content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def test_check_userId1(client): response = client.get('/check?userId=1') assert "True" in response.json def test_check_userId3(client): response = client.get('/check?userId=3') assert "False" in response.json
def test_check_user_id1(client): response = client.get('/check?userId=1') assert 'True' in response.json def test_check_user_id3(client): response = client.get('/check?userId=3') assert 'False' in response.json
# Write your solution for 1.3 here! mysum=0 i=0 while i <= 10000 : i = i+1 mysum = mysum+ i print (mysum)
mysum = 0 i = 0 while i <= 10000: i = i + 1 mysum = mysum + i print(mysum)
config = { "CLIENT_ID": "8", "API_URL": "http://DOMAIN.COM", "PERSONAL_ACCESS_TOKEN": "", "BRIDGE_IP": "192.168.x.x", }
config = {'CLIENT_ID': '8', 'API_URL': 'http://DOMAIN.COM', 'PERSONAL_ACCESS_TOKEN': '', 'BRIDGE_IP': '192.168.x.x'}
load("//bazel/rules/cpp:main.bzl", "cpp_main") load("//bazel/rules/unilang:unilang_to_java.bzl", "unilang_to_java") load("//bazel/rules/code:code_to_java.bzl", "code_to_java") load("//bazel/rules/move_file:move_file.bzl", "move_file") load("//bazel/rules/move_file:move_file_java.bzl", "move_java_file") def transfer_unilang_java(name, path): unilang_to_java(name) move_java_file(name, path)
load('//bazel/rules/cpp:main.bzl', 'cpp_main') load('//bazel/rules/unilang:unilang_to_java.bzl', 'unilang_to_java') load('//bazel/rules/code:code_to_java.bzl', 'code_to_java') load('//bazel/rules/move_file:move_file.bzl', 'move_file') load('//bazel/rules/move_file:move_file_java.bzl', 'move_java_file') def transfer_unilang_java(name, path): unilang_to_java(name) move_java_file(name, path)
getinput = input() def main(): # import pdb; pdb.set_trace() res = [] split_input = list(str(getinput)) for i, _ in enumerate(split_input): if i == len(split_input) - 1: if split_input[i] == split_input[-1]: res.append(int(split_input[i])) else: if split_input[i] == split_input[i + 1]: res.append(int(split_input[i])) return sum(res) print(main())
getinput = input() def main(): res = [] split_input = list(str(getinput)) for (i, _) in enumerate(split_input): if i == len(split_input) - 1: if split_input[i] == split_input[-1]: res.append(int(split_input[i])) elif split_input[i] == split_input[i + 1]: res.append(int(split_input[i])) return sum(res) print(main())
# # PySNMP MIB module H3C-SUBNET-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-SUBNET-VLAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:23:59 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") ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint") h3cCommon, = mibBuilder.importSymbols("HUAWEI-3COM-OID-MIB", "h3cCommon") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Integer32, Gauge32, ObjectIdentity, Counter32, ModuleIdentity, iso, Counter64, TimeTicks, MibIdentifier, Bits, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Integer32", "Gauge32", "ObjectIdentity", "Counter32", "ModuleIdentity", "iso", "Counter64", "TimeTicks", "MibIdentifier", "Bits", "IpAddress") TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString") h3cSubnetVlan = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61)) h3cSubnetVlan.setRevisions(('2005-08-02 13:53',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: h3cSubnetVlan.setRevisionsDescriptions(('The initial revision of this MIB module.',)) if mibBuilder.loadTexts: h3cSubnetVlan.setLastUpdated('200508021353Z') if mibBuilder.loadTexts: h3cSubnetVlan.setOrganization('Huawei 3Com Technology Co., Ltd.') if mibBuilder.loadTexts: h3cSubnetVlan.setContactInfo('Platform Team Huawei 3Com Technology Co., Ltd Hai-Dian District Beijing P.R.China http://www.huawei-3com.com Zip:100085') if mibBuilder.loadTexts: h3cSubnetVlan.setDescription('This MIB contains the objects for managing the subnet-based vlan configurations.') h3cSubnetVlanObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1)) h3cSubnetVlanScalarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1)) h3cSubnetNumAllVlan = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cSubnetNumAllVlan.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumAllVlan.setDescription('The maximum number of subnet that can be configured on all vlans.') h3cSubnetNumPerVlan = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cSubnetNumPerVlan.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumPerVlan.setDescription('The maximum number of subnet that can be configured on each vlan.') h3cSubnetNumAllPort = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cSubnetNumAllPort.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumAllPort.setDescription('The maximum number of subnet that can be applied to all ports.') h3cSubnetNumPerPort = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cSubnetNumPerPort.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumPerPort.setDescription('The maximum number of subnet that can be applied to each port.') h3cSubnetVlanTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2), ) if mibBuilder.loadTexts: h3cSubnetVlanTable.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanTable.setDescription('Subnet-based vlan configuration table.') h3cSubnetVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1), ).setIndexNames((0, "H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanVlanId"), (0, "H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanSubnetIndex")) if mibBuilder.loadTexts: h3cSubnetVlanEntry.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanEntry.setDescription('Subnet-based vlan configuration entry.') h3cSubnetVlanVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 1), Integer32()) if mibBuilder.loadTexts: h3cSubnetVlanVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanVlanId.setDescription('Vlan id.') h3cSubnetVlanSubnetIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 2), Integer32()) if mibBuilder.loadTexts: h3cSubnetVlanSubnetIndex.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanSubnetIndex.setDescription('The subnet index value of a row in this table is from zero to the value of h3cSubnetNumPerVlan subtracting one.') h3cSubnetVlanVlanIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 3), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: h3cSubnetVlanVlanIpAddressType.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanVlanIpAddressType.setDescription('There are two kinds of ip address supported by vlan. One is ipv4, which is 32 bits. The other is ipv6, which is 128 bits.') h3cSubnetVlanIpAddressValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 4), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: h3cSubnetVlanIpAddressValue.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanIpAddressValue.setDescription('The ip address of the configured subnet on vlan, including ipv4 and ipv6.') h3cSubnetVlanNetMaskValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 5), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: h3cSubnetVlanNetMaskValue.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanNetMaskValue.setDescription('The net mask of the configured subnet on vlan, including ipv4 and ipv6.') h3cSubnetVlanRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: h3cSubnetVlanRowStatus.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanRowStatus.setDescription('The row status of this table.') h3cSubnetVlanPortCreateTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3), ) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateTable.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateTable.setDescription('Subnet-based vlan port table. Add all subnet on vlan whose vlan id is h3cSubnetVlanPortInfoVlanId into port at a draught. All of the subnet information in this port is from the h3cSubnetVlanTable above, with the value of h3cSubnetVlanPortInfoVlanId as an index, which is h3cSubnetVlanVlanId in h3cSubnetVlanTable.') h3cSubnetVlanPortCreateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1), ).setIndexNames((0, "H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanPortCreateIndex"), (0, "H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanPortCreateVlanId")) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateEntry.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateEntry.setDescription('Subnet-based vlan port create entry.') h3cSubnetVlanPortCreateIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 1), Integer32()) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateIndex.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateIndex.setDescription('The port index.') h3cSubnetVlanPortCreateVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 2), Integer32()) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateVlanId.setDescription('The subnet-based vlan id. h3cSubnetVlanPortCreateVlanId refers to h3cSubnetVlanVlanId in h3cSubnetVlanTable. If h3cSubnetVlanPortCreateVlanId has no corresponding entry in h3cSubnetVlanTable, set operation will fail.') h3cSubnetVlanPortInfoVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cSubnetVlanPortInfoVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortInfoVlanId.setDescription('This vlaue is the same as the value of h3cSubnetVlanPortCreateVlanId index. All of the subnet information in this port, is described on vlan, whose vlan id is the value of h3cSubnetVlanPortInfoVlanId. The vlan id of vlan including subnet information can be gotten here. The subnet information can be gotten in the h3cSubnetVlanTable above.') h3cSubnetVlanPortRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: h3cSubnetVlanPortRowStatus.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortRowStatus.setDescription('The row status of this table.') h3cSubnetVlanConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2)) h3cSubnetVlanCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 1)) h3cSubnetVlanCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 1, 1)).setObjects(("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanScalarObjectGroup"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanSubnetGroup"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanPortCreateGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cSubnetVlanCompliance = h3cSubnetVlanCompliance.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanCompliance.setDescription('The compliance statement for subnet vlan MIB.') h3cSubnetVlanGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2)) h3cSubnetVlanScalarObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 1)).setObjects(("H3C-SUBNET-VLAN-MIB", "h3cSubnetNumAllVlan"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetNumPerVlan"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetNumAllPort"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetNumPerPort")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cSubnetVlanScalarObjectGroup = h3cSubnetVlanScalarObjectGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanScalarObjectGroup.setDescription('A group of scalar objects describing the maximum number.') h3cSubnetVlanSubnetGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 2)).setObjects(("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanVlanIpAddressType"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanIpAddressValue"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanNetMaskValue"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cSubnetVlanSubnetGroup = h3cSubnetVlanSubnetGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanSubnetGroup.setDescription('A group of subnet vlan subnet.') h3cSubnetVlanPortCreateGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 3)).setObjects(("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanPortInfoVlanId"), ("H3C-SUBNET-VLAN-MIB", "h3cSubnetVlanPortRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cSubnetVlanPortCreateGroup = h3cSubnetVlanPortCreateGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateGroup.setDescription('A group of subnet vlan port create table.') mibBuilder.exportSymbols("H3C-SUBNET-VLAN-MIB", h3cSubnetVlanScalarObjectGroup=h3cSubnetVlanScalarObjectGroup, h3cSubnetVlan=h3cSubnetVlan, h3cSubnetVlanSubnetGroup=h3cSubnetVlanSubnetGroup, h3cSubnetVlanSubnetIndex=h3cSubnetVlanSubnetIndex, h3cSubnetNumPerVlan=h3cSubnetNumPerVlan, h3cSubnetVlanScalarObjects=h3cSubnetVlanScalarObjects, h3cSubnetVlanNetMaskValue=h3cSubnetVlanNetMaskValue, h3cSubnetVlanCompliances=h3cSubnetVlanCompliances, h3cSubnetVlanPortCreateEntry=h3cSubnetVlanPortCreateEntry, h3cSubnetVlanObjects=h3cSubnetVlanObjects, h3cSubnetNumAllVlan=h3cSubnetNumAllVlan, h3cSubnetVlanPortCreateTable=h3cSubnetVlanPortCreateTable, h3cSubnetVlanVlanIpAddressType=h3cSubnetVlanVlanIpAddressType, h3cSubnetNumAllPort=h3cSubnetNumAllPort, h3cSubnetVlanCompliance=h3cSubnetVlanCompliance, h3cSubnetVlanPortCreateVlanId=h3cSubnetVlanPortCreateVlanId, h3cSubnetNumPerPort=h3cSubnetNumPerPort, h3cSubnetVlanRowStatus=h3cSubnetVlanRowStatus, h3cSubnetVlanVlanId=h3cSubnetVlanVlanId, h3cSubnetVlanTable=h3cSubnetVlanTable, h3cSubnetVlanPortCreateGroup=h3cSubnetVlanPortCreateGroup, h3cSubnetVlanPortInfoVlanId=h3cSubnetVlanPortInfoVlanId, PYSNMP_MODULE_ID=h3cSubnetVlan, h3cSubnetVlanPortRowStatus=h3cSubnetVlanPortRowStatus, h3cSubnetVlanPortCreateIndex=h3cSubnetVlanPortCreateIndex, h3cSubnetVlanGroups=h3cSubnetVlanGroups, h3cSubnetVlanEntry=h3cSubnetVlanEntry, h3cSubnetVlanConformance=h3cSubnetVlanConformance, h3cSubnetVlanIpAddressValue=h3cSubnetVlanIpAddressValue)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint') (h3c_common,) = mibBuilder.importSymbols('HUAWEI-3COM-OID-MIB', 'h3cCommon') (inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress') (module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup') (unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, integer32, gauge32, object_identity, counter32, module_identity, iso, counter64, time_ticks, mib_identifier, bits, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Integer32', 'Gauge32', 'ObjectIdentity', 'Counter32', 'ModuleIdentity', 'iso', 'Counter64', 'TimeTicks', 'MibIdentifier', 'Bits', 'IpAddress') (textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'DisplayString') h3c_subnet_vlan = module_identity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61)) h3cSubnetVlan.setRevisions(('2005-08-02 13:53',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: h3cSubnetVlan.setRevisionsDescriptions(('The initial revision of this MIB module.',)) if mibBuilder.loadTexts: h3cSubnetVlan.setLastUpdated('200508021353Z') if mibBuilder.loadTexts: h3cSubnetVlan.setOrganization('Huawei 3Com Technology Co., Ltd.') if mibBuilder.loadTexts: h3cSubnetVlan.setContactInfo('Platform Team Huawei 3Com Technology Co., Ltd Hai-Dian District Beijing P.R.China http://www.huawei-3com.com Zip:100085') if mibBuilder.loadTexts: h3cSubnetVlan.setDescription('This MIB contains the objects for managing the subnet-based vlan configurations.') h3c_subnet_vlan_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1)) h3c_subnet_vlan_scalar_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1)) h3c_subnet_num_all_vlan = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cSubnetNumAllVlan.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumAllVlan.setDescription('The maximum number of subnet that can be configured on all vlans.') h3c_subnet_num_per_vlan = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cSubnetNumPerVlan.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumPerVlan.setDescription('The maximum number of subnet that can be configured on each vlan.') h3c_subnet_num_all_port = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cSubnetNumAllPort.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumAllPort.setDescription('The maximum number of subnet that can be applied to all ports.') h3c_subnet_num_per_port = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cSubnetNumPerPort.setStatus('current') if mibBuilder.loadTexts: h3cSubnetNumPerPort.setDescription('The maximum number of subnet that can be applied to each port.') h3c_subnet_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2)) if mibBuilder.loadTexts: h3cSubnetVlanTable.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanTable.setDescription('Subnet-based vlan configuration table.') h3c_subnet_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1)).setIndexNames((0, 'H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanVlanId'), (0, 'H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanSubnetIndex')) if mibBuilder.loadTexts: h3cSubnetVlanEntry.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanEntry.setDescription('Subnet-based vlan configuration entry.') h3c_subnet_vlan_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 1), integer32()) if mibBuilder.loadTexts: h3cSubnetVlanVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanVlanId.setDescription('Vlan id.') h3c_subnet_vlan_subnet_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 2), integer32()) if mibBuilder.loadTexts: h3cSubnetVlanSubnetIndex.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanSubnetIndex.setDescription('The subnet index value of a row in this table is from zero to the value of h3cSubnetNumPerVlan subtracting one.') h3c_subnet_vlan_vlan_ip_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 3), inet_address_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: h3cSubnetVlanVlanIpAddressType.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanVlanIpAddressType.setDescription('There are two kinds of ip address supported by vlan. One is ipv4, which is 32 bits. The other is ipv6, which is 128 bits.') h3c_subnet_vlan_ip_address_value = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 4), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: h3cSubnetVlanIpAddressValue.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanIpAddressValue.setDescription('The ip address of the configured subnet on vlan, including ipv4 and ipv6.') h3c_subnet_vlan_net_mask_value = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 5), inet_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: h3cSubnetVlanNetMaskValue.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanNetMaskValue.setDescription('The net mask of the configured subnet on vlan, including ipv4 and ipv6.') h3c_subnet_vlan_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 2, 1, 6), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: h3cSubnetVlanRowStatus.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanRowStatus.setDescription('The row status of this table.') h3c_subnet_vlan_port_create_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3)) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateTable.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateTable.setDescription('Subnet-based vlan port table. Add all subnet on vlan whose vlan id is h3cSubnetVlanPortInfoVlanId into port at a draught. All of the subnet information in this port is from the h3cSubnetVlanTable above, with the value of h3cSubnetVlanPortInfoVlanId as an index, which is h3cSubnetVlanVlanId in h3cSubnetVlanTable.') h3c_subnet_vlan_port_create_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1)).setIndexNames((0, 'H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanPortCreateIndex'), (0, 'H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanPortCreateVlanId')) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateEntry.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateEntry.setDescription('Subnet-based vlan port create entry.') h3c_subnet_vlan_port_create_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 1), integer32()) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateIndex.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateIndex.setDescription('The port index.') h3c_subnet_vlan_port_create_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 2), integer32()) if mibBuilder.loadTexts: h3cSubnetVlanPortCreateVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateVlanId.setDescription('The subnet-based vlan id. h3cSubnetVlanPortCreateVlanId refers to h3cSubnetVlanVlanId in h3cSubnetVlanTable. If h3cSubnetVlanPortCreateVlanId has no corresponding entry in h3cSubnetVlanTable, set operation will fail.') h3c_subnet_vlan_port_info_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cSubnetVlanPortInfoVlanId.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortInfoVlanId.setDescription('This vlaue is the same as the value of h3cSubnetVlanPortCreateVlanId index. All of the subnet information in this port, is described on vlan, whose vlan id is the value of h3cSubnetVlanPortInfoVlanId. The vlan id of vlan including subnet information can be gotten here. The subnet information can be gotten in the h3cSubnetVlanTable above.') h3c_subnet_vlan_port_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 1, 3, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: h3cSubnetVlanPortRowStatus.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortRowStatus.setDescription('The row status of this table.') h3c_subnet_vlan_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2)) h3c_subnet_vlan_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 1)) h3c_subnet_vlan_compliance = module_compliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 1, 1)).setObjects(('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanScalarObjectGroup'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanSubnetGroup'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanPortCreateGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_subnet_vlan_compliance = h3cSubnetVlanCompliance.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanCompliance.setDescription('The compliance statement for subnet vlan MIB.') h3c_subnet_vlan_groups = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2)) h3c_subnet_vlan_scalar_object_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 1)).setObjects(('H3C-SUBNET-VLAN-MIB', 'h3cSubnetNumAllVlan'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetNumPerVlan'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetNumAllPort'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetNumPerPort')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_subnet_vlan_scalar_object_group = h3cSubnetVlanScalarObjectGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanScalarObjectGroup.setDescription('A group of scalar objects describing the maximum number.') h3c_subnet_vlan_subnet_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 2)).setObjects(('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanVlanIpAddressType'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanIpAddressValue'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanNetMaskValue'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanRowStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_subnet_vlan_subnet_group = h3cSubnetVlanSubnetGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanSubnetGroup.setDescription('A group of subnet vlan subnet.') h3c_subnet_vlan_port_create_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 61, 2, 2, 3)).setObjects(('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanPortInfoVlanId'), ('H3C-SUBNET-VLAN-MIB', 'h3cSubnetVlanPortRowStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_subnet_vlan_port_create_group = h3cSubnetVlanPortCreateGroup.setStatus('current') if mibBuilder.loadTexts: h3cSubnetVlanPortCreateGroup.setDescription('A group of subnet vlan port create table.') mibBuilder.exportSymbols('H3C-SUBNET-VLAN-MIB', h3cSubnetVlanScalarObjectGroup=h3cSubnetVlanScalarObjectGroup, h3cSubnetVlan=h3cSubnetVlan, h3cSubnetVlanSubnetGroup=h3cSubnetVlanSubnetGroup, h3cSubnetVlanSubnetIndex=h3cSubnetVlanSubnetIndex, h3cSubnetNumPerVlan=h3cSubnetNumPerVlan, h3cSubnetVlanScalarObjects=h3cSubnetVlanScalarObjects, h3cSubnetVlanNetMaskValue=h3cSubnetVlanNetMaskValue, h3cSubnetVlanCompliances=h3cSubnetVlanCompliances, h3cSubnetVlanPortCreateEntry=h3cSubnetVlanPortCreateEntry, h3cSubnetVlanObjects=h3cSubnetVlanObjects, h3cSubnetNumAllVlan=h3cSubnetNumAllVlan, h3cSubnetVlanPortCreateTable=h3cSubnetVlanPortCreateTable, h3cSubnetVlanVlanIpAddressType=h3cSubnetVlanVlanIpAddressType, h3cSubnetNumAllPort=h3cSubnetNumAllPort, h3cSubnetVlanCompliance=h3cSubnetVlanCompliance, h3cSubnetVlanPortCreateVlanId=h3cSubnetVlanPortCreateVlanId, h3cSubnetNumPerPort=h3cSubnetNumPerPort, h3cSubnetVlanRowStatus=h3cSubnetVlanRowStatus, h3cSubnetVlanVlanId=h3cSubnetVlanVlanId, h3cSubnetVlanTable=h3cSubnetVlanTable, h3cSubnetVlanPortCreateGroup=h3cSubnetVlanPortCreateGroup, h3cSubnetVlanPortInfoVlanId=h3cSubnetVlanPortInfoVlanId, PYSNMP_MODULE_ID=h3cSubnetVlan, h3cSubnetVlanPortRowStatus=h3cSubnetVlanPortRowStatus, h3cSubnetVlanPortCreateIndex=h3cSubnetVlanPortCreateIndex, h3cSubnetVlanGroups=h3cSubnetVlanGroups, h3cSubnetVlanEntry=h3cSubnetVlanEntry, h3cSubnetVlanConformance=h3cSubnetVlanConformance, h3cSubnetVlanIpAddressValue=h3cSubnetVlanIpAddressValue)
class User: # create the class attributes n_active = 0 users = [] # create the __init__ method def __init__(self, active, user_name): self.active = active self.user_name = user_name
class User: n_active = 0 users = [] def __init__(self, active, user_name): self.active = active self.user_name = user_name
class DatabaseError(Exception): pass class GameError(Exception): pass
class Databaseerror(Exception): pass class Gameerror(Exception): pass
lst = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) def sequential__search(lst_, num): for i in lst_: if i == num: print() print(i) return print() print() print(f"{num} does not exist in the given list") print() return False sequential__search(lst, 10)
lst = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) def sequential__search(lst_, num): for i in lst_: if i == num: print() print(i) return print() print() print(f'{num} does not exist in the given list') print() return False sequential__search(lst, 10)
def is_credit_card_valid(number): length = len(number) if length % 2 == 0: return False new_number = '' rev = number[::-1] for index in range(0,length): if index % 2 == 0: new_number += rev[index] else: new_number += (str)((int)(rev[index]) + (int)(rev[index])) return sum(map(int, list(new_number))) % 10 == 0 def main(): print(is_credit_card_valid('79927398713')) # Expected output : VALID (True) print(is_credit_card_valid('79927398715')) # Expected output : INVALID (False) if __name__ == '__main__': main()
def is_credit_card_valid(number): length = len(number) if length % 2 == 0: return False new_number = '' rev = number[::-1] for index in range(0, length): if index % 2 == 0: new_number += rev[index] else: new_number += str(int(rev[index]) + int(rev[index])) return sum(map(int, list(new_number))) % 10 == 0 def main(): print(is_credit_card_valid('79927398713')) print(is_credit_card_valid('79927398715')) if __name__ == '__main__': main()
BNB_BASE_URL = "https://www.bnb.bg/Statistics/StExternalSector/StExchangeRates/StERForeignCurrencies/index.htm?" BNB_DATE_FORMAT = "%d.%m.%Y" BNB_SPLIT_BY_MONTHS = 3 BNB_CSV_HEADER_ROWS = 2 NAP_DIGIT_PRECISION = "0.01" NAP_DATE_FORMAT = "%Y-%m-%d" NAP_DIVIDEND_TAX = "0.05" RECEIVED_DIVIDEND_ACTIVITY_TYPES = ["DIV", "DIVIDEND", "DIVCGL", "DIVCGS", "DIVROC", "DIVTXEX"] TAX_DIVIDEND_ACTIVITY_TYPES = ["DIVNRA", "DIVFT", "DIVTW"]
bnb_base_url = 'https://www.bnb.bg/Statistics/StExternalSector/StExchangeRates/StERForeignCurrencies/index.htm?' bnb_date_format = '%d.%m.%Y' bnb_split_by_months = 3 bnb_csv_header_rows = 2 nap_digit_precision = '0.01' nap_date_format = '%Y-%m-%d' nap_dividend_tax = '0.05' received_dividend_activity_types = ['DIV', 'DIVIDEND', 'DIVCGL', 'DIVCGS', 'DIVROC', 'DIVTXEX'] tax_dividend_activity_types = ['DIVNRA', 'DIVFT', 'DIVTW']
class Matcher: def matches(self, arg): pass class Any(Matcher): def __init__(self, wanted_type=None): self.wanted_type = wanted_type def matches(self, arg): if self.wanted_type: return isinstance(arg, self.wanted_type) else: return True def __repr__(self): return "<Any: %s>" % self.wanted_type class Contains(Matcher): def __init__(self, sub): self.sub = sub def matches(self, arg): if not hasattr(arg, 'find'): return return self.sub and len(self.sub) > 0 and arg.find(self.sub) > -1 def __repr__(self): return "<Contains: '%s'>" % self.sub
class Matcher: def matches(self, arg): pass class Any(Matcher): def __init__(self, wanted_type=None): self.wanted_type = wanted_type def matches(self, arg): if self.wanted_type: return isinstance(arg, self.wanted_type) else: return True def __repr__(self): return '<Any: %s>' % self.wanted_type class Contains(Matcher): def __init__(self, sub): self.sub = sub def matches(self, arg): if not hasattr(arg, 'find'): return return self.sub and len(self.sub) > 0 and (arg.find(self.sub) > -1) def __repr__(self): return "<Contains: '%s'>" % self.sub
print("The elementary reactions are:") print(" Reaction 1: the birth of susceptible individuals with propensity b") print(" Reaction 2: their death with propensity mu_S*S(t)") print(" Reaction 3: their infection with propensity beta * S(t)*I(t)") print(" Reaction 4: the death of infected individuals with propensity mu_I*I(t) with mu_I>mu_S") print(" Reaction 5: the recovery of infected individuals with rate alpha * I(t)") print(" Reaction 6: the death of recovered individuals with propensity mu_R*R(t), with mu_R<mu_I.")
print('The elementary reactions are:') print(' Reaction 1: the birth of susceptible individuals with propensity b') print(' Reaction 2: their death with propensity mu_S*S(t)') print(' Reaction 3: their infection with propensity beta * S(t)*I(t)') print(' Reaction 4: the death of infected individuals with propensity mu_I*I(t) with mu_I>mu_S') print(' Reaction 5: the recovery of infected individuals with rate alpha * I(t)') print(' Reaction 6: the death of recovered individuals with propensity mu_R*R(t), with mu_R<mu_I.')
def baz(x): if x < 0: baz(x) else: baz(x)
def baz(x): if x < 0: baz(x) else: baz(x)
TABLES = {'Network': [['f_name', 'TEXT'], ['scenariodate', 'TEXT'], ['stopthresholdspeed', 'TEXT'], ['growth', 'TEXT'], ['defwidth', 'TEXT'], ['pedspeed', 'TEXT'], ['phf', 'TEXT'], ['vehlength', 'TEXT'], ['criticalmergegap', 'TEXT'], ['hv', 'TEXT'], ['followuptime', 'TEXT'], ['utdfversion', 'TEXT'], ['dontwalk', 'TEXT'], ['allredtime', 'TEXT'], ['losttimeadjust', 'TEXT'], ['walk', 'TEXT'], ['defflow', 'TEXT'], ['metric', 'TEXT'], ['criticalgap', 'TEXT'], ['heavyvehlength', 'TEXT'], ['yellowtime', 'TEXT'], ['scenariotime', 'TEXT']], 'Nodes': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['type', 'TEXT'], ['x', 'TEXT'], ['y', 'TEXT'], ['z', 'TEXT'], ['description', 'TEXT'], ['cbd', 'TEXT'], ['inside_radius', 'TEXT'], ['outside_radius', 'TEXT'], ['roundabout_lanes', 'TEXT'], ['circle_speed', 'TEXT']], 'Links': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['median', 'TEXT'], ['name', 'TEXT'], ['time', 'TEXT'], ['grade', 'TEXT'], ['curve_pt_x', 'TEXT'], ['mandatory_distance', 'TEXT'], ['up_id', 'TEXT'], ['speed', 'TEXT'], ['lanes', 'TEXT'], ['link_is_hidden', 'TEXT'], ['street_name_is_hidden', 'TEXT'], ['crosswalk_width', 'TEXT'], ['distance', 'TEXT'], ['twltl', 'TEXT'], ['positioning_distance2', 'TEXT'], ['curve_pt_y', 'TEXT'], ['mandatory_distance2', 'TEXT'], ['offset', 'TEXT'], ['positioning_distance', 'TEXT'], ['curve_pt_z', 'TEXT']], 'Lanes': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['lane_group_flow', 'TEXT'], ['storage', 'TEXT'], ['switchphase', 'TEXT'], ['alignment', 'TEXT'], ['right_radius', 'TEXT'], ['bicycles', 'TEXT'], ['taper', 'TEXT'], ['detectsize1', 'TEXT'], ['heavyvehicles', 'TEXT'], ['turning_speed', 'TEXT'], ['up_node', 'TEXT'], ['right_channeled', 'TEXT'], ['detecttype1', 'TEXT'], ['satflowrtor', 'TEXT'], ['stlanes', 'TEXT'], ['midblock', 'TEXT'], ['detectphase4', 'TEXT'], ['detectqueue1', 'TEXT'], ['detectdelay1', 'TEXT'], ['detectpos2', 'TEXT'], ['busstops', 'TEXT'], ['enter_blocked', 'TEXT'], ['traffic_in_shared_lane', 'TEXT'], ['exit_lanes', 'TEXT'], ['satflow', 'TEXT'], ['detectphase1', 'TEXT'], ['numdetects', 'TEXT'], ['traveltime', 'TEXT'], ['distance', 'TEXT'], ['permphase1', 'TEXT'], ['shared', 'TEXT'], ['phase1', 'TEXT'], ['grade', 'TEXT'], ['width', 'TEXT'], ['allow_rtor', 'TEXT'], ['add_lanes', 'TEXT'], ['lost_time_adjust', 'TEXT'], ['speed', 'TEXT'], ['peds', 'TEXT'], ['detectextend2', 'TEXT'], ['firstdetect', 'TEXT'], ['lanes', 'TEXT'], ['detectsize2', 'TEXT'], ['growth', 'TEXT'], ['detecttype2', 'TEXT'], ['detectphase2', 'TEXT'], ['volume', 'TEXT'], ['signcontrol', 'TEXT'], ['detectextend1', 'TEXT'], ['detectphase3', 'TEXT'], ['detectpos1', 'TEXT'], ['satflowperm', 'TEXT'], ['phf', 'TEXT'], ['headwayfact', 'TEXT'], ['cbd', 'TEXT'], ['lastdetect', 'TEXT'], ['losttime', 'TEXT'], ['dest_node', 'TEXT'], ['idealflow', 'TEXT'], ['phase2', 'TEXT']], 'Timeplans': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['master', 'TEXT'], ['lock_timings', 'TEXT'], ['control_type', 'TEXT'], ['yield', 'TEXT'], ['cycle_length', 'TEXT'], ['node_0', 'TEXT'], ['node_1', 'TEXT'], ['reference_phase', 'TEXT'], ['referenced_to', 'TEXT'], ['offset', 'TEXT']], 'Phases': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['mingreen', 'TEXT'], ['timetoreduce', 'TEXT'], ['actgreen', 'TEXT'], ['end', 'TEXT'], ['allred', 'TEXT'], ['localyield170', 'TEXT'], ['recall', 'TEXT'], ['minsplit', 'TEXT'], ['localstart', 'TEXT'], ['dontwalk', 'TEXT'], ['yield170', 'TEXT'], ['localyield', 'TEXT'], ['timebeforereduce', 'TEXT'], ['brp', 'TEXT'], ['inhibitmax', 'TEXT'], ['yellow', 'TEXT'], ['start', 'TEXT'], ['yield', 'TEXT'], ['vehext', 'TEXT'], ['pedcalls', 'TEXT'], ['maxgreen', 'TEXT'], ['dualentry', 'TEXT'], ['walk', 'TEXT'], ['mingap', 'TEXT']]}
tables = {'Network': [['f_name', 'TEXT'], ['scenariodate', 'TEXT'], ['stopthresholdspeed', 'TEXT'], ['growth', 'TEXT'], ['defwidth', 'TEXT'], ['pedspeed', 'TEXT'], ['phf', 'TEXT'], ['vehlength', 'TEXT'], ['criticalmergegap', 'TEXT'], ['hv', 'TEXT'], ['followuptime', 'TEXT'], ['utdfversion', 'TEXT'], ['dontwalk', 'TEXT'], ['allredtime', 'TEXT'], ['losttimeadjust', 'TEXT'], ['walk', 'TEXT'], ['defflow', 'TEXT'], ['metric', 'TEXT'], ['criticalgap', 'TEXT'], ['heavyvehlength', 'TEXT'], ['yellowtime', 'TEXT'], ['scenariotime', 'TEXT']], 'Nodes': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['type', 'TEXT'], ['x', 'TEXT'], ['y', 'TEXT'], ['z', 'TEXT'], ['description', 'TEXT'], ['cbd', 'TEXT'], ['inside_radius', 'TEXT'], ['outside_radius', 'TEXT'], ['roundabout_lanes', 'TEXT'], ['circle_speed', 'TEXT']], 'Links': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['median', 'TEXT'], ['name', 'TEXT'], ['time', 'TEXT'], ['grade', 'TEXT'], ['curve_pt_x', 'TEXT'], ['mandatory_distance', 'TEXT'], ['up_id', 'TEXT'], ['speed', 'TEXT'], ['lanes', 'TEXT'], ['link_is_hidden', 'TEXT'], ['street_name_is_hidden', 'TEXT'], ['crosswalk_width', 'TEXT'], ['distance', 'TEXT'], ['twltl', 'TEXT'], ['positioning_distance2', 'TEXT'], ['curve_pt_y', 'TEXT'], ['mandatory_distance2', 'TEXT'], ['offset', 'TEXT'], ['positioning_distance', 'TEXT'], ['curve_pt_z', 'TEXT']], 'Lanes': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['lane_group_flow', 'TEXT'], ['storage', 'TEXT'], ['switchphase', 'TEXT'], ['alignment', 'TEXT'], ['right_radius', 'TEXT'], ['bicycles', 'TEXT'], ['taper', 'TEXT'], ['detectsize1', 'TEXT'], ['heavyvehicles', 'TEXT'], ['turning_speed', 'TEXT'], ['up_node', 'TEXT'], ['right_channeled', 'TEXT'], ['detecttype1', 'TEXT'], ['satflowrtor', 'TEXT'], ['stlanes', 'TEXT'], ['midblock', 'TEXT'], ['detectphase4', 'TEXT'], ['detectqueue1', 'TEXT'], ['detectdelay1', 'TEXT'], ['detectpos2', 'TEXT'], ['busstops', 'TEXT'], ['enter_blocked', 'TEXT'], ['traffic_in_shared_lane', 'TEXT'], ['exit_lanes', 'TEXT'], ['satflow', 'TEXT'], ['detectphase1', 'TEXT'], ['numdetects', 'TEXT'], ['traveltime', 'TEXT'], ['distance', 'TEXT'], ['permphase1', 'TEXT'], ['shared', 'TEXT'], ['phase1', 'TEXT'], ['grade', 'TEXT'], ['width', 'TEXT'], ['allow_rtor', 'TEXT'], ['add_lanes', 'TEXT'], ['lost_time_adjust', 'TEXT'], ['speed', 'TEXT'], ['peds', 'TEXT'], ['detectextend2', 'TEXT'], ['firstdetect', 'TEXT'], ['lanes', 'TEXT'], ['detectsize2', 'TEXT'], ['growth', 'TEXT'], ['detecttype2', 'TEXT'], ['detectphase2', 'TEXT'], ['volume', 'TEXT'], ['signcontrol', 'TEXT'], ['detectextend1', 'TEXT'], ['detectphase3', 'TEXT'], ['detectpos1', 'TEXT'], ['satflowperm', 'TEXT'], ['phf', 'TEXT'], ['headwayfact', 'TEXT'], ['cbd', 'TEXT'], ['lastdetect', 'TEXT'], ['losttime', 'TEXT'], ['dest_node', 'TEXT'], ['idealflow', 'TEXT'], ['phase2', 'TEXT']], 'Timeplans': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['master', 'TEXT'], ['lock_timings', 'TEXT'], ['control_type', 'TEXT'], ['yield', 'TEXT'], ['cycle_length', 'TEXT'], ['node_0', 'TEXT'], ['node_1', 'TEXT'], ['reference_phase', 'TEXT'], ['referenced_to', 'TEXT'], ['offset', 'TEXT']], 'Phases': [['f_name', 'TEXT'], ['intid', 'TEXT'], ['direction', 'TEXT'], ['mingreen', 'TEXT'], ['timetoreduce', 'TEXT'], ['actgreen', 'TEXT'], ['end', 'TEXT'], ['allred', 'TEXT'], ['localyield170', 'TEXT'], ['recall', 'TEXT'], ['minsplit', 'TEXT'], ['localstart', 'TEXT'], ['dontwalk', 'TEXT'], ['yield170', 'TEXT'], ['localyield', 'TEXT'], ['timebeforereduce', 'TEXT'], ['brp', 'TEXT'], ['inhibitmax', 'TEXT'], ['yellow', 'TEXT'], ['start', 'TEXT'], ['yield', 'TEXT'], ['vehext', 'TEXT'], ['pedcalls', 'TEXT'], ['maxgreen', 'TEXT'], ['dualentry', 'TEXT'], ['walk', 'TEXT'], ['mingap', 'TEXT']]}
class TxInfo: def __init__(self, txid, timestamp, fee, fee_currency, wallet_address, exchange, url): self.txid = txid self.timestamp = timestamp self.fee = fee self.fee_currency = fee_currency self.wallet_address = wallet_address self.exchange = exchange self.url = url self.comment = ""
class Txinfo: def __init__(self, txid, timestamp, fee, fee_currency, wallet_address, exchange, url): self.txid = txid self.timestamp = timestamp self.fee = fee self.fee_currency = fee_currency self.wallet_address = wallet_address self.exchange = exchange self.url = url self.comment = ''
'''https://practice.geeksforgeeks.org/problems/multiply-two-linked-lists/1 Multiply two linked lists Easy Accuracy: 38.67% Submissions: 24824 Points: 2 Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L1 and L2. Note: The output could be large take modulo 109+7. Input: The first line of input contains an integer T denoting the number of test cases. Then T test cases follow, the first line of each test case contains an integer N denoting the size of the first linked list (L1). In the next line are the space separated values of the first linked list. The third line of each test case contains an integer M denoting the size of the second linked list (L2). In the forth line are space separated values of the second linked list. Output: For each test case output will be an integer denoting the product of the two linked list. User Task: The task is to complete the function multiplyTwoLists() which should multiply the given two linked lists and return the result. Constraints: 1 <= T <= 100 1 <= N, M <= 100 Example: Input: 2 2 3 2 1 2 3 1 0 0 2 1 0 Output: 64 1000 Explanation: Testcase 1: 32*2 = 64. Testcase 2: 100*10 = 1000.''' MOD = 10**9+7 # your task is to complete this function # Function should return an integer value # head1 denotes head node of 1st list # head2 denotes head node of 2nd list ''' class node: def __init__(self): self.data = None self.next = None ''' def multiplyTwoList(head1, head2): num1 = 0 num2 = 0 while head1 or head2: if head1: num1 = (num1*10+head1.data) % MOD head1 = head1.next if head2: num2 = (num2*10+head2. data) % MOD head2 = head2.next return (num1 % MOD*num2 % MOD) % MOD # { # Driver Code Starts class node: def __init__(self): self.data = None self.next = None class Linked_List: def __init__(self): self.head = None def get_head(self): return self.head def insert(self, data): if self.head == None: self.head = node() self.head.data = data else: new_node = node() new_node.data = data new_node.next = None temp = self.head while(temp.next): temp = temp.next temp.next = new_node def printlist(ptr): while ptr != None: print(ptr.data, end=" ") ptr = ptr.next if __name__ == '__main__': t = int(input()) for i in range(t): list1 = Linked_List() n = int(input()) values = list(map(int, input().strip().split())) for i in values: list1.insert(i) # printlist(list1.get_head()) # print '' list2 = Linked_List() n = int(input()) values = list(map(int, input().strip().split())) for i in values: list2.insert(i) # printlist(list2.get_head()) # print '' print(multiplyTwoList(list1.get_head(), list2.get_head())) # } Driver Code Ends
"""https://practice.geeksforgeeks.org/problems/multiply-two-linked-lists/1 Multiply two linked lists Easy Accuracy: 38.67% Submissions: 24824 Points: 2 Given elements as nodes of the two linked lists. The task is to multiply these two linked lists, say L1 and L2. Note: The output could be large take modulo 109+7. Input: The first line of input contains an integer T denoting the number of test cases. Then T test cases follow, the first line of each test case contains an integer N denoting the size of the first linked list (L1). In the next line are the space separated values of the first linked list. The third line of each test case contains an integer M denoting the size of the second linked list (L2). In the forth line are space separated values of the second linked list. Output: For each test case output will be an integer denoting the product of the two linked list. User Task: The task is to complete the function multiplyTwoLists() which should multiply the given two linked lists and return the result. Constraints: 1 <= T <= 100 1 <= N, M <= 100 Example: Input: 2 2 3 2 1 2 3 1 0 0 2 1 0 Output: 64 1000 Explanation: Testcase 1: 32*2 = 64. Testcase 2: 100*10 = 1000.""" mod = 10 ** 9 + 7 '\nclass node:\n def __init__(self):\n self.data = None\n self.next = None\n' def multiply_two_list(head1, head2): num1 = 0 num2 = 0 while head1 or head2: if head1: num1 = (num1 * 10 + head1.data) % MOD head1 = head1.next if head2: num2 = (num2 * 10 + head2.data) % MOD head2 = head2.next return num1 % MOD * num2 % MOD % MOD class Node: def __init__(self): self.data = None self.next = None class Linked_List: def __init__(self): self.head = None def get_head(self): return self.head def insert(self, data): if self.head == None: self.head = node() self.head.data = data else: new_node = node() new_node.data = data new_node.next = None temp = self.head while temp.next: temp = temp.next temp.next = new_node def printlist(ptr): while ptr != None: print(ptr.data, end=' ') ptr = ptr.next if __name__ == '__main__': t = int(input()) for i in range(t): list1 = linked__list() n = int(input()) values = list(map(int, input().strip().split())) for i in values: list1.insert(i) list2 = linked__list() n = int(input()) values = list(map(int, input().strip().split())) for i in values: list2.insert(i) print(multiply_two_list(list1.get_head(), list2.get_head()))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def numComponents(self, head: ListNode, G: List[int]) -> int: ans = 0 G_set = set(G) cur = head while cur: if cur.val in G_set and (not cur.next or cur.next.val not in G_set): ans += 1 cur = cur.next return ans
class Solution: def num_components(self, head: ListNode, G: List[int]) -> int: ans = 0 g_set = set(G) cur = head while cur: if cur.val in G_set and (not cur.next or cur.next.val not in G_set): ans += 1 cur = cur.next return ans
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Rock Paper Scissors! #Problem level: 8 kyu def rps(p1, p2): if p1[0]=='r' and p2[0]=='s': return "Player 1 won!" if p1[0]=='s' and p2[0]=='p': return "Player 1 won!" if p1[0]=='p' and p2[0]=='r': return "Player 1 won!" if p2[0]=='r' and p1[0]=='s': return "Player 2 won!" if p2[0]=='s' and p1[0]=='p': return "Player 2 won!" if p2[0]=='p' and p1[0]=='r': return "Player 2 won!" if p1==p2: return 'Draw!'
def rps(p1, p2): if p1[0] == 'r' and p2[0] == 's': return 'Player 1 won!' if p1[0] == 's' and p2[0] == 'p': return 'Player 1 won!' if p1[0] == 'p' and p2[0] == 'r': return 'Player 1 won!' if p2[0] == 'r' and p1[0] == 's': return 'Player 2 won!' if p2[0] == 's' and p1[0] == 'p': return 'Player 2 won!' if p2[0] == 'p' and p1[0] == 'r': return 'Player 2 won!' if p1 == p2: return 'Draw!'
class ArgsTest: def __init__(self, key:str=None, value:str=None, max_age=None, expires=None, path:str=None, domain:str=None, secure:bool=False, httponly:bool=False, sync_expires:bool=True, comment:str=None, version:int=None): pass class Sub(ArgsTest): pass
class Argstest: def __init__(self, key: str=None, value: str=None, max_age=None, expires=None, path: str=None, domain: str=None, secure: bool=False, httponly: bool=False, sync_expires: bool=True, comment: str=None, version: int=None): pass class Sub(ArgsTest): pass
def roll_new(name, gender): pass def describe(character): pass
def roll_new(name, gender): pass def describe(character): pass
# receive a integer than count the number of "1"s in it's binary form #my : def countBits(n): i = 0 while n > 2: if n % 2 == 1: i = i + 1 n = (n-1)/2 else: n = n/2 return (i + 1) if n != 0 else 0
def count_bits(n): i = 0 while n > 2: if n % 2 == 1: i = i + 1 n = (n - 1) / 2 else: n = n / 2 return i + 1 if n != 0 else 0
# -*- coding: utf-8 -*- class ImageSerializerMixin: def build_absolute_image_url(self, url): if not url.startswith('http'): request = self.context.get('request') return request.build_absolute_uri(url) return url
class Imageserializermixin: def build_absolute_image_url(self, url): if not url.startswith('http'): request = self.context.get('request') return request.build_absolute_uri(url) return url
__version__ = "0.1.9" __license__ = "Apache 2.0 license" __website__ = "https://oss.navio.online/navio-gitlab/" __download_url__ = ('https://github.com/navio-online/navio-gitlab/archive' '/{}.tar.gz'.format(__version__)),
__version__ = '0.1.9' __license__ = 'Apache 2.0 license' __website__ = 'https://oss.navio.online/navio-gitlab/' __download_url__ = ('https://github.com/navio-online/navio-gitlab/archive/{}.tar.gz'.format(__version__),)
SPACE_TOKEN = "\u241F" def replace_space(text: str) -> str: return text.replace(" ", SPACE_TOKEN) def revert_space(text: list) -> str: clean = ( " ".join("".join(text).replace(SPACE_TOKEN, " ").split()) .strip() ) return clean
space_token = '␟' def replace_space(text: str) -> str: return text.replace(' ', SPACE_TOKEN) def revert_space(text: list) -> str: clean = ' '.join(''.join(text).replace(SPACE_TOKEN, ' ').split()).strip() return clean
def check(s): (rule, password) = s.split(':') (amount, letter) = rule.split(' ') (lower, upper) = amount.split('-') count = password.count(letter) return count >= int(lower) and count <= int(upper) def solve(in_file): with open(in_file) as f: passwords = f.readlines() return sum(1 for password in passwords if check(password)) print(solve('input.txt'))
def check(s): (rule, password) = s.split(':') (amount, letter) = rule.split(' ') (lower, upper) = amount.split('-') count = password.count(letter) return count >= int(lower) and count <= int(upper) def solve(in_file): with open(in_file) as f: passwords = f.readlines() return sum((1 for password in passwords if check(password))) print(solve('input.txt'))
class DictionaryManipulator: def __init__(self): self.__dict = {} with open("./en_US.dic", 'r') as content_file: count = 0 for line in content_file.readlines(): words = line.split("/") if len(words) > 1: self.__dict[words[0].lower()] = count # words[1].replace("\n", "") else: self.__dict[line.replace("\n", "")] = count # None count += 1 def words_exist(self, word): return word in self.__dict.keys() def add_word_into_dictionary(self, word, speech=None): if word: self.__dict[word] = speech
class Dictionarymanipulator: def __init__(self): self.__dict = {} with open('./en_US.dic', 'r') as content_file: count = 0 for line in content_file.readlines(): words = line.split('/') if len(words) > 1: self.__dict[words[0].lower()] = count else: self.__dict[line.replace('\n', '')] = count count += 1 def words_exist(self, word): return word in self.__dict.keys() def add_word_into_dictionary(self, word, speech=None): if word: self.__dict[word] = speech
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"load_dcm": "00_io.ipynb", "load_h5": "00_io.ipynb", "crop": "01_manipulate.ipynb", "pad": "01_manipulate.ipynb", "resample": "01_manipulate.ipynb", "resample_by": "01_manipulate.ipynb"} modules = ["io.py", "manipulate.py"] doc_url = "https://pfdamasceno.github.io/I2T2/" git_url = "https://github.com/pfdamasceno/I2T2/tree/master/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'load_dcm': '00_io.ipynb', 'load_h5': '00_io.ipynb', 'crop': '01_manipulate.ipynb', 'pad': '01_manipulate.ipynb', 'resample': '01_manipulate.ipynb', 'resample_by': '01_manipulate.ipynb'} modules = ['io.py', 'manipulate.py'] doc_url = 'https://pfdamasceno.github.io/I2T2/' git_url = 'https://github.com/pfdamasceno/I2T2/tree/master/' def custom_doc_links(name): return None
# # PySNMP MIB module SNR-ERD-4 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNR-ERD-4 # Produced by pysmi-0.3.4 at Mon Apr 29 21:00:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, ObjectIdentity, Unsigned32, IpAddress, iso, Gauge32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, ModuleIdentity, Counter32, enterprises, Bits, Counter64, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ObjectIdentity", "Unsigned32", "IpAddress", "iso", "Gauge32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "ModuleIdentity", "Counter32", "enterprises", "Bits", "Counter64", "Integer32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") snr = ModuleIdentity((1, 3, 6, 1, 4, 1, 40418)) snr.setRevisions(('2015-04-29 12:00',)) if mibBuilder.loadTexts: snr.setLastUpdated('201504291200Z') if mibBuilder.loadTexts: snr.setOrganization('NAG ') snr_erd = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2)).setLabel("snr-erd") snr_erd_4 = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6)).setLabel("snr-erd-4") measurements = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1)) sensesstate = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2)) management = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3)) counters = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8)) options = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 10)) snrSensors = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1)) temperatureSensors = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1)) powerSensors = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2)) alarmSensCnts = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2)) erd4Traps = MibIdentifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0)) voltageSensor = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageSensor.setStatus('current') serialS1 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 10), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS1.setStatus('current') serialS2 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 11), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS2.setStatus('current') serialS3 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 12), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS3.setStatus('current') serialS4 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 13), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS4.setStatus('current') serialS5 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 14), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS5.setStatus('current') serialS6 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 15), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS6.setStatus('current') serialS7 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 16), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS7.setStatus('current') serialS8 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 17), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS8.setStatus('current') serialS9 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 18), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS9.setStatus('current') serialS10 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 19), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialS10.setStatus('current') temperatureS1 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS1.setStatus('current') temperatureS2 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS2.setStatus('current') temperatureS3 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS3.setStatus('current') temperatureS4 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS4.setStatus('current') temperatureS5 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS5.setStatus('current') temperatureS6 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS6.setStatus('current') temperatureS7 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS7.setStatus('current') temperatureS8 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS8.setStatus('current') temperatureS9 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS9.setStatus('current') temperatureS10 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: temperatureS10.setStatus('current') voltageS1 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS1.setStatus('current') currentS1 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS1.setStatus('current') voltageS2 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS2.setStatus('current') currentS2 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS2.setStatus('current') voltageS3 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS3.setStatus('current') currentS3 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS3.setStatus('current') voltageS4 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS4.setStatus('current') currentS4 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS4.setStatus('current') voltageS5 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS5.setStatus('current') currentS5 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS5.setStatus('current') voltageS6 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS6.setStatus('current') currentS6 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS6.setStatus('current') voltageS7 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 19), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS7.setStatus('current') currentS7 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS7.setStatus('current') voltageS8 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 22), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS8.setStatus('current') currentS8 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS8.setStatus('current') voltageS9 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 25), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS9.setStatus('current') currentS9 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 26), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS9.setStatus('current') voltageS10 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 28), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: voltageS10.setStatus('current') currentS10 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 29), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentS10.setStatus('current') alarmSensor1 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("high", 1), ("low", 0), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSensor1.setStatus('current') alarmSensor2 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("high", 1), ("low", 0), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSensor2.setStatus('current') alarmSensor3 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("high", 1), ("low", 0), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSensor3.setStatus('current') alarmSensor4 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("high", 1), ("low", 0), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSensor4.setStatus('current') alarmSensor5 = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("high", 1), ("low", 0), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSensor5.setStatus('current') uSensor = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0))).clone(namedValues=NamedValues(("no", 1), ("yes", 0)))).setMaxAccess("readonly") if mibBuilder.loadTexts: uSensor.setStatus('current') releState = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: releState.setStatus('current') smart1State = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart1State.setStatus('current') smart2State = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart2State.setStatus('current') smart3State = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart3State.setStatus('current') smart4State = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart4State.setStatus('current') smart5State = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 0, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 0), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart5State.setStatus('current') releResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: releResetTime.setStatus('current') smart1ResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart1ResetTime.setStatus('current') smart2ResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart2ResetTime.setStatus('current') smart3ResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart3ResetTime.setStatus('current') smart4ResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 15), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart4ResetTime.setStatus('current') smart5ResetTime = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 16), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smart5ResetTime.setStatus('current') alarmSensor1cnt = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 1), Counter32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: alarmSensor1cnt.setStatus('current') alarmSensor2cnt = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 2), Counter32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: alarmSensor2cnt.setStatus('current') alarmSensor3cnt = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 3), Counter32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: alarmSensor3cnt.setStatus('current') alarmSensor4cnt = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 4), Counter32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: alarmSensor4cnt.setStatus('current') alarmSensor5cnt = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 5), Counter32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: alarmSensor5cnt.setStatus('current') dataType = MibScalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 10, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("integer", 0), ("float", 1), ("ufloat", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dataType.setStatus('current') aSense1Alarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 1)) if mibBuilder.loadTexts: aSense1Alarm.setStatus('current') aSense1Release = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 2)) if mibBuilder.loadTexts: aSense1Release.setStatus('current') aSense2Alarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 3)) if mibBuilder.loadTexts: aSense2Alarm.setStatus('current') aSense2Release = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 4)) if mibBuilder.loadTexts: aSense2Release.setStatus('current') aSense3Alarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 5)) if mibBuilder.loadTexts: aSense3Alarm.setStatus('current') aSense3Release = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 6)) if mibBuilder.loadTexts: aSense3Release.setStatus('current') aSense4Alarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 7)) if mibBuilder.loadTexts: aSense4Alarm.setStatus('current') aSense4Release = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 8)) if mibBuilder.loadTexts: aSense4Release.setStatus('current') aSense5Alarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 9)) if mibBuilder.loadTexts: aSense5Alarm.setStatus('current') aSense5Release = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 10)) if mibBuilder.loadTexts: aSense5Release.setStatus('current') uSenseAlarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 11)) if mibBuilder.loadTexts: uSenseAlarm.setStatus('current') uSenseRelease = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 12)) if mibBuilder.loadTexts: uSenseRelease.setStatus('current') reloutThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 13)) if mibBuilder.loadTexts: reloutThermoOn.setStatus('current') reloutThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 14)) if mibBuilder.loadTexts: reloutThermoOff.setStatus('current') smart1ThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 15)) if mibBuilder.loadTexts: smart1ThermoOn.setStatus('current') smart1ThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 16)) if mibBuilder.loadTexts: smart1ThermoOff.setStatus('current') smart2ThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 17)) if mibBuilder.loadTexts: smart2ThermoOn.setStatus('current') smart2ThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 18)) if mibBuilder.loadTexts: smart2ThermoOff.setStatus('current') smart3ThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 19)) if mibBuilder.loadTexts: smart3ThermoOn.setStatus('current') smart3ThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 20)) if mibBuilder.loadTexts: smart3ThermoOff.setStatus('current') smart4ThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 21)) if mibBuilder.loadTexts: smart4ThermoOn.setStatus('current') smart4ThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 22)) if mibBuilder.loadTexts: smart4ThermoOff.setStatus('current') smart5ThermoOn = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 23)) if mibBuilder.loadTexts: smart5ThermoOn.setStatus('current') smart5ThermoOff = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 24)) if mibBuilder.loadTexts: smart5ThermoOff.setStatus('current') tempSensorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 29)) if mibBuilder.loadTexts: tempSensorAlarm.setStatus('current') tempSensorRelease = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 30)) if mibBuilder.loadTexts: tempSensorRelease.setStatus('current') voltSensorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 31)) if mibBuilder.loadTexts: voltSensorAlarm.setStatus('current') voltSensorRelease = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 32)) if mibBuilder.loadTexts: voltSensorRelease.setStatus('current') task1Done = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 36)) if mibBuilder.loadTexts: task1Done.setStatus('current') task2Done = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 37)) if mibBuilder.loadTexts: task2Done.setStatus('current') task3Done = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 38)) if mibBuilder.loadTexts: task3Done.setStatus('current') task4Done = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 39)) if mibBuilder.loadTexts: task4Done.setStatus('current') pingLost = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 45)) if mibBuilder.loadTexts: pingLost.setStatus('current') batteryChargeLow = NotificationType((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 47)) if mibBuilder.loadTexts: batteryChargeLow.setStatus('current') erd4Group = NotificationGroup((1, 3, 6, 1, 4, 1, 40418, 2, 6, 99)).setObjects(("SNR-ERD-4", "aSense1Alarm"), ("SNR-ERD-4", "aSense1Release"), ("SNR-ERD-4", "aSense2Alarm"), ("SNR-ERD-4", "aSense2Release"), ("SNR-ERD-4", "aSense3Alarm"), ("SNR-ERD-4", "aSense3Release"), ("SNR-ERD-4", "aSense4Alarm"), ("SNR-ERD-4", "aSense4Release"), ("SNR-ERD-4", "aSense5Alarm"), ("SNR-ERD-4", "aSense5Release"), ("SNR-ERD-4", "uSenseAlarm"), ("SNR-ERD-4", "uSenseRelease"), ("SNR-ERD-4", "reloutThermoOn"), ("SNR-ERD-4", "reloutThermoOff"), ("SNR-ERD-4", "smart1ThermoOn"), ("SNR-ERD-4", "smart1ThermoOff"), ("SNR-ERD-4", "smart2ThermoOn"), ("SNR-ERD-4", "smart2ThermoOff"), ("SNR-ERD-4", "smart3ThermoOn"), ("SNR-ERD-4", "smart3ThermoOff"), ("SNR-ERD-4", "smart4ThermoOn"), ("SNR-ERD-4", "smart4ThermoOff"), ("SNR-ERD-4", "smart5ThermoOn"), ("SNR-ERD-4", "smart5ThermoOff"), ("SNR-ERD-4", "tempSensorAlarm"), ("SNR-ERD-4", "tempSensorRelease"), ("SNR-ERD-4", "voltSensorAlarm"), ("SNR-ERD-4", "voltSensorRelease"), ("SNR-ERD-4", "task1Done"), ("SNR-ERD-4", "task2Done"), ("SNR-ERD-4", "task3Done"), ("SNR-ERD-4", "task4Done"), ("SNR-ERD-4", "pingLost"), ("SNR-ERD-4", "batteryChargeLow")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): erd4Group = erd4Group.setStatus('current') mibBuilder.exportSymbols("SNR-ERD-4", voltageSensor=voltageSensor, aSense3Release=aSense3Release, smart2ThermoOff=smart2ThermoOff, serialS2=serialS2, snr=snr, powerSensors=powerSensors, tempSensorRelease=tempSensorRelease, alarmSensor1cnt=alarmSensor1cnt, smart3ThermoOn=smart3ThermoOn, serialS5=serialS5, currentS9=currentS9, serialS8=serialS8, voltageS6=voltageS6, serialS10=serialS10, temperatureS5=temperatureS5, alarmSensor5=alarmSensor5, smart4ThermoOff=smart4ThermoOff, alarmSensor5cnt=alarmSensor5cnt, serialS4=serialS4, erd4Traps=erd4Traps, smart2ThermoOn=smart2ThermoOn, alarmSensor2=alarmSensor2, smart1ThermoOn=smart1ThermoOn, management=management, PYSNMP_MODULE_ID=snr, voltageS10=voltageS10, task2Done=task2Done, alarmSensor3cnt=alarmSensor3cnt, smart4ResetTime=smart4ResetTime, currentS2=currentS2, task4Done=task4Done, voltageS9=voltageS9, reloutThermoOff=reloutThermoOff, smart5State=smart5State, uSenseRelease=uSenseRelease, temperatureS9=temperatureS9, currentS3=currentS3, serialS9=serialS9, uSenseAlarm=uSenseAlarm, snr_erd=snr_erd, smart1ResetTime=smart1ResetTime, temperatureS8=temperatureS8, currentS5=currentS5, smart5ThermoOff=smart5ThermoOff, aSense1Release=aSense1Release, voltageS1=voltageS1, smart5ThermoOn=smart5ThermoOn, temperatureS4=temperatureS4, smart2ResetTime=smart2ResetTime, currentS4=currentS4, temperatureS3=temperatureS3, tempSensorAlarm=tempSensorAlarm, smart4State=smart4State, smart3ResetTime=smart3ResetTime, alarmSensor1=alarmSensor1, temperatureS10=temperatureS10, voltageS7=voltageS7, aSense2Alarm=aSense2Alarm, aSense4Alarm=aSense4Alarm, alarmSensCnts=alarmSensCnts, serialS3=serialS3, voltageS3=voltageS3, smart3State=smart3State, temperatureS6=temperatureS6, dataType=dataType, currentS8=currentS8, uSensor=uSensor, temperatureS2=temperatureS2, voltageS5=voltageS5, smart1State=smart1State, erd4Group=erd4Group, aSense1Alarm=aSense1Alarm, batteryChargeLow=batteryChargeLow, alarmSensor2cnt=alarmSensor2cnt, alarmSensor4=alarmSensor4, aSense4Release=aSense4Release, smart1ThermoOff=smart1ThermoOff, releResetTime=releResetTime, pingLost=pingLost, serialS6=serialS6, smart4ThermoOn=smart4ThermoOn, serialS7=serialS7, smart5ResetTime=smart5ResetTime, currentS6=currentS6, voltageS8=voltageS8, currentS10=currentS10, temperatureS1=temperatureS1, snr_erd_4=snr_erd_4, aSense5Release=aSense5Release, voltSensorRelease=voltSensorRelease, task3Done=task3Done, snrSensors=snrSensors, voltageS2=voltageS2, smart3ThermoOff=smart3ThermoOff, currentS1=currentS1, smart2State=smart2State, currentS7=currentS7, aSense3Alarm=aSense3Alarm, alarmSensor3=alarmSensor3, releState=releState, aSense5Alarm=aSense5Alarm, measurements=measurements, options=options, temperatureSensors=temperatureSensors, serialS1=serialS1, task1Done=task1Done, temperatureS7=temperatureS7, sensesstate=sensesstate, alarmSensor4cnt=alarmSensor4cnt, aSense2Release=aSense2Release, voltSensorAlarm=voltSensorAlarm, counters=counters, reloutThermoOn=reloutThermoOn, voltageS4=voltageS4)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (time_ticks, object_identity, unsigned32, ip_address, iso, gauge32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, module_identity, counter32, enterprises, bits, counter64, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'ObjectIdentity', 'Unsigned32', 'IpAddress', 'iso', 'Gauge32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'ModuleIdentity', 'Counter32', 'enterprises', 'Bits', 'Counter64', 'Integer32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') snr = module_identity((1, 3, 6, 1, 4, 1, 40418)) snr.setRevisions(('2015-04-29 12:00',)) if mibBuilder.loadTexts: snr.setLastUpdated('201504291200Z') if mibBuilder.loadTexts: snr.setOrganization('NAG ') snr_erd = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2)).setLabel('snr-erd') snr_erd_4 = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6)).setLabel('snr-erd-4') measurements = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1)) sensesstate = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2)) management = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3)) counters = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8)) options = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 10)) snr_sensors = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1)) temperature_sensors = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1)) power_sensors = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2)) alarm_sens_cnts = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2)) erd4_traps = mib_identifier((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0)) voltage_sensor = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageSensor.setStatus('current') serial_s1 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 10), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS1.setStatus('current') serial_s2 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 11), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS2.setStatus('current') serial_s3 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 12), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS3.setStatus('current') serial_s4 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 13), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS4.setStatus('current') serial_s5 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 14), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS5.setStatus('current') serial_s6 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 15), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS6.setStatus('current') serial_s7 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 16), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS7.setStatus('current') serial_s8 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 17), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS8.setStatus('current') serial_s9 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 18), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS9.setStatus('current') serial_s10 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 19), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: serialS10.setStatus('current') temperature_s1 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS1.setStatus('current') temperature_s2 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS2.setStatus('current') temperature_s3 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS3.setStatus('current') temperature_s4 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS4.setStatus('current') temperature_s5 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS5.setStatus('current') temperature_s6 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS6.setStatus('current') temperature_s7 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS7.setStatus('current') temperature_s8 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS8.setStatus('current') temperature_s9 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 9), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS9.setStatus('current') temperature_s10 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 1, 10), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: temperatureS10.setStatus('current') voltage_s1 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS1.setStatus('current') current_s1 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS1.setStatus('current') voltage_s2 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS2.setStatus('current') current_s2 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS2.setStatus('current') voltage_s3 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS3.setStatus('current') current_s3 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS3.setStatus('current') voltage_s4 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 10), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS4.setStatus('current') current_s4 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 11), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS4.setStatus('current') voltage_s5 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 13), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS5.setStatus('current') current_s5 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 14), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS5.setStatus('current') voltage_s6 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 16), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS6.setStatus('current') current_s6 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 17), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS6.setStatus('current') voltage_s7 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 19), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS7.setStatus('current') current_s7 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 20), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS7.setStatus('current') voltage_s8 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 22), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS8.setStatus('current') current_s8 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 23), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS8.setStatus('current') voltage_s9 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 25), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS9.setStatus('current') current_s9 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 26), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS9.setStatus('current') voltage_s10 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 28), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: voltageS10.setStatus('current') current_s10 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 1, 1, 2, 29), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: currentS10.setStatus('current') alarm_sensor1 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('high', 1), ('low', 0), ('off', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: alarmSensor1.setStatus('current') alarm_sensor2 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('high', 1), ('low', 0), ('off', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: alarmSensor2.setStatus('current') alarm_sensor3 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('high', 1), ('low', 0), ('off', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: alarmSensor3.setStatus('current') alarm_sensor4 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('high', 1), ('low', 0), ('off', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: alarmSensor4.setStatus('current') alarm_sensor5 = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('high', 1), ('low', 0), ('off', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: alarmSensor5.setStatus('current') u_sensor = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 2, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0))).clone(namedValues=named_values(('no', 1), ('yes', 0)))).setMaxAccess('readonly') if mibBuilder.loadTexts: uSensor.setStatus('current') rele_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: releState.setStatus('current') smart1_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart1State.setStatus('current') smart2_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart2State.setStatus('current') smart3_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart3State.setStatus('current') smart4_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart4State.setStatus('current') smart5_state = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 0, 2))).clone(namedValues=named_values(('on', 1), ('off', 0), ('reset', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart5State.setStatus('current') rele_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 11), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: releResetTime.setStatus('current') smart1_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 12), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart1ResetTime.setStatus('current') smart2_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 13), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart2ResetTime.setStatus('current') smart3_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 14), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart3ResetTime.setStatus('current') smart4_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 15), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart4ResetTime.setStatus('current') smart5_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 3, 16), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: smart5ResetTime.setStatus('current') alarm_sensor1cnt = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 1), counter32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: alarmSensor1cnt.setStatus('current') alarm_sensor2cnt = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 2), counter32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: alarmSensor2cnt.setStatus('current') alarm_sensor3cnt = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 3), counter32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: alarmSensor3cnt.setStatus('current') alarm_sensor4cnt = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 4), counter32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: alarmSensor4cnt.setStatus('current') alarm_sensor5cnt = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 8, 2, 5), counter32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: alarmSensor5cnt.setStatus('current') data_type = mib_scalar((1, 3, 6, 1, 4, 1, 40418, 2, 6, 10, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('integer', 0), ('float', 1), ('ufloat', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: dataType.setStatus('current') a_sense1_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 1)) if mibBuilder.loadTexts: aSense1Alarm.setStatus('current') a_sense1_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 2)) if mibBuilder.loadTexts: aSense1Release.setStatus('current') a_sense2_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 3)) if mibBuilder.loadTexts: aSense2Alarm.setStatus('current') a_sense2_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 4)) if mibBuilder.loadTexts: aSense2Release.setStatus('current') a_sense3_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 5)) if mibBuilder.loadTexts: aSense3Alarm.setStatus('current') a_sense3_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 6)) if mibBuilder.loadTexts: aSense3Release.setStatus('current') a_sense4_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 7)) if mibBuilder.loadTexts: aSense4Alarm.setStatus('current') a_sense4_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 8)) if mibBuilder.loadTexts: aSense4Release.setStatus('current') a_sense5_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 9)) if mibBuilder.loadTexts: aSense5Alarm.setStatus('current') a_sense5_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 10)) if mibBuilder.loadTexts: aSense5Release.setStatus('current') u_sense_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 11)) if mibBuilder.loadTexts: uSenseAlarm.setStatus('current') u_sense_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 12)) if mibBuilder.loadTexts: uSenseRelease.setStatus('current') relout_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 13)) if mibBuilder.loadTexts: reloutThermoOn.setStatus('current') relout_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 14)) if mibBuilder.loadTexts: reloutThermoOff.setStatus('current') smart1_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 15)) if mibBuilder.loadTexts: smart1ThermoOn.setStatus('current') smart1_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 16)) if mibBuilder.loadTexts: smart1ThermoOff.setStatus('current') smart2_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 17)) if mibBuilder.loadTexts: smart2ThermoOn.setStatus('current') smart2_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 18)) if mibBuilder.loadTexts: smart2ThermoOff.setStatus('current') smart3_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 19)) if mibBuilder.loadTexts: smart3ThermoOn.setStatus('current') smart3_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 20)) if mibBuilder.loadTexts: smart3ThermoOff.setStatus('current') smart4_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 21)) if mibBuilder.loadTexts: smart4ThermoOn.setStatus('current') smart4_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 22)) if mibBuilder.loadTexts: smart4ThermoOff.setStatus('current') smart5_thermo_on = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 23)) if mibBuilder.loadTexts: smart5ThermoOn.setStatus('current') smart5_thermo_off = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 24)) if mibBuilder.loadTexts: smart5ThermoOff.setStatus('current') temp_sensor_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 29)) if mibBuilder.loadTexts: tempSensorAlarm.setStatus('current') temp_sensor_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 30)) if mibBuilder.loadTexts: tempSensorRelease.setStatus('current') volt_sensor_alarm = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 31)) if mibBuilder.loadTexts: voltSensorAlarm.setStatus('current') volt_sensor_release = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 32)) if mibBuilder.loadTexts: voltSensorRelease.setStatus('current') task1_done = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 36)) if mibBuilder.loadTexts: task1Done.setStatus('current') task2_done = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 37)) if mibBuilder.loadTexts: task2Done.setStatus('current') task3_done = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 38)) if mibBuilder.loadTexts: task3Done.setStatus('current') task4_done = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 39)) if mibBuilder.loadTexts: task4Done.setStatus('current') ping_lost = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 45)) if mibBuilder.loadTexts: pingLost.setStatus('current') battery_charge_low = notification_type((1, 3, 6, 1, 4, 1, 40418, 2, 6, 0, 47)) if mibBuilder.loadTexts: batteryChargeLow.setStatus('current') erd4_group = notification_group((1, 3, 6, 1, 4, 1, 40418, 2, 6, 99)).setObjects(('SNR-ERD-4', 'aSense1Alarm'), ('SNR-ERD-4', 'aSense1Release'), ('SNR-ERD-4', 'aSense2Alarm'), ('SNR-ERD-4', 'aSense2Release'), ('SNR-ERD-4', 'aSense3Alarm'), ('SNR-ERD-4', 'aSense3Release'), ('SNR-ERD-4', 'aSense4Alarm'), ('SNR-ERD-4', 'aSense4Release'), ('SNR-ERD-4', 'aSense5Alarm'), ('SNR-ERD-4', 'aSense5Release'), ('SNR-ERD-4', 'uSenseAlarm'), ('SNR-ERD-4', 'uSenseRelease'), ('SNR-ERD-4', 'reloutThermoOn'), ('SNR-ERD-4', 'reloutThermoOff'), ('SNR-ERD-4', 'smart1ThermoOn'), ('SNR-ERD-4', 'smart1ThermoOff'), ('SNR-ERD-4', 'smart2ThermoOn'), ('SNR-ERD-4', 'smart2ThermoOff'), ('SNR-ERD-4', 'smart3ThermoOn'), ('SNR-ERD-4', 'smart3ThermoOff'), ('SNR-ERD-4', 'smart4ThermoOn'), ('SNR-ERD-4', 'smart4ThermoOff'), ('SNR-ERD-4', 'smart5ThermoOn'), ('SNR-ERD-4', 'smart5ThermoOff'), ('SNR-ERD-4', 'tempSensorAlarm'), ('SNR-ERD-4', 'tempSensorRelease'), ('SNR-ERD-4', 'voltSensorAlarm'), ('SNR-ERD-4', 'voltSensorRelease'), ('SNR-ERD-4', 'task1Done'), ('SNR-ERD-4', 'task2Done'), ('SNR-ERD-4', 'task3Done'), ('SNR-ERD-4', 'task4Done'), ('SNR-ERD-4', 'pingLost'), ('SNR-ERD-4', 'batteryChargeLow')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): erd4_group = erd4Group.setStatus('current') mibBuilder.exportSymbols('SNR-ERD-4', voltageSensor=voltageSensor, aSense3Release=aSense3Release, smart2ThermoOff=smart2ThermoOff, serialS2=serialS2, snr=snr, powerSensors=powerSensors, tempSensorRelease=tempSensorRelease, alarmSensor1cnt=alarmSensor1cnt, smart3ThermoOn=smart3ThermoOn, serialS5=serialS5, currentS9=currentS9, serialS8=serialS8, voltageS6=voltageS6, serialS10=serialS10, temperatureS5=temperatureS5, alarmSensor5=alarmSensor5, smart4ThermoOff=smart4ThermoOff, alarmSensor5cnt=alarmSensor5cnt, serialS4=serialS4, erd4Traps=erd4Traps, smart2ThermoOn=smart2ThermoOn, alarmSensor2=alarmSensor2, smart1ThermoOn=smart1ThermoOn, management=management, PYSNMP_MODULE_ID=snr, voltageS10=voltageS10, task2Done=task2Done, alarmSensor3cnt=alarmSensor3cnt, smart4ResetTime=smart4ResetTime, currentS2=currentS2, task4Done=task4Done, voltageS9=voltageS9, reloutThermoOff=reloutThermoOff, smart5State=smart5State, uSenseRelease=uSenseRelease, temperatureS9=temperatureS9, currentS3=currentS3, serialS9=serialS9, uSenseAlarm=uSenseAlarm, snr_erd=snr_erd, smart1ResetTime=smart1ResetTime, temperatureS8=temperatureS8, currentS5=currentS5, smart5ThermoOff=smart5ThermoOff, aSense1Release=aSense1Release, voltageS1=voltageS1, smart5ThermoOn=smart5ThermoOn, temperatureS4=temperatureS4, smart2ResetTime=smart2ResetTime, currentS4=currentS4, temperatureS3=temperatureS3, tempSensorAlarm=tempSensorAlarm, smart4State=smart4State, smart3ResetTime=smart3ResetTime, alarmSensor1=alarmSensor1, temperatureS10=temperatureS10, voltageS7=voltageS7, aSense2Alarm=aSense2Alarm, aSense4Alarm=aSense4Alarm, alarmSensCnts=alarmSensCnts, serialS3=serialS3, voltageS3=voltageS3, smart3State=smart3State, temperatureS6=temperatureS6, dataType=dataType, currentS8=currentS8, uSensor=uSensor, temperatureS2=temperatureS2, voltageS5=voltageS5, smart1State=smart1State, erd4Group=erd4Group, aSense1Alarm=aSense1Alarm, batteryChargeLow=batteryChargeLow, alarmSensor2cnt=alarmSensor2cnt, alarmSensor4=alarmSensor4, aSense4Release=aSense4Release, smart1ThermoOff=smart1ThermoOff, releResetTime=releResetTime, pingLost=pingLost, serialS6=serialS6, smart4ThermoOn=smart4ThermoOn, serialS7=serialS7, smart5ResetTime=smart5ResetTime, currentS6=currentS6, voltageS8=voltageS8, currentS10=currentS10, temperatureS1=temperatureS1, snr_erd_4=snr_erd_4, aSense5Release=aSense5Release, voltSensorRelease=voltSensorRelease, task3Done=task3Done, snrSensors=snrSensors, voltageS2=voltageS2, smart3ThermoOff=smart3ThermoOff, currentS1=currentS1, smart2State=smart2State, currentS7=currentS7, aSense3Alarm=aSense3Alarm, alarmSensor3=alarmSensor3, releState=releState, aSense5Alarm=aSense5Alarm, measurements=measurements, options=options, temperatureSensors=temperatureSensors, serialS1=serialS1, task1Done=task1Done, temperatureS7=temperatureS7, sensesstate=sensesstate, alarmSensor4cnt=alarmSensor4cnt, aSense2Release=aSense2Release, voltSensorAlarm=voltSensorAlarm, counters=counters, reloutThermoOn=reloutThermoOn, voltageS4=voltageS4)
class Subtract: def subtract(initial, remove): if not(remove in initial): return initial index = initial.index(remove) tracker = 0 removed = '' while tracker < len(initial): if not(tracker >= index and tracker < index + len(remove)): removed += initial[tracker:tracker + 1] tracker += 1 return removed def subtract_all(initial, remove): if not(remove in initial): return initial removed = '' tracker = 0 index = initial.index(remove) while tracker < len(initial): if not(tracker >= index and tracker < index + len(remove)): removed += initial[tracker:tracker + 1] if tracker == index + len(remove) - 1 and remove in initial[index + len(remove)]: index = initial.index(remove, index + len(remove)) tracker += 1 return removed #print(Subtract.subtract("hello", "hel"))
class Subtract: def subtract(initial, remove): if not remove in initial: return initial index = initial.index(remove) tracker = 0 removed = '' while tracker < len(initial): if not (tracker >= index and tracker < index + len(remove)): removed += initial[tracker:tracker + 1] tracker += 1 return removed def subtract_all(initial, remove): if not remove in initial: return initial removed = '' tracker = 0 index = initial.index(remove) while tracker < len(initial): if not (tracker >= index and tracker < index + len(remove)): removed += initial[tracker:tracker + 1] if tracker == index + len(remove) - 1 and remove in initial[index + len(remove)]: index = initial.index(remove, index + len(remove)) tracker += 1 return removed
fr=open('migrating.txt', 'r') caseDict = {} oldList = [ "Ball_LightningSphere1.bmp", "Ball_LightningSphere2.bmp", "Ball_LightningSphere3.bmp", "Ball_Paper.bmp", "Ball_Stone.bmp", "Ball_Wood.bmp", "Brick.bmp", "Button01_deselect.tga", "Button01_select.tga", "Button01_special.tga", "Column_beige.bmp", "Column_beige_fade.tga", "Column_blue.bmp", "Dome.bmp", "DomeEnvironment.bmp", "DomeShadow.tga", "ExtraBall.bmp", "ExtraParticle.bmp", "E_Holzbeschlag.bmp", "FloorGlow.bmp", "Floor_Side.bmp", "Floor_Top_Border.bmp", "Floor_Top_Borderless.bmp", "Floor_Top_Checkpoint.bmp", "Floor_Top_Flat.bmp", "Floor_Top_Profil.bmp", "Floor_Top_ProfilFlat.bmp", "Font_1.tga", "Gravitylogo_intro.bmp", "HardShadow.bmp", "Laterne_Glas.bmp", "Laterne_Schatten.tga", "Laterne_Verlauf.tga", "Metal_stained.bmp", "Misc_Ufo.bmp", "Misc_UFO_Flash.bmp", "Modul03_Floor.bmp", "Modul03_Wall.bmp", "Modul11_13_Wood.bmp", "Modul11_Wood.bmp", "Modul15.bmp", "Modul16.bmp", "Modul18.bmp", "Modul18_Gitter.tga", "Modul30_d_Seiten.bmp", "Particle_Flames.bmp", "Particle_Smoke.bmp", "PE_Bal_balloons.bmp", "PE_Bal_platform.bmp", "PE_Ufo_env.bmp", "P_Extra_Life_Oil.bmp", "P_Extra_Life_Particle.bmp", "P_Extra_Life_Shadow.bmp", "Rail_Environment.bmp", "sandsack.bmp", "SkyLayer.bmp", "Sky_Vortex.bmp", "Stick_Bottom.tga", "Stick_Stripes.bmp", "Target.bmp", "Tower_Roof.bmp", "Trafo_Environment.bmp", "Trafo_FlashField.bmp", "Trafo_Shadow_Big.tga", "Wood_Metal.bmp", "Wood_MetalStripes.bmp", "Wood_Misc.bmp", "Wood_Nailed.bmp", "Wood_Old.bmp", "Wood_Panel.bmp", "Wood_Plain.bmp", "Wood_Plain2.bmp", "Wood_Raft.bmp" ] caseMode = False caseIndex = 0 while True: cache=fr.readline() if cache=='': break cache=cache.strip() cache=cache.replace('\t', '') if cache=='': continue if not caseMode: if cache.startswith('//case'): # ignored item # skip this pass elif cache.startswith('case'): codeline = "" caseMode = True caseIndex=int(cache.split(' ')[1].replace(':', '')) else: if cache=='break;': codeline+=cache+"\n" caseMode = False caseDict[caseIndex] = codeline else: codeline+=cache+"\n" fr.close() fw=open('migrated.txt', 'w') newList = [ "atari.avi", "atari.bmp", "Ball_LightningSphere1.bmp", "Ball_LightningSphere2.bmp", "Ball_LightningSphere3.bmp", "Ball_Paper.bmp", "Ball_Stone.bmp", "Ball_Wood.bmp", "Brick.bmp", "Button01_deselect.tga", "Button01_select.tga", "Button01_special.tga", "Column_beige.bmp", "Column_beige_fade.tga", "Column_blue.bmp", "Cursor.tga", "Dome.bmp", "DomeEnvironment.bmp", "DomeShadow.tga", "ExtraBall.bmp", "ExtraParticle.bmp", "E_Holzbeschlag.bmp", "FloorGlow.bmp", "Floor_Side.bmp", "Floor_Top_Border.bmp", "Floor_Top_Borderless.bmp", "Floor_Top_Checkpoint.bmp", "Floor_Top_Flat.bmp", "Floor_Top_Profil.bmp", "Floor_Top_ProfilFlat.bmp", "Font_1.tga", "Gravitylogo_intro.bmp", "HardShadow.bmp", "Laterne_Glas.bmp", "Laterne_Schatten.tga", "Laterne_Verlauf.tga", "Logo.bmp", "Metal_stained.bmp", "Misc_Ufo.bmp", "Misc_UFO_Flash.bmp", "Modul03_Floor.bmp", "Modul03_Wall.bmp", "Modul11_13_Wood.bmp", "Modul11_Wood.bmp", "Modul15.bmp", "Modul16.bmp", "Modul18.bmp", "Modul18_Gitter.tga", "Modul30_d_Seiten.bmp", "Particle_Flames.bmp", "Particle_Smoke.bmp", "PE_Bal_balloons.bmp", "PE_Bal_platform.bmp", "PE_Ufo_env.bmp", "Pfeil.tga", "P_Extra_Life_Oil.bmp", "P_Extra_Life_Particle.bmp", "P_Extra_Life_Shadow.bmp", "Rail_Environment.bmp", "sandsack.bmp", "SkyLayer.bmp", "Sky_Vortex.bmp", "Stick_Bottom.tga", "Stick_Stripes.bmp", "Target.bmp", "Tower_Roof.bmp", "Trafo_Environment.bmp", "Trafo_FlashField.bmp", "Trafo_Shadow_Big.tga", "Tut_Pfeil01.tga", "Tut_Pfeil_Hoch.tga", "Wolken_intro.tga", "Wood_Metal.bmp", "Wood_MetalStripes.bmp", "Wood_Misc.bmp", "Wood_Nailed.bmp", "Wood_Old.bmp", "Wood_Panel.bmp", "Wood_Plain.bmp", "Wood_Plain2.bmp", "Wood_Raft.bmp" ] counter = 0 for item in newList: if item in oldList: existedCode = caseDict.get(oldList.index(item), '') else: existedCode = '' if existedCode == '': fw.write('//') fw.write('case {}: //{}'.format(counter, item)) fw.write('\n') fw.write(existedCode) counter+=1 fw.close()
fr = open('migrating.txt', 'r') case_dict = {} old_list = ['Ball_LightningSphere1.bmp', 'Ball_LightningSphere2.bmp', 'Ball_LightningSphere3.bmp', 'Ball_Paper.bmp', 'Ball_Stone.bmp', 'Ball_Wood.bmp', 'Brick.bmp', 'Button01_deselect.tga', 'Button01_select.tga', 'Button01_special.tga', 'Column_beige.bmp', 'Column_beige_fade.tga', 'Column_blue.bmp', 'Dome.bmp', 'DomeEnvironment.bmp', 'DomeShadow.tga', 'ExtraBall.bmp', 'ExtraParticle.bmp', 'E_Holzbeschlag.bmp', 'FloorGlow.bmp', 'Floor_Side.bmp', 'Floor_Top_Border.bmp', 'Floor_Top_Borderless.bmp', 'Floor_Top_Checkpoint.bmp', 'Floor_Top_Flat.bmp', 'Floor_Top_Profil.bmp', 'Floor_Top_ProfilFlat.bmp', 'Font_1.tga', 'Gravitylogo_intro.bmp', 'HardShadow.bmp', 'Laterne_Glas.bmp', 'Laterne_Schatten.tga', 'Laterne_Verlauf.tga', 'Metal_stained.bmp', 'Misc_Ufo.bmp', 'Misc_UFO_Flash.bmp', 'Modul03_Floor.bmp', 'Modul03_Wall.bmp', 'Modul11_13_Wood.bmp', 'Modul11_Wood.bmp', 'Modul15.bmp', 'Modul16.bmp', 'Modul18.bmp', 'Modul18_Gitter.tga', 'Modul30_d_Seiten.bmp', 'Particle_Flames.bmp', 'Particle_Smoke.bmp', 'PE_Bal_balloons.bmp', 'PE_Bal_platform.bmp', 'PE_Ufo_env.bmp', 'P_Extra_Life_Oil.bmp', 'P_Extra_Life_Particle.bmp', 'P_Extra_Life_Shadow.bmp', 'Rail_Environment.bmp', 'sandsack.bmp', 'SkyLayer.bmp', 'Sky_Vortex.bmp', 'Stick_Bottom.tga', 'Stick_Stripes.bmp', 'Target.bmp', 'Tower_Roof.bmp', 'Trafo_Environment.bmp', 'Trafo_FlashField.bmp', 'Trafo_Shadow_Big.tga', 'Wood_Metal.bmp', 'Wood_MetalStripes.bmp', 'Wood_Misc.bmp', 'Wood_Nailed.bmp', 'Wood_Old.bmp', 'Wood_Panel.bmp', 'Wood_Plain.bmp', 'Wood_Plain2.bmp', 'Wood_Raft.bmp'] case_mode = False case_index = 0 while True: cache = fr.readline() if cache == '': break cache = cache.strip() cache = cache.replace('\t', '') if cache == '': continue if not caseMode: if cache.startswith('//case'): pass elif cache.startswith('case'): codeline = '' case_mode = True case_index = int(cache.split(' ')[1].replace(':', '')) elif cache == 'break;': codeline += cache + '\n' case_mode = False caseDict[caseIndex] = codeline else: codeline += cache + '\n' fr.close() fw = open('migrated.txt', 'w') new_list = ['atari.avi', 'atari.bmp', 'Ball_LightningSphere1.bmp', 'Ball_LightningSphere2.bmp', 'Ball_LightningSphere3.bmp', 'Ball_Paper.bmp', 'Ball_Stone.bmp', 'Ball_Wood.bmp', 'Brick.bmp', 'Button01_deselect.tga', 'Button01_select.tga', 'Button01_special.tga', 'Column_beige.bmp', 'Column_beige_fade.tga', 'Column_blue.bmp', 'Cursor.tga', 'Dome.bmp', 'DomeEnvironment.bmp', 'DomeShadow.tga', 'ExtraBall.bmp', 'ExtraParticle.bmp', 'E_Holzbeschlag.bmp', 'FloorGlow.bmp', 'Floor_Side.bmp', 'Floor_Top_Border.bmp', 'Floor_Top_Borderless.bmp', 'Floor_Top_Checkpoint.bmp', 'Floor_Top_Flat.bmp', 'Floor_Top_Profil.bmp', 'Floor_Top_ProfilFlat.bmp', 'Font_1.tga', 'Gravitylogo_intro.bmp', 'HardShadow.bmp', 'Laterne_Glas.bmp', 'Laterne_Schatten.tga', 'Laterne_Verlauf.tga', 'Logo.bmp', 'Metal_stained.bmp', 'Misc_Ufo.bmp', 'Misc_UFO_Flash.bmp', 'Modul03_Floor.bmp', 'Modul03_Wall.bmp', 'Modul11_13_Wood.bmp', 'Modul11_Wood.bmp', 'Modul15.bmp', 'Modul16.bmp', 'Modul18.bmp', 'Modul18_Gitter.tga', 'Modul30_d_Seiten.bmp', 'Particle_Flames.bmp', 'Particle_Smoke.bmp', 'PE_Bal_balloons.bmp', 'PE_Bal_platform.bmp', 'PE_Ufo_env.bmp', 'Pfeil.tga', 'P_Extra_Life_Oil.bmp', 'P_Extra_Life_Particle.bmp', 'P_Extra_Life_Shadow.bmp', 'Rail_Environment.bmp', 'sandsack.bmp', 'SkyLayer.bmp', 'Sky_Vortex.bmp', 'Stick_Bottom.tga', 'Stick_Stripes.bmp', 'Target.bmp', 'Tower_Roof.bmp', 'Trafo_Environment.bmp', 'Trafo_FlashField.bmp', 'Trafo_Shadow_Big.tga', 'Tut_Pfeil01.tga', 'Tut_Pfeil_Hoch.tga', 'Wolken_intro.tga', 'Wood_Metal.bmp', 'Wood_MetalStripes.bmp', 'Wood_Misc.bmp', 'Wood_Nailed.bmp', 'Wood_Old.bmp', 'Wood_Panel.bmp', 'Wood_Plain.bmp', 'Wood_Plain2.bmp', 'Wood_Raft.bmp'] counter = 0 for item in newList: if item in oldList: existed_code = caseDict.get(oldList.index(item), '') else: existed_code = '' if existedCode == '': fw.write('//') fw.write('case {}: //{}'.format(counter, item)) fw.write('\n') fw.write(existedCode) counter += 1 fw.close()
class Net3(nn.Module): def __init__(self, kernel=None, padding=0, stride=2): super(Net3, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=3, kernel_size=3, padding=padding) # first kernel - leading diagonal kernel_1 = torch.Tensor([[[1, -1, -1], [-1, 1, -1], [-1, -1, 1]]]) # second kernel -checkerboard pattern kernel_2 = torch.Tensor([[[1, -1, 1], [-1, 1, -1], [1, -1, 1]]]) # third kernel - other diagonal kernel_3 = torch.Tensor([[[-1, -1, 1], [-1, 1, -1], [1, -1, -1]]]) multiple_kernels = torch.stack([kernel_1, kernel_2, kernel_3], dim=0) self.conv1.weight = torch.nn.Parameter(multiple_kernels) self.conv1.bias = torch.nn.Parameter(torch.Tensor([0, 0, 0])) self.pool = nn.MaxPool2d(kernel_size=2, stride=stride) def forward(self, x): x = self.conv1(x) x = F.relu(x) x = self.pool(x) # pass through a max pool layer return x # add event to airtable atform.add_event('Coding Exercise 3.3: Implement MaxPooling') ## check if your implementation is correct net = Net3().to(DEVICE) check_pooling_net(net, device=DEVICE)
class Net3(nn.Module): def __init__(self, kernel=None, padding=0, stride=2): super(Net3, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=3, kernel_size=3, padding=padding) kernel_1 = torch.Tensor([[[1, -1, -1], [-1, 1, -1], [-1, -1, 1]]]) kernel_2 = torch.Tensor([[[1, -1, 1], [-1, 1, -1], [1, -1, 1]]]) kernel_3 = torch.Tensor([[[-1, -1, 1], [-1, 1, -1], [1, -1, -1]]]) multiple_kernels = torch.stack([kernel_1, kernel_2, kernel_3], dim=0) self.conv1.weight = torch.nn.Parameter(multiple_kernels) self.conv1.bias = torch.nn.Parameter(torch.Tensor([0, 0, 0])) self.pool = nn.MaxPool2d(kernel_size=2, stride=stride) def forward(self, x): x = self.conv1(x) x = F.relu(x) x = self.pool(x) return x atform.add_event('Coding Exercise 3.3: Implement MaxPooling') net = net3().to(DEVICE) check_pooling_net(net, device=DEVICE)
# Fonte https://www.thehuxley.com/problem/2253?locale=pt_BR # TODO: Ordenar saidas de forma alfabetica, seguindo especificacoes do problema tamanho_a, tamanho_b = input().split() tamanho_a = int(tamanho_a) tamanho_b = int(tamanho_b) selecionados_a, selecionados_b = input().split() selecionados_a = int(selecionados_a) selecionados_b = int(selecionados_b) a = input().split() a = list(map(int, a)) b = input().split() b = list(map(int, b)) a.sort() b.sort(reverse=True) if a[selecionados_a - 1] < b[selecionados_b - 1]: print("YES") else: print("NO")
(tamanho_a, tamanho_b) = input().split() tamanho_a = int(tamanho_a) tamanho_b = int(tamanho_b) (selecionados_a, selecionados_b) = input().split() selecionados_a = int(selecionados_a) selecionados_b = int(selecionados_b) a = input().split() a = list(map(int, a)) b = input().split() b = list(map(int, b)) a.sort() b.sort(reverse=True) if a[selecionados_a - 1] < b[selecionados_b - 1]: print('YES') else: print('NO')
# # PySNMP MIB module ASCEND-CALL-LOGGING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-CALL-LOGGING-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:26:02 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) # callLoggingGroup, = mibBuilder.importSymbols("ASCEND-MIB", "callLoggingGroup") Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") IpAddress, MibIdentifier, TimeTicks, Unsigned32, NotificationType, Gauge32, Counter64, Counter32, iso, Bits, Integer32, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "MibIdentifier", "TimeTicks", "Unsigned32", "NotificationType", "Gauge32", "Counter64", "Counter32", "iso", "Bits", "Integer32", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") callLoggingNumServers = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: callLoggingNumServers.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingNumServers.setDescription('The maximum number of Call Logging servers supported by the system.') callLoggingServerTable = MibTable((1, 3, 6, 1, 4, 1, 529, 25, 2), ) if mibBuilder.loadTexts: callLoggingServerTable.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerTable.setDescription('A list of entries for Call Logging Server addresses.') callLoggingServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 529, 25, 2, 1), ).setIndexNames((0, "ASCEND-CALL-LOGGING-MIB", "callLoggingServerIndex")) if mibBuilder.loadTexts: callLoggingServerEntry.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerEntry.setDescription('Entry holding information about the currently active Call Logging Server and the address of a Server.') callLoggingServerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: callLoggingServerIndex.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerIndex.setDescription("The index number for this Call Logging server entry. Its value ranges from 1 to 'callLoggingNumServers'. and identifies which server entry is associated with.") callLoggingCurrentServerFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("standby", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: callLoggingCurrentServerFlag.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingCurrentServerFlag.setDescription('Value indicates whether this entry is the current Call Logging server or not.') callLoggingServerIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingServerIPAddress.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerIPAddress.setDescription('The IP address of Call Logging server. The value 0.0.0.0 is returned if entry is invalid.') callLoggingEnableActiveServer = MibTableColumn((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("notApplicable", 1), ("enable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingEnableActiveServer.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingEnableActiveServer.setDescription('This is used to set the active call Logging server. If set to enable(2) it will enable the call Logging server, A read on the variable will return notApplicable(1).') callLoggingStatus = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingStatus.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingStatus.setDescription('Enable/Disable call loggin support. Note: Prior to enable the call Logging, one of the Call Logging server must be setup with a valid IP address. If the server IP address is not setup, a SET to this object will return with a bad value error.') callLoggingPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingPortNumber.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingPortNumber.setDescription('The UDP server port to use for Call Logging packets.') callLoggingKey = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingKey.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingKey.setDescription('The (RADIUS_ACCT) call logging key to access server.') callLoggingTimeout = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingTimeout.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingTimeout.setDescription('Number of seconds to wait for a response to previous Call Logging request sent to server.') callLoggingIdBase = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 10, 16))).clone(namedValues=NamedValues(("other", 1), ("invalid", 2), ("base10", 10), ("base16", 16)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingIdBase.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingIdBase.setDescription('The Base to use in reporting Call Logging ID.') callLoggingResetTime = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingResetTime.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingResetTime.setDescription('The time to reset to the primary server after it has failed.') callLoggingStopPacketsOnly = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingStopPacketsOnly.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingStopPacketsOnly.setDescription('Send call log Stop packets that have username=0. These are caused by connections that are dropped before authentication is done.') callLoggingRetryLimit = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingRetryLimit.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingRetryLimit.setDescription('Number of retries before removing Call Logging packet. 0 means leave on retry list until maximum retry entries are exceeded.') callLoggingAssStatus = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("idle", 1), ("active", 2), ("aborted", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: callLoggingAssStatus.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingAssStatus.setDescription('Indicates the status of Active Session Snapshot protocol. Writing the attribute with a nonzero value causes the start of an Active Session Snapshot. If no server is configured the Active Session Snapshot will abort immediatly, an active session can not be aborted') callLoggingDroppedPacketCount = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: callLoggingDroppedPacketCount.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingDroppedPacketCount.setDescription('Number of dropped Call Logging packets since the last Active Session Snapshot') callLoggingRadCompatMode = MibScalar((1, 3, 6, 1, 4, 1, 529, 25, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("invalid", 2), ("radOldAscend", 3), ("radVendorSpecific", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: callLoggingRadCompatMode.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingRadCompatMode.setDescription('Indicates call logging RADIUS compatibility mode. This variable is deprecated, starting with TAOS Release 8.0. this variable has a fixed value of radVendorSpecific(4)') mibBuilder.exportSymbols("ASCEND-CALL-LOGGING-MIB", callLoggingKey=callLoggingKey, callLoggingServerEntry=callLoggingServerEntry, callLoggingStatus=callLoggingStatus, callLoggingDroppedPacketCount=callLoggingDroppedPacketCount, callLoggingServerIndex=callLoggingServerIndex, callLoggingTimeout=callLoggingTimeout, callLoggingServerTable=callLoggingServerTable, callLoggingStopPacketsOnly=callLoggingStopPacketsOnly, callLoggingRadCompatMode=callLoggingRadCompatMode, callLoggingNumServers=callLoggingNumServers, callLoggingResetTime=callLoggingResetTime, callLoggingRetryLimit=callLoggingRetryLimit, callLoggingIdBase=callLoggingIdBase, callLoggingEnableActiveServer=callLoggingEnableActiveServer, callLoggingAssStatus=callLoggingAssStatus, callLoggingCurrentServerFlag=callLoggingCurrentServerFlag, callLoggingServerIPAddress=callLoggingServerIPAddress, callLoggingPortNumber=callLoggingPortNumber)
(call_logging_group,) = mibBuilder.importSymbols('ASCEND-MIB', 'callLoggingGroup') (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (ip_address, mib_identifier, time_ticks, unsigned32, notification_type, gauge32, counter64, counter32, iso, bits, integer32, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'MibIdentifier', 'TimeTicks', 'Unsigned32', 'NotificationType', 'Gauge32', 'Counter64', 'Counter32', 'iso', 'Bits', 'Integer32', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') call_logging_num_servers = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: callLoggingNumServers.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingNumServers.setDescription('The maximum number of Call Logging servers supported by the system.') call_logging_server_table = mib_table((1, 3, 6, 1, 4, 1, 529, 25, 2)) if mibBuilder.loadTexts: callLoggingServerTable.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerTable.setDescription('A list of entries for Call Logging Server addresses.') call_logging_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 529, 25, 2, 1)).setIndexNames((0, 'ASCEND-CALL-LOGGING-MIB', 'callLoggingServerIndex')) if mibBuilder.loadTexts: callLoggingServerEntry.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerEntry.setDescription('Entry holding information about the currently active Call Logging Server and the address of a Server.') call_logging_server_index = mib_table_column((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: callLoggingServerIndex.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerIndex.setDescription("The index number for this Call Logging server entry. Its value ranges from 1 to 'callLoggingNumServers'. and identifies which server entry is associated with.") call_logging_current_server_flag = mib_table_column((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('standby', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: callLoggingCurrentServerFlag.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingCurrentServerFlag.setDescription('Value indicates whether this entry is the current Call Logging server or not.') call_logging_server_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 3), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingServerIPAddress.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingServerIPAddress.setDescription('The IP address of Call Logging server. The value 0.0.0.0 is returned if entry is invalid.') call_logging_enable_active_server = mib_table_column((1, 3, 6, 1, 4, 1, 529, 25, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('notApplicable', 1), ('enable', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingEnableActiveServer.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingEnableActiveServer.setDescription('This is used to set the active call Logging server. If set to enable(2) it will enable the call Logging server, A read on the variable will return notApplicable(1).') call_logging_status = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingStatus.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingStatus.setDescription('Enable/Disable call loggin support. Note: Prior to enable the call Logging, one of the Call Logging server must be setup with a valid IP address. If the server IP address is not setup, a SET to this object will return with a bad value error.') call_logging_port_number = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingPortNumber.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingPortNumber.setDescription('The UDP server port to use for Call Logging packets.') call_logging_key = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 5), octet_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingKey.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingKey.setDescription('The (RADIUS_ACCT) call logging key to access server.') call_logging_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 6), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingTimeout.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingTimeout.setDescription('Number of seconds to wait for a response to previous Call Logging request sent to server.') call_logging_id_base = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 10, 16))).clone(namedValues=named_values(('other', 1), ('invalid', 2), ('base10', 10), ('base16', 16)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingIdBase.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingIdBase.setDescription('The Base to use in reporting Call Logging ID.') call_logging_reset_time = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingResetTime.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingResetTime.setDescription('The time to reset to the primary server after it has failed.') call_logging_stop_packets_only = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingStopPacketsOnly.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingStopPacketsOnly.setDescription('Send call log Stop packets that have username=0. These are caused by connections that are dropped before authentication is done.') call_logging_retry_limit = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 10), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingRetryLimit.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingRetryLimit.setDescription('Number of retries before removing Call Logging packet. 0 means leave on retry list until maximum retry entries are exceeded.') call_logging_ass_status = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('idle', 1), ('active', 2), ('aborted', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: callLoggingAssStatus.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingAssStatus.setDescription('Indicates the status of Active Session Snapshot protocol. Writing the attribute with a nonzero value causes the start of an Active Session Snapshot. If no server is configured the Active Session Snapshot will abort immediatly, an active session can not be aborted') call_logging_dropped_packet_count = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 12), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: callLoggingDroppedPacketCount.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingDroppedPacketCount.setDescription('Number of dropped Call Logging packets since the last Active Session Snapshot') call_logging_rad_compat_mode = mib_scalar((1, 3, 6, 1, 4, 1, 529, 25, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('invalid', 2), ('radOldAscend', 3), ('radVendorSpecific', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: callLoggingRadCompatMode.setStatus('mandatory') if mibBuilder.loadTexts: callLoggingRadCompatMode.setDescription('Indicates call logging RADIUS compatibility mode. This variable is deprecated, starting with TAOS Release 8.0. this variable has a fixed value of radVendorSpecific(4)') mibBuilder.exportSymbols('ASCEND-CALL-LOGGING-MIB', callLoggingKey=callLoggingKey, callLoggingServerEntry=callLoggingServerEntry, callLoggingStatus=callLoggingStatus, callLoggingDroppedPacketCount=callLoggingDroppedPacketCount, callLoggingServerIndex=callLoggingServerIndex, callLoggingTimeout=callLoggingTimeout, callLoggingServerTable=callLoggingServerTable, callLoggingStopPacketsOnly=callLoggingStopPacketsOnly, callLoggingRadCompatMode=callLoggingRadCompatMode, callLoggingNumServers=callLoggingNumServers, callLoggingResetTime=callLoggingResetTime, callLoggingRetryLimit=callLoggingRetryLimit, callLoggingIdBase=callLoggingIdBase, callLoggingEnableActiveServer=callLoggingEnableActiveServer, callLoggingAssStatus=callLoggingAssStatus, callLoggingCurrentServerFlag=callLoggingCurrentServerFlag, callLoggingServerIPAddress=callLoggingServerIPAddress, callLoggingPortNumber=callLoggingPortNumber)
filepath = 'Prometheus_Unbound.txt' with open(filepath) as fp: line = fp.readline() cnt = 1 while line: print("Line {}: {}".format(cnt, line.strip())) line = fp.readline() cnt += 1
filepath = 'Prometheus_Unbound.txt' with open(filepath) as fp: line = fp.readline() cnt = 1 while line: print('Line {}: {}'.format(cnt, line.strip())) line = fp.readline() cnt += 1
sum = 0 for i in range(1000): if i%3==0 or i%5==0: sum+=i print(sum)
sum = 0 for i in range(1000): if i % 3 == 0 or i % 5 == 0: sum += i print(sum)
# https://www.codingame.com/training/easy/lumen def get_neighbors(col, row, room_size): if room_size == 1: return if row > 0: yield col, row - 1 if col > 0: yield col - 1, row - 1 if col < room_size - 1: yield col + 1, row - 1 if row < room_size - 1: yield col, row + 1 if col > 0: yield col - 1, row + 1 if col < room_size - 1: yield col + 1, row + 1 if col > 0: yield col - 1, row if col < room_size - 1: yield col + 1, row def fill_light(col, row, light_level, room, room_size): if light_level == 0: return if room[col][row] in ('X', 'C'): room[col][row] = light_level elif room[col][row] >= light_level: return room[col][row] = light_level for nc, nr in get_neighbors(col, row, room_size): fill_light(nc, nr, light_level - 1, room, room_size) def count_dark_spots(room, room_size): ret = 0 for col in range(room_size): for row in range(room_size): if room[col][row] in ('X', 0): ret += 1 return ret def solution(): room_size = int(input()) base_light = int(input()) candles = [] room = [] for col in range(room_size): room.append(input().split()) for row, c in enumerate(room[-1]): if c == 'C': candles.append((col, row)) for col, row in candles: fill_light(col, row, base_light, room, room_size) dark_spots = count_dark_spots(room, room_size) print(dark_spots) solution()
def get_neighbors(col, row, room_size): if room_size == 1: return if row > 0: yield (col, row - 1) if col > 0: yield (col - 1, row - 1) if col < room_size - 1: yield (col + 1, row - 1) if row < room_size - 1: yield (col, row + 1) if col > 0: yield (col - 1, row + 1) if col < room_size - 1: yield (col + 1, row + 1) if col > 0: yield (col - 1, row) if col < room_size - 1: yield (col + 1, row) def fill_light(col, row, light_level, room, room_size): if light_level == 0: return if room[col][row] in ('X', 'C'): room[col][row] = light_level elif room[col][row] >= light_level: return room[col][row] = light_level for (nc, nr) in get_neighbors(col, row, room_size): fill_light(nc, nr, light_level - 1, room, room_size) def count_dark_spots(room, room_size): ret = 0 for col in range(room_size): for row in range(room_size): if room[col][row] in ('X', 0): ret += 1 return ret def solution(): room_size = int(input()) base_light = int(input()) candles = [] room = [] for col in range(room_size): room.append(input().split()) for (row, c) in enumerate(room[-1]): if c == 'C': candles.append((col, row)) for (col, row) in candles: fill_light(col, row, base_light, room, room_size) dark_spots = count_dark_spots(room, room_size) print(dark_spots) solution()
neighborhoods = [ "Andersonville", "Archer Heights", "Ashburn", "Ashburn Estates", "Austin", "Avaondale", "Belmont Central", "Beverly", "Beverly Woods", "Brainerd", "Bridgeport", "Brighton Park", "Bronceville", "Bucktown", "Burnside", "Calumet Heights", "Canaryville", "Clearing", "Chatham", "Chinatown", "Cottage Grove Heights", "Cragin", "Dunning", "East Chicago", "Edison Park", "Edgebrook", "Edgewater", "Englewood", "Ford City", "Gage Park", "Galewood", "Garfield Park", "Garfield Ridge", "Gold Coast", "Grand Crossing", "Gresham", "Hamilton Park", "Humboldt Park", "Hyde Park", "Jefferson Park", "Kelvyn Park", "Kenwood", "Kilbourn Park", "Lake Meadows", "Lakeview", "Lawndale", "Lincoln Park", "Lincoln Square", "Little Village", "Logan Square", "Longwood Manor", "Loop", "Marquette Park", "McKinley Park", "Midway", "Morgan Park", "Montclare", "Mount Greenwood", "North Center", "Norwood Park", "Old Irving Park", "Old Town", "Park Manor", "Pilsen", "Princeton Park", "Portage Park", "Pullman", "Ravenswood", "River North", "River West", "Rodgers Park", "Roscoe VIllage", "Roseland", "Sauganash", "Schorsch Village", "Scottsdale", "South Chicago", "South Deering", "South Loop", "South Shore", "Streeterville", "Tri-Taylor", "Ukrainian Village", "United Center", "Uptown", "Vittum Park", "Washington Heights", "West Elsdon", "West Loop", "West Pullman", "Westlawn", "Wicker Park", "Woodlawn", "Wrigleyville", "Wrigtwood", ]
neighborhoods = ['Andersonville', 'Archer Heights', 'Ashburn', 'Ashburn Estates', 'Austin', 'Avaondale', 'Belmont Central', 'Beverly', 'Beverly Woods', 'Brainerd', 'Bridgeport', 'Brighton Park', 'Bronceville', 'Bucktown', 'Burnside', 'Calumet Heights', 'Canaryville', 'Clearing', 'Chatham', 'Chinatown', 'Cottage Grove Heights', 'Cragin', 'Dunning', 'East Chicago', 'Edison Park', 'Edgebrook', 'Edgewater', 'Englewood', 'Ford City', 'Gage Park', 'Galewood', 'Garfield Park', 'Garfield Ridge', 'Gold Coast', 'Grand Crossing', 'Gresham', 'Hamilton Park', 'Humboldt Park', 'Hyde Park', 'Jefferson Park', 'Kelvyn Park', 'Kenwood', 'Kilbourn Park', 'Lake Meadows', 'Lakeview', 'Lawndale', 'Lincoln Park', 'Lincoln Square', 'Little Village', 'Logan Square', 'Longwood Manor', 'Loop', 'Marquette Park', 'McKinley Park', 'Midway', 'Morgan Park', 'Montclare', 'Mount Greenwood', 'North Center', 'Norwood Park', 'Old Irving Park', 'Old Town', 'Park Manor', 'Pilsen', 'Princeton Park', 'Portage Park', 'Pullman', 'Ravenswood', 'River North', 'River West', 'Rodgers Park', 'Roscoe VIllage', 'Roseland', 'Sauganash', 'Schorsch Village', 'Scottsdale', 'South Chicago', 'South Deering', 'South Loop', 'South Shore', 'Streeterville', 'Tri-Taylor', 'Ukrainian Village', 'United Center', 'Uptown', 'Vittum Park', 'Washington Heights', 'West Elsdon', 'West Loop', 'West Pullman', 'Westlawn', 'Wicker Park', 'Woodlawn', 'Wrigleyville', 'Wrigtwood']
largura = int(input('digite a largura: ')) altura = int(input('digite a altura: ')) resetalargura = largura contador = largura print((largura) * '#', end='') while altura > 0: while contador < largura and contador > 0: print('#', end='') contador -= 1 print('#') altura -= 1 print((largura) * '#', end='') #while altura > 1: #if contador < largura and contador > 0: #print('#', (largura - 3) * ' ', end='') #elif contador == largura: #print((largura - 1) * '#', end='') #print('#') #altura -= 1 #contador -= 1 # #print((largura) * '#', end='')
largura = int(input('digite a largura: ')) altura = int(input('digite a altura: ')) resetalargura = largura contador = largura print(largura * '#', end='') while altura > 0: while contador < largura and contador > 0: print('#', end='') contador -= 1 print('#') altura -= 1 print(largura * '#', end='')
def task_dis(size,task_list): task_num=len(task_list) task_dis_list=[] for i in range(size): task_dis_list.append([]) #print(str(task_dis_list)) for i in range(len(task_list)): for j in range(size): if i%size==j: task_dis_list[j].append(task_list[i]) #for i in range(size): # print("************"+str(i)+"************") # print(str(task_dis_list[i])) return task_dis_list #testing code if 1==0: size=12 task_list=[{0,2},{1,2},{2,2},{3,2},{4,2},{5,2},{6,2},{7,2},{8,2},{9,2},\ {10,2},{11,2},{12,2},{13,2},{14,2},{15,2},{16,2},{17,2},{18,2},{19,2}, {20,2},{21,2},{22,2},{23,2},{24,2},{25,2},{26,2},{27,2},{28,2},{29,2}, {30,2},{31,2},{32,2},{33,2},{34,2},{35,2},{36,2},{37,2},{38,2},{39,2}] task_dis_list=task_dis(size,task_list) print(str(task_dis_list)) for i in range(size): print("************"+str(i)+"************") print(str(task_dis_list[i]))
def task_dis(size, task_list): task_num = len(task_list) task_dis_list = [] for i in range(size): task_dis_list.append([]) for i in range(len(task_list)): for j in range(size): if i % size == j: task_dis_list[j].append(task_list[i]) return task_dis_list if 1 == 0: size = 12 task_list = [{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}, {6, 2}, {7, 2}, {8, 2}, {9, 2}, {10, 2}, {11, 2}, {12, 2}, {13, 2}, {14, 2}, {15, 2}, {16, 2}, {17, 2}, {18, 2}, {19, 2}, {20, 2}, {21, 2}, {22, 2}, {23, 2}, {24, 2}, {25, 2}, {26, 2}, {27, 2}, {28, 2}, {29, 2}, {30, 2}, {31, 2}, {32, 2}, {33, 2}, {34, 2}, {35, 2}, {36, 2}, {37, 2}, {38, 2}, {39, 2}] task_dis_list = task_dis(size, task_list) print(str(task_dis_list)) for i in range(size): print('************' + str(i) + '************') print(str(task_dis_list[i]))
''' By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ''' p_no = 0 def is_prime(x): if x >= 2: for y in range(2,x): if not( x % y ): #reverse the modulo operation return False else: return False return True arr=[] for i in range(int(100000)): if is_prime(i)==True: p_no += 1 arr.append(i) print(arr) print ("We found " + str(p_no) + " prime numbers.")
""" By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? """ p_no = 0 def is_prime(x): if x >= 2: for y in range(2, x): if not x % y: return False else: return False return True arr = [] for i in range(int(100000)): if is_prime(i) == True: p_no += 1 arr.append(i) print(arr) print('We found ' + str(p_no) + ' prime numbers.')
load("//third_party:repos/boost.bzl", "boost_repository") load("//third_party:repos/grpc.bzl", "grpc_rules_repository") load("//third_party:repos/gtest.bzl", "gtest_repository") def dependencies(excludes = []): ignores = native.existing_rules().keys() + excludes if "com_github_nelhage_rules_boost" not in ignores: boost_repository() if "rules_proto_grpc" not in ignores: grpc_rules_repository() if "gtest" not in ignores: gtest_repository(name = "gtest")
load('//third_party:repos/boost.bzl', 'boost_repository') load('//third_party:repos/grpc.bzl', 'grpc_rules_repository') load('//third_party:repos/gtest.bzl', 'gtest_repository') def dependencies(excludes=[]): ignores = native.existing_rules().keys() + excludes if 'com_github_nelhage_rules_boost' not in ignores: boost_repository() if 'rules_proto_grpc' not in ignores: grpc_rules_repository() if 'gtest' not in ignores: gtest_repository(name='gtest')
class EncodingEnum: BINARY_ENCODING = 0 BINARY_WITH_VARIABLE_LENGTH_STRINGS = 1 JSON_ENCODING = 2 JSON_COMPACT_ENCODING = 3 PROTOCOL_BUFFERS = 4
class Encodingenum: binary_encoding = 0 binary_with_variable_length_strings = 1 json_encoding = 2 json_compact_encoding = 3 protocol_buffers = 4
num = int(input('Digite um numero [999 para parar]: ')) soma = 0 tot = 0 while num != 999: soma += num tot += 1 num = int(input('Digite um numero [999 para parar] : ')) print(f'{soma} e {tot}')
num = int(input('Digite um numero [999 para parar]: ')) soma = 0 tot = 0 while num != 999: soma += num tot += 1 num = int(input('Digite um numero [999 para parar] : ')) print(f'{soma} e {tot}')
_base_ = [ '../../_base_/models/faster_rcnn_r50_fpn.py', '../../_base_/datasets/waymo_detection_1280x1920.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model model = dict( rpn_head=dict( anchor_generator=dict( type='AnchorGenerator', scales=[3], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64]),), roi_head=dict( bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels=256, featmap_strides=[4, 8, 16, 32], finest_scale=19), bbox_head=dict(num_classes=3)) ) # data data = dict(samples_per_gpu=4) # lr is set for a batch size of 8 optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[8, 11]) runner = dict(type='EpochBasedRunner', max_epochs=12) # load_from = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth' # noqa resume_from = 'saved_models/study/faster_rcnn_r50_fpn_fp16_4x2_1x_1280x1920_improved/epoch_10.pth' # fp16 settings fp16 = dict(loss_scale=512.)
_base_ = ['../../_base_/models/faster_rcnn_r50_fpn.py', '../../_base_/datasets/waymo_detection_1280x1920.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'] model = dict(rpn_head=dict(anchor_generator=dict(type='AnchorGenerator', scales=[3], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64])), roi_head=dict(bbox_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels=256, featmap_strides=[4, 8, 16, 32], finest_scale=19), bbox_head=dict(num_classes=3))) data = dict(samples_per_gpu=4) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[8, 11]) runner = dict(type='EpochBasedRunner', max_epochs=12) resume_from = 'saved_models/study/faster_rcnn_r50_fpn_fp16_4x2_1x_1280x1920_improved/epoch_10.pth' fp16 = dict(loss_scale=512.0)
a = 5 b = 6 c = 7.5 result = multiply(a, b, c) print(result)
a = 5 b = 6 c = 7.5 result = multiply(a, b, c) print(result)
ch=input("Enter ch = ") for i in range (0,len(ch)-1,2): if(ch[i].isalpha()): print((ch[i])*int(ch[i+1]),end="") elif(ch[i+1].isalpha()): print((ch[i+1])*int(ch[i]),end="")
ch = input('Enter ch = ') for i in range(0, len(ch) - 1, 2): if ch[i].isalpha(): print(ch[i] * int(ch[i + 1]), end='') elif ch[i + 1].isalpha(): print(ch[i + 1] * int(ch[i]), end='')
class KalmanFilter: def __init__(self, errorMeasurement, errorEstimate, q): self.errorMeasurement = errorMeasurement self.errorEstimate = errorEstimate self.q = q #covariance error self.lastEstimate = 25.0 self.currentEstimate = 25.0 def updateEstimate(self,measurement): kGain = self.errorEstimate/(self.errorEstimate+self.errorMeasurement) self.currentEstimate = self.lastEstimate + kGain*(measurement-self.lastEstimate) self.errorEstimate = (1.0-kGain)*self.errorEstimate + abs(self.lastEstimate-self.currentEstimate)*self.q self.lastEstimate=self.currentEstimate return self.currentEstimate def setLastEstimate(self,val): self.lastEstimate = val self.currentEstimate = val
class Kalmanfilter: def __init__(self, errorMeasurement, errorEstimate, q): self.errorMeasurement = errorMeasurement self.errorEstimate = errorEstimate self.q = q self.lastEstimate = 25.0 self.currentEstimate = 25.0 def update_estimate(self, measurement): k_gain = self.errorEstimate / (self.errorEstimate + self.errorMeasurement) self.currentEstimate = self.lastEstimate + kGain * (measurement - self.lastEstimate) self.errorEstimate = (1.0 - kGain) * self.errorEstimate + abs(self.lastEstimate - self.currentEstimate) * self.q self.lastEstimate = self.currentEstimate return self.currentEstimate def set_last_estimate(self, val): self.lastEstimate = val self.currentEstimate = val
''' Settings for generating synthetic images using code for Cut, Paste, and Learn Paper ''' # Paths BACKGROUND_DIR = '/scratch/jnan1/background/TRAIN' BACKGROUND_GLOB_STRING = '*.png' INVERTED_MASK = False # Set to true if white pixels represent background # Parameters for generator NUMBER_OF_WORKERS = 4 BLENDING_LIST = ['gaussian', 'none', 'box', 'motion'] # Parameters for images MIN_NO_OF_OBJECTS = 1 MAX_NO_OF_OBJECTS = 3 MIN_NO_OF_DISTRACTOR_OBJECTS = 1 MAX_NO_OF_DISTRACTOR_OBJECTS = 3 WIDTH = 960 HEIGHT = 720 OBJECT_SIZE = 256 MAX_ATTEMPTS_TO_SYNTHESIZE = 20 # Parameters for objects in images MIN_SCALE = 0.25 # min scale for scale augmentation MAX_SCALE = 0.6 # max scale for scale augmentation MAX_DEGREES = 30 # max rotation allowed during rotation augmentation MAX_TRUNCATION_FRACTION = 0 # max fraction to be truncated = MAX_TRUNCACTION_FRACTION*(WIDTH/HEIGHT) MAX_ALLOWED_IOU = 0.75 # IOU > MAX_ALLOWED_IOU is considered an occlusion MIN_WIDTH = 6 # Minimum width of object to use for data generation MIN_HEIGHT = 6 # Minimum height of object to use for data generation
""" Settings for generating synthetic images using code for Cut, Paste, and Learn Paper """ background_dir = '/scratch/jnan1/background/TRAIN' background_glob_string = '*.png' inverted_mask = False number_of_workers = 4 blending_list = ['gaussian', 'none', 'box', 'motion'] min_no_of_objects = 1 max_no_of_objects = 3 min_no_of_distractor_objects = 1 max_no_of_distractor_objects = 3 width = 960 height = 720 object_size = 256 max_attempts_to_synthesize = 20 min_scale = 0.25 max_scale = 0.6 max_degrees = 30 max_truncation_fraction = 0 max_allowed_iou = 0.75 min_width = 6 min_height = 6
# https://adventofcode.com/2019/day/4 def is_valid_password(i: int, version: int = 1) -> bool: i_digits = [int(digit) for digit in str(i)] is_increasing, repeats = True, False for k in range(len(i_digits) - 1): if i_digits[k] > i_digits[k+1]: is_increasing = False elif version == 1 and i_digits[k] == i_digits[k+1]: repeats = True elif version == 2 and i_digits[k] == i_digits[k+1]: if 0 < k < len(i_digits) - 2: valid_repeat = ((i_digits[k-1] != i_digits[k]) and (i_digits[k+1] != i_digits[k+2])) elif k == 0: valid_repeat = i_digits[k+1] != i_digits[k+2] elif k == len(i_digits) - 2: valid_repeat = i_digits[k-1] != i_digits[k] else: raise ValueError('k takes on an unexpected value') if valid_repeat: repeats = True return is_increasing and repeats def main(code_range: iter): password_count = [0, 0] for i in code_range: password_count[0] += int(is_valid_password(i, version=1)) password_count[1] += int(is_valid_password(i, version=2)) print(password_count[0]) print(password_count[1]) if __name__ == '__main__': possible_range = range(156218, 652527 + 1) main(possible_range)
def is_valid_password(i: int, version: int=1) -> bool: i_digits = [int(digit) for digit in str(i)] (is_increasing, repeats) = (True, False) for k in range(len(i_digits) - 1): if i_digits[k] > i_digits[k + 1]: is_increasing = False elif version == 1 and i_digits[k] == i_digits[k + 1]: repeats = True elif version == 2 and i_digits[k] == i_digits[k + 1]: if 0 < k < len(i_digits) - 2: valid_repeat = i_digits[k - 1] != i_digits[k] and i_digits[k + 1] != i_digits[k + 2] elif k == 0: valid_repeat = i_digits[k + 1] != i_digits[k + 2] elif k == len(i_digits) - 2: valid_repeat = i_digits[k - 1] != i_digits[k] else: raise value_error('k takes on an unexpected value') if valid_repeat: repeats = True return is_increasing and repeats def main(code_range: iter): password_count = [0, 0] for i in code_range: password_count[0] += int(is_valid_password(i, version=1)) password_count[1] += int(is_valid_password(i, version=2)) print(password_count[0]) print(password_count[1]) if __name__ == '__main__': possible_range = range(156218, 652527 + 1) main(possible_range)
#Function which finds 45 minutes before current time def alarm_clock(h, m): #Finding total minutes passed total_minutes = h * 60 + m ans = [] #Subtracting 45 minutes if total_minutes >= 45: answer_minutes = total_minutes - 45 else: answer_minutes = total_minutes - 45 + 1440 #Finding answer hours, and minutes ans += [answer_minutes // 60, answer_minutes % 60] #Returning value return ans #Input part H, M = map(int, input().split()) answer_list = [] #Applying algorithm answer_list = alarm_clock(H, M) #Output part for i in range(len(answer_list)): print(answer_list[i], end = " ") print()
def alarm_clock(h, m): total_minutes = h * 60 + m ans = [] if total_minutes >= 45: answer_minutes = total_minutes - 45 else: answer_minutes = total_minutes - 45 + 1440 ans += [answer_minutes // 60, answer_minutes % 60] return ans (h, m) = map(int, input().split()) answer_list = [] answer_list = alarm_clock(H, M) for i in range(len(answer_list)): print(answer_list[i], end=' ') print()
class TypeValidator(object): def __init__(self, *types, **options): self.types = types self.exclude = options.get('exclude') def __call__(self, value): if self.exclude is not None and isinstance(value, self.exclude): return False if not isinstance(value, self.types): return False return True class AttributeValidator(object): def __init__(self, attribute): self.attribute = attribute def __call__(self, value): if not hasattr(value, self.attribute): return False return True
class Typevalidator(object): def __init__(self, *types, **options): self.types = types self.exclude = options.get('exclude') def __call__(self, value): if self.exclude is not None and isinstance(value, self.exclude): return False if not isinstance(value, self.types): return False return True class Attributevalidator(object): def __init__(self, attribute): self.attribute = attribute def __call__(self, value): if not hasattr(value, self.attribute): return False return True
class ImageArea: def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = self.width * self.height return area def __gt__(self, other): return self.get_area() > other.get_area() def __ge__(self, other): return self.get_area() >= other.get_area() def __lt__(self, other): return self.get_area() < other.get_area() def __le__(self, other): return self.get_area() <= other.get_area() def __eq__(self, other): return self.get_area() == other.get_area() def __ne__(self, other): return self.get_area() != other.get_area() image_one = ImageArea(10, 10) image_two = ImageArea(10, 10) print(image_one < image_two) print(image_one <= image_two) print(image_one > image_two) print(image_one >= image_two) print(image_one == image_two) print(image_one != image_two)
class Imagearea: def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = self.width * self.height return area def __gt__(self, other): return self.get_area() > other.get_area() def __ge__(self, other): return self.get_area() >= other.get_area() def __lt__(self, other): return self.get_area() < other.get_area() def __le__(self, other): return self.get_area() <= other.get_area() def __eq__(self, other): return self.get_area() == other.get_area() def __ne__(self, other): return self.get_area() != other.get_area() image_one = image_area(10, 10) image_two = image_area(10, 10) print(image_one < image_two) print(image_one <= image_two) print(image_one > image_two) print(image_one >= image_two) print(image_one == image_two) print(image_one != image_two)
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: found = {} max_length = 0 start_pos = -1 for pos, char in enumerate(s): if char in found and start_pos <= found[char]: start_pos = found[char] else: max_length = max(max_length, pos - start_pos) found[char] = pos return max_length
class Solution: def length_of_longest_substring(self, s: str) -> int: found = {} max_length = 0 start_pos = -1 for (pos, char) in enumerate(s): if char in found and start_pos <= found[char]: start_pos = found[char] else: max_length = max(max_length, pos - start_pos) found[char] = pos return max_length
try: raise ArithmeticError except Exception: print("Caught ArithmeticError via Exception") try: raise ArithmeticError except ArithmeticError: print("Caught ArithmeticError") try: raise AssertionError except Exception: print("Caught AssertionError via Exception") try: raise AssertionError except AssertionError: print("Caught AssertionError") try: raise AttributeError except Exception: print("Caught AttributeError via Exception") try: raise AttributeError except AttributeError: print("Caught AttributeError") #try: # raise BufferError #except Exception: # print("Caught BufferError via Exception") #try: # raise BufferError #except BufferError: # print("Caught BufferError") #try: # raise BytesWarning #except Warning: # print("Caught BytesWarning via Warning") #try: # raise BytesWarning #except BytesWarning: # print("Caught BytesWarning") #try: # raise DeprecationWarning #except Warning: # print("Caught DeprecationWarning via Warning") #try: # raise DeprecationWarning #except DeprecationWarning: # print("Caught DeprecationWarning") try: raise EOFError except Exception: print("Caught EOFError via Exception") try: raise EOFError except EOFError: print("Caught EOFError") #try: # raise EnvironmentError #except Exception: # print("Caught EnvironmentError via Exception") #try: # raise EnvironmentError #except EnvironmentError: # print("Caught EnvironmentError") try: raise Exception except BaseException: print("Caught Exception via BaseException") try: raise Exception except Exception: print("Caught Exception") #try: # raise FloatingPointError #except ArithmeticError: # print("Caught FloatingPointError via ArithmeticError") #try: # raise FloatingPointError #except FloatingPointError: # print("Caught FloatingPointError") #try: # raise FutureWarning #except Warning: # print("Caught FutureWarning via Warning") #try: # raise FutureWarning #except FutureWarning: # print("Caught FutureWarning") #try: # raise IOError #except Exception: # print("Caught IOError via Exception") #try: # raise IOError #except IOError: # print("Caught IOError") try: raise ImportError except Exception: print("Caught ImportError via Exception") try: raise ImportError except ImportError: print("Caught ImportError") #try: # raise ImportWarning #except Warning: # print("Caught ImportWarning via Warning") #try: # raise ImportWarning #except ImportWarning: # print("Caught ImportWarning") try: raise IndentationError except SyntaxError: print("Caught IndentationError via SyntaxError") try: raise IndentationError except IndentationError: print("Caught IndentationError") try: raise IndexError except LookupError: print("Caught IndexError via LookupError") try: raise IndexError except IndexError: print("Caught IndexError") try: raise KeyError except LookupError: print("Caught KeyError via LookupError") try: raise KeyError except KeyError: print("Caught KeyError") try: raise LookupError except Exception: print("Caught LookupError via Exception") try: raise LookupError except LookupError: print("Caught LookupError") try: raise MemoryError except Exception: print("Caught MemoryError via Exception") try: raise MemoryError except MemoryError: print("Caught MemoryError") try: raise NameError except Exception: print("Caught NameError via Exception") try: raise NameError except NameError: print("Caught NameError") try: raise NotImplementedError except RuntimeError: print("Caught NotImplementedError via RuntimeError") try: raise NotImplementedError except NotImplementedError: print("Caught NotImplementedError") try: raise OSError except Exception: print("Caught OSError via Exception") try: raise OSError except OSError: print("Caught OSError") try: raise OverflowError except ArithmeticError: print("Caught OverflowError via ArithmeticError") try: raise OverflowError except OverflowError: print("Caught OverflowError") #try: # raise PendingDeprecationWarning #except Warning: # print("Caught PendingDeprecationWarning via Warning") #try: # raise PendingDeprecationWarning #except PendingDeprecationWarning: # print("Caught PendingDeprecationWarning") #try: # raise ReferenceError #except Exception: # print("Caught ReferenceError via Exception") #try: # raise ReferenceError #except ReferenceError: # print("Caught ReferenceError") #try: # raise ResourceWarning #except Warning: # print("Caught ResourceWarning via Warning") #try: # raise ResourceWarning #except ResourceWarning: # print("Caught ResourceWarning") try: raise RuntimeError except Exception: print("Caught RuntimeError via Exception") try: raise RuntimeError except RuntimeError: print("Caught RuntimeError") #try: # raise RuntimeWarning #except Warning: # print("Caught RuntimeWarning via Warning") #try: # raise RuntimeWarning #except RuntimeWarning: # print("Caught RuntimeWarning") try: raise SyntaxError except Exception: print("Caught SyntaxError via Exception") try: raise SyntaxError except SyntaxError: print("Caught SyntaxError") #try: # raise SyntaxWarning #except Warning: # print("Caught SyntaxWarning via Warning") #try: # raise SyntaxWarning #except SyntaxWarning: # print("Caught SyntaxWarning") try: raise SystemError except Exception: print("Caught SystemError via Exception") try: raise SystemError except SystemError: print("Caught SystemError") #try: # raise TabError #except IndentationError: # print("Caught TabError via IndentationError") #try: # raise TabError #except TabError: # print("Caught TabError") try: raise TypeError except Exception: print("Caught TypeError via Exception") try: raise TypeError except TypeError: print("Caught TypeError") #try: # raise UnboundLocalError #except NameError: # print("Caught UnboundLocalError via NameError") #try: # raise UnboundLocalError #except UnboundLocalError: # print("Caught UnboundLocalError") #try: # raise UserWarning #except Warning: # print("Caught UserWarning via Warning") #try: # raise UserWarning #except UserWarning: # print("Caught UserWarning") try: raise ValueError except Exception: print("Caught ValueError via Exception") try: raise ValueError except ValueError: print("Caught ValueError") #try: # raise Warning #except Exception: # print("Caught Warning via Exception") #try: # raise Warning #except Warning: # print("Caught Warning") try: raise ZeroDivisionError except ArithmeticError: print("Caught ZeroDivisionError via ArithmeticError") try: raise ZeroDivisionError except ZeroDivisionError: print("Caught ZeroDivisionError")
try: raise ArithmeticError except Exception: print('Caught ArithmeticError via Exception') try: raise ArithmeticError except ArithmeticError: print('Caught ArithmeticError') try: raise AssertionError except Exception: print('Caught AssertionError via Exception') try: raise AssertionError except AssertionError: print('Caught AssertionError') try: raise AttributeError except Exception: print('Caught AttributeError via Exception') try: raise AttributeError except AttributeError: print('Caught AttributeError') try: raise EOFError except Exception: print('Caught EOFError via Exception') try: raise EOFError except EOFError: print('Caught EOFError') try: raise Exception except BaseException: print('Caught Exception via BaseException') try: raise Exception except Exception: print('Caught Exception') try: raise ImportError except Exception: print('Caught ImportError via Exception') try: raise ImportError except ImportError: print('Caught ImportError') try: raise IndentationError except SyntaxError: print('Caught IndentationError via SyntaxError') try: raise IndentationError except IndentationError: print('Caught IndentationError') try: raise IndexError except LookupError: print('Caught IndexError via LookupError') try: raise IndexError except IndexError: print('Caught IndexError') try: raise KeyError except LookupError: print('Caught KeyError via LookupError') try: raise KeyError except KeyError: print('Caught KeyError') try: raise LookupError except Exception: print('Caught LookupError via Exception') try: raise LookupError except LookupError: print('Caught LookupError') try: raise MemoryError except Exception: print('Caught MemoryError via Exception') try: raise MemoryError except MemoryError: print('Caught MemoryError') try: raise NameError except Exception: print('Caught NameError via Exception') try: raise NameError except NameError: print('Caught NameError') try: raise NotImplementedError except RuntimeError: print('Caught NotImplementedError via RuntimeError') try: raise NotImplementedError except NotImplementedError: print('Caught NotImplementedError') try: raise OSError except Exception: print('Caught OSError via Exception') try: raise OSError except OSError: print('Caught OSError') try: raise OverflowError except ArithmeticError: print('Caught OverflowError via ArithmeticError') try: raise OverflowError except OverflowError: print('Caught OverflowError') try: raise RuntimeError except Exception: print('Caught RuntimeError via Exception') try: raise RuntimeError except RuntimeError: print('Caught RuntimeError') try: raise SyntaxError except Exception: print('Caught SyntaxError via Exception') try: raise SyntaxError except SyntaxError: print('Caught SyntaxError') try: raise SystemError except Exception: print('Caught SystemError via Exception') try: raise SystemError except SystemError: print('Caught SystemError') try: raise TypeError except Exception: print('Caught TypeError via Exception') try: raise TypeError except TypeError: print('Caught TypeError') try: raise ValueError except Exception: print('Caught ValueError via Exception') try: raise ValueError except ValueError: print('Caught ValueError') try: raise ZeroDivisionError except ArithmeticError: print('Caught ZeroDivisionError via ArithmeticError') try: raise ZeroDivisionError except ZeroDivisionError: print('Caught ZeroDivisionError')
# The directory where jobs are stored job_directory = "/fred/oz988/gwcloud/jobs/" # Format submission script for specified scheduler. scheduler = "slurm" # Environment scheduler sources during runtime scheduler_env = "/fred/oz988/gwcloud/gwcloud_job_client/bundles/unpacked/fbc9f7c0815f1a83b0de36f957351c93797b2049/venv/bin/activate"
job_directory = '/fred/oz988/gwcloud/jobs/' scheduler = 'slurm' scheduler_env = '/fred/oz988/gwcloud/gwcloud_job_client/bundles/unpacked/fbc9f7c0815f1a83b0de36f957351c93797b2049/venv/bin/activate'
# Node: Gate G102 (1096088604) # http://www.openstreetmap.org/node/1096088604 assert_has_feature( 16, 10487, 25366, 'pois', { 'id': 1096088604, 'kind': 'aeroway_gate' }) # Node: Gate 1 (2618197593) # http://www.openstreetmap.org/node/2618197593 assert_has_feature( 16, 10309, 22665, 'pois', { 'id': 2618197593, 'kind': 'gate', 'aeroway': type(None) }) # Node: Lone Star Sports # http://www.openstreetmap.org/node/2122898936 assert_has_feature( 16, 13462, 24933, 'pois', { 'id': 2122898936, 'kind': 'ski_rental' }) # http://www.openstreetmap.org/way/52497271 assert_has_feature( 16, 10566, 25429, 'landuse', { 'id': 52497271, 'kind': 'wood' }) # http://www.openstreetmap.org/way/207859675 assert_has_feature( 16, 11306, 26199, 'landuse', { 'id': 207859675, 'kind': 'wood' }) # http://www.openstreetmap.org/way/417405367 assert_has_feature( 16, 10480, 25323, 'landuse', { 'id': 417405367, 'kind': 'natural_wood' }) # http://www.openstreetmap.org/way/422270533 assert_has_feature( 16, 10476, 25324, 'landuse', { 'id': 422270533, 'kind': 'forest' }) # http://www.openstreetmap.org/way/95360670 assert_has_feature( 16, 17780, 27428, 'landuse', { 'id': 95360670, 'kind': 'natural_forest' }) # Way: Stables & Equestrian Area (393312618) # http://www.openstreetmap.org/way/393312618 assert_has_feature( 16, 10294, 25113, 'landuse', { 'id': 393312618, 'kind': 'park' }) # http://www.openstreetmap.org/way/29191880 assert_has_feature( 16, 12393, 26315, 'landuse', { 'id': 29191880, 'kind': 'natural_park' })
assert_has_feature(16, 10487, 25366, 'pois', {'id': 1096088604, 'kind': 'aeroway_gate'}) assert_has_feature(16, 10309, 22665, 'pois', {'id': 2618197593, 'kind': 'gate', 'aeroway': type(None)}) assert_has_feature(16, 13462, 24933, 'pois', {'id': 2122898936, 'kind': 'ski_rental'}) assert_has_feature(16, 10566, 25429, 'landuse', {'id': 52497271, 'kind': 'wood'}) assert_has_feature(16, 11306, 26199, 'landuse', {'id': 207859675, 'kind': 'wood'}) assert_has_feature(16, 10480, 25323, 'landuse', {'id': 417405367, 'kind': 'natural_wood'}) assert_has_feature(16, 10476, 25324, 'landuse', {'id': 422270533, 'kind': 'forest'}) assert_has_feature(16, 17780, 27428, 'landuse', {'id': 95360670, 'kind': 'natural_forest'}) assert_has_feature(16, 10294, 25113, 'landuse', {'id': 393312618, 'kind': 'park'}) assert_has_feature(16, 12393, 26315, 'landuse', {'id': 29191880, 'kind': 'natural_park'})
# Leo colorizer control file for io mode. # This file is in the public domain. # Properties for io mode. properties = { "commentStart": "*/", "indentCloseBrackets": ")", "indentOpenBrackets": "(", "lineComment": "//", "lineUpClosingBracket": "true", } # Attributes dict for io_main ruleset. io_main_attributes_dict = { "default": "null", "digit_re": "", "escape": "\\", "highlight_digits": "true", "ignore_case": "false", "no_word_sep": "", } # Dictionary of attributes dictionaries for io mode. attributesDictDict = { "io_main": io_main_attributes_dict, } # Keywords dict for io_main ruleset. io_main_keywords_dict = { "Block": "keyword1", "Buffer": "keyword1", "CFunction": "keyword1", "Date": "keyword1", "Duration": "keyword1", "File": "keyword1", "Future": "keyword1", "LinkedList": "keyword1", "List": "keyword1", "Map": "keyword1", "Message": "keyword1", "Nil": "keyword1", "Nop": "keyword1", "Number": "keyword1", "Object": "keyword1", "String": "keyword1", "WeakLink": "keyword1", "block": "keyword1", "clone": "keyword3", "do": "keyword2", "else": "keyword2", "foreach": "keyword2", "forward": "keyword3", "hasSlot": "keyword3", "if": "keyword2", "method": "keyword1", "print": "keyword3", "proto": "keyword3", "self": "keyword3", "setSlot": "keyword3", "super": "keyword3", "type": "keyword3", "while": "keyword2", "write": "keyword3", } # Dictionary of keywords dictionaries for io mode. keywordsDictDict = { "io_main": io_main_keywords_dict, } # Rules for io_main ruleset. def io_rule0(colorer, s, i): return colorer.match_eol_span(s, i, kind="comment1", seq="#", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="", exclude_match=False) def io_rule1(colorer, s, i): return colorer.match_eol_span(s, i, kind="comment1", seq="//", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="", exclude_match=False) def io_rule2(colorer, s, i): return colorer.match_span(s, i, kind="comment1", begin="/*", end="*/", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="",exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule3(colorer, s, i): return colorer.match_span(s, i, kind="literal2", begin="\"", end="\"", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="",exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule4(colorer, s, i): return colorer.match_span(s, i, kind="literal2", begin="\"\"\"", end="\"\"\"", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="",exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule5(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="`", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule6(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="~", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule7(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="@", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule8(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="@@", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule9(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="$", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule10(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="%", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule11(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="^", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule12(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="&", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule13(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="*", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule14(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="-", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule15(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="+", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule16(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="/", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule17(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="=", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule18(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="{", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule19(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="}", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule20(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="[", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule21(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="]", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule22(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="|", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule23(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="\\", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule24(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq=">=", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule25(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="<=", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule26(colorer, s, i): return colorer.match_seq(s, i, kind="operator", seq="?", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def io_rule27(colorer, s, i): return colorer.match_keywords(s, i) # Rules dict for io_main ruleset. rulesDict1 = { "\"": [io_rule3,io_rule4,], "#": [io_rule0,], "$": [io_rule9,], "%": [io_rule10,], "&": [io_rule12,], "*": [io_rule13,], "+": [io_rule15,], "-": [io_rule14,], "/": [io_rule1,io_rule2,io_rule16,], "0": [io_rule27,], "1": [io_rule27,], "2": [io_rule27,], "3": [io_rule27,], "4": [io_rule27,], "5": [io_rule27,], "6": [io_rule27,], "7": [io_rule27,], "8": [io_rule27,], "9": [io_rule27,], "<": [io_rule25,], "=": [io_rule17,], ">": [io_rule24,], "?": [io_rule26,], "@": [io_rule7,io_rule8,io_rule27,], "A": [io_rule27,], "B": [io_rule27,], "C": [io_rule27,], "D": [io_rule27,], "E": [io_rule27,], "F": [io_rule27,], "G": [io_rule27,], "H": [io_rule27,], "I": [io_rule27,], "J": [io_rule27,], "K": [io_rule27,], "L": [io_rule27,], "M": [io_rule27,], "N": [io_rule27,], "O": [io_rule27,], "P": [io_rule27,], "Q": [io_rule27,], "R": [io_rule27,], "S": [io_rule27,], "T": [io_rule27,], "U": [io_rule27,], "V": [io_rule27,], "W": [io_rule27,], "X": [io_rule27,], "Y": [io_rule27,], "Z": [io_rule27,], "[": [io_rule20,], "\\": [io_rule23,], "]": [io_rule21,], "^": [io_rule11,], "`": [io_rule5,], "a": [io_rule27,], "b": [io_rule27,], "c": [io_rule27,], "d": [io_rule27,], "e": [io_rule27,], "f": [io_rule27,], "g": [io_rule27,], "h": [io_rule27,], "i": [io_rule27,], "j": [io_rule27,], "k": [io_rule27,], "l": [io_rule27,], "m": [io_rule27,], "n": [io_rule27,], "o": [io_rule27,], "p": [io_rule27,], "q": [io_rule27,], "r": [io_rule27,], "s": [io_rule27,], "t": [io_rule27,], "u": [io_rule27,], "v": [io_rule27,], "w": [io_rule27,], "x": [io_rule27,], "y": [io_rule27,], "z": [io_rule27,], "{": [io_rule18,], "|": [io_rule22,], "}": [io_rule19,], "~": [io_rule6,], } # x.rulesDictDict for io mode. rulesDictDict = { "io_main": rulesDict1, } # Import dict for io mode. importDict = {}
properties = {'commentStart': '*/', 'indentCloseBrackets': ')', 'indentOpenBrackets': '(', 'lineComment': '//', 'lineUpClosingBracket': 'true'} io_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'false', 'no_word_sep': ''} attributes_dict_dict = {'io_main': io_main_attributes_dict} io_main_keywords_dict = {'Block': 'keyword1', 'Buffer': 'keyword1', 'CFunction': 'keyword1', 'Date': 'keyword1', 'Duration': 'keyword1', 'File': 'keyword1', 'Future': 'keyword1', 'LinkedList': 'keyword1', 'List': 'keyword1', 'Map': 'keyword1', 'Message': 'keyword1', 'Nil': 'keyword1', 'Nop': 'keyword1', 'Number': 'keyword1', 'Object': 'keyword1', 'String': 'keyword1', 'WeakLink': 'keyword1', 'block': 'keyword1', 'clone': 'keyword3', 'do': 'keyword2', 'else': 'keyword2', 'foreach': 'keyword2', 'forward': 'keyword3', 'hasSlot': 'keyword3', 'if': 'keyword2', 'method': 'keyword1', 'print': 'keyword3', 'proto': 'keyword3', 'self': 'keyword3', 'setSlot': 'keyword3', 'super': 'keyword3', 'type': 'keyword3', 'while': 'keyword2', 'write': 'keyword3'} keywords_dict_dict = {'io_main': io_main_keywords_dict} def io_rule0(colorer, s, i): return colorer.match_eol_span(s, i, kind='comment1', seq='#', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False) def io_rule1(colorer, s, i): return colorer.match_eol_span(s, i, kind='comment1', seq='//', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False) def io_rule2(colorer, s, i): return colorer.match_span(s, i, kind='comment1', begin='/*', end='*/', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule3(colorer, s, i): return colorer.match_span(s, i, kind='literal2', begin='"', end='"', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule4(colorer, s, i): return colorer.match_span(s, i, kind='literal2', begin='"""', end='"""', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def io_rule5(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='`', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule6(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='~', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule7(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='@', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule8(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='@@', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule9(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='$', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule10(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='%', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule11(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='^', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule12(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='&', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule13(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='*', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule14(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='-', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule15(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='+', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule16(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='/', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule17(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='=', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule18(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='{', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule19(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='}', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule20(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='[', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule21(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq=']', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule22(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='|', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule23(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='\\', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule24(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='>=', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule25(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='<=', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule26(colorer, s, i): return colorer.match_seq(s, i, kind='operator', seq='?', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='') def io_rule27(colorer, s, i): return colorer.match_keywords(s, i) rules_dict1 = {'"': [io_rule3, io_rule4], '#': [io_rule0], '$': [io_rule9], '%': [io_rule10], '&': [io_rule12], '*': [io_rule13], '+': [io_rule15], '-': [io_rule14], '/': [io_rule1, io_rule2, io_rule16], '0': [io_rule27], '1': [io_rule27], '2': [io_rule27], '3': [io_rule27], '4': [io_rule27], '5': [io_rule27], '6': [io_rule27], '7': [io_rule27], '8': [io_rule27], '9': [io_rule27], '<': [io_rule25], '=': [io_rule17], '>': [io_rule24], '?': [io_rule26], '@': [io_rule7, io_rule8, io_rule27], 'A': [io_rule27], 'B': [io_rule27], 'C': [io_rule27], 'D': [io_rule27], 'E': [io_rule27], 'F': [io_rule27], 'G': [io_rule27], 'H': [io_rule27], 'I': [io_rule27], 'J': [io_rule27], 'K': [io_rule27], 'L': [io_rule27], 'M': [io_rule27], 'N': [io_rule27], 'O': [io_rule27], 'P': [io_rule27], 'Q': [io_rule27], 'R': [io_rule27], 'S': [io_rule27], 'T': [io_rule27], 'U': [io_rule27], 'V': [io_rule27], 'W': [io_rule27], 'X': [io_rule27], 'Y': [io_rule27], 'Z': [io_rule27], '[': [io_rule20], '\\': [io_rule23], ']': [io_rule21], '^': [io_rule11], '`': [io_rule5], 'a': [io_rule27], 'b': [io_rule27], 'c': [io_rule27], 'd': [io_rule27], 'e': [io_rule27], 'f': [io_rule27], 'g': [io_rule27], 'h': [io_rule27], 'i': [io_rule27], 'j': [io_rule27], 'k': [io_rule27], 'l': [io_rule27], 'm': [io_rule27], 'n': [io_rule27], 'o': [io_rule27], 'p': [io_rule27], 'q': [io_rule27], 'r': [io_rule27], 's': [io_rule27], 't': [io_rule27], 'u': [io_rule27], 'v': [io_rule27], 'w': [io_rule27], 'x': [io_rule27], 'y': [io_rule27], 'z': [io_rule27], '{': [io_rule18], '|': [io_rule22], '}': [io_rule19], '~': [io_rule6]} rules_dict_dict = {'io_main': rulesDict1} import_dict = {}
x = int(input()) ar = list(map(int,input().split())) ar = sorted(ar) if(ar[0]<=0): print(False) else: chk = False for i in ar: s = str(i) if (s==s[::-1]): chk = True break print(chk)
x = int(input()) ar = list(map(int, input().split())) ar = sorted(ar) if ar[0] <= 0: print(False) else: chk = False for i in ar: s = str(i) if s == s[::-1]: chk = True break print(chk)
#!/bin/zsh ''' Extending the Multiclipboard Extend the multiclipboard program in this chapter so that it has a delete <keyword> command line argument that will delete a keyword from the shelf. Then add a delete command line argument that will delete all keywords. '''
""" Extending the Multiclipboard Extend the multiclipboard program in this chapter so that it has a delete <keyword> command line argument that will delete a keyword from the shelf. Then add a delete command line argument that will delete all keywords. """
class CityNotFoundError(Exception): pass class ServerError(Exception): pass class OWMApiKeyIsNotCorrectError(ServerError): pass
class Citynotfounderror(Exception): pass class Servererror(Exception): pass class Owmapikeyisnotcorrecterror(ServerError): pass
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum == target: return [l + 1, r + 1] if sum < target: l += 1 else: r -= 1
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum == target: return [l + 1, r + 1] if sum < target: l += 1 else: r -= 1
HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' REDEFINED = "\033[0;0m" PROCESS = "\033[1;37;42m" def message_information(text): print(OKBLUE + str(text) + REDEFINED) def message_sucess(text): print(OKGREEN + str(text) + REDEFINED) def message_failed(text): print(FAIL + str(text) + REDEFINED) def message_warning(text): print(WARNING + str(text) + REDEFINED) def process(text): print(PROCESS + f" {text} " + REDEFINED)
header = '\x1b[95m' okblue = '\x1b[94m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' underline = '\x1b[4m' redefined = '\x1b[0;0m' process = '\x1b[1;37;42m' def message_information(text): print(OKBLUE + str(text) + REDEFINED) def message_sucess(text): print(OKGREEN + str(text) + REDEFINED) def message_failed(text): print(FAIL + str(text) + REDEFINED) def message_warning(text): print(WARNING + str(text) + REDEFINED) def process(text): print(PROCESS + f' {text} ' + REDEFINED)
class SensorStatusJob: on = 'ON' off = 'OFF' broken = 'BROKEN' charge_low = 'CHARGE_LOW' discharged = 'DISCHARGED' class SensorStatusSituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING' class ObjectStatusJob: on = 'ON' off = 'OFF' defect = 'DEFECT' class ObjectStatusSituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING'
class Sensorstatusjob: on = 'ON' off = 'OFF' broken = 'BROKEN' charge_low = 'CHARGE_LOW' discharged = 'DISCHARGED' class Sensorstatussituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING' class Objectstatusjob: on = 'ON' off = 'OFF' defect = 'DEFECT' class Objectstatussituation: null = 'NULL' stable = 'STABLE' fire = 'FIRE' warning = 'WARNING'
# Misc general coloring tips # Color organization: highlighted, neutral, and low-lighted/background # Red and green in center of screen # Blue, black, white, and yellow in periphery of screen # http://www.awwwards.com/flat-design-an-in-depth-look.html # main actions such as "Submit," "Send," "See More," should have vivid color with strong contrast to background, same as logo # secondary button color, usually a light gray, ok vs cancel titlefont1 = {"type": ("Segoe UI", 12, "bold"), "color": "black"} titlefont1_contrast = {"type": ("Segoe UI", 12, "bold"), "color": "white"} font1 = {"type": ("Segoe UI", 10), "color": "black"} font2 = {"type": ("Segoe UI", 10), "color": "Grey42"} color1 = "Grey69" color2 = "Grey79" color3 = "Grey89" color4 = "Grey99" color5 = "white" strongcolor1 = "gold" strongcolor2 = "dark orange" alterncolor1 = "DodgerBlue" alterncolor2 = "Blue3" # Dark version ##titlefont1 = {"type": ("Segoe UI", 12, "bold"), ## "color": "white"} ##titlefont1_contrast = {"type": ("Segoe UI", 12, "bold"), ## "color": "white"} ## ##font1 = {"type": ("Segoe UI", 10), ## "color": "white"} ##font2 = {"type": ("Segoe UI", 10), ## "color": "Grey82"} ## ##color1 = "Grey9" ##color2 = "Grey19" ##color3 = "Grey29" ##color4 = "Grey39" ##color5 = "Grey49" ## ##strongcolor1 = "gold" ##strongcolor2 = "dark orange" ## ##alterncolor1 = "DodgerBlue" ##alterncolor2 = "Blue3" ##
titlefont1 = {'type': ('Segoe UI', 12, 'bold'), 'color': 'black'} titlefont1_contrast = {'type': ('Segoe UI', 12, 'bold'), 'color': 'white'} font1 = {'type': ('Segoe UI', 10), 'color': 'black'} font2 = {'type': ('Segoe UI', 10), 'color': 'Grey42'} color1 = 'Grey69' color2 = 'Grey79' color3 = 'Grey89' color4 = 'Grey99' color5 = 'white' strongcolor1 = 'gold' strongcolor2 = 'dark orange' alterncolor1 = 'DodgerBlue' alterncolor2 = 'Blue3'
subprocess.Popen('/bin/ls *', shell=True) #nosec (on the line) subprocess.Popen('/bin/ls *', #nosec (at the start of function call) shell=True) subprocess.Popen('/bin/ls *', shell=True) #nosec (on the specific kwarg line)
subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True) subprocess.Popen('/bin/ls *', shell=True)
''' Single point of truth for version information ''' VERSION_NO = '1.1.7' VERSION_DESC = 'VAWS' + VERSION_NO
""" Single point of truth for version information """ version_no = '1.1.7' version_desc = 'VAWS' + VERSION_NO
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None slow = fast = head meet = None while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: meet = slow break if meet is None: return None p1 = head p2 = meet while p1 != p2: p1 = p1.next p2 = p2.next return p1 A = Solution() a = ListNode(3) b = ListNode(2) c = ListNode(0) d = ListNode(-4) a.next = b b.next = c c.next = d d.next = b e = ListNode(1) f = ListNode(2) e.next = f f.next = e print(A.detectCycle(e))
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None slow = fast = head meet = None while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: meet = slow break if meet is None: return None p1 = head p2 = meet while p1 != p2: p1 = p1.next p2 = p2.next return p1 a = solution() a = list_node(3) b = list_node(2) c = list_node(0) d = list_node(-4) a.next = b b.next = c c.next = d d.next = b e = list_node(1) f = list_node(2) e.next = f f.next = e print(A.detectCycle(e))
# Create a string variable with your full name name = "Boris Johnson" # Split the string into a list names = name.split(" ") # Print out your surname surname = names[-1] print("Surname:", surname) # Check if your surname contains the letter 'e' pos = surname.find("e") print("Position of 'e':", pos) # or contains the letter 'o' pos = surname.find("o") print("Position of 'o':", pos)
name = 'Boris Johnson' names = name.split(' ') surname = names[-1] print('Surname:', surname) pos = surname.find('e') print("Position of 'e':", pos) pos = surname.find('o') print("Position of 'o':", pos)
value = 'some' #modify this line if value == 'Y' or value == 'y': print('yes') elif value == 'N' or value == 'n': print('no') else: print('error')
value = 'some' if value == 'Y' or value == 'y': print('yes') elif value == 'N' or value == 'n': print('no') else: print('error')
class BasicBlock(object): def __init__(self): self.start_addr = 0 self.end_addr = 0 self.instructions = [] self.successors = [] def __str__(self): return "0x%x - 0x%x (%d) -> [%s]" % (self.start_addr, self.end_addr, len(self.instructions), ", ".join(["0x%x" % ref for ref in self.successors]))
class Basicblock(object): def __init__(self): self.start_addr = 0 self.end_addr = 0 self.instructions = [] self.successors = [] def __str__(self): return '0x%x - 0x%x (%d) -> [%s]' % (self.start_addr, self.end_addr, len(self.instructions), ', '.join(['0x%x' % ref for ref in self.successors]))
events = input().split("|") energy = 100 coins = 100 is_bankrupt = False for event in events: args = event.split("-") name = args[0] value = int(args[1]) if name == "rest": gained_energy = 0 if energy + value < 100: gained_energy = value energy += value else: gained_energy = 100 - energy energy = 100 print(f"You gained {gained_energy} energy.") print(f"Current energy: {energy}.") elif name == "order": if energy < 30: energy += 50 print("You had to rest!") continue coins += value energy -= 30 print(f"You earned {value} coins.") else: if coins <= value: print(f"Closed! Cannot afford {name}.") is_bankrupt = True break coins -= value print(f"You bought {name}.") if not is_bankrupt: print("Day completed!") print(f"Coins: {coins}") print(f"Energy: {energy}")
events = input().split('|') energy = 100 coins = 100 is_bankrupt = False for event in events: args = event.split('-') name = args[0] value = int(args[1]) if name == 'rest': gained_energy = 0 if energy + value < 100: gained_energy = value energy += value else: gained_energy = 100 - energy energy = 100 print(f'You gained {gained_energy} energy.') print(f'Current energy: {energy}.') elif name == 'order': if energy < 30: energy += 50 print('You had to rest!') continue coins += value energy -= 30 print(f'You earned {value} coins.') else: if coins <= value: print(f'Closed! Cannot afford {name}.') is_bankrupt = True break coins -= value print(f'You bought {name}.') if not is_bankrupt: print('Day completed!') print(f'Coins: {coins}') print(f'Energy: {energy}')
to_name = { "TA": "TA", "D": "dependent", "TC": "tile coding", "RB": "random binary", "R": "random real-valued", "P": "polynomial", "F": "fourier", "RC": "state aggregation", }
to_name = {'TA': 'TA', 'D': 'dependent', 'TC': 'tile coding', 'RB': 'random binary', 'R': 'random real-valued', 'P': 'polynomial', 'F': 'fourier', 'RC': 'state aggregation'}
# -*- coding:utf-8 -*- class Solution: def IsPopOrder(self, pushV, popV): # write code here imi = [pushV.pop(0)] while imi: cur = popV.pop(0) while imi[-1] != cur: if not pushV: return False imi.append(pushV.pop(0)) imi.pop() return True s = Solution() s.IsPopOrder([1,2,3,4,5],[3,2,5,4,1])
class Solution: def is_pop_order(self, pushV, popV): imi = [pushV.pop(0)] while imi: cur = popV.pop(0) while imi[-1] != cur: if not pushV: return False imi.append(pushV.pop(0)) imi.pop() return True s = solution() s.IsPopOrder([1, 2, 3, 4, 5], [3, 2, 5, 4, 1])
colors_file = None try: colors_file = open("colors2.txt", "r") for color in colors_file: print(color.rstrip()) except IOError as exc: print(exc) finally: if colors_file: colors_file.close() # print(dir(colors_file))
colors_file = None try: colors_file = open('colors2.txt', 'r') for color in colors_file: print(color.rstrip()) except IOError as exc: print(exc) finally: if colors_file: colors_file.close()
''' import html2text html = input('') text = html2text.html2text(html) print(text) input() ''' teste = input("Digite:") if teste == "1": print("1") elif teste == "2": print("2") else: print("3")
""" import html2text html = input('') text = html2text.html2text(html) print(text) input() """ teste = input('Digite:') if teste == '1': print('1') elif teste == '2': print('2') else: print('3')
d = {'name':'mari','age':19,'gender':'feminine'} del d['age'] print(d.values()) # .keys() # .items() for k,v in d.items(): print(f'[{k}]:[{v}]') print(d) e = {} br = [] for c in range(0,2): e['uf'] = str(input('estado: ')) e['cidade'] = str(input('cidade: ')) br.append(e.copy()) print(br)
d = {'name': 'mari', 'age': 19, 'gender': 'feminine'} del d['age'] print(d.values()) for (k, v) in d.items(): print(f'[{k}]:[{v}]') print(d) e = {} br = [] for c in range(0, 2): e['uf'] = str(input('estado: ')) e['cidade'] = str(input('cidade: ')) br.append(e.copy()) print(br)
class MultiplesOf3And5: def execute(self, top): result = 0 for multiple in [3, 5]: result += sum(self.get_multiples(multiple, top)) return result def get_multiples(self, multiple, top): value = 0 while value < top: yield value value += multiple
class Multiplesof3And5: def execute(self, top): result = 0 for multiple in [3, 5]: result += sum(self.get_multiples(multiple, top)) return result def get_multiples(self, multiple, top): value = 0 while value < top: yield value value += multiple
# # PROBLEM INTERPRETATION | MY INTERPRETATION # | # West | West # _______ | _______ # *South-West* / \ North-West | *South* / \ North-West # / \ | / \ # \ / | \ / # South-Est \_______/ *North-Est* | South-Est \_______/ *North* # Est | Est # | # | # | # --------------------> Est | # | --------------------> Est # / \ | | . # / / \ / \ / \ / \ \ | | _____________________________ . # / | A | B | C | D | \ | | | A | B | C | D | | . # / / \ / \ / \ / \ / \ \ | | |_____|_____|_____|_____|_____| . # / | E | F | G | H | I | \ | | | E | F | G | H | I | . # / \ / \ / \ / \ / \ / \ | | |_____|_____|_____|_____|_____| . # / | J | K | L | M | \ | | | | J | K | L | M | . # |/ \ / \ / \ / \ / \| | \|/ |_____|_____|_____|_____|_____| . # ' ' | ' _| # *South-West* South-Est | *South* South-Est # def resize(list_, radius, default): # resize generic list, expanding symmetrically for _ in range((size(radius) - len(list_)) // 2): list_.append(safe_copy(default)) list_.insert(0, safe_copy(default)) def safe_copy(element): try: return element.copy() except AttributeError: return element def size(radius): # given the radius (max index abs value) the size is 2 radius + 1 for the center + 2 for margins return 2 * radius + 3 def resize_floor(f, s_radius, e_radius): resize(f, s_radius, ['.'] * size(e_radius)) for r in floor: resize(r, e_radius, '.') def is_margin(num, radius): return num == 0 or num == size(radius) - 1 # part 1 blacks = set() for tile in open("input.txt", "r").read().split('\n'): tile = tile.replace('sw', 's').replace('ne', 'n') s = tile.count('s') - tile.count('n') e = tile.count('e') - tile.count('w') coords = (s, e) if coords in blacks: blacks.remove(coords) else: blacks.add(coords) print(len(blacks)) # part 2 sRadius = 0 # radius is max coord in abs value eRadius = 0 floor = [['.']] for tile in blacks: # set starting black tiles (from part 1 set) to '#' sRadius = max(sRadius, abs(tile[0])) eRadius = max(eRadius, abs(tile[1])) resize_floor(floor, sRadius, eRadius) floor[tile[0] + sRadius + 1][tile[1] + eRadius + 1] = '#' # +1 for margin for _ in range(100): expandS = 0 expandE = 0 for i in range(len(floor)): for j in range(len(floor[i])): neighbours = 0 for delta in [(1, 0), (1, 1), (0, 1), (-1, 0), (-1, -1), (0, -1)]: # count neighbours y = i + delta[0] x = j + delta[1] if 0 <= y < len(floor) and 0 <= x < len(floor[i]): if floor[y][x] == '#' or floor[y][x] == '0': neighbours += 1 if floor[i][j] == '#': # decide changes but don't apply yet if neighbours == 0 or neighbours > 2: floor[i][j] = '0' # '0' is '#' going to '.' if floor[i][j] == '.': if neighbours == 2: floor[i][j] = '1' # '1' is '.' going to '#' for i in range(len(floor)): # apply changes for j in range(len(floor[i])): if floor[i][j] == '0' or floor[i][j] == '1': if floor[i][j] == '0': floor[i][j] = '.' else: floor[i][j] = '#' if is_margin(i, sRadius): # expand radius if I'm writing on margin expandS = 1 if is_margin(j, eRadius): expandE = 1 sRadius += expandS eRadius += expandE resize_floor(floor, sRadius, eRadius) total = 0 # count final number of '#' for row in floor: total += row.count('#') print(total)
def resize(list_, radius, default): for _ in range((size(radius) - len(list_)) // 2): list_.append(safe_copy(default)) list_.insert(0, safe_copy(default)) def safe_copy(element): try: return element.copy() except AttributeError: return element def size(radius): return 2 * radius + 3 def resize_floor(f, s_radius, e_radius): resize(f, s_radius, ['.'] * size(e_radius)) for r in floor: resize(r, e_radius, '.') def is_margin(num, radius): return num == 0 or num == size(radius) - 1 blacks = set() for tile in open('input.txt', 'r').read().split('\n'): tile = tile.replace('sw', 's').replace('ne', 'n') s = tile.count('s') - tile.count('n') e = tile.count('e') - tile.count('w') coords = (s, e) if coords in blacks: blacks.remove(coords) else: blacks.add(coords) print(len(blacks)) s_radius = 0 e_radius = 0 floor = [['.']] for tile in blacks: s_radius = max(sRadius, abs(tile[0])) e_radius = max(eRadius, abs(tile[1])) resize_floor(floor, sRadius, eRadius) floor[tile[0] + sRadius + 1][tile[1] + eRadius + 1] = '#' for _ in range(100): expand_s = 0 expand_e = 0 for i in range(len(floor)): for j in range(len(floor[i])): neighbours = 0 for delta in [(1, 0), (1, 1), (0, 1), (-1, 0), (-1, -1), (0, -1)]: y = i + delta[0] x = j + delta[1] if 0 <= y < len(floor) and 0 <= x < len(floor[i]): if floor[y][x] == '#' or floor[y][x] == '0': neighbours += 1 if floor[i][j] == '#': if neighbours == 0 or neighbours > 2: floor[i][j] = '0' if floor[i][j] == '.': if neighbours == 2: floor[i][j] = '1' for i in range(len(floor)): for j in range(len(floor[i])): if floor[i][j] == '0' or floor[i][j] == '1': if floor[i][j] == '0': floor[i][j] = '.' else: floor[i][j] = '#' if is_margin(i, sRadius): expand_s = 1 if is_margin(j, eRadius): expand_e = 1 s_radius += expandS e_radius += expandE resize_floor(floor, sRadius, eRadius) total = 0 for row in floor: total += row.count('#') print(total)
# Why does this file exist, and why not put this in `__main__`? # # You might be tempted to import things from __main__ later, # but that will cause problems: the code will get executed twice: # # - When you run `python -m poetry_issue_2369` python will execute # `__main__.py` as a script. That means there won't be any # `poetry_issue_2369.__main__` in `sys.modules`. # - When you import `__main__` it will get executed again (as a module) because # there's no `poetry_issue_2369.__main__` in `sys.modules`. def main(args=None): return 1
def main(args=None): return 1
{ "task": "tabular", "core": { "data": { "bs": 64, #Default "val_bs": null, #Default "device": null, #Default "no_check": false, #Default "num_workers": 16, "validation": { "method": "none", # [split_none, split_by_rand_pct, split_subsets, split_by_files, split_by_fname_file, split_by_folder, split_by_idx, split_by_idxs, split_by_list, split_by_valid_func, split_from_df] "rand_pct": { "valid_pct": 0.2, #Default "seed": null #Default }, "idx": { "csv_name": null, "valid_idx": 20 }, "subsets": { "train_size": 0.08, "valid_size": 0.2, "seed": null }, "files": { "valid_names": null }, "fname_file": { "fname": null, "path": null }, "folder": { "train": "train", "valid": "train" }, "idxs": { "train_idx": null, "valid_idx": null }, "list": { "train": null, "valid": null }, "valid_func": { "fname": null, "func": null }, "from_df": { "col": null #Default is 2 } }, "label": { "method": "from_df", # [label_empty, label_from_df, label_const, label_from_folder, label_from_func, label_from_re] "from_df": { "default":true, "cols": 1, #Default "label_cls": null, #Default options: null, FloatList, CategoryList, MultiCategoryList, EmptyLabelList "items": null, "label_delim": null, "one_hot": false, "classes": null }, "const": { "const": 0, #Default "label_cls": null #Default }, "from_func": { "fname": null, "func": null }, "from_re": { "pat": null, "full_path": false }, "from_folder": { "label_cls": null } } }, "metric": { # Available options: [accuracy, accuracy_thresh, top_k_accuracy, dice, error_rate, mean_squared_error, mean_absolute_error, # mean_squared_logarithmic_error, exp_rmspe, root_mean_squared_error, fbeta, explained_variance, r2_score, Precision, Recall, # FBeta, ExplainedVariance, MatthewsCorreff, KappaScore, MultiLabelFbeta, auc_roc_score, roc_curve, AUROC] "methods": [ "accuracy", "error_rate", "Precision" ], "accuracy_thresh": { "thresh": 0.5, #Default "sigmoid": true #Default }, "top_k_accuracy": { "k": 5 #Default }, "dice": { "iou": false, #Default "eps": 1e-8 #Default }, "fbeta": { "thresh": 0.2, #Default "beta": 2, #Default "eps": 1e-9, #Default "sigmoid": true #Default }, "Precision": { "average": "binary", #Default "pos_label": 1, #Default "eps": 1e-9 #Default }, "Recall": { "average": "binary", #Default "pos_label": 1, #Default "eps": 1e-9 #Default }, "FBeta": { "average": "binary", #Default "pos_label": 1, #Default "eps": 1e-9, #Default "beta": 2 #Default }, "KappaScore": { "weights": null }, "MultiLabelFbeta": { "beta": 2, #Default "eps": 1e-15, #Default "thresh": 0.3, #Default "sigmoid": true, #Default "average": "micro" #Default } }, "loss": { "type": "pre-defined", "pre-defined": { "func": "MSELossFlat" # BCEFlat, BCEWithLogitsFlat, CrossEntropyFlat, MSELossFlat, NoopLoss, WassersteinLoss }, "custom": { "fname": null, "func": null } }, "optimizer": { # "available_opts": [ # "SGD", # "RMSProp", # "Adam", # "AdamW", # "Adadelta", # "Adagrad", # "SparseAdam", # "Adamax", # "ASGD" # ], "chosen_opt": "ASGD", "arguments": { "SGD": { "lr": 0, "momentum": 0, "weight_decay": 0, "dampening": 0, "nesterov": false }, "RMSProp": { "lr": 0.01, "momentum": 0, "alpha": 0.99, "eps": 1e-8, "centered": false, "weight_decay": 0 }, "Adam": { "lr": 0.001, "momentum": 0.9, "alpha": 0.999, "eps": 1e-8, "weight_decay": 0, "amsgrad": false }, "AdamW": { "lr": 0.001, "momentum": 0.9, "alpha": 0.999, "eps": 1e-8, "weight_decay": 0.01, "amsgrad": false }, "Adadelta": { "lr": 1, "rho": 0.9, "eps": 0.000001, "weight_decay": 0 }, "Adagrad": { "lr": 0.01, "lr_decay": 0, "eps": 1e-10, "weight_decay": 0 }, "SparseAdam": { "lr": 0.001, "momentum": 0.9, "alpha": 0.999, "eps": 1e-8 }, "Adamax": { "lr": 0.002, "momentum": 0.9, "alpha": 0.999, "eps": 1e-8, "weight_decay": 0.01 }, "ASGD": { "lr": 0.01, "lambd": 0.0001, "alpha": 0.75, "t0": 1000000, "weight_decay": 0 } } } }, "tabular": { "input": { "csv_name": "./data/hello.csv", "dep_var": "columnt", "cat_names": [ "column1" ], "cont_names": [ "column2" ], "test_df": { "has_test": false, "csv_name": null } }, "transform": { "FillMissing": { "fill_strategy": "MEDIAN", # MEDIAN, COMMON, CONSTANT "add_col": true, "fill_val": 0 #Filled with this if CONSTANT }, "Categorify": true, "Normalize": true, "Datetime": { "cols": [], "cyclic": false #Bool } }, "model": { "type": "default", #Default, Custom "default": { "out_sz": null, "layers": null, "emb_drop": 0, "ps": null, "y_range": null, "use_bn": true, "bn_final": false }, "custom": { "layers": [], "extra_args": { "bn_begin": false } } } }, "test_df": null, "vision": { "subtask": "object-detection", "input": { "method": "from_folder", "from_folder": { "path": "data/coco_tiny", "extensions": null, "recurse": true, "exclude": null, "include": null, "processor": null, "presort": false }, "from_csv": { "csv_name": null, "path":null, "cols": 0, "delimiter": null, "header": "infer", "processor": null } }, "classification-single-label": {}, "classification-multi-label": {}, "regression": {}, "segmentation": {}, "gan": { "noise_sz": 100 }, "object-detection": {}, "points": {}, "transform": { "size":24, "data_aug":["basic_transforms","zoom_crop","manual"], "chosen_data_aug":"manual", "basic_transforms": { "do_flip":true, "flip_vert":false, "max_rotate":10.0, "max_zoom":1, "max_lighting":0.8, "max_warp":0.2, "p_affine":0.75, "p_lighting":0.75 }, "zoom_crop": { "scale":[0.75,2], "do_rand":true, "p":1.0 }, "manual": { "brightness": { "change":0.5 }, "contrast": { "scale":1.0 }, "crop": { "size":300, "row_pct":0.5, "col_pct":0.5 }, "crop_pad": { "size":300, "padding_mode":"reflection", "row_pct":0.5, "col_pct":0.5 }, "dihedral": { "k":0 }, "dihedral_affine": { "k":0 }, "flip_lr": {}, "flip_affine": {}, "jitter": { "magnitude":0.0 }, "pad": { "padding":50, "available_modes":["zeros", "border", "reflection"], "mode":"reflection" }, "rotate": { "degrees":0.0 }, "rgb_randomize": { "channels":["Red", "Green", "Blue"], "chosen_channels":"Red", "thresh":[0.2,0.595,0.99], "chosen_thresh":0.2 }, "skew": { "direction":0, "magnitude":0, "invert":false }, "squish": { "scale":1.0, "row_pct":0.5, "col_pct":0.5 }, "symmetric_wrap": { "magnitude":[-0.2,0.2] }, "tilt": { "direction":0, "magnitude":0 }, "zoom": { "scale":1.0, "row_pct":0.5, "col_pct":0.5 }, "cutout": { "n_holes":1, "length":40 } } } } }
{'task': 'tabular', 'core': {'data': {'bs': 64, 'val_bs': null, 'device': null, 'no_check': false, 'num_workers': 16, 'validation': {'method': 'none', 'rand_pct': {'valid_pct': 0.2, 'seed': null}, 'idx': {'csv_name': null, 'valid_idx': 20}, 'subsets': {'train_size': 0.08, 'valid_size': 0.2, 'seed': null}, 'files': {'valid_names': null}, 'fname_file': {'fname': null, 'path': null}, 'folder': {'train': 'train', 'valid': 'train'}, 'idxs': {'train_idx': null, 'valid_idx': null}, 'list': {'train': null, 'valid': null}, 'valid_func': {'fname': null, 'func': null}, 'from_df': {'col': null}}, 'label': {'method': 'from_df', 'from_df': {'default': true, 'cols': 1, 'label_cls': null, 'items': null, 'label_delim': null, 'one_hot': false, 'classes': null}, 'const': {'const': 0, 'label_cls': null}, 'from_func': {'fname': null, 'func': null}, 'from_re': {'pat': null, 'full_path': false}, 'from_folder': {'label_cls': null}}}, 'metric': {'methods': ['accuracy', 'error_rate', 'Precision'], 'accuracy_thresh': {'thresh': 0.5, 'sigmoid': true}, 'top_k_accuracy': {'k': 5}, 'dice': {'iou': false, 'eps': 1e-08}, 'fbeta': {'thresh': 0.2, 'beta': 2, 'eps': 1e-09, 'sigmoid': true}, 'Precision': {'average': 'binary', 'pos_label': 1, 'eps': 1e-09}, 'Recall': {'average': 'binary', 'pos_label': 1, 'eps': 1e-09}, 'FBeta': {'average': 'binary', 'pos_label': 1, 'eps': 1e-09, 'beta': 2}, 'KappaScore': {'weights': null}, 'MultiLabelFbeta': {'beta': 2, 'eps': 1e-15, 'thresh': 0.3, 'sigmoid': true, 'average': 'micro'}}, 'loss': {'type': 'pre-defined', 'pre-defined': {'func': 'MSELossFlat'}, 'custom': {'fname': null, 'func': null}}, 'optimizer': {'chosen_opt': 'ASGD', 'arguments': {'SGD': {'lr': 0, 'momentum': 0, 'weight_decay': 0, 'dampening': 0, 'nesterov': false}, 'RMSProp': {'lr': 0.01, 'momentum': 0, 'alpha': 0.99, 'eps': 1e-08, 'centered': false, 'weight_decay': 0}, 'Adam': {'lr': 0.001, 'momentum': 0.9, 'alpha': 0.999, 'eps': 1e-08, 'weight_decay': 0, 'amsgrad': false}, 'AdamW': {'lr': 0.001, 'momentum': 0.9, 'alpha': 0.999, 'eps': 1e-08, 'weight_decay': 0.01, 'amsgrad': false}, 'Adadelta': {'lr': 1, 'rho': 0.9, 'eps': 1e-06, 'weight_decay': 0}, 'Adagrad': {'lr': 0.01, 'lr_decay': 0, 'eps': 1e-10, 'weight_decay': 0}, 'SparseAdam': {'lr': 0.001, 'momentum': 0.9, 'alpha': 0.999, 'eps': 1e-08}, 'Adamax': {'lr': 0.002, 'momentum': 0.9, 'alpha': 0.999, 'eps': 1e-08, 'weight_decay': 0.01}, 'ASGD': {'lr': 0.01, 'lambd': 0.0001, 'alpha': 0.75, 't0': 1000000, 'weight_decay': 0}}}}, 'tabular': {'input': {'csv_name': './data/hello.csv', 'dep_var': 'columnt', 'cat_names': ['column1'], 'cont_names': ['column2'], 'test_df': {'has_test': false, 'csv_name': null}}, 'transform': {'FillMissing': {'fill_strategy': 'MEDIAN', 'add_col': true, 'fill_val': 0}, 'Categorify': true, 'Normalize': true, 'Datetime': {'cols': [], 'cyclic': false}}, 'model': {'type': 'default', 'default': {'out_sz': null, 'layers': null, 'emb_drop': 0, 'ps': null, 'y_range': null, 'use_bn': true, 'bn_final': false}, 'custom': {'layers': [], 'extra_args': {'bn_begin': false}}}}, 'test_df': null, 'vision': {'subtask': 'object-detection', 'input': {'method': 'from_folder', 'from_folder': {'path': 'data/coco_tiny', 'extensions': null, 'recurse': true, 'exclude': null, 'include': null, 'processor': null, 'presort': false}, 'from_csv': {'csv_name': null, 'path': null, 'cols': 0, 'delimiter': null, 'header': 'infer', 'processor': null}}, 'classification-single-label': {}, 'classification-multi-label': {}, 'regression': {}, 'segmentation': {}, 'gan': {'noise_sz': 100}, 'object-detection': {}, 'points': {}, 'transform': {'size': 24, 'data_aug': ['basic_transforms', 'zoom_crop', 'manual'], 'chosen_data_aug': 'manual', 'basic_transforms': {'do_flip': true, 'flip_vert': false, 'max_rotate': 10.0, 'max_zoom': 1, 'max_lighting': 0.8, 'max_warp': 0.2, 'p_affine': 0.75, 'p_lighting': 0.75}, 'zoom_crop': {'scale': [0.75, 2], 'do_rand': true, 'p': 1.0}, 'manual': {'brightness': {'change': 0.5}, 'contrast': {'scale': 1.0}, 'crop': {'size': 300, 'row_pct': 0.5, 'col_pct': 0.5}, 'crop_pad': {'size': 300, 'padding_mode': 'reflection', 'row_pct': 0.5, 'col_pct': 0.5}, 'dihedral': {'k': 0}, 'dihedral_affine': {'k': 0}, 'flip_lr': {}, 'flip_affine': {}, 'jitter': {'magnitude': 0.0}, 'pad': {'padding': 50, 'available_modes': ['zeros', 'border', 'reflection'], 'mode': 'reflection'}, 'rotate': {'degrees': 0.0}, 'rgb_randomize': {'channels': ['Red', 'Green', 'Blue'], 'chosen_channels': 'Red', 'thresh': [0.2, 0.595, 0.99], 'chosen_thresh': 0.2}, 'skew': {'direction': 0, 'magnitude': 0, 'invert': false}, 'squish': {'scale': 1.0, 'row_pct': 0.5, 'col_pct': 0.5}, 'symmetric_wrap': {'magnitude': [-0.2, 0.2]}, 'tilt': {'direction': 0, 'magnitude': 0}, 'zoom': {'scale': 1.0, 'row_pct': 0.5, 'col_pct': 0.5}, 'cutout': {'n_holes': 1, 'length': 40}}}}}
class Solution: def containsDuplicate(self, nums: List[int]) -> bool: seen = {} for i in nums: if i in seen: return True seen[i] = 1 return False
class Solution: def contains_duplicate(self, nums: List[int]) -> bool: seen = {} for i in nums: if i in seen: return True seen[i] = 1 return False
d = {"a": 1, "b": 2, "c": 3} sum=0 for i in d: sum+=d.get(i) print(sum)
d = {'a': 1, 'b': 2, 'c': 3} sum = 0 for i in d: sum += d.get(i) print(sum)
def triple_sum(nums): result = [] for i in nums: for j in nums: for k in nums: j_is_unique = j != i and j != k k_is_unique = k != i sum_is_zero = (i + j + k) == 0 if j_is_unique and k_is_unique and sum_is_zero: if set([i,j,k]) not in result: result.append(set([i,j,k])) return result if __name__ == '__main__': nums = set([0, -1, 2, -3, 1]) print(triple_sum(nums))
def triple_sum(nums): result = [] for i in nums: for j in nums: for k in nums: j_is_unique = j != i and j != k k_is_unique = k != i sum_is_zero = i + j + k == 0 if j_is_unique and k_is_unique and sum_is_zero: if set([i, j, k]) not in result: result.append(set([i, j, k])) return result if __name__ == '__main__': nums = set([0, -1, 2, -3, 1]) print(triple_sum(nums))
s=str(input()) n1,n2=[int(e) for e in input().split()] j=0 for i in range(len(s)): if j<n1-1: print(s[j],end="") j+=1 elif j>=n1-1: j=n2 if j>=n1: print(s[j],end="") j-=1 elif j<=k: print(s[j],end="") j+=1 k=n2-1
s = str(input()) (n1, n2) = [int(e) for e in input().split()] j = 0 for i in range(len(s)): if j < n1 - 1: print(s[j], end='') j += 1 elif j >= n1 - 1: j = n2 if j >= n1: print(s[j], end='') j -= 1 elif j <= k: print(s[j], end='') j += 1 k = n2 - 1
def mapDict(d, mapF): result = {} for key in d: mapped = mapF(key, d[key]) if mapped != None: result[key] = mapped return result withPath = mapDict(houseClosestObj, lambda house, obj: { "target": obj, "path": houseObjPaths[house][obj]}) with open("houseClosestObj.json", "w") as fp: json.dump(withPath, fp)
def map_dict(d, mapF): result = {} for key in d: mapped = map_f(key, d[key]) if mapped != None: result[key] = mapped return result with_path = map_dict(houseClosestObj, lambda house, obj: {'target': obj, 'path': houseObjPaths[house][obj]}) with open('houseClosestObj.json', 'w') as fp: json.dump(withPath, fp)
# rounds a number to the nearest even number # Author: Isabella Doyle num = float(input("Enter a number: ")) round = round(num) print('{} rounded is {}'.format(num, round))
num = float(input('Enter a number: ')) round = round(num) print('{} rounded is {}'.format(num, round))
def main(): print('This is printed from testfile.py') if __name__=='__main__': main()
def main(): print('This is printed from testfile.py') if __name__ == '__main__': main()
def _get_main(ctx): if ctx.file.main: return ctx.file.main.path main = ctx.label.name + ".py" for src in ctx.files.srcs: if src.basename == main: return src.path fail( "corresponding default '{}' does not appear in srcs. ".format(main) + "Add it or override default file name with a 'main' attribute", ) def _conda_impl(ctx): env = ctx.attr.env launcher = ctx.actions.declare_file(ctx.label.name) args = ctx.actions.args() args.add(ctx.file.launcher) args.add(launcher) ctx.actions.run_shell( inputs = [ctx.file.launcher], outputs = [launcher], arguments = [args], command = "cp $1 $2", ) launcher_main = ctx.actions.declare_file(ctx.label.name + ".main") ctx.actions.write( output = launcher_main, content = _get_main(ctx), ) runfiles = ctx.runfiles( collect_data = True, collect_default = True, files = ctx.files.srcs, symlinks = { ".main": launcher_main, }, root_symlinks = { ".cenv": env.files.to_list()[0], ".main": launcher_main, }, ) return [DefaultInfo(executable = launcher, runfiles = runfiles)] _conda_attrs = { "srcs": attr.label_list(allow_files = [".py"]), "data": attr.label_list(allow_files = True), "deps": attr.label_list(), "env": attr.label( mandatory = True, allow_files = True, ), "main": attr.label(allow_single_file = [".py"]), "launcher": attr.label( default = Label("//tools/conda_run"), allow_single_file = True, ), } _conda_binary = rule( attrs = _conda_attrs, executable = True, implementation = _conda_impl, ) _conda_test = rule( attrs = _conda_attrs, test = True, implementation = _conda_impl, ) def conda_binary(tags = [], **kwargs): _conda_binary(tags = tags + ["conda"], **kwargs) def conda_test(tags = [], **kwargs): _conda_test(tags = tags + ["conda"], **kwargs)
def _get_main(ctx): if ctx.file.main: return ctx.file.main.path main = ctx.label.name + '.py' for src in ctx.files.srcs: if src.basename == main: return src.path fail("corresponding default '{}' does not appear in srcs. ".format(main) + "Add it or override default file name with a 'main' attribute") def _conda_impl(ctx): env = ctx.attr.env launcher = ctx.actions.declare_file(ctx.label.name) args = ctx.actions.args() args.add(ctx.file.launcher) args.add(launcher) ctx.actions.run_shell(inputs=[ctx.file.launcher], outputs=[launcher], arguments=[args], command='cp $1 $2') launcher_main = ctx.actions.declare_file(ctx.label.name + '.main') ctx.actions.write(output=launcher_main, content=_get_main(ctx)) runfiles = ctx.runfiles(collect_data=True, collect_default=True, files=ctx.files.srcs, symlinks={'.main': launcher_main}, root_symlinks={'.cenv': env.files.to_list()[0], '.main': launcher_main}) return [default_info(executable=launcher, runfiles=runfiles)] _conda_attrs = {'srcs': attr.label_list(allow_files=['.py']), 'data': attr.label_list(allow_files=True), 'deps': attr.label_list(), 'env': attr.label(mandatory=True, allow_files=True), 'main': attr.label(allow_single_file=['.py']), 'launcher': attr.label(default=label('//tools/conda_run'), allow_single_file=True)} _conda_binary = rule(attrs=_conda_attrs, executable=True, implementation=_conda_impl) _conda_test = rule(attrs=_conda_attrs, test=True, implementation=_conda_impl) def conda_binary(tags=[], **kwargs): _conda_binary(tags=tags + ['conda'], **kwargs) def conda_test(tags=[], **kwargs): _conda_test(tags=tags + ['conda'], **kwargs)
#---------------------------------------------------------------------------------------------------------- # # AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX # # NAME: Copy Hue/Sat # #---------------------------------------------------------------------------------------------------------- ns = nuke.selectedNodes() for n in ns: n.knob('hue').setValue(1) n.knob('sat').setValue(1) n.knob('lumaMix').setValue(0)
ns = nuke.selectedNodes() for n in ns: n.knob('hue').setValue(1) n.knob('sat').setValue(1) n.knob('lumaMix').setValue(0)
#!/usr/bin/env python temp = 24 Farenheint = temp * 1.8 + 32 print(Farenheint)
temp = 24 farenheint = temp * 1.8 + 32 print(Farenheint)
expected_output = { 'id':{ 101: { 'connection': 0, 'name': 'grpc-tcp', 'state': 'Resolving', 'explanation': 'Resolution request in progress' } } }
expected_output = {'id': {101: {'connection': 0, 'name': 'grpc-tcp', 'state': 'Resolving', 'explanation': 'Resolution request in progress'}}}
dolares = input('Cuantos dolares tienes?: ') dolares = float(dolares) valor_dolar = 0.045 peso = dolares / valor_dolar peso = round(peso,2) peso = str(peso) print('Tienes $' + peso + ' Pesos')
dolares = input('Cuantos dolares tienes?: ') dolares = float(dolares) valor_dolar = 0.045 peso = dolares / valor_dolar peso = round(peso, 2) peso = str(peso) print('Tienes $' + peso + ' Pesos')
load(":collect_export_declaration.bzl", "collect_export_declaration") load(":collect_header_declaration.bzl", "collect_header_declaration") load(":collect_link_declaration.bzl", "collect_link_declaration") load(":collect_umbrella_dir_declaration.bzl", "collect_umbrella_dir_declaration") load(":collection_results.bzl", "collection_results") load(":errors.bzl", "errors") load(":tokens.bzl", "tokens", rws = "reserved_words", tts = "token_types") load("@bazel_skylib//lib:sets.bzl", "sets") _unsupported_module_members = sets.make([ rws.config_macros, rws.conflict, rws.requires, rws.use, ]) def collect_module_members(parsed_tokens): tlen = len(parsed_tokens) members = [] consumed_count = 0 open_members_token, err = tokens.get_as(parsed_tokens, 0, tts.curly_bracket_open, count = tlen) if err != None: return None, err consumed_count += 1 skip_ahead = 0 collect_result = None prefix_tokens = [] for idx in range(consumed_count, tlen - consumed_count): consumed_count += 1 if skip_ahead > 0: skip_ahead -= 1 continue collect_result = None # Get next token token, err = tokens.get(parsed_tokens, idx, count = tlen) if err != None: return None, err # Process token if tokens.is_a(token, tts.curly_bracket_close): if len(prefix_tokens) > 0: return None, errors.new( "Unexpected prefix tokens found at end of module member block. tokens: %s" % (prefix_tokens), ) break elif tokens.is_a(token, tts.newline): if len(prefix_tokens) > 0: return None, errors.new( "Unexpected prefix tokens found before end of line. tokens: %s" % (prefix_tokens), ) elif tokens.is_a(token, tts.reserved, rws.umbrella): # The umbrella word can appear for umbrella headers or umbrella directories. # If the next token is header, then it is an umbrella header. Otherwise, it is an umbrella # directory. next_idx = idx + 1 next_token, err = tokens.get(parsed_tokens, next_idx, count = tlen) if err != None: return None, err if tokens.is_a(next_token, tts.reserved, rws.header): prefix_tokens.append(token) else: if len(prefix_tokens) > 0: return None, errors.new( "Unexpected prefix tokens found before end of line. tokens: %" % (prefix_tokens), ) collect_result, err = collect_umbrella_dir_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved, rws.header): collect_result, err = collect_header_declaration(parsed_tokens[idx:], prefix_tokens) prefix_tokens = [] elif tokens.is_a(token, tts.reserved, rws.export): collect_result, err = collect_export_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved, rws.link): collect_result, err = collect_link_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved) and sets.contains(_unsupported_module_members, token.value): return None, errors.new("Unsupported module member token. token: %s" % (token)) else: # Store any unrecognized tokens as prefix tokens to be processed later prefix_tokens.append(token) # Handle index advancement. if err != None: return None, err if collect_result: members.extend(collect_result.declarations) skip_ahead = collect_result.count - 1 return collection_results.new(members, consumed_count), None
load(':collect_export_declaration.bzl', 'collect_export_declaration') load(':collect_header_declaration.bzl', 'collect_header_declaration') load(':collect_link_declaration.bzl', 'collect_link_declaration') load(':collect_umbrella_dir_declaration.bzl', 'collect_umbrella_dir_declaration') load(':collection_results.bzl', 'collection_results') load(':errors.bzl', 'errors') load(':tokens.bzl', 'tokens', rws='reserved_words', tts='token_types') load('@bazel_skylib//lib:sets.bzl', 'sets') _unsupported_module_members = sets.make([rws.config_macros, rws.conflict, rws.requires, rws.use]) def collect_module_members(parsed_tokens): tlen = len(parsed_tokens) members = [] consumed_count = 0 (open_members_token, err) = tokens.get_as(parsed_tokens, 0, tts.curly_bracket_open, count=tlen) if err != None: return (None, err) consumed_count += 1 skip_ahead = 0 collect_result = None prefix_tokens = [] for idx in range(consumed_count, tlen - consumed_count): consumed_count += 1 if skip_ahead > 0: skip_ahead -= 1 continue collect_result = None (token, err) = tokens.get(parsed_tokens, idx, count=tlen) if err != None: return (None, err) if tokens.is_a(token, tts.curly_bracket_close): if len(prefix_tokens) > 0: return (None, errors.new('Unexpected prefix tokens found at end of module member block. tokens: %s' % prefix_tokens)) break elif tokens.is_a(token, tts.newline): if len(prefix_tokens) > 0: return (None, errors.new('Unexpected prefix tokens found before end of line. tokens: %s' % prefix_tokens)) elif tokens.is_a(token, tts.reserved, rws.umbrella): next_idx = idx + 1 (next_token, err) = tokens.get(parsed_tokens, next_idx, count=tlen) if err != None: return (None, err) if tokens.is_a(next_token, tts.reserved, rws.header): prefix_tokens.append(token) else: if len(prefix_tokens) > 0: return (None, errors.new('Unexpected prefix tokens found before end of line. tokens: %' % prefix_tokens)) (collect_result, err) = collect_umbrella_dir_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved, rws.header): (collect_result, err) = collect_header_declaration(parsed_tokens[idx:], prefix_tokens) prefix_tokens = [] elif tokens.is_a(token, tts.reserved, rws.export): (collect_result, err) = collect_export_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved, rws.link): (collect_result, err) = collect_link_declaration(parsed_tokens[idx:]) elif tokens.is_a(token, tts.reserved) and sets.contains(_unsupported_module_members, token.value): return (None, errors.new('Unsupported module member token. token: %s' % token)) else: prefix_tokens.append(token) if err != None: return (None, err) if collect_result: members.extend(collect_result.declarations) skip_ahead = collect_result.count - 1 return (collection_results.new(members, consumed_count), None)
# GEPPETTO SERVLET MESSAGES class Servlet: LOAD_PROJECT_FROM_URL = 'load_project_from_url' RUN_EXPERIMENT = 'run_experiment' CLIENT_ID = 'client_id' PING = 'ping' class ServletResponse: PROJECT_LOADED = 'project_loaded' GEPPETTO_MODEL_LOADED = 'geppetto_model_loaded' EXPERIMENT_LOADED = 'experiment_loaded' ERROR_RUNNING_EXPERIMENT = 'error_running_experiment' GENERIC_ERROR = 'generic_error' ERROR_LOADING_PROJECT = 'error_loading_project' # GATEWAY MESSAGES class Income: LOAD_MODEL = 'load_model' class Outcome: ERROR = 'error' CONNECTION_CLOSED = 'connection_closed' GEPPETTO_RESPONSE_RECEIVED = 'geppetto_response_received' # ERRORS class PygeppettoDjangoError(): code = None message = None def __init__(self): return {'code': self.code, 'message': self.message} class UknownActionError(PygeppettoDjangoError): code = 400 message = 'UKNOWN_ACTION' class ActionNotFoundError(PygeppettoDjangoError): code = 404 message = 'ACTION_NOT_FOUND'
class Servlet: load_project_from_url = 'load_project_from_url' run_experiment = 'run_experiment' client_id = 'client_id' ping = 'ping' class Servletresponse: project_loaded = 'project_loaded' geppetto_model_loaded = 'geppetto_model_loaded' experiment_loaded = 'experiment_loaded' error_running_experiment = 'error_running_experiment' generic_error = 'generic_error' error_loading_project = 'error_loading_project' class Income: load_model = 'load_model' class Outcome: error = 'error' connection_closed = 'connection_closed' geppetto_response_received = 'geppetto_response_received' class Pygeppettodjangoerror: code = None message = None def __init__(self): return {'code': self.code, 'message': self.message} class Uknownactionerror(PygeppettoDjangoError): code = 400 message = 'UKNOWN_ACTION' class Actionnotfounderror(PygeppettoDjangoError): code = 404 message = 'ACTION_NOT_FOUND'
# 2. Using the dictionary created in the previous problem, allow the user to enter a dollar amount # and print out all the products whose price is less than that amount. print('To stop any phase, enter an empty product name.') product_dict = {} while True: product = input('Enter a product name to assign with a price: ') if product == '': break price = input('Enter the product price: ') while price == '': print('You must enter a price for the product.') price = input('Enter the product price: ') product_dict[product] = price amount = input('Enter an amount to check against: ') for product, price in product_dict.items(): if float(price) < float(amount): print(f'{product} costs ${price}')
print('To stop any phase, enter an empty product name.') product_dict = {} while True: product = input('Enter a product name to assign with a price: ') if product == '': break price = input('Enter the product price: ') while price == '': print('You must enter a price for the product.') price = input('Enter the product price: ') product_dict[product] = price amount = input('Enter an amount to check against: ') for (product, price) in product_dict.items(): if float(price) < float(amount): print(f'{product} costs ${price}')
reservation_day = int(input()) reservation_month = int(input()) accommodation_day = int(input()) accommodation_month = int(input()) leaving_day = int(input()) leaving_month = int(input()) discount = 0 price_per_night = 0 discount_days = accommodation_day - 10 days_staying = abs(accommodation_day - leaving_day) if reservation_day <= 1: pass
reservation_day = int(input()) reservation_month = int(input()) accommodation_day = int(input()) accommodation_month = int(input()) leaving_day = int(input()) leaving_month = int(input()) discount = 0 price_per_night = 0 discount_days = accommodation_day - 10 days_staying = abs(accommodation_day - leaving_day) if reservation_day <= 1: pass
s, a, A = list(input()), list('abcdefghijklmnopqrstuvwxyz'), 26 s1, s2 = s[0:len(s) // 2], s[len(s) // 2:len(s)] s1_r, s2_r = sum([a.index(i.lower()) for i in s1]), sum([a.index(i.lower()) for i in s2]) for i in range(len(s1)): s1[i] = a[(s1_r + a.index(s1[i].lower())) % A] for i in range(len(s2)): s2[i] = a[(s2_r + a.index(s2[i].lower())) % A] for i in range(len(s1)): s1[i] = a[(a.index(s2[i].lower()) + a.index(s1[i].lower())) % A] print("".join(s1).upper())
(s, a, a) = (list(input()), list('abcdefghijklmnopqrstuvwxyz'), 26) (s1, s2) = (s[0:len(s) // 2], s[len(s) // 2:len(s)]) (s1_r, s2_r) = (sum([a.index(i.lower()) for i in s1]), sum([a.index(i.lower()) for i in s2])) for i in range(len(s1)): s1[i] = a[(s1_r + a.index(s1[i].lower())) % A] for i in range(len(s2)): s2[i] = a[(s2_r + a.index(s2[i].lower())) % A] for i in range(len(s1)): s1[i] = a[(a.index(s2[i].lower()) + a.index(s1[i].lower())) % A] print(''.join(s1).upper())
def test(): print('hello world') c = color(1,0.2,0.2, 1) print(c) print(c.r) print(c.g) print(c.b) print(c.a) c.a = 0.5 print(c.a) c.b += 0.1 print(c.b) d = c.darkened( 0.9 ) print(d) test()
def test(): print('hello world') c = color(1, 0.2, 0.2, 1) print(c) print(c.r) print(c.g) print(c.b) print(c.a) c.a = 0.5 print(c.a) c.b += 0.1 print(c.b) d = c.darkened(0.9) print(d) test()
out = [] digits =[ "0000001", "1001111", #1 "0010010", "0000110", #3 "1001100", "0100100", #5 "1100000", "0001111", #7 "0000000", "0001100", #9 ] for i in range(10000): s = "{:04d}".format(i) out += ["{:21d} 0 0 {} {} {} {}".format(i, digits[int(s[0])], digits[int(s[1])], digits[int(s[2])], digits[int(s[3])] ) ] f = open ("examples/count.out", "w") f.write("\n".join(out)) f.close()
out = [] digits = ['0000001', '1001111', '0010010', '0000110', '1001100', '0100100', '1100000', '0001111', '0000000', '0001100'] for i in range(10000): s = '{:04d}'.format(i) out += ['{:21d} 0 0 {} {} {} {}'.format(i, digits[int(s[0])], digits[int(s[1])], digits[int(s[2])], digits[int(s[3])])] f = open('examples/count.out', 'w') f.write('\n'.join(out)) f.close()