content
stringlengths
7
1.05M
class Solution: def isAlienSorted(self, words: List[str], order: str) -> bool: order_indx = {} for idx,letter in enumerate(order): order_indx[letter] = idx # compare adjacent words for i in range(len(words)-1): word1 = words[i] word2 = words[i+1] # words that are the same can be skipped if word1 == word2: continue # longer words, that start with the adjacent word, should not come first if len(word1)>len(word2): if word1.startswith(word2): return False # compare each character, it must be smaller or equal to that of the adjacent word for k in range(min(len(word1),len(word2))): if order_indx[word1[k]]<order_indx[word2[k]]: break elif order_indx[word1[k]]==order_indx[word2[k]]: continue else: return False return True # Time: O(C): C is total content of words # Space:O(1)
def center(win, width=100, height=100): win.update_idletasks() width = width frm_width = win.winfo_rootx() - win.winfo_x() win_width = width + 2 * frm_width height = height titlebar_height = win.winfo_rooty() - win.winfo_y() win_height = height + titlebar_height + frm_width x = win.winfo_screenwidth() // 2 - win_width // 2 y = win.winfo_screenheight() // 2 - win_height // 2 win.geometry('{}x{}+{}+{}'.format(width, height, x, y)) win.deiconify()
array = list(map(int, input('Enter the array of integers to be sorted(separated by spaces):').split())) for i in range(len(array)): min_idx = i for j in range(i + 1, len(array)): if array[min_idx] > array[j]: min_idx = j array[i], array[min_idx] = array[min_idx], array[i] print("Sorted array is:") print(*array)
# -*- coding: utf-8 -*- class CertstreamObject(object): """Base class for all the certstream data classes""" @classmethod def from_dict(cls, data): """ Returns a copy of the passed data :param data: The dict from which an object should be created from :return: copy of data or None """ if not data: return None data = data.copy() return data
batch_size = 192*4 config = {} # set the parameters related to the training and testing set data_train_opt = {} data_train_opt['batch_size'] = batch_size data_train_opt['unsupervised'] = True data_train_opt['epoch_size'] = None data_train_opt['random_sized_crop'] = False data_train_opt['dataset_name'] = 'imagenet' data_train_opt['split'] = 'train' data_test_opt = {} data_test_opt['batch_size'] = batch_size data_test_opt['unsupervised'] = True data_test_opt['epoch_size'] = None data_test_opt['random_sized_crop'] = False data_test_opt['dataset_name'] = 'imagenet' data_test_opt['split'] = 'val' config['data_train_opt'] = data_train_opt config['data_test_opt'] = data_test_opt config['max_num_epochs'] = 200 net_opt = {} net_opt['num_classes'] = 8 net_opt['num_stages'] = 4 networks = {} net_optim_params = {'optim_type': 'sgd', 'lr': 0.01, 'momentum':0.9, 'weight_decay': 5e-4, 'nesterov': True, 'LUT_lr':[(100, 0.01),(150,0.001),(200,0.0001)]} networks['model'] = {'def_file': 'architectures/AlexNet.py', 'pretrained': None, 'opt': net_opt, 'optim_params': net_optim_params} config['networks'] = networks criterions = {} criterions['loss'] = {'ctype':'MSELoss', 'opt':True} config['criterions'] = criterions config['algorithm_type'] = 'UnsupervisedModel'
# -*- coding: utf-8 -*- def main(): n = int(input()) ans = 0 for i in range(1, int(n ** 0.5) + 1): if n % i == 0 and (i ** 2) != n: m = n // i - 1 if n // m == n % m: ans += m print(ans) if __name__ == '__main__': main()
""" Collection of lists and dicts representing types in the python C-API """ """ CPython's function pointers as dict: typename: (return_type, (args,)) """ FUNCTIONS = { "unaryfunc": ("PyObject*", ("PyObject*",)), "binaryfunc": ("PyObject*", ("PyObject*", "PyObject*")), "ternaryfunc": ("PyObject*", ("PyObject*", "PyObject*", "PyObject*")), "inquiry": ("int", ("PyObject*",)), "lenfunc": ("Py_ssize_t", ("PyObject*",)), "ssizeargfunc": ("PyObject*", ("PyObject*", "Py_ssize_t")), "ssizessizeargfunc": ("PyObject*", ("PyObject*", "Py_ssize_t", "Py_ssize_t")), "ssizeobjargproc": ("int", ("PyObject*", "Py_ssize_t", "PyObject*")), "ssizessizeobjargproc": ("int", ("PyObject*", "Py_ssize_t", "Py_ssize_t", "PyObject*")), "objobjargproc": ("int", ("PyObject*", "PyObject*", "PyObject*")), "freefunc": ("void", ("void*",)), "destructor": ("void", ("PyObject*",)), "printfunc": ("int", ("PyObject*", "FILE*", "int")), "getattrfunc": ("PyObject*", ("PyObject*", "char*")), "getattrofunc": ("PyObject*", ("PyObject*", "PyObject*")), "setattrfunc": ("int", ("PyObject*", "char*", "PyObject*")), "setattrofunc": ("int", ("PyObject*", "PyObject*", "PyObject*")), "reprfunc": ("PyObject*", ("PyObject*",)), "hashfunc": ("Py_hash_t", ("PyObject*",)), "richcmpfunc": ("PyObject*", ("PyObject*", "PyObject*", "int")), "getiterfunc": ("PyObject*", ("PyObject*",)), "iternextfunc": ("PyObject*", ("PyObject*",)), "descrgetfunc": ("PyObject*", ("PyObject*", "PyObject*", "PyObject*")), "descrsetfunc": ("int", ("PyObject*", "PyObject*", "PyObject*")), "initproc": ("int", ("PyObject*", "PyObject*", "PyObject*")), "newfunc": ("PyObject*", ("struct _typeobject*", "PyObject*", "PyObject*")), "allocfunc": ("PyObject*", ("struct _typeobject*", "Py_ssize_t")), "getter": ("PyObject*", ("PyObject*", "void*")), "setter": ("int", ("PyObject*", "PyObject*", "void*")), "objobjproc": ("int", ("PyObject*", "PyObject*")), "visitproc": ("int", ("PyObject*", "void*")), "traverseproc": ("int", ("PyObject*", "visitproc", "void*")), } """ All members of PyTypeObject (member_name, type) """ PyTypeObject = [ ("tp_name", "const char*"), ("tp_basicsize", "Py_ssize_t"), ("tp_itemsize", "Py_ssize_t"), ("tp_dealloc", "destructor"), ("tp_print", "printfunc"), ("tp_getattr", "getattrfunc"), ("tp_setattr", "setattrfunc"), ("tp_reserved", "void*"), ("tp_repr", "reprfunc"), ("tp_as_number", "PyNumberMethods*"), ("tp_as_sequence", "PySequenceMethods*"), ("tp_as_mapping", "PyMappingMethods*"), ("tp_hash", "hashfunc"), ("tp_call", "ternaryfunc"), ("tp_str", "reprfunc"), ("tp_getattro", "getattrofunc"), ("tp_setattro", "setattrofunc"), ("tp_as_buffer", "PyBufferProcs*"), ("tp_flags", "unsigned long"), ("tp_doc", "const char*"), ("tp_traverse", "traverseproc"), ("tp_clear", "inquiry"), ("tp_richcompare", "richcmpfunc"), ("tp_weaklistoffset", "Py_ssize_t"), ("tp_iter", "getiterfunc"), ("tp_iternext", "iternextfunc"), ("tp_methods", "struct PyMethodDef*"), ("tp_members", "struct PyMemberDef*"), ("tp_getset", "struct PyGetSetDef*"), ("tp_base", "struct _typeobject*"), ("tp_dict", "PyObject*"), ("tp_descr_get", "descrgetfunc"), ("tp_descr_set", "descrsetfunc"), ("tp_dictoffset", "Py_ssize_t"), ("tp_init", "initproc"), ("tp_alloc", "allocfunc"), ("tp_new", "newfunc"), ("tp_free", "freefunc"), ("tp_is_gc", "inquiry"), ("tp_bases", "PyObject*"), ("tp_mro", "PyObject*"), ("tp_cache", "PyObject*"), ("tp_subclasses", "PyObject*"), ("tp_weaklist", "PyObject*"), ("tp_del", "destructor"), ("tp_version_tag", "unsigned int"), ("tp_finalize", "destructor"), ] PyNumberMethods = [ ("nb_add", "binaryfunc"), ("nb_subtract", "binaryfunc"), ("nb_multiply", "binaryfunc"), ("nb_remainder", "binaryfunc"), ("nb_divmod", "binaryfunc"), ("nb_power", "ternaryfunc"), ("nb_negative", "unaryfunc"), ("nb_positive", "unaryfunc"), ("nb_absolute", "unaryfunc"), ("nb_bool", "inquiry"), ("nb_invert", "unaryfunc"), ("nb_lshift", "binaryfunc"), ("nb_rshift", "binaryfunc"), ("nb_and", "binaryfunc"), ("nb_xor", "binaryfunc"), ("nb_or", "binaryfunc"), ("nb_int", "unaryfunc"), ("nb_reserved", "void*"), ("nb_float", "unaryfunc"), ("nb_inplace_add", "binaryfunc"), ("nb_inplace_subtract", "binaryfunc"), ("nb_inplace_multiply", "binaryfunc"), ("nb_inplace_remainder", "binaryfunc"), ("nb_inplace_power", "ternaryfunc"), ("nb_inplace_lshift", "binaryfunc"), ("nb_inplace_rshift", "binaryfunc"), ("nb_inplace_and", "binaryfunc"), ("nb_inplace_xor", "binaryfunc"), ("nb_inplace_or", "binaryfunc"), ("nb_floor_divide", "binaryfunc"), ("nb_true_divide", "binaryfunc"), ("nb_inplace_floor_divide", "binaryfunc"), ("nb_inplace_true_divide", "binaryfunc"), ("nb_index", "unaryfunc"), ] PySequenceMethods = [ ("sq_length", "lenfunc"), ("sq_concat", "binaryfunc"), ("sq_repeat", "ssizeargfunc"), ("sq_item", "ssizeargfunc"), ("was_sq_slice", "void*"), ("sq_ass_item", "ssizeobjargproc"), ("was_sq_ass_slice", "void*"), ("sq_contains", "objobjproc"), ("sq_inplace_concat", "binaryfunc"), ("sq_inplace_repeat", "ssizeargfunc"), ] PyMappingMethods = [ ("mp_length", "lenfunc"), ("mp_subscript", "binaryfunc"), ("mp_ass_subscript", "objobjargproc"), ] PyBufferProcs = [ ("bf_getbuffer", "getbufferproc"), ("bf_releasebuffer", "releasebufferproc"), ] PyModuleDef = [ ("m_name", "const char*"), ("m_doc", "const char*"), ("m_size", "Py_ssize_t"), ("m_methods", "PyMethodDef*"), ("m_reload", "inquiry"), ("m_traverse", "traverseproc"), ("m_clear", "inquiry"), ("m_free", "freefunc"), ] SEQUENCE_FUNCS = [ ("__len__", "sq_length"), ("__???__", "sq_concat"), ("__???__", "sq_repeat"), ("__getitem__", "sq_item"), ("__???___", "was_sq_slice"), ("__setitem__", "sq_ass_item"), ("__???___", "was_sq_ass_slice"), ("__contains__", "sq_contains"), ("__???___", "sq_inplace_concat"), ("__???___", "sq_inplace_repeat"), ] NUMBER_FUNCS = [ ("__add__", "nb_add", "binaryfunc"), ("__sub__", "nb_subtract", "binaryfunc"), ("__mul__", "nb_multiply", "binaryfunc"), ("__mod__", "nb_remainder", "binaryfunc"), ("__???__", "nb_divmod", "binaryfunc"), ("__pow__", "nb_power", "ternaryfunc"), ("__neg__", "nb_negative", "unaryfunc"), ("__pos__", "nb_positive", "unaryfunc"), ("__abs__", "nb_absolute", "unaryfunc"), ("__bool__", "nb_bool", "inquiry"), ("__???__", "nb_invert", "unaryfunc"), ("__???__", "nb_lshift", "binaryfunc"), ("__???__", "nb_rshift", "binaryfunc"), ("__and__", "nb_and", "binaryfunc"), ("__xor__", "nb_xor", "binaryfunc"), ("__or__", "nb_or", "binaryfunc"), ("__???__", "nb_int", "unaryfunc"), ("__???__", "nb_reserved", "void*"), ("__???__", "nb_float", "unaryfunc"), ("__iadd__", "nb_inplace_add", "binaryfunc"), ("__isub__", "nb_inplace_subtract", "binaryfunc"), ("__imul__", "nb_inplace_multiply", "binaryfunc"), ("__imod__", "nb_inplace_remainder", "binaryfunc"), ("__ipow__", "nb_inplace_power", "ternaryfunc"), ("__???__", "nb_inplace_lshift", "binaryfunc"), ("__???__", "nb_inplace_rshift", "binaryfunc"), ("__iand__", "nb_inplace_and", "binaryfunc"), ("__ixor__", "nb_inplace_xor", "binaryfunc"), ("__ior__", "nb_inplace_or", "binaryfunc"), ("__floordiv__", "nb_floor_divide", "binaryfunc"), ("__truediv__", "nb_true_divide", "binaryfunc"), ("__ifloordiv__", "nb_inplace_floor_divide", "binaryfunc"), ("__itruediv__", "nb_inplace_true_divide", "binaryfunc"), ("__???__", "nb_index", "unaryfunc"), ] TYPE_FUNCS = [ ("__str__", "tp_str"), ("__unicode__", "tp_str"), ("__repr__", "tp_repr"), ("__init__", "tp_init"), ("__eq__", "tp_richcompare") ] # otherwise PyObject* SPECIAL_RETURN_TYPES = { "__init__": "int", "__len__": "Py_ssize_t", "__setitem__": "int", } SPECIAL_ARGUMENTS = { "__getitem__": ", Py_ssize_t index", "__setitem__": ", Py_ssize_t index, PyObject* arg", } FUNCNAME_TO_STRUCT_MEMBER = dict() for i in SEQUENCE_FUNCS + NUMBER_FUNCS + TYPE_FUNCS: FUNCNAME_TO_STRUCT_MEMBER.setdefault(i[0], i[1]) STRUCT_MEMBER_TO_TYPE = dict() for i in PyModuleDef + PyBufferProcs + PyMappingMethods + PySequenceMethods + PyNumberMethods + PyTypeObject: STRUCT_MEMBER_TO_TYPE.setdefault(i[0], i[1]) FUNCNAME_TO_TYPE = dict() for i in FUNCNAME_TO_STRUCT_MEMBER: mem = FUNCNAME_TO_STRUCT_MEMBER.get(i) if mem in STRUCT_MEMBER_TO_TYPE: FUNCNAME_TO_TYPE.setdefault(i, STRUCT_MEMBER_TO_TYPE[mem])
# # PySNMP MIB module DOT3-OAM-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/DOT3-OAM-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:10:39 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ( Integer, OctetString, ObjectIdentifier, ) = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint") ( CounterBasedGauge64, ) = mibBuilder.importSymbols("HCNUM-TC", "CounterBasedGauge64") ( ifIndex, ) = mibBuilder.importSymbols("IF-MIB", "ifIndex") ( ObjectGroup, ModuleCompliance, NotificationGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") ( Bits, Gauge32, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, TimeTicks, ModuleIdentity, Unsigned32, IpAddress, NotificationType, iso, mib_2, ObjectIdentity, Integer32, Counter32, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Gauge32", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "TimeTicks", "ModuleIdentity", "Unsigned32", "IpAddress", "NotificationType", "iso", "mib-2", "ObjectIdentity", "Integer32", "Counter32") ( TruthValue, TextualConvention, MacAddress, TimeStamp, DisplayString, ) = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "MacAddress", "TimeStamp", "DisplayString") dot3OamMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 158)).setRevisions(("2007-06-14 00:00",)) if mibBuilder.loadTexts: dot3OamMIB.setLastUpdated('200706140000Z') if mibBuilder.loadTexts: dot3OamMIB.setOrganization('IETF Ethernet Interfaces and Hub MIB Working Group') if mibBuilder.loadTexts: dot3OamMIB.setContactInfo('WG Charter:\n http://www.ietf.org/html.charters/hubmib-charter.html\n Mailing lists:\n General Discussion: [email protected]\n To Subscribe: [email protected]\n In Body: subscribe your_email_address\n Chair: Bert Wijnen\n Alcatel-Lucent\n Email: bwijnen at alcatel-lucent dot com\n Editor: Matt Squire\n Hatteras Networks\n E-mail: msquire at hatterasnetworks dot com\n ') if mibBuilder.loadTexts: dot3OamMIB.setDescription("The MIB module for managing the new Ethernet OAM features\n introduced by the Ethernet in the First Mile taskforce (IEEE\n 802.3ah). The functionality presented here is based on IEEE\n 802.3ah [802.3ah], released in October, 2004. [802.3ah] was\n prepared as an addendum to the standing version of IEEE 802.3\n [802.3-2002]. Since then, [802.3ah] has been\n merged into the base IEEE 802.3 specification in [802.3-2005].\n\n In particular, this MIB focuses on the new OAM functions\n introduced in Clause 57 of [802.3ah]. The OAM functionality\n of Clause 57 is controlled by new management attributes\n introduced in Clause 30 of [802.3ah]. The OAM functions are\n not specific to any particular Ethernet physical layer, and\n can be generically applied to any Ethernet interface of\n [802.3-2002].\n\n An Ethernet OAM protocol data unit is a valid Ethernet frame\n with a destination MAC address equal to the reserved MAC\n address for Slow Protocols (See 43B of [802.3ah]), a\n lengthOrType field equal to the reserved type for Slow\n Protocols, and a Slow Protocols subtype equal to that of the\n subtype reserved for Ethernet OAM. OAMPDU is used throughout\n this document as an abbreviation for Ethernet OAM protocol\n data unit.\n\n The following reference is used throughout this MIB module:\n\n [802.3ah] refers to:\n IEEE Std 802.3ah-2004: 'Draft amendment to -\n Information technology - Telecommunications and\n information exchange between systems - Local and\n metropolitan area networks - Specific requirements - Part\n 3: Carrier sense multiple access with collision detection\n (CSMA/CD) access method and physical layer specifications\n - Media Access Control Parameters, Physical Layers and\n Management Parameters for subscriber access networks',\n October 2004.\n\n [802.3-2002] refers to:\n IEEE Std 802.3-2002:\n 'Information technology - Telecommunications and\n information exchange between systems - Local and\n metropolitan area networks - Specific requirements - Part\n 3: Carrier sense multiple access with collision detection\n (CSMA/CD) access method and physical layer specifications\n - Media Access Control Parameters, Physical Layers and\n Management Parameters for subscriber access networks',\n March 2002.\n\n [802.3-2005] refers to:\n IEEE Std 802.3-2005:\n 'Information technology - Telecommunications and\n information exchange between systems - Local and\n metropolitan area networks - Specific requirements - Part\n 3: Carrier sense multiple access with collision detection\n (CSMA/CD) access method and physical layer specifications\n - Media Access Control Parameters, Physical Layers and\n Management Parameters for subscriber access networks',\n December 2005.\n\n [802-2001] refers to:\n 'IEEE Standard for LAN/MAN (Local Area\n Network/Metropolitan Area Network): Overview and\n Architecture', IEEE 802, June 2001.\n\n Copyright (c) The IETF Trust (2007). This version of\n this MIB module is part of RFC 4878; See the RFC itself for\n full legal notices. ") dot3OamNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 158, 0)) dot3OamObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 158, 1)) dot3OamConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 158, 2)) class EightOTwoOui(OctetString, TextualConvention): subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(3,3) fixedLength = 3 dot3OamTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 1), ) if mibBuilder.loadTexts: dot3OamTable.setDescription('This table contains the primary controls and status for the\n OAM capabilities of an Ethernet-like interface. There will be\n one row in this table for each Ethernet-like interface in the\n system that supports the OAM functions defined in [802.3ah].\n ') dot3OamEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: dot3OamEntry.setDescription('An entry in the table that contains information on the\n Ethernet OAM function for a single Ethernet like interface.\n Entries in the table are created automatically for each\n interface supporting Ethernet OAM. The status of the row\n entry can be determined from dot3OamOperStatus.\n\n A dot3OamEntry is indexed in the dot3OamTable by the ifIndex\n object of the Interfaces MIB.\n ') dot3OamAdminState = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamAdminState.setDescription('This object is used to provision the default administrative\n OAM mode for this interface. This object represents the\n desired state of OAM for this interface.\n\n The dot3OamAdminState always starts in the disabled(2) state\n until an explicit management action or configuration\n information retained by the system causes a transition to the\n enabled(1) state. When enabled(1), Ethernet OAM will attempt\n to operate over this interface.\n ') dot3OamOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,))).clone(namedValues=NamedValues(("disabled", 1), ("linkFault", 2), ("passiveWait", 3), ("activeSendLocal", 4), ("sendLocalAndRemote", 5), ("sendLocalAndRemoteOk", 6), ("oamPeeringLocallyRejected", 7), ("oamPeeringRemotelyRejected", 8), ("operational", 9), ("nonOperHalfDuplex", 10),))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamOperStatus.setDescription('At initialization and failure conditions, two OAM entities on\n\n the same full-duplex Ethernet link begin a discovery phase to\n determine what OAM capabilities may be used on that link. The\n progress of this initialization is controlled by the OA\n sublayer.\n\n This value is always disabled(1) if OAM is disabled on this\n interface via the dot3OamAdminState.\n\n If the link has detected a fault and is transmitting OAMPDUs\n with a link fault indication, the value is linkFault(2).\n Also, if the interface is not operational (ifOperStatus is\n not up(1)), linkFault(2) is returned. Note that the object\n ifOperStatus may not be up(1) as a result of link failure or\n administrative action (ifAdminState being down(2) or\n testing(3)).\n\n The passiveWait(3) state is returned only by OAM entities in\n passive mode (dot3OamMode) and reflects the state in which the\n OAM entity is waiting to see if the peer device is OA\n capable. The activeSendLocal(4) value is used by active mode\n devices (dot3OamMode) and reflects the OAM entity actively\n trying to discover whether the peer has OAM capability but has\n not yet made that determination.\n\n The state sendLocalAndRemote(5) reflects that the local OA\n entity has discovered the peer but has not yet accepted or\n rejected the configuration of the peer. The local device can,\n for whatever reason, decide that the peer device is\n unacceptable and decline OAM peering. If the local OAM entity\n rejects the peer OAM entity, the state becomes\n oamPeeringLocallyRejected(7). If the OAM peering is allowed\n by the local device, the state moves to\n sendLocalAndRemoteOk(6). Note that both the\n sendLocalAndRemote(5) and oamPeeringLocallyRejected(7) states\n fall within the state SEND_LOCAL_REMOTE of the Discovery state\n diagram [802.3ah, Figure 57-5], with the difference being\n whether the local OAM client has actively rejected the peering\n or has just not indicated any decision yet. Whether a peering\n decision has been made is indicated via the local flags field\n in the OAMPDU (reflected in the aOAMLocalFlagsField of\n 30.3.6.1.10).\n\n If the remote OAM entity rejects the peering, the state\n becomes oamPeeringRemotelyRejected(8). Note that both the\n sendLocalAndRemoteOk(6) and oamPeeringRemotelyRejected(8)\n states fall within the state SEND_LOCAL_REMOTE_OK of the\n Discovery state diagram [802.3ah, Figure 57-5], with the\n difference being whether the remote OAM client has rejected\n\n the peering or has just not yet decided. This is indicated\n via the remote flags field in the OAMPDU (reflected in the\n aOAMRemoteFlagsField of 30.3.6.1.11).\n\n When the local OAM entity learns that both it and the remote\n OAM entity have accepted the peering, the state moves to\n operational(9) corresponding to the SEND_ANY state of the\n Discovery state diagram [802.3ah, Figure 57-5].\n\n Since Ethernet OAM functions are not designed to work\n completely over half-duplex interfaces, the value\n nonOperHalfDuplex(10) is returned whenever Ethernet OAM is\n enabled (dot3OamAdminState is enabled(1)), but the interface\n is in half-duplex operation.\n ') dot3OamMode = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("passive", 1), ("active", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamMode.setDescription("This object configures the mode of OAM operation for this\n Ethernet-like interface. OAM on Ethernet interfaces may be in\n 'active' mode or 'passive' mode. These two modes differ in\n that active mode provides additional capabilities to initiate\n monitoring activities with the remote OAM peer entity, while\n passive mode generally waits for the peer to initiate OA\n actions with it. As an example, an active OAM entity can put\n the remote OAM entity in a loopback state, where a passive OA\n entity cannot.\n\n The default value of dot3OamMode is dependent on the type of\n system on which this Ethernet-like interface resides. The\n default value should be 'active(2)' unless it is known that\n this system should take on a subservient role to the other\n device connected over this interface.\n\n Changing this value results in incrementing the configuration\n revision field of locally generated OAMPDUs (30.3.6.1.12) and\n potentially re-doing the OAM discovery process if the\n dot3OamOperStatus was already operational(9).\n ") dot3OamMaxOamPduSize = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(64,1518))).setUnits('octets').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamMaxOamPduSize.setDescription('The largest OAMPDU that the OAM entity supports. OA\n entities exchange maximum OAMPDU sizes and negotiate to use\n the smaller of the two maximum OAMPDU sizes between the peers.\n This value is determined by the local implementation.\n ') dot3OamConfigRevision = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamConfigRevision.setDescription('The configuration revision of the OAM entity as reflected in\n the latest OAMPDU sent by the OAM entity. The config revision\n is used by OAM entities to indicate that configuration changes\n have occurred, which might require the peer OAM entity to\n re-evaluate whether OAM peering is allowed.\n ') dot3OamFunctionsSupported = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 1, 1, 6), Bits().clone(namedValues=NamedValues(("unidirectionalSupport", 0), ("loopbackSupport", 1), ("eventSupport", 2), ("variableSupport", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamFunctionsSupported.setDescription("The OAM functions supported on this Ethernet-like interface.\n OAM consists of separate functional sets beyond the basic\n discovery process that is always required. These functional\n groups can be supported independently by any implementation.\n These values are communicated to the peer via the local\n configuration field of Information OAMPDUs.\n\n Setting 'unidirectionalSupport(0)' indicates that the OA\n\n entity supports the transmission of OAMPDUs on links that are\n operating in unidirectional mode (traffic flowing in one\n direction only). Setting 'loopbackSupport(1)' indicates that\n the OAM entity can initiate and respond to loopback commands.\n Setting 'eventSupport(2)' indicates that the OAM entity can\n send and receive Event Notification OAMPDUs. Setting\n 'variableSupport(3)' indicates that the OAM entity can send\n and receive Variable Request and Response OAMPDUs.\n ") dot3OamPeerTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 2), ) if mibBuilder.loadTexts: dot3OamPeerTable.setDescription('This table contains information about the OAM peer for a\n particular Ethernet-like interface. OAM entities communicate\n with a single OAM peer entity on Ethernet links on which OA\n is enabled and operating properly. There is one entry in this\n table for each entry in the dot3OamTable for which information\n on the peer OAM entity is available.\n ') dot3OamPeerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: dot3OamPeerEntry.setDescription('An entry in the table containing information on the peer OA\n entity for a single Ethernet-like interface.\n\n Note that there is at most one OAM peer for each Ethernet-like\n interface. Entries are automatically created when information\n about the OAM peer entity becomes available, and automatically\n deleted when the OAM peer entity is no longer in\n communication. Peer information is not available when\n dot3OamOperStatus is disabled(1), linkFault(2),\n passiveWait(3), activeSendLocal(4), or nonOperHalfDuplex(10).\n ') dot3OamPeerMacAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 1), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerMacAddress.setDescription('The MAC address of the peer OAM entity. The MAC address is\n derived from the most recently received OAMPDU.\n ') dot3OamPeerVendorOui = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 2), EightOTwoOui()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerVendorOui.setDescription('The OUI of the OAM peer as reflected in the latest\n Information OAMPDU received with a Local Information TLV. The\n OUI can be used to identify the vendor of the remote OA\n entity. This value is initialized to three octets of zero\n before any Local Information TLV is received.\n ') dot3OamPeerVendorInfo = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerVendorInfo.setDescription('The Vendor Info of the OAM peer as reflected in the latest\n Information OAMPDU received with a Local Information TLV.\n The semantics of the Vendor Information field is proprietary\n and specific to the vendor (identified by the\n dot3OamPeerVendorOui). This information could, for example,\n\n be used to identify a specific product or product family.\n This value is initialized to zero before any Local\n Information TLV is received.\n ') dot3OamPeerMode = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("passive", 1), ("active", 2), ("unknown", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerMode.setDescription('The mode of the OAM peer as reflected in the latest\n Information OAMPDU received with a Local Information TLV. The\n mode of the peer can be determined from the Configuration\n field in the Local Information TLV of the last Information\n OAMPDU received from the peer. The value is unknown(3)\n whenever no Local Information TLV has been received. The\n values of active(2) and passive(1) are returned when a Local\n Information TLV has been received indicating that the peer is\n in active or passive mode, respectively.\n ') dot3OamPeerMaxOamPduSize = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 5), Unsigned32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0,0),ValueRangeConstraint(64,1518),))).setUnits('octets').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerMaxOamPduSize.setDescription("The maximum size of OAMPDU supported by the peer as reflected\n in the latest Information OAMPDU received with a Local\n Information TLV. Ethernet OAM on this interface must not use\n OAMPDUs that exceed this size. The maximum OAMPDU size can be\n determined from the PDU Configuration field of the Local\n Information TLV of the last Information OAMPDU received from\n the peer. A value of zero is returned if no Local Information\n TLV has been received. Otherwise, the value of the OAM peer's\n maximum OAMPDU size is returned in this value.\n ") dot3OamPeerConfigRevision = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerConfigRevision.setDescription('The configuration revision of the OAM peer as reflected in\n the latest OAMPDU. This attribute is changed by the peer\n whenever it has a local configuration change for Ethernet OA\n on this interface. The configuration revision can be\n determined from the Revision field of the Local Information\n TLV of the most recently received Information OAMPDU with\n a Local Information TLV. A value of zero is returned if\n no Local Information TLV has been received.\n ') dot3OamPeerFunctionsSupported = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 2, 1, 7), Bits().clone(namedValues=NamedValues(("unidirectionalSupport", 0), ("loopbackSupport", 1), ("eventSupport", 2), ("variableSupport", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamPeerFunctionsSupported.setDescription('The OAM functions supported on this Ethernet-like interface.\n OAM consists of separate functionality sets above the basic\n discovery process. This value indicates the capabilities of\n the peer OAM entity with respect to these functions. This\n value is initialized so all bits are clear.\n\n If unidirectionalSupport(0) is set, then the peer OAM entity\n supports sending OAM frames on Ethernet interfaces when the\n receive path is known to be inoperable. If\n loopbackSupport(1) is set, then the peer OAM entity can send\n and receive OAM loopback commands. If eventSupport(2) is set,\n then the peer OAM entity can send and receive event OAMPDUs to\n signal various error conditions. If variableSupport(3) is\n set, then the peer OAM entity can send and receive variable\n requests to monitor the attribute value as described in Clause\n 57 of [802.3ah].\n\n The capabilities of the OAM peer can be determined from the\n configuration field of the Local Information TLV of the most\n recently received Information OAMPDU with a Local Information\n TLV. All zeros are returned if no Local Information TLV has\n\n yet been received.\n ') dot3OamLoopbackTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 3), ) if mibBuilder.loadTexts: dot3OamLoopbackTable.setDescription("This table contains controls for the loopback state of the\n local link as well as indicates the status of the loopback\n function. There is one entry in this table for each entry in\n dot3OamTable that supports loopback functionality (where\n dot3OamFunctionsSupported includes the loopbackSupport bit\n set).\n\n Loopback can be used to place the remote OAM entity in a state\n where every received frame (except OAMPDUs) is echoed back\n over the same interface on which they were received. In this\n state, at the remote entity, 'normal' traffic is disabled as\n only the looped back frames are transmitted on the interface.\n Loopback is thus an intrusive operation that prohibits normal\n data flow and should be used accordingly.\n ") dot3OamLoopbackEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: dot3OamLoopbackEntry.setDescription('An entry in the table, containing information on the loopback\n status for a single Ethernet-like interface. Entries in the\n table are automatically created whenever the local OAM entity\n supports loopback capabilities. The loopback status on the\n interface can be determined from the dot3OamLoopbackStatus\n object.\n ') dot3OamLoopbackStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6,))).clone(namedValues=NamedValues(("noLoopback", 1), ("initiatingLoopback", 2), ("remoteLoopback", 3), ("terminatingLoopback", 4), ("localLoopback", 5), ("unknown", 6),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamLoopbackStatus.setDescription("The loopback status of the OAM entity. This status is\n determined by a combination of the local parser and\n multiplexer states, the remote parser and multiplexer states,\n as well as by the actions of the local OAM client. When\n operating in normal mode with no loopback in progress, the\n status reads noLoopback(1).\n\n The values initiatingLoopback(2) and terminatingLoopback(4)\n can be read or written. The other values can only be read -\n they can never be written. Writing initiatingLoopback causes\n the local OAM entity to start the loopback process with its\n peer. This value can only be written when the status is\n noLoopback(1). Writing the value initiatingLoopback(2) in any\n other state has no effect. When in remoteLoopback(3), writing\n terminatingLoopback(4) causes the local OAM entity to initiate\n the termination of the loopback state. Writing\n terminatingLoopack(4) in any other state has no effect.\n\n If the OAM client initiates a loopback and has sent a\n Loopback OAMPDU and is waiting for a response, where the local\n parser and multiplexer states are DISCARD (see [802.3ah,\n 57.2.11.1]), the status is 'initiatingLoopback'. In this\n case, the local OAM entity has yet to receive any\n acknowledgment that the remote OAM entity has received its\n loopback command request.\n\n If the local OAM client knows that the remote OAM entity is in\n loopback mode (via the remote state information as described\n in [802.3ah, 57.2.11.1, 30.3.6.1.15]), the status is\n remoteLoopback(3). If the local OAM client is in the process\n of terminating the remote loopback [802.3ah, 57.2.11.3,\n 30.3.6.1.14] with its local multiplexer and parser states in\n DISCARD, the status is terminatingLoopback(4). If the remote\n OAM client has put the local OAM entity in loopback mode as\n indicated by its local parser state, the status is\n localLoopback(5).\n\n The unknown(6) status indicates that the parser and\n multiplexer combination is unexpected. This status may be\n returned if the OAM loopback is in a transition state but\n should not persist.\n\n The values of this attribute correspond to the following\n values of the local and remote parser and multiplexer states.\n\n value LclPrsr LclMux RmtPrsr RmtMux\n noLoopback FWD FWD FWD FWD\n initLoopback DISCARD DISCARD FWD FWD\n rmtLoopback DISCARD FWD LPBK DISCARD\n tmtngLoopback DISCARD DISCARD LPBK DISCARD\n lclLoopback LPBK DISCARD DISCARD FWD\n unknown *** any other combination ***\n ") dot3OamLoopbackIgnoreRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("ignore", 1), ("process", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamLoopbackIgnoreRx.setDescription('Since OAM loopback is a disruptive operation (user traffic\n does not pass), this attribute provides a mechanism to provide\n controls over whether received OAM loopback commands are\n processed or ignored. When the value is ignore(1), received\n loopback commands are ignored. When the value is process(2),\n OAM loopback commands are processed. The default value is to\n ignore loopback commands (ignore(1)).\n ') dot3OamStatsTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 4), ) if mibBuilder.loadTexts: dot3OamStatsTable.setDescription('This table contains statistics for the OAM function on a\n particular Ethernet-like interface. There is an entry in the\n table for every entry in the dot3OamTable.\n\n The counters in this table are defined as 32-bit entries to\n match the counter size as defined in [802.3ah]. Given that\n the OA protocol is a slow protocol, the counters increment at\n a slow rate.\n ') dot3OamStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: dot3OamStatsEntry.setDescription('An entry in the table containing statistics information on\n the Ethernet OAM function for a single Ethernet-like\n interface. Entries are automatically created for every entry\n in the dot3OamTable. Counters are maintained across\n transitions in dot3OamOperStatus.\n ') dot3OamInformationTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 1), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamInformationTx.setDescription('A count of the number of Information OAMPDUs transmitted on\n this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime. ') dot3OamInformationRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 2), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamInformationRx.setDescription('A count of the number of Information OAMPDUs received on this\n interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamUniqueEventNotificationTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 3), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamUniqueEventNotificationTx.setDescription('A count of the number of unique Event OAMPDUs transmitted on\n this interface. Event Notifications may be sent in duplicate\n to increase the probability of successfully being received,\n\n given the possibility that a frame may be lost in transit.\n Duplicate Event Notification transmissions are counted by\n dot3OamDuplicateEventNotificationTx.\n\n A unique Event Notification OAMPDU is indicated as an Event\n Notification OAMPDU with a Sequence Number field that is\n distinct from the previously transmitted Event Notification\n OAMPDU Sequence Number.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamUniqueEventNotificationRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 4), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamUniqueEventNotificationRx.setDescription('A count of the number of unique Event OAMPDUs received on\n this interface. Event Notification OAMPDUs may be sent in\n duplicate to increase the probability of successfully being\n received, given the possibility that a frame may be lost in\n transit. Duplicate Event Notification receptions are counted\n by dot3OamDuplicateEventNotificationRx.\n\n A unique Event Notification OAMPDU is indicated as an Event\n Notification OAMPDU with a Sequence Number field that is\n distinct from the previously received Event Notification\n OAMPDU Sequence Number.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamDuplicateEventNotificationTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 5), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamDuplicateEventNotificationTx.setDescription('A count of the number of duplicate Event OAMPDUs transmitted\n\n on this interface. Event Notification OAMPDUs may be sent in\n duplicate to increase the probability of successfully being\n received, given the possibility that a frame may be lost in\n transit.\n\n A duplicate Event Notification OAMPDU is indicated as an Event\n Notification OAMPDU with a Sequence Number field that is\n identical to the previously transmitted Event Notification\n OAMPDU Sequence Number.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamDuplicateEventNotificationRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 6), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamDuplicateEventNotificationRx.setDescription('A count of the number of duplicate Event OAMPDUs received on\n this interface. Event Notification OAMPDUs may be sent in\n duplicate to increase the probability of successfully being\n received, given the possibility that a frame may be lost in\n transit.\n\n A duplicate Event Notification OAMPDU is indicated as an Event\n Notification OAMPDU with a Sequence Number field that is\n identical to the previously received Event Notification OAMPDU\n Sequence Number.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamLoopbackControlTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 7), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamLoopbackControlTx.setDescription('A count of the number of Loopback Control OAMPDUs transmitted\n\n on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamLoopbackControlRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 8), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamLoopbackControlRx.setDescription('A count of the number of Loopback Control OAMPDUs received\n on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamVariableRequestTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 9), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamVariableRequestTx.setDescription('A count of the number of Variable Request OAMPDUs transmitted\n on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamVariableRequestRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 10), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamVariableRequestRx.setDescription('A count of the number of Variable Request OAMPDUs received on\n\n this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamVariableResponseTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 11), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamVariableResponseTx.setDescription('A count of the number of Variable Response OAMPDUs\n transmitted on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamVariableResponseRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 12), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamVariableResponseRx.setDescription('A count of the number of Variable Response OAMPDUs received\n on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamOrgSpecificTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 13), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamOrgSpecificTx.setDescription('A count of the number of Organization Specific OAMPDUs\n\n transmitted on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamOrgSpecificRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 14), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamOrgSpecificRx.setDescription('A count of the number of Organization Specific OAMPDUs\n received on this interface.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamUnsupportedCodesTx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 15), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamUnsupportedCodesTx.setDescription('A count of the number of OAMPDUs transmitted on this\n interface with an unsupported op-code.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamUnsupportedCodesRx = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 16), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamUnsupportedCodesRx.setDescription('A count of the number of OAMPDUs received on this interface\n\n with an unsupported op-code.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ') dot3OamFramesLostDueToOam = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 4, 1, 17), Counter32()).setUnits('frames').setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamFramesLostDueToOam.setDescription("A count of the number of frames that were dropped by the OA\n multiplexer. Since the OAM multiplexer has multiple inputs\n and a single output, there may be cases where frames are\n dropped due to transmit resource contention. This counter is\n incremented whenever a frame is dropped by the OAM layer.\n Note that any Ethernet frame, not just OAMPDUs, may be dropped\n by the OAM layer. This can occur when an OAMPDU takes\n precedence over a 'normal' frame resulting in the 'normal'\n frame being dropped.\n\n When this counter is incremented, no other counters in this\n MIB are incremented.\n\n Discontinuities of this counter can occur at re-initialization\n of the management system, and at other times as indicated by\n the value of the ifCounterDiscontinuityTime.\n ") dot3OamEventConfigTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 5), ) if mibBuilder.loadTexts: dot3OamEventConfigTable.setDescription('Ethernet OAM includes the ability to generate and receive\n Event Notification OAMPDUs to indicate various link problems.\n This table contains the mechanisms to enable Event\n\n Notifications and configure the thresholds to generate the\n standard Ethernet OAM events. There is one entry in the table\n for every entry in dot3OamTable that supports OAM events\n (where dot3OamFunctionsSupported includes the eventSupport\n bit set). The values in the table are maintained across\n changes to dot3OamOperStatus.\n\n The standard threshold crossing events are:\n - Errored Symbol Period Event. Generated when the number of\n symbol errors exceeds a threshold within a given window\n defined by a number of symbols (for example, 1,000 symbols\n out of 1,000,000 had errors).\n - Errored Frame Period Event. Generated when the number of\n frame errors exceeds a threshold within a given window\n defined by a number of frames (for example, 10 frames out\n of 1000 had errors).\n - Errored Frame Event. Generated when the number of frame\n errors exceeds a threshold within a given window defined\n by a period of time (for example, 10 frames in 1 second\n had errors).\n - Errored Frame Seconds Summary Event. Generated when the\n number of errored frame seconds exceeds a threshold within\n a given time period (for example, 10 errored frame seconds\n within the last 100 seconds). An errored frame second is\n defined as a 1 second interval which had >0 frame errors.\n There are other events (dying gasp, critical events) that are\n not threshold crossing events but which can be\n enabled/disabled via this table.\n ') dot3OamEventConfigEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 5, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: dot3OamEventConfigEntry.setDescription('Entries are automatically created and deleted from this\n table, and exist whenever the OAM entity supports Ethernet OA\n events (as indicated by the eventSupport bit in\n dot3OamFunctionsSuppported). Values in the table are\n maintained across changes to the value of dot3OamOperStatus.\n\n Event configuration controls when the local management entity\n sends Event Notification OAMPDUs to its OAM peer, and when\n certain event flags are set or cleared in OAMPDUs.\n ') dot3OamErrSymPeriodWindowHi = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 1), Unsigned32()).setUnits('2^32 symbols').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrSymPeriodWindowHi.setDescription('The two objects dot3OamErrSymPeriodWindowHi and\n dot3OamErrSymPeriodLo together form an unsigned 64-bit\n integer representing the number of symbols over which this\n threshold event is defined. This is defined as\n dot3OamErrSymPeriodWindow = ((2^32)*dot3OamErrSymPeriodWindowHi)\n + dot3OamErrSymPeriodWindowLo\n\n If dot3OamErrSymPeriodThreshold symbol errors occur within a\n window of dot3OamErrSymPeriodWindow symbols, an Event\n Notification OAMPDU should be generated with an Errored Symbol\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n\n The default value for dot3OamErrSymPeriodWindow is the number\n of symbols in one second for the underlying physical layer.\n ') dot3OamErrSymPeriodWindowLo = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 2), Unsigned32()).setUnits('symbols').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrSymPeriodWindowLo.setDescription('The two objects dot3OamErrSymPeriodWindowHi and\n dot3OamErrSymPeriodWindowLo together form an unsigned 64-bit\n integer representing the number of symbols over which this\n threshold event is defined. This is defined as\n\n dot3OamErrSymPeriodWindow = ((2^32)*dot3OamErrSymPeriodWindowHi)\n + dot3OamErrSymPeriodWindowLo\n\n If dot3OamErrSymPeriodThreshold symbol errors occur within a\n window of dot3OamErrSymPeriodWindow symbols, an Event\n Notification OAMPDU should be generated with an Errored Symbol\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n\n The default value for dot3OamErrSymPeriodWindow is the number\n of symbols in one second for the underlying physical layer.\n ') dot3OamErrSymPeriodThresholdHi = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 3), Unsigned32()).setUnits('2^32 symbols').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrSymPeriodThresholdHi.setDescription('The two objects dot3OamErrSymPeriodThresholdHi and\n dot3OamErrSymPeriodThresholdLo together form an unsigned\n 64-bit integer representing the number of symbol errors that\n must occur within a given window to cause this event.\n\n This is defined as\n\n dot3OamErrSymPeriodThreshold =\n ((2^32) * dot3OamErrSymPeriodThresholdHi)\n + dot3OamErrSymPeriodThresholdLo\n\n If dot3OamErrSymPeriodThreshold symbol errors occur within a\n window of dot3OamErrSymPeriodWindow symbols, an Event\n Notification OAMPDU should be generated with an Errored Symbol\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n\n The default value for dot3OamErrSymPeriodThreshold is one\n symbol errors. If the threshold value is zero, then an Event\n\n Notification OAMPDU is sent periodically (at the end of every\n window). This can be used as an asynchronous notification to\n the peer OAM entity of the statistics related to this\n threshold crossing alarm.\n ') dot3OamErrSymPeriodThresholdLo = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 4), Unsigned32()).setUnits('symbols').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrSymPeriodThresholdLo.setDescription('The two objects dot3OamErrSymPeriodThresholdHi and\n dot3OamErrSymPeriodThresholdLo together form an unsigned\n 64-bit integer representing the number of symbol errors that\n must occur within a given window to cause this event.\n\n This is defined as\n\n dot3OamErrSymPeriodThreshold =\n ((2^32) * dot3OamErrSymPeriodThresholdHi)\n + dot3OamErrSymPeriodThresholdLo\n\n If dot3OamErrSymPeriodThreshold symbol errors occur within a\n window of dot3OamErrSymPeriodWindow symbols, an Event\n Notification OAMPDU should be generated with an Errored Symbol\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n\n The default value for dot3OamErrSymPeriodThreshold is one\n symbol error. If the threshold value is zero, then an Event\n Notification OAMPDU is sent periodically (at the end of every\n window). This can be used as an asynchronous notification to\n the peer OAM entity of the statistics related to this\n threshold crossing alarm.\n ') dot3OamErrSymPeriodEvNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 5), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrSymPeriodEvNotifEnable.setDescription('If true, the OAM entity should send an Event Notification\n OAMPDU when an Errored Symbol Period Event occurs.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ') dot3OamErrFramePeriodWindow = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 6), Unsigned32()).setUnits('frames').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFramePeriodWindow.setDescription('The number of frames over which the threshold is defined.\n The default value of the window is the number of minimum size\n Ethernet frames that can be received over the physical layer\n in one second.\n\n If dot3OamErrFramePeriodThreshold frame errors occur within a\n window of dot3OamErrFramePeriodWindow frames, an Event\n Notification OAMPDU should be generated with an Errored Frame\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n ') dot3OamErrFramePeriodThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 7), Unsigned32()).setUnits('frames').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFramePeriodThreshold.setDescription('The number of frame errors that must occur for this event to\n be triggered. The default value is one frame error. If the\n threshold value is zero, then an Event Notification OAMPDU is\n sent periodically (at the end of every window). This can be\n used as an asynchronous notification to the peer OAM entity of\n the statistics related to this threshold crossing alarm.\n\n If dot3OamErrFramePeriodThreshold frame errors occur within a\n window of dot3OamErrFramePeriodWindow frames, an Event\n Notification OAMPDU should be generated with an Errored Frame\n Period Event TLV indicating that the threshold has been\n crossed in this window.\n ') dot3OamErrFramePeriodEvNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 8), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFramePeriodEvNotifEnable.setDescription('If true, the OAM entity should send an Event Notification\n OAMPDU when an Errored Frame Period Event occurs.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ') dot3OamErrFrameWindow = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 9), Unsigned32().clone(10)).setUnits('tenths of a second').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameWindow.setDescription('The amount of time (in 100ms increments) over which the\n threshold is defined. The default value is 10 (1 second).\n\n If dot3OamErrFrameThreshold frame errors occur within a window\n of dot3OamErrFrameWindow seconds (measured in tenths of\n seconds), an Event Notification OAMPDU should be generated\n with an Errored Frame Event TLV indicating that the threshold\n has been crossed in this window.\n ') dot3OamErrFrameThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 10), Unsigned32().clone(1)).setUnits('frames').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameThreshold.setDescription('The number of frame errors that must occur for this event to\n be triggered. The default value is one frame error. If the\n threshold value is zero, then an Event Notification OAMPDU is\n sent periodically (at the end of every window). This can be\n used as an asynchronous notification to the peer OAM entity of\n the statistics related to this threshold crossing alarm.\n\n If dot3OamErrFrameThreshold frame errors occur within a window\n of dot3OamErrFrameWindow (in tenths of seconds), an Event\n Notification OAMPDU should be generated with an Errored Frame\n Event TLV indicating the threshold has been crossed in this\n window.\n ') dot3OamErrFrameEvNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 11), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameEvNotifEnable.setDescription('If true, the OAM entity should send an Event Notification\n OAMPDU when an Errored Frame Event occurs.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ') dot3OamErrFrameSecsSummaryWindow = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100,9000)).clone(100)).setUnits('tenths of a second').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameSecsSummaryWindow.setDescription('The amount of time (in 100 ms intervals) over which the\n threshold is defined. The default value is 100 (10 seconds).\n\n If dot3OamErrFrameSecsSummaryThreshold frame errors occur\n within a window of dot3OamErrFrameSecsSummaryWindow (in tenths\n of seconds), an Event Notification OAMPDU should be generated\n with an Errored Frame Seconds Summary Event TLV indicating\n that the threshold has been crossed in this window.\n ') dot3OamErrFrameSecsSummaryThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,900)).clone(1)).setUnits('errored frame seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameSecsSummaryThreshold.setDescription('The number of errored frame seconds that must occur for this\n event to be triggered. The default value is one errored frame\n second. If the threshold value is zero, then an Event\n Notification OAMPDU is sent periodically (at the end of every\n window). This can be used as an asynchronous notification to\n the peer OAM entity of the statistics related to this\n threshold crossing alarm.\n\n If dot3OamErrFrameSecsSummaryThreshold frame errors occur\n within a window of dot3OamErrFrameSecsSummaryWindow (in tenths\n of seconds), an Event Notification OAMPDU should be generated\n with an Errored Frame Seconds Summary Event TLV indicating\n that the threshold has been crossed in this window.\n ') dot3OamErrFrameSecsEvNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 14), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamErrFrameSecsEvNotifEnable.setDescription('If true, the local OAM entity should send an Event\n Notification OAMPDU when an Errored Frame Seconds Event\n occurs.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ') dot3OamDyingGaspEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 15), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamDyingGaspEnable.setDescription("If true, the local OAM entity should attempt to indicate a\n dying gasp via the OAMPDU flags field to its peer OAM entity\n when a dying gasp event occurs. The exact definition of a\n dying gasp event is implementation dependent. If the system\n\n does not support dying gasp capability, setting this object\n has no effect, and reading the object should always result in\n 'false'.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ") dot3OamCriticalEventEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 5, 1, 16), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: dot3OamCriticalEventEnable.setDescription("If true, the local OAM entity should attempt to indicate a\n critical event via the OAMPDU flags to its peer OAM entity\n when a critical event occurs. The exact definition of a\n critical event is implementation dependent. If the system\n does not support critical event capability, setting this\n object has no effect, and reading the object should always\n result in 'false'.\n\n By default, this object should have the value true for\n Ethernet-like interfaces that support OAM. If the OAM layer\n does not support Event Notifications (as indicated via the\n dot3OamFunctionsSupported attribute), this value is ignored.\n ") dot3OamEventLogTable = MibTable((1, 3, 6, 1, 2, 1, 158, 1, 6), ) if mibBuilder.loadTexts: dot3OamEventLogTable.setDescription("This table records a history of the events that have occurred\n at the Ethernet OAM level. These events can include locally\n detected events, which may result in locally generated\n OAMPDUs, and remotely detected events, which are detected by\n the OAM peer entity and signaled to the local entity via\n\n Ethernet OAM. Ethernet OAM events can be signaled by Event\n Notification OAMPDUs or by the flags field in any OAMPDU.\n\n This table contains both threshold crossing events and\n non-threshold crossing events. The parameters for the\n threshold window, threshold value, and actual value\n (dot3OamEventLogWindowXX, dot3OamEventLogThresholdXX,\n dot3OamEventLogValue) are only applicable to threshold\n crossing events, and are returned as all F's (2^32 - 1) for\n non-threshold crossing events.\n\n Entries in the table are automatically created when such\n events are detected. The size of the table is implementation\n dependent. When the table reaches its maximum size, older\n entries are automatically deleted to make room for newer\n entries.\n ") dot3OamEventLogEntry = MibTableRow((1, 3, 6, 1, 2, 1, 158, 1, 6, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DOT3-OAM-MIB", "dot3OamEventLogIndex")) if mibBuilder.loadTexts: dot3OamEventLogEntry.setDescription('An entry in the dot3OamEventLogTable. Entries are\n automatically created whenever Ethernet OAM events occur at\n the local OAM entity, and when Event Notification OAMPDUs are\n received at the local OAM entity (indicating that events have\n occurred at the peer OAM entity). The size of the table is\n implementation dependent, but when the table becomes full,\n older events are automatically deleted to make room for newer\n events. The table index dot3OamEventLogIndex increments for\n each new entry, and when the maximum value is reached, the\n value restarts at zero.\n ') dot3OamEventLogIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1,4294967295))) if mibBuilder.loadTexts: dot3OamEventLogIndex.setDescription('An arbitrary integer for identifying individual events\n within the event log. ') dot3OamEventLogTimestamp = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 2), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogTimestamp.setDescription('The value of sysUpTime at the time of the logged event. For\n locally generated events, the time of the event can be\n accurately retrieved from sysUpTime. For remotely generated\n events, the time of the event is indicated by the reception of\n the Event Notification OAMPDU indicating that the event\n occurred on the peer. A system may attempt to adjust the\n timestamp value to more accurately reflect the time of the\n event at the peer OAM entity by using other information, such\n as that found in the timestamp found of the Event Notification\n TLVs, which provides an indication of the relative time\n between events at the peer entity. ') dot3OamEventLogOui = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 3), EightOTwoOui()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogOui.setDescription('The OUI of the entity defining the object type. All IEEE\n 802.3 defined events (as appearing in [802.3ah] except for the\n Organizationally Unique Event TLVs) use the IEEE 802.3 OUI of\n 0x0180C2. Organizations defining their own Event Notification\n TLVs include their OUI in the Event Notification TLV that\n gets reflected here. ') dot3OamEventLogType = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogType.setDescription("The type of event that generated this entry in the event log.\n When the OUI is the IEEE 802.3 OUI of 0x0180C2, the following\n event types are defined:\n erroredSymbolEvent(1),\n erroredFramePeriodEvent(2),\n erroredFrameEvent(3),\n erroredFrameSecondsEvent(4),\n linkFault(256),\n dyingGaspEvent(257),\n criticalLinkEvent(258)\n The first four are considered threshold crossing events, as\n they are generated when a metric exceeds a given value within\n a specified window. The other three are not threshold\n crossing events.\n\n When the OUI is not 71874 (0x0180C2 in hex), then some other\n organization has defined the event space. If event subtyping\n is known to the implementation, it may be reflected here.\n Otherwise, this value should return all F's (2^32 - 1).\n ") dot3OamEventLogLocation = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("local", 1), ("remote", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogLocation.setDescription('Whether this event occurred locally (local(1)), or was\n received from the OAM peer via Ethernet OAM (remote(2)).\n ') dot3OamEventLogWindowHi = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogWindowHi.setDescription("If the event represents a threshold crossing event, the two\n objects dot3OamEventWindowHi and dot3OamEventWindowLo, form\n an unsigned 64-bit integer yielding the window over which the\n value was measured for the threshold crossing event (for\n example, 5, when 11 occurrences happened in 5 seconds while\n the threshold was 10). The two objects are combined as:\n\n dot3OamEventLogWindow = ((2^32) * dot3OamEventLogWindowHi)\n + dot3OamEventLogWindowLo\n\n Otherwise, this value is returned as all F's (2^32 - 1) and\n adds no useful information.\n ") dot3OamEventLogWindowLo = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 7), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogWindowLo.setDescription("If the event represents a threshold crossing event, the two\n objects dot3OamEventWindowHi and dot3OamEventWindowLo form an\n unsigned 64-bit integer yielding the window over which the\n value was measured for the threshold crossing event (for\n example, 5, when 11 occurrences happened in 5 seconds while\n the threshold was 10). The two objects are combined as:\n\n dot3OamEventLogWindow = ((2^32) * dot3OamEventLogWindowHi)\n + dot3OamEventLogWindowLo\n\n Otherwise, this value is returned as all F's (2^32 - 1) and\n adds no useful information.\n ") dot3OamEventLogThresholdHi = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 8), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogThresholdHi.setDescription("If the event represents a threshold crossing event, the two\n objects dot3OamEventThresholdHi and dot3OamEventThresholdLo\n form an unsigned 64-bit integer yielding the value that was\n crossed for the threshold crossing event (for example, 10,\n when 11 occurrences happened in 5 seconds while the threshold\n was 10). The two objects are combined as:\n\n dot3OamEventLogThreshold = ((2^32) * dot3OamEventLogThresholdHi)\n + dot3OamEventLogThresholdLo\n\n Otherwise, this value is returned as all F's (2^32 -1) and\n adds no useful information.\n ") dot3OamEventLogThresholdLo = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 9), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogThresholdLo.setDescription("If the event represents a threshold crossing event, the two\n objects dot3OamEventThresholdHi and dot3OamEventThresholdLo\n form an unsigned 64-bit integer yielding the value that was\n crossed for the threshold crossing event (for example, 10,\n when 11 occurrences happened in 5 seconds while the threshold\n was 10). The two objects are combined as:\n\n dot3OamEventLogThreshold = ((2^32) * dot3OamEventLogThresholdHi)\n + dot3OamEventLogThresholdLo\n\n Otherwise, this value is returned as all F's (2^32 - 1) and\n adds no useful information.\n ") dot3OamEventLogValue = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 10), CounterBasedGauge64()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogValue.setDescription("If the event represents a threshold crossing event, this\n value indicates the value of the parameter within the given\n window that generated this event (for example, 11, when 11\n occurrences happened in 5 seconds while the threshold was 10).\n\n Otherwise, this value is returned as all F's\n (2^64 - 1) and adds no useful information.\n ") dot3OamEventLogRunningTotal = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 11), CounterBasedGauge64()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogRunningTotal.setDescription('Each Event Notification TLV contains a running total of the\n number of times an event has occurred, as well as the number\n of times an Event Notification for the event has been\n\n transmitted. For non-threshold crossing events, the number of\n events (dot3OamLogRunningTotal) and the number of resultant\n Event Notifications (dot3OamLogEventTotal) should be\n identical.\n\n For threshold crossing events, since multiple occurrences may\n be required to cross the threshold, these values are likely\n different. This value represents the total number of times\n this event has happened since the last reset (for example,\n 3253, when 3253 symbol errors have occurred since the last\n reset, which has resulted in 51 symbol error threshold\n crossing events since the last reset).\n ') dot3OamEventLogEventTotal = MibTableColumn((1, 3, 6, 1, 2, 1, 158, 1, 6, 1, 12), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dot3OamEventLogEventTotal.setDescription('Each Event Notification TLV contains a running total of the\n number of times an event has occurred, as well as the number\n of times an Event Notification for the event has been\n transmitted. For non-threshold crossing events, the number of\n events (dot3OamLogRunningTotal) and the number of resultant\n Event Notifications (dot3OamLogEventTotal) should be\n identical.\n\n For threshold crossing events, since multiple occurrences may\n be required to cross the threshold, these values are likely\n different. This value represents the total number of times\n one or more of these occurrences have resulted in an Event\n Notification (for example, 51 when 3253 symbol errors have\n occurred since the last reset, which has resulted in 51 symbol\n error threshold crossing events since the last reset).\n ') dot3OamThresholdEvent = NotificationType((1, 3, 6, 1, 2, 1, 158, 0, 1)).setObjects(*(("DOT3-OAM-MIB", "dot3OamEventLogTimestamp"), ("DOT3-OAM-MIB", "dot3OamEventLogOui"), ("DOT3-OAM-MIB", "dot3OamEventLogType"), ("DOT3-OAM-MIB", "dot3OamEventLogLocation"), ("DOT3-OAM-MIB", "dot3OamEventLogWindowHi"), ("DOT3-OAM-MIB", "dot3OamEventLogWindowLo"), ("DOT3-OAM-MIB", "dot3OamEventLogThresholdHi"), ("DOT3-OAM-MIB", "dot3OamEventLogThresholdLo"), ("DOT3-OAM-MIB", "dot3OamEventLogValue"), ("DOT3-OAM-MIB", "dot3OamEventLogRunningTotal"), ("DOT3-OAM-MIB", "dot3OamEventLogEventTotal"),)) if mibBuilder.loadTexts: dot3OamThresholdEvent.setDescription('A dot3OamThresholdEvent notification is sent when a local or\n remote threshold crossing event is detected. A local\n threshold crossing event is detected by the local entity,\n while a remote threshold crossing event is detected by the\n reception of an Ethernet OAM Event Notification OAMPDU\n that indicates a threshold event.\n\n This notification should not be sent more than once per\n second.\n\n The OAM entity can be derived from extracting the ifIndex from\n the variable bindings. The objects in the notification\n correspond to the values in a row instance in the\n dot3OamEventLogTable.\n\n The management entity should periodically check\n dot3OamEventLogTable to detect any missed events.') dot3OamNonThresholdEvent = NotificationType((1, 3, 6, 1, 2, 1, 158, 0, 2)).setObjects(*(("DOT3-OAM-MIB", "dot3OamEventLogTimestamp"), ("DOT3-OAM-MIB", "dot3OamEventLogOui"), ("DOT3-OAM-MIB", "dot3OamEventLogType"), ("DOT3-OAM-MIB", "dot3OamEventLogLocation"), ("DOT3-OAM-MIB", "dot3OamEventLogEventTotal"),)) if mibBuilder.loadTexts: dot3OamNonThresholdEvent.setDescription('A dot3OamNonThresholdEvent notification is sent when a local\n or remote non-threshold crossing event is detected. A local\n event is detected by the local entity, while a remote event is\n detected by the reception of an Ethernet OAM Event\n Notification OAMPDU that indicates a non-threshold crossing\n event.\n\n This notification should not be sent more than once per\n\n second.\n\n The OAM entity can be derived from extracting the ifIndex from\n the variable bindings. The objects in the notification\n correspond to the values in a row instance of the\n dot3OamEventLogTable.\n\n The management entity should periodically check\n dot3OamEventLogTable to detect any missed events.') dot3OamGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 158, 2, 1)) dot3OamCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 158, 2, 2)) dot3OamCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 158, 2, 2, 1)).setObjects(*(("DOT3-OAM-MIB", "dot3OamControlGroup"), ("DOT3-OAM-MIB", "dot3OamPeerGroup"), ("DOT3-OAM-MIB", "dot3OamStatsBaseGroup"), ("DOT3-OAM-MIB", "dot3OamLoopbackGroup"), ("DOT3-OAM-MIB", "dot3OamErrSymbolPeriodEventGroup"), ("DOT3-OAM-MIB", "dot3OamErrFramePeriodEventGroup"), ("DOT3-OAM-MIB", "dot3OamErrFrameEventGroup"), ("DOT3-OAM-MIB", "dot3OamErrFrameSecsSummaryEventGroup"), ("DOT3-OAM-MIB", "dot3OamFlagEventGroup"), ("DOT3-OAM-MIB", "dot3OamEventLogGroup"), ("DOT3-OAM-MIB", "dot3OamNotificationGroup"),)) if mibBuilder.loadTexts: dot3OamCompliance.setDescription('The compliance statement for managed entities\n supporting OAM on Ethernet-like interfaces.\n ') dot3OamControlGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 1)).setObjects(*(("DOT3-OAM-MIB", "dot3OamAdminState"), ("DOT3-OAM-MIB", "dot3OamOperStatus"), ("DOT3-OAM-MIB", "dot3OamMode"), ("DOT3-OAM-MIB", "dot3OamMaxOamPduSize"), ("DOT3-OAM-MIB", "dot3OamConfigRevision"), ("DOT3-OAM-MIB", "dot3OamFunctionsSupported"),)) if mibBuilder.loadTexts: dot3OamControlGroup.setDescription('A collection of objects providing the abilities,\n configuration, and status of an Ethernet OAM entity. ') dot3OamPeerGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 2)).setObjects(*(("DOT3-OAM-MIB", "dot3OamPeerMacAddress"), ("DOT3-OAM-MIB", "dot3OamPeerVendorOui"), ("DOT3-OAM-MIB", "dot3OamPeerVendorInfo"), ("DOT3-OAM-MIB", "dot3OamPeerMode"), ("DOT3-OAM-MIB", "dot3OamPeerFunctionsSupported"), ("DOT3-OAM-MIB", "dot3OamPeerMaxOamPduSize"), ("DOT3-OAM-MIB", "dot3OamPeerConfigRevision"),)) if mibBuilder.loadTexts: dot3OamPeerGroup.setDescription('A collection of objects providing the abilities,\n configuration, and status of a peer Ethernet OAM entity. ') dot3OamStatsBaseGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 3)).setObjects(*(("DOT3-OAM-MIB", "dot3OamInformationTx"), ("DOT3-OAM-MIB", "dot3OamInformationRx"), ("DOT3-OAM-MIB", "dot3OamUniqueEventNotificationTx"), ("DOT3-OAM-MIB", "dot3OamUniqueEventNotificationRx"), ("DOT3-OAM-MIB", "dot3OamDuplicateEventNotificationTx"), ("DOT3-OAM-MIB", "dot3OamDuplicateEventNotificationRx"), ("DOT3-OAM-MIB", "dot3OamLoopbackControlTx"), ("DOT3-OAM-MIB", "dot3OamLoopbackControlRx"), ("DOT3-OAM-MIB", "dot3OamVariableRequestTx"), ("DOT3-OAM-MIB", "dot3OamVariableRequestRx"), ("DOT3-OAM-MIB", "dot3OamVariableResponseTx"), ("DOT3-OAM-MIB", "dot3OamVariableResponseRx"), ("DOT3-OAM-MIB", "dot3OamOrgSpecificTx"), ("DOT3-OAM-MIB", "dot3OamOrgSpecificRx"), ("DOT3-OAM-MIB", "dot3OamUnsupportedCodesTx"), ("DOT3-OAM-MIB", "dot3OamUnsupportedCodesRx"), ("DOT3-OAM-MIB", "dot3OamFramesLostDueToOam"),)) if mibBuilder.loadTexts: dot3OamStatsBaseGroup.setDescription('A collection of objects providing the statistics for the\n number of various transmit and receive events for OAM on an\n Ethernet-like interface. Note that all of these counters must\n be supported even if the related function (as described in\n dot3OamFunctionsSupported) is not supported. ') dot3OamLoopbackGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 4)).setObjects(*(("DOT3-OAM-MIB", "dot3OamLoopbackStatus"), ("DOT3-OAM-MIB", "dot3OamLoopbackIgnoreRx"),)) if mibBuilder.loadTexts: dot3OamLoopbackGroup.setDescription('A collection of objects for controlling the OAM remote\n\n loopback function. ') dot3OamErrSymbolPeriodEventGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 5)).setObjects(*(("DOT3-OAM-MIB", "dot3OamErrSymPeriodWindowHi"), ("DOT3-OAM-MIB", "dot3OamErrSymPeriodWindowLo"), ("DOT3-OAM-MIB", "dot3OamErrSymPeriodThresholdHi"), ("DOT3-OAM-MIB", "dot3OamErrSymPeriodThresholdLo"), ("DOT3-OAM-MIB", "dot3OamErrSymPeriodEvNotifEnable"),)) if mibBuilder.loadTexts: dot3OamErrSymbolPeriodEventGroup.setDescription('A collection of objects for configuring the thresholds for an\n Errored Symbol Period Event.\n\n Each [802.3ah] defined Event Notification TLV has its own\n conformance group because each event can be implemented\n independently of any other. ') dot3OamErrFramePeriodEventGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 6)).setObjects(*(("DOT3-OAM-MIB", "dot3OamErrFramePeriodWindow"), ("DOT3-OAM-MIB", "dot3OamErrFramePeriodThreshold"), ("DOT3-OAM-MIB", "dot3OamErrFramePeriodEvNotifEnable"),)) if mibBuilder.loadTexts: dot3OamErrFramePeriodEventGroup.setDescription('A collection of objects for configuring the thresholds for an\n Errored Frame Period Event.\n\n Each [802.3ah] defined Event Notification TLV has its own\n conformance group because each event can be implemented\n independently of any other. ') dot3OamErrFrameEventGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 7)).setObjects(*(("DOT3-OAM-MIB", "dot3OamErrFrameWindow"), ("DOT3-OAM-MIB", "dot3OamErrFrameThreshold"), ("DOT3-OAM-MIB", "dot3OamErrFrameEvNotifEnable"),)) if mibBuilder.loadTexts: dot3OamErrFrameEventGroup.setDescription('A collection of objects for configuring the thresholds for an\n Errored Frame Event.\n\n Each [802.3ah] defined Event Notification TLV has its own\n conformance group because each event can be implemented\n independently of any other. ') dot3OamErrFrameSecsSummaryEventGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 8)).setObjects(*(("DOT3-OAM-MIB", "dot3OamErrFrameSecsSummaryWindow"), ("DOT3-OAM-MIB", "dot3OamErrFrameSecsSummaryThreshold"), ("DOT3-OAM-MIB", "dot3OamErrFrameSecsEvNotifEnable"),)) if mibBuilder.loadTexts: dot3OamErrFrameSecsSummaryEventGroup.setDescription('A collection of objects for configuring the thresholds for an\n Errored Frame Seconds Summary Event.\n\n Each [802.3ah] defined Event Notification TLV has its own\n conformance group because each event can be implemented\n independently of any other. ') dot3OamFlagEventGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 9)).setObjects(*(("DOT3-OAM-MIB", "dot3OamDyingGaspEnable"), ("DOT3-OAM-MIB", "dot3OamCriticalEventEnable"),)) if mibBuilder.loadTexts: dot3OamFlagEventGroup.setDescription('A collection of objects for configuring the sending OAMPDUs\n with the critical event flag or dying gasp flag enabled. ') dot3OamEventLogGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 10)).setObjects(*(("DOT3-OAM-MIB", "dot3OamEventLogTimestamp"), ("DOT3-OAM-MIB", "dot3OamEventLogOui"), ("DOT3-OAM-MIB", "dot3OamEventLogType"), ("DOT3-OAM-MIB", "dot3OamEventLogLocation"), ("DOT3-OAM-MIB", "dot3OamEventLogWindowHi"), ("DOT3-OAM-MIB", "dot3OamEventLogWindowLo"), ("DOT3-OAM-MIB", "dot3OamEventLogThresholdHi"), ("DOT3-OAM-MIB", "dot3OamEventLogThresholdLo"), ("DOT3-OAM-MIB", "dot3OamEventLogValue"), ("DOT3-OAM-MIB", "dot3OamEventLogRunningTotal"), ("DOT3-OAM-MIB", "dot3OamEventLogEventTotal"),)) if mibBuilder.loadTexts: dot3OamEventLogGroup.setDescription('A collection of objects for configuring the thresholds for an\n Errored Frame Seconds Summary Event and maintaining the event\n information. ') dot3OamNotificationGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 158, 2, 1, 11)).setObjects(*(("DOT3-OAM-MIB", "dot3OamThresholdEvent"), ("DOT3-OAM-MIB", "dot3OamNonThresholdEvent"),)) if mibBuilder.loadTexts: dot3OamNotificationGroup.setDescription('A collection of notifications used by Ethernet OAM to signal\n to a management entity that local or remote events have\n occurred on a specified Ethernet link. ') mibBuilder.exportSymbols("DOT3-OAM-MIB", dot3OamLoopbackControlTx=dot3OamLoopbackControlTx, dot3OamEventLogEventTotal=dot3OamEventLogEventTotal, dot3OamEventLogLocation=dot3OamEventLogLocation, dot3OamEventLogEntry=dot3OamEventLogEntry, dot3OamEventLogWindowHi=dot3OamEventLogWindowHi, dot3OamPeerVendorOui=dot3OamPeerVendorOui, dot3OamNonThresholdEvent=dot3OamNonThresholdEvent, dot3OamEventLogRunningTotal=dot3OamEventLogRunningTotal, dot3OamMaxOamPduSize=dot3OamMaxOamPduSize, dot3OamErrSymbolPeriodEventGroup=dot3OamErrSymbolPeriodEventGroup, dot3OamPeerGroup=dot3OamPeerGroup, dot3OamFlagEventGroup=dot3OamFlagEventGroup, dot3OamErrSymPeriodWindowLo=dot3OamErrSymPeriodWindowLo, dot3OamLoopbackEntry=dot3OamLoopbackEntry, dot3OamUniqueEventNotificationTx=dot3OamUniqueEventNotificationTx, dot3OamLoopbackTable=dot3OamLoopbackTable, dot3OamLoopbackGroup=dot3OamLoopbackGroup, dot3OamCompliances=dot3OamCompliances, dot3OamErrSymPeriodWindowHi=dot3OamErrSymPeriodWindowHi, dot3OamErrFramePeriodEventGroup=dot3OamErrFramePeriodEventGroup, dot3OamInformationTx=dot3OamInformationTx, dot3OamPeerMode=dot3OamPeerMode, dot3OamErrSymPeriodThresholdHi=dot3OamErrSymPeriodThresholdHi, dot3OamInformationRx=dot3OamInformationRx, dot3OamFramesLostDueToOam=dot3OamFramesLostDueToOam, dot3OamOrgSpecificRx=dot3OamOrgSpecificRx, dot3OamUniqueEventNotificationRx=dot3OamUniqueEventNotificationRx, dot3OamMode=dot3OamMode, dot3OamUnsupportedCodesRx=dot3OamUnsupportedCodesRx, dot3OamNotificationGroup=dot3OamNotificationGroup, dot3OamPeerVendorInfo=dot3OamPeerVendorInfo, dot3OamEventLogGroup=dot3OamEventLogGroup, dot3OamDuplicateEventNotificationRx=dot3OamDuplicateEventNotificationRx, dot3OamUnsupportedCodesTx=dot3OamUnsupportedCodesTx, dot3OamErrFrameEventGroup=dot3OamErrFrameEventGroup, dot3OamStatsEntry=dot3OamStatsEntry, dot3OamErrFrameSecsSummaryWindow=dot3OamErrFrameSecsSummaryWindow, dot3OamPeerTable=dot3OamPeerTable, dot3OamObjects=dot3OamObjects, dot3OamErrFramePeriodWindow=dot3OamErrFramePeriodWindow, dot3OamErrFrameWindow=dot3OamErrFrameWindow, dot3OamVariableResponseRx=dot3OamVariableResponseRx, dot3OamPeerMacAddress=dot3OamPeerMacAddress, dot3OamVariableRequestTx=dot3OamVariableRequestTx, dot3OamErrFrameThreshold=dot3OamErrFrameThreshold, dot3OamEventLogOui=dot3OamEventLogOui, dot3OamConformance=dot3OamConformance, dot3OamOperStatus=dot3OamOperStatus, dot3OamEventConfigEntry=dot3OamEventConfigEntry, dot3OamErrFrameEvNotifEnable=dot3OamErrFrameEvNotifEnable, dot3OamEventLogWindowLo=dot3OamEventLogWindowLo, dot3OamVariableResponseTx=dot3OamVariableResponseTx, dot3OamTable=dot3OamTable, dot3OamErrFramePeriodEvNotifEnable=dot3OamErrFramePeriodEvNotifEnable, dot3OamEventLogThresholdHi=dot3OamEventLogThresholdHi, dot3OamCompliance=dot3OamCompliance, dot3OamOrgSpecificTx=dot3OamOrgSpecificTx, EightOTwoOui=EightOTwoOui, dot3OamEventLogTimestamp=dot3OamEventLogTimestamp, dot3OamErrSymPeriodEvNotifEnable=dot3OamErrSymPeriodEvNotifEnable, dot3OamErrFrameSecsSummaryEventGroup=dot3OamErrFrameSecsSummaryEventGroup, dot3OamPeerMaxOamPduSize=dot3OamPeerMaxOamPduSize, dot3OamPeerFunctionsSupported=dot3OamPeerFunctionsSupported, dot3OamEventLogType=dot3OamEventLogType, dot3OamStatsBaseGroup=dot3OamStatsBaseGroup, dot3OamLoopbackControlRx=dot3OamLoopbackControlRx, dot3OamPeerEntry=dot3OamPeerEntry, dot3OamCriticalEventEnable=dot3OamCriticalEventEnable, dot3OamErrFrameSecsSummaryThreshold=dot3OamErrFrameSecsSummaryThreshold, dot3OamLoopbackIgnoreRx=dot3OamLoopbackIgnoreRx, dot3OamGroups=dot3OamGroups, dot3OamLoopbackStatus=dot3OamLoopbackStatus, dot3OamConfigRevision=dot3OamConfigRevision, dot3OamEventLogThresholdLo=dot3OamEventLogThresholdLo, dot3OamErrFrameSecsEvNotifEnable=dot3OamErrFrameSecsEvNotifEnable, PYSNMP_MODULE_ID=dot3OamMIB, dot3OamDyingGaspEnable=dot3OamDyingGaspEnable, dot3OamNotifications=dot3OamNotifications, dot3OamPeerConfigRevision=dot3OamPeerConfigRevision, dot3OamEventLogValue=dot3OamEventLogValue, dot3OamEventLogTable=dot3OamEventLogTable, dot3OamThresholdEvent=dot3OamThresholdEvent, dot3OamFunctionsSupported=dot3OamFunctionsSupported, dot3OamVariableRequestRx=dot3OamVariableRequestRx, dot3OamEventConfigTable=dot3OamEventConfigTable, dot3OamDuplicateEventNotificationTx=dot3OamDuplicateEventNotificationTx, dot3OamErrSymPeriodThresholdLo=dot3OamErrSymPeriodThresholdLo, dot3OamControlGroup=dot3OamControlGroup, dot3OamEntry=dot3OamEntry, dot3OamStatsTable=dot3OamStatsTable, dot3OamMIB=dot3OamMIB, dot3OamAdminState=dot3OamAdminState, dot3OamEventLogIndex=dot3OamEventLogIndex, dot3OamErrFramePeriodThreshold=dot3OamErrFramePeriodThreshold)
# base class FyException(Exception): def __init__(s, message): s.message = '\n;;;;;\n' s.message += s.__class__.__name__.replace('_', ' ') s.message += '\n' s.message += str(message) def __str__(s): return s.message # exception class a_function_cannot_be_dotted(FyException): pass class cannot_indent_on_first_line(FyException): pass class cannot_find_attribute_in_class(FyException): pass class cannot_find_attribute_setter_in_class(FyException): pass class cannot_find_targetted_ast(FyException): pass class cannot_mix_args_and_kwargs(FyException): pass class cannot_overwrite_spec(FyException): pass class cannot_resolve_modifier(FyException): pass class cannot_set_reference_with_a_property_setter(FyException): pass class cannot_find_class_definition_in_module(FyException): pass class compilation_error(FyException): pass class else_without_if_elif_where_or_elwhere(FyException): pass class error_in_interpolant(FyException): pass class fortran_file_not_found(FyException): pass class guid_override_error(FyException): pass class indentation_increased_by_more_than_one_level(FyException): pass class indentation_without_colon(FyException): pass class inconsistent_mro(FyException): pass class intrinsic_type_cannot_be_dotted(FyException): pass class invalid_url(FyException): pass class left_element_in_aliased_import_is_not_an_url(FyException): pass class interpretation_error(FyException): pass class lexical_interpolation_is_only_on_routine_or_class(FyException): pass class linking_error(FyException): pass class mark_newlinex_lexing_error(FyException): pass class mixed_indentation(FyException): pass class nb_of_arguments_mismatch(FyException): pass class no_element_specified_in_slice_import(FyException): pass class no_fortran_compiler_found(FyException): pass class only_aliased_namespace_star_or_slice_import_are_allowed(FyException): pass class only_attribute_or_method_can_be_inherited(FyException): pass class only_star_import_allowed_for_shared_library(FyException): pass class only_star_or_slice_import_allowed_for_fortran(FyException): pass class python_import_error(FyException): pass class space_tab_mixed(FyException): pass class syntax_error(FyException): pass class unbalanced_parenthesis(FyException): pass class fml_error(FyException): pass class module_not_found(FyException): pass class name_not_found_in_fython_module(FyException): pass class package_not_found(FyException): pass class resolution_error(FyException): pass class string_format_error(FyException): pass class unknown_identifier(FyException): pass class unknown_print_mode(FyException): pass
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. load("//antlir/bzl:shape.bzl", "shape") load("//antlir/bzl:target_helpers.bzl", "antlir_dep") load("//antlir/bzl:target_tagger.bzl", "new_target_tagger", "target_tagger_to_feature") load(":symlink.shape.bzl", "symlink_t") def _build_symlink_feature(link_target, link_name, symlinks_to_arg): symlink_spec = shape.new( symlink_t, dest = link_name, source = link_target, ) return target_tagger_to_feature( new_target_tagger(), items = struct(**{symlinks_to_arg: [symlink_spec]}), # The `fake_macro_library` docblock explains this self-dependency extra_deps = [antlir_dep("bzl/image/feature:symlink")], ) def feature_ensure_dir_symlink(link_target, link_name): """ The operation follows rsync convention for a destination (`link_name`): `ends/in/slash/` means "write into this directory", `does/not/end/with/slash` means "write with the specified filename": - `feature.ensure_dir_symlink("/d", "/e/")` symlinks directory `/d` to `/e/d` - `feature.ensure_dir_symlink("/a", "/b/c")` symlinks directory `/a` to `/b/c` Both arguments are mandatory: - `link_target` is the image-absolute source file/dir of the symlink. This file must exist as we do not support dangling symlinks. IMPORTANT: The emitted symlink will be **relative** by default, enabling easier inspection if images via `buck-image-out`. If this is a problem for you, we can add an `absolute` boolean kwarg. - `link_name` is an image-absolute path. A trailing / is significant. A `link_name` that does NOT end in / is a full path in the new image, ending with a filename for the new symlink. As with `image.clone`, a traling / means that `link_name` must be a pre-existing directory in the image (e.g. created via `image.ensure_dirs_exist`), and the actual link will be placed at `link_name/(basename of link_target)`. This item is indempotent: it is a no-op if a symlink already exists that matches the spec. """ return _build_symlink_feature(link_target, link_name, "symlinks_to_dirs") def feature_ensure_file_symlink(link_target, link_name): """ The operation follows rsync convention for a destination (`link_name`): `ends/in/slash/` means "write into this directory", `does/not/end/with/slash` means "write with the specified filename": - `feature.ensure_file_symlink("/d", "/e/")` symlinks file `/d` to `/e/d` - `feature.ensure_file_symlink("/a", "/b/c")` symlinks file `/a` to `/b/c` Both arguments are mandatory: - `link_target` is the image-absolute source file/dir of the symlink. This file must exist as we do not support dangling symlinks. IMPORTANT: The emitted symlink will be **relative** by default, enabling easier inspection if images via `buck-image-out`. If this is a problem for you, we can add an `absolute` boolean kwarg. - `link_name` is an image-absolute path. A trailing / is significant. A `link_name` that does NOT end in / is a full path in the new image, ending with a filename for the new symlink. As with `image.clone`, a traling / means that `link_name` must be a pre-existing directory in the image (e.g. created via `image.ensure_dirs_exist`), and the actual link will be placed at `link_name/(basename of link_target)`. This item is indempotent: it is a no-op if a symlink already exists that matches the spec. """ return _build_symlink_feature(link_target, link_name, "symlinks_to_files")
# Palanquin (9110107) | Outside Ninja Castle (800040000) mushroomShrine = 800000000 response = sm.sendAskYesNo("Would you like to go to #m" + str(mushroomShrine) + "m#?") if response: sm.warp(mushroomShrine)
f = open("./three.txt", "r") lines = [x.strip() for x in f.readlines()] gamma = "" for index in range(len(lines[0])): bits = [line[index] for line in lines] zeros = list(bits).count('0') ones = list(bits).count('1') if zeros > ones: gamma += "0" else: gamma += "1" epsilon = "" for index in range(len(lines[0])): bits = [line[index] for line in lines] zeros = list(bits).count('0') ones = list(bits).count('1') if zeros < ones: epsilon += "0" else: epsilon += "1" print("Star 1", int(epsilon, 2) * int(gamma, 2)) oxygen_valid = list(lines) index = 0 while len(oxygen_valid) > 1: bits = [line[index] for line in oxygen_valid] zeros = list(bits).count('0') ones = list(bits).count('1') if zeros > ones: oxygen_valid = [line for line in oxygen_valid if line[index] == "0"] else: oxygen_valid = [line for line in oxygen_valid if line[index] == "1"] index += 1 co = list(lines) index = 0 while len(co) > 1: bits = [line[index] for line in co] zeros = list(bits).count('0') ones = list(bits).count('1') if zeros <= ones: co = [line for line in co if line[index] == "0"] else: co = [line for line in co if line[index] == "1"] index += 1 print("Star 2", int(oxygen_valid[0], 2) * int(co[0], 2))
#!/usr/bin/python # # Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # IN = None INOUT = None FILE_IN = None FILE_OUT = None FILE_INOUT = None COLLECTION_IN = None COLLECTION_INOUT = None COLLECTION_OUT = None # Aliases for parameter definition as dictionary Type = 'type' # parameter type Direction = 'direction' # parameter type StdIOStream = 'stream' # parameter stream Prefix = 'prefix' # parameter prefix Depth = 'depth' # collection recursive depth block_count = 'block_count' block_length = 'block_length' stride = 'stride'
""" Test group in a different order .. pii: Group 1 - Annotation 1 .. pii_retirement: local_api, consumer_api .. pii_types: id, name """
def bin_search_lower(a, x): l, r = -1, len(a) while l + 1 < r: m = (l + r) // 2 if a[m] <= x: l = m else: r = m return l n, k = map(int, input().split()) array = list(map(int, input().split())) for x in map(int, input().split()): print(bin_search_lower(array, x) + 1)
class State: def __init__(self, client) -> None: self.client = client def get_input_command(self): return input(f"JogoDaVelha> ").strip().split() or [""] def handle_input_command(self, *input_command): pass def handle_opponent_command(self, *command): pass def handle_new_connection_command(self, *command): pass def _handle_skip(self): pass def _handle_default(self, *args): print("Invalid command!") def _handle_exit(self): self.client.stop()
#!/usr/bin/env python # -*- coding: utf-8 -*- spinMultiplicity = 2 energy = { 'CCSD(T)-F12/cc-pVTZ-F12': MolproLog('TSN09_f12.out'), } frequencies = GaussianLog('ts3-freq.log') rotors = [HinderedRotor(scanLog=ScanLog('scan_0.log'), pivots=[4,10], top=[10,11,12,13,14], symmetry=1, fit='best'), HinderedRotor(scanLog=ScanLog('scan_1.log'), pivots=[10,13], top=[13,14], symmetry=1, fit='best'), HinderedRotor(scanLog=ScanLog('scan_2.log'), pivots=[4,6], top=[6,7,8,9], symmetry=3, fit='best'),]
""" Featurizers will always output arrays but they will use structure-oriented methods underneath to do it. """
a, b = map(int, input().split()) a = str(a) b = str(b) count = 0 c = int(a) d = int(b) for i in range(c, d + 1): i = str(i) if i[0] == i[4] and i[1] == i[3]: count += 1 print(count)
#!/usr/local/bin/python # coding: utf-8 VERSION = '2.1.1' # 0: CRITICAL, 1: INFO, 2: DEBUG VERBOSE_LEVEL = 1 # 0: CONSOLE, 1: FILE, 2: CONSOLE & FILE LOG_TYPE = 0 LOG_DIR = 'output' HTML = False DEBUG = True
class Human: def __init__(self, name, age): self.name = name self.age = age def greeting(self): print(f"Hello {self.name}!") def get_name(self): return self.name def get_age(self): return self.age def set_age(self, age): self.age = age h = Human("Andrei", 31) h.greeting() print(h.get_name()) h.set_age(48) print(h.get_age())
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: num_len = len(nums) prefix_products, postfix_products = [1] * (num_len + 1), [1] * (num_len + 1) prefix_product, postfix_product = 1, 1 for prefix_index in range(num_len): prefix_product *= nums[prefix_index] prefix_products[prefix_index+1] = prefix_product postfix_index = num_len - 1 - prefix_index postfix_product *= nums[postfix_index] postfix_products[postfix_index] = postfix_product infix_products = [] for index in range(num_len): infix_products.append(prefix_products[index] * postfix_products[index+1]) return infix_products
CREATE_GAME = 'game_create' JOIN_GAME = 'game_join' LEAVE_GAME = 'game_abort' SET_NICK = 'nickname_set' INIT_BOARD = 'board_init' FIRE = 'attack' NUKE = 'special_attack' MOVE = 'move' SURRENDER = 'surrender' CHAT_SEND = 'chat_send'
# -*- coding: utf-8 -*- class Stack(object): """ Implements a simple stack data structure. Attrs: top: object, a pointer to the top object in the stack. count: int, a counter of the number of elements in the stack. """ def __init__(self): self.top = None self.count = 0 def __len__(self): return self.count def is_empty(self): return self.count == 0 def pop(self): """ Returns the value at the top of the stack. """ if self.top == None: return None value = self.top['value'] self.top = self.top['prev'] self.count -= 1 return value def push(self, value): """ Adds a new value on top of the stack. """ node = {'value': value, 'prev': None} if self.top == None: self.top = node else: node['prev'] = self.top self.top = node self.count += 1 def peek(self): """ Returns the value of the top element in the stack without removing it from the data structure. """ if self.top == None: return None return self.top['value']
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: if not l1: return l2 if not l2: return l1 res = ListNode(-1) if l1.val<l2.val: res.val = l1.val res.next = self.mergeTwoLists(l1.next,l2) else: res.val = l2.val res.next = self.mergeTwoLists(l1,l2.next) return res
# Depth-first Search # Given an integer array, your task is to find all the different possible increasing subsequences of the given array, and the length of an increasing subsequence should be at least 2 . # # Example: # Input: [4, 6, 7, 7] # Output: [[4, 6], [4, 7], [4, 6, 7], [4, 6, 7, 7], [6, 7], [6, 7, 7], [7,7], [4,7,7]] # Note: # The length of the given array will not exceed 15. # The range of integer in the given array is [-100,100]. # The given array may contain duplicates, and two equal integers should also be considered as a special case of increasing sequence. class Solution: def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ res = [] self.subsets(nums, 0, [], res) return res def subsets(self, nums, index, temp, res): if len(nums) >= index and len(temp) >= 2: res.append(temp[:]) used = {} for i in range(index, len(nums)): if len(temp) > 0 and temp[-1] > nums[i]: continue if nums[i] in used: continue used[nums[i]] = True temp.append(nums[i]) self.subsets(nums, i+1, temp, res) temp.pop()
odds = {1, 3, 5, 7} evens = set([0, 2, 4, 6, 8]) print(odds.union(evens)) odds.intersection() odds.difference()
def f1(): print(11) yield print(22) yield print(33) def f2(): print(55) yield print(66) yield print(77) v1 = f1() v2 = f2() next(v1) # v1.send(None) next(v2) # v1.send(None) next(v1) # v1.send(None) next(v2) # v1.send(None) next(v1) # v1.send(None) next(v2) # v1.send(None)
## Gerenators def mygenerator(x): for i in range(x): yield i values = mygenerator(100) for i in values: print(i) print(next(mygenerator))
__author__ = 'yinjun' #@see http://www.jiuzhang.com/solutions/longest-common-subsequence/ class Solution: """ @param A, B: Two strings. @return: The length of longest common subsequence of A and B. """ def longestCommonSubsequence(self, A, B): # write your code here x = len(A) y = len(B) dp = [[0 for j in range(y+1)] for i in range(x+1)] for i in range(1, x+1): for j in range(1, y+1): if A[i-1] == B[j-1]: dp[i][j] = dp[i-1][j-1] + 1 else: dp[i][j] = max(dp[i-1][j], dp[i][j-1]) return dp[x][y]
class Node: def __init__(self, key): self.key = key self.child = [] def newNode(key): temp = Node(key) return temp def LevelOrderTraversal(root): if (root == None): return; # Standard level order traversal code # using queue q = [] # Create a queue q.append(root); # Enqueue root while (len(q) != 0): n = len(q); # If this node has children while (n > 0): # Dequeue an item from queue and print it p = q[0] q.pop(0); print(p.key, end='->') if len(p.child) > 0: for e in p.child: print(e.key.get("name"), end=",") print() # Enqueue all children of the dequeued item for i in range(len(p.child)): q.append(p.child[i]); n -= 1 print() # Print new line between two levels def add_node(root, index, value): if (root == None): return; # Standard level order traversal code # using queue q = [] # Create a queue q.append(root); # Enqueue root while (len(q) != 0): n = len(q); # If this node has children while (n > 0): p = q[0] q.pop(0); tmp_key = {'id': p.key['id'], 'name': p.key['name']} if tmp_key == index: tmp_value = {'id': value['id'], 'name': value['name']} if len(list(filter(lambda e: {'id': e.key['id'], 'name': e.key['name']} == tmp_value, p.child))) == 0: p.child.append(newNode(value)) # Enqueue all children of the dequeued item for i in range(len(p.child)): q.append(p.child[i]); n -= 1 def get_direct_sub_node(root, index): if root is None: return # Standard level order traversal code # using queue q = [] # Create a queue q.append(root) # Enqueue root while len(q) != 0: n = len(q) # If this node has children while n > 0: p = q[0] q.pop(0) if index['id']: # if id != None if index['id'] == p.key['id']: return p.key, p.child else: tmp_key = {"id": p.key["id"], "name": p.key["name"]} if tmp_key == index: return p.key, p.child # Enqueue all children of the dequeued item for i in range(len(p.child)): q.append(p.child[i]) n -= 1 return None def find_node_by_canonicalPath(root, path): if root is None: return q = [] # Create a queue q.append(root) # Enqueue root while len(q) != 0: n = len(q) # If this node has children while n > 0: p = q[0] q.pop(0) if p.key.get("canonicalPath") == path: return p # Enqueue all children of the dequeued item for i in range(len(p.child)): q.append(p.child[i]) n -= 1 return None
'''Задача - 1 Вам необходимо создать завод по производству мягких игрушек для детей. Вам надо продумать структуру классов, чтобы у вас был класс, который создаёт игрушки на основании: Названия, Цвета, Типа (животное, персонаж мультфильма) Опишите процедуры создания игрушки в трёх методах: -- Закупка сырья, пошив, окраска Не усложняйте пусть методы просто выводят текст о том, что делают. В итоге ваш класс по производству игрушек должен вернуть объект нового класса Игрушка.''' class Toys: def __init__(self, name, model, color): self.name = name self.model = model self.color = color self._purchase_materials() self._sewing() self._painting() def _purchase_materials(self): print(f'Закупка сырья для {self.name}') def _sewing(self): print(f'Пошив {self.name}') def _painting(self): print(f'Окраска {self.name} в {self.color}') class Factory(Toys): def __init__(self, name, model, color): super().__init__(name, model, color) self.name_factory = 'some factory' self.number_factory = '123123' toy1 = Factory('toy', 'animal', 'green')
def add_up(nums): return sum(nums) def test_answer(): assert add_up([1,2,2]) == 5
print('\033[1:33m = \033[m'*20) velocidade = float(input('Qual foi a velocidade atingida pelo seu carro? ')) print('\033[1:33m - \033[m'*20) multa = ( (velocidade - 80) * 7) if velocidade<= 80: print('Parabéns vc não ultrapassou o limite de velocidade.') else: print('\033[:31mVocê ultrapassou o limite de 80km/h irá receber uma multa de \033[1:33m{:.2f}€.'.format(multa))
#!/usr/bin/python3 def read_file(filename=""): '''open a given file''' with open(filename, 'r') as f: print("{}".format(f.read()), end="")
class Node: def __init__(self, x, y): self.g = 0 self.h = 0 self.f = 0 self.parent = None self.cost = 1 self.x = x self.y = y self.left_child = None self.right_child = None self.top_child = None self.down_child = None def update_h(self, goal): self.h = abs(self.x - goal.x) + abs(self.y - goal.y) self.f = self.h + self.g def update_hnew(self, goalC): self.h = goalC - self.g self.f = self.h + self.g def update_g(self, new_g): self.g = new_g self.f = new_g + self.h def update_f(self, new_f): self.f = new_f def print(self): print("(", self.x, ", ", self.y, ")") def traverse_children(self, i): if i == 0: return self.right_child if i == 1: return self.left_child if i == 2: return self.top_child return self.down_child
def clever_format(num, format="%.2f"): if num > 1e12: return format % (num / 1e12) + "T" if num > 1e9: return format % (num / 1e9) + "G" if num > 1e6: return format % (num / 1e6) + "M" if num > 1e3: return format % (num / 1e3) + "K"
## PACKAGE THIS FUNCTION INTO MAVENN def split_dataset(data_df, set_col='set', train_set_name='training', val_set_name='validation', test_set_name='test'): """ Splits dataset into (1) `trainval_df`: training + validation set (2) `train_df`: test set based on the value of the column `set_col`, which is then dropped. Also adds a `val_set_name` column to trainval_df indicating which data is to be reserved for validation (as opposed to gradient descent). Parameters ---------- data_df: (pd.DataFrame) Dataset to split set_col: (str) Column of data_df indicating training, validation, or test set train_set_name: (str) Value in data_df[set_col] indicating allocation to training set val_set_name: (str) Value in data_df[set_col] indicating allocation to validation set test_set_name: (str) Value in data_df[set_col] indicating allocation to test set Returns ------- trainval_df: (pd.DataFrame) Training + validation dataset. Contains a column named `val_set_name` indicating whether a row is allocated to the training or validation set. test_df: (pd.DataFrame) Test dataset. """ # Specify training + validation sets trainval_ix = data_df[set_col].isin([train_set_name, val_set_name]) trainval_df = data_df[trainval_ix].copy().reset_index(drop=True) trainval_df.insert(loc=0, column=val_set_name, value=trainval_df[set_col].eq(val_set_name)) trainval_df.drop(columns=set_col, inplace=True) # Specify test set test_ix = data_df[set_col].eq(test_set_name) test_df = data_df[test_ix].copy().reset_index(drop=True) test_df.drop(columns=set_col, inplace=True) # return return trainval_df, test_df
n,k=map(int,input().split()) x=sorted(list(map(int,input().split()))) a=[] for i in range(n-k+1): l=x[i] r=x[i+k-1] a.append(min(abs(l)+abs(r-l),abs(r)+abs(l-r))) print(min(a))
class Cell: def __init__(self, alive = False): self.currentState = alive self.futureState = alive def updateState(self, state): self.futureState = state def refresh(self): self.currentState = self.futureState def isAlive(self): return self.currentState def __str__(self): return "O" if self.currentState else "."
str1 = input() str2 = input() a = [0 for i in range(0,27)] for i in str1: a[ord(i)-ord('a')] += 1 for i in str2: a[ord(i)-ord('a')] -= 1 ans = 0 for i in a: if ( i < 0 ): ans += -i else: ans += i print(ans)
class GameInfo(object): """ holds player information for the current game """ def __init__(self, team_name, match_token, team_password, client_token = ''): self.client_token = client_token self.team_name = team_name self.match_token = match_token self.team_password = team_password
looged_user = False # if looged_user: # msg = 'Usuário logado.' # else: # msg = 'Usuário não está logado.' msg = 'Usuário logado' if looged_user else 'Usuário não está logado.' print(msg)
############################################################################# # # # RGB/A Colour webGenFramework module to BFA c7 # # ############################################################################# """ This is a rgb/a colour module for bfa colours. Dependencies: None note:: Author(s): Mitch last-check: 07.07.2021 """ # noinspection PyUnusedLocal def __preload__(forClient: bool = True): pass # noinspection PyUnusedLocal def __postload__(forClient: bool = True): pass class Colour: """ Base class for representing any colour. :param name: Name of this colour. note:: Author(s): Mitch """ def __init__(self, name): self.name = name def toCSS(self): """ To be overridden. """ pass class RGB_Colour(Colour): """ Represents a colour in rgb encoding. :param name: Name of this colour. :param red: Red value of this colour. :param green: Green value of this colour. :param blue: Blue value of this colour. note:: Author(s): Mitch """ def __init__(self, name: str, red: int, green: int, blue: int): super().__init__(name) self.red = red self.green = green self.blue = blue def toCSS(self): """ Converts the colour to a CSS readable string. :return: CSS string. note:: Author(s): Mitch """ return "rgb(" + ",".join([str(self.red), str(self.green), str(self.blue)]) + ")" @classmethod def fromHex(cls, name: str, hexString: str): """ Alternative constructor to instantiate a colour via its hex-string definition. :param name: Name of the colour :param hexString: The hex-string containing the rgb values of the colour. :return: The rgb colour corresponding to the hex-string. note:: Author(s): Mitch """ return cls(name, int(hexString[:2], 16), int(hexString[2:4], 16), int(hexString[4:], 16)) class RGBA_Colour(RGB_Colour): """ Represents a colour in rgba encoding. :param name: Name of this colour. :param alpha: Alpha(opacity) value of this colour. note:: Author(s): Mitch """ def __init__(self, name: str, red: int, green: int, blue: int, alpha: float): super().__init__(name, red, green, blue) self.alpha = alpha def toCSS(self): """ Converts the colour to a CSS readable string. :return: CSS string. note:: Author(s): Mitch """ return "rgba(" + ",".join([str(self.red), str(self.green), str(self.blue), str("%.2f" % self.alpha)]) + ")" def toRGB(self): """ Converts the RGBA colour to an RGB colour. :return: RGB colour disregarding the alpha value. note:: Author(s): Mitch """ return RGB_Colour(self.name, self.red, self.green, self.blue) def createVariant(self, variation: str): """ Creates a variant of this colour. :param variation: The type of variation that's desired. :return: RGBA colour variation if applicable, otherwise None. note:: Author(s): Mitch """ if variation == 'faint': if self.alpha > 0.21: return RGBA_Colour(variation + self.name, self.red, self.green, self.blue, self.alpha-0.21) elif variation == 'fainter': if self.alpha > 0.8: return RGBA_Colour(variation + self.name, self.red, self.green, self.blue, self.alpha-0.8) return None
def serializeCgiToServer(coors): #coors is a n by 2 2D array of doubles string = "" for i in range(0, len(coors)): string += str(coors[i][0]) + "," + str(coors[i][1]) # add comma between x and y coor string += ";" # add semicolon to seperate coors string += "\n" #ending character return string.encode('utf-8') def deserializeCgiToServer(string): string = string.decode('utf-8') splitted = string.split(";") coors = [None]*(len(splitted)-1) # create list: [None, None, None,...] with length len(splitted)-1 for i in range(0,len(splitted)-1): coors[i] = splitted[i].split(",") coors[i] = [float(x) for x in coors[i]] # convert to float return coors def serializeServerToCgi(distanceMatrix): # distanceMatrix is matrix of doubles string = "" for i in range(0, len(distanceMatrix)): for j in range(0, len(distanceMatrix[i])): string += str(distanceMatrix[i][j]) + "," # seperate distances with comma string += ";" # seperate rows with semicolon string += "\n" # ending character return string.encode('utf-8') def deserializeServerToCgi(string): string = string.decode('utf-8') splitted = string.split(";") distanceMatrix = [None]*(len(splitted)-1) for i in range(0,len(splitted)-1): row = splitted[i].split(",") distanceMatrix[i] = row[0:len(row)-1] distanceMatrix[i] = [float(x) for x in distanceMatrix[i]] # convert to float return distanceMatrix def testFunctions(): string = serializeCgiToServer([[1,2]]) coors = deserializeCgiToServer(string) print(coors) string = serializeServerToCgi([[10,6,5]]) distanceMatrix = deserializeServerToCgi(string) print(distanceMatrix) #if __name__ == '__main__': # testFunctions()
# # PySNMP MIB module CISCOSB-SENSORENTMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-SENSORENTMIB # Produced by pysmi-0.3.4 at Wed May 1 12:23:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint") rlEnv, = mibBuilder.importSymbols("CISCOSB-HWENVIROMENT", "rlEnv") entityPhysicalGroup, entPhysicalIndex = mibBuilder.importSymbols("ENTITY-MIB", "entityPhysicalGroup", "entPhysicalIndex") EntitySensorValue, entPhySensorEntry = mibBuilder.importSymbols("ENTITY-SENSOR-MIB", "EntitySensorValue", "entPhySensorEntry") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") TimeTicks, ModuleIdentity, Unsigned32, Gauge32, mib_2, NotificationType, ObjectIdentity, IpAddress, Counter64, Bits, Integer32, Counter32, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ModuleIdentity", "Unsigned32", "Gauge32", "mib-2", "NotificationType", "ObjectIdentity", "IpAddress", "Counter64", "Bits", "Integer32", "Counter32", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier") DisplayString, TimeStamp, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TimeStamp", "TextualConvention") rlSensor = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 4)) rlSensor.setRevisions(('2003-09-21 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: rlSensor.setRevisionsDescriptions(('ADDED this MODULE-IDENTITY clause.',)) if mibBuilder.loadTexts: rlSensor.setLastUpdated('200309210000Z') if mibBuilder.loadTexts: rlSensor.setOrganization('Cisco Small Business') if mibBuilder.loadTexts: rlSensor.setContactInfo('Postal: 170 West Tasman Drive San Jose , CA 95134-1706 USA Website: Cisco Small Business Home http://www.cisco.com/smb>;, Cisco Small Business Support Community <http://www.cisco.com/go/smallbizsupport>') if mibBuilder.loadTexts: rlSensor.setDescription('The private MIB module definition for sensors in Cisco devices.') rlEntPhySensorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 3), ) if mibBuilder.loadTexts: rlEntPhySensorTable.setStatus('current') if mibBuilder.loadTexts: rlEntPhySensorTable.setDescription('The addition to the table of sensors maintained by the environmental monitor.') rlEntPhySensorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 3, 1), ) entPhySensorEntry.registerAugmentions(("CISCOSB-SENSORENTMIB", "rlEntPhySensorEntry")) rlEntPhySensorEntry.setIndexNames(*entPhySensorEntry.getIndexNames()) if mibBuilder.loadTexts: rlEntPhySensorEntry.setStatus('current') if mibBuilder.loadTexts: rlEntPhySensorEntry.setDescription('An additon to the entry in the sensor table, representing the maximum/minimum values for the sensor associated.') rlEnvPhySensorMinValue = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 3, 1, 1), EntitySensorValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlEnvPhySensorMinValue.setStatus('current') if mibBuilder.loadTexts: rlEnvPhySensorMinValue.setDescription('Minimum value for the Sensor being instrumented.') rlEnvPhySensorMaxValue = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 3, 1, 2), EntitySensorValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlEnvPhySensorMaxValue.setStatus('current') if mibBuilder.loadTexts: rlEnvPhySensorMaxValue.setDescription('Maximum value for the Sensor being instrumented.') rlEnvPhySensorTestValue = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 83, 3, 1, 3), EntitySensorValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlEnvPhySensorTestValue.setStatus('current') if mibBuilder.loadTexts: rlEnvPhySensorTestValue.setDescription('Test/reference value for the Sensor being instrumented.') mibBuilder.exportSymbols("CISCOSB-SENSORENTMIB", rlEntPhySensorEntry=rlEntPhySensorEntry, rlSensor=rlSensor, rlEnvPhySensorMaxValue=rlEnvPhySensorMaxValue, rlEnvPhySensorTestValue=rlEnvPhySensorTestValue, PYSNMP_MODULE_ID=rlSensor, rlEntPhySensorTable=rlEntPhySensorTable, rlEnvPhySensorMinValue=rlEnvPhySensorMinValue)
def load_assets(): assets = {} # background do jogo assets['background'] = pygame.image.load(r'img\spacebg.jpg').convert() assets['background']= pygame.transform.scale(assets['background'],(largura,altura)) # tela inicial assets['tela_init'] = pygame.image.load(r'img\screen_start1.png').convert() assets['tela_init']= pygame.transform.scale(assets['tela_init'],(largura,altura)) # tela do gameover assets['tela_fin'] = pygame.image.load(r'img\screen_gameover1.png').convert() assets['tela_fin']= pygame.transform.scale(assets['tela_fin'],(largura,altura)) # tela de vitória assets['tela_fin2'] = pygame.image.load(r'img\screen_final1.png').convert() assets['tela_fin2']= pygame.transform.scale(assets['tela_fin2'],(largura,altura)) # imagem do ufo assets['image_aviao'] = pygame.image.load(r'img\ufo2.png').convert_alpha() assets['image_aviao'] = pygame.transform.scale(assets['image_aviao'],(largura_aviao,altura_aviao)) # imagem da nave 1 do jogador assets['image_nave'] = pygame.image.load(r'img\ITS1.png').convert_alpha() assets['image_nave'] = pygame.transform.scale(assets['image_nave'],(largura_nave,altura_nave)) # imagem da nave 2 do jogador assets['image_nave2'] = pygame.image.load(r'img\ITS2.png').convert_alpha() assets['image_nave2'] = pygame.transform.scale(assets['image_nave2'],(largura_nave,altura_nave2)) anim_explosao_av = [] anim_explosao_nav = [] for i in range(9): # arquivos da animacao animacao = 'regularExplosion0{}.png'.format(i) img = pygame.image.load(animacao).convert() img = pygame.transform.scale(img, (72, 72)) anim_explosao_av.append(img) assets["anim_explosao_av"] = anim_explosao_av for i in range(9): # arquivos da animacao animacao = 'regularExplosion0{}.png'.format(i) img = pygame.image.load(animacao).convert() img = pygame.transform.scale(img, (150, 150)) anim_explosao_nav.append(img) assets["anim_explosao_nav"] = anim_explosao_nav # carrega os sons do jogo pygame.mixer.music.load(r'som\music.mp3') pygame.mixer.music.load(r'som\musicgame.mp3') pygame.mixer.music.load(r'som\endmusic.mp3') pygame.mixer.music.set_volume(0.2) assets['explosao'] = pygame.mixer.Sound(r'som\explosao.mp3') return assets
count = 0 fields = ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"] hex_not = "1234567890abcdef" ecls = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"] def check_pprt(pprt): global count flag = True i = 0 while flag and i < len(fields): flag = flag and fields[i] in pprt i = i + 1 if flag: try: byr = int(pprt["byr"]) flag = flag and (byr >= 1920 and byr <= 2002) iyr = int(pprt["iyr"]) flag = flag and (iyr >= 2010 and iyr <= 2020) eyr = int(pprt["eyr"]) flag = flag and (eyr >= 2020 and eyr <= 2030) hgt = int(pprt["hgt"][:-2]) is_cm = pprt["hgt"][-2:] == "cm" lwr = 150 if is_cm else 59 upr = 193 if is_cm else 76 flag = flag and (hgt >= lwr and hgt <= upr) flag = flag and pprt["hcl"][0] == "#" for ch in pprt["hcl"][1:]: flag = flag and ch in hex_not flag = flag and pprt["ecl"] in ecls flag = flag and len(pprt["pid"]) == 9 except: flag = False count = count + flag pprt = dict() while True: try: ln = input() if not ln.strip(): check_pprt(pprt) pprt = dict() continue data = ln.split(" ") for d in data: d_spl = d.split(":") pprt[d_spl[0]] = d_spl[1] except EOFError: check_pprt(pprt) break print(count)
#OPERATOR PENUGASAN #input mengisi nilai nilai_x=int(input("masukan nilai x: ")) #operator penjumlahan nilai_x +=20 print("hasil jumlah: ", nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator pengurangan nilai_x -=10 print("hasil kurang:",nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator perkalian nilai_x *=10 print("hasil kali:",nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator pembagian nilai_x /=30 print("hasil bagi:",nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator perpangkatan nilai_x **=5 print("hasil pangkat:",nilai_x) nilai_x=int(input("masukan nilai x: ")) #operator sisa bagi nilai_x %=35 print("hasil sisa bagi:",nilai_x)
#author SANKALP SAXENA # Enter your code here. Read input from STDIN. Print output to STDOUT n = int(input()) s = set() for i in range(0, n) : s.add(input()) print(len(s))
def find_prefix_entry(message, dictionary): """ Find the longest entry in dictionary which is a prefix of the given message """ for entry in dictionary[::-1]: if message.startswith(entry[0]): return dictionary.index(entry) return -1 def lz78_encode(message, *args, **kwargs): dictionary = [] while len(message) > 0: prefix_entry = find_prefix_entry(message, dictionary) if prefix_entry == -1: next_char = message[0] entry = (next_char, (0, next_char)) message = message[1:] else: prefix = dictionary[prefix_entry][0] next_char = message[len(prefix)] value = prefix + next_char entry = (value, (prefix_entry + 1, next_char)) message = message[len(value) :] dictionary.append(entry) return dictionary def lz78_decode(outputs, *args, **kwargs): dictionary = [] message = "" for i, c in outputs: if i == 0: suffix = c dictionary.append((c, (i, c))) else: entry = dictionary[i - 1] suffix = entry[0] + c dictionary.append((entry[0] + c, (i, c))) message += suffix return message
def swap_case(s): swapped = s.swapcase() return swapped
#----------------------------------------------------------------------------- # Runtime: 84ms # Memory Usage: # Link: #----------------------------------------------------------------------------- class Solution: def multiply(self, num1: str, num2: str) -> str: if num1 == '0' or num2 == '0': return '0' len_num1 = len(num1) len_num2 = len(num2) num1 = num1[::-1] num2 = num2[::-1] result_list = [0] * 220 dic = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9} for i in range(len_num1): for j in range(len_num2): result_list[i + j] += dic[num1[i]] * dic[num2[j]] carry = 0 result = "" for i in range(len_num1 + len_num2): carry, rest = divmod(result_list[i] + carry, 10) result = str(rest) + result for i, ch in enumerate(result): if ch != '0': break return result[i:]
""" [7/23/2014] Challenge#172 [Intermediate] Image Rendering 101...010101000101 https://www.reddit.com/r/dailyprogrammer/comments/2ba3nf/7232014_challenge172_intermediate_image_rendering/ #Description You may have noticed from our [easy](http://www.reddit.com/r/dailyprogrammer/comments/2ba3g3/7212014_challenge_172_easy/) challenge that finding a program to render the PBM format is either very difficult or usually just a spammy program that no one would dare download. Your mission today, given the knowledge you have gained from last weeks challenge is to create a Renderer for the PBM format. For those who didn't do mondays challenge, here's a recap * a PBM usually starts with 'P1' denoting that it is a .PBM file * The next line consists of 2 integers representing the width and height of our image * Finally, the pixel data. 0 is white and 1 is black. This Wikipedia article will tell you more http://en.wikipedia.org/wiki/Netpbm_format #Formal Inputs & Outputs ##Input description On standard console input you should be prompted to pass the .PBM file you have created from the easy challenge. ##Output description The output will be a .PBM file rendered to the screen following the conventions where 0 is a white pixel, 1 is a black pixel #Notes This task is considerably harder in some languages. Some languages have large support for image handling (.NET and others) whilst some will require a bit more grunt work (C and even Python) . It's up to you to decide the language, but easier alternatives probably do exist. #Bonus Create a renderer for the other versions of .PBM (P2 and P3) and output these to the screen. #Finally Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas """ def main(): pass if __name__ == "__main__": main()
# This file is part of the DMComm project by BladeSabre. License: MIT. """ `dmcomm.protocol.barcode` ========================= Functions for generating EAN-13 patterns. """ # https://en.wikipedia.org/wiki/International_Article_Number _START_END = "101" _CENTRE = "01010" _CODES = { "L": ["0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011"], "G": ["0100111", "0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001", "0010111"], "R": ["1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100"], } _SELECT = ["LLLLLL", "LLGLGG", "LLGGLG", "LLGGGL", "LGLLGG", "LGGLLG", "LGGGLL", "LGLGLG", "LGLGGL", "LGGLGL"] def ean13_bits(barcode_number: list) -> str: result = [_START_END] selection = _SELECT[barcode_number[0]] for i in range(6): digit = barcode_number[i + 1] code = _CODES[selection[i]][digit] result.append(code) result.append(_CENTRE) for i in range(6): digit = barcode_number[i + 7] code = _CODES["R"][digit] result.append(code) result.append(_START_END) return "".join(result) def run_lengths(seq) -> list: if len(seq) == 0: return [] result = [] prev = seq[0] count = 1 for item in seq[1:]: if item == prev: count += 1 else: result.append(count) count = 1 prev = item result.append(count) return result def ean13_lengths(barcode_number: list) -> list: return run_lengths(ean13_bits(barcode_number))
# program that takes a text file as input and returns the number of words of a given text file. def count_words(filepath): with open(filepath) as f: data = f.read() data.replace(",", " ") return len(data.split(" ")) print(count_words("words.txt"))
#get the user input for Position position = input("Position : ") while position != "M" and position != "m" and position != "S" and position != "s": print("Invalid Input") position = input("Position : ") #get the user input for sales amount sales = input("Sales amount : ") sales = float(sales) #get the basic salary by the user input if position == "M" or position == "m": basic = 50000 else: basic = 75000 #check the sales amount for commission if sales >= 30000: commission = sales * 10 / 100 else: commission = 0 #calculate the salary salary = basic + commission #display the commission and the salary print("Commission : " + str(commission)) print("Salary : " + str(salary))
# Calcular o preço de um produto com % de desconto para pagamento a vista e % de juros para pagamento parcelado. print('x=' * 80) # AQUI FICA O VALOR DO PRODUTO. preco = float(input('Qual o valor do produto ?R$ ')) # VALOR DO DESCONTO OU ACREŚIMO. porcentagem = float(input('Desconto ou acréscimo para este produto em (%) ? ')) # QUANTIDADE DE PARCELAS. prestacoes = float(input('Número de parcelas: ')) # CALCULO PARA COMPRA A VISTA. avista = preco - (preco * porcentagem / 100) # CALCULO PARA COMPRA PARCELADA. parcelado = preco + (preco * porcentagem / 100) # VALOR POR PARCELAS. parcelas = parcelado / prestacoes # VALOR A VISTA. print('O valor do produto é R$ {:.2f}, se o pagamento for a vista tera um desconto de {}% ficando o valor em R$ {:.2f}.'.format(preco, porcentagem, avista)) # VALOR PARCELADO. print('Se o pagamento for parcelado tera um acréscimo {}% ficando o valor em R$ {:.2f}.'.format(porcentagem, parcelado)) # PARCELAS. print('Com {:.0f} parcelas de {:.2f}.'.format(prestacoes, parcelas)) print('x=' * 80)
# Created by MechAviv # Quest ID :: 23600 # Not coded yet OBJECT_6 = sm.getIntroNpcObjectID(2159377) sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.sendDelay(900) sm.moveCamera(False, 100, -307, -41) sm.sendDelay(2604) sm.setSpeakerID(2159377) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendNext("Good, very good! I am very satisfied with these results. Just a few more fine adjustments and...") sm.startQuest(23724) sm.completeQuest(23600) sm.changeBGM("Bgm30.img/fromUnderToUpper", 0, 0) sm.showEffect("Effect/Direction12.img/effect/tuto/BalloonMsg1/0", 1200, 0, -120, 0, OBJECT_6, False, 0) sm.moveNpcByObjectId(OBJECT_6, True, 1, 100) sm.sendDelay(90) sm.setSpeakerID(2159377) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendNext("An intruder?! It could be Orchid. Turn on the monitor!") sm.startQuest(23725) sm.sendDelay(2100) sm.completeQuest(23725) sm.sendDelay(1200) sm.setSpeakerID(2159377) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendNext("Is it the Resistance? I suppose that would be better than Orchid, but... this is the worst possible time!") sm.setSpeakerID(2159377) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay("Wait, wait, wait. Maybe this will work. One more test, yes... they will be perfect... Hahaha... MWAHAHAHA!") sm.warp(931050940, 0)
""" This package contains the portions of the library used only when implementing an OpenID consumer. """ __all__ = ['consumer', 'discover']
rgb = input() rgb = rgb.replace(" ", "") if int(rgb) % 4 == 0: print("YES") else: print("NO")
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False # if it is a large {key: value} in dict, the list way is slower than dict way # usedList = [] hashTable = {} valueTable = {} for i in range(len(s)): if s[i] in hashTable: if hashTable[s[i]] != t[i]: return False else: continue else: # if t[i] in usedList: if t[i] in valueTable: return False # usedList.append(t[i]) hashTable[s[i]] = t[i] valueTable[t[i]] = s[i] return True if __name__ == "__main__": s = 'egg' t = 'add' res = Solution() print(res.isIsomorphic(s, t))
def main() -> None: n = int(input()) def f(a: int, b: int) -> int: return a**3 + (a + b) * a * b + b**3 def binary_search(a: int) -> int: lo = -1 hi = 1 << 20 while hi - lo > 1: # print(lo, hi) b = (lo + hi) // 2 if f(a, b) >= n: hi = b else: lo = b return hi mn = 1 << 64 for a in range(1 << 20): b = binary_search(a) x = f(a, b) mn = min(mn, x) print(mn) if __name__ == "__main__": main()
def raw_response(function=None): def decorator(function): function.raw_response = True return function if function: return decorator(function) return decorator
class StringBuilder(object): def __init__(self, strr=''): self.str_list = [s for s in strr] def __getitem__(self, item): return ''.join(self.str_list[item]) def __setitem__(self, key, value): self.str_list[key] = value def __repr__(self): return ''.join(self.str_list) def __len__(self): return len(self.str_list) def __iter__(self): for s in self.str_list: yield s def __add__(self, other): for s in other: self.str_list.append(s) return self def append(self, other): return self.__add__(other) def __str__(self): return self.__repr__() def __delitem__(self, key): self.str_list.pop(key) def remove(self, key): self.__delitem__(key) def to_string(self): return self.__str__()
#from math import hypot co = float(input('Quanto mede o cateto oposto? ')) ca = float(input('Quanto mede o cateto adjacente? ')) hi = hypot(co, ca) print(f'A hipotenusa vai medir {hi:.2f}') ''' import math co = float(input('Quanto mede o cateto oposto? ')) ca = float(input('Quanto mede o cateto adjacente? ')) hi = math.hypot(co, ca) print(f'A hipotenusa vai medir {hi:.2f}') '''
class Person: IS = None def __init__(self, name, hours, rate): self.name = name self.hours = hours self.rate = rate def __new__(cls, *args, **kwargs): if cls.IS == None: cls.IS = object.__new__(Person) return cls.IS def pay(self): return self.hours * self.rate z = Person('Bob', 14, 4) x = Person('Jack', 44, 4) print(z, x) print(z.hours, x.hours)
data_matrix = [ [2, 3, 1, 1], [1, 2, 3, 1], [1, 1, 2, 3], [3, 1, 1, 2] ] def fill_zeros(data_val): return bin(int(data_val, 16))[2:].zfill(8) input_hex = [0xd4, 0xbf, 0x5d, 0x30] input_bin = [] for i, bin_num in enumerate(input_hex): bin_num = bin(input_hex[i])[2:].zfill(8) print(bin_num) bin_num = int(bin_num, 2) input_bin.append(bin_num) print(input_bin) for col in data_matrix: print("+++++++++++++++++++++++\nThe {} round\n\n".format(col)) result_row_1 = [] for i, row in enumerate(col): if row == 2: print("2") a = input_bin[i] a = bin(input_bin[i])[2:].zfill(8) print("AAAAAAAAAAAAAAAAA\n") print("a = {}".format(a)) print(type(a)) print("\nAAAAAAAAAAAAAAAA") if int(a[0]) == 1: a = input_bin[i] << 1 a = bin(a)[3:].zfill(8) print("I am a leftshifted a: {}".format(a)) a = int(a, 2) xor_row_1 = a ^ 0x1b xor_row_1 = bin(xor_row_1)[2:].zfill(8) print("I am == 1: {}".format(xor_row_1)) else: a = input_bin[i] << 1 a = bin(a)[3:].zfill(8) a = int(a, 2) xor_row_1 = a xor_row_1 = bin(xor_row_1)[2:].zfill(8) print("I am == 0: {}".format(xor_row_1)) xor_row_1 = a elif row == 3: print("3") b = input_bin[i] b = bin(input_bin[i])[2:].zfill(8) print("BBBBBBBBBBBBBBBBBB\n") print("b = {}".format(b)) print(type(b)) print("\nBBBBBBBBBBBBBBBBBBB") if int(b[0]) == 1: b = input_bin[i] << 1 b = bin(b)[3:].zfill(8) print("I am a leftshifted b: {}".format(b)) b = int(b, 2) xor_row_2 = b ^ 0x1b ^ input_bin[i] xor_row_2 = bin(xor_row_2)[2:].zfill(8) print("I am == 1: {}".format(xor_row_2)) else: b = input_bin[i] << 1 b = bin(b)[2:].zfill(8) print("I am a leftshifted b: {}".format(b)) b = int(b, 2) xor_row_2 = b ^ input_bin[i] xor_row_2 = bin(xor_row_2)[2:].zfill(8) print("I am == 0: {}".format(xor_row_2)) print(xor_row_2) else: print("1") print("\n\n\n\n\n\n")
Root.default = -3 Scale.default = 'minor' Clock.bpm=100 acordes = [(2,4,6),(-1,1,3),(0,2,4)] escalera = P[5,4,3,2] p1 >> space([0,0,4,2,0,0,5,2],dur=1,amp=[0,1,1,1]) d1 >> play("X ",amp=1) pt >> play('#', dur=16,sus=4, rate=-1/2, amp=var([1,0],[16,inf],start=now)) p1 >> space([4,4,2,0,3,3,2,1],dur=1,amp=[0,1,1,1]) p1 >> space([0,0,4,2,0,0,5,2],dur=1,amp=[0,1,1,1]) b1 >> ambi([0,-2,4,3],dur=4,sus=3,oct=3,chop=3,amp=3) v1 >> loop("verso",P[0:8],formant=0,amp=2,room=0.0,mix=0.0,glide=0,chop=0) p1 >> space([4,4,2,0,3,3,2,1],dur=1,amp=[0,1,1,1]) v1 >> loop("verso",P[8:16],formant=0,amp=2,room=0.0,mix=0.0,glide=0,chop=0) d3 >> play("-") p1 >> space([0,0,4,2,0,0,5,2],dur=1,amp=[0,1,1,1]) v1 >> loop("verso",P[0:8],formant=2,amp=2,room=0.0,mix=0.0,glide=0,chop=0) p1 >> space([4,4,2,0,3,3,2,1],dur=1,amp=[0,1,1,1]) v1 >> loop("verso",P[8:16],formant=2,amp=2,room=0.0,mix=0.0,glide=0,chop=0) pt >> play('#', dur=16,sus=4, rate=-1/2, amp=var([1,0],[16,inf],start=now)) b1 >> ambi([0],dur=4,sus=2,oct=3,chop=3) p1 >> space([(0,2,4)]*4,dur=2,amp=1) p2 >> prophet([(0,2,4)]*4,dur=2,amp=0.5) d1 >> play("X ",amp=1) d3 >> play("-",dur=PSum(6,4)) b1 >> bass([2,-1,0,-2],dur=4,chop=2,sus=3,amp=0.7,oct=5) n = 5 p2 >> prophet([(2,4,6)]*n+[(-1,1,3)]*n+[(0,2,4)]*n+[5,4,3,2],dur=list(PSum(n,4)[:n*3])+[1]*4,amp=[1,1,1,1]*3 + [1,1,1,1]) v1 >> loop("estribillo1_pablito_rack",P[0:8],formant=[0],amp=1) v1 >> loop("estribillo1_pablito_rack",P[8:16],formant=[0],amp=1) v1 >> loop("estribillo2_mathi_rack",P[0:8],formant=[0],amp=0.7) v1 >> loop("estribillo2_mathi_rack",P[8:16],formant=[0],amp=0.7) v1 >> loop("estribillo3_pablito_rack",P[0:8],formant=[0],amp=1) v1 >> loop("estribillo3_pablito_rack",P[8:16],formant=[0],amp=1) v1 >> loop("estribillo4_pablito_rack",P[0:8],formant=[0],amp=1) v1 >> loop("estribillo4_pablito_rack",P[8:16],formant=[0],amp=1) b1 >> bass([2],dur=4,chop=3,sus=2) p1 >> space([(2,4,6)]*4,dur=2,amp=1) p2 >> prophet([(2,4,6)]*4,dur=2,amp=1) v1 >> loop('estribillo4_pablito_rack',P[0:8], formant=0,amp=1) v2 >> loop('estribillo4_mathi_rack', P[8:16],formant=0, amp=0.5) Group(v1,v2).solo()
class Solution: def minimumRefill(self, plants: List[int], capacityA: int, capacityB: int) -> int: """ [2,2,4,3,3] A = 5, B = 5 cans = 1 1 2 [1,2,4,4,5] A = 6, B = 2 cans = 3 0,3 1,1 (c-(sum%c)) """ n = len(plants) i, j = 0, n-1 cap_a, cap_b = capacityA, capacityB cans_used = 0 # 1 while i < j: cans_used += cap_a < plants[i] cans_used += cap_b < plants[j] cap_a = cap_a if cap_a >= plants[i] else capacityA cap_b = cap_b if cap_b >= plants[j] else capacityB cap_a -= plants[i] cap_b -= plants[j] i += 1 j -= 1 if i == j: max_water = max(cap_a, cap_b) cans_used += max_water < plants[i] return cans_used
def main(): totalNum = 0 totalValues = {} filename = 'day1_1_input.txt' found = False while not found: userInput = open(filename, 'r') print ("Starting from the top") for i in userInput: print (i) if i[0] == '-': totalNum -= int(i[1:]) else: totalNum += int(i[1:]) print (totalNum) if totalNum in totalValues: found = True break else: totalValues[totalNum] = 1 userInput.close() print(totalNum) main()
def response(hey_bob): hey_bob = hey_bob.strip() if _is_silence(hey_bob): return 'Fine. Be that way!' if _is_shouting(hey_bob): if _is_question(hey_bob): return "Calm down, I know what I'm doing!" else: return 'Whoa, chill out!' elif _is_question(hey_bob): return 'Sure.' else: return 'Whatever.' def _is_silence(hey_bob): return hey_bob == '' def _is_shouting(hey_bob): return hey_bob.isupper() def _is_question(hey_bob): return hey_bob.endswith('?')
word = input("Enter a number: ") word = int(word) count =10 while True: temp = word % 10 word = word//10 if temp % 2==0: print(temp,end="") if word == 0: break
# 1表示空格,0表示墙, 2表示陷阱, 3表示火 Mazes = { 'maze7_1': [ [1., 0., 1., 1., 1., 1., 1.], [1., 1., 1., 0., 0., 1., 0.], [0., 0., 0., 1., 1., 1., 0.], [1., 1., 1., 1., 0., 0., 1.], [1., 0., 0., 0., 1., 1., 1.], [1., 0., 1., 1., 1., 1., 1.], [1., 1., 1., 0., 1., 1., 1.] ], 'maze7_2': [ [1., 0., 1., 1., 1., 1., 1.], [1., 1., 1., 0., 0., 1., 0.], [0., 0., 0., 1., 1., 1., 0.], [1., 1., 1., 1., 0., 0., 1.], [1., 0., 0., 0., 1., 1., 1.], [1., 0., 1., 1., 1., 2., 2.], [1., 1., 1., 0., 1., 1., 1.] ], 'maze7_3': [ [1., 0., 1., 1., 1., 1., 1.], [1., 1., 3., 0., 0., 1., 0.], [0., 0., 0., 1., 1., 1., 0.], [1., 1., 1., 1., 0., 0., 1.], [1., 0., 0., 0., 1., 1., 1.], [1., 0., 1., 1., 1., 2., 2.], [1., 1., 1., 0., 1., 1., 1.] ], 'maze10_1': [ [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1], ], 'maze10_2': [ [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1], ], 'maze10_3': [ [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1, 0, 0, 0, 1], [1, 1, 0, 1, 0, 1, 3, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 3, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1], ], 'maze11_1': [ [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 3, 0, 0, 1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 2], [1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2], [1, 0, 0, 0, 1, 1, 3, 1, 1, 1, 2], [1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1], [1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 1, 3, 0, 1, 0, 0, 3], [1, 0, 3, 0, 1, 1, 2, 1, 1, 0, 1], [1, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1], ] }
data = input() products = {} while not data == "statistics": product, quantity = data.split(": ") quantity = int(quantity) if product in products: products[product] += quantity else: products[product] = quantity data = input() print("Products in stock:") for product in products: print(f"- {product}: {products[product]}") print(f"Total Products: {len(products)}") print(f"Total Quantity: {sum(products.values())}")
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def createList(l: list) -> ListNode: header = current = ListNode() for i in range(0, len(l)): current.next = current = ListNode(l[i]) return header.next def printList(l: ListNode): while l: print(l.val) l = l.next print(" ") ''' leetcode - 2 两数相加 # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def addTwoNumbers(l1: ListNode, l2: ListNode) -> ListNode: header = current = ListNode() plus = val = 0 while plus or l1 or l2: val = plus if l1: l1, val = l1.next, l1.val + val if l2: l2, val = l2.next, l2.val + val if val >= 10: plus, val = 1, val - 10 else: plus = 0 current.next = current = ListNode(val) return header.next l1 = [9,9,9,9,9,9,9] l2 = [9,9,9,9] listno1 = createList(l1) listno2 = createList(l2) printList(listno1) printList(listno2) list3 = addTwoNumbers(listno1, listno2) printList(list3) ''' ''' #leetcode - 3 最长子串 def lengthOfLongestSubstring(s: str) -> int: if len(s) == 0: return 0 tempS = [] maxL = 0 for c in s: if c in tempS: tempS[:] = tempS[tempS.index(c) + 1: ] tempS.append(c) maxL = maxL if maxL > len(tempS) else len(tempS) return maxL print(lengthOfLongestSubstring("aabaab!bb")) ''' ''' def isPalindrome(x: int) -> bool: if x < 0 or (x % 10 == 0 and x != 0): return False leftV, rightV = x, 0 while leftV > rightV: rightV = rightV * 10 + leftV % 10 leftV = int(leftV / 10) return leftV == rightV or leftV == int(rightV/10) print(12 % 10) print(isPalindrome(0)) ''' """ def deleteDuplicates(head: ListNode) -> ListNode: num = [] headL = l = ListNode() while head: if head.val not in num: num.append(head.val) l.next = l = ListNode(head.val) head = head.next return headL.next l1 = createList([1,1,2,3,3]) printList(l1) printList(deleteDuplicates(l1)) """ class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right #[1,null,2,3] def createTreeNode() -> TreeNode: # l3 = TreeNode(3) # l2 = TreeNode(2, l3) # l1 = TreeNode(1) # l1.right = l2 # return l1 # 1 # 4 3 # 2 l1 = TreeNode(1) l2 = TreeNode(4) l3 = TreeNode(3) l4 = TreeNode(2) l1.left = l2 l1.right = l3 l2.right = l4 return l1 #中序遍历 def inorderTraversal(root: TreeNode) -> []: tempL = [] intL = [] while root or len(tempL): while root: tempL.append(root) root = root.left root = tempL.pop() intL.append(root.val) root = root.right return intL """ # 先序 递归调用 def xianxu(root: TreeNode) -> []: def bianli(node: TreeNode): if not node: return intL.append(node.val) bianli(node.left) bianli(node.right) intL = [] bianli(root) return intL """ """ # 先序 使用队列思想 def xianxu(root: TreeNode) -> []: nodeL = [] intL = [] while root or len(nodeL): while root: nodeL.append(root) intL.append(root.val) root = root.left root = nodeL.pop() root = root.right return intL """ """ # 后续遍历:左 右 中 def houxu(root: TreeNode) -> []: nodeL = [] intL = list() prev = None while root or len(nodeL): while root: nodeL.append(root) root = root.left root = nodeL.pop() if not root.right or prev == root.right: intL.append(root.val) prev = root root = None else: nodeL.append(root) root = root.right return intL L = createTreeNode() print(houxu(L)) """ """ # 链表反转 l1 = [1,2,3,4,5,6,7, 8, 9] listno1 = createList(l1) def fanzhuan(l: ListNode) -> ListNode: header = current = ListNode() while l: l1 = ListNode(l.val) l1.next = header.next header.next = l1 l = l.next return header.next #printList(fanzhuan(listno1)) """ # LRU缓存机制 class DlinkedNode: def __init__(self, key = 0, value = 0): self.key = key self.value = value self.pre = None self.next = None class Solution: cache = dict() # 可以使用双向链表来实现,这里取巧,使用list node = list() count = 0 def LRU(self, operations: list, k: int) -> list: self.count = k resultL = [] for i in range(len(operations)): innderL = operations[i] if innderL[0] == 1: self.set(innderL[1], innderL[2]) elif innderL[0] == 2: resultL.append(self.get(innderL[1])) return resultL def set(self, key: int, value: int): if key in self.cache: #在cache中,移动到最前 self.node.remove(key) # 插入最前边 self.cache[key] = value self.node.insert(0, key) if len(self.node) > self.count: delkey = self.node.pop() self.cache.pop(delkey) def get(self, key: int) -> int: if key in self.cache: self.node.remove(key) self.node.insert(0, key) return self.cache[key] else: return -1 #sol = Solution() #operations = [[1,1,1],[1,2,2],[1,3,2],[2,1],[1,4,4],[2,2]] #print(sol.LRU(operations, 3)) """ # 排列好的有重复数据的list,二分查找,并输出最小的值, def search(numss: list, target: int): if not numss: return -1 low, high= 0, len(numss)-1 idx = -1 while low <= high: mid = (low + high) // 2 if numss[mid] < target: low = mid + 1 elif numss[mid] > target: high = mid - 1 else: idx = mid high = mid - 1 return idx #list1 = [1,2,2,4] list1 = [-2,1,2] #2 print(search(list1, 2)) """ """ def maxLengthList(arr:[] ) -> []: # write code here # 采用队列的思路,先进先出,有重复的则移除前所有的数据 res = [] temp = [] for i in arr: if i in temp: temp[:] = temp[temp.index(i) + 1 :] temp.append(i) if len(res) < len(temp): res = temp.copy() return res def maxLengthList2(arr:[] ) -> int: # write code here # 采用队列的思路,先进先出,有重复的则移除前所有的数据 temp = [] maxL = 0 for i in arr: if i in temp: temp[:] = temp[temp.index(i) + 1 :] temp.append(i) if maxL < len(temp): maxL = len(temp) return maxL arr = [1,2,3,1,2,3,2,2] arr = [2,3,4,5] print(maxLengthList2(arr)) """ """ def getLessNums(tinput: [], k: int) -> []: for i in range(0, len(tinput)): minIdx = i minVal = tinput[i] for j in range(i + 1, len(tinput)): if minVal > tinput[j]: minVal = tinput[j] minIdx = j tinput[i], tinput[minIdx] = minVal, tinput[i] if i == k: break return tinput[0:k] print(getLessNums([4,5,1,6,2,7,3,8],4)) """ """ 这里会把B merge到A中。比如A = [1,2,3], B = [2,5,6] 调用方法会变成A=[1,2,3,0,0,0]自动扩展3个元素 然后把Bmerge到A中,最后的结果为[1,2,2,3,5,6] """ """ def mergeTwoList(A:[], m: int, B:[], n:int): # 1. 使用双指针,这里直接使用m和n即可 # 2. A、B从最后一个元素进行对比 # 3. A的值比B大,则A[m-1]的值移动到最后,指针左移 # 4. B的值比A大,则直接赋值,指针左移 if not A or not B: return while m > 0 and n > 0: # if A[m-1] >= B[n-1]: A[m+n-1] = A[m-1] m -= 1 else: A[m+n-1] = B[n-1] n -= 1 if n > 0: A[:n] = B[:n] A = [1,2,3,0,0,0] B = [2,5,6] mergeTwoList(A, 3, B, 3) print(A) """ def solveStr(s: str) -> str: # write code here l = list(s) for i in range(0, len(l) // 2): l[i], l[len(l)-1-i] = l[len(l)-1-i], l[i] return "".join(l) print(solveStr("abcde"))
# static methods # use the staticmethod decorator class Human: @staticmethod def speak(): print("I can speak") Human().speak() me = Human() me.speak() # this line will give error # expected an error.. but there isn't any # static methods can be called on an instance of a class # i didn't pass self or any argument to the static method # there are other cracked gette and setters.. shitty as it may seem # i don't like it
# Sem passar valores pelo init class Calculadora: # def __init__(self): # pass def soma(self, valor_a, valor_b): return valor_a + valor_b def subtracao(self, valor_a, valor_b): return valor_a - valor_b def multiplicacao(self, valor_a, valor_b): return valor_a * valor_b def divisao(self, valor_a, valor_b): return valor_a / valor_b if __name__ == '__main__': # Instanciando uma classe calculadora = Calculadora() print(calculadora.soma(10, 2)) print(calculadora.subtracao(10, 2)) print(calculadora.multiplicacao(10, 2)) print(calculadora.divisao(10, 2))
def make_album(singer, album, numbers=''): albums = {'singer': singer, 'album': album} if numbers: albums['numbers'] = numbers return albums print(make_album('张靓颖', '终于等到你')) print(make_album('邓丽君', '我只在乎你', 20)) print(make_album('汪小敏', '笑看风云')) while True: singer = input("请输入歌手:") if not singer: break album = input("请输入专辑:") if not album: break print(make_album(singer, album))
def get_level(cell): i = 0 while cell > (2*i+1)**2: i += 1 return i def find_coord(cell): level = get_level(cell) x = level y = -level current = (2*level+1)**2 while x != -level: if current == cell: return (x, y) x-=1 current -= 1 while y != level: if current == cell: return (x, y) y+=1 current -= 1 while x != level: if current == cell: return (x, y) x+=1 current -= 1 while y != -level: if current == cell: return (x, y) y-=1 current -= 1 return None print(find_coord(347991))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Filename: for.py edibles = ['ham', 'spam', 'eggs', 'nuts'] for food in edibles: if food == 'spam': print('No more spam please!') break print('Great, delicious ' + food) else: print('I am so glad: No spam!') print('Finally, I finished stuffing myself')
class QuoteLine: def __init__(self, lineText, lineNumber, origin): self.lineText = lineText self.lineNumber = lineNumber self.origin = origin self.renderedLine = None def renderLine(self, font, color): ''' Renders the line using the given font and color. ''' self.renderedLine = font.render(self.lineText, False, color) def discardRenderedLine(self): ''' Discards the rendered line (self.renderedLine = None) ''' self.renderedLine = None
first_str = input() second_str = input() while first_str in second_str: second_str = second_str.replace(first_str, '') print(second_str)
# # PySNMP MIB module CHIPFDDINET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHIPFDDINET-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:48:56 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") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") DisplayString, = mibBuilder.importSymbols("RFC1155-SMI", "DisplayString") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") IpAddress, Gauge32, enterprises, TimeTicks, iso, Counter64, NotificationType, ObjectIdentity, MibIdentifier, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Integer32, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Gauge32", "enterprises", "TimeTicks", "iso", "Counter64", "NotificationType", "ObjectIdentity", "MibIdentifier", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Integer32", "ModuleIdentity", "Unsigned32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") chipcom = MibIdentifier((1, 3, 6, 1, 4, 1, 49)) chipmib02 = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2)) chipGen = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 1)) chipEcho = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 2)) chipProducts = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3)) chipExperiment = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 4)) chipTTY = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 5)) chipTFTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 6)) chipDownload = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 7)) online = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1)) oebm = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 2)) midnight = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 3)) workGroupHub = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4)) emm = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 5)) chipBridge = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 6)) trmm = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 7)) fmm = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 8)) focus1 = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 9)) oeim = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 10)) chipExpTokenRing = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 4, 1)) dot1dBridge = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 4, 14)) dot5 = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 4, 1, 1)) olAgents = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 1)) olConc = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 2)) olEnv = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 3)) olModules = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4)) olNets = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5)) olGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 6)) olAlarm = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 7)) olSpecMods = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4)) ol50nnMCTL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 3)) ol51nnMMGT = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 4)) ol51nnMFIB = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 5)) ol51nnMUTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 6)) ol51nnMTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 7)) ol51nnMBNC = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 8)) ol51nnBEE = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 9)) ol51nnRES = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 10)) ol51nnREE = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 11)) ol51nnMAUIF = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 12)) ol51nnMAUIM = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 13)) ol5208MTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 14)) ol51nnMFP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 15)) ol51nnMFBP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 16)) ol51nnMTPL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 17)) ol51nnMTPPL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 18)) ol52nnMTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 19)) ol52nnMFR = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 20)) ol51nnMTS = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 21)) ol51nnMFL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 22)) ol50nnMRCTL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 23)) ol51nnMFB = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 24)) ol53nnMMGT = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 25)) ol53nnMFBMIC = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 26)) ol53nnMFIBST = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 27)) ol53nnMSTP = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 28)) ol51nnMTPCL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 29)) ol52nnBTT = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 30)) ol51nnIx = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 31)) ol52nnMMGT = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 32)) ol50nnMHCTL = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 4, 4, 33)) olNet = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 1)) olEnet = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 2)) olTRnet = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 3)) olFDDInet = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4)) hubSysGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 1)) hardwareGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 2)) softwareGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 3)) hubGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 4)) boardGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 5)) portGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 6)) alarmGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 4, 7)) olThresh = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 7, 1)) olThreshControl = MibIdentifier((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 7, 1, 1)) olFDDIStatsModTable = MibTable((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2), ) if mibBuilder.loadTexts: olFDDIStatsModTable.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModTable.setDescription('A table of statistical information counted for each module in each FDDI network.') olFDDIStatsModEntry = MibTableRow((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1), ).setIndexNames((0, "CHIPFDDINET-MIB", "olFDDIStatsModSlotIndex")) if mibBuilder.loadTexts: olFDDIStatsModEntry.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModEntry.setDescription('A list of statistical information for each module on each FDDI network in the concentrator.') olFDDIStatsModSlotIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsModSlotIndex.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModSlotIndex.setDescription('The slot number that contains this module.') olFDDIStatsModMgtRcvErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsModMgtRcvErrs.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModMgtRcvErrs.setDescription('The number of errors encountered while receiving data on the Management Channel.') olFDDIStatsModMgtXmitErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsModMgtXmitErrs.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModMgtXmitErrs.setDescription('The number of errors encountered while transmitting data on the Management Channel.') olFDDIStatsModBackplaneErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsModBackplaneErrs.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModBackplaneErrs.setDescription('The number of errors while receiving and transmitting network data on the backplane.') olFDDIStatsModPllUnlockErrs = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsModPllUnlockErrs.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsModPllUnlockErrs.setDescription('The number of times the phased lock loop on the backplane network data channel was lost.') olFDDIStatsPortTable = MibTable((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3), ) if mibBuilder.loadTexts: olFDDIStatsPortTable.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortTable.setDescription('A table of statistical information counted for each Port in each FDDI network.') olFDDIStatsPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1), ).setIndexNames((0, "CHIPFDDINET-MIB", "olFDDIStatsPortSlotIndex"), (0, "CHIPFDDINET-MIB", "olFDDIStatsPortIndex")) if mibBuilder.loadTexts: olFDDIStatsPortEntry.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortEntry.setDescription('A list of statistical information for each Port on each FDDI network in the concentrator.') olFDDIStatsPortSlotIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortSlotIndex.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortSlotIndex.setDescription('The slot number that contains this Port.') olFDDIStatsPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortIndex.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortIndex.setDescription('The Port number of this port') olFDDIStatsPortLCTFailCts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortLCTFailCts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortLCTFailCts.setDescription('The count of the consecutive times the link confidence test (LCT) has failed during connection management. Once the connection has been established, the count is zeroed. (refer to ANSI 9.4.1).') olFDDIStatsPortLerEstimate = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortLerEstimate.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortLerEstimate.setDescription('A long term average link error rate. It ranges from 10**-4 to 10**-15 and is reported as the absolute value of the exponent of the estimate (the larger the number, the smaller the value).') olFDDIStatsPortLemRejectCts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortLemRejectCts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortLemRejectCts.setDescription('A link error monitoring count of the times that a link has been removed from the ring due to the LerCutOff threshold being exceeded.') olFDDIStatsPortLemCts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 3, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDIStatsPortLemCts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDIStatsPortLemCts.setDescription("The aggregate link error monitor error count, set to zero only on station power up. This variable's long term rate average is lerEstimate.") olFDDInetStatsTable = MibTable((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4), ) if mibBuilder.loadTexts: olFDDInetStatsTable.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsTable.setDescription('A table of statistical information counted for each FDDI network in the concentrator') olFDDInetStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1), ).setIndexNames((0, "CHIPFDDINET-MIB", "olFDDInetStatsNetID")) if mibBuilder.loadTexts: olFDDInetStatsEntry.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsEntry.setDescription('A list of statistical information for each FDDI network in the concentrator.') olFDDInetStatsNetID = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 16, 17, 18, 19))).clone(namedValues=NamedValues(("isolated", 2), ("fddi-1", 16), ("fddi-2", 17), ("fddi-3", 18), ("fddi-4", 19)))).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsNetID.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsNetID.setDescription('The network index that uniquely identifies this network. One of isolated, fddi-1, fddi-2, fddi-3, or fddi-4.') olFDDInetStatsRingOpCounts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsRingOpCounts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsRingOpCounts.setDescription('The number times the ring transitioned to operational.') olFDDInetStatsFrameCounts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsFrameCounts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsFrameCounts.setDescription('Frame_Ct (refer to ANSI MAC 2.2.1).') olFDDInetStatsErrorCounts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsErrorCounts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsErrorCounts.setDescription('Error_Ct (refer to ANSI MAC 2.2.1).') olFDDInetStatsLostCounts = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsLostCounts.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsLostCounts.setDescription('Lost_Ct (refer to ANSI MAC 2.2.1).') olFDDInetStatsFrameErrorRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 49, 2, 3, 1, 5, 4, 4, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: olFDDInetStatsFrameErrorRatio.setStatus('mandatory') if mibBuilder.loadTexts: olFDDInetStatsFrameErrorRatio.setDescription('This attribute is the actual ratio, ((delta snmpFddiMACLostCt + delta snmpFddiMACErrorCt) / (delta snmpFddiMACFrameCt + delta snmpFddiMACLostCt)) x 2**16.') mibBuilder.exportSymbols("CHIPFDDINET-MIB", olFDDIStatsModSlotIndex=olFDDIStatsModSlotIndex, olNets=olNets, ol50nnMRCTL=ol50nnMRCTL, softwareGroup=softwareGroup, hubSysGroup=hubSysGroup, olFDDInetStatsRingOpCounts=olFDDInetStatsRingOpCounts, olThresh=olThresh, olFDDInetStatsLostCounts=olFDDInetStatsLostCounts, dot1dBridge=dot1dBridge, oeim=oeim, olFDDIStatsModMgtRcvErrs=olFDDIStatsModMgtRcvErrs, olThreshControl=olThreshControl, chipTTY=chipTTY, ol53nnMMGT=ol53nnMMGT, ol52nnMFR=ol52nnMFR, ol51nnMAUIF=ol51nnMAUIF, olFDDIStatsModPllUnlockErrs=olFDDIStatsModPllUnlockErrs, online=online, chipExpTokenRing=chipExpTokenRing, olConc=olConc, ol51nnREE=ol51nnREE, ol53nnMFIBST=ol53nnMFIBST, ol51nnMTPL=ol51nnMTPL, olFDDIStatsModEntry=olFDDIStatsModEntry, ol51nnMBNC=ol51nnMBNC, ol51nnMTPPL=ol51nnMTPPL, trmm=trmm, ol51nnBEE=ol51nnBEE, ol51nnMAUIM=ol51nnMAUIM, chipEcho=chipEcho, olEnv=olEnv, chipProducts=chipProducts, olFDDIStatsPortTable=olFDDIStatsPortTable, ol51nnMFP=ol51nnMFP, olFDDIStatsPortLemRejectCts=olFDDIStatsPortLemRejectCts, chipDownload=chipDownload, olFDDInet=olFDDInet, olSpecMods=olSpecMods, dot5=dot5, ol51nnMTPCL=ol51nnMTPCL, olFDDInetStatsFrameErrorRatio=olFDDInetStatsFrameErrorRatio, fmm=fmm, chipmib02=chipmib02, olFDDIStatsModMgtXmitErrs=olFDDIStatsModMgtXmitErrs, olFDDInetStatsErrorCounts=olFDDInetStatsErrorCounts, ol51nnMFL=ol51nnMFL, chipGen=chipGen, olFDDIStatsPortEntry=olFDDIStatsPortEntry, midnight=midnight, olGroups=olGroups, ol51nnRES=ol51nnRES, olFDDIStatsPortSlotIndex=olFDDIStatsPortSlotIndex, ol53nnMFBMIC=ol53nnMFBMIC, olFDDInetStatsFrameCounts=olFDDInetStatsFrameCounts, olFDDIStatsPortLemCts=olFDDIStatsPortLemCts, emm=emm, olFDDInetStatsEntry=olFDDInetStatsEntry, olEnet=olEnet, ol52nnMMGT=ol52nnMMGT, olFDDIStatsPortLCTFailCts=olFDDIStatsPortLCTFailCts, olNet=olNet, chipcom=chipcom, ol51nnMFBP=ol51nnMFBP, ol51nnIx=ol51nnIx, olFDDIStatsModBackplaneErrs=olFDDIStatsModBackplaneErrs, olModules=olModules, olFDDInetStatsTable=olFDDInetStatsTable, alarmGroup=alarmGroup, ol51nnMTP=ol51nnMTP, olFDDIStatsModTable=olFDDIStatsModTable, ol51nnMFIB=ol51nnMFIB, ol51nnMTS=ol51nnMTS, focus1=focus1, chipTFTP=chipTFTP, olTRnet=olTRnet, workGroupHub=workGroupHub, hardwareGroup=hardwareGroup, ol51nnMUTP=ol51nnMUTP, ol53nnMSTP=ol53nnMSTP, olFDDInetStatsNetID=olFDDInetStatsNetID, ol51nnMMGT=ol51nnMMGT, chipExperiment=chipExperiment, chipBridge=chipBridge, boardGroup=boardGroup, ol52nnBTT=ol52nnBTT, olAlarm=olAlarm, olFDDIStatsPortIndex=olFDDIStatsPortIndex, ol5208MTP=ol5208MTP, ol50nnMHCTL=ol50nnMHCTL, portGroup=portGroup, oebm=oebm, ol51nnMFB=ol51nnMFB, hubGroup=hubGroup, olFDDIStatsPortLerEstimate=olFDDIStatsPortLerEstimate, ol50nnMCTL=ol50nnMCTL, ol52nnMTP=ol52nnMTP, olAgents=olAgents)
# class Solution(object): # def generateParenthesis(self, n): # """ # :type n: int # :rtype: List[str] # """ class Solution(object): def generateParenthesis(self, n): if n == 1: return ['()'] last_list = self.generateParenthesis(n - 1) res = [] for t in last_list: curr = t + ')' for index in range(len(curr)): if curr[index] == ')': res.append(curr[:index] + '(' + curr[index:]) return list(set(res)) # def generateParenthesis(self, n): # def generate(leftnum, rightnum, s, result): # if leftnum == 0 and rightnum == 0: # result.append(s) # if leftnum > 0: # generate(leftnum - 1, rightnum, s + '(', result) # if rightnum > 0 and leftnum < rightnum: # generate(leftnum, rightnum - 1, s + ')', result) # # result = [] # s = '' # generate(n, n, s, result) # return result
# MIT License # # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. def pretty_dict(d, indent=0): """Pretty the output format of a dictionary. Parameters ---------- d dict, the input dictionary instance. indent int, indent level, non-negative. Returns ------- res str, the output string """ res = "" for k, v in d.items(): res += "\t" * indent + str(k) if isinstance(v, dict): res += "\n" + pretty_dict(v, indent + 1) else: res += ": " + str(v) + "\n" return res
print(10/3) print(10//3) print() kue = 16 anak = 4 kuePerAnak = kue // anak print ("Setiap anak akan mendapatkan kue sebanyak ", kuePerAnak)
class ExportUnit(Enum,IComparable,IFormattable,IConvertible): """ An enumerated type listing possible target units for CAD Export. enum ExportUnit,values: Centimeter (4),Default (0),Foot (2),Inch (1),Meter (5),Millimeter (3) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self,*args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self,*args): pass def __gt__(self,*args): pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self,*args): pass def __lt__(self,*args): pass def __ne__(self,*args): pass def __reduce_ex__(self,*args): pass def __str__(self,*args): pass Centimeter=None Default=None Foot=None Inch=None Meter=None Millimeter=None value__=None
while True: X, M = map(int, input().split()) if X == 0 and M == 0: break Y = X * M print(Y)
age = 5+(8%3)-3+(3*10)/2 greetings = "Welcome to IEEE Python Workshop 2018 edition. It's my pleasure to conduct today's workshop for you." name = "Saurabh Mudgal" major = "mechanical engineering" print(greetings) print("My name is " + name + ".") print("I am " + str(age) + " years old and am majoring in " + major + ".")
# -*- coding: utf-8 -*- __title__ = 'exp_mixture_model' __version__ = '1.0.0' __description__ = 'Maximum likelihood estimation and model selection of EMMs' __copyright__ = 'Copyright (C) 2019 Makoto Okada and Naoki Masuda' __license__ = 'MIT License' __author__ = 'Makoto Okada, Kenji Yamanishi and Naoki Masuda' __author_email__ = '[email protected]' __url__ = 'https://github.com/naokimas/exp_mixture_model'
class Product: def __init__(self, name, category_name, unit_price): self.name = name self.category_name = category_name self.unit_price = unit_price def __str__(self): return f"Nazwa: {self.name} | Kategoria: {self.category_name} | Cena: {self.unit_price} PLN/szt"
class Shape: def __init__(self): self.data = ['_' for _ in range(10)] def print_out(self): print(''.join(self.data)) class Even(Shape): def draw_func(self, x): if x % 2 == 0: return True else: return False class ThirdBiggerFive(Shape): def draw_func(self, x): if x % 3 == 0 or x > 5: return True else: return False def draw(Obj): o = Obj() for x in range(0, 10): if o.draw_func(x): o.data[x] = 'X' return o even = draw(Even) even.print_out() third = draw(ThirdBiggerFive) third.print_out()
#!/usr/bin/python3 # steinkirch at gmail.com # astro.sunysb.edu/steinkirch class Node(object): def __init__(self, value=None): self.value = value self.next = None class Stack(object): def __init__(self): self.top = None def push(self, item): node = Node(item) node.next = self.top self.top = node def pop(self): if self.top: node = self.top self.top = node.next return node.value raise Exception('Stack is empty.') def isEmpty(self): return bool(self.top) def seeTop(self): if self.top: return self.top.value raise Exception('Stack is empty.') def size(self): node = self.top count = 0 while node: count +=1 node = node.next return count class StackList(list): def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): if self.items: return self.items.pop() raise Exception('Stack is empty.') def seeTop(self): if self.items: return self.items[-1] raise Exception('Stack is empty.') def size(self): return len(self.items) def isEmpty(self): return bool(self.items) def main(): s1 = StackList() print(s1.isEmpty()) for i in range(1, 10): s1.push(i) print(s1.isEmpty()) print(s1.size()) print(s1.seeTop()) s1.pop() print(s1.size()) print(s1.seeTop()) s2 = Stack() print(s2.isEmpty()) for i in range(1, 10): s2.push(i) print(s2.isEmpty()) print(s2.size()) print(s2.seeTop()) s2.pop() print(s2.size()) print(s2.seeTop()) if __name__ == '__main__': main()
# coding: utf-8 def naive_square_matrix_product(A, B): """ Implementation of naive squre matrix multiplication algorithm """ n = len(A) C = [[0 for _ in range(n)] for _ in range(n)] for i in range(n): for j in range(n): for k in range(n): C[i][j] += A[i][k] * B[k][j] return C def print_mx(matrix): """ pretty print of matrix """ for line in matrix: print("\t".join(map(str, line))) def subtract(A, B): return [[x - y for x, y in zip(a, b)] for a, b in zip(A, B)] def add(A, B): return [[x + y for x, y in zip(a, b)] for a, b in zip(A, B)] def strassen_square_matrix_product(A, B, leaf_size=64): """ Implementation of the strassen algorithm for square matrixes""" n = len(A) # leaf size determine # the size of matrix when we start using naive square matrix product if n <= leaf_size: return naive_square_matrix_product(A, B) # initializing the new sub-matrices new_size = n // 2 a11 = list(map(lambda x: x[:new_size], A[:new_size])) # top left a12 = list(map(lambda x: x[new_size:], A[:new_size])) # top right a21 = list(map(lambda x: x[:new_size], A[new_size:])) # bottom left a22 = list(map(lambda x: x[new_size:], A[new_size:])) # bottom right b11 = list(map(lambda x: x[:new_size], B[:new_size])) # top left b12 = list(map(lambda x: x[new_size:], B[:new_size])) # top right b21 = list(map(lambda x: x[:new_size], B[new_size:])) # bottom left b22 = list(map(lambda x: x[new_size:], B[new_size:])) # bottom right # Calculating p1 to p7: # p1 = (a11) * (b12 - b22) p1 = strassen_square_matrix_product(a11, subtract(b12, b22)) # p2 = (a11 + a12) * (b22) p2 = strassen_square_matrix_product(add(a11, a12), b22) # p3 = (a21 + a22) * (b11) p3 = strassen_square_matrix_product(add(a21, a22), b11) # p4 = (a22) * (b21 - b11) p4 = strassen_square_matrix_product(a22, subtract(b21, b11)) # p5 = (a11 + a22) * (b11 + b22) p5 = strassen_square_matrix_product(add(a11, a22), add(b11, b22)) # p6 = (a12 - a22) * (b21 + b22) p6 = strassen_square_matrix_product(subtract(a12, a22), add(b21, b22)) # p7 = (a11 - a21) * (b11 + b12) p7 = strassen_square_matrix_product(subtract(a11, a21), add(b11, b12)) # calculating c11 to c22: # c11 = p5 + p4 - p2 + p6 c11 = add(subtract(add(p5, p4), p2), p6) # c12 = p1 + p2 c12 = add(p1, p2) # c21 = p3 + p4 c21 = add(p3, p4) # c22 = p5 + p1 - p3 - p7 c22 = subtract(subtract(add(p5, p1), p3), p7) cl = c11 + c21 cr = c12 + c22 return [cl[i] + cr[i] for i in range(len(cl))] if __name__ in "__main__": a = [[1, 2, 7, 0], [2, 3, 4, 2], [4, 5, 1, 0], [2, 6, 3, 8]] b = [[4, 5, 6, 1], [7, 6, 8, 0], [1, 0, 3, 6], [7, 4, 7, 5]] print('A:') print_mx(a) print('B:') print_mx(b) naive = naive_square_matrix_product(a, b) print('naive algorithm') print_mx(naive) print('Strassen algorithm') strassen = strassen_square_matrix_product(a, b) print_mx(strassen)
def lmap(f, it): return list(map(f, it)) def ints(it): return lmap(int, it) def solve(input): l = len(input.split()[0]) xs = lmap(lambda x: int(x, 2), input.split()) a = 0 for i in range(l): cnt = [0, 0] for x in xs: cnt[(x >> i) & 1] += 1 if cnt[1] > cnt[0]: a |= 1 << i return a * (~a & ((1 << l) - 1))
__author__ = 'Roman Morozov' def convert_name_extract(list_in: list) -> list: tmp: list = [] for i in list_in: i = i.title() name = i.rpartition(' ') tmp.append(f'Привет, {name[-1]}!') return tmp if __name__ == '__main__': example_list = ['инженер-конструктор Игорь', 'главный бухгалтер МАРИНА', 'токарь высшего разряда нИКОЛАй', 'директор аэлита'] result = convert_name_extract(example_list) print(result)
def cria_matriz(num_linhas, num_colunas): ''' (int, int) --> matriz (lista de listas) Cria e retorna uma matriz com num_linhas linhas e num_colunas colunas em que cada elemento é igual digitado pelo usuário. ''' matriz = [] # lista vazia for i in range(num_linhas): # cria a linha i linha = [] # lista vazia for j in range(num_colunas): valor = int(input("Digite o elemento [" + str(i) + "][" + str(j) + "]")) linha.append(valor) # adiciona linha à matriz matriz.append(linha) return matriz def le_matriz(): lin = int(input("Digite o número de linhas da matriz: ")) col = int(input("Digite o número de colunas da matriz: ")) return cria_matriz(lin, col) def exibir_matriz_separada(): matriz = le_matriz() for linha in matriz: print(linha) # i = 0 # while i < len(matriz): # print(matriz[i]) # i += 1 # for i in range(num_linhas): # for i in range(len(matriz)): # print(matriz[i])
#!/usr/bin/env python3 # # Author: # Tamas Jos (@skelsec) # PROCESS_QUERY_INFORMATION = 0x0400 PROCESS_VM_READ = 0x0010 PROCESS_VM_WRITE = 0x0020 PROCESS_VM_OPERATION = 0x0008 PROCESS_CREATE_THREAD = 0x0002 # Standard access rights DELETE = 0x00010000 READ_CONTROL = 0x00020000 WRITE_DAC = 0x00040000 WRITE_OWNER = 0x00080000 SYNCHRONIZE = 0x00100000 STANDARD_RIGHTS_REQUIRED = 0x000F0000 STANDARD_RIGHTS_READ = READ_CONTROL STANDARD_RIGHTS_WRITE = READ_CONTROL STANDARD_RIGHTS_EXECUTE = READ_CONTROL STANDARD_RIGHTS_ALL = 0x001F0000 SPECIFIC_RIGHTS_ALL = 0x0000FFFF #--- Constants ---------------------------------------------------------------- privnames = { "SE_ASSIGNPRIMARYTOKEN_NAME" : "SeAssignPrimaryTokenPrivilege", "SE_AUDIT_NAME" : "SeAuditPrivilege", "SE_BACKUP_NAME" : "SeBackupPrivilege", "SE_CHANGE_NOTIFY_NAME" : "SeChangeNotifyPrivilege", "SE_CREATE_GLOBAL_NAME" : "SeCreateGlobalPrivilege", "SE_CREATE_PAGEFILE_NAME" : "SeCreatePagefilePrivilege", "SE_CREATE_PERMANENT_NAME" : "SeCreatePermanentPrivilege", "SE_CREATE_SYMBOLIC_LINK_NAME" : "SeCreateSymbolicLinkPrivilege", "SE_CREATE_TOKEN_NAME" : "SeCreateTokenPrivilege", "SE_DEBUG_NAME" : "SeDebugPrivilege", "SE_ENABLE_DELEGATION_NAME" : "SeEnableDelegationPrivilege", "SE_IMPERSONATE_NAME" : "SeImpersonatePrivilege", "SE_INC_BASE_PRIORITY_NAME" : "SeIncreaseBasePriorityPrivilege", "SE_INCREASE_QUOTA_NAME" : "SeIncreaseQuotaPrivilege", "SE_INC_WORKING_SET_NAME" : "SeIncreaseWorkingSetPrivilege", "SE_LOAD_DRIVER_NAME" : "SeLoadDriverPrivilege", "SE_LOCK_MEMORY_NAME" : "SeLockMemoryPrivilege", "SE_MACHINE_ACCOUNT_NAME" : "SeMachineAccountPrivilege", "SE_MANAGE_VOLUME_NAME" : "SeManageVolumePrivilege", "SE_PROF_SINGLE_PROCESS_NAME" : "SeProfileSingleProcessPrivilege", "SE_RELABEL_NAME" : "SeRelabelPrivilege", "SE_REMOTE_SHUTDOWN_NAME" : "SeRemoteShutdownPrivilege", "SE_RESTORE_NAME" : "SeRestorePrivilege", "SE_SECURITY_NAME" : "SeSecurityPrivilege", "SE_SHUTDOWN_NAME" : "SeShutdownPrivilege", "SE_SYNC_AGENT_NAME" : "SeSyncAgentPrivilege", "SE_SYSTEM_ENVIRONMENT_NAME" : "SeSystemEnvironmentPrivilege", "SE_SYSTEM_PROFILE_NAME" : "SeSystemProfilePrivilege", "SE_SYSTEMTIME_NAME" : "SeSystemtimePrivilege", "SE_TAKE_OWNERSHIP_NAME" : "SeTakeOwnershipPrivilege", "SE_TCB_NAME" : "SeTcbPrivilege", "SE_TIME_ZONE_NAME" : "SeTimeZonePrivilege", "SE_TRUSTED_CREDMAN_ACCESS_NAME" : "SeTrustedCredManAccessPrivilege", "SE_UNDOCK_NAME" : "SeUndockPrivilege", "SE_UNSOLICITED_INPUT_NAME" : "SeUnsolicitedInputPrivilege" } # Privilege constants SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege" SE_AUDIT_NAME = "SeAuditPrivilege" SE_BACKUP_NAME = "SeBackupPrivilege" SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege" SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege" SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege" SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege" SE_CREATE_SYMBOLIC_LINK_NAME = "SeCreateSymbolicLinkPrivilege" SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege" SE_DEBUG_NAME = "SeDebugPrivilege" SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege" SE_IMPERSONATE_NAME = "SeImpersonatePrivilege" SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege" SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege" SE_INC_WORKING_SET_NAME = "SeIncreaseWorkingSetPrivilege" SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege" SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege" SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege" SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege" SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege" SE_RELABEL_NAME = "SeRelabelPrivilege" SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege" SE_RESTORE_NAME = "SeRestorePrivilege" SE_SECURITY_NAME = "SeSecurityPrivilege" SE_SHUTDOWN_NAME = "SeShutdownPrivilege" SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege" SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege" SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege" SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege" SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege" SE_TCB_NAME = "SeTcbPrivilege" SE_TIME_ZONE_NAME = "SeTimeZonePrivilege" SE_TRUSTED_CREDMAN_ACCESS_NAME = "SeTrustedCredManAccessPrivilege" SE_UNDOCK_NAME = "SeUndockPrivilege" SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege" SE_CREATE_TOKEN = 2 SE_ASSIGNPRIMARYTOKEN = 3 SE_LOCK_MEMORY=4 SE_INCREASE_QUOTA=5 SE_UNSOLICITED_INPUT=6 SE_TCB=7 SE_SECURITY=8 SE_TAKE_OWNERSHIP=9 SE_LOAD_DRIVER=10 SE_SYSTEM_PROFILE=11 SE_SYSTEMTIME=12 SE_PROF_SINGLE_PROCESS=13 SE_INC_BASE_PRIORITY=14 SE_CREATE_PAGEFILE=15 SE_CREATE_PERMANENT=16 SE_BACKUP=17 SE_RESTORE=18 SE_SHUTDOWN=19 SE_DEBUG=20 SE_AUDIT=21 SE_SYSTEM_ENVIRONMENT=22 SE_CHANGE_NOTIFY=23 SE_REMOTE_SHUTDOWN=24 SE_UNDOCK=25 SE_SYNC_AGENT=26 SE_ENABLE_DELEGATION=27 SE_MANAGE_VOLUME=28 SE_IMPERSONATE=29 SE_CREATE_GLOBAL=30 SE_TRUSTED_CREDMAN_ACCESS=31 SE_RELABEL=32 SE_INC_WORKING_SET=33 SE_TIME_ZONE=34 SE_CREATE_SYMBOLIC_LINK=35 SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001 SE_PRIVILEGE_ENABLED = 0x00000002 SE_PRIVILEGE_REMOVED = 0x00000004 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 TOKEN_ADJUST_PRIVILEGES = 0x00000020 LOGON_WITH_PROFILE = 0x00000001 LOGON_NETCREDENTIALS_ONLY = 0x00000002 # Token access rights TOKEN_ASSIGN_PRIMARY = 0x0001 TOKEN_DUPLICATE = 0x0002 TOKEN_IMPERSONATE = 0x0004 TOKEN_QUERY = 0x0008 TOKEN_QUERY_SOURCE = 0x0010 TOKEN_ADJUST_PRIVILEGES = 0x0020 TOKEN_ADJUST_GROUPS = 0x0040 TOKEN_ADJUST_DEFAULT = 0x0080 TOKEN_ADJUST_SESSIONID = 0x0100 TOKEN_READ = (STANDARD_RIGHTS_READ | TOKEN_QUERY) TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT | TOKEN_ADJUST_SESSIONID) #dont ask me... TOKEN_MANIP_ACCESS = (TOKEN_QUERY | TOKEN_READ | TOKEN_IMPERSONATE | TOKEN_QUERY_SOURCE | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY | (131072 | 4)) # typedef enum _SECURITY_IMPERSONATION_LEVEL { # SecurityAnonymous, # SecurityIdentification, # SecurityImpersonation, # SecurityDelegation # } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL; SecurityAnonymous = 0 SecurityIdentification = 1 SecurityImpersonation = 2 SecurityDelegation = 3 TokenPrimary = 1 TokenImpersonation = 2 # Predefined HKEY values HKEY_CLASSES_ROOT = 0x80000000 HKEY_CURRENT_USER = 0x80000001 HKEY_LOCAL_MACHINE = 0x80000002 HKEY_USERS = 0x80000003 HKEY_PERFORMANCE_DATA = 0x80000004 HKEY_CURRENT_CONFIG = 0x80000005 # Registry access rights KEY_ALL_ACCESS = 0xF003F KEY_CREATE_LINK = 0x0020 KEY_CREATE_SUB_KEY = 0x0004 KEY_ENUMERATE_SUB_KEYS = 0x0008 KEY_EXECUTE = 0x20019 KEY_NOTIFY = 0x0010 KEY_QUERY_VALUE = 0x0001 KEY_READ = 0x20019 KEY_SET_VALUE = 0x0002 KEY_WOW64_32KEY = 0x0200 KEY_WOW64_64KEY = 0x0100 KEY_WRITE = 0x20006 # Registry value types REG_NONE = 0 REG_SZ = 1 REG_EXPAND_SZ = 2 REG_BINARY = 3 REG_DWORD = 4 REG_DWORD_LITTLE_ENDIAN = REG_DWORD REG_DWORD_BIG_ENDIAN = 5 REG_LINK = 6 REG_MULTI_SZ = 7 REG_RESOURCE_LIST = 8 REG_FULL_RESOURCE_DESCRIPTOR = 9 REG_RESOURCE_REQUIREMENTS_LIST = 10 REG_QWORD = 11 REG_QWORD_LITTLE_ENDIAN = REG_QWORD
class Solution(object): def frequencySort(self, s): """ :type s: str :rtype: str """ d = collections.defaultdict(int) for c in s: d[c] += 1 l = [[-d[key],key] for key in d] l.sort() # print l res = ''.join([(-n)*c for n,c in l]) return res