content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
s: str = "" se: str = "" l: [int] = None le: int = 0 k: bool = False def f(): 1+"2" for k in l: 1+"2" for g in l: 1+"2" for f in l: 1+"2" for se in l: 1+"2" for l in s: 1+"2" for f in k: 1+"2"
s: str = '' se: str = '' l: [int] = None le: int = 0 k: bool = False def f(): 1 + '2' for k in l: 1 + '2' for g in l: 1 + '2' for f in l: 1 + '2' for se in l: 1 + '2' for l in s: 1 + '2' for f in k: 1 + '2'
# coding=utf8 SthWrong = (-1, 'Something Wrong') ArgMis = (-1000, 'Args Missing') ArgFormatInvalid = (-1001, 'Args Format Invalid') DataNotExists = (-2000, 'Data Not Exists')
sth_wrong = (-1, 'Something Wrong') arg_mis = (-1000, 'Args Missing') arg_format_invalid = (-1001, 'Args Format Invalid') data_not_exists = (-2000, 'Data Not Exists')
# Directory and File locations DATASETDIR = "driving_dataset/" MODELDIR = "save" MODELFILE = MODELDIR + "/model.ckpt" LOGDIR = "logs"
datasetdir = 'driving_dataset/' modeldir = 'save' modelfile = MODELDIR + '/model.ckpt' logdir = 'logs'
"""! @brief Cloud Tool for Yandex Disk service. @details The tool has been implemented to support CI infrastructure of pyclustering library. @authors Andrei Novikov (pyclustering@yandex.ru) @date 2014-2020 @copyright BSD-3-Clause """
"""! @brief Cloud Tool for Yandex Disk service. @details The tool has been implemented to support CI infrastructure of pyclustering library. @authors Andrei Novikov (pyclustering@yandex.ru) @date 2014-2020 @copyright BSD-3-Clause """
side1 = 12 side2 = 14 side3 = 124 if side1 == side2 and side2 == side3: print(1) elif side1 == side2 or side2 == side3 or side1 == side3: print(2) else: print(3)
side1 = 12 side2 = 14 side3 = 124 if side1 == side2 and side2 == side3: print(1) elif side1 == side2 or side2 == side3 or side1 == side3: print(2) else: print(3)
class RPCError(Exception): pass class ConsistencyError(Exception): pass class TermConsistencyError(ConsistencyError): def __init__(self, term: int): self.term = term class LeaderConsistencyError(ConsistencyError): def __init__(self, leader_id: bytes): self.leader_id = leader_id class EntriesConsistencyError(ConsistencyError): pass
class Rpcerror(Exception): pass class Consistencyerror(Exception): pass class Termconsistencyerror(ConsistencyError): def __init__(self, term: int): self.term = term class Leaderconsistencyerror(ConsistencyError): def __init__(self, leader_id: bytes): self.leader_id = leader_id class Entriesconsistencyerror(ConsistencyError): pass
#Card class to be imported by every program in repository #Ace value initialized to 11, can be changed to 1 in-game class Card: def __init__(self, suit_id, rank_id): self.suit_id = suit_id self.rank_id = rank_id if self.rank_id == 1: self.rank = "Ace" self.value = 11 elif self.rank_id == 11: self.rank = "Jack" self.value = 10 elif self.rank_id == 12: self.rank = "Queen" self.value = 10 elif self.rank_id == 13: self.rank = "King" self.value = 10 elif 2 <= self.rank_id <= 10: self.rank = str(self.rank_id) self.value = self.rank_id else: self.rank = "RankError" self.value = -1 if self.suit_id == 1: self.suit = "Hearts" self.symbol = "\u2665" elif self.suit_id == 2: self.suit = "Clubs" self.symbol = "\u2663" elif self.suit_id == 3: self.suit = "Spades" self.symbol = "\u2660" elif self.suit_id == 4: self.suit = "Diamonds" self.symbol = "\u2666" else: self.suit = "SuitError" self.full_name = f"{self.rank} of {self.suit}" if self.rank_id in (1, 11, 12, 13): self.short_name = self.rank[0] + self.symbol else: self.short_name = self.rank + self.symbol def __str__(self): return self.full_name
class Card: def __init__(self, suit_id, rank_id): self.suit_id = suit_id self.rank_id = rank_id if self.rank_id == 1: self.rank = 'Ace' self.value = 11 elif self.rank_id == 11: self.rank = 'Jack' self.value = 10 elif self.rank_id == 12: self.rank = 'Queen' self.value = 10 elif self.rank_id == 13: self.rank = 'King' self.value = 10 elif 2 <= self.rank_id <= 10: self.rank = str(self.rank_id) self.value = self.rank_id else: self.rank = 'RankError' self.value = -1 if self.suit_id == 1: self.suit = 'Hearts' self.symbol = '♥' elif self.suit_id == 2: self.suit = 'Clubs' self.symbol = '♣' elif self.suit_id == 3: self.suit = 'Spades' self.symbol = '♠' elif self.suit_id == 4: self.suit = 'Diamonds' self.symbol = '♦' else: self.suit = 'SuitError' self.full_name = f'{self.rank} of {self.suit}' if self.rank_id in (1, 11, 12, 13): self.short_name = self.rank[0] + self.symbol else: self.short_name = self.rank + self.symbol def __str__(self): return self.full_name
# find the maximum path sum. The path may start and end at any node in the tree. class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_sum_path(root): max_sum_path_util.res = -float('inf') max_sum_path_util(root) return max_sum_path_util.res def max_sum_path_util(root): if root is None: return 0 # find max sum in left and right sub tree left_sum = max_sum_path_util(root.left) right_sum = max_sum_path_util(root.right) # if current node is one of the nodes in the path above for max # it can either be along, or with left sub tree or right sub tree max_single = max(max(left_sum, right_sum) + root.data, root.data) # if the current root itself is considered as top node of the max path max_parent = max(left_sum + right_sum + root.data, max_single) # store the maximum result max_sum_path_util.res = max(max_sum_path_util.res, max_parent) # return the max_single for upper nodes calculation return max_single if __name__ == '__main__': root = Node(10) root.left = Node(2) root.right = Node(10) root.left.left = Node(20) root.left.right = Node(1) root.right.right = Node(-25) root.right.right.left = Node(3) root.right.right.right = Node(4) print('max path sum is:', max_sum_path(root))
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_sum_path(root): max_sum_path_util.res = -float('inf') max_sum_path_util(root) return max_sum_path_util.res def max_sum_path_util(root): if root is None: return 0 left_sum = max_sum_path_util(root.left) right_sum = max_sum_path_util(root.right) max_single = max(max(left_sum, right_sum) + root.data, root.data) max_parent = max(left_sum + right_sum + root.data, max_single) max_sum_path_util.res = max(max_sum_path_util.res, max_parent) return max_single if __name__ == '__main__': root = node(10) root.left = node(2) root.right = node(10) root.left.left = node(20) root.left.right = node(1) root.right.right = node(-25) root.right.right.left = node(3) root.right.right.right = node(4) print('max path sum is:', max_sum_path(root))
def buildGraphFromInput(): n = int(input()) graph = [] for i in range(n): x, y = [int(j) for j in input().split()] graph.append((x,y)) return graph def computeNumberOfNeighbors(graph): numberOfNeighbors = {} for x,y in graph: if not x in numberOfNeighbors: numberOfNeighbors[x] = 1 else: numberOfNeighbors[x] += 1 if not y in numberOfNeighbors: numberOfNeighbors[y] = 1 else: numberOfNeighbors[y] += 1 return numberOfNeighbors def computeMinHeight(graph): minHeight = 0 while graph: i = 0 numberOfNeighbors = computeNumberOfNeighbors(graph) numberOfVertices = len(graph) while i < numberOfVertices: x, y = graph[i] if numberOfNeighbors[x] == 1 or numberOfNeighbors[y] == 1: graph.pop(i) numberOfVertices -= 1 else: i += 1 minHeight += 1 return minHeight print(computeMinHeight(buildGraphFromInput()))
def build_graph_from_input(): n = int(input()) graph = [] for i in range(n): (x, y) = [int(j) for j in input().split()] graph.append((x, y)) return graph def compute_number_of_neighbors(graph): number_of_neighbors = {} for (x, y) in graph: if not x in numberOfNeighbors: numberOfNeighbors[x] = 1 else: numberOfNeighbors[x] += 1 if not y in numberOfNeighbors: numberOfNeighbors[y] = 1 else: numberOfNeighbors[y] += 1 return numberOfNeighbors def compute_min_height(graph): min_height = 0 while graph: i = 0 number_of_neighbors = compute_number_of_neighbors(graph) number_of_vertices = len(graph) while i < numberOfVertices: (x, y) = graph[i] if numberOfNeighbors[x] == 1 or numberOfNeighbors[y] == 1: graph.pop(i) number_of_vertices -= 1 else: i += 1 min_height += 1 return minHeight print(compute_min_height(build_graph_from_input()))
MES_LEVEL_INFO = 0 MES_LEVEL_WARN = 1 MES_LEVEL_ERROR = 2 _level = 0 _message = "" def set_mes(level, message): global _level global _message if message != "": _level = level _message = message def get_mes(): return _level, _message
mes_level_info = 0 mes_level_warn = 1 mes_level_error = 2 _level = 0 _message = '' def set_mes(level, message): global _level global _message if message != '': _level = level _message = message def get_mes(): return (_level, _message)
# # PySNMP MIB module IBM-INTERFACE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-INTERFACE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:51:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") enterprises, ObjectIdentity, Gauge32, iso, MibIdentifier, Integer32, ModuleIdentity, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks, Bits, Counter32, Counter64, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "enterprises", "ObjectIdentity", "Gauge32", "iso", "MibIdentifier", "Integer32", "ModuleIdentity", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks", "Bits", "Counter32", "Counter64", "IpAddress") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ibmIROCroutinginterface = MibIdentifier((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17)) ibminterfaceClearTable = MibTable((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1), ) if mibBuilder.loadTexts: ibminterfaceClearTable.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearTable.setDescription('A table allowing interface counters to be cleared.') ibminterfaceClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: ibminterfaceClearEntry.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearEntry.setDescription('Entry identifying a particular interface whose counters are to be cleared.') ibminterfaceClearInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearInOctets.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInOctets.setDescription('When SET to a value of clear(1), the counter of bytes received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearInUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearInUcastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInUcastPkts.setDescription('When SET to a value of clear(1), the counter of unicast packets received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearInMulticastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearInMulticastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInMulticastPkts.setDescription('When SET to a value of clear(1), the counter of multicast packets received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearInErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearInErrors.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInErrors.setDescription('When SET to a value of clear(1), the counters for all types of input errors are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearInAll = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearInAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInAll.setDescription('When SET to a value of clear(1), the counters for all input counters (byte, packet, error) are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearOutOctets.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutOctets.setDescription('When SET to a value of clear(1), the counter of bytes sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearOutUcastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearOutUcastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutUcastPkts.setDescription('When SET to a value of clear(1), the counter of unicast packets sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearOutMulticastPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearOutMulticastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutMulticastPkts.setDescription('When SET to a value of clear(1), the counter of multicast packets sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearOutErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearOutErrors.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutErrors.setDescription('When SET to a value of clear(1), the counters for all types of output errors are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearOutAll = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearOutAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutAll.setDescription('When SET to a value of clear(1), the counters for all output counters (byte, packet, error) are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearMaintTest = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearMaintTest.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearMaintTest.setDescription('When SET to a value of clear(1), the counters for self test pass, self test fail and maintenance fail are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearDeviceSpecific = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearDeviceSpecific.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearDeviceSpecific.setDescription('When SET to a value of clear(1), all the device specific counters are reset. For example, for an Ethernet interface, all the counters provided in the dot3StatsTable are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterfaceClearAll = MibTableColumn((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("noaction", 0), ("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ibminterfaceClearAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearAll.setDescription('When SET to a value of clear(1), all the reset actions performed by the MIB objects defined above are executed at once. This action has the same behavior as executing the CLEAR command from the T5 console prompt (+). When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') mibBuilder.exportSymbols("IBM-INTERFACE-MIB", ibminterfaceClearInAll=ibminterfaceClearInAll, ibminterfaceClearTable=ibminterfaceClearTable, ibminterfaceClearEntry=ibminterfaceClearEntry, ibminterfaceClearInMulticastPkts=ibminterfaceClearInMulticastPkts, ibminterfaceClearInErrors=ibminterfaceClearInErrors, ibminterfaceClearOutOctets=ibminterfaceClearOutOctets, ibmIROCroutinginterface=ibmIROCroutinginterface, ibminterfaceClearInOctets=ibminterfaceClearInOctets, ibminterfaceClearOutMulticastPkts=ibminterfaceClearOutMulticastPkts, ibminterfaceClearMaintTest=ibminterfaceClearMaintTest, ibminterfaceClearOutUcastPkts=ibminterfaceClearOutUcastPkts, ibminterfaceClearOutErrors=ibminterfaceClearOutErrors, ibminterfaceClearOutAll=ibminterfaceClearOutAll, ibminterfaceClearInUcastPkts=ibminterfaceClearInUcastPkts, ibminterfaceClearAll=ibminterfaceClearAll, ibminterfaceClearDeviceSpecific=ibminterfaceClearDeviceSpecific)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (enterprises, object_identity, gauge32, iso, mib_identifier, integer32, module_identity, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, time_ticks, bits, counter32, counter64, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'enterprises', 'ObjectIdentity', 'Gauge32', 'iso', 'MibIdentifier', 'Integer32', 'ModuleIdentity', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'TimeTicks', 'Bits', 'Counter32', 'Counter64', 'IpAddress') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') ibm_iro_croutinginterface = mib_identifier((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17)) ibminterface_clear_table = mib_table((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1)) if mibBuilder.loadTexts: ibminterfaceClearTable.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearTable.setDescription('A table allowing interface counters to be cleared.') ibminterface_clear_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: ibminterfaceClearEntry.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearEntry.setDescription('Entry identifying a particular interface whose counters are to be cleared.') ibminterface_clear_in_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearInOctets.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInOctets.setDescription('When SET to a value of clear(1), the counter of bytes received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_in_ucast_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearInUcastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInUcastPkts.setDescription('When SET to a value of clear(1), the counter of unicast packets received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_in_multicast_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearInMulticastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInMulticastPkts.setDescription('When SET to a value of clear(1), the counter of multicast packets received over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_in_errors = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearInErrors.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInErrors.setDescription('When SET to a value of clear(1), the counters for all types of input errors are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_in_all = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearInAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearInAll.setDescription('When SET to a value of clear(1), the counters for all input counters (byte, packet, error) are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_out_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearOutOctets.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutOctets.setDescription('When SET to a value of clear(1), the counter of bytes sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_out_ucast_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearOutUcastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutUcastPkts.setDescription('When SET to a value of clear(1), the counter of unicast packets sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_out_multicast_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearOutMulticastPkts.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutMulticastPkts.setDescription('When SET to a value of clear(1), the counter of multicast packets sent over this interface is reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_out_errors = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearOutErrors.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutErrors.setDescription('When SET to a value of clear(1), the counters for all types of output errors are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_out_all = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearOutAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearOutAll.setDescription('When SET to a value of clear(1), the counters for all output counters (byte, packet, error) are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_maint_test = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearMaintTest.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearMaintTest.setDescription('When SET to a value of clear(1), the counters for self test pass, self test fail and maintenance fail are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_device_specific = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearDeviceSpecific.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearDeviceSpecific.setDescription('When SET to a value of clear(1), all the device specific counters are reset. For example, for an Ethernet interface, all the counters provided in the dot3StatsTable are reset. When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') ibminterface_clear_all = mib_table_column((1, 3, 6, 1, 4, 1, 2, 6, 119, 4, 17, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('noaction', 0), ('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ibminterfaceClearAll.setStatus('mandatory') if mibBuilder.loadTexts: ibminterfaceClearAll.setDescription('When SET to a value of clear(1), all the reset actions performed by the MIB objects defined above are executed at once. This action has the same behavior as executing the CLEAR command from the T5 console prompt (+). When READ, this object always returns a value of noaction(0), since this object is intended as a trigger, rather than providing information.') mibBuilder.exportSymbols('IBM-INTERFACE-MIB', ibminterfaceClearInAll=ibminterfaceClearInAll, ibminterfaceClearTable=ibminterfaceClearTable, ibminterfaceClearEntry=ibminterfaceClearEntry, ibminterfaceClearInMulticastPkts=ibminterfaceClearInMulticastPkts, ibminterfaceClearInErrors=ibminterfaceClearInErrors, ibminterfaceClearOutOctets=ibminterfaceClearOutOctets, ibmIROCroutinginterface=ibmIROCroutinginterface, ibminterfaceClearInOctets=ibminterfaceClearInOctets, ibminterfaceClearOutMulticastPkts=ibminterfaceClearOutMulticastPkts, ibminterfaceClearMaintTest=ibminterfaceClearMaintTest, ibminterfaceClearOutUcastPkts=ibminterfaceClearOutUcastPkts, ibminterfaceClearOutErrors=ibminterfaceClearOutErrors, ibminterfaceClearOutAll=ibminterfaceClearOutAll, ibminterfaceClearInUcastPkts=ibminterfaceClearInUcastPkts, ibminterfaceClearAll=ibminterfaceClearAll, ibminterfaceClearDeviceSpecific=ibminterfaceClearDeviceSpecific)
name = "btclib" __version__ = "2020.12" __author__ = "The btclib developers" __author_email__ = "devs@btclib.org" __copyright__ = "Copyright (C) 2017-2020 The btclib developers" __license__ = "MIT License"
name = 'btclib' __version__ = '2020.12' __author__ = 'The btclib developers' __author_email__ = 'devs@btclib.org' __copyright__ = 'Copyright (C) 2017-2020 The btclib developers' __license__ = 'MIT License'
class Sentinel(object): """Unique placeholders for signals""" def __init__(self, name=None): self.name = name def __eq__(self, other): return other is self def __hash__(self): return id(self) def __str__(self): if self.name is not None: return str(self.name) return repr(self) def __repr__(self): if self.name is not None: return '<%s %r at 0x%x>' % (self.__class__.__name__, self.name, id(self)) return '<%s at 0x%x>' % (self.__class__.__name__, id(self))
class Sentinel(object): """Unique placeholders for signals""" def __init__(self, name=None): self.name = name def __eq__(self, other): return other is self def __hash__(self): return id(self) def __str__(self): if self.name is not None: return str(self.name) return repr(self) def __repr__(self): if self.name is not None: return '<%s %r at 0x%x>' % (self.__class__.__name__, self.name, id(self)) return '<%s at 0x%x>' % (self.__class__.__name__, id(self))
# # PySNMP MIB module RARITANCCv2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RARITANCCv2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:43:46 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, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") internet, Bits, MibIdentifier, Counter64, IpAddress, Counter32, TimeTicks, Unsigned32, mgmt, Integer32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, ObjectIdentity, NotificationType, Gauge32, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "internet", "Bits", "MibIdentifier", "Counter64", "IpAddress", "Counter32", "TimeTicks", "Unsigned32", "mgmt", "Integer32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "ObjectIdentity", "NotificationType", "Gauge32", "enterprises") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") raritan = ModuleIdentity((1, 3, 6, 1, 4, 1, 13742)) raritan.setRevisions(('2011-04-11 11:08',)) if mibBuilder.loadTexts: raritan.setLastUpdated('201104111108Z') if mibBuilder.loadTexts: raritan.setOrganization('Raritan Inc.') products = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 1)) enterpriseManagement = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 1, 1)) commandCenter = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1)) ccObject = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0)) ccNotify = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1)) ccObjectName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccObjectName.setStatus('current') ccObjectInstance = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccObjectInstance.setStatus('current') ccUserName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserName.setStatus('current') ccUserSessionId = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserSessionId.setStatus('current') ccUserNameInitiated = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserNameInitiated.setStatus('current') ccUserNameTerminated = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 6), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserNameTerminated.setStatus('current') ccImageType = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 7), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccImageType.setStatus('current') ccImageVersion = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 8), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccImageVersion.setStatus('current') ccImageVersionStatus = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("success", 1), ("failure", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccImageVersionStatus.setStatus('current') ccUserWhoAdded = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 10), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserWhoAdded.setStatus('current') ccUserWhoDeleted = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 11), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserWhoDeleted.setStatus('current') ccUserWhoModified = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 12), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserWhoModified.setStatus('current') ccNodeName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 13), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccNodeName.setStatus('current') ccLanCard = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("primary", 1), ("backup", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLanCard.setStatus('current') ccHardDisk = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("primary", 1), ("backup", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccHardDisk.setStatus('current') ccSessionType = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("serial", 1), ("kvm", 2), ("powerOutlet", 3), ("admin", 4), ("diagnostics", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccSessionType.setStatus('current') ccClusterState = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("primary", 1), ("secondary", 2), ("standAlone", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccClusterState.setStatus('current') ccLeafNodeName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 18), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLeafNodeName.setStatus('current') ccLeafNodeIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 19), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLeafNodeIPAddress.setStatus('current') ccLeafNodeFirmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 20), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLeafNodeFirmwareVersion.setStatus('current') ccScheduledTaskDescription = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 21), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccScheduledTaskDescription.setStatus('current') ccScheduledTaskFailureReason = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 22), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccScheduledTaskFailureReason.setStatus('current') ccDiagnosticConsoleMAX_ACCESSLevel = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 23), DisplayString()).setLabel("ccDiagnosticConsoleMAX-ACCESSLevel").setMaxAccess("readwrite") if mibBuilder.loadTexts: ccDiagnosticConsoleMAX_ACCESSLevel.setStatus('current') ccDeviceName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 24), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccDeviceName.setStatus('current') ccUserGroupName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 25), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccUserGroupName.setStatus('current') ccBannerChanges = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("modified", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccBannerChanges.setStatus('current') ccMOTDChanges = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("modified", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccMOTDChanges.setStatus('current') ccOldNumberOfOutlets = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 28), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccOldNumberOfOutlets.setStatus('current') ccNewNumberOfOutlets = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 29), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccNewNumberOfOutlets.setStatus('current') ccSystemMonitorNotificationLevel = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 30), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccSystemMonitorNotificationLevel.setStatus('current') ccSystemMonitorNotificationMessage = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 31), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccSystemMonitorNotificationMessage.setStatus('current') ccDominionPXFirmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 32), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccDominionPXFirmwareVersion.setStatus('current') ccClusterPeer = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 33), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccClusterPeer.setStatus('current') ccClusterOperation = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 34), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccClusterOperation.setStatus('current') ccClusterOperationStatus = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("success", 1), ("failure", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccClusterOperationStatus.setStatus('current') ccTransferOperation = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 36), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("export", 1), ("import", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccTransferOperation.setStatus('current') ccFileType = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 37), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccFileType.setStatus('current') ccLicensedFeature = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 38), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLicensedFeature.setStatus('current') ccLicenseServer = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 39), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLicenseServer.setStatus('current') ccPortName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 41), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccPortName.setStatus('current') ccLicenseTerminatedReason = MibScalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 40), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ccLicenseTerminatedReason.setStatus('current') ccUnavailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 1)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccClusterState")) if mibBuilder.loadTexts: ccUnavailable.setStatus('current') ccAvailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 2)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccClusterState")) if mibBuilder.loadTexts: ccAvailable.setStatus('current') ccUserLogin = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 3)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccUserLogin.setStatus('current') ccUserLogout = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 4)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccUserLogout.setStatus('current') ccSPortConnectionStarted = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 5)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccSessionType"), ("RARITANCCv2-MIB", "ccUserSessionId"), ("RARITANCCv2-MIB", "ccNodeName"), ("RARITANCCv2-MIB", "ccPortName")) if mibBuilder.loadTexts: ccSPortConnectionStarted.setStatus('current') ccPortConnectionStopped = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 6)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccSessionType"), ("RARITANCCv2-MIB", "ccUserSessionId"), ("RARITANCCv2-MIB", "ccNodeName"), ("RARITANCCv2-MIB", "ccPortName")) if mibBuilder.loadTexts: ccPortConnectionStopped.setStatus('current') ccPortConnectionTerminated = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 7)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserNameInitiated"), ("RARITANCCv2-MIB", "ccUserNameTerminated"), ("RARITANCCv2-MIB", "ccSessionType"), ("RARITANCCv2-MIB", "ccUserSessionId"), ("RARITANCCv2-MIB", "ccNodeName"), ("RARITANCCv2-MIB", "ccPortName")) if mibBuilder.loadTexts: ccPortConnectionTerminated.setStatus('current') ccImageUpgradeStarted = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 8)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccImageType"), ("RARITANCCv2-MIB", "ccImageVersion")) if mibBuilder.loadTexts: ccImageUpgradeStarted.setStatus('current') ccImageUpgradeResults = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 9)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccImageType"), ("RARITANCCv2-MIB", "ccImageVersion"), ("RARITANCCv2-MIB", "ccImageVersionStatus")) if mibBuilder.loadTexts: ccImageUpgradeResults.setStatus('current') ccUserAdded = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 10)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccUserWhoAdded")) if mibBuilder.loadTexts: ccUserAdded.setStatus('current') ccUserDeleted = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 11)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccUserWhoDeleted")) if mibBuilder.loadTexts: ccUserDeleted.setStatus('current') ccUserModified = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 12)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccUserModified.setStatus('current') ccUserAuthenticationFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 13)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccUserAuthenticationFailure.setStatus('current') ccRootPasswordChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 14)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccRootPasswordChanged.setStatus('current') ccLanCardFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 15)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLanCard"), ("RARITANCCv2-MIB", "ccClusterState")) if mibBuilder.loadTexts: ccLanCardFailure.setStatus('current') ccHardDiskFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 16)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccHardDisk"), ("RARITANCCv2-MIB", "ccClusterState")) if mibBuilder.loadTexts: ccHardDiskFailure.setStatus('current') ccLeafNodeUnavailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 17)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccLeafNodeUnavailable.setStatus('current') ccLeafNodeAvailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 18)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccLeafNodeAvailable.setStatus('current') ccIncompatibleDeviceFirmware = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 19)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress"), ("RARITANCCv2-MIB", "ccLeafNodeFirmwareVersion")) if mibBuilder.loadTexts: ccIncompatibleDeviceFirmware.setStatus('current') ccDeviceUpgrade = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 20)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress"), ("RARITANCCv2-MIB", "ccLeafNodeFirmwareVersion"), ("RARITANCCv2-MIB", "ccImageVersionStatus")) if mibBuilder.loadTexts: ccDeviceUpgrade.setStatus('current') ccEnterMaintenanceMode = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 21)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccEnterMaintenanceMode.setStatus('current') ccExitMaintenanceMode = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 22)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccExitMaintenanceMode.setStatus('current') ccUserLockedOut = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 23)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName")) if mibBuilder.loadTexts: ccUserLockedOut.setStatus('current') ccDeviceAddedAfterCCNOCNotification = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 24)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccDeviceName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccDeviceAddedAfterCCNOCNotification.setStatus('current') ccScheduledTaskExecutionFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 25)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccScheduledTaskDescription"), ("RARITANCCv2-MIB", "ccScheduledTaskFailureReason")) if mibBuilder.loadTexts: ccScheduledTaskExecutionFailure.setStatus('current') ccDiagnosticConsoleLogin = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 26)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccDiagnosticConsoleMAX_ACCESSLevel")) if mibBuilder.loadTexts: ccDiagnosticConsoleLogin.setStatus('current') ccDiagnosticConsoleLogout = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 27)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccDiagnosticConsoleMAX_ACCESSLevel")) if mibBuilder.loadTexts: ccDiagnosticConsoleLogout.setStatus('current') ccNOCAvailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 28)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccNOCAvailable.setStatus('current') ccNOCUnavailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 29)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccNOCUnavailable.setStatus('current') ccUserGroupAdded = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 30)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserGroupName"), ("RARITANCCv2-MIB", "ccUserWhoAdded")) if mibBuilder.loadTexts: ccUserGroupAdded.setStatus('current') ccUserGroupDeleted = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 31)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserGroupName"), ("RARITANCCv2-MIB", "ccUserWhoDeleted")) if mibBuilder.loadTexts: ccUserGroupDeleted.setStatus('current') ccUserGroupModified = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 32)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserGroupName"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccUserGroupModified.setStatus('current') ccSuperuserNameChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 33)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccSuperuserNameChanged.setStatus('current') ccSuperuserPasswordChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 34)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccSuperuserPasswordChanged.setStatus('current') ccLoginBannerChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 35)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserWhoModified"), ("RARITANCCv2-MIB", "ccBannerChanges")) if mibBuilder.loadTexts: ccLoginBannerChanged.setStatus('current') ccMOTDChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 36)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserWhoModified"), ("RARITANCCv2-MIB", "ccMOTDChanges")) if mibBuilder.loadTexts: ccMOTDChanged.setStatus('current') ccDominionPXReplaced = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 37)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccOldNumberOfOutlets"), ("RARITANCCv2-MIB", "ccNewNumberOfOutlets")) if mibBuilder.loadTexts: ccDominionPXReplaced.setStatus('current') ccSystemMonitorNotification = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 38)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccSystemMonitorNotificationLevel"), ("RARITANCCv2-MIB", "ccSystemMonitorNotificationMessage")) if mibBuilder.loadTexts: ccSystemMonitorNotification.setStatus('current') ccNeighborhoodActivated = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 39)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance")) if mibBuilder.loadTexts: ccNeighborhoodActivated.setStatus('current') ccNeighborhoodUpdated = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 40)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance")) if mibBuilder.loadTexts: ccNeighborhoodUpdated.setStatus('current') ccDominionPXFirmwareChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 41)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccDominionPXFirmwareVersion")) if mibBuilder.loadTexts: ccDominionPXFirmwareChanged.setStatus('current') ccClusterFailover = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 42)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccClusterPeer")) if mibBuilder.loadTexts: ccClusterFailover.setStatus('current') ccClusterBackupFailed = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 43)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccClusterPeer")) if mibBuilder.loadTexts: ccClusterBackupFailed.setStatus('current') ccClusterWaitingPeerDetected = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 44)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccClusterPeer")) if mibBuilder.loadTexts: ccClusterWaitingPeerDetected.setStatus('current') ccClusterAction = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 45)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccClusterOperation"), ("RARITANCCv2-MIB", "ccClusterOperationStatus")) if mibBuilder.loadTexts: ccClusterAction.setStatus('current') ccCSVFileTransferred = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 46)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccFileType"), ("RARITANCCv2-MIB", "ccTransferOperation")) if mibBuilder.loadTexts: ccCSVFileTransferred.setStatus('current') ccPIQUnavailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 47)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccPIQUnavailable.setStatus('current') ccPIQAvailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 48)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLeafNodeName"), ("RARITANCCv2-MIB", "ccLeafNodeIPAddress")) if mibBuilder.loadTexts: ccPIQAvailable.setStatus('current') ccLicenseServerUnavailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 49)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLicenseServer")) if mibBuilder.loadTexts: ccLicenseServerUnavailable.setStatus('current') ccLicenseServerFailover = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 50)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLicenseServer")) if mibBuilder.loadTexts: ccLicenseServerFailover.setStatus('current') ccLicenseServerAvailable = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 51)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLicenseServer")) if mibBuilder.loadTexts: ccLicenseServerAvailable.setStatus('current') ccLicenseTerminated = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 52)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance")) if mibBuilder.loadTexts: ccLicenseTerminated.setStatus('current') ccAddLicenseFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 53)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance")) if mibBuilder.loadTexts: ccAddLicenseFailure.setStatus('current') ccAddFeatureFailure = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 54)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLicensedFeature")) if mibBuilder.loadTexts: ccAddFeatureFailure.setStatus('current') ccLicenseTerminatedWithReason = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 55)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccLicenseTerminatedReason")) if mibBuilder.loadTexts: ccLicenseTerminatedWithReason.setStatus('current') ccUserPasswordChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 56)).setObjects(("RARITANCCv2-MIB", "ccObjectName"), ("RARITANCCv2-MIB", "ccObjectInstance"), ("RARITANCCv2-MIB", "ccUserName"), ("RARITANCCv2-MIB", "ccUserWhoModified")) if mibBuilder.loadTexts: ccUserPasswordChanged.setStatus('current') mibBuilder.exportSymbols("RARITANCCv2-MIB", ccNeighborhoodUpdated=ccNeighborhoodUpdated, ccNeighborhoodActivated=ccNeighborhoodActivated, ccUserAdded=ccUserAdded, ccMOTDChanges=ccMOTDChanges, ccLicenseServerFailover=ccLicenseServerFailover, ccMOTDChanged=ccMOTDChanged, ccUserWhoDeleted=ccUserWhoDeleted, ccEnterMaintenanceMode=ccEnterMaintenanceMode, ccClusterState=ccClusterState, ccNOCAvailable=ccNOCAvailable, ccSessionType=ccSessionType, ccUserGroupModified=ccUserGroupModified, ccTransferOperation=ccTransferOperation, ccUserAuthenticationFailure=ccUserAuthenticationFailure, ccUserNameInitiated=ccUserNameInitiated, ccLanCard=ccLanCard, ccLeafNodeFirmwareVersion=ccLeafNodeFirmwareVersion, ccDeviceUpgrade=ccDeviceUpgrade, ccDiagnosticConsoleMAX_ACCESSLevel=ccDiagnosticConsoleMAX_ACCESSLevel, ccClusterWaitingPeerDetected=ccClusterWaitingPeerDetected, ccScheduledTaskFailureReason=ccScheduledTaskFailureReason, ccSystemMonitorNotificationMessage=ccSystemMonitorNotificationMessage, ccFileType=ccFileType, ccDeviceAddedAfterCCNOCNotification=ccDeviceAddedAfterCCNOCNotification, ccUserName=ccUserName, ccObject=ccObject, ccClusterOperation=ccClusterOperation, ccDominionPXFirmwareVersion=ccDominionPXFirmwareVersion, ccClusterFailover=ccClusterFailover, ccClusterPeer=ccClusterPeer, ccImageUpgradeResults=ccImageUpgradeResults, ccLicenseServerAvailable=ccLicenseServerAvailable, ccLeafNodeName=ccLeafNodeName, ccAvailable=ccAvailable, ccObjectInstance=ccObjectInstance, ccIncompatibleDeviceFirmware=ccIncompatibleDeviceFirmware, ccUserGroupAdded=ccUserGroupAdded, ccUnavailable=ccUnavailable, ccSuperuserNameChanged=ccSuperuserNameChanged, ccPIQUnavailable=ccPIQUnavailable, ccUserWhoModified=ccUserWhoModified, ccLicenseTerminated=ccLicenseTerminated, ccNewNumberOfOutlets=ccNewNumberOfOutlets, ccUserPasswordChanged=ccUserPasswordChanged, commandCenter=commandCenter, ccHardDisk=ccHardDisk, products=products, ccPortConnectionTerminated=ccPortConnectionTerminated, ccDominionPXFirmwareChanged=ccDominionPXFirmwareChanged, ccDeviceName=ccDeviceName, enterpriseManagement=enterpriseManagement, ccImageVersion=ccImageVersion, ccClusterOperationStatus=ccClusterOperationStatus, ccNOCUnavailable=ccNOCUnavailable, ccUserGroupName=ccUserGroupName, ccLoginBannerChanged=ccLoginBannerChanged, ccSuperuserPasswordChanged=ccSuperuserPasswordChanged, ccObjectName=ccObjectName, ccCSVFileTransferred=ccCSVFileTransferred, ccUserLogout=ccUserLogout, ccOldNumberOfOutlets=ccOldNumberOfOutlets, ccUserModified=ccUserModified, ccImageType=ccImageType, ccUserGroupDeleted=ccUserGroupDeleted, ccNotify=ccNotify, ccSystemMonitorNotificationLevel=ccSystemMonitorNotificationLevel, ccUserLockedOut=ccUserLockedOut, ccPortConnectionStopped=ccPortConnectionStopped, ccDiagnosticConsoleLogin=ccDiagnosticConsoleLogin, ccLeafNodeAvailable=ccLeafNodeAvailable, ccLicensedFeature=ccLicensedFeature, ccPIQAvailable=ccPIQAvailable, ccUserNameTerminated=ccUserNameTerminated, PYSNMP_MODULE_ID=raritan, ccHardDiskFailure=ccHardDiskFailure, ccNodeName=ccNodeName, raritan=raritan, ccSPortConnectionStarted=ccSPortConnectionStarted, ccImageUpgradeStarted=ccImageUpgradeStarted, ccUserLogin=ccUserLogin, ccExitMaintenanceMode=ccExitMaintenanceMode, ccLeafNodeIPAddress=ccLeafNodeIPAddress, ccRootPasswordChanged=ccRootPasswordChanged, ccScheduledTaskExecutionFailure=ccScheduledTaskExecutionFailure, ccUserWhoAdded=ccUserWhoAdded, ccLicenseTerminatedReason=ccLicenseTerminatedReason, ccBannerChanges=ccBannerChanges, ccAddFeatureFailure=ccAddFeatureFailure, ccClusterAction=ccClusterAction, ccDiagnosticConsoleLogout=ccDiagnosticConsoleLogout, ccUserDeleted=ccUserDeleted, ccScheduledTaskDescription=ccScheduledTaskDescription, ccLicenseServer=ccLicenseServer, ccClusterBackupFailed=ccClusterBackupFailed, ccImageVersionStatus=ccImageVersionStatus, ccLeafNodeUnavailable=ccLeafNodeUnavailable, ccPortName=ccPortName, ccUserSessionId=ccUserSessionId, ccLicenseServerUnavailable=ccLicenseServerUnavailable, ccLicenseTerminatedWithReason=ccLicenseTerminatedWithReason, ccDominionPXReplaced=ccDominionPXReplaced, ccSystemMonitorNotification=ccSystemMonitorNotification, ccLanCardFailure=ccLanCardFailure, ccAddLicenseFailure=ccAddLicenseFailure)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (internet, bits, mib_identifier, counter64, ip_address, counter32, time_ticks, unsigned32, mgmt, integer32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, object_identity, notification_type, gauge32, enterprises) = mibBuilder.importSymbols('SNMPv2-SMI', 'internet', 'Bits', 'MibIdentifier', 'Counter64', 'IpAddress', 'Counter32', 'TimeTicks', 'Unsigned32', 'mgmt', 'Integer32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'ObjectIdentity', 'NotificationType', 'Gauge32', 'enterprises') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') raritan = module_identity((1, 3, 6, 1, 4, 1, 13742)) raritan.setRevisions(('2011-04-11 11:08',)) if mibBuilder.loadTexts: raritan.setLastUpdated('201104111108Z') if mibBuilder.loadTexts: raritan.setOrganization('Raritan Inc.') products = mib_identifier((1, 3, 6, 1, 4, 1, 13742, 1)) enterprise_management = mib_identifier((1, 3, 6, 1, 4, 1, 13742, 1, 1)) command_center = mib_identifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1)) cc_object = mib_identifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0)) cc_notify = mib_identifier((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1)) cc_object_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 1), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccObjectName.setStatus('current') cc_object_instance = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 2), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccObjectInstance.setStatus('current') cc_user_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 3), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserName.setStatus('current') cc_user_session_id = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 4), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserSessionId.setStatus('current') cc_user_name_initiated = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 5), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserNameInitiated.setStatus('current') cc_user_name_terminated = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 6), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserNameTerminated.setStatus('current') cc_image_type = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 7), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccImageType.setStatus('current') cc_image_version = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 8), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccImageVersion.setStatus('current') cc_image_version_status = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('success', 1), ('failure', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccImageVersionStatus.setStatus('current') cc_user_who_added = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 10), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserWhoAdded.setStatus('current') cc_user_who_deleted = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 11), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserWhoDeleted.setStatus('current') cc_user_who_modified = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 12), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserWhoModified.setStatus('current') cc_node_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 13), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccNodeName.setStatus('current') cc_lan_card = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('primary', 1), ('backup', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLanCard.setStatus('current') cc_hard_disk = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('primary', 1), ('backup', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccHardDisk.setStatus('current') cc_session_type = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('serial', 1), ('kvm', 2), ('powerOutlet', 3), ('admin', 4), ('diagnostics', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccSessionType.setStatus('current') cc_cluster_state = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 17), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('primary', 1), ('secondary', 2), ('standAlone', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccClusterState.setStatus('current') cc_leaf_node_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 18), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLeafNodeName.setStatus('current') cc_leaf_node_ip_address = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 19), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLeafNodeIPAddress.setStatus('current') cc_leaf_node_firmware_version = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 20), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLeafNodeFirmwareVersion.setStatus('current') cc_scheduled_task_description = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 21), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccScheduledTaskDescription.setStatus('current') cc_scheduled_task_failure_reason = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 22), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccScheduledTaskFailureReason.setStatus('current') cc_diagnostic_console_max_access_level = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 23), display_string()).setLabel('ccDiagnosticConsoleMAX-ACCESSLevel').setMaxAccess('readwrite') if mibBuilder.loadTexts: ccDiagnosticConsoleMAX_ACCESSLevel.setStatus('current') cc_device_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 24), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccDeviceName.setStatus('current') cc_user_group_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 25), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccUserGroupName.setStatus('current') cc_banner_changes = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2), ('modified', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccBannerChanges.setStatus('current') cc_motd_changes = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 27), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2), ('modified', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccMOTDChanges.setStatus('current') cc_old_number_of_outlets = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 28), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccOldNumberOfOutlets.setStatus('current') cc_new_number_of_outlets = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 29), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccNewNumberOfOutlets.setStatus('current') cc_system_monitor_notification_level = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 30), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccSystemMonitorNotificationLevel.setStatus('current') cc_system_monitor_notification_message = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 31), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccSystemMonitorNotificationMessage.setStatus('current') cc_dominion_px_firmware_version = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 32), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccDominionPXFirmwareVersion.setStatus('current') cc_cluster_peer = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 33), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccClusterPeer.setStatus('current') cc_cluster_operation = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 34), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccClusterOperation.setStatus('current') cc_cluster_operation_status = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 35), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('success', 1), ('failure', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccClusterOperationStatus.setStatus('current') cc_transfer_operation = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 36), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('export', 1), ('import', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccTransferOperation.setStatus('current') cc_file_type = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 37), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccFileType.setStatus('current') cc_licensed_feature = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 38), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLicensedFeature.setStatus('current') cc_license_server = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 39), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLicenseServer.setStatus('current') cc_port_name = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 41), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccPortName.setStatus('current') cc_license_terminated_reason = mib_scalar((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 0, 40), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: ccLicenseTerminatedReason.setStatus('current') cc_unavailable = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 1)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccClusterState')) if mibBuilder.loadTexts: ccUnavailable.setStatus('current') cc_available = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 2)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccClusterState')) if mibBuilder.loadTexts: ccAvailable.setStatus('current') cc_user_login = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 3)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccUserLogin.setStatus('current') cc_user_logout = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 4)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccUserLogout.setStatus('current') cc_s_port_connection_started = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 5)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccSessionType'), ('RARITANCCv2-MIB', 'ccUserSessionId'), ('RARITANCCv2-MIB', 'ccNodeName'), ('RARITANCCv2-MIB', 'ccPortName')) if mibBuilder.loadTexts: ccSPortConnectionStarted.setStatus('current') cc_port_connection_stopped = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 6)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccSessionType'), ('RARITANCCv2-MIB', 'ccUserSessionId'), ('RARITANCCv2-MIB', 'ccNodeName'), ('RARITANCCv2-MIB', 'ccPortName')) if mibBuilder.loadTexts: ccPortConnectionStopped.setStatus('current') cc_port_connection_terminated = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 7)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserNameInitiated'), ('RARITANCCv2-MIB', 'ccUserNameTerminated'), ('RARITANCCv2-MIB', 'ccSessionType'), ('RARITANCCv2-MIB', 'ccUserSessionId'), ('RARITANCCv2-MIB', 'ccNodeName'), ('RARITANCCv2-MIB', 'ccPortName')) if mibBuilder.loadTexts: ccPortConnectionTerminated.setStatus('current') cc_image_upgrade_started = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 8)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccImageType'), ('RARITANCCv2-MIB', 'ccImageVersion')) if mibBuilder.loadTexts: ccImageUpgradeStarted.setStatus('current') cc_image_upgrade_results = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 9)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccImageType'), ('RARITANCCv2-MIB', 'ccImageVersion'), ('RARITANCCv2-MIB', 'ccImageVersionStatus')) if mibBuilder.loadTexts: ccImageUpgradeResults.setStatus('current') cc_user_added = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 10)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccUserWhoAdded')) if mibBuilder.loadTexts: ccUserAdded.setStatus('current') cc_user_deleted = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 11)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccUserWhoDeleted')) if mibBuilder.loadTexts: ccUserDeleted.setStatus('current') cc_user_modified = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 12)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccUserModified.setStatus('current') cc_user_authentication_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 13)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccUserAuthenticationFailure.setStatus('current') cc_root_password_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 14)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccRootPasswordChanged.setStatus('current') cc_lan_card_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 15)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLanCard'), ('RARITANCCv2-MIB', 'ccClusterState')) if mibBuilder.loadTexts: ccLanCardFailure.setStatus('current') cc_hard_disk_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 16)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccHardDisk'), ('RARITANCCv2-MIB', 'ccClusterState')) if mibBuilder.loadTexts: ccHardDiskFailure.setStatus('current') cc_leaf_node_unavailable = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 17)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccLeafNodeUnavailable.setStatus('current') cc_leaf_node_available = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 18)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccLeafNodeAvailable.setStatus('current') cc_incompatible_device_firmware = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 19)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress'), ('RARITANCCv2-MIB', 'ccLeafNodeFirmwareVersion')) if mibBuilder.loadTexts: ccIncompatibleDeviceFirmware.setStatus('current') cc_device_upgrade = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 20)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress'), ('RARITANCCv2-MIB', 'ccLeafNodeFirmwareVersion'), ('RARITANCCv2-MIB', 'ccImageVersionStatus')) if mibBuilder.loadTexts: ccDeviceUpgrade.setStatus('current') cc_enter_maintenance_mode = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 21)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccEnterMaintenanceMode.setStatus('current') cc_exit_maintenance_mode = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 22)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccExitMaintenanceMode.setStatus('current') cc_user_locked_out = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 23)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName')) if mibBuilder.loadTexts: ccUserLockedOut.setStatus('current') cc_device_added_after_ccnoc_notification = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 24)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccDeviceName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccDeviceAddedAfterCCNOCNotification.setStatus('current') cc_scheduled_task_execution_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 25)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccScheduledTaskDescription'), ('RARITANCCv2-MIB', 'ccScheduledTaskFailureReason')) if mibBuilder.loadTexts: ccScheduledTaskExecutionFailure.setStatus('current') cc_diagnostic_console_login = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 26)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccDiagnosticConsoleMAX_ACCESSLevel')) if mibBuilder.loadTexts: ccDiagnosticConsoleLogin.setStatus('current') cc_diagnostic_console_logout = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 27)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccDiagnosticConsoleMAX_ACCESSLevel')) if mibBuilder.loadTexts: ccDiagnosticConsoleLogout.setStatus('current') cc_noc_available = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 28)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccNOCAvailable.setStatus('current') cc_noc_unavailable = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 29)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccNOCUnavailable.setStatus('current') cc_user_group_added = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 30)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserGroupName'), ('RARITANCCv2-MIB', 'ccUserWhoAdded')) if mibBuilder.loadTexts: ccUserGroupAdded.setStatus('current') cc_user_group_deleted = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 31)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserGroupName'), ('RARITANCCv2-MIB', 'ccUserWhoDeleted')) if mibBuilder.loadTexts: ccUserGroupDeleted.setStatus('current') cc_user_group_modified = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 32)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserGroupName'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccUserGroupModified.setStatus('current') cc_superuser_name_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 33)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccSuperuserNameChanged.setStatus('current') cc_superuser_password_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 34)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccSuperuserPasswordChanged.setStatus('current') cc_login_banner_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 35)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserWhoModified'), ('RARITANCCv2-MIB', 'ccBannerChanges')) if mibBuilder.loadTexts: ccLoginBannerChanged.setStatus('current') cc_motd_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 36)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserWhoModified'), ('RARITANCCv2-MIB', 'ccMOTDChanges')) if mibBuilder.loadTexts: ccMOTDChanged.setStatus('current') cc_dominion_px_replaced = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 37)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccOldNumberOfOutlets'), ('RARITANCCv2-MIB', 'ccNewNumberOfOutlets')) if mibBuilder.loadTexts: ccDominionPXReplaced.setStatus('current') cc_system_monitor_notification = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 38)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccSystemMonitorNotificationLevel'), ('RARITANCCv2-MIB', 'ccSystemMonitorNotificationMessage')) if mibBuilder.loadTexts: ccSystemMonitorNotification.setStatus('current') cc_neighborhood_activated = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 39)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance')) if mibBuilder.loadTexts: ccNeighborhoodActivated.setStatus('current') cc_neighborhood_updated = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 40)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance')) if mibBuilder.loadTexts: ccNeighborhoodUpdated.setStatus('current') cc_dominion_px_firmware_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 41)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccDominionPXFirmwareVersion')) if mibBuilder.loadTexts: ccDominionPXFirmwareChanged.setStatus('current') cc_cluster_failover = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 42)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccClusterPeer')) if mibBuilder.loadTexts: ccClusterFailover.setStatus('current') cc_cluster_backup_failed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 43)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccClusterPeer')) if mibBuilder.loadTexts: ccClusterBackupFailed.setStatus('current') cc_cluster_waiting_peer_detected = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 44)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccClusterPeer')) if mibBuilder.loadTexts: ccClusterWaitingPeerDetected.setStatus('current') cc_cluster_action = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 45)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccClusterOperation'), ('RARITANCCv2-MIB', 'ccClusterOperationStatus')) if mibBuilder.loadTexts: ccClusterAction.setStatus('current') cc_csv_file_transferred = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 46)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccFileType'), ('RARITANCCv2-MIB', 'ccTransferOperation')) if mibBuilder.loadTexts: ccCSVFileTransferred.setStatus('current') cc_piq_unavailable = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 47)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccPIQUnavailable.setStatus('current') cc_piq_available = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 48)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLeafNodeName'), ('RARITANCCv2-MIB', 'ccLeafNodeIPAddress')) if mibBuilder.loadTexts: ccPIQAvailable.setStatus('current') cc_license_server_unavailable = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 49)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLicenseServer')) if mibBuilder.loadTexts: ccLicenseServerUnavailable.setStatus('current') cc_license_server_failover = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 50)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLicenseServer')) if mibBuilder.loadTexts: ccLicenseServerFailover.setStatus('current') cc_license_server_available = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 51)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLicenseServer')) if mibBuilder.loadTexts: ccLicenseServerAvailable.setStatus('current') cc_license_terminated = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 52)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance')) if mibBuilder.loadTexts: ccLicenseTerminated.setStatus('current') cc_add_license_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 53)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance')) if mibBuilder.loadTexts: ccAddLicenseFailure.setStatus('current') cc_add_feature_failure = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 54)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLicensedFeature')) if mibBuilder.loadTexts: ccAddFeatureFailure.setStatus('current') cc_license_terminated_with_reason = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 55)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccLicenseTerminatedReason')) if mibBuilder.loadTexts: ccLicenseTerminatedWithReason.setStatus('current') cc_user_password_changed = notification_type((1, 3, 6, 1, 4, 1, 13742, 1, 1, 1, 1, 56)).setObjects(('RARITANCCv2-MIB', 'ccObjectName'), ('RARITANCCv2-MIB', 'ccObjectInstance'), ('RARITANCCv2-MIB', 'ccUserName'), ('RARITANCCv2-MIB', 'ccUserWhoModified')) if mibBuilder.loadTexts: ccUserPasswordChanged.setStatus('current') mibBuilder.exportSymbols('RARITANCCv2-MIB', ccNeighborhoodUpdated=ccNeighborhoodUpdated, ccNeighborhoodActivated=ccNeighborhoodActivated, ccUserAdded=ccUserAdded, ccMOTDChanges=ccMOTDChanges, ccLicenseServerFailover=ccLicenseServerFailover, ccMOTDChanged=ccMOTDChanged, ccUserWhoDeleted=ccUserWhoDeleted, ccEnterMaintenanceMode=ccEnterMaintenanceMode, ccClusterState=ccClusterState, ccNOCAvailable=ccNOCAvailable, ccSessionType=ccSessionType, ccUserGroupModified=ccUserGroupModified, ccTransferOperation=ccTransferOperation, ccUserAuthenticationFailure=ccUserAuthenticationFailure, ccUserNameInitiated=ccUserNameInitiated, ccLanCard=ccLanCard, ccLeafNodeFirmwareVersion=ccLeafNodeFirmwareVersion, ccDeviceUpgrade=ccDeviceUpgrade, ccDiagnosticConsoleMAX_ACCESSLevel=ccDiagnosticConsoleMAX_ACCESSLevel, ccClusterWaitingPeerDetected=ccClusterWaitingPeerDetected, ccScheduledTaskFailureReason=ccScheduledTaskFailureReason, ccSystemMonitorNotificationMessage=ccSystemMonitorNotificationMessage, ccFileType=ccFileType, ccDeviceAddedAfterCCNOCNotification=ccDeviceAddedAfterCCNOCNotification, ccUserName=ccUserName, ccObject=ccObject, ccClusterOperation=ccClusterOperation, ccDominionPXFirmwareVersion=ccDominionPXFirmwareVersion, ccClusterFailover=ccClusterFailover, ccClusterPeer=ccClusterPeer, ccImageUpgradeResults=ccImageUpgradeResults, ccLicenseServerAvailable=ccLicenseServerAvailable, ccLeafNodeName=ccLeafNodeName, ccAvailable=ccAvailable, ccObjectInstance=ccObjectInstance, ccIncompatibleDeviceFirmware=ccIncompatibleDeviceFirmware, ccUserGroupAdded=ccUserGroupAdded, ccUnavailable=ccUnavailable, ccSuperuserNameChanged=ccSuperuserNameChanged, ccPIQUnavailable=ccPIQUnavailable, ccUserWhoModified=ccUserWhoModified, ccLicenseTerminated=ccLicenseTerminated, ccNewNumberOfOutlets=ccNewNumberOfOutlets, ccUserPasswordChanged=ccUserPasswordChanged, commandCenter=commandCenter, ccHardDisk=ccHardDisk, products=products, ccPortConnectionTerminated=ccPortConnectionTerminated, ccDominionPXFirmwareChanged=ccDominionPXFirmwareChanged, ccDeviceName=ccDeviceName, enterpriseManagement=enterpriseManagement, ccImageVersion=ccImageVersion, ccClusterOperationStatus=ccClusterOperationStatus, ccNOCUnavailable=ccNOCUnavailable, ccUserGroupName=ccUserGroupName, ccLoginBannerChanged=ccLoginBannerChanged, ccSuperuserPasswordChanged=ccSuperuserPasswordChanged, ccObjectName=ccObjectName, ccCSVFileTransferred=ccCSVFileTransferred, ccUserLogout=ccUserLogout, ccOldNumberOfOutlets=ccOldNumberOfOutlets, ccUserModified=ccUserModified, ccImageType=ccImageType, ccUserGroupDeleted=ccUserGroupDeleted, ccNotify=ccNotify, ccSystemMonitorNotificationLevel=ccSystemMonitorNotificationLevel, ccUserLockedOut=ccUserLockedOut, ccPortConnectionStopped=ccPortConnectionStopped, ccDiagnosticConsoleLogin=ccDiagnosticConsoleLogin, ccLeafNodeAvailable=ccLeafNodeAvailable, ccLicensedFeature=ccLicensedFeature, ccPIQAvailable=ccPIQAvailable, ccUserNameTerminated=ccUserNameTerminated, PYSNMP_MODULE_ID=raritan, ccHardDiskFailure=ccHardDiskFailure, ccNodeName=ccNodeName, raritan=raritan, ccSPortConnectionStarted=ccSPortConnectionStarted, ccImageUpgradeStarted=ccImageUpgradeStarted, ccUserLogin=ccUserLogin, ccExitMaintenanceMode=ccExitMaintenanceMode, ccLeafNodeIPAddress=ccLeafNodeIPAddress, ccRootPasswordChanged=ccRootPasswordChanged, ccScheduledTaskExecutionFailure=ccScheduledTaskExecutionFailure, ccUserWhoAdded=ccUserWhoAdded, ccLicenseTerminatedReason=ccLicenseTerminatedReason, ccBannerChanges=ccBannerChanges, ccAddFeatureFailure=ccAddFeatureFailure, ccClusterAction=ccClusterAction, ccDiagnosticConsoleLogout=ccDiagnosticConsoleLogout, ccUserDeleted=ccUserDeleted, ccScheduledTaskDescription=ccScheduledTaskDescription, ccLicenseServer=ccLicenseServer, ccClusterBackupFailed=ccClusterBackupFailed, ccImageVersionStatus=ccImageVersionStatus, ccLeafNodeUnavailable=ccLeafNodeUnavailable, ccPortName=ccPortName, ccUserSessionId=ccUserSessionId, ccLicenseServerUnavailable=ccLicenseServerUnavailable, ccLicenseTerminatedWithReason=ccLicenseTerminatedWithReason, ccDominionPXReplaced=ccDominionPXReplaced, ccSystemMonitorNotification=ccSystemMonitorNotification, ccLanCardFailure=ccLanCardFailure, ccAddLicenseFailure=ccAddLicenseFailure)
age=input("How old are you? 38") height=input("How tall are you? `120") weight=input("How much do you weight? 129") print(f"So, you're {age} old, {height} tall, and {weight} heavy.")
age = input('How old are you? 38') height = input('How tall are you? `120') weight = input('How much do you weight? 129') print(f"So, you're {age} old, {height} tall, and {weight} heavy.")
#!/usr/bin/env python # -*- coding: utf-8 -* # Copyright: [CUP] - See LICENSE for details. # Authors: liushuxian(liushuxian) """ This module provides utils of jenkins. """ STATUS_FAIL = "FAIL" STATUS_ERROR = "ERROR" STATUS_ABORTED = "ABORTED" STATUS_REGRESSION = "REGRESSION" STATUS_SUCCESS = "SUCCESS" STATUS_FIXED = "FIXED" STATUS_PASSED = "PASSED" RESULT_FAILURE = "FAILURE" RESULT_FAILED = "FAILED" RESULT_SKIPPED = "SKIPPED"
""" This module provides utils of jenkins. """ status_fail = 'FAIL' status_error = 'ERROR' status_aborted = 'ABORTED' status_regression = 'REGRESSION' status_success = 'SUCCESS' status_fixed = 'FIXED' status_passed = 'PASSED' result_failure = 'FAILURE' result_failed = 'FAILED' result_skipped = 'SKIPPED'
# Homeserver address homeserver = "https://phuks.co" # Homeserver credentials. Not required if using a .token file username = "jenny" password = "nice&secure" # Display name nick = "Jenny" # Prefix for commands prefix = '.' # List of admins using full matrix usernames admins = ['@polsaker:phuks.co'] # If this list is not empty, the bot will ONLY load the modules on this list whitelistonly_modules = [] # Modules that won't be loaded disabled_modules = ['steam', 'phuks'] # WolframAlpha API key, used for wolframalpha.py wolframalpha_apikey = "123456-7894561234" # Google API key, used by various modules google_apikey = "PutItInHere" # DarkSky API key, used for the weather module darksky_apikey = "GibMeTheWeather" # Cleverbot API key, used for cleverbot.py CLEVERBOT_API_KEY = "CccCcCccCCCccCccCc" # List of servers we will blindly join channels when invited to allowed_servers = ['phuks.co', 'chat.poal.co']
homeserver = 'https://phuks.co' username = 'jenny' password = 'nice&secure' nick = 'Jenny' prefix = '.' admins = ['@polsaker:phuks.co'] whitelistonly_modules = [] disabled_modules = ['steam', 'phuks'] wolframalpha_apikey = '123456-7894561234' google_apikey = 'PutItInHere' darksky_apikey = 'GibMeTheWeather' cleverbot_api_key = 'CccCcCccCCCccCccCc' allowed_servers = ['phuks.co', 'chat.poal.co']
# table definition table = { 'table_name' : 'db_view_cols', 'module_id' : 'db', 'short_descr' : 'Db view columns', 'long_descr' : 'Database view column definitions', 'sub_types' : None, 'sub_trans' : None, 'sequence' : ['seq', ['view_id', 'col_type'], None], 'tree_params' : None, 'roll_params' : None, 'indexes' : None, 'ledger_col' : None, 'defn_company' : None, 'data_company' : None, 'read_only' : False, } # column definitions cols = [] cols.append ({ 'col_name' : 'row_id', 'data_type' : 'AUTO', 'short_descr': 'Row id', 'long_descr' : 'Row id', 'col_head' : 'Row', 'key_field' : 'Y', 'data_source': 'gen', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'created_id', 'data_type' : 'INT', 'short_descr': 'Created id', 'long_descr' : 'Created row id', 'col_head' : 'Created', 'key_field' : 'N', 'data_source': 'gen', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : '0', 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'deleted_id', 'data_type' : 'INT', 'short_descr': 'Deleted id', 'long_descr' : 'Deleted row id', 'col_head' : 'Deleted', 'key_field' : 'N', 'data_source': 'gen', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : '0', 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'view_id', 'data_type' : 'INT', 'short_descr': 'View id', 'long_descr' : 'View id', 'col_head' : 'View', 'key_field' : 'A', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : ['db_views', 'row_id', 'view_name', 'view_name', True, None], 'choices' : None, }) cols.append ({ 'col_name' : 'col_name', 'data_type' : 'TEXT', 'short_descr': 'Column name', 'long_descr' : 'Column name', 'col_head' : 'Column', 'key_field' : 'A', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 15, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'col_type', 'data_type' : 'TEXT', 'short_descr': 'Column type', 'long_descr' : 'Column type', 'col_head' : 'Col type', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': False, 'max_len' : 5, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : 'view', 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : [ ['view', 'View column'], ['virt', 'Virtual column'], ], }) cols.append ({ 'col_name' : 'source', 'data_type' : 'JSON', 'short_descr': 'Source', 'long_descr' : 'Source - for each base table, literal or db column', 'col_head' : 'Source', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'seq', 'data_type' : 'INT', 'short_descr': 'Seq', 'long_descr' : 'Position for display', 'col_head' : 'Seq', 'key_field' : 'N', 'data_source': 'seq', 'condition' : None, 'allow_null' : False, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'data_type', 'data_type' : 'TEXT', 'short_descr': 'Data type', 'long_descr' : 'Data type', 'col_head' : 'Type', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': [ ['where', '', 'view_id>view_created', 'is', '$False', ''], ], 'max_len' : 5, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : 'TEXT', 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : [ ['TEXT', 'Text'], ['INT', 'Integer'], ['DEC', 'Decimal'], ['$TRN', 'Transaction currency'], ['$PTY', 'Party currency'], ['$LCL', 'Local currency'], ['DTE', 'Date'], ['DTM', 'Date-time'], ['BOOL', 'True/False'], ['AUTO', 'Generated key'], ['JSON', 'Json'], ['XML', 'Xml'], ['SXML', 'Xml string'], ['FXML', 'Form definition'], ['RXML', 'Report definition'], ['PXML', 'Process definition'], ], }) cols.append ({ 'col_name' : 'short_descr', 'data_type' : 'TEXT', 'short_descr': 'Short description', 'long_descr' : 'Column description', 'col_head' : 'Description', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': True, 'max_len' : 30, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'long_descr', 'data_type' : 'TEXT', 'short_descr': 'Long description', 'long_descr' : 'Full description for user manual, tool-tip, etc', 'col_head' : 'Long description', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'col_head', 'data_type' : 'TEXT', 'short_descr': 'Column heading', 'long_descr' : 'Column heading for reports and grids', 'col_head' : 'Col head', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 30, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'key_field', 'data_type' : 'TEXT', 'short_descr': 'Key field', 'long_descr' : 'Yes=primary key, Alt=alternate key, No=not key field', 'col_head' : 'Key', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : False, 'allow_amend': [ ['where', '', 'view_id>view_created', 'is', '$False', ''], ], 'max_len' : 1, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : 'N', 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : [ ['N', 'No'], ['Y', 'Yes'], ['A', 'Alt'], ], }) cols.append ({ 'col_name' : 'scale_ptr', 'data_type' : 'TEXT', 'short_descr': 'Column with scale factor', 'long_descr' : 'Column to define number of decimals allowed', 'col_head' : 'Scale ptr', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'fkey', 'data_type' : 'JSON', 'short_descr': 'Foreign key', 'long_descr' : 'Foreign key', 'col_head' : 'Fkey', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'choices', 'data_type' : 'JSON', 'short_descr': 'Choices', 'long_descr' : 'List of valid choices.\nNot used at present, but might be useful.', 'col_head' : 'Choices', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) cols.append ({ 'col_name' : 'sql', 'data_type' : 'TEXT', 'short_descr': 'Sql statement', 'long_descr' : 'Sql statement to return value', 'col_head' : 'Sql', 'key_field' : 'N', 'data_source': 'input', 'condition' : None, 'allow_null' : True, 'allow_amend': True, 'max_len' : 0, 'db_scale' : 0, 'scale_ptr' : None, 'dflt_val' : None, 'dflt_rule' : None, 'col_checks' : None, 'fkey' : None, 'choices' : None, }) # virtual column definitions virt = [] # cursor definitions cursors = [] # actions actions = []
table = {'table_name': 'db_view_cols', 'module_id': 'db', 'short_descr': 'Db view columns', 'long_descr': 'Database view column definitions', 'sub_types': None, 'sub_trans': None, 'sequence': ['seq', ['view_id', 'col_type'], None], 'tree_params': None, 'roll_params': None, 'indexes': None, 'ledger_col': None, 'defn_company': None, 'data_company': None, 'read_only': False} cols = [] cols.append({'col_name': 'row_id', 'data_type': 'AUTO', 'short_descr': 'Row id', 'long_descr': 'Row id', 'col_head': 'Row', 'key_field': 'Y', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'created_id', 'data_type': 'INT', 'short_descr': 'Created id', 'long_descr': 'Created row id', 'col_head': 'Created', 'key_field': 'N', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': '0', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'deleted_id', 'data_type': 'INT', 'short_descr': 'Deleted id', 'long_descr': 'Deleted row id', 'col_head': 'Deleted', 'key_field': 'N', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': '0', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'view_id', 'data_type': 'INT', 'short_descr': 'View id', 'long_descr': 'View id', 'col_head': 'View', 'key_field': 'A', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': ['db_views', 'row_id', 'view_name', 'view_name', True, None], 'choices': None}) cols.append({'col_name': 'col_name', 'data_type': 'TEXT', 'short_descr': 'Column name', 'long_descr': 'Column name', 'col_head': 'Column', 'key_field': 'A', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 15, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'col_type', 'data_type': 'TEXT', 'short_descr': 'Column type', 'long_descr': 'Column type', 'col_head': 'Col type', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 5, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': 'view', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': [['view', 'View column'], ['virt', 'Virtual column']]}) cols.append({'col_name': 'source', 'data_type': 'JSON', 'short_descr': 'Source', 'long_descr': 'Source - for each base table, literal or db column', 'col_head': 'Source', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'seq', 'data_type': 'INT', 'short_descr': 'Seq', 'long_descr': 'Position for display', 'col_head': 'Seq', 'key_field': 'N', 'data_source': 'seq', 'condition': None, 'allow_null': False, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'data_type', 'data_type': 'TEXT', 'short_descr': 'Data type', 'long_descr': 'Data type', 'col_head': 'Type', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': [['where', '', 'view_id>view_created', 'is', '$False', '']], 'max_len': 5, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': 'TEXT', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': [['TEXT', 'Text'], ['INT', 'Integer'], ['DEC', 'Decimal'], ['$TRN', 'Transaction currency'], ['$PTY', 'Party currency'], ['$LCL', 'Local currency'], ['DTE', 'Date'], ['DTM', 'Date-time'], ['BOOL', 'True/False'], ['AUTO', 'Generated key'], ['JSON', 'Json'], ['XML', 'Xml'], ['SXML', 'Xml string'], ['FXML', 'Form definition'], ['RXML', 'Report definition'], ['PXML', 'Process definition']]}) cols.append({'col_name': 'short_descr', 'data_type': 'TEXT', 'short_descr': 'Short description', 'long_descr': 'Column description', 'col_head': 'Description', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': True, 'max_len': 30, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'long_descr', 'data_type': 'TEXT', 'short_descr': 'Long description', 'long_descr': 'Full description for user manual, tool-tip, etc', 'col_head': 'Long description', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'col_head', 'data_type': 'TEXT', 'short_descr': 'Column heading', 'long_descr': 'Column heading for reports and grids', 'col_head': 'Col head', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 30, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'key_field', 'data_type': 'TEXT', 'short_descr': 'Key field', 'long_descr': 'Yes=primary key, Alt=alternate key, No=not key field', 'col_head': 'Key', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': [['where', '', 'view_id>view_created', 'is', '$False', '']], 'max_len': 1, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': 'N', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': [['N', 'No'], ['Y', 'Yes'], ['A', 'Alt']]}) cols.append({'col_name': 'scale_ptr', 'data_type': 'TEXT', 'short_descr': 'Column with scale factor', 'long_descr': 'Column to define number of decimals allowed', 'col_head': 'Scale ptr', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'fkey', 'data_type': 'JSON', 'short_descr': 'Foreign key', 'long_descr': 'Foreign key', 'col_head': 'Fkey', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'choices', 'data_type': 'JSON', 'short_descr': 'Choices', 'long_descr': 'List of valid choices.\nNot used at present, but might be useful.', 'col_head': 'Choices', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) cols.append({'col_name': 'sql', 'data_type': 'TEXT', 'short_descr': 'Sql statement', 'long_descr': 'Sql statement to return value', 'col_head': 'Sql', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None}) virt = [] cursors = [] actions = []
f = open('input.txt', 'r') values = [] for line in f: values.append(int(line)) counter = 0 # Part 1: for x in range(len(values)-1): if values[x+1] > values[x]: counter += 1 print(f"part 1: {counter}") # Part 2: counter = 0 for x in range(2, len(values)-1): lsum = sum([values[i] for i in range(x-2, x+1)]) rsum = sum([values[j] for j in range(x-1, x+2)]) # print(f"lsum: {lsum}, rsum: {rsum}") if rsum > lsum: counter += 1 print(f"part 2: {counter}")
f = open('input.txt', 'r') values = [] for line in f: values.append(int(line)) counter = 0 for x in range(len(values) - 1): if values[x + 1] > values[x]: counter += 1 print(f'part 1: {counter}') counter = 0 for x in range(2, len(values) - 1): lsum = sum([values[i] for i in range(x - 2, x + 1)]) rsum = sum([values[j] for j in range(x - 1, x + 2)]) if rsum > lsum: counter += 1 print(f'part 2: {counter}')
# # PySNMP MIB module ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:49:38 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint") etsysModules, = mibBuilder.importSymbols("ENTERASYS-MIB-NAMES", "etsysModules") InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") NotificationType, ModuleIdentity, Bits, ObjectIdentity, IpAddress, Integer32, Counter64, iso, Gauge32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, MibIdentifier, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "ModuleIdentity", "Bits", "ObjectIdentity", "IpAddress", "Integer32", "Counter64", "iso", "Gauge32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "MibIdentifier", "Counter32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") etsysMgmtAuthNotificationMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60)) etsysMgmtAuthNotificationMIB.setRevisions(('2011-03-08 20:40', '2005-11-14 16:48',)) if mibBuilder.loadTexts: etsysMgmtAuthNotificationMIB.setLastUpdated('201103082040Z') if mibBuilder.loadTexts: etsysMgmtAuthNotificationMIB.setOrganization('Enterasys Networks, Inc') class EtsysMgmtAuthNotificationTypes(TextualConvention, Bits): status = 'current' namedValues = NamedValues(("cliConsole", 0), ("cliSsh", 1), ("cliTelnet", 2), ("webview", 3), ("inactiveUser", 4), ("maxUserAttempt", 5), ("maxUserFail", 6)) etsysMgmtAuthObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1)) etsysMgmtAuthNotificationBranch = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0)) etsysMgmtAuthConfigBranch = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1)) etsysMgmtAuthAuthenticationBranch = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2)) etsysMgmtAuthNotificationsSupported = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1, 1), EtsysMgmtAuthNotificationTypes()).setMaxAccess("readonly") if mibBuilder.loadTexts: etsysMgmtAuthNotificationsSupported.setStatus('current') etsysMgmtAuthNotificationEnabledStatus = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1, 2), EtsysMgmtAuthNotificationTypes()).setMaxAccess("readwrite") if mibBuilder.loadTexts: etsysMgmtAuthNotificationEnabledStatus.setStatus('current') etsysMgmtAuthType = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 1), EtsysMgmtAuthNotificationTypes()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: etsysMgmtAuthType.setStatus('current') etsysMgmtAuthUserName = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 2), DisplayString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: etsysMgmtAuthUserName.setStatus('current') etsysMgmtAuthInetAddressType = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 3), InetAddressType()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: etsysMgmtAuthInetAddressType.setStatus('current') etsysMgmtAuthInetAddress = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 4), InetAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: etsysMgmtAuthInetAddress.setStatus('current') etsysMgmtAuthInIfIndex = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 5), InterfaceIndexOrZero()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: etsysMgmtAuthInIfIndex.setStatus('current') etsysMgmtAuthSuccessNotificiation = NotificationType((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 1)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if mibBuilder.loadTexts: etsysMgmtAuthSuccessNotificiation.setStatus('current') etsysMgmtAuthFailNotificiation = NotificationType((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 2)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if mibBuilder.loadTexts: etsysMgmtAuthFailNotificiation.setStatus('current') etsysMgmtAuthInactiveNotification = NotificationType((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 3)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if mibBuilder.loadTexts: etsysMgmtAuthInactiveNotification.setStatus('current') etsysMgmtAuthMaxAuthAttemptNotification = NotificationType((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 4)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if mibBuilder.loadTexts: etsysMgmtAuthMaxAuthAttemptNotification.setStatus('current') etsysMgmtAuthMaxFailNotification = NotificationType((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 5)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if mibBuilder.loadTexts: etsysMgmtAuthMaxFailNotification.setStatus('current') etsysMgmtAuthConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2)) etsysMgmtAuthGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1)) etsysMgmtAuthCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2)) etsysMgmtAuthConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 1)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthNotificationsSupported"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthNotificationEnabledStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthConfigGroup = etsysMgmtAuthConfigGroup.setStatus('current') etsysMgmtAuthHistoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 2)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthUserName"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddressType"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInetAddress"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInIfIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthHistoryGroup = etsysMgmtAuthHistoryGroup.setStatus('current') etsysMgmtAuthNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 3)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthSuccessNotificiation"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthFailNotificiation")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthNotificationGroup = etsysMgmtAuthNotificationGroup.setStatus('current') etsysMgmtAuthNotificationUserGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 4)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthInactiveNotification"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthMaxAuthAttemptNotification"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthMaxFailNotification")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthNotificationUserGroup = etsysMgmtAuthNotificationUserGroup.setStatus('current') etsysMgmtAuthCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2, 1)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthConfigGroup"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthHistoryGroup"), ("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthNotificationGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthCompliance = etsysMgmtAuthCompliance.setStatus('current') etsysMgmtAuthUserCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2, 2)).setObjects(("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", "etsysMgmtAuthNotificationUserGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsysMgmtAuthUserCompliance = etsysMgmtAuthUserCompliance.setStatus('current') mibBuilder.exportSymbols("ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB", etsysMgmtAuthNotificationUserGroup=etsysMgmtAuthNotificationUserGroup, etsysMgmtAuthNotificationGroup=etsysMgmtAuthNotificationGroup, etsysMgmtAuthNotificationBranch=etsysMgmtAuthNotificationBranch, etsysMgmtAuthFailNotificiation=etsysMgmtAuthFailNotificiation, etsysMgmtAuthConfigGroup=etsysMgmtAuthConfigGroup, etsysMgmtAuthMaxFailNotification=etsysMgmtAuthMaxFailNotification, etsysMgmtAuthNotificationEnabledStatus=etsysMgmtAuthNotificationEnabledStatus, etsysMgmtAuthCompliance=etsysMgmtAuthCompliance, etsysMgmtAuthGroups=etsysMgmtAuthGroups, etsysMgmtAuthConformance=etsysMgmtAuthConformance, etsysMgmtAuthNotificationMIB=etsysMgmtAuthNotificationMIB, etsysMgmtAuthInetAddress=etsysMgmtAuthInetAddress, PYSNMP_MODULE_ID=etsysMgmtAuthNotificationMIB, etsysMgmtAuthNotificationsSupported=etsysMgmtAuthNotificationsSupported, etsysMgmtAuthConfigBranch=etsysMgmtAuthConfigBranch, etsysMgmtAuthInIfIndex=etsysMgmtAuthInIfIndex, etsysMgmtAuthSuccessNotificiation=etsysMgmtAuthSuccessNotificiation, etsysMgmtAuthType=etsysMgmtAuthType, etsysMgmtAuthUserCompliance=etsysMgmtAuthUserCompliance, etsysMgmtAuthUserName=etsysMgmtAuthUserName, etsysMgmtAuthAuthenticationBranch=etsysMgmtAuthAuthenticationBranch, etsysMgmtAuthObjects=etsysMgmtAuthObjects, etsysMgmtAuthInactiveNotification=etsysMgmtAuthInactiveNotification, etsysMgmtAuthMaxAuthAttemptNotification=etsysMgmtAuthMaxAuthAttemptNotification, etsysMgmtAuthInetAddressType=etsysMgmtAuthInetAddressType, EtsysMgmtAuthNotificationTypes=EtsysMgmtAuthNotificationTypes, etsysMgmtAuthCompliances=etsysMgmtAuthCompliances, etsysMgmtAuthHistoryGroup=etsysMgmtAuthHistoryGroup)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint', 'ValueRangeConstraint', 'SingleValueConstraint') (etsys_modules,) = mibBuilder.importSymbols('ENTERASYS-MIB-NAMES', 'etsysModules') (interface_index_or_zero,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndexOrZero') (inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (notification_type, module_identity, bits, object_identity, ip_address, integer32, counter64, iso, gauge32, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, mib_identifier, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'NotificationType', 'ModuleIdentity', 'Bits', 'ObjectIdentity', 'IpAddress', 'Integer32', 'Counter64', 'iso', 'Gauge32', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'MibIdentifier', 'Counter32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') etsys_mgmt_auth_notification_mib = module_identity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60)) etsysMgmtAuthNotificationMIB.setRevisions(('2011-03-08 20:40', '2005-11-14 16:48')) if mibBuilder.loadTexts: etsysMgmtAuthNotificationMIB.setLastUpdated('201103082040Z') if mibBuilder.loadTexts: etsysMgmtAuthNotificationMIB.setOrganization('Enterasys Networks, Inc') class Etsysmgmtauthnotificationtypes(TextualConvention, Bits): status = 'current' named_values = named_values(('cliConsole', 0), ('cliSsh', 1), ('cliTelnet', 2), ('webview', 3), ('inactiveUser', 4), ('maxUserAttempt', 5), ('maxUserFail', 6)) etsys_mgmt_auth_objects = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1)) etsys_mgmt_auth_notification_branch = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0)) etsys_mgmt_auth_config_branch = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1)) etsys_mgmt_auth_authentication_branch = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2)) etsys_mgmt_auth_notifications_supported = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1, 1), etsys_mgmt_auth_notification_types()).setMaxAccess('readonly') if mibBuilder.loadTexts: etsysMgmtAuthNotificationsSupported.setStatus('current') etsys_mgmt_auth_notification_enabled_status = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 1, 2), etsys_mgmt_auth_notification_types()).setMaxAccess('readwrite') if mibBuilder.loadTexts: etsysMgmtAuthNotificationEnabledStatus.setStatus('current') etsys_mgmt_auth_type = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 1), etsys_mgmt_auth_notification_types()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: etsysMgmtAuthType.setStatus('current') etsys_mgmt_auth_user_name = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 2), display_string()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: etsysMgmtAuthUserName.setStatus('current') etsys_mgmt_auth_inet_address_type = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 3), inet_address_type()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: etsysMgmtAuthInetAddressType.setStatus('current') etsys_mgmt_auth_inet_address = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 4), inet_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: etsysMgmtAuthInetAddress.setStatus('current') etsys_mgmt_auth_in_if_index = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 2, 5), interface_index_or_zero()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: etsysMgmtAuthInIfIndex.setStatus('current') etsys_mgmt_auth_success_notificiation = notification_type((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 1)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if mibBuilder.loadTexts: etsysMgmtAuthSuccessNotificiation.setStatus('current') etsys_mgmt_auth_fail_notificiation = notification_type((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 2)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if mibBuilder.loadTexts: etsysMgmtAuthFailNotificiation.setStatus('current') etsys_mgmt_auth_inactive_notification = notification_type((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 3)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if mibBuilder.loadTexts: etsysMgmtAuthInactiveNotification.setStatus('current') etsys_mgmt_auth_max_auth_attempt_notification = notification_type((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 4)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if mibBuilder.loadTexts: etsysMgmtAuthMaxAuthAttemptNotification.setStatus('current') etsys_mgmt_auth_max_fail_notification = notification_type((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 1, 0, 5)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if mibBuilder.loadTexts: etsysMgmtAuthMaxFailNotification.setStatus('current') etsys_mgmt_auth_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2)) etsys_mgmt_auth_groups = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1)) etsys_mgmt_auth_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2)) etsys_mgmt_auth_config_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 1)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthNotificationsSupported'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthNotificationEnabledStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_config_group = etsysMgmtAuthConfigGroup.setStatus('current') etsys_mgmt_auth_history_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 2)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthUserName'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddressType'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInetAddress'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInIfIndex')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_history_group = etsysMgmtAuthHistoryGroup.setStatus('current') etsys_mgmt_auth_notification_group = notification_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 3)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthSuccessNotificiation'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthFailNotificiation')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_notification_group = etsysMgmtAuthNotificationGroup.setStatus('current') etsys_mgmt_auth_notification_user_group = notification_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 1, 4)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthInactiveNotification'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthMaxAuthAttemptNotification'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthMaxFailNotification')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_notification_user_group = etsysMgmtAuthNotificationUserGroup.setStatus('current') etsys_mgmt_auth_compliance = module_compliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2, 1)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthConfigGroup'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthHistoryGroup'), ('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthNotificationGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_compliance = etsysMgmtAuthCompliance.setStatus('current') etsys_mgmt_auth_user_compliance = module_compliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 60, 2, 2, 2)).setObjects(('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', 'etsysMgmtAuthNotificationUserGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): etsys_mgmt_auth_user_compliance = etsysMgmtAuthUserCompliance.setStatus('current') mibBuilder.exportSymbols('ENTERASYS-MGMT-AUTH-NOTIFICATION-MIB', etsysMgmtAuthNotificationUserGroup=etsysMgmtAuthNotificationUserGroup, etsysMgmtAuthNotificationGroup=etsysMgmtAuthNotificationGroup, etsysMgmtAuthNotificationBranch=etsysMgmtAuthNotificationBranch, etsysMgmtAuthFailNotificiation=etsysMgmtAuthFailNotificiation, etsysMgmtAuthConfigGroup=etsysMgmtAuthConfigGroup, etsysMgmtAuthMaxFailNotification=etsysMgmtAuthMaxFailNotification, etsysMgmtAuthNotificationEnabledStatus=etsysMgmtAuthNotificationEnabledStatus, etsysMgmtAuthCompliance=etsysMgmtAuthCompliance, etsysMgmtAuthGroups=etsysMgmtAuthGroups, etsysMgmtAuthConformance=etsysMgmtAuthConformance, etsysMgmtAuthNotificationMIB=etsysMgmtAuthNotificationMIB, etsysMgmtAuthInetAddress=etsysMgmtAuthInetAddress, PYSNMP_MODULE_ID=etsysMgmtAuthNotificationMIB, etsysMgmtAuthNotificationsSupported=etsysMgmtAuthNotificationsSupported, etsysMgmtAuthConfigBranch=etsysMgmtAuthConfigBranch, etsysMgmtAuthInIfIndex=etsysMgmtAuthInIfIndex, etsysMgmtAuthSuccessNotificiation=etsysMgmtAuthSuccessNotificiation, etsysMgmtAuthType=etsysMgmtAuthType, etsysMgmtAuthUserCompliance=etsysMgmtAuthUserCompliance, etsysMgmtAuthUserName=etsysMgmtAuthUserName, etsysMgmtAuthAuthenticationBranch=etsysMgmtAuthAuthenticationBranch, etsysMgmtAuthObjects=etsysMgmtAuthObjects, etsysMgmtAuthInactiveNotification=etsysMgmtAuthInactiveNotification, etsysMgmtAuthMaxAuthAttemptNotification=etsysMgmtAuthMaxAuthAttemptNotification, etsysMgmtAuthInetAddressType=etsysMgmtAuthInetAddressType, EtsysMgmtAuthNotificationTypes=EtsysMgmtAuthNotificationTypes, etsysMgmtAuthCompliances=etsysMgmtAuthCompliances, etsysMgmtAuthHistoryGroup=etsysMgmtAuthHistoryGroup)
""" This module contains the result sentences and intents for the English version of the Supervisor app. """ # Result sentences RESULT_BACK = "Hi, I'm back!" RESULT_CONFIRM_REBOOT = "Do you really want to reboot the system?" RESULT_CONFIRM_SHUTDOWN = "Do you really want to shutdown the system?" RESULT_DISABLE_APP = "OK, I'll disable the {} app and restart all Snips actions." RESULT_ENABLE_APP = "OK, I'll enable the {} app and restart all Snips actions." RESULT_OK = "OK" RESULT_REBOOT = "OK, I'll reboot now. I'll be back." RESULT_RESTART_SERVICE = "OK, I'll restart the {} service." RESULT_RESTART_ALL_SERVICES = "OK, I'll restart all Snips services." RESULT_SHUTDOWN = "OK, I'll shutdown now. Please wake me up soon." RESULT_SORRY = "Sorry, I encountered an error. Have a look at the logs to solve it." RESULT_SORRY_PERMISSIONS = "Sorry, I couldn't change the execute permissions of the action files." # Intents INTENT_CONFIRM_REBOOT = 'koan:ConfirmReboot' INTENT_CONFIRM_SHUTDOWN = 'koan:ConfirmShutdown' INTENT_DISABLE_APP = 'koan:DisableApp' INTENT_ENABLE_APP = 'koan:EnableApp' INTENT_REBOOT = 'koan:Reboot' INTENT_RESTART_SERVICE = 'koan:RestartService' INTENT_SHUTDOWN = 'koan:Shutdown' # Slot types SLOT_TYPE_APP = 'koan/snips-app'
""" This module contains the result sentences and intents for the English version of the Supervisor app. """ result_back = "Hi, I'm back!" result_confirm_reboot = 'Do you really want to reboot the system?' result_confirm_shutdown = 'Do you really want to shutdown the system?' result_disable_app = "OK, I'll disable the {} app and restart all Snips actions." result_enable_app = "OK, I'll enable the {} app and restart all Snips actions." result_ok = 'OK' result_reboot = "OK, I'll reboot now. I'll be back." result_restart_service = "OK, I'll restart the {} service." result_restart_all_services = "OK, I'll restart all Snips services." result_shutdown = "OK, I'll shutdown now. Please wake me up soon." result_sorry = 'Sorry, I encountered an error. Have a look at the logs to solve it.' result_sorry_permissions = "Sorry, I couldn't change the execute permissions of the action files." intent_confirm_reboot = 'koan:ConfirmReboot' intent_confirm_shutdown = 'koan:ConfirmShutdown' intent_disable_app = 'koan:DisableApp' intent_enable_app = 'koan:EnableApp' intent_reboot = 'koan:Reboot' intent_restart_service = 'koan:RestartService' intent_shutdown = 'koan:Shutdown' slot_type_app = 'koan/snips-app'
class Solution(object): def fizzBuzz(self, n): # Scaleable hash dict = {3:"Fizz", 5:"Buzz"} res = [] # Iterate through 1-n+1 for i in range(1, n+1): # app represents what to append of not the number app = "" # iterate through any number of keys, instead of only 3, 5 for j in [3, 5]: if not i % j: app+=(dict[j]) # Append to res array if app != "": res.append(app) else: res.append(str(i)) return res z = Solution() n = 15 print(z.fizzBuzz(n))
class Solution(object): def fizz_buzz(self, n): dict = {3: 'Fizz', 5: 'Buzz'} res = [] for i in range(1, n + 1): app = '' for j in [3, 5]: if not i % j: app += dict[j] if app != '': res.append(app) else: res.append(str(i)) return res z = solution() n = 15 print(z.fizzBuzz(n))
# MAJOR_VER = 20 # MINOR_VER = 11 # REVISION_VER = 0 # CONTROL_VER = 6 # OFFICIAL = False # MAJOR_VER = 20 # MINOR_VER = 12 # REVISION_VER = 5 # CONTROL_VER = 6 # OFFICIAL = True MAJOR_VER = 21 MINOR_VER = 6 REVISION_VER = 0 CONTROL_VER = 6 OFFICIAL = False
major_ver = 21 minor_ver = 6 revision_ver = 0 control_ver = 6 official = False
#https://www.hackerrank.com/challenges/array-left-rotation length, rotations = map(int, input().strip().split()) array = list(map(int, input().strip().split())) displacement = rotations % length lower = [] for i in range(displacement, length): lower.append(array[i]) upper = [] for i in range(displacement): upper.append(array[i]) array = lower + upper print(" ".join(map(str, array))) ## or array = array[displacement:] + array[:displacement]
(length, rotations) = map(int, input().strip().split()) array = list(map(int, input().strip().split())) displacement = rotations % length lower = [] for i in range(displacement, length): lower.append(array[i]) upper = [] for i in range(displacement): upper.append(array[i]) array = lower + upper print(' '.join(map(str, array))) array = array[displacement:] + array[:displacement]
""" # Definition for a Node. class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child """ class Solution: def flatten(self, head: 'Node') -> 'Node': curr = head stack = [] while curr: if curr.child: if curr.next: stack.append(curr.next) curr.next = curr.child curr.child.prev = curr curr.child = None else: if not curr.next and stack: nextNode = stack.pop() curr.next = nextNode nextNode.prev = curr curr = curr.next return head
""" # Definition for a Node. class Node: def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child """ class Solution: def flatten(self, head: 'Node') -> 'Node': curr = head stack = [] while curr: if curr.child: if curr.next: stack.append(curr.next) curr.next = curr.child curr.child.prev = curr curr.child = None elif not curr.next and stack: next_node = stack.pop() curr.next = nextNode nextNode.prev = curr curr = curr.next return head
DWI_ENTITIES = dict(suffix="dwi", extension=".nii.gz") TENSOR_DERIVED_ENTITIES = dict(suffix="dwiref", resolution="dwi") TENSOR_DERIVED_METRICS = dict( diffusion_tensor=[ "fa", "ga", "rgb", "md", "ad", "rd", "mode", "evec", "eval", "tensor", ], restore_tensor=[ "fa", "ga", "rgb", "md", "ad", "rd", "mode", "evec", "eval", "tensor", ], diffusion_kurtosis=[ "fa", "ga", "rgb", "md", "ad", "rd", "mode", "evec", "eval", "mk", "ak", "rk", "dt_tensor", "dk_tensor", ], ) KWARGS_MAPPING = dict( dwi="input_files", bval="bvalues_files", bvec="bvectors_files", mask="mask_files", out_metrics="save_metrics", )
dwi_entities = dict(suffix='dwi', extension='.nii.gz') tensor_derived_entities = dict(suffix='dwiref', resolution='dwi') tensor_derived_metrics = dict(diffusion_tensor=['fa', 'ga', 'rgb', 'md', 'ad', 'rd', 'mode', 'evec', 'eval', 'tensor'], restore_tensor=['fa', 'ga', 'rgb', 'md', 'ad', 'rd', 'mode', 'evec', 'eval', 'tensor'], diffusion_kurtosis=['fa', 'ga', 'rgb', 'md', 'ad', 'rd', 'mode', 'evec', 'eval', 'mk', 'ak', 'rk', 'dt_tensor', 'dk_tensor']) kwargs_mapping = dict(dwi='input_files', bval='bvalues_files', bvec='bvectors_files', mask='mask_files', out_metrics='save_metrics')
#!/usr/bin/env python3 t = sorted([float(x) for x in input().split()]) o = float(input()) best = (t[0] + t[1] + t[2])/3 worst = (t[1] + t[2] + t[3])/3 if o < best: print('impossible') elif o >= worst: print('infinite') else: print(f'{3*o-t[1]-t[2]:.2f}')
t = sorted([float(x) for x in input().split()]) o = float(input()) best = (t[0] + t[1] + t[2]) / 3 worst = (t[1] + t[2] + t[3]) / 3 if o < best: print('impossible') elif o >= worst: print('infinite') else: print(f'{3 * o - t[1] - t[2]:.2f}')
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test") def gen_tests(srcs): for src in srcs: name = src.replace("s/","_").replace(".ts","") nodejs_test(name=name, entry_point = src, data=[":tsc","@npm//big-integer"])
load('@build_bazel_rules_nodejs//:index.bzl', 'nodejs_test') def gen_tests(srcs): for src in srcs: name = src.replace('s/', '_').replace('.ts', '') nodejs_test(name=name, entry_point=src, data=[':tsc', '@npm//big-integer'])
# https://www.codementor.io/moyosore/a-dive-into-python-closures-and-decorators-part-2-ab2enoyjg def hello(f): print(f"{f} in @hello") def f_wrapper(name): print("in wrapper of @hello") print(f"name:{name}, f(name):{f(name)}") return f"Hello {f(name)}" return f_wrapper def uppercase(f): print(f"{f} in @uppercase") def f_wrapper(name): print("in wrapper of @uppercase") print(f"name:{name}, f(name):{f(name)}") return f(name).upper() return f_wrapper def split_string(f): print(f"{f} in @split_string") def f_wrapper(name): print("in wrapper of @split_string") print(f"name:{name}, f(name):{f(name)}") return f(name).split() return f_wrapper @hello # first applied def say_hello_to1(name): return name.upper() @uppercase # Second applied @hello # first applied def say_hello_to2(name): return name.upper() @split_string # Third applied @uppercase # Second applied @hello # first applied def say_hello_to3(name): return name.upper() # <function say_hello_to1 at 0x000002403A363598> in @hello # <function say_hello_to2 at 0x000002403A3636A8> in @hello # <function hello.<locals>.f_wrapper at 0x000002403A363730> in @uppercase # <function say_hello_to3 at 0x000002403A363840> in @hello # <function hello.<locals>.f_wrapper at 0x000002403A3638C8> in @uppercase # <function uppercase.<locals>.f_wrapper at 0x000002403A363950> in @split_string print( f""" === say_hello_to1("hyuk1") @hello === {say_hello_to1("hyuk1")} """ ) # in wrapper of @hello # name:hyuk1, f(name):HYUK1 # === say_hello_to1("hyuk1") @hello === # Hello HYUK1 print( f""" === say_hello_to2("hyuk2") @hello @uppercase === {say_hello_to2("hyuk2")} """ ) # in wrapper of @uppercase # in wrapper of @hello # name:hyuk2, f(name):HYUK2 # name:hyuk2, f(name):Hello HYUK2 # in wrapper of @hello # name:hyuk2, f(name):HYUK2 # === say_hello_to2("hyuk2") @hello @uppercase === # HELLO HYUK2 print( f""" === say_hello_to3("hyuk3") @hello @uppercase @split_string === {say_hello_to3("hyuk3")} """ ) """ EXPLANATION The say_hello_to3 function returns output HYUK3 -- by -- return name.upper() This output is then passed into @hello When @hello is applied, we get returned output Hello HYUK3 -- by -- return f"Hello {f(name)}" This output is then passed into @uppercase When @uppercase is applied, we get returned output HELLO HYUK3 -- by -- return f(name).upper() This output is then passed into @split_string When @split_string is applied, we get returned output ['HELLO', 'HYUK3'] -- by -- return f(name).upper() This output is final return. """ # in wrapper of @split_string # in wrapper of @uppercase # in wrapper of @hello # name:hyuk3, f(name):HYUK3 # name:hyuk3, f(name):Hello HYUK3 # in wrapper of @hello # name:hyuk3, f(name):HYUK3 # name:hyuk3, f(name):HELLO HYUK3 # in wrapper of @uppercase # in wrapper of @hello # name:hyuk3, f(name):HYUK3 # name:hyuk3, f(name):Hello HYUK3 # in wrapper of @hello # name:hyuk3, f(name):HYUK3 # === say_hello_to3("hyuk3") @hello @uppercase @split_string === # ['HELLO', 'HYUK3']
def hello(f): print(f'{f} in @hello') def f_wrapper(name): print('in wrapper of @hello') print(f'name:{name}, f(name):{f(name)}') return f'Hello {f(name)}' return f_wrapper def uppercase(f): print(f'{f} in @uppercase') def f_wrapper(name): print('in wrapper of @uppercase') print(f'name:{name}, f(name):{f(name)}') return f(name).upper() return f_wrapper def split_string(f): print(f'{f} in @split_string') def f_wrapper(name): print('in wrapper of @split_string') print(f'name:{name}, f(name):{f(name)}') return f(name).split() return f_wrapper @hello def say_hello_to1(name): return name.upper() @uppercase @hello def say_hello_to2(name): return name.upper() @split_string @uppercase @hello def say_hello_to3(name): return name.upper() print(f"""\n=== say_hello_to1("hyuk1") @hello ===\n{say_hello_to1('hyuk1')}\n""") print(f"""\n=== say_hello_to2("hyuk2") @hello @uppercase ===\n{say_hello_to2('hyuk2')}\n""") print(f"""\n=== say_hello_to3("hyuk3") @hello @uppercase @split_string ===\n{say_hello_to3('hyuk3')}\n""") ' EXPLANATION\n\nThe say_hello_to3 function returns output\nHYUK3 -- by -- return name.upper()\nThis output is then passed into @hello\n\nWhen @hello is applied, we get returned output\nHello HYUK3 -- by -- return f"Hello {f(name)}"\nThis output is then passed into @uppercase\n\nWhen @uppercase is applied, we get returned output\nHELLO HYUK3 -- by -- return f(name).upper()\nThis output is then passed into @split_string\n\nWhen @split_string is applied, we get returned output\n[\'HELLO\', \'HYUK3\'] -- by -- return f(name).upper()\nThis output is final return.\n\n'
''' Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example: nums = [-4, -2, 2, 4], a = 1, b = 3, c = 5, Result: [3, 9, 15, 33] nums = [-4, -2, 2, 4], a = -1, b = 3, c = 5 Result: [-23, -5, 1, 7] ''' class Solution(object): def sortTransformedArray(self, nums, a, b, c): """ :type nums: List[int] :type a: int :type b: int :type c: int :rtype: List[int] """ if a == 0: if b == 0: return [c for i in xrange(len(nums))] elif b > 0: return [b * x + c for x in nums] else: # b < 0 return [b * x + c for x in reversed(nums)] elif a > 0: mid = -b / (2.0 * a) i = 0 j = len(nums) - 1 res = [] while i <= j: if abs(nums[i] - mid) > abs(nums[j] - mid): res = [self.f(nums[i], a, b, c)] + res i += 1 else: res = [self.f(nums[j], a, b, c)] + res j -= 1 return res else: # a < 0 mid = -b / (2.0 * a) i = 0 j = len(nums) - 1 res = [] while i <= j: if (abs(nums[i] - mid) > abs(nums[j] - mid)): res.append(self.f(nums[i], a, b, c)) i += 1 else: res.append(self.f(nums[j], a, b, c)) j -= 1 return res def f(self, x, a, b, c): return a * x * x + b * x + c
""" Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array. The returned array must be in sorted order. Expected time complexity: O(n) Example: nums = [-4, -2, 2, 4], a = 1, b = 3, c = 5, Result: [3, 9, 15, 33] nums = [-4, -2, 2, 4], a = -1, b = 3, c = 5 Result: [-23, -5, 1, 7] """ class Solution(object): def sort_transformed_array(self, nums, a, b, c): """ :type nums: List[int] :type a: int :type b: int :type c: int :rtype: List[int] """ if a == 0: if b == 0: return [c for i in xrange(len(nums))] elif b > 0: return [b * x + c for x in nums] else: return [b * x + c for x in reversed(nums)] elif a > 0: mid = -b / (2.0 * a) i = 0 j = len(nums) - 1 res = [] while i <= j: if abs(nums[i] - mid) > abs(nums[j] - mid): res = [self.f(nums[i], a, b, c)] + res i += 1 else: res = [self.f(nums[j], a, b, c)] + res j -= 1 return res else: mid = -b / (2.0 * a) i = 0 j = len(nums) - 1 res = [] while i <= j: if abs(nums[i] - mid) > abs(nums[j] - mid): res.append(self.f(nums[i], a, b, c)) i += 1 else: res.append(self.f(nums[j], a, b, c)) j -= 1 return res def f(self, x, a, b, c): return a * x * x + b * x + c
class Generator(object): def __init__(self, number, factor): self.number = number self.factor = factor def next(self): self.number = (self.number * self.factor) % 2147483647 return self.number class Judge(object): def __init__(self): self.A = Generator(512, 16807) self.B = Generator(191, 48271) def do_steps(self, steps): ctr = 0 for i in range(steps): if (self.A.next() & 0xFFFF) == (self.B.next() & 0xFFFF): ctr += 1 print(ctr, i) return ctr j = Judge() print(j.do_steps(40 * 1000 * 1000))
class Generator(object): def __init__(self, number, factor): self.number = number self.factor = factor def next(self): self.number = self.number * self.factor % 2147483647 return self.number class Judge(object): def __init__(self): self.A = generator(512, 16807) self.B = generator(191, 48271) def do_steps(self, steps): ctr = 0 for i in range(steps): if self.A.next() & 65535 == self.B.next() & 65535: ctr += 1 print(ctr, i) return ctr j = judge() print(j.do_steps(40 * 1000 * 1000))
class primary_key(object): """A decorator to assign the primary key to a Model class""" def __init__(self, partition_key, sort_key=None): """constructor for the primary_key decorator Arguments: partition_key -- a string of the tables partition_key sort_key -- optional string of the sort_key for the table """ self.partition_key = partition_key self.sort_key = sort_key def __call__(self, cls): """Automatically add _primary_key to the Model class""" column = getattr(cls, self.partition_key) if self.sort_key: cls._primary_key = (column, getattr(cls, self.sort_key)) else: cls._primary_key = (column,) return cls
class Primary_Key(object): """A decorator to assign the primary key to a Model class""" def __init__(self, partition_key, sort_key=None): """constructor for the primary_key decorator Arguments: partition_key -- a string of the tables partition_key sort_key -- optional string of the sort_key for the table """ self.partition_key = partition_key self.sort_key = sort_key def __call__(self, cls): """Automatically add _primary_key to the Model class""" column = getattr(cls, self.partition_key) if self.sort_key: cls._primary_key = (column, getattr(cls, self.sort_key)) else: cls._primary_key = (column,) return cls
fig, ax = plt.subplots() im = ax.pcolor(grouped_pivot, cmap='RdBu') #label names row_labels = grouped_pivot.columns.levels[1] col_labels = grouped_pivot.index #move ticks and labels to the center ax.set_xticks(np.arange(grouped_pivot.shape[1]) + 0.5, minor=False) ax.set_yticks(np.arange(grouped_pivot.shape[0]) + 0.5, minor=False) #insert labels ax.set_xticklabels(row_labels, minor=False) ax.set_yticklabels(col_labels, minor=False) #rotate label if too long plt.xticks(rotation=90) fig.colorbar(im) plt.show()
(fig, ax) = plt.subplots() im = ax.pcolor(grouped_pivot, cmap='RdBu') row_labels = grouped_pivot.columns.levels[1] col_labels = grouped_pivot.index ax.set_xticks(np.arange(grouped_pivot.shape[1]) + 0.5, minor=False) ax.set_yticks(np.arange(grouped_pivot.shape[0]) + 0.5, minor=False) ax.set_xticklabels(row_labels, minor=False) ax.set_yticklabels(col_labels, minor=False) plt.xticks(rotation=90) fig.colorbar(im) plt.show()
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : ZhaoYY #pylint: disable=invalid-name ''' problems about int. ''' class IntProblem: ''' int problems ''' def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x > 0 and x % 10 == 0: return False t = 0 z = x while x > 0: t = t * 10 + x % 10 x //= 10 if t == x: return True return t == z def countAndSay(self, n): """ https://leetcode.com/problems/count-and-say/description/ :type n: int :rtype: str """ l = [] for i in range(n): if l: last, count, t = -1, 0, '' for s in l[i - 1]: n = int(s) if last < 0: last = n count = 1 elif last == n: count += 1 else: t += str(count) + str(last) last = n count = 1 t += str(count) + str(last) l.append(t) else: l.append('1') return l[i] def countPrimeSetBits(self, L, R): """ https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/description/ :type L: int :type R: int :rtype: int """ prims = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31} count = 0 for n in range(L, R + 1): if bin(n)[2:].count('1') in prims: count += 1 return count def countPrimeSetBitsSimple(self, L, R): count = 0 for n in range(L, R + 1): count += 665772 >> bin(n).count('1') & 1 return count if __name__ == "__main__": problem = IntProblem() print(problem.countAndSay(5))
""" problems about int. """ class Intproblem: """ int problems """ def is_palindrome(self, x): """ :type x: int :rtype: bool """ if x > 0 and x % 10 == 0: return False t = 0 z = x while x > 0: t = t * 10 + x % 10 x //= 10 if t == x: return True return t == z def count_and_say(self, n): """ https://leetcode.com/problems/count-and-say/description/ :type n: int :rtype: str """ l = [] for i in range(n): if l: (last, count, t) = (-1, 0, '') for s in l[i - 1]: n = int(s) if last < 0: last = n count = 1 elif last == n: count += 1 else: t += str(count) + str(last) last = n count = 1 t += str(count) + str(last) l.append(t) else: l.append('1') return l[i] def count_prime_set_bits(self, L, R): """ https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/description/ :type L: int :type R: int :rtype: int """ prims = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31} count = 0 for n in range(L, R + 1): if bin(n)[2:].count('1') in prims: count += 1 return count def count_prime_set_bits_simple(self, L, R): count = 0 for n in range(L, R + 1): count += 665772 >> bin(n).count('1') & 1 return count if __name__ == '__main__': problem = int_problem() print(problem.countAndSay(5))
#!/usr/bin/env python3 """ Learn Python 3 the hard way exercise 1 """
""" Learn Python 3 the hard way exercise 1 """
def sayhello(name): return "Hello, " + name + ", nice to meet you!" if __name__ == "__main__": print(sayhello(input("What is your name? ")))
def sayhello(name): return 'Hello, ' + name + ', nice to meet you!' if __name__ == '__main__': print(sayhello(input('What is your name? ')))
# using cube coordinates: https://www.redblobgames.com/grids/hexagons/ def update(tile, command): x, y, z = tile if command == 'w': x -= 1 y += 1 elif command == 'e': x += 1 y -= 1 elif command == 'nw': y += 1 z -= 1 elif command == 'se': y -= 1 z += 1 elif command == 'ne': x += 1 z -= 1 elif command == 'sw': x -= 1 z += 1 assert x + y + z == 0 return [x, y, z] def neighbors(tile): directions = ['w', 'e', 'nw', 'ne', 'sw', 'se'] return [update(tile, direction) for direction in directions] # input with open('input.txt') as f: lines = f.readlines() # part 1 flipped = [] for line in lines: commands = line.replace('w', 'w,').replace('e', 'e,').split(',')[:-1] tile = [0, 0, 0] for command in commands: tile = update(tile, command) flipped.remove(tile) if tile in flipped else flipped.append(tile) ans1 = len(flipped) # part 2 for _ in range(100): possible = [] for tile in flipped: possible += [adj for adj in neighbors(tile) if adj not in possible] possible += [tile for tile in flipped if tile not in possible] next_flipped = flipped.copy() for tile in possible: num = len([adj for adj in neighbors(tile) if adj in flipped]) if tile in flipped: if num == 0 or num > 2: next_flipped.remove(tile) else: if num == 2: next_flipped.append(tile) flipped = next_flipped ans2 = len(flipped) # output answer = [] answer.append('Part 1: {}'.format(ans1)) answer.append('Part 2: {}'.format(ans2)) with open('solution.txt', 'w') as f: f.writelines('\n'.join(answer)+'\n')
def update(tile, command): (x, y, z) = tile if command == 'w': x -= 1 y += 1 elif command == 'e': x += 1 y -= 1 elif command == 'nw': y += 1 z -= 1 elif command == 'se': y -= 1 z += 1 elif command == 'ne': x += 1 z -= 1 elif command == 'sw': x -= 1 z += 1 assert x + y + z == 0 return [x, y, z] def neighbors(tile): directions = ['w', 'e', 'nw', 'ne', 'sw', 'se'] return [update(tile, direction) for direction in directions] with open('input.txt') as f: lines = f.readlines() flipped = [] for line in lines: commands = line.replace('w', 'w,').replace('e', 'e,').split(',')[:-1] tile = [0, 0, 0] for command in commands: tile = update(tile, command) flipped.remove(tile) if tile in flipped else flipped.append(tile) ans1 = len(flipped) for _ in range(100): possible = [] for tile in flipped: possible += [adj for adj in neighbors(tile) if adj not in possible] possible += [tile for tile in flipped if tile not in possible] next_flipped = flipped.copy() for tile in possible: num = len([adj for adj in neighbors(tile) if adj in flipped]) if tile in flipped: if num == 0 or num > 2: next_flipped.remove(tile) elif num == 2: next_flipped.append(tile) flipped = next_flipped ans2 = len(flipped) answer = [] answer.append('Part 1: {}'.format(ans1)) answer.append('Part 2: {}'.format(ans2)) with open('solution.txt', 'w') as f: f.writelines('\n'.join(answer) + '\n')
# Demo Python For Loops - The range() Function ''' The range() Function - Part 2 The range() function defaults to 0 as a starting value, however it is possible to specify the starting value by adding a parameter: range(2, 6), which means values from 2 to 6 (but not including 6): ''' # Using the start parameter: for x in range(2, 7): print(x)
""" The range() Function - Part 2 The range() function defaults to 0 as a starting value, however it is possible to specify the starting value by adding a parameter: range(2, 6), which means values from 2 to 6 (but not including 6): """ for x in range(2, 7): print(x)
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def create_ThriftUnicodeDecodeError_from_UnicodeDecodeError(error, field_name): if isinstance(error, ThriftUnicodeDecodeError): error.field_names.append(field_name) return error return ThriftUnicodeDecodeError( error.encoding, error.object, error.start, error.end, error.reason, field_name ) class ThriftUnicodeDecodeError(UnicodeDecodeError): def __init__(self, encoding, object, start, end, reason, field_name): super(ThriftUnicodeDecodeError, self).__init__(encoding, object, start, end, reason) self.field_names = [field_name] def __str__(self): return "{error} when decoding field '{field}'".format( error=super(ThriftUnicodeDecodeError, self).__str__(), field="->".join(reversed(self.field_names)) )
def create__thrift_unicode_decode_error_from__unicode_decode_error(error, field_name): if isinstance(error, ThriftUnicodeDecodeError): error.field_names.append(field_name) return error return thrift_unicode_decode_error(error.encoding, error.object, error.start, error.end, error.reason, field_name) class Thriftunicodedecodeerror(UnicodeDecodeError): def __init__(self, encoding, object, start, end, reason, field_name): super(ThriftUnicodeDecodeError, self).__init__(encoding, object, start, end, reason) self.field_names = [field_name] def __str__(self): return "{error} when decoding field '{field}'".format(error=super(ThriftUnicodeDecodeError, self).__str__(), field='->'.join(reversed(self.field_names)))
class Enactor: def __init__(self, dev_info, sftp_location, sftp_port, sftp_username, sftp_password, sftp_key_location, sftp_directory): pass def stop(self): pass def enact_light_plan(self, dev, BL_Quota, NL_Quota): return True def enact_socket_plan(self, dev, AC_total): return True def retreive_previous_plan_AC(self, dev): return None def retreive_previous_plan_DC(self, dev): return None def check_diff_light(self, prev_plan, BL_Quota, NL_Quota): return 1.0 def check_diff_socket(self, prev_plan, AC_total): return 1.0
class Enactor: def __init__(self, dev_info, sftp_location, sftp_port, sftp_username, sftp_password, sftp_key_location, sftp_directory): pass def stop(self): pass def enact_light_plan(self, dev, BL_Quota, NL_Quota): return True def enact_socket_plan(self, dev, AC_total): return True def retreive_previous_plan_ac(self, dev): return None def retreive_previous_plan_dc(self, dev): return None def check_diff_light(self, prev_plan, BL_Quota, NL_Quota): return 1.0 def check_diff_socket(self, prev_plan, AC_total): return 1.0
# noinspection PyUnusedLocal # skus = unicode string def getItems(): items = { 'A': 50, 'B': 30, 'C': 20, 'D': 15, 'E': 40, 'F': 10, 'G': 20, 'H': 10, 'I': 35, 'J': 60, 'K': 70, 'L': 90, 'M': 15, 'N': 40, 'O': 10, 'P': 50, 'Q': 30, 'R': 50, 'S': 20, 'T': 20, 'U': 40, 'V': 50, 'W': 20, 'X': 17, 'Y': 20, 'Z': 21} return items def getMultiItems(): multiItems = { 'A': [0, 0, 130, 0, 200], # 3A for 130, 5A for 200 'B': [0, 45], # 2B for 45 'H': [0, 0, 0, 0, 45, 0, 0, 0, 0, 80], # 5H for 45, 10H for 80 'K': [0, 120], # 2K for 120 'P': [0, 0, 0, 0, 200], # 5P for 200 'Q': [0, 0, 80], # 3Q for 80 'V': [0, 90, 130]} # 2V for 90, 3V for 130 return multiItems def getPassTests(skus, items): """Input tests""" passTest = True # check string if not isinstance(skus, str): passTest = False # check valid skus if not set(skus).issubset(items): passTest = False return passTest def getSkuCounts(skus, items): """Build inventory dictionary""" skuCounts = {} for sku in items: skuCounts[sku] = list(skus).count(sku) return skuCounts def adjustForGroupOffers(skuCounts): """ X, S, T, Y, Z increasing prices""" decr = ['Z', 'Y', 'T', 'S', 'X'] special = [skuCounts.get(sku, 0) for sku in decr] groupOffer = 0 n = sum(special) if n >= 3: # group offer price groups = n // 3 deduce = groups * 3 groupOffer = 45 * groups # adjust counts from the most expensive to the least to be nice for sku in decr: print('sku: %s n: %s' % (sku, deduce)) skuCount = skuCounts[sku] if deduce > skuCount: deduce -= skuCounts[sku] skuCounts[sku] = 0 else: skuCounts[sku] -= deduce deduce = 0 print('skuCounts: %s' % skuCounts) if deduce < 1: break return groupOffer, skuCounts def adjustForOffers(skuCounts): if 'E' in skuCounts: # 2E get one B free offers = skuCounts['E'] // 2 if offers > 0: skuCounts['B'] -= offers if skuCounts['B'] < 0: skuCounts['B'] = 0 print('E skuCounts: %s' % skuCounts) if 'F' in skuCounts: # 2F get one F free if skuCounts['F'] >= 3: offers = skuCounts['F'] // 3 if offers > 0: skuCounts['F'] -= offers if skuCounts['F'] < 0: skuCounts['F'] = 0 print('F skuCounts: %s' % skuCounts) if 'N' in skuCounts: # 3N get one M free if skuCounts['N'] >= 3: offers = skuCounts['N'] // 3 if offers > 0: skuCounts['M'] -= offers if skuCounts['M'] < 0: skuCounts['M'] = 0 print('N skuCounts: %s' % skuCounts) if 'R' in skuCounts: # 3R get one Q free if skuCounts['R'] >= 3: offers = skuCounts['R'] // 3 if offers > 0: skuCounts['Q'] -= offers if skuCounts['Q'] < 0: skuCounts['Q'] = 0 print('R skuCounts: %s' % skuCounts) if 'U' in skuCounts: # 3U get one U free if skuCounts['U'] >= 4: offers = skuCounts['U'] // 4 if offers > 0: skuCounts['U'] -= offers if skuCounts['U'] < 0: skuCounts['U'] = 0 print('U skuCounts: %s' % skuCounts) return skuCounts def adjustForDiscounts(skuCounts, multiItems): discounted = 0 for sku in multiItems: print('sku: %s' % sku) if sku in skuCounts: offers= multiItems[sku] print('offers: %s' % offers) for i in range(len(offers)): print('i: %s' % i) n = len(offers) - i pos = n - 1 if multiItems[sku][pos] > 0: discounted += multiItems[sku][pos] * (skuCounts[sku] // n) print('discounted: %s' % discounted) skuCounts[sku] = skuCounts[sku] % n print('skuCounts: %s' % skuCounts) return discounted, skuCounts def getRegular(skuCounts, items): regular = 0 for sku, count in skuCounts.items(): regular += skuCounts[sku] * items[sku] print('regular: %s' % regular) return regular def checkout(skus): items = getItems() multiItems = getMultiItems() # check input integrity passTests = getPassTests(skus, items) if not passTests: return -1 # build inventory skuCounts = getSkuCounts(skus, items) print('skuCounts: %s' % skuCounts) # adjust inventory for group offers groupOffer, skuCounts = adjustForGroupOffers(skuCounts) # adjust inventory for offers skuCounts = adjustForOffers(skuCounts) # adjust inventory for discounts discounted, skuCounts = adjustForDiscounts(skuCounts, multiItems) # no discounts total regular = getRegular(skuCounts, items) # finalise total total = groupOffer + discounted + regular # return('done') return total #Result is: FAILED #Some requests have failed (1/141). Here are some of them: # - {"method":"checkout","params":["UUU"],"id":"CHK_R4_054"}, expected: 120, got: 80 """ skuCounts = {'Z': 1, 'Y': 1, 'T': 1, 'S': 1, 'X': 1} skuCounts decr = ['Z', 'Y', 'T', 'S', 'X'] special = [skuCounts.get(sku, 0) for sku in decr] special groupOffer = 0 n = sum(special) if n >= 3: # group offer price groups = n // 3 deduce = groups * 3 groupOffer = 45 * groups # adjust counts from the most expensive to the least to be nice for sku in decr: print('sku: %s n: %s' % (sku, deduce)) skuCount = skuCounts[sku] if deduce > skuCount: deduce -= skuCounts[sku] skuCounts[sku] = 0 else: skuCounts[sku] -= deduce deduce = 0 print('skuCounts: %s' % skuCounts) if deduce < 1: break skuCounts groupOffer """ a = checkout('UUU') a #---------------- #a = checkout("EEB") #a #---------------- #a = checkout("EEEB") #a #---------------- #a = checkout("F") #a #---------------- #a = checkout("FF") #a #---------------- #a = checkout("FFF") #a #---------------- #a = checkout("FFFFF") #a
def get_items(): items = {'A': 50, 'B': 30, 'C': 20, 'D': 15, 'E': 40, 'F': 10, 'G': 20, 'H': 10, 'I': 35, 'J': 60, 'K': 70, 'L': 90, 'M': 15, 'N': 40, 'O': 10, 'P': 50, 'Q': 30, 'R': 50, 'S': 20, 'T': 20, 'U': 40, 'V': 50, 'W': 20, 'X': 17, 'Y': 20, 'Z': 21} return items def get_multi_items(): multi_items = {'A': [0, 0, 130, 0, 200], 'B': [0, 45], 'H': [0, 0, 0, 0, 45, 0, 0, 0, 0, 80], 'K': [0, 120], 'P': [0, 0, 0, 0, 200], 'Q': [0, 0, 80], 'V': [0, 90, 130]} return multiItems def get_pass_tests(skus, items): """Input tests""" pass_test = True if not isinstance(skus, str): pass_test = False if not set(skus).issubset(items): pass_test = False return passTest def get_sku_counts(skus, items): """Build inventory dictionary""" sku_counts = {} for sku in items: skuCounts[sku] = list(skus).count(sku) return skuCounts def adjust_for_group_offers(skuCounts): """ X, S, T, Y, Z increasing prices""" decr = ['Z', 'Y', 'T', 'S', 'X'] special = [skuCounts.get(sku, 0) for sku in decr] group_offer = 0 n = sum(special) if n >= 3: groups = n // 3 deduce = groups * 3 group_offer = 45 * groups for sku in decr: print('sku: %s n: %s' % (sku, deduce)) sku_count = skuCounts[sku] if deduce > skuCount: deduce -= skuCounts[sku] skuCounts[sku] = 0 else: skuCounts[sku] -= deduce deduce = 0 print('skuCounts: %s' % skuCounts) if deduce < 1: break return (groupOffer, skuCounts) def adjust_for_offers(skuCounts): if 'E' in skuCounts: offers = skuCounts['E'] // 2 if offers > 0: skuCounts['B'] -= offers if skuCounts['B'] < 0: skuCounts['B'] = 0 print('E skuCounts: %s' % skuCounts) if 'F' in skuCounts: if skuCounts['F'] >= 3: offers = skuCounts['F'] // 3 if offers > 0: skuCounts['F'] -= offers if skuCounts['F'] < 0: skuCounts['F'] = 0 print('F skuCounts: %s' % skuCounts) if 'N' in skuCounts: if skuCounts['N'] >= 3: offers = skuCounts['N'] // 3 if offers > 0: skuCounts['M'] -= offers if skuCounts['M'] < 0: skuCounts['M'] = 0 print('N skuCounts: %s' % skuCounts) if 'R' in skuCounts: if skuCounts['R'] >= 3: offers = skuCounts['R'] // 3 if offers > 0: skuCounts['Q'] -= offers if skuCounts['Q'] < 0: skuCounts['Q'] = 0 print('R skuCounts: %s' % skuCounts) if 'U' in skuCounts: if skuCounts['U'] >= 4: offers = skuCounts['U'] // 4 if offers > 0: skuCounts['U'] -= offers if skuCounts['U'] < 0: skuCounts['U'] = 0 print('U skuCounts: %s' % skuCounts) return skuCounts def adjust_for_discounts(skuCounts, multiItems): discounted = 0 for sku in multiItems: print('sku: %s' % sku) if sku in skuCounts: offers = multiItems[sku] print('offers: %s' % offers) for i in range(len(offers)): print('i: %s' % i) n = len(offers) - i pos = n - 1 if multiItems[sku][pos] > 0: discounted += multiItems[sku][pos] * (skuCounts[sku] // n) print('discounted: %s' % discounted) skuCounts[sku] = skuCounts[sku] % n print('skuCounts: %s' % skuCounts) return (discounted, skuCounts) def get_regular(skuCounts, items): regular = 0 for (sku, count) in skuCounts.items(): regular += skuCounts[sku] * items[sku] print('regular: %s' % regular) return regular def checkout(skus): items = get_items() multi_items = get_multi_items() pass_tests = get_pass_tests(skus, items) if not passTests: return -1 sku_counts = get_sku_counts(skus, items) print('skuCounts: %s' % skuCounts) (group_offer, sku_counts) = adjust_for_group_offers(skuCounts) sku_counts = adjust_for_offers(skuCounts) (discounted, sku_counts) = adjust_for_discounts(skuCounts, multiItems) regular = get_regular(skuCounts, items) total = groupOffer + discounted + regular return total "\nskuCounts = {'Z': 1, 'Y': 1, 'T': 1, 'S': 1, 'X': 1}\nskuCounts\n\ndecr = ['Z', 'Y', 'T', 'S', 'X'] \n\nspecial = [skuCounts.get(sku, 0) for sku in decr]\nspecial\n\ngroupOffer = 0\nn = sum(special)\nif n >= 3:\n # group offer price\n groups = n // 3\n deduce = groups * 3\n groupOffer = 45 * groups\n \n # adjust counts from the most expensive to the least to be nice\n for sku in decr:\n print('sku: %s n: %s' % (sku, deduce))\n skuCount = skuCounts[sku]\n \n if deduce > skuCount:\n deduce -= skuCounts[sku]\n skuCounts[sku] = 0\n else:\n skuCounts[sku] -= deduce\n deduce = 0\n print('skuCounts: %s' % skuCounts)\n \n if deduce < 1:\n break\n\nskuCounts\ngroupOffer\n" a = checkout('UUU') a
class Solution: def reverse(self, x: int): flag = 0 minus = "-" if x < 0: flag = 1 x = x * -1 result= str(x) result = ''.join(reversed(result)) x = int(result) if flag == 1: x = x * -1 if x > 2147483647 or x < -2147483647: return 0 return x
class Solution: def reverse(self, x: int): flag = 0 minus = '-' if x < 0: flag = 1 x = x * -1 result = str(x) result = ''.join(reversed(result)) x = int(result) if flag == 1: x = x * -1 if x > 2147483647 or x < -2147483647: return 0 return x
class Solution: def compareVersion(self, version1: str, version2: str) -> int: v1 = [int(x) for x in version1.split('.')] v2 = [int(x) for x in version2.split('.')] while v1 and v1[-1] == 0: v1.pop() while v2 and v2[-1] == 0: v2.pop() if v1 < v2: return -1 elif v1 > v2: return 1 else: return 0
class Solution: def compare_version(self, version1: str, version2: str) -> int: v1 = [int(x) for x in version1.split('.')] v2 = [int(x) for x in version2.split('.')] while v1 and v1[-1] == 0: v1.pop() while v2 and v2[-1] == 0: v2.pop() if v1 < v2: return -1 elif v1 > v2: return 1 else: return 0
def star(N): for i in range(0,N): for j in range(0,i+1): print("*",end = "") print("\r") if __name__ == '__main__': N = int(input()) star(N)
def star(N): for i in range(0, N): for j in range(0, i + 1): print('*', end='') print('\r') if __name__ == '__main__': n = int(input()) star(N)
class Solution: def isBalanced(self, root: TreeNode) -> bool: return self.height(root) != -1 def height(self, root): if not root: return 0 lh = self.height(root.right) if lh == -1: return -1 rh = self.height(root.left) if rh == -1: return -1 if abs(lh - rh) > 1: return -1 return max(lh, rh) + 1
class Solution: def is_balanced(self, root: TreeNode) -> bool: return self.height(root) != -1 def height(self, root): if not root: return 0 lh = self.height(root.right) if lh == -1: return -1 rh = self.height(root.left) if rh == -1: return -1 if abs(lh - rh) > 1: return -1 return max(lh, rh) + 1
"""Path sum: two ways """ matrix_height = 80 matrix_width = 80 def traverse(matrix, v, h, cur_score=0, max_path=[[False] * matrix_width for x in range(matrix_height)]): max_path[matrix_height-1][matrix_width-1] = matrix[matrix_height-1][matrix_width-1] min_score = float("inf") if max_path[v][h]: return cur_score + max_path[v][h] if v + 1 < matrix_height: min_score = min(min_score, traverse(matrix, v + 1, h, cur_score + matrix[v][h])) if h + 1 < matrix_width: min_score = min(min_score, traverse(matrix, v, h + 1, cur_score + matrix[v][h])) max_path[v][h] = min_score return min_score matrix = [] with open("./data/p091_matrix.txt", "r") as f: for line in f: matrix.append(list(map(int, line.split(",")))) for x in range(matrix_height-1, -1, -1): for y in range(matrix_height-1, -1, -1): traverse(matrix, x, y) print(traverse(matrix, 0, 0))
"""Path sum: two ways """ matrix_height = 80 matrix_width = 80 def traverse(matrix, v, h, cur_score=0, max_path=[[False] * matrix_width for x in range(matrix_height)]): max_path[matrix_height - 1][matrix_width - 1] = matrix[matrix_height - 1][matrix_width - 1] min_score = float('inf') if max_path[v][h]: return cur_score + max_path[v][h] if v + 1 < matrix_height: min_score = min(min_score, traverse(matrix, v + 1, h, cur_score + matrix[v][h])) if h + 1 < matrix_width: min_score = min(min_score, traverse(matrix, v, h + 1, cur_score + matrix[v][h])) max_path[v][h] = min_score return min_score matrix = [] with open('./data/p091_matrix.txt', 'r') as f: for line in f: matrix.append(list(map(int, line.split(',')))) for x in range(matrix_height - 1, -1, -1): for y in range(matrix_height - 1, -1, -1): traverse(matrix, x, y) print(traverse(matrix, 0, 0))
class Metrics: listMetric = {} def addMetric(self, metric): self.listMetric[metric.getName()] = metric.getData() def getMetrics(self): return self.listMetric
class Metrics: list_metric = {} def add_metric(self, metric): self.listMetric[metric.getName()] = metric.getData() def get_metrics(self): return self.listMetric
# coding: utf-8 class Maxipago(object): def __init__(self, maxid, api_key, api_version='3.1.1.15', sandbox=False): self.maxid = maxid self.api_key = api_key self.api_version = api_version self.sandbox = sandbox def __getattr__(self, name): try: class_name = ''.join([n.title() for n in name.split('_') + ['manager']]) module = __import__('maxipago.managers.{0}'.format(name), fromlist=['']) klass = getattr(module, class_name) return klass(self.maxid, self.api_key, self.api_version, self.sandbox) except ImportError: if name in self.__dict__: return self.__dict__.get('name') except AttributeError: raise AttributeError
class Maxipago(object): def __init__(self, maxid, api_key, api_version='3.1.1.15', sandbox=False): self.maxid = maxid self.api_key = api_key self.api_version = api_version self.sandbox = sandbox def __getattr__(self, name): try: class_name = ''.join([n.title() for n in name.split('_') + ['manager']]) module = __import__('maxipago.managers.{0}'.format(name), fromlist=['']) klass = getattr(module, class_name) return klass(self.maxid, self.api_key, self.api_version, self.sandbox) except ImportError: if name in self.__dict__: return self.__dict__.get('name') except AttributeError: raise AttributeError
# Copyright 2009-2017 Ram Rachum. # This program is distributed under the MIT license. '''Defines different rounding options for binary search.''' # todo: Confirm that `*_IF_BOTH` options are used are used in all places that # currently ~use them. class Rounding: '''Base class for rounding options for binary search.''' class BOTH(Rounding): ''' Get a tuple `(low, high)` of the 2 items that surround the specified value. If there's an exact match, gives it twice in the tuple, i.e. `(match, match)`. ''' class EXACT(Rounding): '''Get the item that has exactly the same value has the specified value.''' class CLOSEST(Rounding): '''Get the item which has a value closest to the specified value.''' class LOW(Rounding): ''' Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. ''' class HIGH(Rounding): ''' Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. ''' class LOW_IF_BOTH(Rounding): ''' Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. Before it returns the item, it checks if there also exists an item with a value *higher* than the specified value or equal to it. If there isn't, it returns `None`. (If there's an exact match, this rounding will return it.) ''' class HIGH_IF_BOTH(Rounding): ''' Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. Before it returns the item, it checks if there also exists an item with a value *lower* than the specified value or equal to it. If there isn't, it returns `None`. (If there's an exact match, this rounding will return it.) ''' class CLOSEST_IF_BOTH(Rounding): ''' Get the item which has a value closest to the specified value. Before it returns the item, it checks if there also exists an item which is "on the other side" of the specified value. e.g. if the closest item is higher than the specified item, it will confirm that there exists an item *below* the specified value. (And vice versa.) If there isn't it returns `None`. (If there's an exact match, this rounding will return it.) ''' class LOW_OTHERWISE_HIGH(Rounding): ''' Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. If there is no item below, give the one just above. (If there's an exact match, this rounding will return it.) ''' class HIGH_OTHERWISE_LOW(Rounding): ''' Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. If there is no item above, give the one just below. (If there's an exact match, this rounding will return it.) ''' roundings = (LOW, LOW_IF_BOTH, LOW_OTHERWISE_HIGH, HIGH, HIGH_IF_BOTH, HIGH_OTHERWISE_LOW, EXACT, CLOSEST, CLOSEST_IF_BOTH, BOTH) '''List of all the available roundings.'''
"""Defines different rounding options for binary search.""" class Rounding: """Base class for rounding options for binary search.""" class Both(Rounding): """ Get a tuple `(low, high)` of the 2 items that surround the specified value. If there's an exact match, gives it twice in the tuple, i.e. `(match, match)`. """ class Exact(Rounding): """Get the item that has exactly the same value has the specified value.""" class Closest(Rounding): """Get the item which has a value closest to the specified value.""" class Low(Rounding): """ Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. """ class High(Rounding): """ Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. """ class Low_If_Both(Rounding): """ Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. Before it returns the item, it checks if there also exists an item with a value *higher* than the specified value or equal to it. If there isn't, it returns `None`. (If there's an exact match, this rounding will return it.) """ class High_If_Both(Rounding): """ Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. Before it returns the item, it checks if there also exists an item with a value *lower* than the specified value or equal to it. If there isn't, it returns `None`. (If there's an exact match, this rounding will return it.) """ class Closest_If_Both(Rounding): """ Get the item which has a value closest to the specified value. Before it returns the item, it checks if there also exists an item which is "on the other side" of the specified value. e.g. if the closest item is higher than the specified item, it will confirm that there exists an item *below* the specified value. (And vice versa.) If there isn't it returns `None`. (If there's an exact match, this rounding will return it.) """ class Low_Otherwise_High(Rounding): """ Get the item with a value that is just below the specified value. i.e. the highest item which has a value lower or equal to the specified value. If there is no item below, give the one just above. (If there's an exact match, this rounding will return it.) """ class High_Otherwise_Low(Rounding): """ Get the item with a value that is just above the specified value. i.e. the lowest item which has a value higher or equal to the specified value. If there is no item above, give the one just below. (If there's an exact match, this rounding will return it.) """ roundings = (LOW, LOW_IF_BOTH, LOW_OTHERWISE_HIGH, HIGH, HIGH_IF_BOTH, HIGH_OTHERWISE_LOW, EXACT, CLOSEST, CLOSEST_IF_BOTH, BOTH) 'List of all the available roundings.'
expected_output = { "interfaces": { "GigabitEthernet1/0/1": { "name": "foo bar", "down_time": "00:00:00", "up_time": "4d5h", }, } }
expected_output = {'interfaces': {'GigabitEthernet1/0/1': {'name': 'foo bar', 'down_time': '00:00:00', 'up_time': '4d5h'}}}
data = [ [0, 'Does your animal fly?', 1, 2], [1, 'Is your flying animal a bird?', 3, 4], [2, 'Does your animal live underwater?', 7, 8], [3, 'Is your bird native to Australia?', 5, 6], [4, 'Is it a fruit bat?'], [5, 'Is it a kookaburra?'], [6, 'Is it a blue jay?'], [7, 'Is your animal a mammal?', 9, 10], [8, 'Is it a wombat?'], [9, 'Is it a blue whale?'], [10, 'Is it a goldfish?'], ] i = 0 while True: question = data[i][1] x = input(question + ' ') if len(data[i]) == 2: break if x == 'y': i = data[i][2] if x == 'n': i = data[i][3] print('Thanks for playing')
data = [[0, 'Does your animal fly?', 1, 2], [1, 'Is your flying animal a bird?', 3, 4], [2, 'Does your animal live underwater?', 7, 8], [3, 'Is your bird native to Australia?', 5, 6], [4, 'Is it a fruit bat?'], [5, 'Is it a kookaburra?'], [6, 'Is it a blue jay?'], [7, 'Is your animal a mammal?', 9, 10], [8, 'Is it a wombat?'], [9, 'Is it a blue whale?'], [10, 'Is it a goldfish?']] i = 0 while True: question = data[i][1] x = input(question + ' ') if len(data[i]) == 2: break if x == 'y': i = data[i][2] if x == 'n': i = data[i][3] print('Thanks for playing')
def riverSizes(matrix): # Write your code here. if not matrix: return [] sizes=[] visited=[[False for values in row] for row in matrix] for i in range(len(matrix)): for j in range(len(matrix[0])): if visited[i][j]: continue getSize(i,j,visited,matrix,sizes) return sizes def getSize(i,j,visited,matrix,sizes): currentRiverSize=0 nodesToExplore=[[i,j]] while nodesToExplore: currentNode=nodesToExplore.pop() x,y=currentNode if visited[x][y]: continue visited[x][y]=True if matrix[x][y]==0: continue currentRiverSize+=1 unvisitedNeighbours=getNeighbours(x,y,visited,matrix) for nodes in unvisitedNeighbours: nodesToExplore.append(nodes) if currentRiverSize>0: sizes.append(currentRiverSize) def getNeighbours(i,j,visited,matrix): toReturn =[] if i>0 and not visited[i-1][j]: toReturn.append([i-1,j]) if i<len(matrix)-1 and not visited[i+1][j]: toReturn.append([i+1,j]) if j>0 and not visited[i][j-1]: toReturn.append([i,j-1]) if j<len(matrix[0])-1 and not visited[i][j+1]: toReturn.append([i,j+1]) return toReturn
def river_sizes(matrix): if not matrix: return [] sizes = [] visited = [[False for values in row] for row in matrix] for i in range(len(matrix)): for j in range(len(matrix[0])): if visited[i][j]: continue get_size(i, j, visited, matrix, sizes) return sizes def get_size(i, j, visited, matrix, sizes): current_river_size = 0 nodes_to_explore = [[i, j]] while nodesToExplore: current_node = nodesToExplore.pop() (x, y) = currentNode if visited[x][y]: continue visited[x][y] = True if matrix[x][y] == 0: continue current_river_size += 1 unvisited_neighbours = get_neighbours(x, y, visited, matrix) for nodes in unvisitedNeighbours: nodesToExplore.append(nodes) if currentRiverSize > 0: sizes.append(currentRiverSize) def get_neighbours(i, j, visited, matrix): to_return = [] if i > 0 and (not visited[i - 1][j]): toReturn.append([i - 1, j]) if i < len(matrix) - 1 and (not visited[i + 1][j]): toReturn.append([i + 1, j]) if j > 0 and (not visited[i][j - 1]): toReturn.append([i, j - 1]) if j < len(matrix[0]) - 1 and (not visited[i][j + 1]): toReturn.append([i, j + 1]) return toReturn
# G00364712 Robert Higgins - Exercise 2 # Collatz Conjecture https://en.wikipedia.org/wiki/Collatz_conjecture nStr = input("Enter a positive integer:") n = int(nStr) while n > 1: if n % 2 == 0: n = n/2 print(int(n)) else: n = (3*n) + 1 print(int(n)) # Output below for user input 23 # Enter a positive integer:23 # 70 # 35 # 106 # 53 # 160 # 80 # 40 # 20 # 10 # 5 # 16 # 8 # 4 # 2 # 1
n_str = input('Enter a positive integer:') n = int(nStr) while n > 1: if n % 2 == 0: n = n / 2 print(int(n)) else: n = 3 * n + 1 print(int(n))
collatz_lengths = {} def collatz_length(number: int) -> int: """Calculate the collatz sequence length for a number All values that are visited while generating the sequence will have their sequence length cached. This allows for greatly improved performance with multiple use. """ length_if_known = collatz_lengths.get(number) if length_if_known is not None: return length_if_known visited_numbers = [] length = 1 current_value = number while current_value > 1: if current_value % 2 == 0: current_value //= 2 else: current_value = 3 * current_value + 1 length_if_known = collatz_lengths.get(current_value) if length_if_known is not None: length += length_if_known current_value = 1 else: visited_numbers.append(current_value) length += 1 collatz_lengths[number] = length adjusted_length = length for visited_number in visited_numbers: adjusted_length -= 1 collatz_lengths[visited_number] = adjusted_length return length def reset_cached_lengths(): """Clear all known collatz lengths""" collatz_lengths.clear()
collatz_lengths = {} def collatz_length(number: int) -> int: """Calculate the collatz sequence length for a number All values that are visited while generating the sequence will have their sequence length cached. This allows for greatly improved performance with multiple use. """ length_if_known = collatz_lengths.get(number) if length_if_known is not None: return length_if_known visited_numbers = [] length = 1 current_value = number while current_value > 1: if current_value % 2 == 0: current_value //= 2 else: current_value = 3 * current_value + 1 length_if_known = collatz_lengths.get(current_value) if length_if_known is not None: length += length_if_known current_value = 1 else: visited_numbers.append(current_value) length += 1 collatz_lengths[number] = length adjusted_length = length for visited_number in visited_numbers: adjusted_length -= 1 collatz_lengths[visited_number] = adjusted_length return length def reset_cached_lengths(): """Clear all known collatz lengths""" collatz_lengths.clear()
def functie(l,n): for a in range(1,n+1): l.append(a**n) list=[] n = int(input("n = ")) functie(list,n) print(list)
def functie(l, n): for a in range(1, n + 1): l.append(a ** n) list = [] n = int(input('n = ')) functie(list, n) print(list)
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( A , arr_size , sum ) : for i in range ( 0 , arr_size - 1 ) : s = set ( ) curr_sum = sum - A [ i ] for j in range ( i + 1 , arr_size ) : if ( curr_sum - A [ j ] ) in s : print ( "Triplet is" , A [ i ] , ", " , A [ j ] , ", " , curr_sum - A [ j ] ) return True s.add ( A [ j ] ) return False #TOFILL if __name__ == '__main__': param = [ ([1, 6, 8, 8, 9, 11, 13, 13, 15, 17, 21, 24, 38, 38, 42, 43, 46, 46, 47, 54, 55, 56, 57, 58, 60, 60, 60, 62, 63, 63, 65, 66, 67, 67, 69, 81, 84, 84, 85, 86, 95, 99],27,24,), ([20, -86, -24, 38, -32, -64, -72, 72, 68, 94, 18, -60, -4, -18, -18, -70, 6, -86, 46, -16, 46, -28],21,20,), ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],17,13,), ([13, 96, 31, 39, 23, 39, 50, 10, 21, 64, 41, 54, 44, 97, 24, 91, 79, 86, 38, 49, 77, 71, 8, 98, 85, 36, 37, 65, 42, 48],17,18,), ([-86, -68, -58, -56, -54, -54, -48, -40, -36, -32, -26, -16, -14, -12, -12, -4, -4, -4, 0, 10, 22, 22, 30, 54, 62, 68, 88, 88],21,25,), ([0, 1, 1, 1, 1, 0, 0],5,3,), ([8, 8, 9, 13, 20, 24, 29, 52, 53, 96],9,8,), ([18, -92, -10, 26, 58, -48, 38, 66, -98, -72, 4, 76, -52, 20, 60, -56, 96, 60, -10, -26, -64, -66, -22, -86, 74, 82, 2, -14, 76, 82, 40, 70, -40, -2, -46, -38, 22, 98, 58],30,30,), ([1, 1, 1, 1],2,2,), ([72],0,0,) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success+=1 print("#Results: %i, %i" % (n_success, len(param)))
def f_gold(A, arr_size, sum): for i in range(0, arr_size - 1): s = set() curr_sum = sum - A[i] for j in range(i + 1, arr_size): if curr_sum - A[j] in s: print('Triplet is', A[i], ', ', A[j], ', ', curr_sum - A[j]) return True s.add(A[j]) return False if __name__ == '__main__': param = [([1, 6, 8, 8, 9, 11, 13, 13, 15, 17, 21, 24, 38, 38, 42, 43, 46, 46, 47, 54, 55, 56, 57, 58, 60, 60, 60, 62, 63, 63, 65, 66, 67, 67, 69, 81, 84, 84, 85, 86, 95, 99], 27, 24), ([20, -86, -24, 38, -32, -64, -72, 72, 68, 94, 18, -60, -4, -18, -18, -70, 6, -86, 46, -16, 46, -28], 21, 20), ([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 17, 13), ([13, 96, 31, 39, 23, 39, 50, 10, 21, 64, 41, 54, 44, 97, 24, 91, 79, 86, 38, 49, 77, 71, 8, 98, 85, 36, 37, 65, 42, 48], 17, 18), ([-86, -68, -58, -56, -54, -54, -48, -40, -36, -32, -26, -16, -14, -12, -12, -4, -4, -4, 0, 10, 22, 22, 30, 54, 62, 68, 88, 88], 21, 25), ([0, 1, 1, 1, 1, 0, 0], 5, 3), ([8, 8, 9, 13, 20, 24, 29, 52, 53, 96], 9, 8), ([18, -92, -10, 26, 58, -48, 38, 66, -98, -72, 4, 76, -52, 20, 60, -56, 96, 60, -10, -26, -64, -66, -22, -86, 74, 82, 2, -14, 76, 82, 40, 70, -40, -2, -46, -38, 22, 98, 58], 30, 30), ([1, 1, 1, 1], 2, 2), ([72], 0, 0)] n_success = 0 for (i, parameters_set) in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success += 1 print('#Results: %i, %i' % (n_success, len(param)))
# ------- MAIN SETTINGS ----------- # SQLITE_DB_PATH = u'/Users/sidhshar/Downloads/dbstore/pp.sqlite' JSON_DATA_FILENAME = 'pp.json' MASTER_JSON_FILENAME = 'master.json' STOP_COUNT = 2 # ------- STORAGE SETTINGS ----------- # INPUT_STORE_DIRECTORY = u'/Users/sidhshar/Downloads/photodirip' OUTPUT_STORE_DIRECTORY = u'/Users/sidhshar/Downloads/photodirop' TYPE_JPG_FAMILY = ('jpg', 'jpeg') TYPE_VIDEO_FAMILY = ('mp4,' '3gp,') ALLOWED_EXTENSIONS = () # TYPE_JPG_FAMILY + TYPE_VIDEO_FAMILY
sqlite_db_path = u'/Users/sidhshar/Downloads/dbstore/pp.sqlite' json_data_filename = 'pp.json' master_json_filename = 'master.json' stop_count = 2 input_store_directory = u'/Users/sidhshar/Downloads/photodirip' output_store_directory = u'/Users/sidhshar/Downloads/photodirop' type_jpg_family = ('jpg', 'jpeg') type_video_family = 'mp4,3gp,' allowed_extensions = ()
def make_key(*args): return "ti:" + ":".join(args) def make_refset_key(pmid): return make_key("article", pmid, "refset")
def make_key(*args): return 'ti:' + ':'.join(args) def make_refset_key(pmid): return make_key('article', pmid, 'refset')
#!/usr/bin/env python # coding: utf-8 # This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # # Solution Notebook # ## Problem: Find an element in a sorted array that has been rotated a number of times. # # * [Constraints](#Constraints) # * [Test Cases](#Test-Cases) # * [Algorithm](#Algorithm) # * [Code](#Code) # * [Unit Test](#Unit-Test) # ## Constraints # # * Is the input an array of ints? # * Yes # * Can the input have duplicates? # * Yes # * Do we know how many times the array was rotated? # * No # * Was the array originally sorted in increasing or decreasing order? # * Increasing # * For the output, do we return the index? # * Yes # * Can we assume the inputs are valid? # * No # * Can we assume this fits memory? # * Yes # ## Test Cases # # * None -> Exception # * [] -> None # * Not found -> None # * General case with duplicates # * General case without duplicates # ## Algorithm # # ### General case without dupes # # <pre> # # index 0 1 2 3 4 5 6 7 8 9 # input [ 1, 3, 5, 6, 7, 8, 9, 10, 12, 14] # input rotated 1x [10, 12, 14, 1, 3, 5, 6, 7, 8, 9] # input rotated 2x [ 5, 6, 7, 8, 9, 10, 12, 14, 1, 3] # input rotated 3x [10, 12, 14, 1, 3, 5, 6, 7, 8, 9] # # find 1 # len = 10 # mid = 10 // 2 = 5 # s m e # index 0 1 2 3 4 5 6 7 8 9 # input [10, 12, 14, 1, 3, 5, 6, 7, 8, 9] # # input[start] > input[mid]: Left half is rotated # input[end] >= input[mid]: Right half is sorted # 1 is not within input[mid+1] to input[end] on the right side, go left # # s m e # index 0 1 2 3 4 5 6 7 8 9 # input [10, 12, 14, 1, 3, 5, 6, 7, 8, 9] # # input[start] <= input[mid]: Right half is rotated # input[end] >= input[mid]: Left half is sorted # 1 is not within input[left] to input[mid-1] on the left side, go right # # </pre> # # ### General case with dupes # # <pre> # # s m e # index 0 1 2 3 4 5 6 7 8 9 # input [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2] # # input[start] == input[mid], input[mid] != input[end], go right # # input rotated 1x [ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1] # # input[start] == input[mid] == input[end], search both sides # # </pre> # # Complexity: # * Time: O(log n) if there are no duplicates, else O(n) # * Space: O(m), where m is the recursion depth # ## Code # In[1]: class Array(object): def search_sorted_array(self, array, val): if array is None or val is None: raise TypeError('array or val cannot be None') if not array: return None return self._search_sorted_array(array, val, start=0, end=len(array) - 1) def _search_sorted_array(self, array, val, start, end): if end < start: return None mid = (start + end) // 2 if array[mid] == val: return mid # Left side is sorted if array[start] < array[mid]: if array[start] <= val < array[mid]: return self._search_sorted_array(array, val, start, mid - 1) else: return self._search_sorted_array(array, val, mid + 1, end) # Right side is sorted elif array[start] > array[mid]: if array[mid] < val <= array[end]: return self._search_sorted_array(array, val, mid + 1, end) else: return self._search_sorted_array(array, val, start, mid - 1) # Duplicates else: if array[mid] != array[end]: return self._search_sorted_array(array, val, mid + 1, end) else: result = self._search_sorted_array(array, val, start, mid - 1) if result != None: return result else: return self._search_sorted_array(array, val, mid + 1, end) # ## Unit Test # In[2]: get_ipython().run_cell_magic('writefile', 'test_search_sorted_array.py', "import unittest\n\n\nclass TestArray(unittest.TestCase):\n\n def test_search_sorted_array(self):\n array = Array()\n self.assertRaises(TypeError, array.search_sorted_array, None)\n self.assertEqual(array.search_sorted_array([3, 1, 2], 0), None)\n self.assertEqual(array.search_sorted_array([3, 1, 2], 0), None)\n data = [10, 12, 14, 1, 3, 5, 6, 7, 8, 9]\n self.assertEqual(array.search_sorted_array(data, val=1), 3)\n data = [ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]\n self.assertEqual(array.search_sorted_array(data, val=2), 2)\n print('Success: test_search_sorted_array')\n\n\ndef main():\n test = TestArray()\n test.test_search_sorted_array()\n\n\nif __name__ == '__main__':\n main()") # In[3]: get_ipython().run_line_magic('run', '-i test_search_sorted_array.py')
class Array(object): def search_sorted_array(self, array, val): if array is None or val is None: raise type_error('array or val cannot be None') if not array: return None return self._search_sorted_array(array, val, start=0, end=len(array) - 1) def _search_sorted_array(self, array, val, start, end): if end < start: return None mid = (start + end) // 2 if array[mid] == val: return mid if array[start] < array[mid]: if array[start] <= val < array[mid]: return self._search_sorted_array(array, val, start, mid - 1) else: return self._search_sorted_array(array, val, mid + 1, end) elif array[start] > array[mid]: if array[mid] < val <= array[end]: return self._search_sorted_array(array, val, mid + 1, end) else: return self._search_sorted_array(array, val, start, mid - 1) elif array[mid] != array[end]: return self._search_sorted_array(array, val, mid + 1, end) else: result = self._search_sorted_array(array, val, start, mid - 1) if result != None: return result else: return self._search_sorted_array(array, val, mid + 1, end) get_ipython().run_cell_magic('writefile', 'test_search_sorted_array.py', "import unittest\n\n\nclass TestArray(unittest.TestCase):\n\n def test_search_sorted_array(self):\n array = Array()\n self.assertRaises(TypeError, array.search_sorted_array, None)\n self.assertEqual(array.search_sorted_array([3, 1, 2], 0), None)\n self.assertEqual(array.search_sorted_array([3, 1, 2], 0), None)\n data = [10, 12, 14, 1, 3, 5, 6, 7, 8, 9]\n self.assertEqual(array.search_sorted_array(data, val=1), 3)\n data = [ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1]\n self.assertEqual(array.search_sorted_array(data, val=2), 2)\n print('Success: test_search_sorted_array')\n\n\ndef main():\n test = TestArray()\n test.test_search_sorted_array()\n\n\nif __name__ == '__main__':\n main()") get_ipython().run_line_magic('run', '-i test_search_sorted_array.py')
def strip_ptms(sequence): """ Removes all post-translation modifications (i.e. phosphorylation, glycosylation, etc) from a sequence. Parameters ---------- sequence : str Returns ------- str """ return sequence.upper()
def strip_ptms(sequence): """ Removes all post-translation modifications (i.e. phosphorylation, glycosylation, etc) from a sequence. Parameters ---------- sequence : str Returns ------- str """ return sequence.upper()
def iterable(source): def callbag(start, sink): if (start != 0): return for i in source: sink(1, i) return callbag
def iterable(source): def callbag(start, sink): if start != 0: return for i in source: sink(1, i) return callbag
'''1. Write a Python program to check the sum of three elements (each from an array) from three arrays is equal to a target value. Print all those three-element combinations. Sample data: /* X = [10, 20, 20, 20] Y = [10, 20, 30, 40] Z = [10, 30, 40, 20] target = 70 */ ''' X = [10, 20, 20, 20] Y = [10, 20, 30, 40] Z = [10, 30, 40, 20] for x in X: for y in Y: for z in Z: if x+y+z==70: print((x, y, z))
"""1. Write a Python program to check the sum of three elements (each from an array) from three arrays is equal to a target value. Print all those three-element combinations. Sample data: /* X = [10, 20, 20, 20] Y = [10, 20, 30, 40] Z = [10, 30, 40, 20] target = 70 */ """ x = [10, 20, 20, 20] y = [10, 20, 30, 40] z = [10, 30, 40, 20] for x in X: for y in Y: for z in Z: if x + y + z == 70: print((x, y, z))
""" You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id. For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then employee 1 has a data structure like [1, 15, [2]], and employee 2 has [2, 10, [3]], and employee 3 has [3, 5, []]. Note that although employee 3 is also a subordinate of employee 1, the relationship is not direct. Now given the employee information of a company, and an employee id, you need to return the total importance value of this employee and all his subordinates. Example 1: Input: [[1, 5, [2, 3]], [2, 3, []], [3, 3, []]], 1 Output: 11 Explanation: Employee 1 has importance value 5, and he has two direct subordinates: employee 2 and employee 3. They both have importance value 3. So the total importance value of employee 1 is 5 + 3 + 3 = 11. Note: One employee has at most one direct leader and may have several subordinates. The maximum number of employees won't exceed 2000. """ """ # Employee info class Employee(object): def __init__(self, id, importance, subordinates): # It's the unique id of each node. # unique id of this employee self.id = id # the importance value of this employee self.importance = importance # the id of direct subordinates self.subordinates = subordinates """ class Solution(object): def getImportance(self, employees, id): """ :type employees: Employee :type id: int :rtype: int """ r= 0 if not employees: return r tr = {} for em in employees: tr[em.id] = (em.importance, em.subordinates) q = [id] while q: c = q[0] r += tr[c][0] del q[0] q.extend(tr[c][1]) return r
""" You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id. For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then employee 1 has a data structure like [1, 15, [2]], and employee 2 has [2, 10, [3]], and employee 3 has [3, 5, []]. Note that although employee 3 is also a subordinate of employee 1, the relationship is not direct. Now given the employee information of a company, and an employee id, you need to return the total importance value of this employee and all his subordinates. Example 1: Input: [[1, 5, [2, 3]], [2, 3, []], [3, 3, []]], 1 Output: 11 Explanation: Employee 1 has importance value 5, and he has two direct subordinates: employee 2 and employee 3. They both have importance value 3. So the total importance value of employee 1 is 5 + 3 + 3 = 11. Note: One employee has at most one direct leader and may have several subordinates. The maximum number of employees won't exceed 2000. """ "\n# Employee info\nclass Employee(object):\n def __init__(self, id, importance, subordinates):\n # It's the unique id of each node.\n # unique id of this employee\n self.id = id\n # the importance value of this employee\n self.importance = importance\n # the id of direct subordinates\n self.subordinates = subordinates\n" class Solution(object): def get_importance(self, employees, id): """ :type employees: Employee :type id: int :rtype: int """ r = 0 if not employees: return r tr = {} for em in employees: tr[em.id] = (em.importance, em.subordinates) q = [id] while q: c = q[0] r += tr[c][0] del q[0] q.extend(tr[c][1]) return r
def request_numbers(): numbers = [] for n in range(3): number = float(input("Number: ")) numbers.append(number) return numbers def main(): numbers = request_numbers() ordered = list(sorted(numbers)) if numbers == ordered: print("Aumentando") elif numbers == ordered[::-1]: print("Disminiyendo") else: print("Ninguno") if __name__ == '__main__': main()
def request_numbers(): numbers = [] for n in range(3): number = float(input('Number: ')) numbers.append(number) return numbers def main(): numbers = request_numbers() ordered = list(sorted(numbers)) if numbers == ordered: print('Aumentando') elif numbers == ordered[::-1]: print('Disminiyendo') else: print('Ninguno') if __name__ == '__main__': main()
""" stringjumble.py Author: Carlton Credit: You Assignment: The purpose of this challenge is to gain proficiency with manipulating lists. Write and submit a Python program that accepts a string from the user and prints it back in three different ways: * With all letters in reverse. * With words in reverse order, but letters within each word in the correct order. * With all words in correct order, but letters reversed within the words. Output of your program should look like this: Please enter a string of text (the bigger the better): There are a few techniques or tricks that you may find handy You entered "There are a few techniques or tricks that you may find handy". Now jumble it: ydnah dnif yam uoy taht skcirt ro seuqinhcet wef a era erehT handy find may you that tricks or techniques few a are There erehT era a wef seuqinhcet ro skcirt taht uoy yam dnif ydnah """ str1 = input("Please enter a string of text (the bigger the better): ") print ('You entered "{0}". Now jumble it:'.format(str1)) str2 = str1[::-1] list1 = str1.split() list2 = list1[::-1] str3 = " ".join(list2) print (str2) print(str3) size = len(list1) counter = 0 final = "" while counter < size: str4 = list1[counter] str5 = str4[::-1] final = final + str5 + " " counter = counter + 1 print (final)
""" stringjumble.py Author: Carlton Credit: You Assignment: The purpose of this challenge is to gain proficiency with manipulating lists. Write and submit a Python program that accepts a string from the user and prints it back in three different ways: * With all letters in reverse. * With words in reverse order, but letters within each word in the correct order. * With all words in correct order, but letters reversed within the words. Output of your program should look like this: Please enter a string of text (the bigger the better): There are a few techniques or tricks that you may find handy You entered "There are a few techniques or tricks that you may find handy". Now jumble it: ydnah dnif yam uoy taht skcirt ro seuqinhcet wef a era erehT handy find may you that tricks or techniques few a are There erehT era a wef seuqinhcet ro skcirt taht uoy yam dnif ydnah """ str1 = input('Please enter a string of text (the bigger the better): ') print('You entered "{0}". Now jumble it:'.format(str1)) str2 = str1[::-1] list1 = str1.split() list2 = list1[::-1] str3 = ' '.join(list2) print(str2) print(str3) size = len(list1) counter = 0 final = '' while counter < size: str4 = list1[counter] str5 = str4[::-1] final = final + str5 + ' ' counter = counter + 1 print(final)
# -*- coding: utf-8 -*- """ Created on Wed Mar 28 21:38:08 2018 @author: Dell """ __all__=['dxf','s2k']
""" Created on Wed Mar 28 21:38:08 2018 @author: Dell """ __all__ = ['dxf', 's2k']
## ## Karkinos - b0bb ## ## https://twitter.com/0xb0bb ## https://github.com/0xb0bb/karkinos ## MAJOR_VERSION = 0 MINOR_VERSION = 2 KARKINOS_VERSION = 'Karkinos v%d.%d' % (MAJOR_VERSION, MINOR_VERSION)
major_version = 0 minor_version = 2 karkinos_version = 'Karkinos v%d.%d' % (MAJOR_VERSION, MINOR_VERSION)
# Tuenti Challenge Edition 8 Level 6 PROBLEM_SIZE = "test" # -- jam input/output ------------------------------------------------------- # def parse_problems(lines): """ Given a list of lines, parses them and returns a list of problems. """ res = [] i = 0 while i < len(lines): N = int(lines[i]) notes = [tuple(map(int, l.split(" "))) for l in lines[i + 1:i + N + 1]] res.append((N, notes)) i += N + 1 return res def solve_all(): """ Process each test case and generate the output file. """ res = "" with open("%s.in" % PROBLEM_SIZE, "r", encoding="utf-8") as fp: lines = fp.read().strip().split("\n")[1:] problems = parse_problems(lines) for case, problem in enumerate(problems, 1): print("Solving Case #%s" % case) res += "Case #%s: %s\n" % (case, solve(*problem)) with open("%s2.out" % PROBLEM_SIZE, "w", encoding="utf-8") as fp: fp.write(res[:-1]) # -- problem specific functions --------------------------------------------- # def solve(N, notes): score = 0 print("generating") # transform notes to a list of (start_t, end_t, score) sorted by start_t scores = {} for x, l, s, p in notes: key = (int(x / s), int((x + l) / s)) if key in scores: scores[key] += p else: scores[key] = p print("delaying") # delay a bit start times and promote a bit end times, to disallow overlapping notes = [(s * 2 - 1, e * 2 + 1, p) for (s, e), p in scores.items()] print("computing with %s elements" % len(notes)) return compute(notes) def compute(notes): """ O(n^2) solution. Polynomial time could be reached using interval graphs. """ last_release = max(n[1] for n in notes) + 1 releases = [[] for _ in range(last_release)] for s, e, p in notes: releases[e].append((s, p)) T = [0] * last_release for r in range(1, last_release): if releases[r]: for s, p in releases[r]: C = p + T[s] if C > T[r]: T[r] = C for i in range(r + 1, last_release): T[i] = max(T[i], T[r]) return T[-1] # -- entrypoint ------------------------------------------------------------- # if __name__ == "__main__": solve_all()
problem_size = 'test' def parse_problems(lines): """ Given a list of lines, parses them and returns a list of problems. """ res = [] i = 0 while i < len(lines): n = int(lines[i]) notes = [tuple(map(int, l.split(' '))) for l in lines[i + 1:i + N + 1]] res.append((N, notes)) i += N + 1 return res def solve_all(): """ Process each test case and generate the output file. """ res = '' with open('%s.in' % PROBLEM_SIZE, 'r', encoding='utf-8') as fp: lines = fp.read().strip().split('\n')[1:] problems = parse_problems(lines) for (case, problem) in enumerate(problems, 1): print('Solving Case #%s' % case) res += 'Case #%s: %s\n' % (case, solve(*problem)) with open('%s2.out' % PROBLEM_SIZE, 'w', encoding='utf-8') as fp: fp.write(res[:-1]) def solve(N, notes): score = 0 print('generating') scores = {} for (x, l, s, p) in notes: key = (int(x / s), int((x + l) / s)) if key in scores: scores[key] += p else: scores[key] = p print('delaying') notes = [(s * 2 - 1, e * 2 + 1, p) for ((s, e), p) in scores.items()] print('computing with %s elements' % len(notes)) return compute(notes) def compute(notes): """ O(n^2) solution. Polynomial time could be reached using interval graphs. """ last_release = max((n[1] for n in notes)) + 1 releases = [[] for _ in range(last_release)] for (s, e, p) in notes: releases[e].append((s, p)) t = [0] * last_release for r in range(1, last_release): if releases[r]: for (s, p) in releases[r]: c = p + T[s] if C > T[r]: T[r] = C for i in range(r + 1, last_release): T[i] = max(T[i], T[r]) return T[-1] if __name__ == '__main__': solve_all()
class StorageServiceName(basestring): """ The Storage Service Name """ @staticmethod def get_api_name(): return "storage-service-name"
class Storageservicename(basestring): """ The Storage Service Name """ @staticmethod def get_api_name(): return 'storage-service-name'
# -*- coding: utf-8 -*- class BasePlugin(object): NAME = 'base_plugin' DESCRIPTION = '' @property def plugin_name(self): """Return the name of the plugin.""" return self.NAME def Process(self, **kwargs): """Evaluates if this is the correct plugin and processes data accordingly. """
class Baseplugin(object): name = 'base_plugin' description = '' @property def plugin_name(self): """Return the name of the plugin.""" return self.NAME def process(self, **kwargs): """Evaluates if this is the correct plugin and processes data accordingly. """
#!/usr/bin/env python3 if __name__ == '__main__': numbers = [[6, 1, 6], [6], [5, 6, 6], [5], [4], [7, 5, 7, 2], [5, 8], [9], [7], [5, 6], [3, 4], [8], [4, 9, 3, 6], [8, 2, 4], [9, 7], [6, 8], [2, 5], [2, 4], [8, 3, 4], [5, 2], [4], [4, 4, 5, 5], [5, 1], [1, 4, 8], [6, 5], [5, 7, 8, 9], [1], [6], [3], [6], [7, 3, 8, 8], [6], [2, 5, 4], [7], [3, 7], [1, 9, 1, 1], [2, 6, 2], [2, 7, 5], [6, 3, 7], [6, 1], [6, 3, 9, 7], [4, 3, 3]] squares = [sum([n**2 for n in subnumbers]) for subnumbers in numbers] print(squares)
if __name__ == '__main__': numbers = [[6, 1, 6], [6], [5, 6, 6], [5], [4], [7, 5, 7, 2], [5, 8], [9], [7], [5, 6], [3, 4], [8], [4, 9, 3, 6], [8, 2, 4], [9, 7], [6, 8], [2, 5], [2, 4], [8, 3, 4], [5, 2], [4], [4, 4, 5, 5], [5, 1], [1, 4, 8], [6, 5], [5, 7, 8, 9], [1], [6], [3], [6], [7, 3, 8, 8], [6], [2, 5, 4], [7], [3, 7], [1, 9, 1, 1], [2, 6, 2], [2, 7, 5], [6, 3, 7], [6, 1], [6, 3, 9, 7], [4, 3, 3]] squares = [sum([n ** 2 for n in subnumbers]) for subnumbers in numbers] print(squares)
SEPN = f"\n{'=' * 40}" SEP = f"{SEPN}\n" QUERY_SPLIT_SIZE = 5000 SEQUENCE = 'sequence' TABLE = 'table' PRIMARY = 'primary' UNIQUE = 'unique' FOREIGN = 'foreign'
sepn = f"\n{'=' * 40}" sep = f'{SEPN}\n' query_split_size = 5000 sequence = 'sequence' table = 'table' primary = 'primary' unique = 'unique' foreign = 'foreign'
"""Top-level package for Genetic Algorithm.""" __author__ = """Puneetha Pai B P""" __email__ = 'puneethapai29@gmail.com' __version__ = '0.0.1'
"""Top-level package for Genetic Algorithm.""" __author__ = 'Puneetha Pai B P' __email__ = 'puneethapai29@gmail.com' __version__ = '0.0.1'
def code_function(): #function begin############################################ global code code=""" `include "{0}_seq_item.sv" `include "{0}_sequencer.sv" `include "{0}_sequence.sv" `include "{0}_driver.sv" `include "{0}_monitor.sv" class {0}_agent extends uvm_agent; //--------------------------------------- // component instances //--------------------------------------- {0}_driver driver; {0}_sequencer sequencer; {0}_monitor monitor; `uvm_component_utils({0}_agent) //--------------------------------------- // constructor //--------------------------------------- function new (string name, uvm_component parent); super.new(name, parent); endfunction : new //--------------------------------------- // build_phase //--------------------------------------- function void build_phase(uvm_phase phase); super.build_phase(phase); monitor = {0}_monitor::type_id::create("monitor", this); //creating driver and sequencer only for ACTIVE agent if(get_is_active() == UVM_ACTIVE) begin driver = {0}_driver::type_id::create("driver", this); sequencer = {0}_sequencer::type_id::create("sequencer", this); end endfunction : build_phase //--------------------------------------- // connect_phase - connecting the driver and sequencer port //--------------------------------------- function void connect_phase(uvm_phase phase); if(get_is_active() == UVM_ACTIVE) begin driver.seq_item_port.connect(sequencer.seq_item_export); end endfunction : connect_phase endclass : {0}_agent """.format(animesh) #functionend############################################ fh=open("protocol.csv","r") for animesh in fh: # protocol_name=protocol_name.strip("\n") animesh=animesh.strip("\n") fph=open('{0}_agent.sv'.format(animesh),"w") # code_function() fph.write(code) print(code)
def code_function(): global code code = '\n`include "{0}_seq_item.sv"\n`include "{0}_sequencer.sv"\n`include "{0}_sequence.sv"\n`include "{0}_driver.sv"\n`include "{0}_monitor.sv"\n\nclass {0}_agent extends uvm_agent;\n\n //---------------------------------------\n // component instances\n //---------------------------------------\n {0}_driver driver;\n {0}_sequencer sequencer;\n {0}_monitor monitor;\n\n `uvm_component_utils({0}_agent)\n \n //---------------------------------------\n // constructor\n //---------------------------------------\n function new (string name, uvm_component parent);\n super.new(name, parent);\n endfunction : new\n\n //---------------------------------------\n // build_phase\n //---------------------------------------\n function void build_phase(uvm_phase phase);\n super.build_phase(phase);\n \n monitor = {0}_monitor::type_id::create("monitor", this);\n\n //creating driver and sequencer only for ACTIVE agent\n if(get_is_active() == UVM_ACTIVE) begin\n driver = {0}_driver::type_id::create("driver", this);\n sequencer = {0}_sequencer::type_id::create("sequencer", this);\n end\n endfunction : build_phase\n \n //--------------------------------------- \n // connect_phase - connecting the driver and sequencer port\n //---------------------------------------\n function void connect_phase(uvm_phase phase);\n if(get_is_active() == UVM_ACTIVE) begin\n driver.seq_item_port.connect(sequencer.seq_item_export);\n end\n endfunction : connect_phase\n\nendclass : {0}_agent\n'.format(animesh) fh = open('protocol.csv', 'r') for animesh in fh: animesh = animesh.strip('\n') fph = open('{0}_agent.sv'.format(animesh), 'w') fph.write(code) print(code)
# Numbers in Python can be of two types: Integers and Floats # They're very important as many ML algorithms can only deal # with numbers and will ignore/crash on any other kind of input # because they're based complex math algorithms # Integers have unbound size in Python 3! lucky_number = 13 universe_number = 42 # Floats are numbers that have a decimal point! pi = 3.14 a_third = 0.333 # We can do basic math calculations using the operators / + - * % and ** times_two = lucky_number * 2 square = universe_number ** 2 mod = 3 % 2 # results in the remainder of the division of 3 by 2 (1 in this case) # In the example below we calculate the area of a circle radius = 50 area_of_circle = pi * (radius ** 2) print(area_of_circle)
lucky_number = 13 universe_number = 42 pi = 3.14 a_third = 0.333 times_two = lucky_number * 2 square = universe_number ** 2 mod = 3 % 2 radius = 50 area_of_circle = pi * radius ** 2 print(area_of_circle)
# -*- coding: utf-8 -*- # Copyright (c) 2013 Ole Krause-Sparmann # 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. class VectorFilter(object): """ Interface for vector-list filters. They get either (vector, data, distance) tupes or (vector, data) tuples and return subsets of them. Some filters work on lists of (vector, data, distance) tuples, others work on lists of (vector, data) tuples and others work on both types. Depending on the configuration of the engine, you have to select the right filter chain. Filter are chained in the engine, if you specify more than one. This way you can combine their functionalities. The default filtes in the engine (see engine.py) are a UniqueFilter followed by a NearestFilter(10). The UniqueFilter makes sure, that the candidate list contains each vector only once and the NearestFilter(10) returns the 10 closest candidates (using the distance). Which kind you need is very simple to determine: If you use a Distance implementation, you have to use filters that take (vector, data, distance) tuples. If you however decide to not use Distance (Engine with distance=None), you have to use a vector filters that process lists of (vector, data) tuples. However all filters can handle both input types. They will just return the input list if their filter mechanism does not apply on the input type. """ def filter_vectors(self, input_list): """ Returns subset of specified input list. """ raise NotImplementedError
class Vectorfilter(object): """ Interface for vector-list filters. They get either (vector, data, distance) tupes or (vector, data) tuples and return subsets of them. Some filters work on lists of (vector, data, distance) tuples, others work on lists of (vector, data) tuples and others work on both types. Depending on the configuration of the engine, you have to select the right filter chain. Filter are chained in the engine, if you specify more than one. This way you can combine their functionalities. The default filtes in the engine (see engine.py) are a UniqueFilter followed by a NearestFilter(10). The UniqueFilter makes sure, that the candidate list contains each vector only once and the NearestFilter(10) returns the 10 closest candidates (using the distance). Which kind you need is very simple to determine: If you use a Distance implementation, you have to use filters that take (vector, data, distance) tuples. If you however decide to not use Distance (Engine with distance=None), you have to use a vector filters that process lists of (vector, data) tuples. However all filters can handle both input types. They will just return the input list if their filter mechanism does not apply on the input type. """ def filter_vectors(self, input_list): """ Returns subset of specified input list. """ raise NotImplementedError
# Runs all 1d datasets. Experiment(description='Run all 1D datasets', data_dir='../data/1d_data/', max_depth=8, random_order=False, k=2, debug=False, local_computation=True, n_rand=3, sd=4, max_jobs=500, verbose=True, make_predictions=False, skip_complete=True, results_dir='../results/Feb 10 1D results/', iters=200)
experiment(description='Run all 1D datasets', data_dir='../data/1d_data/', max_depth=8, random_order=False, k=2, debug=False, local_computation=True, n_rand=3, sd=4, max_jobs=500, verbose=True, make_predictions=False, skip_complete=True, results_dir='../results/Feb 10 1D results/', iters=200)
# 1.2 Palindrome Tester def is_palindrome(input_string): length = len(input_string) palindrome = True for i in range(0, length // 2): if input_string[i] != input_string[length - i - 1]: palindrome = False return palindrome
def is_palindrome(input_string): length = len(input_string) palindrome = True for i in range(0, length // 2): if input_string[i] != input_string[length - i - 1]: palindrome = False return palindrome
class Gurney: def greeting(self): print('welcome to Simple Calculator Alpha 0.1') def main(self): firstNumber = float(input('Enter your first number: ')) operator = float(input('enter your operator: ')) secondNumber = float(input('Enter your third number:')) if (operator == '+'): simpleCalculator.add(self, firstNumber, operator, secondNumber) elif (operator == '-'): simpleCalculator.subtract(self, firstNumber, operator, secondNumber) elif (operator == '*'): simplecalculator.mult(self, firstNumber, operator, secondNumber) elif (operator == '/'): simplecalculator.mult(self, firstNumber, operator, secondNumber) def add(self, firstNumber, operator, secondNumber): print(firstNumber, '+', secondNumber, '=', firstNumber + secondNumber) def subtract(self, firstNumber, operator, secondNumber): print(firstNumber, '-', secondNumber, '=', firstNumber - secondNUmber) def mult(self, firstNumber, operator, secondNumber): print(firstNumber, '*', secondNumber, '=', firstNumber * secondNumber) def div(self, firstNumber, operator, secondNumber): print(firstNumber, '/', secondNumber, '=', firstNumber / secondNumber) class Daniel: def __init__(self): self.user_string = '' def loop(self): while True: arg = input('-> ') if arg == 'quit': print(self.user_string) break else: self.user_string += arg class Jonathan: def __init__(self): self.user_string = '' def add(self, uno, dos): addop = uno + dos return addop def subtract(self, num1, num2): subop = num1 - num2 return subop def multiply(self, num1, num2): multop = num1 * num2 return multop def divide(self, num1, num2): divop = num1 / num2 return divop def main(self): print('ezpz calculatorino') while True: num1 = int(input('Enter your first number: ')) op = input('Choose an operator(+,-,*,/)') num2 = int(input('Enter your second number: ')) if (op == '+'): answer = Jonathan().add( num1, num2) print(num1, "+", num2, "=", answer) break elif (op == '-'): answer = Jonathan().subtract(num1, num2) print(num1, "-", num2, "=", answer) break elif (op == '*'): answer = Jonathan().multiply(num1, num2) print(num1, "*", num2, "=", answer) break elif (op == '/'): answer = Jonathan().divide(num1, num2) print(num1, "/", num2, "=", answer) break else: print('invalid string') if __name__ == '__main__': g = Gurney() g.loop() d = Daniel() d.loop() j = Jonathan() j.main()
class Gurney: def greeting(self): print('welcome to Simple Calculator Alpha 0.1') def main(self): first_number = float(input('Enter your first number: ')) operator = float(input('enter your operator: ')) second_number = float(input('Enter your third number:')) if operator == '+': simpleCalculator.add(self, firstNumber, operator, secondNumber) elif operator == '-': simpleCalculator.subtract(self, firstNumber, operator, secondNumber) elif operator == '*': simplecalculator.mult(self, firstNumber, operator, secondNumber) elif operator == '/': simplecalculator.mult(self, firstNumber, operator, secondNumber) def add(self, firstNumber, operator, secondNumber): print(firstNumber, '+', secondNumber, '=', firstNumber + secondNumber) def subtract(self, firstNumber, operator, secondNumber): print(firstNumber, '-', secondNumber, '=', firstNumber - secondNUmber) def mult(self, firstNumber, operator, secondNumber): print(firstNumber, '*', secondNumber, '=', firstNumber * secondNumber) def div(self, firstNumber, operator, secondNumber): print(firstNumber, '/', secondNumber, '=', firstNumber / secondNumber) class Daniel: def __init__(self): self.user_string = '' def loop(self): while True: arg = input('-> ') if arg == 'quit': print(self.user_string) break else: self.user_string += arg class Jonathan: def __init__(self): self.user_string = '' def add(self, uno, dos): addop = uno + dos return addop def subtract(self, num1, num2): subop = num1 - num2 return subop def multiply(self, num1, num2): multop = num1 * num2 return multop def divide(self, num1, num2): divop = num1 / num2 return divop def main(self): print('ezpz calculatorino') while True: num1 = int(input('Enter your first number: ')) op = input('Choose an operator(+,-,*,/)') num2 = int(input('Enter your second number: ')) if op == '+': answer = jonathan().add(num1, num2) print(num1, '+', num2, '=', answer) break elif op == '-': answer = jonathan().subtract(num1, num2) print(num1, '-', num2, '=', answer) break elif op == '*': answer = jonathan().multiply(num1, num2) print(num1, '*', num2, '=', answer) break elif op == '/': answer = jonathan().divide(num1, num2) print(num1, '/', num2, '=', answer) break else: print('invalid string') if __name__ == '__main__': g = gurney() g.loop() d = daniel() d.loop() j = jonathan() j.main()
symbology = 'code93' cases = [ ('001.png', 'CODE93', dict(includetext=True)), ('002.png', 'CODE93^SFT/A', dict(parsefnc=True, includecheck=True)), ]
symbology = 'code93' cases = [('001.png', 'CODE93', dict(includetext=True)), ('002.png', 'CODE93^SFT/A', dict(parsefnc=True, includecheck=True))]
class Solution: def minimumDeletions(self, s: str) -> int: n = len(s) a = 0 res = 0 for i in range(n - 1, -1, -1): if s[i] == 'a': a += 1 elif s[i] == 'b': if a > 0: a -= 1 res += 1 return res s = "aababbab" res = Solution().minimumDeletions(s) print(res)
class Solution: def minimum_deletions(self, s: str) -> int: n = len(s) a = 0 res = 0 for i in range(n - 1, -1, -1): if s[i] == 'a': a += 1 elif s[i] == 'b': if a > 0: a -= 1 res += 1 return res s = 'aababbab' res = solution().minimumDeletions(s) print(res)
num1=100 num2=200 num3=300 a b c 1 2 3 ttttt e f g 9 8 7
num1 = 100 num2 = 200 num3 = 300 a b c 1 2 3 ttttt e f g 9 8 7
#Find the Runner-Up Score! if __name__ == '__main__': n = int(raw_input()) arr = map(int, raw_input().split()) arr=sorted(arr) a=arr[0] b=arr[0] for i in range(1,n): if(arr[i]==a): pass elif(arr[i]>a): a=arr[i] b=arr[i-1] print(b)
if __name__ == '__main__': n = int(raw_input()) arr = map(int, raw_input().split()) arr = sorted(arr) a = arr[0] b = arr[0] for i in range(1, n): if arr[i] == a: pass elif arr[i] > a: a = arr[i] b = arr[i - 1] print(b)
# Variables that contains the user credentials to access Twitter API ACCESS_TOKEN = "" ACCESS_TOKEN_SECRET = "" CONSUMER_KEY = "" CONSUMER_SECRET = ""
access_token = '' access_token_secret = '' consumer_key = '' consumer_secret = ''
SECRET_KEY = '\xa6\xbaG\x80\xc9-$s\xd5~\x031N\x8f\xd9/\x88\xd0\xba#B\x9c\xcd_' DEBUG = False DB_HOST = 'localhost' DB_USER = 'grupo35' DB_PASS = 'OTRiYWJhYjU3YWMy' DB_NAME = 'grupo35' SQLALCHEMY_DATABASE_URI = 'mysql://grupo35:OTRiYWJhYjU3YWMy@localhost/grupo35' SQLALCHEMY_TRACK_MODIFICATIONS = False
secret_key = '¦ºG\x80É-$sÕ~\x031N\x8fÙ/\x88к#B\x9cÍ_' debug = False db_host = 'localhost' db_user = 'grupo35' db_pass = 'OTRiYWJhYjU3YWMy' db_name = 'grupo35' sqlalchemy_database_uri = 'mysql://grupo35:OTRiYWJhYjU3YWMy@localhost/grupo35' sqlalchemy_track_modifications = False
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def inorderTraversal(self, root: 'TreeNode') -> 'List[int]': out = [] self.traverse(root, out) return out def traverse(self, root, out): if root: self.traverse(root.left, out) out.append(root.val) self.traverse(root.right, out)
class Solution: def inorder_traversal(self, root: 'TreeNode') -> 'List[int]': out = [] self.traverse(root, out) return out def traverse(self, root, out): if root: self.traverse(root.left, out) out.append(root.val) self.traverse(root.right, out)
# Created by MechAviv # Quest ID :: 17620 # [Commerci Republic] Eye for an Eye sm.setSpeakerID(9390217) sm.sendNext("Now, what dream can I make come true for you? Remember, anything in the entire world is yours for the asking.") sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay("Can you introduce me to Gilberto Daniella?") sm.setSpeakerID(9390217) sm.sendSay("I offer to make your wildest dreams come true, and that is what you want?") # Unhandled Stat Changed [MP] Packet: 00 00 00 10 00 00 00 00 00 00 C6 0A 00 00 FF 00 00 00 00 sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay("Yup, I really want to meet #bGILBERTO DANIELLA#k.") sm.setSpeakerID(9390217) sm.sendSay("I heard you the first time. It's just...") sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay("What?") sm.setSpeakerID(9390217) sm.sendSay("Well, I thought you'd ask for something difficult, like borrowing my hat.") sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay("That was next on my list.") sm.setSpeakerID(9390217) if sm.sendAskYesNo("To get to the Daniella Merchant Union office, head east from this spot, past the town fountain. It's the white building with golden ornamentation."): sm.setSpeakerID(9390217) sm.sendNext("I'll let them know you're on your way. Be polite when you talk to Gilberto. He is quite powerful in Commerci.") sm.startQuest(17620) else: sm.setSpeakerID(9390217) sm.sendSayOkay("Still sorting through your deepest desires? Let me know when you know what you want.")
sm.setSpeakerID(9390217) sm.sendNext('Now, what dream can I make come true for you? Remember, anything in the entire world is yours for the asking.') sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay('Can you introduce me to Gilberto Daniella?') sm.setSpeakerID(9390217) sm.sendSay('I offer to make your wildest dreams come true, and that is what you want?') sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay('Yup, I really want to meet #bGILBERTO DANIELLA#k.') sm.setSpeakerID(9390217) sm.sendSay("I heard you the first time. It's just...") sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay('What?') sm.setSpeakerID(9390217) sm.sendSay("Well, I thought you'd ask for something difficult, like borrowing my hat.") sm.setSpeakerID(9390217) sm.setPlayerAsSpeaker() sm.sendSay('That was next on my list.') sm.setSpeakerID(9390217) if sm.sendAskYesNo("To get to the Daniella Merchant Union office, head east from this spot, past the town fountain. It's the white building with golden ornamentation."): sm.setSpeakerID(9390217) sm.sendNext("I'll let them know you're on your way. Be polite when you talk to Gilberto. He is quite powerful in Commerci.") sm.startQuest(17620) else: sm.setSpeakerID(9390217) sm.sendSayOkay('Still sorting through your deepest desires? Let me know when you know what you want.')
#!/usr/bin/env python3 f = "day10.input.txt" # f = "day10.ex.txt" ns = open(f).read().strip().split("\n") ns = [int(x) for x in ns] ns.sort() ns.insert(0, 0) ns.append(max(ns) + 3) def part1(): count1 = 0 count3 = 0 for i in range(len(ns) - 1): diff = ns[i + 1] - ns[i] if diff == 1: count1 += 1 if diff == 3: count3 += 1 return count1 * count3 checked = {} def get_num_ways(pos): # last if pos == len(ns) - 1: return 1 if pos in checked: return checked[pos] total = 0 for i in range(pos + 1, len(ns)): if ns[i] - ns[pos] <= 3: total += get_num_ways(i) checked[pos] = total return total def part2(): return get_num_ways(0) print(part1()) print(part2())
f = 'day10.input.txt' ns = open(f).read().strip().split('\n') ns = [int(x) for x in ns] ns.sort() ns.insert(0, 0) ns.append(max(ns) + 3) def part1(): count1 = 0 count3 = 0 for i in range(len(ns) - 1): diff = ns[i + 1] - ns[i] if diff == 1: count1 += 1 if diff == 3: count3 += 1 return count1 * count3 checked = {} def get_num_ways(pos): if pos == len(ns) - 1: return 1 if pos in checked: return checked[pos] total = 0 for i in range(pos + 1, len(ns)): if ns[i] - ns[pos] <= 3: total += get_num_ways(i) checked[pos] = total return total def part2(): return get_num_ways(0) print(part1()) print(part2())
def sub_dict(dic, *keys, **renames): d1 = {k: v for k, v in dic.items() if k in keys} d2 = {renames[k]: v for k, v in dic.items() if k in renames.keys()} return d1 | d2
def sub_dict(dic, *keys, **renames): d1 = {k: v for (k, v) in dic.items() if k in keys} d2 = {renames[k]: v for (k, v) in dic.items() if k in renames.keys()} return d1 | d2
# TODO: Figure out if this is even being used... class logging(object): def __init__(self, arg): super(logging, self).__init__() self.arg = arg
class Logging(object): def __init__(self, arg): super(logging, self).__init__() self.arg = arg
# https://www.codewars.com/kata/51ba717bb08c1cd60f00002f/train/python def solution(args): print(args) i = j = 0 result = [] section = [] while i < len(args): section.append(str(args[j])) while j + 1 < len(args) and args[j] + 1 == args[j + 1]: section.append(str(args[j + 1])) j += 1 if(len(section) > 2): result.append(section[0] + '-' + section[-1]) else: result.extend(section) i += len(section) j = i section = [] return ','.join(result)
def solution(args): print(args) i = j = 0 result = [] section = [] while i < len(args): section.append(str(args[j])) while j + 1 < len(args) and args[j] + 1 == args[j + 1]: section.append(str(args[j + 1])) j += 1 if len(section) > 2: result.append(section[0] + '-' + section[-1]) else: result.extend(section) i += len(section) j = i section = [] return ','.join(result)
''' Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connected to (0-indexed). It is -1 if there is no cycle. Note that pos is not passed as a parameter. Do not modify the linked list. Example 1: Input: head = [3,2,0,-4], pos = 1 Output: tail connects to node index 1 Explanation: There is a cycle in the linked list, where tail connects to the second node. Example 2: Input: head = [1,2], pos = 0 Output: tail connects to node index 0 Explanation: There is a cycle in the linked list, where tail connects to the first node. Example 3: Input: head = [1], pos = -1 Output: no cycle Explanation: There is no cycle in the linked list. '''
""" Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connected to (0-indexed). It is -1 if there is no cycle. Note that pos is not passed as a parameter. Do not modify the linked list. Example 1: Input: head = [3,2,0,-4], pos = 1 Output: tail connects to node index 1 Explanation: There is a cycle in the linked list, where tail connects to the second node. Example 2: Input: head = [1,2], pos = 0 Output: tail connects to node index 0 Explanation: There is a cycle in the linked list, where tail connects to the first node. Example 3: Input: head = [1], pos = -1 Output: no cycle Explanation: There is no cycle in the linked list. """
def is_a_leap_year(year): if (year % 400 == 0): return True elif (year % 100 == 0): return False elif (year % 4 == 0): return True return False def get_number_of_days(month, is_a_leap_year): if (month == 4 or month == 6 or month == 9 or month == 11): return 30 if (month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12): return 31 if is_a_leap_year: return 29 return 28 # Note: for the days, we go from 0 to 6 in order to use the modulo # Whereas for the months, we go from 1 to 12 for a more conventional notation # 1 Jan 1900 was a Monday day_on_1st_day_of_month = 0 number_of_matching_sundays = 0 # From 1900 to 2000 for current_year in range(1900, 2001): leap_year = is_a_leap_year(current_year) for month in range(1, 13): day_on_1st_day_of_month += get_number_of_days(month, leap_year) day_on_1st_day_of_month %= 7 if (day_on_1st_day_of_month == 6 and current_year > 1900 and not (current_year == 2000 and month == 12)): number_of_matching_sundays += 1 print(number_of_matching_sundays)
def is_a_leap_year(year): if year % 400 == 0: return True elif year % 100 == 0: return False elif year % 4 == 0: return True return False def get_number_of_days(month, is_a_leap_year): if month == 4 or month == 6 or month == 9 or (month == 11): return 30 if month == 1 or month == 3 or month == 5 or (month == 7) or (month == 8) or (month == 10) or (month == 12): return 31 if is_a_leap_year: return 29 return 28 day_on_1st_day_of_month = 0 number_of_matching_sundays = 0 for current_year in range(1900, 2001): leap_year = is_a_leap_year(current_year) for month in range(1, 13): day_on_1st_day_of_month += get_number_of_days(month, leap_year) day_on_1st_day_of_month %= 7 if day_on_1st_day_of_month == 6 and current_year > 1900 and (not (current_year == 2000 and month == 12)): number_of_matching_sundays += 1 print(number_of_matching_sundays)
""" This module holds custom exceptions """ class Error(Exception): """Base class for exceptions in this module.""" pass class ItemNotInInventoryError(Error): """ This exception is raised whenever the item we want to remove from our inventory is not there. """ def __init__(self, message, inventory: dict, item_name: str, *args): self.message = message self.inventory = inventory # value that caused the error self.item_name = item_name super(Exception, self).__init__(message, inventory, item_name, args) class NoSuchCharacterError(Error): """ This exception is raised whenever we want to load a character that is not saved in the database. """ def __init(self, message, name: str, *args): self.char_name = name super(Exception, self).__init__(message, name, args) class InvalidBuffError(Error): """ This exception is raised whenever we're trying to load a buff that is not of an approved type """ def __init(self, message, name: str, *args): self.buff_name = name super(Exception, self).__init__(message, name, args) class NonExistantBuffError(Error): """ This exception is raised whenever we're trying to access a Buff that is not part of the object ex: Trying to remove a buff from a Character when he does not have it in the first place """ def __init(self, message, name: str, *args): self.buff_name = name super(Exception, self).__init__(message, name, args)
""" This module holds custom exceptions """ class Error(Exception): """Base class for exceptions in this module.""" pass class Itemnotininventoryerror(Error): """ This exception is raised whenever the item we want to remove from our inventory is not there. """ def __init__(self, message, inventory: dict, item_name: str, *args): self.message = message self.inventory = inventory self.item_name = item_name super(Exception, self).__init__(message, inventory, item_name, args) class Nosuchcharactererror(Error): """ This exception is raised whenever we want to load a character that is not saved in the database. """ def __init(self, message, name: str, *args): self.char_name = name super(Exception, self).__init__(message, name, args) class Invalidbufferror(Error): """ This exception is raised whenever we're trying to load a buff that is not of an approved type """ def __init(self, message, name: str, *args): self.buff_name = name super(Exception, self).__init__(message, name, args) class Nonexistantbufferror(Error): """ This exception is raised whenever we're trying to access a Buff that is not part of the object ex: Trying to remove a buff from a Character when he does not have it in the first place """ def __init(self, message, name: str, *args): self.buff_name = name super(Exception, self).__init__(message, name, args)
""" pgdumpreport ============ Generate a report from the contents of a pg_dump created archive. """ version = '1.0.0'
""" pgdumpreport ============ Generate a report from the contents of a pg_dump created archive. """ version = '1.0.0'
class WordCount: # @param {str} line a text, for example "Bye Bye see you next" def mapper(self, _, line): # Write your code here # Please use 'yield key, value' for word in line.split(): yield word, 1 # @param key is from mapper # @param values is a set of value with the same key def reducer(self, key, values): # Write your code here # Please use 'yield key, value' yield key, sum(values)
class Wordcount: def mapper(self, _, line): for word in line.split(): yield (word, 1) def reducer(self, key, values): yield (key, sum(values))
CLIENT_ID = "affordability-c31256e5-39c4-4b20-905a-7500c583c591" CLIENT_SECRET = "eea983ac6dde3d1db86efe5793c7f6ec64b3d9c3ca6c81f4b71380109a723050" API_BASE = "https://api.nordicapigateway.com/" # If Python 2.x is used, only ASCII characters can be used in the values below. SECRET_KEY = "0401" # for local session storage. USERHASH = "test-user-id" INCLUDE_TRANSACTION_DETAILS = False # Set to True, if transaction details should be included. This requires special permissions for your client app!
client_id = 'affordability-c31256e5-39c4-4b20-905a-7500c583c591' client_secret = 'eea983ac6dde3d1db86efe5793c7f6ec64b3d9c3ca6c81f4b71380109a723050' api_base = 'https://api.nordicapigateway.com/' secret_key = '0401' userhash = 'test-user-id' include_transaction_details = False
MEDIA_INTENT = 'media' FEELING_INTENTS = ['smalltalk.appraisal.good', 'smalltalk.user.can_not_sleep', 'smalltalk.appraisal.thank_you', 'smalltalk.user.good', 'smalltalk.user.happy', 'smalltalk.user.sad', 'smalltalk.appraisal.bad', 'smalltalk.agent.happy', 'smalltalk.user.sick'] AFFIRMATION_INTENTS = ['yes', 'correct', 'smalltalk.dialog.correct', 'smalltalk.agent.right', 'smalltalk.appraisal.good'] NEGATION_INTENTS = ['no', 'wrong', 'smalltalk.dialog.wrong', 'skip', 'smalltalk.agent.wrong', 'smalltalk.dialog.wrong', 'smalltalk.appraisal.bad', 'repeat'] SMALLTALK_INTENTS = [ 'who_are_you', 'tell_a_joke', 'smalltalk.user.will_be_back', 'smalltalk.agent.be_clever', 'smalltalk.user.looks_like', 'smalltalk.user.sick', 'smalltalk.user.joking', 'smalltalk.greetings.nice_to_talk_to_you', 'smalltalk.agent.marry_user', 'smalltalk.agent.talk_to_me', 'smalltalk.user.has_birthday', 'smalltalk.user.wants_to_see_agent_again', 'smalltalk.user.happy', 'smalltalk.greetings.whatsup', 'smalltalk.agent.acquaintance', 'smalltalk.greetings.goodnight', 'smalltalk.user.lonely', 'smalltalk.emotions.wow', 'smalltalk.appraisal.bad', 'smalltalk.agent.funny', 'smalltalk.agent.birth_date', 'smalltalk.agent.occupation', 'smalltalk.appraisal.no_problem', 'smalltalk.agent.age', 'smalltalk.user.going_to_bed', 'smalltalk.user.bored', 'smalltalk.agent.bad', 'smalltalk.user.misses_agent', 'smalltalk.agent.beautiful', 'smalltalk.user.testing_agent', 'smalltalk.appraisal.good', 'smalltalk.agent.there', 'smalltalk.agent.annoying', 'smalltalk.user.angry', 'smalltalk.agent.busy', 'smalltalk.dialog.sorry', 'smalltalk.agent.right', 'smalltalk.appraisal.welcome', 'smalltalk.agent.suck', 'smalltalk.agent.happy', 'smalltalk.user.busy', 'smalltalk.user.excited', 'smalltalk.appraisal.well_done', 'smalltalk.agent.hobby', 'smalltalk.agent.family', 'smalltalk.agent.clever', 'smalltalk.agent.ready', 'smalltalk.greetings.nice_to_see_you', 'smalltalk.dialog.i_do_not_care', 'smalltalk.user.wants_to_talk', 'smalltalk.greetings.how_are_you', 'smalltalk.agent.sure', 'smalltalk.emotions.ha_ha', 'smalltalk.agent.my_friend', 'smalltalk.user.waits', 'smalltalk.agent.real', 'smalltalk.appraisal.thank_you', 'smalltalk.dialog.what_do_you_mean', 'smalltalk.user.back', 'smalltalk.agent.origin', 'smalltalk.agent.good', 'smalltalk.agent.drunk', 'smalltalk.agent.chatbot', 'smalltalk.dialog.hug', 'smalltalk.user.does_not_want_to_talk', 'smalltalk.greetings.start', 'smalltalk.user.sleepy', 'smalltalk.user.tired', 'smalltalk.greetings.nice_to_meet_you', 'smalltalk.greetings.goodevening', 'smalltalk.agent.answer_my_question', 'smalltalk.user.sad', 'smalltalk.agent.boss', 'smalltalk.agent.can_you_help', 'smalltalk.agent.crazy', 'smalltalk.user.likes_agent', 'smalltalk.agent.residence', 'smalltalk.user.can_not_sleep', 'smalltalk.agent.fired', 'smalltalk.agent.date_user', 'smalltalk.agent.hungry', 'smalltalk.agent.boring', 'smalltalk.dialog.hold_on', 'smalltalk.user.good', 'smalltalk.greetings.goodmorning', 'smalltalk.user.needs_advice', 'smalltalk.user.loves_agent', 'smalltalk.user.here', 'smalltalk.agent.make_sandwich' ] ASTONISHED_AMAZED = ['astonished_interest', 'smalltalk.user.wow'] REQUEST_HELP = ['smalltalk.agent.can_you_help', 'clarify'] START = ['start', 'hello', 'smalltalk.greetings' 'smalltalk.greetings.whatsup', 'smalltalk.greetings.nice_to_see_you', 'smalltalk.greetings.start', 'smalltalk.greetings.goodevening', 'smalltalk.greetings.goodmorning', 'smalltalk.greetings.hello', ]
media_intent = 'media' feeling_intents = ['smalltalk.appraisal.good', 'smalltalk.user.can_not_sleep', 'smalltalk.appraisal.thank_you', 'smalltalk.user.good', 'smalltalk.user.happy', 'smalltalk.user.sad', 'smalltalk.appraisal.bad', 'smalltalk.agent.happy', 'smalltalk.user.sick'] affirmation_intents = ['yes', 'correct', 'smalltalk.dialog.correct', 'smalltalk.agent.right', 'smalltalk.appraisal.good'] negation_intents = ['no', 'wrong', 'smalltalk.dialog.wrong', 'skip', 'smalltalk.agent.wrong', 'smalltalk.dialog.wrong', 'smalltalk.appraisal.bad', 'repeat'] smalltalk_intents = ['who_are_you', 'tell_a_joke', 'smalltalk.user.will_be_back', 'smalltalk.agent.be_clever', 'smalltalk.user.looks_like', 'smalltalk.user.sick', 'smalltalk.user.joking', 'smalltalk.greetings.nice_to_talk_to_you', 'smalltalk.agent.marry_user', 'smalltalk.agent.talk_to_me', 'smalltalk.user.has_birthday', 'smalltalk.user.wants_to_see_agent_again', 'smalltalk.user.happy', 'smalltalk.greetings.whatsup', 'smalltalk.agent.acquaintance', 'smalltalk.greetings.goodnight', 'smalltalk.user.lonely', 'smalltalk.emotions.wow', 'smalltalk.appraisal.bad', 'smalltalk.agent.funny', 'smalltalk.agent.birth_date', 'smalltalk.agent.occupation', 'smalltalk.appraisal.no_problem', 'smalltalk.agent.age', 'smalltalk.user.going_to_bed', 'smalltalk.user.bored', 'smalltalk.agent.bad', 'smalltalk.user.misses_agent', 'smalltalk.agent.beautiful', 'smalltalk.user.testing_agent', 'smalltalk.appraisal.good', 'smalltalk.agent.there', 'smalltalk.agent.annoying', 'smalltalk.user.angry', 'smalltalk.agent.busy', 'smalltalk.dialog.sorry', 'smalltalk.agent.right', 'smalltalk.appraisal.welcome', 'smalltalk.agent.suck', 'smalltalk.agent.happy', 'smalltalk.user.busy', 'smalltalk.user.excited', 'smalltalk.appraisal.well_done', 'smalltalk.agent.hobby', 'smalltalk.agent.family', 'smalltalk.agent.clever', 'smalltalk.agent.ready', 'smalltalk.greetings.nice_to_see_you', 'smalltalk.dialog.i_do_not_care', 'smalltalk.user.wants_to_talk', 'smalltalk.greetings.how_are_you', 'smalltalk.agent.sure', 'smalltalk.emotions.ha_ha', 'smalltalk.agent.my_friend', 'smalltalk.user.waits', 'smalltalk.agent.real', 'smalltalk.appraisal.thank_you', 'smalltalk.dialog.what_do_you_mean', 'smalltalk.user.back', 'smalltalk.agent.origin', 'smalltalk.agent.good', 'smalltalk.agent.drunk', 'smalltalk.agent.chatbot', 'smalltalk.dialog.hug', 'smalltalk.user.does_not_want_to_talk', 'smalltalk.greetings.start', 'smalltalk.user.sleepy', 'smalltalk.user.tired', 'smalltalk.greetings.nice_to_meet_you', 'smalltalk.greetings.goodevening', 'smalltalk.agent.answer_my_question', 'smalltalk.user.sad', 'smalltalk.agent.boss', 'smalltalk.agent.can_you_help', 'smalltalk.agent.crazy', 'smalltalk.user.likes_agent', 'smalltalk.agent.residence', 'smalltalk.user.can_not_sleep', 'smalltalk.agent.fired', 'smalltalk.agent.date_user', 'smalltalk.agent.hungry', 'smalltalk.agent.boring', 'smalltalk.dialog.hold_on', 'smalltalk.user.good', 'smalltalk.greetings.goodmorning', 'smalltalk.user.needs_advice', 'smalltalk.user.loves_agent', 'smalltalk.user.here', 'smalltalk.agent.make_sandwich'] astonished_amazed = ['astonished_interest', 'smalltalk.user.wow'] request_help = ['smalltalk.agent.can_you_help', 'clarify'] start = ['start', 'hello', 'smalltalk.greetingssmalltalk.greetings.whatsup', 'smalltalk.greetings.nice_to_see_you', 'smalltalk.greetings.start', 'smalltalk.greetings.goodevening', 'smalltalk.greetings.goodmorning', 'smalltalk.greetings.hello']
x1, v1, x2, v2 = map(int, input().strip().split(' ')) if v1 == v2: print("NO") else: j = (x1 - x2) // (v2 - v1) print("YES" if j > 0 and (x1+v1*j == x2+v2*j) else "NO")
(x1, v1, x2, v2) = map(int, input().strip().split(' ')) if v1 == v2: print('NO') else: j = (x1 - x2) // (v2 - v1) print('YES' if j > 0 and x1 + v1 * j == x2 + v2 * j else 'NO')
with open("meeting.in", "r") as inputFile: numberOfFields, numberOfPaths = map(int, list(inputFile.readline().strip().split())) paths = [list(map(int, line.strip().split())) for line in inputFile.readlines()] bessiepassable, elsiepassable = {str(i[0])+str(i[1]):i[2] for i in paths}, {str(i[0])+str(i[1]):i[3] for i in paths} def remove_dups(strvar): return "".join(sorted(list(set(strvar)))) def lenofpath(strvar, dictvar): distance = 0 for n in range(0, len(strvar)-1): distance = distance + dictvar[strvar[n]+strvar[n+1]] return distance fieldsPath = list(set([str(i[0])+str(i[1]) for i in paths])) first = [i for i in fieldsPath if i[0] == "1"] second = [remove_dups(k+j) for k in first for j in fieldsPath if j[0] != "1" and k[1] == j[0]] cowpath = [i for i in first+second if i[0] == "1" and i[-1] == str(numberOfFields)] bessie, elsie = {}, {} for path in cowpath: bessie[path], elsie[path] = lenofpath(path, bessiepassable), lenofpath(path, elsiepassable) with open("meeting.out", "w") as outputField: print(min([i for x in list(elsie.values()) for i in list(bessie.values()) if i == x]), file=outputField)
with open('meeting.in', 'r') as input_file: (number_of_fields, number_of_paths) = map(int, list(inputFile.readline().strip().split())) paths = [list(map(int, line.strip().split())) for line in inputFile.readlines()] (bessiepassable, elsiepassable) = ({str(i[0]) + str(i[1]): i[2] for i in paths}, {str(i[0]) + str(i[1]): i[3] for i in paths}) def remove_dups(strvar): return ''.join(sorted(list(set(strvar)))) def lenofpath(strvar, dictvar): distance = 0 for n in range(0, len(strvar) - 1): distance = distance + dictvar[strvar[n] + strvar[n + 1]] return distance fields_path = list(set([str(i[0]) + str(i[1]) for i in paths])) first = [i for i in fieldsPath if i[0] == '1'] second = [remove_dups(k + j) for k in first for j in fieldsPath if j[0] != '1' and k[1] == j[0]] cowpath = [i for i in first + second if i[0] == '1' and i[-1] == str(numberOfFields)] (bessie, elsie) = ({}, {}) for path in cowpath: (bessie[path], elsie[path]) = (lenofpath(path, bessiepassable), lenofpath(path, elsiepassable)) with open('meeting.out', 'w') as output_field: print(min([i for x in list(elsie.values()) for i in list(bessie.values()) if i == x]), file=outputField)