content
stringlengths
7
1.05M
class A(object): def do_this(self): print('do_this() in A') class B(A): pass class C(A): def do_this(self): print('do_this() in C') class D(B, C): pass D_instance = D() D_instance.do_this() print(D.mro()) # Method resolution order
a, b = 0, 1 while b < 10: print(b) a, b = b, a + b # 1 # 1 # 2 # 3 # 5 # 8 a, b = 0, 1 while b < 1000: print(b, end='->') a, b = b, a + b # 1->1->2->3->5->8->13->21->34->55->89->144->233->377->610->987->%
class AutoScaleSettingVO: def __init__(self, mini_size=1, max_size=1, mem_exc=0, deploy_name = ""): self.miniSize = mini_size self.maxSize = max_size self.memExc = mem_exc self.deployName = deploy_name self.operationResult = ""
#Date: 031622 #Difficulty: Easy class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ write=0 for read in range(len(nums)): if nums[read]!=val: nums[write]=nums[read] write+=1 return write
# # PySNMP MIB module STN-ATM-VPN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-ATM-VPN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:03:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, MibIdentifier, NotificationType, Unsigned32, Counter32, Gauge32, Counter64, iso, ObjectIdentity, TimeTicks, Bits, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "MibIdentifier", "NotificationType", "Unsigned32", "Counter32", "Gauge32", "Counter64", "iso", "ObjectIdentity", "TimeTicks", "Bits", "IpAddress") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") stnNotification, = mibBuilder.importSymbols("SPRING-TIDE-NETWORKS-SMI", "stnNotification") stnRouterAtmVpn, = mibBuilder.importSymbols("STN-ROUTER-MIB", "stnRouterAtmVpn") stnAtmVpn = ModuleIdentity((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1)) if mibBuilder.loadTexts: stnAtmVpn.setLastUpdated('0008080000Z') if mibBuilder.loadTexts: stnAtmVpn.setOrganization('Spring Tide Networks') stnAtmVpnTrunkObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1)) stnAtmVpnLinkObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2)) stnAtmVpnTrunkTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1), ) if mibBuilder.loadTexts: stnAtmVpnTrunkTable.setStatus('current') stnAtmVpnTrunkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkIfIndex")) if mibBuilder.loadTexts: stnAtmVpnTrunkEntry.setStatus('current') stnAtmVpnTrunkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkIfIndex.setStatus('current') stnAtmVpnTrunkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkViId.setStatus('current') stnAtmVpnTrunkName = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkName.setStatus('current') stnAtmVpnTrunkState = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkState.setStatus('current') stnAtmVpnTrunkLowerIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 5), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkLowerIfIndex.setStatus('current') stnAtmVpnTrunkVpnPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkVpnPaths.setStatus('current') stnAtmVpnTrunkInUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkInUnknownVpnId.setStatus('current') stnAtmVpnTrunkInVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkInVpnIdIfaceInvalid.setStatus('current') stnAtmVpnTrunkOutUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkOutUnknownVpnId.setStatus('current') stnAtmVpnTrunkOutVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkOutVpnIdIfaceInvalid.setStatus('current') stnAtmVpnTrunkPathTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2), ) if mibBuilder.loadTexts: stnAtmVpnTrunkPathTable.setStatus('current') stnAtmVpnTrunkPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathTrunkIfIndex"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnOUI"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnIndex"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnSubIndex")) if mibBuilder.loadTexts: stnAtmVpnTrunkPathEntry.setStatus('current') stnAtmVpnTrunkPathTrunkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathTrunkIfIndex.setStatus('current') stnAtmVpnTrunkPathVpnOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnOUI.setStatus('current') stnAtmVpnTrunkPathVpnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnIndex.setStatus('current') stnAtmVpnTrunkPathVpnSubIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnSubIndex.setStatus('current') stnAtmVpnTrunkPathType = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("vpnLearnedPath", 1), ("vpnStaticPath", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathType.setStatus('current') stnAtmVpnTrunkPathNextIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("atmVpnLink", 1), ("atmVpnTrunk", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfType.setStatus('current') stnAtmVpnTrunkPathNextIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 7), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfIndex.setStatus('current') stnAtmVpnTrunkPathInPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathInPackets.setStatus('current') stnAtmVpnTrunkPathInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathInOctets.setStatus('current') stnAtmVpnTrunkPathOutPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutPackets.setStatus('current') stnAtmVpnTrunkPathOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutOctets.setStatus('current') stnAtmVpnLinkTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1), ) if mibBuilder.loadTexts: stnAtmVpnLinkTable.setStatus('current') stnAtmVpnLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnLinkIfIndex")) if mibBuilder.loadTexts: stnAtmVpnLinkEntry.setStatus('current') stnAtmVpnLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkIfIndex.setStatus('current') stnAtmVpnLinkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkViId.setStatus('current') stnAtmVpnLinkName = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkName.setStatus('current') stnAtmVpnLinkVpnOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnOUI.setStatus('current') stnAtmVpnLinkVpnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnIndex.setStatus('current') stnAtmVpnLinkVpnSubIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnSubIndex.setStatus('current') stnAtmVpnLinkState = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkState.setStatus('current') stnAtmVpnLinkTrunkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkTrunkViId.setStatus('current') stnAtmVpnLinkLowerIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 9), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkLowerIfIndex.setStatus('current') stnAtmVpnLinkOutUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkOutUnknownVpnId.setStatus('current') stnAtmVpnLinkOutVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkOutVpnIdIfaceInvalid.setStatus('current') stnAtmVpnLinkInVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkInVpnIdIfaceInvalid.setStatus('current') mibBuilder.exportSymbols("STN-ATM-VPN-MIB", stnAtmVpnLinkIfIndex=stnAtmVpnLinkIfIndex, stnAtmVpnTrunkState=stnAtmVpnTrunkState, stnAtmVpnTrunkPathInOctets=stnAtmVpnTrunkPathInOctets, stnAtmVpnLinkLowerIfIndex=stnAtmVpnLinkLowerIfIndex, stnAtmVpnLinkInVpnIdIfaceInvalid=stnAtmVpnLinkInVpnIdIfaceInvalid, stnAtmVpnLinkObjects=stnAtmVpnLinkObjects, stnAtmVpnTrunkPathVpnSubIndex=stnAtmVpnTrunkPathVpnSubIndex, stnAtmVpnTrunkPathTable=stnAtmVpnTrunkPathTable, stnAtmVpn=stnAtmVpn, PYSNMP_MODULE_ID=stnAtmVpn, stnAtmVpnLinkState=stnAtmVpnLinkState, stnAtmVpnTrunkOutVpnIdIfaceInvalid=stnAtmVpnTrunkOutVpnIdIfaceInvalid, stnAtmVpnTrunkInVpnIdIfaceInvalid=stnAtmVpnTrunkInVpnIdIfaceInvalid, stnAtmVpnTrunkName=stnAtmVpnTrunkName, stnAtmVpnTrunkEntry=stnAtmVpnTrunkEntry, stnAtmVpnTrunkVpnPaths=stnAtmVpnTrunkVpnPaths, stnAtmVpnTrunkPathVpnOUI=stnAtmVpnTrunkPathVpnOUI, stnAtmVpnTrunkViId=stnAtmVpnTrunkViId, stnAtmVpnTrunkTable=stnAtmVpnTrunkTable, stnAtmVpnLinkVpnOUI=stnAtmVpnLinkVpnOUI, stnAtmVpnTrunkPathVpnIndex=stnAtmVpnTrunkPathVpnIndex, stnAtmVpnTrunkPathInPackets=stnAtmVpnTrunkPathInPackets, stnAtmVpnTrunkPathNextIfType=stnAtmVpnTrunkPathNextIfType, stnAtmVpnTrunkOutUnknownVpnId=stnAtmVpnTrunkOutUnknownVpnId, stnAtmVpnTrunkInUnknownVpnId=stnAtmVpnTrunkInUnknownVpnId, stnAtmVpnLinkOutUnknownVpnId=stnAtmVpnLinkOutUnknownVpnId, stnAtmVpnTrunkPathOutPackets=stnAtmVpnTrunkPathOutPackets, stnAtmVpnLinkTrunkViId=stnAtmVpnLinkTrunkViId, stnAtmVpnTrunkPathTrunkIfIndex=stnAtmVpnTrunkPathTrunkIfIndex, stnAtmVpnTrunkPathNextIfIndex=stnAtmVpnTrunkPathNextIfIndex, stnAtmVpnTrunkPathEntry=stnAtmVpnTrunkPathEntry, stnAtmVpnTrunkIfIndex=stnAtmVpnTrunkIfIndex, stnAtmVpnLinkTable=stnAtmVpnLinkTable, stnAtmVpnLinkOutVpnIdIfaceInvalid=stnAtmVpnLinkOutVpnIdIfaceInvalid, stnAtmVpnTrunkPathType=stnAtmVpnTrunkPathType, stnAtmVpnLinkVpnSubIndex=stnAtmVpnLinkVpnSubIndex, stnAtmVpnLinkName=stnAtmVpnLinkName, stnAtmVpnTrunkObjects=stnAtmVpnTrunkObjects, stnAtmVpnLinkVpnIndex=stnAtmVpnLinkVpnIndex, stnAtmVpnLinkEntry=stnAtmVpnLinkEntry, stnAtmVpnLinkViId=stnAtmVpnLinkViId, stnAtmVpnTrunkPathOutOctets=stnAtmVpnTrunkPathOutOctets, stnAtmVpnTrunkLowerIfIndex=stnAtmVpnTrunkLowerIfIndex)
class MenuItem: # Definiskan method info def info(self): print('Tampilkan nama dan harga dari menu item') menu_item1 = MenuItem() menu_item1.name = 'Roti Lapis' menu_item1.price = 5 # Panggil method info dari menu_item1 menu_item1.info() menu_item2 = MenuItem() menu_item2.name = 'Kue Coklat' menu_item2.price = 4 # Panggil method info dari menu_item2 menu_item2.info()
# Rodar script online # https://trinket.io/features/python3 a = int(input('Digite um número qualquer: ')) result = 0 # Verificando se p é primo while True: p = int(input('Digite um número primo: ')) cont = 0 for i in range(1, p + 1): if p % i == 0: cont += 1 if cont == 2: break else: print('{} não é primo!'.format(p)) if (a % p) == 0: result = ((a**p) - a) / p print("Primeira Fórmula") if (((a**p) - a) % p) == 0: print('Resultado: {}'.format(result)) print('a e p são congruentes') else: print('Resultado: {}'.format(result)) print('a e p não são congruentes') else: p2 = p -1 result = (((a**p2)-1) / p) print('Segunda Formula') if (((a**p2)-1) % p) == 0: print('Resultado: {}'.format(result)) print('a e p são congruentes') else: print('Resultado: {}'.format(result)) print('a e p não são congruentes')
#!/user/bin/python '''Number of Inversions '''
class HideX(object): # def x(): # def fget(self): # return ~self.__x # def fset(self, x): # assert isinstance(x, int), 'x must be int' # self.__x = ~x # return locals() # x = property(**x()) @property def x(self): return ~self.__x @x.setter def x(self, x): assert isinstance(x, int), 'x must be int' self.__x = ~x o = HideX() o.x = 5 print(o.x) print(o._HideX__x)
""" The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queens puzzle. Example: Input: 4, Output: 2 Explanation: There are two distinct solutions to the 4-queens puzzle as shown below. [[".Q..", // Solution 1 "...Q", "Q...", "..Q."], ["..Q.", // Solution 2 "Q...", "...Q", ".Q.."]] """ """ Same procedure as problem 51 except we propagate the number of results upwards, and not the final state of the board. """ def solve_n_queens(n): if n == 1: return 1 elif n < 4: return 0 def place_queen_on_row(row_idx, board): results = 0 for col_idx, col in enumerate(board[row_idx]): if col != '-': continue board_c = board.copy() board_c[row_idx] = f"{'.'*col_idx}Q{'.'*(n-1-col_idx)}" if row_idx == n - 1: return 1 for below_step in range(1, n-row_idx): new_below_row = '' for below_col_idx, char in enumerate(board_c[row_idx+below_step]): new_below_row += '.' if ( char == '.' or below_col_idx in {col_idx-below_step, col_idx, col_idx+below_step} ) else '-' board_c[row_idx+below_step] = new_below_row if res := place_queen_on_row(row_idx+1, board_c): results += res return results board = ['-'*n for _ in range(n)] return place_queen_on_row(0, board) assert solve_n_queens(4) == 2 assert solve_n_queens(8) == 92
#coding=utf-8 ''' Created on 2015-10-10 @author: Devuser ''' class HomeTaskPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="task/home_task_leftsub_nav.html" task_index_path="task/home_task_index.html" class HomeProjectPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="project/home_project_leftsub_nav.html" project_list_template_path="project/home_project_listview.html" project_list_control_path="project/home_project_list_control.html" class HomeAutoTaskPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="autotask/home_autotask_leftsub_nav.html" project_list_template_path="autotask/home_autotask_listview.html" class HomeDashBoardPath(object): left_nav_template_path="home/home_left_nav.html" activity_template_path="dashboard/home_dashboard_activity.html" summary_template_path="dashboard/home_dashboard_summary.html" class HomeFortestingPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="fortesting/home_fortesting_leftsub_nav.html" class HomeIssuePath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="issue/home_issue_leftsub_nav.html" home_issue_webapp="issue/home_issue_webapp.html" home_issue_index="issue/index.html" class HomeWebappsPath(object): webapps_index_path="webapps/home_webapp_index.html" left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="webapps/home_webapps_leftsub_nav.html" webapps_webpart_path="webapps/home_webapp_webpart.html" webapps_create_dialog_path="webapps/home_webapp_create_dialog.html" class Home_unloginPagePath(object): home_page_path="home/home_page.html" home_welcome_path="home/home_page_welcome.html" home_project_summary_path="home/home_page_project_summary.html" home_device_page_path="home/home_page_device.html" class DevicePagePath(object): left_nav_template_path="home/home_left_nav.html" device_page_path="device/home_device_index.html" device_list_page="device/home_device_list_page.html" device_list_controll="device/home_device_list_controll.html"
#Link Class is given! class Link: """A linked list. >>> s = Link(1, Link(2, Link(3))) >>> s.first 1 >>> s.rest Link(2, Link(3)) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self.rest = rest def __repr__(self): if self.rest is Link.empty: return 'Link({})'.format(self.first) else: return 'Link({}, {})'.format(self.first, repr(self.rest)) def __str__(self): """Returns a human-readable string representation of the Link >>> s = Link(1, Link(2, Link(3, Link(4)))) >>> str(s) '<1 2 3 4>' >>> str(Link(1)) '<1>' >>> str(Link.empty) # empty tuple '()' """ string = '<' while self.rest is not Link.empty: string += str(self.first) + ' ' self = self.rest return string + str(self.first) + '>' def __eq__(self, other): """Compares if two Linked Lists contain same values or not. >>> s, t = Link(1, Link(2)), Link(1, Link(2)) >>> s == t True """ if self is Link.empty and other is Link.empty: return True if self is Link.empty or other is Link.empty: return False return self.first == other.first and self.rest == other.rest def list_to_link(lst): """Takes a Python list and returns a Link with the same elements. >>> link = list_to_link([1, 2, 3]) >>> link 'Link(1, Link(2, Link(3)))' """ "***YOUR CODE HERE***" def link_to_list(link): """Takes a Link and returns a Python list with the same elements. >>> link = Link(1, Link(2, Link(3, Link(4)))) >>> link_to_list(link) [1, 2, 3, 4] >>> link_to_list(Link.empty) [] """ "*** YOUR CODE HERE ***" def remove_all(link , value): """Remove all the nodes containing value. Assume there exists some nodes to be removed and the first element is never removed. >>> l1 = Link(0, Link(2, Link(2, Link(3, Link(1, Link(2, Link(3))))))) >>> remove_all(l1, 2) >>> l1 Link(0, Link(3, Link(1, Link(3)))) >>> remove_all(l1, 3) >>> l1 Link(0, Link(1)) """ "*** YOUR CODE HERE ***" def linked_sum(lnk, total): """Return the number of combinations of elements in lnk that sum up to total . >>> # Four combinations : 1 1 1 1 , 1 1 2 , 1 3 , 2 2 >>> linked_sum (Link(1, Link(2, Link(3, Link(5)))), 4) 4 >>> linked_sum(Link(2, Link(3, Link(5))), 1) 0 >>> # One combination : 2 3 >>> linked_sum(Link(2, Link(4, Link(3))), 5) 1 """ "*** YOUR CODE HERE ***" def has_cycle(s): """ >>> has_cycle(Link.empty) False >>> a = Link(1, Link(2, Link(3))) >>> has_cycle(a) False >>> a.rest.rest.rest = a >>> has_cycle(a) True """ "*** YOUR CODE HERE ***"
class Reccomandation: def __init__(self, input_text): self.text = input_text def __get__(self, name ): return self.name
""" https://leetcode.com/problems/count-primes/ """ class Solution: # @param {integer} n # @return {integer} def countPrimes(self, n): if n <=2: return 0 if n == 3: return 1 count = n-2 d = [True for i in xrange(n)] for i in xrange(2, int(n**0.5)+1): if d[i]: j = 2 while i*j < n: if d[i*j]: d[i*j] = False count -=1 j +=1 return count
__author__ = 'nickbortolotti' """ Parte 1 1.utilizar un arreglo que almacene 2 cadenas y 2 valores enteros 2.mostrar en pantalla el la ubicacion 1 mostrar desde el 0-2 mostrar del 2 en adelante mostrar del 1 en reversa mostrar el ultimo elemento del arreglo en reversa """
def error_output(number_of_parameters): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open("parameters", "r+") file2.seek(0) position2 = file2.tell() file = open("fort.13","r") file.seek(0) position = file.tell() try: file.seek(0) error = file.read(12) file2.seek(20) file2.write(" " + error.rjust(18)) finally: file.close() except IOError: pass def error_output_bf(number_of_parameters, parameters_file_name): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open(parameters_file_name, "a+") #file2.seek(0) #position2 = file2.tell() file = open("fort.13","r") file.seek(0) position = file.tell() try: file.seek(0) error_bf = file.read(12) #file2.seek(20) file2.write("\n TOTAL ERROR: " + error_bf.rjust(18)) finally: file.close() except IOError: pass return error_bf
num_classes = 81 # model settings model = dict( type='SOLOv2', #pretrained='torchvision://resnet50', # The backbone weights will be overwritten when using load_from or resume_from. # https://github.com/open-mmlab/mmdetection/issues/7817#issuecomment-1108503826 backbone=dict( type='ResNet', depth=50, in_channels = 3, num_stages=4, out_indices=(0, 1, 2, 3), # C2, C3, C4, C5 frozen_stages=-1, # -1 is unfrozen, 0 -> C1 is frozen, 1 - C1, C2 are frozen and so on style='pytorch'), # norm_eval = True # true by default, "you're fine-tuning to minimize training, it's typically best to keep batch normalization frozen" # https://stackoverflow.com/questions/63016740/why-its-necessary-to-frozen-all-inner-state-of-a-batch-normalization-layer-when # required for traning from scratch neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=0, num_outs=5), bbox_head=dict( type='SOLOv2Head', num_classes=num_classes, in_channels=256, stacked_convs=2, seg_feat_channels=256, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 56), (28, 112), (56, 224), (112, 448), (224, 896)), sigma=0.2, num_grids=[40, 36, 24, 16, 12], ins_out_channels=128, loss_ins=dict( type='DiceLoss', use_sigmoid=True, loss_weight=3.0), loss_cate=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0)), mask_feat_head=dict( type='MaskFeatHead', in_channels=256, out_channels=128, start_level=0, end_level=3, num_classes=128, norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)), ) # training and testing settings train_cfg = dict() test_cfg = dict( nms_pre=500, score_thr=0.1, mask_thr=0.5, update_thr=0.05, kernel='gaussian', # gaussian/linear sigma=2.0, max_per_img=100)
#!/usr/bin/env prey async def main(): word = input("Give me a word: ") await x(f"echo {word}")
class ToolConfig (): def __init__ (self): self.one = './data/onetwothree1.wav' self.two = './data/onetwothree8.wav' self.digits_path = './data/digits'
# # PySNMP MIB module SW-DES3x50-ACLMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-DES3x50-ACLMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:12:30 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") ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") dlink_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-mgmt") PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, NotificationType, iso, MibIdentifier, Integer32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Gauge32, ObjectIdentity, Bits, TimeTicks, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "iso", "MibIdentifier", "Integer32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Gauge32", "ObjectIdentity", "Bits", "TimeTicks", "ModuleIdentity", "Unsigned32") DisplayString, RowStatus, TextualConvention, MacAddress = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "MacAddress") swAclMgmtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 11, 5)) if mibBuilder.loadTexts: swAclMgmtMIB.setLastUpdated('0007150000Z') if mibBuilder.loadTexts: swAclMgmtMIB.setOrganization('enterprise, Inc.') if mibBuilder.loadTexts: swAclMgmtMIB.setContactInfo(' Customer Service Postal: Tel: E-mail: ') if mibBuilder.loadTexts: swAclMgmtMIB.setDescription('The Structure of Access Control List Information for the proprietary enterprise.') swAclMaskMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 1)) swAclRuleMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 2)) swACLEthernetTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1), ) if mibBuilder.loadTexts: swACLEthernetTable.setStatus('current') if mibBuilder.loadTexts: swACLEthernetTable.setDescription("This table contain ACL mask of Ethernet information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's layer 2 part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields. ") swACLEthernetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLEthernetProfileID")) if mibBuilder.loadTexts: swACLEthernetEntry.setStatus('current') if mibBuilder.loadTexts: swACLEthernetEntry.setDescription('A list of information about ACL of Ethernet.') swACLEthernetProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEthernetProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEthernetProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLEthernetUsevlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUsevlan.setDescription('Specifies that the switch will examine the VLAN part of each packet header.') swACLEthernetMacAddrMaskState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-mac-addr", 2), ("src-mac-addr", 3), ("dst-src-mac-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setDescription("This object indicates the status of MAC address mask. other(1) - Neither source MAC address nor destination MAC address are masked. dst-mac-addr(2) - recieved frames's destination MAC address are currently used to be filtered as it meets with the MAC address entry of the table. src-mac-addr(3) - recieved frames's source MAC address are currently used to be filtered as it meets with the MAC address entry of the table. dst-src-mac-addr(4) - recieved frames's destination MAC address or source MAC address are currently used to be filtered as it meets with the MAC address entry of the table.") swACLEthernetSrcMacAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 4), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setDescription('This object Specifies the MAC address mask for the source MAC address.') swACLEthernetDstMacAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 5), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setDescription('This object Specifies the MAC address mask for the destination MAC address.') swACLEthernetUse8021p = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUse8021p.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUse8021p.setDescription("Specifies if the switch will examine the 802.1p priority value in the frame's header or not.") swACLEthernetUseEthernetType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setDescription("Specifies if the switch will examine the Ethernet type value in each frame's header or not.") swACLEthernetPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 8), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetPort.setStatus('current') if mibBuilder.loadTexts: swACLEthernetPort.setDescription('.') swACLEthernetRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 9), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEthernetRowStatus.setDescription('This object indicates the status of this entry.') swACLIpTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2), ) if mibBuilder.loadTexts: swACLIpTable.setStatus('current') if mibBuilder.loadTexts: swACLIpTable.setDescription("This table contain ACL mask of IP information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's IP layer part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields.") swACLIpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpProfileID")) if mibBuilder.loadTexts: swACLIpEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpEntry.setDescription('A list of information about ACL of IP Layer.') swACLIpProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLIpUsevlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLIpUsevlan.setDescription('This object indicates if IP layer vlan is examined or not.') swACLIpIpAddrMaskState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-ip-addr", 2), ("src-ip-addr", 3), ("dst-src-ip-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setDescription("This object indicates the status of IP address mask. other(1) - Neither source IP address nor destination IP address are masked. dst-ip-addr(2) - recieved frames's destination IP address are currently used to be filtered as it meets with the IP address entry of the table. src-ip-addr(3) - recieved frames's source IP address are currently used to be filtered as it meets with the IP address entry of the table. dst-src-ip-addr(4) - recieved frames's destination IP address or source IP address are currently used to be filtered as it meets with the IP address entry of the table.") swACLIpSrcIpAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 4), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setDescription('This object Specifies IP address mask for the source IP address.') swACLIpDstIpAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setDescription('This object Specifies the IP address mask for the destination IP address.') swACLIpUseDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUseDSCP.setStatus('current') if mibBuilder.loadTexts: swACLIpUseDSCP.setDescription('This object indicates DSCP protocol is is examined or not.') swACLIpUseProtoType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("icmp", 2), ("igmp", 3), ("tcp", 4), ("udp", 5), ("protocolId", 6)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUseProtoType.setStatus('current') if mibBuilder.loadTexts: swACLIpUseProtoType.setDescription('That object indicates which protocol will be examined.') swACLIpIcmpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("type", 2), ("code", 3), ("type-code", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIcmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIcmpOption.setDescription('This object indicates which fields should be filled in of ICMP. none(1)- two fields are null. type(2)- type field should be filled in. code(3)- code field should be filled in. type-code(4)- not only type fileld but code field should be filled in. ') swACLIpIgmpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIgmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIgmpOption.setDescription('This object indicates Options of IGMP is examined or not.') swACLIpTcpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-addr", 2), ("src-addr", 3), ("dst-src-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTcpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpTcpOption.setDescription("This object indicates the status of filtered address of TCP. other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - both recieved frames's destination port and source port are currently used to be filtered .") swACLIpUdpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-addr", 2), ("src-addr", 3), ("dst-src-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUdpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpUdpOption.setDescription("This object indicates the status of filtered address of UDP . other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - recieved frames's destination port or source port are currently used to be filtered.") swACLIpTCPorUDPSrcPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setDescription('Specifies a TCP port mask for the source port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the source port if swACLIpUseProtoType is UDP. ') swACLIpTCPorUDPDstPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setDescription('Specifies a TCP port mask for the destination port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the destination port if swACLIpUseProtoType is UDP.') swACLIpTCPFlagBit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPFlagBit.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPFlagBit.setDescription('Specifies a TCP connection flag mask.') swACLIpProtoIDOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpProtoIDOption.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDOption.setDescription("Specifies that the switch will examine each frame's Protocol ID field or not.") swACLIpProtoIDMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpProtoIDMask.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDMask.setDescription('Specifies that the rule applies to the IP protocol ID and the mask options behind the IP header.') swACLIpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 17), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpPort.setStatus('current') if mibBuilder.loadTexts: swACLIpPort.setDescription('.') swACLIpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 18), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRowStatus.setDescription('This object indicates the status of this entry.') swACLPayloadTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3), ) if mibBuilder.loadTexts: swACLPayloadTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadTable.setDescription('') swACLPayloadEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadProfileID")) if mibBuilder.loadTexts: swACLPayloadEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadEntry.setDescription('') swACLPayloadProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadProfileID.setDescription('.') swACLPayloadOffSet0to15 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setDescription('.') swACLPayloadOffSet16to31 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setDescription('.') swACLPayloadOffSet32to47 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setDescription('.') swACLPayloadOffSet48to63 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setDescription('.') swACLPayloadOffSet64to79 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setDescription('.') swACLPayloadPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 7), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadPort.setStatus('current') if mibBuilder.loadTexts: swACLPayloadPort.setDescription('.') swACLPayloadRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRowStatus.setDescription('.') swACLEtherRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1), ) if mibBuilder.loadTexts: swACLEtherRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleTable.setDescription('This table contain ACL rule of ethernet information.') swACLEtherRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLEtherRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLEtherRuleAccessID")) if mibBuilder.loadTexts: swACLEtherRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEntry.setDescription('A list of information about ACL rule of the layer 2 part of each packet.') swACLEtherRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEtherRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLEtherRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEtherRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleAccessID.setDescription('The ID of ACL rule entry relate to swACLEtherRuleProfileID.') swACLEtherRuleVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') swACLEtherRuleSrcMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 4), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setDescription('Specifies that the access will apply to only packets with this source MAC address.') swACLEtherRuleDstMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 5), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setDescription('Specifies that the access will apply to only packets with this destination MAC address.') swACLEtherRule8021P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRule8021P.setStatus('current') if mibBuilder.loadTexts: swACLEtherRule8021P.setDescription('Specifies that the access will apply only to packets with this 802.1p priority value.') swACLEtherRuleEtherType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEtherType.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEtherType.setDescription('Specifies that the access will apply only to packets with this hexidecimal 802.1Q Ethernet type value in the packet header.') swACLEtherRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') swACLEtherRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePriority.setDescription('Specific the priority will change to the packets while the swACLEtherRuleReplacePriority is enabled .') swACLEtherRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') swACLEtherRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setDescription('Specific the packets that match the access profile will replaced the DSCP field by the switch or not .') swACLEtherRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLEtherRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("permit", 1), ("deny", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePermit.setDescription('This object indicates resoult of examination is permit or deny;default is permit(1) permit - Specifies that packets that match the access profile are permitted to be forwarded by the switch. deny - Specifies that packets that do not match the access profile are not permitted to be forwarded by the switch and will be filtered.') swACLEtherRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 14), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setDescription('This object indicates the status of this entry.') swACLIpRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2), ) if mibBuilder.loadTexts: swACLIpRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleTable.setDescription('.') swACLIpRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpRuleAccessID")) if mibBuilder.loadTexts: swACLIpRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEntry.setDescription('.') swACLIpRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLIpRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleAccessID.setDescription('The ID of ACL IP rule entry .') swACLIpRuleVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') swACLIpRuleSrcIpaddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 4), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setDescription('Specific an IP source address.') swACLIpRuleDstIpaddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setDescription('Specific an IP destination address.') swACLIpRuleDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDscp.setDescription('Specific the value of dscp, the value can be configured 0 to 63') swACLIpRuleProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("icmp", 2), ("igmp", 3), ("tcp", 4), ("udp", 5), ("protocolId", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleProtocol.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtocol.setDescription('Specifies the IP protocol which has been configured in swACLIpEntry .') swACLIpRuleType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleType.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleType.setDescription('Specific that the rule applies to the value of icmp type traffic.') swACLIpRuleCode = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleCode.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleCode.setDescription('Specific that the rule applies to the value of icmp code traffic.') swACLIpRuleSrcPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleSrcPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcPort.setDescription('Specific that the rule applies the range of tcp/udp source port') swACLIpRuleDstPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDstPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstPort.setDescription('Specific the range of tcp/udp destination port range') swACLIpRuleFlagBits = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleFlagBits.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleFlagBits.setDescription('A value which indicates the set of TCP flags that this entity may potentially offers. The value is a sum. This sum initially takes the value zero, Then, for each flag, L, in the range 1 through 6, that this node performs transactions for, 2 raised to (L - 1) is added to the sum. Note that values should be calculated accordingly: Flag functionality 6 urg bit 5 ack bit 4 rsh bit 3 rst bit 2 syn bit 1 fin bit For example,it you want to enable urg bit and ack bit,you should set vlaue 48(2^(5-1) + 2^(6-1)).') swACLIpRuleProtoID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleProtoID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtoID.setDescription('Specific that the rule applies to the value of ip protocol id traffic') swACLIpRuleUserMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 14), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleUserMask.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleUserMask.setDescription('Specific that the rule applies to the ip protocol id and the range of options behind the IP header.') swACLIpRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') swACLIpRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') swACLIpRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') swACLIpRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setDescription('Indicate weather the DSCP field can be over-write or not. ') swACLIpRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLIpRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("deny", 1), ("permit", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePermit.setDescription('This object indicates filter is permit or deny; default is permit(1)') swACLIpRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 21), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRowStatus.setDescription('This object indicates the status of this entry.') swACLPayloadRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3), ) if mibBuilder.loadTexts: swACLPayloadRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleTable.setDescription('') swACLPayloadRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadRuleAccessID")) if mibBuilder.loadTexts: swACLPayloadRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEntry.setDescription('') swACLPayloadRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setDescription('') swACLPayloadRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setDescription('') swACLPayloadRuleOffSet0to15 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setDescription('') swACLPayloadRuleOffSet16to31 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setDescription('') swACLPayloadRuleOffSet32to47 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setDescription('') swACLPayloadRuleOffSet48to63 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setDescription('') swACLPayloadRuleOffSet64to79 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setDescription('') swACLPayloadRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setDescription('') swACLPayloadRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') swACLPayloadRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setDescription('') swACLPayloadRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setDescription('Indicate wether the DSCP field can be over-write or not ') swACLPayloadRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLPayloadRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("permit", 1), ("deny", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePermit.setDescription('') swACLPayloadRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 14), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setDescription('') mibBuilder.exportSymbols("SW-DES3x50-ACLMGMT-MIB", swACLIpUseDSCP=swACLIpUseDSCP, swACLIpRuleFlagBits=swACLIpRuleFlagBits, swACLEthernetPort=swACLEthernetPort, swACLIpRuleEntry=swACLIpRuleEntry, swACLIpUdpOption=swACLIpUdpOption, swACLIpRuleSrcPort=swACLIpRuleSrcPort, swACLPayloadRuleEnablePriority=swACLPayloadRuleEnablePriority, swACLPayloadOffSet48to63=swACLPayloadOffSet48to63, swACLIpTCPorUDPDstPortMask=swACLIpTCPorUDPDstPortMask, swACLPayloadOffSet64to79=swACLPayloadOffSet64to79, swACLPayloadRuleOffSet16to31=swACLPayloadRuleOffSet16to31, swACLIpIgmpOption=swACLIpIgmpOption, swACLEtherRuleDstMacAddress=swACLEtherRuleDstMacAddress, swAclMgmtMIB=swAclMgmtMIB, swACLIpRulePermit=swACLIpRulePermit, swACLIpRuleProtocol=swACLIpRuleProtocol, swACLIpUsevlan=swACLIpUsevlan, swACLPayloadRulePriority=swACLPayloadRulePriority, swACLIpRuleDstIpaddress=swACLIpRuleDstIpaddress, swACLIpEntry=swACLIpEntry, swACLIpRuleEnableReplaceDscp=swACLIpRuleEnableReplaceDscp, swACLIpSrcIpAddrMask=swACLIpSrcIpAddrMask, swACLEtherRuleRowStatus=swACLEtherRuleRowStatus, swACLIpRuleEnablePriority=swACLIpRuleEnablePriority, swACLIpRuleType=swACLIpRuleType, swACLIpRuleUserMask=swACLIpRuleUserMask, swACLIpUseProtoType=swACLIpUseProtoType, swACLIpRulePriority=swACLIpRulePriority, swACLIpRuleSrcIpaddress=swACLIpRuleSrcIpaddress, swACLPayloadProfileID=swACLPayloadProfileID, swACLEthernetTable=swACLEthernetTable, swACLIpTCPorUDPSrcPortMask=swACLIpTCPorUDPSrcPortMask, swACLPayloadPort=swACLPayloadPort, swACLPayloadRuleOffSet32to47=swACLPayloadRuleOffSet32to47, swAclMaskMgmt=swAclMaskMgmt, swACLPayloadRuleRowStatus=swACLPayloadRuleRowStatus, swACLEthernetRowStatus=swACLEthernetRowStatus, swACLEtherRuleEntry=swACLEtherRuleEntry, swACLIpRuleAccessID=swACLIpRuleAccessID, swACLIpTable=swACLIpTable, swACLEthernetUseEthernetType=swACLEthernetUseEthernetType, swACLIpTcpOption=swACLIpTcpOption, swACLEtherRuleTable=swACLEtherRuleTable, swACLIpRuleCode=swACLIpRuleCode, swACLEthernetProfileID=swACLEthernetProfileID, swAclRuleMgmt=swAclRuleMgmt, swACLEthernetSrcMacAddrMask=swACLEthernetSrcMacAddrMask, swACLPayloadOffSet16to31=swACLPayloadOffSet16to31, swACLPayloadRuleOffSet64to79=swACLPayloadRuleOffSet64to79, swACLIpTCPFlagBit=swACLIpTCPFlagBit, swACLPayloadRuleTable=swACLPayloadRuleTable, swACLEthernetEntry=swACLEthernetEntry, swACLEtherRuleSrcMacAddress=swACLEtherRuleSrcMacAddress, PYSNMP_MODULE_ID=swAclMgmtMIB, swACLEthernetUse8021p=swACLEthernetUse8021p, swACLPayloadRuleEnableReplaceDscp=swACLPayloadRuleEnableReplaceDscp, swACLPayloadOffSet0to15=swACLPayloadOffSet0to15, swACLIpRuleVlan=swACLIpRuleVlan, swACLIpProtoIDMask=swACLIpProtoIDMask, swACLPayloadRulePermit=swACLPayloadRulePermit, swACLPayloadRuleEntry=swACLPayloadRuleEntry, swACLEthernetMacAddrMaskState=swACLEthernetMacAddrMaskState, swACLEtherRuleReplacePriority=swACLEtherRuleReplacePriority, swACLEtherRuleRepDscp=swACLEtherRuleRepDscp, swACLEtherRule8021P=swACLEtherRule8021P, swACLIpRowStatus=swACLIpRowStatus, swACLPayloadRuleOffSet48to63=swACLPayloadRuleOffSet48to63, swACLIpDstIpAddrMask=swACLIpDstIpAddrMask, swACLPayloadTable=swACLPayloadTable, swACLIpProtoIDOption=swACLIpProtoIDOption, swACLEtherRuleProfileID=swACLEtherRuleProfileID, swACLIpRuleTable=swACLIpRuleTable, swACLEtherRuleVlan=swACLEtherRuleVlan, swACLPayloadEntry=swACLPayloadEntry, swACLPayloadRuleAccessID=swACLPayloadRuleAccessID, swACLEthernetUsevlan=swACLEthernetUsevlan, swACLPayloadOffSet32to47=swACLPayloadOffSet32to47, swACLIpRuleRowStatus=swACLIpRuleRowStatus, swACLEtherRuleEnablePriority=swACLEtherRuleEnablePriority, swACLIpPort=swACLIpPort, swACLPayloadRuleReplacePriority=swACLPayloadRuleReplacePriority, swACLEtherRulePriority=swACLEtherRulePriority, swACLIpRuleDstPort=swACLIpRuleDstPort, swACLIpRuleRepDscp=swACLIpRuleRepDscp, swACLPayloadRowStatus=swACLPayloadRowStatus, swACLEtherRuleEnableReplaceDscp=swACLEtherRuleEnableReplaceDscp, swACLEthernetDstMacAddrMask=swACLEthernetDstMacAddrMask, swACLIpProfileID=swACLIpProfileID, swACLIpRuleProfileID=swACLIpRuleProfileID, swACLPayloadRuleRepDscp=swACLPayloadRuleRepDscp, swACLIpRuleProtoID=swACLIpRuleProtoID, swACLEtherRuleAccessID=swACLEtherRuleAccessID, swACLEtherRulePermit=swACLEtherRulePermit, swACLIpIcmpOption=swACLIpIcmpOption, swACLIpIpAddrMaskState=swACLIpIpAddrMaskState, swACLEtherRuleEtherType=swACLEtherRuleEtherType, swACLPayloadRuleProfileID=swACLPayloadRuleProfileID, swACLPayloadRuleOffSet0to15=swACLPayloadRuleOffSet0to15, swACLIpRuleReplacePriority=swACLIpRuleReplacePriority, swACLIpRuleDscp=swACLIpRuleDscp)
""" Augment 3D images of a focal lesion with 3D rotation, flip, and translation. import_mhd: Prepare patches from lung CT scan images and annotations. (See readme.md - Installation for details.) datasets: Retrieve patches after augmentation for training. classify_patch: Demonstrate the use of datasets for training 3D deep convolution net. """
# Michael O'Regan 05/May/2019 # https://www.sanfoundry.com/python-program-implement-bucket-sort/ def bucketSort(alist): largest = max(alist) length = len(alist) size = largest/length buckets = [[] for _ in range(length)] for i in range(length): j = int(alist[i]/size) if j != length: buckets[j].append(alist[i]) else: buckets[length - 1].append(alist[i]) for i in range(length): insertionSort(buckets[i]) result = [] for i in range(length): result = result + buckets[i] return result def insertionSort(alist): for i in range(1, len(alist)): temp = alist[i] j = i - 1 while (j >= 0 and temp < alist[j]): alist[j + 1] = alist[j] j = j - 1 alist[j + 1] = temp alist = [54,26,93,17,77,31,44,55,20] bucketSort(alist) print(bucketSort(alist))
""" It is commonly said that one human year is equivalent to 7 dog years. However this simple conversion fails to recognize that dogs reach adulthood in approximately two years. As a result, some people believe that it is better to count each of the first two human years as 10.5 dog years, and then count each additional human year as 4 dog years. Write a program that implements the conversion from human years to dog years described in the previous paragraph. Ensure that your program works correctly for conversions of less than two human years and for conversions of two or more human years. Your program should display an appropriate error message if the user enters a negative number. Remember that: - the FIRST TWO HUMAN YEARS are equivalent to 10.5 CANINE YEARS - the FOLLOWING HUMAN YEARS are equivalent to FOUR CANINE YEARS. """ # START Definition of FUNCTIONS def valutaIntPositive(numero): if numero.isdigit(): if numero != "0": return True return False def yearsHumanDog(etaHuman): if etaHuman == 1: etaDog = 10.5 return etaDog elif etaHuman == 2: etaDog = 21 return etaDog else: etaDog = 21 + ((etaHuman-2) * 4) return etaDog # END Definition of FUNCTIONS # Acquisition and Control of the DATA entered by the USER etaHuman = input("Enter the HUMAN Years: ") etaHumanIntPositive = valutaIntPositive(etaHuman) while not(etaHumanIntPositive): print("Incorrect entry. Try again.") etaHuman = input("Enter the HUMAN Years: ") etaHumanIntPositive = valutaIntPositive(etaHuman) # Conversion STR -> INT etaHuman = int(etaHuman) # DOG YEARS computing etaDog = yearsHumanDog(etaHuman) # Displaying the RESULTS if etaHuman == 1: print(str(etaHuman) + " HUMAN year is equal to " + str(etaDog) + " DOG years.") else: print(str(etaHuman) + " HUMAN years is equal to " + str(etaDog) + " DOG years.")
divs = {} def sm(x): s = 0 for i in range(2,int(x**0.5)): if x%i == 0: s += i s += x/i if i*i == x: s -= i return s+1 for i in range(10001): divs[i] = sm(i) ans = 0 for i in range(10001): for j in range(10001): if divs[i] == j and divs[j] == i and i!=j: ans += i print(ans)
####################### # MaudeMiner Settings # ####################### # Database settings DATABASE_PATH = '/Users/tklovett/maude/' DATABASE_NAME = 'maude' # These setting control where the text files and zip files retrieved from the FDA website are stored DATA_PATH = '/Users/tklovett/maude/data/' ZIPS_PATH = DATA_PATH + 'zips/' TXTS_PATH = DATA_PATH + 'txts/' # The downloader module will use MAUDE_DATA_ORIGIN = 'http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/PostmarketRequirements/ReportingAdverseEvents/ucm127891.htm' LINES_PER_DB_COMMIT = 1000 * 50 # MaudeMiner will load any modules listed here INSTALLED_MODULES = ( "querier", "tokenizer", "html_generator", "cleanser", )
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def sortedArrayToBST(self, nums: List[int]) -> TreeNode: return self.generateTree(nums, 0, len(nums) - 1) def generateTree(self, nums, left, right): if left > right: return None mid = (left + right) // 2 curNode = TreeNode(nums[mid]) curNode.left = self.generateTree(nums, left, mid - 1) curNode.right = self.generateTree(nums, mid + 1, right) return curNode
class _LinearWithBias(Module): __parameters__ = ["weight", "bias", ] __buffers__ = [] weight : Tensor bias : Tensor training : bool
count = 0 current_group = set() with open('in', 'r') as f: for line in f.readlines(): l = line.strip() if len(l) == 0: # this is end of the last group count += len(current_group) current_group = set() else: # add answers to the current group for chr in l: current_group.add(chr) # don't forget the last group count += len(current_group) print(count)
stim_positions = { "double": [ [(0.4584, 0.2575, 0.2038), (0.4612, 0.2690, -0.0283)], # 3d location [(0.4601, 0.1549, 0.1937), (0.4614, 0.1660, -0.0358)], ], "double_20070301": [ [(0.4538, 0.2740, 0.1994), (0.4565, 0.2939, -0.0531)], # top highy [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)], # top lowy ], "half": [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166, -0.0329)],], "half_20070303": [[(0.4628, 0.2066, 0.1920), (0.4703, 0.2276, -0.0555)]], "tall": [[(0.4562, 0.1951, 0.2798), (0.4542, 0.2097, -0.0325)],], ##from 20061205: ##tall=[( 456.2, 195.1, 279.8), ## ( 454.2, 209.7,-32.5)] ##from 20061212: ##short=[( 461.4, 204.2, 128.1), ## ( 462.5, 205.3, 114.4)] ##from 20061219: ##necklace = [( 455.9, 194.4, 262.8), ## ( 456.2, 212.8,-42.2)] ## 'no post (smoothed)' : [( .4562, .1951, .2798), ## ( .4542, .2097,-.0325)], "short": [[(0.4614, 0.2042, 0.1281), (0.4625, 0.2053, 0.1144)]], "necklace": [[(0.4559, 0.1944, 0.2628), (0.4562, 0.2128, -0.0422)]], None: [], }
""" 026 Pig Latin takes the first consonant of a word, moves it to the end of the word and adds on an “ay”. If a word begins with a vowel you just add “way” to the end. For example, pig becomes igpay, banana becomes ananabay, and aadvark becomes aadvarkway. Create a program that will ask the user to enter a word and change it into Pig Latin. Make sure the new word is displayed in lower case """ word = input("enter a word plz : ") vowels = ["a", "A", "i", "I", "e" , "E","O", "o","u","U"] if word[0] in vowels : print(word +"way") else : length = len(word) newword = word[1:length] print(newword + word[0]+"ay")
class Node(object): def __init__(self): super().__init__() self.__filename = '' self.__children = [] self.__line_number = 0 self.__column_number = 0 def get_children(self) -> list: return self.__children def add_child(self, child: 'Node') -> None: assert isinstance(child, Node) self.__children.append(child) def get_line_number(self) -> int: return self.__line_number def set_line_number(self, n: int) -> None: self.__line_number = int(n) def get_column_number(self) -> int: return self.__column_number def set_column_number(self, n: int) -> None: self.__column_number = int(n) def get_file_name(self) -> str: return self.__filename def set_file_name(self, f: str) -> None: self.__filename = str(f) def is_leaf(self) -> bool: if len(self.__children) == 0: return True return False
"""TO BE EDITED. """ # from easyml import def test_foo(): assert 1 == 1
def binary_search(nums, target): low = 0 high = len(nums) - 1 while low <= high: mid = low + ((high - low) // 2) if nums[mid] > target: high = mid-1 elif nums[mid] < target: low = mid+1 else: return mid return -1 if __name__ == "__main__": lst = [0, 1, 2, 5, 6, 7, 8] print(binary_search(lst, 10)) print(binary_search(lst, 7)) print(binary_search(lst, 1))
# # PySNMP MIB module ALVARION-USER-ACCOUNT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-USER-ACCOUNT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:06:37 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) # alvarionMgmtV2, = mibBuilder.importSymbols("ALVARION-SMI", "alvarionMgmtV2") OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Unsigned32, MibIdentifier, Integer32, Counter64, Gauge32, TimeTicks, ObjectIdentity, IpAddress, ModuleIdentity, Counter32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Unsigned32", "MibIdentifier", "Integer32", "Counter64", "Gauge32", "TimeTicks", "ObjectIdentity", "IpAddress", "ModuleIdentity", "Counter32", "iso") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") alvarionUserAccountMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35)) if mibBuilder.loadTexts: alvarionUserAccountMIB.setLastUpdated('200710310000Z') if mibBuilder.loadTexts: alvarionUserAccountMIB.setOrganization('Alvarion Ltd.') alvarionUserAccountMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1)) coUserAccountStatusGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1)) coUserAccountStatusTable = MibTable((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1), ) if mibBuilder.loadTexts: coUserAccountStatusTable.setStatus('current') coUserAccountStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1), ).setIndexNames((0, "ALVARION-USER-ACCOUNT-MIB", "coUserAccIndex")) if mibBuilder.loadTexts: coUserAccountStatusEntry.setStatus('current') coUserAccIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: coUserAccIndex.setStatus('current') coUserAccUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccUserName.setStatus('current') coUserAccPlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccPlanName.setStatus('current') coUserAccRemainingOnlineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 4), Integer32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccRemainingOnlineTime.setStatus('current') coUserAccFirstLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccFirstLoginTime.setStatus('current') coUserAccRemainingSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 6), Integer32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccRemainingSessionTime.setStatus('current') coUserAccStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("valid", 1), ("invalid", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccStatus.setStatus('current') coUserAccExpirationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccExpirationTime.setStatus('current') alvarionUserAccountMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2)) alvarionUserAccountMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2, 0)) alvarionUserAccountMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3)) alvarionUserAccountMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1)) alvarionUserAccountMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2)) alvarionUserAccountMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1, 1)).setObjects(("ALVARION-USER-ACCOUNT-MIB", "alvarionUserAccountStatusMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarionUserAccountMIBCompliance = alvarionUserAccountMIBCompliance.setStatus('current') alvarionUserAccountStatusMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2, 1)).setObjects(("ALVARION-USER-ACCOUNT-MIB", "coUserAccUserName"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccPlanName"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccRemainingOnlineTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccFirstLoginTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccRemainingSessionTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccStatus"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccExpirationTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarionUserAccountStatusMIBGroup = alvarionUserAccountStatusMIBGroup.setStatus('current') mibBuilder.exportSymbols("ALVARION-USER-ACCOUNT-MIB", coUserAccountStatusEntry=coUserAccountStatusEntry, coUserAccountStatusTable=coUserAccountStatusTable, alvarionUserAccountMIBNotificationPrefix=alvarionUserAccountMIBNotificationPrefix, alvarionUserAccountMIBGroups=alvarionUserAccountMIBGroups, alvarionUserAccountStatusMIBGroup=alvarionUserAccountStatusMIBGroup, coUserAccountStatusGroup=coUserAccountStatusGroup, alvarionUserAccountMIBCompliances=alvarionUserAccountMIBCompliances, PYSNMP_MODULE_ID=alvarionUserAccountMIB, coUserAccRemainingOnlineTime=coUserAccRemainingOnlineTime, coUserAccExpirationTime=coUserAccExpirationTime, coUserAccUserName=coUserAccUserName, coUserAccFirstLoginTime=coUserAccFirstLoginTime, alvarionUserAccountMIB=alvarionUserAccountMIB, alvarionUserAccountMIBCompliance=alvarionUserAccountMIBCompliance, coUserAccStatus=coUserAccStatus, coUserAccPlanName=coUserAccPlanName, coUserAccIndex=coUserAccIndex, alvarionUserAccountMIBConformance=alvarionUserAccountMIBConformance, coUserAccRemainingSessionTime=coUserAccRemainingSessionTime, alvarionUserAccountMIBObjects=alvarionUserAccountMIBObjects, alvarionUserAccountMIBNotifications=alvarionUserAccountMIBNotifications)
class Solution: def superPow(self, a: int, b: List[int]) -> int: if (a % 1337 == 0): return 0 return pow(a, reduce(lambda x, y: x * 10 + y, b), 1337)
print("Hello, world!") x = "Hello World" print(x) y = 42 print(y)
def StringToDict(s): RES = dict() for e in set(s): RES[e] = 0 for e in s: RES[e] += 1 return RES
""" Master list of constants for logger Mostly logger keys, but some other constants as well. """ # loggerkey - header HEADER = "header" # loggerkey - timing info EPOCH_START = "epoch_start" EPOCH_STOP = "epoch_stop" RUN_START = "run_start" RUN_STOP = "run_stop" BATCH_START = "batch_start" BATCH_STOP = "batch_stop" # loggerkey - run information NUM_BATCHES = "num_batches" BATCH_SIZE = "batch_size" FLOPS = "flops" # loggerkey - model hyperparameters LEARNING_RATE = "learning_rate" # type of summary view saved to file INTERMEDIATE_VIEW = "intermediate_view" # table view RAW_VIEW = "raw_view" # json view # available types of score metrics EXPS = "exps" # examples/sec (throughput) TFPS = "tfps" # teraflops/sec (floating point ops rate) GBPS = "gbps" # gb/sec
##################################################################### # Trabajando con Cadenas de Texto # ##################################################################### cadena = " Hola Mundo!! " print(cadena) print(cadena[10]) print(cadena[3:]) print(cadena[:10]) print(cadena[2:6]) print(cadena[-4]) print(cadena.lower()) print(cadena.upper()) print(cadena.capitalize()) print(cadena.strip()) print(cadena.replace("o", "+")) print(cadena.isdigit()) print(len(cadena)) print(cadena.count()) print("") ##################################################################### # Formateando Cadenas y Número # ##################################################################### mensaje = "Mundo" print("Hola " + mensaje + " !!!") print("Hola {} !!!".format(mensaje)) print("Hola {s} !!!".format(s=mensaje)) print(f"Hola {mensaje} !!!") numero = 10 / 3 print(numero) print("Hola {n:1.2f} !!!".format(n=numero))
DO_RUN_BIAS_TEST=False DEBUG = False INPUT_CSV=False ROOT_FOLDER="/home/jupyter/forms-ocr" OUTPUT_FOLDER= ROOT_FOLDER + "/sample_images" GEN_FOLDER = OUTPUT_FOLDER + "/img" LOCALE = "en_GB" DUMMY_GENERATOR=0 FIELD_DICT_3FIELDS= {'Name':(0,0),'Tax':(0,0), 'Address':(0,0) } FIELD_DICT_7FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0) } FIELD_DICT_16FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0), 'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0) } FIELD_DICT_23FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0), 'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0), 'Tax2':(0,0), 'Tax3':(0,0), 'Tax4':(0,0), 'Tax5':(0,0), 'Tax6':(0,0), 'Tax7':(0,0), 'Date':(0,0) } FIELD_DICT_SSN= {'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0) } FIELD_DICT= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Instructions':(0,0), 'Exemptions':(0,0), 'ExemptionCode':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0),'Account':(0,0), 'SocialSeciurityNumber':(0,0), 'EmpIdentificationNumber':(0,0) } ############################### FAKER_GENERATOR=1 HANDWRITING_FIXED=0 HANDWRITING_PRESET_FLAG=1
data = { "en": { "no_permission": "You do not have permission to use this command!", "not_command_sender": "You are not the sender of that command!", "vote_message": "Thank you for voting for Doge Utilities!", "banned_message": "You are banned from using Doge Utilities!", "error_message": "Oops! Doge Utilities has ran into an error...", "use_in_server": "Please use Doge Utilities in a server for the best experience!", "no_reminders": "You have no active reminders", "reminders": "Reminders", "reminder": "Reminder", "time": "Time", "text": "Text", "vote_again": "Don't forget to vote for me!", "todo_list": "To-do List", "todo_empty": "Your to-do list is empty", "generate_number": "Generate Number", "number_prompt": "Your random number is", "cpu_usage": "CPU Usage", "ram_usage": "RAM Usage", "thread_count": "Thread Count", "joined_guilds": "Joined Guilds", "active_shards": "Active Shards", "member_count": "Member Count", "channel_count": "Channel Count", "command_count": "Command Count", "disnake_version": "Disnake Version", "bot_version": "Bot Version", "bot_uptime": "Bot Uptime", "latency": "Latency", "shard": "Shard", "members_lower": "members", "guilds_lower": "guilds", "i_choose": "I choose", "shard_count": "Shard Count", "current_shard": "Current Shard", "reminder_removed": "That reminder has been successfully removed", "reminder_added": "You will be reminded in **{}**", "support_server": "Doge Utilities support server", "user_accounts": "User accounts", "bot_accounts": "Bot accounts", "total_members": "Total members", "guild_members": "Guild Members", "todo_added": 'Successfully added **"{}"** to your to-do list', "todo_removed": 'Successfully removed **"{}"** from your to-do list', "uptime_description": "Doge Utilities has been running for", "current_time": "Time", "current_date": "Date", "weekday": "Weekday", "time_description": "Information for", "weekdays": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], "vote_websites": "You can vote for me on these websites", "vote_reminder_added": "A **12 hour reminder** has been successfully added!", "vote_reminder_exists": "A reminder already exists!", "vote_add_reminder": "Add a reminder", "vote_messages_enabled": "Vote messages have been successfully **enabled**", "vote_messages_disabled": "Vote messages have been successfully **disabled**", "enabled_lower": "enabled", "disabled_lower": "disabled", "vote_messages_status": "Vote messages are currently **{}**", "language_update": "Your preferred language has been set to **{}**", "language_name": "English", "website_links": "Here are the links to my website", "website": "Website", "dashboard": "Dashboard", "user_kicked": "**{}** has been **successfully kicked**", "user_banned": "**{}** has been **successfully banned**", "unable_to_kick": "Unable to kick **{}**", "unable_to_ban": "Unable to ban **{}**", "mention_valid_user": "Please mention a valid user!", "user_id": "User ID", "user_tag": "Tag", "creation_time": "Creation Time", "public_flags": "Public Flags", "bot_user": "Bot User", "system_user": "System User", "command_cooldown": "Command Cooldown", "command_cooldown_description": "Please wait **{}** before using the `{}` command again", "invalid_duration": "Please enter a valid duration!", "no_permission_kick": "You do not have permission to kick **{}**!", "no_permission_ban": "You do not have permission to ban **{}**!", "unable_to_mute": "Unable to mute **{}**", "no_permission_mute": "You do not have permission to mute **{}**!", "no_permission_unmute": "You do not have permission to unmute **{}**!", "user_muted": "Successfully muted **{}** for **{}**", "unable_to_unban": "Unable to unban **{}**", "bot_error": "Bot Error", "unable_to_unmute": "Unable to unmute **{}**", "user_unmuted": "**{}** has been successfully unmuted", "cannot_warn_self": "You cannot warn yourself!", "cannot_warn_bot": "You cannot warn a bot!", "cannot_warn_administrator": "You cannot warn an administrator!", "no_permission_warn": "You do not have permission to warn **{}**!", "warning": "Warning", "warning_lower": "warning", "warnings_lower": "warnings", "warning_count": "You now have {0} {1} in {2}", "user_warned": "Successfully warned **{}** (**{}**)", "unable_to_warn": "Unable to warn **{}**", "warnings_reset": "**{}**'s warnings have been successfully reset", "not_specified": "Not specified", "generate_number_limit": "You have generated **5 numbers** already. Please re-run the command to continue.", "expression": "Expression", "result": "Result", "unknown_answer": "Unknown Answer", "second": "second", "seconds": "seconds", "minute": "minute", "minutes": "minutes", "hour": "hours", "hours": "hours", "day": "day", "days": "days", "month": "months", "months": "months", "year": "year", "years": "years", "suggestion_sent": "Your suggestion has been successfully sent", "sending_suggestion": "Sending your suggestion...", "not_bot_owner": "You are not the owner of Doge Utilities!", "infinity": "infinity", "no_negative_numbers": "No negative numbers please!", "duration_too_long": "The specified duration is too long!", "current_language_description": "Your preferred language is set to **{}**", "border_size_too_big": "The border size must not exceed 32!", "qr_code": "QR Code", "qr_create_failed": "Unable to create a QR code", "correct_answer": "Correct answer!", "wrong_answer": "Wrong answer... The correct answer was **{}**.", "unable_to_clear": "Unable to clear messages", "max_clear_messages": "You can only clear up to **1000 messages**!", "cleared": "Successfully deleted **{} {}**", "cleared_from": "Successfully deleted **{} {}** from **{}**", "cleared_contains": 'Successfully deleted **{} {}** that contained **"{}"**', "cleared_from_contains": 'Successfully deleted **{} {}** from **{}** that contained **"{}"**', "message_lower": "message", "messages_lower": "messages", "bot_error_report": "Doge Utilities error report", "joined_game": "Successfully joined the game!", "already_joined": "You have already joined the game!", "player_one": "Player 1", "player_two": "Player 2", "game_starts_in_three": "The game starts in **3 seconds**!", "join_tictactoe": "Click to join the TicTacToe game", "afk_removed": "Your AFK status has been removed!", "afk_set": "Your AFK message has been set to **\"{}\"**", "currently_afk": "**{}** is currently AFK ({}): **{}**", "already_afk": "You are already AFK!", "mentioned_user": "The user you mentioned", "i_am_afk": "I am AFK", "text_too_long": "The specified text is too long!", "item_limit": "You can only add up to **{} items**!", "channel_locked": "{} has been successfully locked", "channel_unlocked": "{} has been successfully unlocked", "unable_to_lock": "I am unable to lock {}", "unable_to_unlock": "I am unable to unlock {}", "wrong_turn": "It is not your turn!", "not_in_game": "You did not join that game!", "bot_status": "Bot Status", "minecraft_server": "Minecraft Server", "players": "Players", "unknown_upper": "Unknown", "unable_to_connect": "Unable to connect", "nothing_here": "There is nothing here...", "custom_embed_generated": "Your custom embed has been successfully generated!", "no_permission_manage_role": "You do not have permission to manage this role!", "enter_valid_message_id": "Please enter a valid message ID (that exists in this channel)", "unable_to_add_emoji": "I am unable to add an emoji to that message!", "reaction_role_created": "A new reaction role has been successfully created!", "reaction_roles": "Reaction Roles", "no_reaction_roles": "There are no reaction roles in this server", "currency_list": "Currency List", "invite_link": "Invite Link", "leave_server": "Leave Server", "leave_server_confirm": "Are you sure you want me to leave this server? Please press the button again to confirm.", "leaving_server": "Leaving server...", "here_is_invite_link": "Here is Doge Utilities' invite link", "source_code": "Source Code", "developers": "Developers", "ideas": "Ideas", "translators": "Translators", "big_thanks_to": "Big thanks to {}, and a lot more awesome people!", "currency_conversion": "Currency Conversion", "source_code_here": "You can find my code [here]({})", }, "zh-cn": { "no_permission": "你没有权限使用这个指令!", "not_command_sender": "这个指令不是你发的!", "vote_message": "谢谢你给我投票!", "banned_message": "你已被禁止使用Doge Utilities!", "error_message": "很抱歉, Doge Utilities出错了。。。", "use_in_server": "请你在服务器里使用Doge Utilities!", "no_reminders": "你没有提醒", "reminders": "提醒", "reminder": "提醒", "time": "时间", "text": "文字", "vote_again": "不要忘记给我投票!", "todo_list": "待办事列表", "todo_empty": "你的待办事列表是空的", "generate_number": "生成数字", "number_prompt": "你的随机数字是", "cpu_usage": "CPU使用率", "ram_usage": "RAM使用率", "thread_count": "机器人程序数", "joined_guilds": "机器人服务器", "active_shards": "机器人碎片", "member_count": "用户数", "channel_count": "频道数", "command_count": "指令数", "disnake_version": "Disnake版本", "bot_version": "机器人版本", "bot_uptime": "运行时间", "latency": "延迟", "shard": "碎片", "members_lower": "用户", "guilds_lower": "服务器", "i_choose": "我选择", "shard_count": "碎片数", "current_shard": "当前碎片", "reminder_removed": "那个提醒已被成功移除", "reminder_added": "你会在**{}**后被提醒", "support_server": "我的服务器", "user_accounts": "用户账号", "bot_accounts": "机器人账号", "total_members": "全部账号", "guild_members": "服务器成员", "todo_added": '我成功的把 **"{}"** 加到了你的待办事列表', "todo_removed": '我成功的把你待办事列表里的 **"{}"** 移除了', "uptime_description": "我已经运行了", "current_time": "时间", "current_date": "日期", "weekday": "星期", "time_description": "关于", "weekdays": ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期天"], "vote_websites": "你可以在这些网站上给我投票", "vote_reminder_added": "我成功的给你加了一个**12小时的提醒**!", "vote_reminder_exists": "你已经有了一个提醒!", "vote_add_reminder": "加一个提醒", "vote_messages_enabled": "投票通知已被成功**打开**", "vote_messages_disabled": "投票通知已被成功**关闭**", "enabled_lower": "打开", "disabled_lower": "关闭", "vote_messages_status": "投票消息现在属于**{}**状态", "language_update": "你的语言已被换成**{}**", "language_name": "中文", "website_links": "这我是我的网站的链接", "website": "网站", "dashboard": "控制板", "user_kicked": "**{}**已被**成功剔除**", "user_banned": "**{}**已被**成功封锁**", "unable_to_kick": "我无法剔除**{}**", "unable_to_ban": "我无法封锁**{}**", "mention_valid_user": "请@一个服务器成员!", "user_id": "用户ID", "user_tag": "账号", "creation_time": "创造时间", "public_flags": "属性", "bot_user": "机器人用户", "system_user": "系统用户", "command_cooldown": "指令冷却", "command_cooldown_description": "请在**{}**后使用`{}`", "invalid_duration": "请输入一个正确的时间!", "no_permission_kick": "你没有权限剔除**{}**!", "no_permission_ban": "你没有权限封锁**{}**!", "unable_to_mute": "我无法禁言**{}**", "no_permission_mute": "你没有权限禁言**{}**!", "no_permission_unmute": "你没有权限解**{}**的禁言!", "user_muted": "我成功禁言了**{}** (**{}**)", "unable_to_unban": "我无法解除**{}**的封锁", "bot_error": "机器人错误", "unable_to_unmute": "我无法解**{}**的禁言", "user_unmuted": "**{}**的禁言已被成功解除", "cannot_warn_self": "你不能警告你自己!", "cannot_warn_bot": "你不能警告一个机器人!", "cannot_warn_administrator": "你不能警告一个管理员!", "no_permission_warn": "你没有权限警告**{}**!", "warning": "警告", "warning_lower": "警告", "warnings_lower": "警告", "warning_count": "你在{2}有{0}个{1}", "user_warned": "成功的警告了**{}** (**{}**)", "unable_to_warn": "我无法警告**{}**", "warnings_reset": "**{}**的警告已被成功清除", "not_specified": "无原因", "generate_number_limit": "你已经生成了**五个数字**。如果你想继续, 请重新运行指令。", "expression": "数学题", "result": "结果", "unknown_answer": "未知答案", "second": "秒", "seconds": "秒", "minute": "分钟", "minutes": "分钟", "hour": "小时", "hours": "小时", "day": "天", "days": "天", "month": "月", "months": "月", "year": "年", "years": "年", "suggestion_sent": "你的建议已被成功发送", "sending_suggestion": "正在发送你的建议。。。", "not_bot_owner": "你不是Doge Utilities的主人!", "infinity": "无数", "no_negative_numbers": "请不要输入负数!", "duration_too_long": "你提供的时间太长了!", "current_language_description": "你的显示语言是**{}**", "border_size_too_big": "边框大小不能超过32!", "qr_code": "QR码", "qr_create_failed": "我无法生成二维码", "correct_answer": "你答对了!", "wrong_answer": "你答错了。。。真确答案是**{}**。", "unable_to_clear": "我无法清除消息", "max_clear_messages": "你最多只能清除**1000个消息**!", "cleared": "我成功清除了**{}个{}**", "cleared_from": "我成功清除了来自**{2}**的**{0}个{1}**", "cleared_contains": '我成功清除了含有**"{2}"**的**{0}个{1}**', "cleared_from_contains": '我成功清除了来自**{2}**含有**"{3}"**的**{0}个{1}**', "message_lower": "消息", "messages_lower": "消息", "bot_error_report": "Doge Utilities错误报告", "joined_game": "成功加入了游戏!", "already_joined": "你已经加入了游戏!", "player_one": "玩家1", "player_two": "玩家2", "game_starts_in_three": "游戏会在**3秒**后开始!", "join_tictactoe": "点击按钮加入TicTacToe游戏", "afk_removed": "你的AFK已被移除!", "afk_set": "你的AFK消息已被设成**\"{}\"**", "currently_afk": "**{}**现在是AFK ({}): **{}**", "already_afk": "你已经是AFK!", "mentioned_user": "你@的用户", "i_am_afk": "我不在", "text_too_long": "你提供的字太长了!", "item_limit": "你只能加**{}个**物品!", "channel_locked": "{} 已被成功锁定", "channel_unlocked": "{} 已被成功解锁", "unable_to_lock": "我无法锁定 {}", "unable_to_unlock": "我无法解锁 {}", "wrong_turn": "这不是你玩的时候!", "not_in_game": "你没有加入那个游戏!", "bot_status": "机器人状态", "minecraft_server": "我的世界服务器", "players": "玩家", "unknown_upper": "未知", "unable_to_connect": "无法连接", "nothing_here": "这里没东西。。。", "custom_embed_generated": "你的嵌入已被成功生成!", "no_permission_manage_role": "你没有权限管理这个身份组!", "enter_valid_message_id": "请输入一个在这个频道里存在的消息ID!", "unable_to_add_emoji": "我无法在那个消息上加emoji!", "reaction_role_created": "我成功的创造了一个新的反应身分组!", "reaction_roles": "反应身分组", "no_reaction_roles": "这个服务器没有反应身分组", "currency_list": "货币列表", "invite_link": "邀请链接", "leave_server": "退出服务器", "leave_server_confirm": "你确定你要让我退出这个服务器吗? 如果你真的要让我退出, 请再按一次按钮。", "leaving_server": "正在退出服务器。。。", "here_is_invite_link": "这是我的邀请链接", "source_code": "源代码", "developers": "开发者", "ideas": "主意", "translators": "翻译", "big_thanks_to": "很感谢 {}, 和很多其他人!", "currency_conversion": "货币转换", "source_code_here": "你可以在[这里]({})找到我的源代码", }, "de": { "no_permission": "Du hast keine Berechtigung diesen Befehl zu benutzen!", "not_command_sender": "Du hast den Befehl nicht benutzt!", "vote_message": "Danke dass du Doge Utilities Bewertet hast!", "banned_message": "Du bist von Doge Utilities gesperrt", "error_message": "Ups! Doge Utilities hatte einen Fehler...", "shard": "Shard", "latency": "Latenz", "time": "Wann", "text": "Text", "reminder": "Erinnerung", "reminders": "Erinnerungen", "cpu_usage": "CPU Auslastung", "ram_usage": "RAM Auslastung", "thread_count": "Anzahl der Threads", "joined_guilds": "Servern beigetreten", "active_shards": "Aktive Shards", "member_count": "Anzahl der Mitglieder", "channel_count": "Anzahl der Kanäle", "command_count": "Anzahl der Commands", "disnake_version": "Disnake Version", "bot_version": "Bot Version", "bot_uptime": "Bot online seit", "i_choose": "Ich wähle", "members_lower": "Mitglieder", "guilds_lower": "Server", "current_shard": "Aktueller Shard", "shard_count": "Shards", "use_in_server": "Bitte nutze Doge Utilities in einem Server für das bestmögliche Ergebnis!", "no_reminders": "Du hast keine aktiven Erinnerungen", "vote_again": "Vergiss nicht für mich zu voten!", "todo_list": "To-do Liste", "todo_empty": "Deine To-do Liste ist leer", "generate_number": "Generiere eine Nummer", "number_prompt": "Deine generierte Nummer ist", "reminder_removed": "Diese Erinnerung wurde erfolgreich entfernt", "reminder_added": "Du wirst erinnert in **{}**", "minute": "Minute", "minutes": "Minuten", "support_server": "Doge Utilities Support Server", "user_accounts": "Nutzer Accounts", "bot_accounts": "Bot Accounts", "total_members": "Alle Mitglieder", "guild_members": "Server Mitglieder", "todo_added": '**"{}"** wurde erfolgreich zur To-do Liste hinzugefügt', "todo_removed": '**"{}"** wurde erfolgreich aus der To-do Liste entfernt', "uptime_description": "Doge Utilities ist online seit", "current_time": "Uhrzeit", "current_date": "Datum", "weekday": "Wochentag", "time_description": "Informationen für", "weekdays": ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"], "vote_websites": "Du kannst für mich auf folgenden Websites voten", "vote_reminder_added": "Eine **12 Stunden Erinnerung** wurde erfolgreich hinzugefügt!", "vote_reminder_exists": "Es gibt bereits eine Erinnerung!", "vote_add_reminder": "Füge eine Erinnerung hinzu", "vote_messages_enabled": "Vote Benachrichtigungen wurden erfolgreich **aktiviert**", "vote_messages_disabled": "Vote Benachrichtigungen wurden erfolgreich **deaktiviert**", "enabled_lower": "aktiviert", "disabled_lower": "deaktiviert", "vote_messages_status": "Vote Benachrichtigungen sind derzeit **{}**", "language_update": "Deine Sprache wurde auf **{}** gesetzt", "language_name": "deutsch", "website_links": "Hier sind Links für meine Website", "website": "Website", "dashboard": "Dashboard", "user_kicked": "**{}** wurde erfolgreich gekickt", "user_banned": "**{}** wurde erfolgreich gebannt", "unable_to_kick": "**{}** Kicken nicht möglich", "unable_to_ban": "**{}** bannen nicht möglich", "mention_valid_user": "Bitte erwähne einen gültigen Nutzer", "user_id": "Nutzer ID", "user_tag": "Tag", "creation_time": "Zeitpunkt der Erstellung", "public_flags": "Public Flags", "bot_user": "Bot Nutzer", "system_user": "System Nutzer", "command_cooldown": "Command cool-down", "invalid_duration": "Bitte gib einen gültigen Zeitraum an", "no_permission_kick": "Du hast keine Berechtigungen um **{}** zu kicken", "no_permission_ban": "Du hast keine Berechtigungen **{}** zu bannen", "unable_to_mute": "**{}** nuten nicht möglich", "no_permission_mute": "Du hast keine Berechtigungen **{}** zu muten", "no_permission_unmute": "Du hast keine Berechtigungen **{}** zu unmuten", "user_muted_permanently": "**{}** wurde erfolgreich permanent gemuted", "user_muted_temporarily": "**{}** wurde erfolgreich für **{}** gemuted", "unable_to_unban": "**{}** bannen nicht möglich", "bot_error": "Bot Fehler", "unable_to_unmute": "**{}** unmuten nicht möglich", "user_unmuted": "**{}** erfolgreich unmuted", "cannot_warn_self": "Du kannst dich nicht selbst verwarnen!", "cannot_warn_bot": "Du kannst keinen Bot verwarnen!", "cannot_warn_administrator": "Du kannst keine Administratoren warnen!", "no_permission_warn": "Du hast keine Berechtigungen **{}** zu warnen!", "warning": "Warnung", "warning_lower": "Warnung", "warnings_lower": "Warnungen", "warning_count": "Du hast jetzt {0} {1} in {2}", "user_warned": "**{}** wurde erfolgreich gewarnt. (**{}**)", "unable_to_warn": "**{}** warnen nicht möglich", "warnings_reset": "Die Warnungen von **{}** wurden erfolgreich zurückgesetzt", "not_specified": "Nicht angegeben", "command_cooldown_description": "Bitte warte **{}** befor du den `{}` Befehl wieder benutzen kannst", "generate_number_limit": "Du hast bereits 5 Zahlen generiert. Bitte führe den Befehl erneut aus, um weiterzumachen.", "expression": "Rechnung", "result": "Ergebnis", "unknown_answer": "Unbekannte Antwort", "second": "Sekunde", "seconds": "Sekunden", "hour": "Stunde", "hours": "Stunden", "day": "Tag", "days": "Tage", "month": "Monat", "months": "Monate", "year": "Jahr", "years": "Jahre", "suggestion_sent": "Dein Vorschlag wurde erfolgreich abgesendet", "sending_suggestion": "Dein Vorschlag wird abgeschickt...", "not_bot_owner": "Du bist nicht der Besitzer von Doge Utilities!", "infinity": "Unendlich", "no_negative_numbers": "Bitte keine negativen Zahlen!", "duration_too_long": "Die angegebene Dauer ist zu lang!", "current_language_description": "Deine bevorzugte Sprache wurde zu **{}** geändert", "border_size_too_big": "Die länge der Randes darf 32 nicht überschreiten!", "qr_code": "QR Code", "qr_create_failed": "Erstellen des QR Codes ist nicht möglich", "correct_answer": "Richtige Antwort!", "wrong_answer": "Falsche Antwort... die richtige Antwort war **{}**", "unable_to_clear": "Löschen der Nachrichten nicht möglich", "max_clear_messages": "Du kannst maximal **1000 Nachrichten** löschen", "cleared": "Erfolgreich **{} {}** gelöscht", "cleared_from": "Erfolgreich **{} {}** von **{}** gelöscht", "cleared_contains": "Erfolgreich **{} {}** gelöscht, mit dem Inhalt **{}**", "cleared_from_contains": "Erfolgreich **{} {}** von **{}** gelöscht, mit dem Inhalt **{}**", "message_lower": "Nachricht", "messages_lower": "Nachrichten", "bot_error_report": "Doge Utilities Error Report", "joined_game": "Dem Spiel erfolgreich beigetreten!", "already_joined": "Du bist dem Spiel bereits beigetreten!", "player_one": "Spieler 1", "player_two": "Spieler 2", "game_starts_in_three": "Das Spiel startet in **3 Sekunden**!", "join_tictactoe": "Klicke, um der TicTacToe Partie beizutreten", "afk_removed": "Dein AFK wurde entfernt!", "afk_set": "Deine AFK Nachricht wurde auf **\"{}\"** gesetzt", "currently_afk": "**{}** ist im Moment AFK ({}): **{}**", "already_afk": "Du bist bereits AFK!", "mentioned_user": "Der Nutzer, den du erwähnt hast", "i_am_afk": "Ich bin AFK", "text_too_long": "Der angegebene Text ist zu lang!", "item_limit": "Du kannst maximal **{} Elemente** hinzufügen!", "channel_locked": "{} wurde erfolgreich gesperrt", "channel_unlocked": "{} wurde erfolgreich entsperrt", "unable_to_lock": "Ich kann {} nicht sperren", "unable_to_unlock": "Ich kann {} nicht entsperren", "wrong_turn": "Du bist nicht an der Reihe!", "not_in_game": "Du bist diesem Spiel nicht beigetreten!", "bot_status": "Bot Status", }, "ru": { "no_permission": "У вас нет разрешений на использование этой команды!", "not_command_sender": "Вы не являетесь отправителем данной команды!", "vote_message": "Спасибо за то, что вы проголосовали за меня!", "banned_message": "Вам запретили использовать Doge Utilities!", "error_message": "Упс... Doge Utilities столкнулся с ошибкой...", "use_in_server": "Пожалуйста, используйте Doge Utilities на сервере для лучшего опыта!", "no_reminders": "У вас нет активных напоминаний", "reminders": "Напоминания", "time": "Время", "text": "Текст", "todo_list": "Список дел", "support_server": "Сервер поддержки Doge Utilities", "vote_again": "Не забывай голосовать за меня!", "todo_empty": "Ваш список дел пустой", "generate_number": "Сгенерировать число", "number_prompt": "Ваше случайное число", "cpu_usage": "Использование CPU", "ram_usage": "Использование RAM", "thread_count": "Количество треадов", "active_shards": "Активные шарды", "member_count": "Количество участников", "channel_count": "Количество каналов", "command_count": "Количество команд", "disnake_version": "Версия Disnake", "bot_version": "Версия бота", "bot_uptime": "Время работы", "shard": "Шард", "members_lower": "участники", "guilds_lower": "гильдии", "i_choose": "Я выбрал", "shard_count": "Количество шардов", "current_shard": "Текущий шард", "reminder_removed": "Это напоминание было успешно удалено", "reminder_added": "Вам напомнят в **{}**", "minute": "минута", "minutes": "минуты", "latency": "Задержка", "joined_guilds": "Гильдий", "uptime_description": "Doge Utilities работает", "reminder": "Напоминание", "user_accounts": "Учетные записи пользователей", "bot_accounts": "Аккаунты ботов", "total_members": "Всего участников", "guild_members": "Участники гильдии", "todo_added": '**"{}"** был успешно добавлен к вашему списку дел', "todo_removed": '**"{}"** {} был успешно удален с вашего списка дел', "current_time": "Время", "current_date": "Дата", "weekday": "День недели", "time_description": "Информация для", "weekdays": ["Понедельник", "вторник", "среда", "четверг", "пятница", "суббота", "воскресенье"], "vote_websites": "Вы можете проголосовать за меня на этих вебсайтах", "vote_reminder_added": "**12 часовое напоминание** было успешно добавлено!", "vote_reminder_exists": "Напоминание уже существует!", "vote_add_reminder": "Добавить напоминание", "vote_messages_enabled": "Сообщения голосования успешно **включены**", "vote_messages_disabled": "Сообщения голосования успешно **отключены**", "enabled_lower": "включены", "disabled_lower": "отключены", "vote_messages_status": "Сообщения о голосовании в настоящее время **{}**", "language_update": "Ваш основной язык установлен на **{}**", "language_name": "русский", "website_links": "Вот ссылка на мой вебсайт", "website": "Вебсайт", "dashboard": "Панель управления", "user_kicked": "**{}** успешно кикнут", "user_banned": "**{}** успешно забанен", "unable_to_kick": "Невозможно кикнуть **{}**", "unable_to_ban": "Невозможно забанить **{}**", "mention_valid_user": "Пожалуйста, укажите правильного пользователь", "user_id": "Айди", "user_tag": "Тег", "creation_time": "Дата создания", "public_flags": "Публичные флаги", "bot_user": "Боты", "system_user": "Системный пользователь", "command_cooldown": "Задержка команды", "invalid_duration": "Пожалуйста, укажите правильную задержу", "no_permission_kick": "Вы не имеете права кикнуть **{}**", "no_permission_ban": "Вы не имеете права забанить **{}**", "unable_to_mute": "Невозможно замьютить **{}**", "no_permission_mute": "Вы не имеете право замьютить **{}**", "no_permission_unmute": "Вы не имеете права замьютить **{}**", "user_muted_permanently": "**{}** был успешно замьючен навсегда", "user_muted_temporarily": "**{}** был успешно замьютен на **{}**", "unable_to_unban": "Невозможно разбанить **{}**", "bot_error": "Ошибка бота", "unable_to_unmute": "Невозможно размьютить **{}**", "user_unmuted": "**{}** успешно размьючен", "cannot_warn_self": "Вы не можете дать предупреждение самому себе!", "cannot_warn_bot": "Вы не можете дать предупреждение боту!", "cannot_warn_administrator": "Вы не можете дать предупреждение администатору!", "no_permission_warn": "Вы не имеете права дать предупреждение **{}**!", "warning": "Предупреждение", "warning_lower": "предупреждение", "warnings_lower": "предупреждения", "warning_count": "Теперь у вас есть {0} {1} в {2}", "user_warned": "**{}** успешно предупреждён (**{}**)", "unable_to_warn": "Невозможно дать предупреждение **{}**", "warnings_reset": "Предупреждения **{}** было успешно сняты", "not_specified": "Не указано", }, "sk": { "no_permission": "Nemáš oprávnenie na použitie tohto príkazu!", "not_command_sender": "Nie si odosielateľom toho príkazu!", "vote_message": "Ďakujeme Ti za hlasovanie za Doge Utilities!", "banned_message": "Máš zakázané používať Doge Utilities!", "error_message": "Ups! Doge Utilities narazil na chybu...", "use_in_server": "Prosím, používaj Doge Utilities na serveri pre najlepší dojem!", "no_reminders": "Nemáš žiadne aktívne pripomienky", "reminders": "Pripomienky", "reminder": "Pripomienka", "time": "Čas", "text": "Text", "vote_again": "Nezabudni za mňa zahlasovať!", "todo_list": "Zoznam úloh", "todo_empty": "Tvoj zoznam úloh je prázdny", "generate_number": "Vygeneruj Číslo", "number_prompt": "Tvoje náhodné číslo je", "cpu_usage": "Využitie procesora", "ram_usage": "Využitie pamäte RAM", "thread_count": "Počet vlákien", "joined_guilds": "Pripojených serverov", "active_shards": "Aktívnych inštancií", "member_count": "Počet používateľov", "channel_count": "Počet kanálov", "command_count": "Počet príkazov", "disnake_version": "Verzia Disnake", "bot_version": "Verzia Bot-a", "bot_uptime": "Čas prevádzky", "latency": "Odozva", "shard": "inštancia", "members_lower": "používateľov", "guilds_lower": "serverov", "i_choose": "Ja si vyberám", "shard_count": "Počet inštancií", "current_shard": "Aktuálna inštancia", "reminder_removed": "Daná pripomienka bola úspešne odstránená", "reminder_added": "Pripomenutie bude uskutočnené za **{}**", "minute": "minúta", "minutes": "minúty", "support_server": "Server podpory Doge Utilities", "user_accounts": "Účty používateľov", "bot_accounts": "Účty bot-ov", "total_members": "Celkovo používateľov", "guild_members": "Používatelia servera", "todo_added": "Úspešne pridané **{}** do tvojho zoznamu úloh", "todo_removed": "Z tvojho zoznamu úloh bolo úspešne odstránené **{}**", "uptime_description": "Doge Utilities je v prevádzke", "current_time": "Čas", "current_date": "Dátum", "weekday": "Pracovný deň", "time_description": "Informácia pre", "weekdays": ['Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota', 'Nedeľa'], "vote_websites": "Hlasovať za mňa môžeš na týchto stránkach", "vote_reminder_added": "12 hodinová pripomienka bola úspešne pridaná!", "vote_reminder_exists": "Pripomienka už existuje!", "vote_add_reminder": "Pridať pripomienku", "vote_messages_enabled": "Správy na hlasovanie boli úspešne zapnuté", "vote_messages_disabled": "Správy na hlasovanie boli úspešne vypnuté", "enabled_lower": "zapnuté", "disabled_lower": "vypnuté", "vote_messages_status": "Správy na hlasovanie sú momentálne **{}**", "language_update": "Tvoj preferovaný jazyk bol nastavený na **{}**", "language_name": "Angličtina", "website_links": "Tu sú odkazy na moje web stránky", "website": "Webová stránka", "dashboard": "Nástenka", "user_kicked": "**{}** bol úspešne vyhodený", "user_banned": "**{}** bol úspešne zablokovaný", "unable_to_kick": "Nie som schopný vyhodiť **{}**", "unable_to_ban": "Nie som schopný zablokovať **{}**", "mention_valid_user": "Prosím, označ platného používateľa!", "user_id": "Používateľské ID", "user_tag": "Označenie", "creation_time": "Čas vytvorenia", "public_flags": "Verejné vlajky", "bot_user": "Účet bot-a", "system_user": "Systémový používateľ", "command_cooldown": "Presiahnutá rýchlosť posielania príkazov", "invalid_duration": "Prosím zadaj platnú dĺžku!", "no_permission_kick": "Nemáš oprávnenie vyhodiť **{}**!", "no_permission_ban": "Nemáš oprávnenie zablokovať **{}**!", "unable_to_mute": "Nie som schopný stlmiť **{}**", "no_permission_mute": "Nemáš oprávnenie stlmiť **{}**!", "no_permission_unmute": "Nemáš oprávnenie zrušiť stlmenie **{}**!", "user_muted_permanently": "**{}** bol úspešne stlmený navždy", "user_muted_temporarily": "**{}** bol stlmený na **{}**", "unable_to_unban": "Nie som schopný odblokovať **{}**", "bot_error": "Chyba bot-a", "unable_to_unmute": "Nie som schopný zrušiť stlmenie **{}**", "user_unmuted": "Úspešne zrušené stlmenie používateľa **{}**", "cannot_warn_self": "Nemôžeš varovať sám seba!", "cannot_warn_bot": "Nemôžeš varovať bot-a!", "cannot_warn_administrator": "Nemôžeš varovať administrátora!", "no_permission_warn": "Nemáš oprávnenie varovať **{}**!", "warning": "Varovanie", "warning_lower": "varovanie", "warnings_lower": "varovania", "warning_count": "Teraz máš {0} {1} v {2}", "user_warned": "Používateľ **{}** bol úspešne varovaný za (**{}**)", "unable_to_warn": "Nie som schopný varovať **{}**", "warnings_reset": "Varovania používateľa **{}** boli resetované", "not_specified": "Nešpecifikované", "command_cooldown_description": "Prosím počkaj **{}** pred opakovaným použitím príkazu `{}`", "generate_number_limit": "Už si vygeneroval 5 náhodných čísel. Ak chceš generovať ďalšie náhodné čísla, spusti znovu príkaz.", "expression": "Výraz", "result": "Výsledok", "unknown_answer": "Neznáma odpoveď", "second": "sekunda", "seconds": "sekundy", "hour": "hodina", "hours": "hodiny", "day": "deň", "days": "dni", "month": "mesiac", "months": "mesiace", "year": "rok", "years": "roky", "suggestion_sent": "Tvoj nápad bol úspešne zaznamenaný", "sending_suggestion": "Odosielam tvoj nápad...", "not_bot_owner": "Nie si majiteľom Doge Utilities!", "infinity": "nekonečno", "no_negative_numbers": "Nepoužívajte prosím záporné čísla!", "duration_too_long": "Daná časová dĺžka je príliš dlhá!", "current_language_description": "Tvoj preferovaný jazyk bol nastavený na **{}**", "border_size_too_big": "Veľkosť hranice nesmie presiahnuť 32!", "qr_code": "QR kód", "qr_create_failed": "Nebolo možné vytvoriť QR kód", "correct_answer": "Správna odpoveď!", "wrong_answer": "Nesprávne... Správna odpoveď bola **{}**.", "unable_to_clear": "Nebolo možné vymazať správy", "max_clear_messages": "Môžeš vymazať maximálne 1000 správ!", "cleared": "Úspešne vymazaných **{} {}**", "cleared_from": "Úspešne vymazaných **{} {}** z **{}**", "cleared_contains": "Úspešne vymazaných **{} {}**, ktoré obsahovali **{}**", "cleared_from_contains": "Úspešne vymazaných **{} {}** od **{}**, ktoré obsahovali **{}**", "message_lower": "správa", "messages_lower": "správy", "bot_error_report": "Chybové hlásenie Doge Utilities", "joined_game": "Úspešné pripojenie k hre!", "already_joined": "Už si pripojený k hre!", "player_one": "Hráč 1", "player_two": "Hráč 2", "game_starts_in_three": "Hra začína za 3 sekundy!", "join_tictactoe": "Klikni pre pripojenie ku hre piškôriek", "afk_removed": "Tvoj AFK bol odstránený!", "afk_set": "Tvoja AFK správa bola nastavená na **\"{}\"**", "currently_afk": "**{}** je momentálne AFK ({}): **{}**", "already_afk": "Už si AFK!", "mentioned_user": "Používateľ, ktorého si spomenul/a", "i_am_afk": "Som AFK", "text_too_long": "Daný text je príliš dlhý!", "item_limit": "Môžeš pridať maximálne **{}** vecí!", "channel_locked": "{} bol úspešne uzamknutý", "channel_unlocked": "{} bol úspešne odomknutý", "unable_to_lock": "Nie som schopný zamknúť {}", "unable_to_unlock": "Nie sok schopný odomknúť {}", }, } data["zh-tw"] = data["zh-cn"] def get(language, key): language = language.lower() key = key.lower() if language not in data.keys(): language = "en" language_data = data[language] if key not in language_data: language_data = data["en"] if key not in language_data: return "?" else: return language_data[key] else: return language_data[key]
class Student: studentLevel = 'first year computer science 2020/2021 session' studentCounter = 0 def __init__(self, thename, thematricno, thesex, thehostelname , theage,thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex self.hostelname = thehostelname self.age = theage self.csc102examscore = thecsc102examscore Student.studentCounter = Student.studentCounter registeredCourse = 'CSC102' @classmethod def registeredcourse(cls): print("registerd course is {Student.registeredCourse}") def function(self): if self.age > 16: return "yes, he is older than 16" else: return "no he is not older than 16" def getName(self): return self.name def setName(self, thenewName): self.name = thenewName @staticmethod def PAUNanthem(): print('Pau, here we come, Pau, here we come ') studendt1 = Student('James Kaka', '021074', 'M','cooperative mall',15,98) print(studendt1.getName()) studendt1.setName('James Gaga') print(studendt1.getName()) print(studendt1.function()) Student.registeredCourse() Student.PAUNanthem()
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 19:32:39 2020 @author: abcdk """ # 5 Data types # Int, Float, Boolean, String, Null
# success values # sql.h SQL_INVALID_HANDLE = -2 SQL_ERROR = -1 SQL_SUCCESS = 0 SQL_SUCCESS_WITH_INFO = 1 SQL_STILL_EXECUTING = 2 SQL_NEED_DATA = 99 SQL_NO_DATA_FOUND = 100 sql_errors = [SQL_ERROR, SQL_INVALID_HANDLE] # sqlext.h SQL_FETCH_NEXT = 0x01 SQL_FETCH_FIRST = 0x02 SQL_FETCH_LAST = 0x04 SQL_FETCH_PRIOR = 0x08 SQL_FETCH_ABSOLUTE = 0x10 SQL_FETCH_RELATIVE = 0x20 SQL_FETCH_RESUME = 0x40 SQL_FETCH_BOOKMARK = 0x80 # sql types SQL_TYPE_NULL = 0 SQL_CHAR = 1 SQL_NUMERIC = 2 SQL_DECIMAL = 3 SQL_INTEGER = 4 SQL_SMALLINT = 5 SQL_FLOAT = 6 SQL_REAL = 7 SQL_DOUBLE = 8 SQL_DATE = 9 SQL_TIME = 10 SQL_TIMESTAMP = 11 SQL_VARCHAR = 12 # SQL extended datatypes SQL_LONGVARCHAR = -1 SQL_BINARY = -2 SQL_VARBINARY = -3 SQL_LONGVARBINARY = -4 SQL_BIGINT = -5 SQL_TINYINT = -6 SQL_BIT = -7 SQL_INTERVAL_YEAR = -80 SQL_INTERVAL_MONTH = -81 SQL_INTERVAL_YEAR_TO_MONTH = -82 SQL_INTERVAL_DAY = -83 SQL_INTERVAL_HOUR = -84 SQL_INTERVAL_MINUTE = -85 SQL_INTERVAL_SECOND = -86 SQL_INTERVAL_DAY_TO_HOUR = -87 SQL_INTERVAL_DAY_TO_MINUTE = -88 SQL_INTERVAL_DAY_TO_SECOND = -89 SQL_INTERVAL_HOUR_TO_MINUTE = -90 SQL_INTERVAL_HOUR_TO_SECOND = -91 SQL_INTERVAL_MINUTE_TO_SECOND = -92 SQL_UNICODE = -95 SQL_UNICODE_VARCHAR = -96 SQL_UNICODE_LONGVARCHAR = -97 SQL_UNICODE_CHAR = SQL_UNICODE SQL_TYPE_DRIVER_START = SQL_INTERVAL_YEAR SQL_TYPE_DRIVER_END = SQL_UNICODE_LONGVARCHAR SQL_SIGNED_OFFSET = -20 SQL_UNSIGNED_OFFSET = -22 # Special length values (don't work yet) SQL_NULL_DATA = -1 SQL_DATA_AT_EXEC = -2 SQL_NTS = -3 # SQLGetInfo type types STRING = 's' INT16 = 'h' INT32 = 'l' # C datatype to SQL datatype mapping SQL types SQL_C_CHAR = SQL_CHAR # CHAR, VARCHAR, DECIMAL, NUMERIC SQL_C_LONG = SQL_INTEGER # INTEGER SQL_C_SHORT = SQL_SMALLINT # SMALLINT SQL_C_FLOAT = SQL_REAL # REAL SQL_C_DOUBLE = SQL_DOUBLE # FLOAT, DOUBLE SQL_C_DEFAULT = 99 # SQL_C_DATE = SQL_DATE SQL_C_TIME = SQL_TIME SQL_C_TIMESTAMP = SQL_TIMESTAMP SQL_C_BINARY = SQL_BINARY SQL_C_BIT = SQL_BIT SQL_C_TINYINT = SQL_TINYINT SQL_C_SLONG = SQL_C_LONG+SQL_SIGNED_OFFSET # SIGNED INTEGER SQL_C_SSHORT = SQL_C_SHORT+SQL_SIGNED_OFFSET # SIGNED SMALLINT SQL_C_STINYINT = SQL_TINYINT+SQL_SIGNED_OFFSET # SIGNED TINYINT SQL_C_ULONG = SQL_C_LONG+SQL_UNSIGNED_OFFSET # UNSIGNED INTEGER SQL_C_USHORT = SQL_C_SHORT+SQL_UNSIGNED_OFFSET # UNSIGNED SMALLINT SQL_C_UTINYINT = SQL_TINYINT+SQL_UNSIGNED_OFFSET # UNSIGNED TINYINT SQL_C_BOOKMARK = SQL_C_ULONG # BOOKMARK # from "sql.h" # Defines for SQLGetInfo SQL_ACTIVE_CONNECTIONS = 0, INT16 SQL_ACTIVE_STATEMENTS = 1, INT16 SQL_DATA_SOURCE_NAME = 2, STRING SQL_DRIVER_HDBC = 3, INT32 SQL_DRIVER_HENV = 4, INT32 SQL_DRIVER_HSTMT = 5, INT32 SQL_DRIVER_NAME = 6, STRING SQL_DRIVER_VER = 7, STRING SQL_FETCH_DIRECTION = 8, INT32 SQL_ODBC_API_CONFORMANCE = 9, INT16 SQL_ODBC_VER = 10, STRING SQL_ROW_UPDATES = 11, STRING SQL_ODBC_SAG_CLI_CONFORMANCE = 12, INT16 SQL_SERVER_NAME = 13, STRING SQL_SEARCH_PATTERN_ESCAPE = 14, STRING SQL_ODBC_SQL_CONFORMANCE = 15, INT16 SQL_DATABASE_NAME = 16, STRING SQL_DBMS_NAME = 17, STRING SQL_DBMS_VER = 18, STRING SQL_ACCESSIBLE_TABLES = 19, STRING SQL_ACCESSIBLE_PROCEDURES = 20, STRING SQL_PROCEDURES = 21, STRING SQL_CONCAT_NULL_BEHAVIOR = 22, INT16 SQL_CURSOR_COMMIT_BEHAVIOR = 23, INT16 SQL_CURSOR_ROLLBACK_BEHAVIOR = 24, INT16 SQL_DATA_SOURCE_READ_ONLY = 25, STRING SQL_DEFAULT_TXN_ISOLATION = 26, INT32 SQL_EXPRESSIONS_IN_ORDERBY = 27, STRING SQL_IDENTIFIER_CASE = 28, INT16 SQL_IDENTIFIER_QUOTE_CHAR = 29, STRING SQL_MAX_COLUMN_NAME_LEN = 30, INT16 SQL_MAX_CURSOR_NAME_LEN = 31, INT16 SQL_MAX_OWNER_NAME_LEN = 32, INT16 SQL_MAX_PROCEDURE_NAME_LEN = 33, INT16 SQL_MAX_QUALIFIER_NAME_LEN = 34, INT16 SQL_MAX_TABLE_NAME_LEN = 35, INT16 SQL_MULT_RESULT_SETS = 36, STRING SQL_MULTIPLE_ACTIVE_TXN = 37, STRING SQL_OUTER_JOINS = 38, STRING SQL_OWNER_TERM = 39, STRING SQL_PROCEDURE_TERM = 40, STRING SQL_QUALIFIER_NAME_SEPARATOR = 41, STRING SQL_QUALIFIER_TERM = 42, STRING SQL_SCROLL_CONCURRENCY = 43, INT32 SQL_SCROLL_OPTIONS = 44, INT32 SQL_TABLE_TERM = 45, STRING SQL_TXN_CAPABLE = 46, INT16 SQL_USER_NAME = 47, STRING SQL_CONVERT_FUNCTIONS = 48, INT32 SQL_NUMERIC_FUNCTIONS = 49, INT32 SQL_STRING_FUNCTIONS = 50, INT32 SQL_SYSTEM_FUNCTIONS = 51, INT32 SQL_TIMEDATE_FUNCTIONS = 52, INT32 SQL_CONVERT_BIGINT = 53, INT32 SQL_CONVERT_BINARY = 54, INT32 SQL_CONVERT_BIT = 55, INT32 SQL_CONVERT_CHAR = 56, INT32 SQL_CONVERT_DATE = 57, INT32 SQL_CONVERT_DECIMAL = 58, INT32 SQL_CONVERT_DOUBLE = 59, INT32 SQL_CONVERT_FLOAT = 60, INT32 SQL_CONVERT_INTEGER = 61, INT32 SQL_CONVERT_LONGVARCHAR = 62, INT32 SQL_CONVERT_NUMERIC = 63, INT32 SQL_CONVERT_REAL = 64, INT32 SQL_CONVERT_SMALLINT = 65, INT32 SQL_CONVERT_TIME = 66, INT32 SQL_CONVERT_TIMESTAMP = 67, INT32 SQL_CONVERT_TINYINT = 68, INT32 SQL_CONVERT_VARBINARY = 69, INT32 SQL_CONVERT_VARCHAR = 70, INT32 SQL_CONVERT_LONGVARBINARY = 71, INT32 SQL_TXN_ISOLATION_OPTION = 72, INT32 SQL_ODBC_SQL_OPT_IEF = 73, STRING SQL_CORRELATION_NAME = 74, INT16 SQL_NON_NULLABLE_COLUMNS = 75, INT16 SQL_DRIVER_HLIB = 76, INT32 SQL_DRIVER_ODBC_VER = 77, STRING SQL_LOCK_TYPES = 78, INT32 SQL_POS_OPERATIONS = 79, INT32 SQL_POSITIONED_STATEMENTS = 80, INT32 SQL_GETDATA_EXTENSIONS = 81, INT32 SQL_BOOKMARK_PERSISTENCE = 82, INT32 SQL_STATIC_SENSITIVITY = 83, INT32 SQL_FILE_USAGE = 84, INT16 SQL_NULL_COLLATION = 85, INT16 SQL_ALTER_TABLE = 86, INT32 SQL_COLUMN_ALIAS = 87, STRING SQL_GROUP_BY = 88, INT16 SQL_KEYWORDS = 89, STRING SQL_ORDER_BY_COLUMNS_IN_SELECT = 90, STRING SQL_OWNER_USAGE = 91, INT32 SQL_QUALIFIER_USAGE = 92, INT32 SQL_QUOTED_IDENTIFIER_CASE = 93, INT32 SQL_SPECIAL_CHARACTERS = 94, STRING SQL_SUBQUERIES = 95, INT32 SQL_UNION = 96, INT32 SQL_MAX_COLUMNS_IN_GROUP_BY = 97, INT16 SQL_MAX_COLUMNS_IN_INDEX = 98, INT16 SQL_MAX_COLUMNS_IN_ORDER_BY = 99, INT16 SQL_MAX_COLUMNS_IN_SELECT = 100, INT16 SQL_MAX_COLUMNS_IN_TABLE = 101, INT16 SQL_MAX_INDEX_SIZE = 102, INT32 SQL_MAX_ROW_SIZE_INCLUDES_LONG = 103, STRING SQL_MAX_ROW_SIZE = 104, INT32 SQL_MAX_STATEMENT_LEN = 105, INT32 SQL_MAX_TABLES_IN_SELECT = 106, INT16 SQL_MAX_USER_NAME_LEN = 107, INT16 SQL_MAX_CHAR_LITERAL_LEN = 108, INT32 SQL_TIMEDATE_ADD_INTERVALS = 109, INT32 SQL_TIMEDATE_DIFF_INTERVALS = 110, INT32 SQL_NEED_LONG_DATA_LEN = 111, STRING SQL_MAX_BINARY_LITERAL_LEN = 112, INT32 SQL_LIKE_ESCAPE_CLAUSE = 113, STRING SQL_QUALIFIER_LOCATION = 114, INT16 # # <Phew!> # # Level 1 Prototypes # <sqlext.h> # Options for SQLDriverConnect SQL_DRIVER_NOPROMPT = 0 SQL_DRIVER_COMPLETE = 1 SQL_DRIVER_PROMPT = 2 SQL_DRIVER_COMPLETE_REQUIRED = 3 # For SQLGetFunctions SQL_API_ALL_FUNCTIONS = 0 # Defines for SQLBindParameter and # SQLProcedureColumns (returned in the result set) SQL_PARAM_TYPE_UNKNOWN = 0 SQL_PARAM_INPUT = 1 SQL_PARAM_INPUT_OUTPUT = 2 SQL_RESULT_COL = 3 SQL_PARAM_OUTPUT = 4 SQL_RETURN_VALUE = 5 # SQLFreeStmt defines SQL_CLOSE = 0 SQL_DROP = 1 SQL_UNBIND = 2 SQL_RESET_PARAMS = 3 # Added by Edward Akerboom: # SQL Handles SQL_HANDLE_ENV = 1 SQL_HANDLE_DBC = 2 SQL_HANDLE_STMT = 3 SQL_HANDLE_DESC = 4 # SQLGetEnvAttr - Attributes SQL_ATTR_ODBC_VERSION = 200 SQL_ATTR_CONNECTION_POOLING = 201 SQL_ATTR_CP_MATCH = 202 # SQLGetEnvAttr - SQL_ATTR_ODBC_VERSION SQL_OV_ODBC2 = 2, INT32 SQL_OV_ODBC3 = 3, INT32 # # SQLGetEnvAttr - SQL_ATTR_CONNECTION_POOLING # SQL_CP_OFF 0UL # SQL_CP_ONE_PER_DRIVER 1UL # SQL_CP_ONE_PER_HENV 2UL # SQL_CP_DEFAULT SQL_CP_OFF # # # # SQLGetEnvAttr - SQL_ATTR_CP_MATCH # SQL_CP_STRICT_MATCH 0UL # SQL_CP_RELAXED_MATCH 1UL # SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH SQL_NO_DATA = 100 SQL_NULL_HENV = 0 SQL_NULL_HDBC = 0 SQL_NULL_HSTMT = 0 # Don't know if this works: SQL_IS_POINTER = -4 SQL_IS_UINTEGER = -5 SQL_IS_INTEGER = -6 SQL_IS_USMALLINT = -7 SQL_IS_SMALLINT = -8
class Solution: # @param A : list of integers # @return an integer def perfectPeak(self, A): n = len(A) left = [0] * n right = [0] * n left[0] = A[0] right[n-1] = A[n-1] for i in range(1, n) : left[i] = max(left[i-1], A[i]) for i in range(n-2, -1, -1) : right[i] = min(right[i+1], A[i]) for i in range(1, n-1) : if A[i] > left[i-1] and A[i] < right[i+1] : return 1 return 0 A = [ 5706, 26963, 24465, 29359, 16828, 26501, 28146, 18468, 9962, 2996, 492, 11479, 23282, 19170, 15725, 6335 ] ob = Solution() print(ob.perfectPeak(A))
class Matrix: def __init__(self, matrix_string: str): # Split matrix_string into lines, split lines on whitespace and cast elements as integers. self.matrix = [[int(j) for j in i.split()] for i in matrix_string.splitlines()] def row(self, index: int) -> list[int]: return self.matrix[index - 1] def column(self, index: int) -> list[int]: return [i[index - 1] for i in self.matrix]
Colors = {'snow': ('255', '250', '250'), 'ghostwhite': ('248', '248', '255'), 'GhostWhite': ('248', '248', '255'), 'whitesmoke': ('245', '245', '245'), 'WhiteSmoke': ('245', '245', '245'), 'gainsboro': ('220', '220', '220'), 'floralwhite': ('255', '250', '240'), 'FloralWhite': ('255', '250', '240'), 'oldlace': ('253', '245', '230'), 'OldLace': ('253', '245', '230'), 'linen': ('250', '240', '230'), 'antiquewhite': ('250', '235', '215'), 'AntiqueWhite': ('250', '235', '215'), 'papayawhip': ('255', '239', '213'), 'PapayaWhip': ('255', '239', '213'), 'blanchedalmond': ('255', '235', '205'), 'BlanchedAlmond': ('255', '235', '205'), 'bisque': ('255', '228', '196'), 'peachpuff': ('255', '218', '185'), 'PeachPuff': ('255', '218', '185'), 'navajowhite': ('255', '222', '173'), 'NavajoWhite': ('255', '222', '173'), 'moccasin': ('255', '228', '181'), 'cornsilk': ('255', '248', '220'), 'ivory': ('255', '255', '240'), 'lemonchiffon': ('255', '250', '205'), 'LemonChiffon': ('255', '250', '205'), 'seashell': ('255', '245', '238'), 'honeydew': ('240', '255', '240'), 'mintcream': ('245', '255', '250'), 'MintCream': ('245', '255', '250'), 'azure': ('240', '255', '255'), 'aliceblue': ('240', '248', '255'), 'AliceBlue': ('240', '248', '255'), 'lavender': ('230', '230', '250'), 'lavenderblush': ('255', '240', '245'), 'LavenderBlush': ('255', '240', '245'), 'mistyrose': ('255', '228', '225'), 'MistyRose': ('255', '228', '225'), 'white': ('255', '255', '255'), 'black': ('0', '0', '0'), 'darkslategray': ('47', '79', '79'), 'DarkSlateGray': ('47', '79', '79'), 'darkslategrey': ('47', '79', '79'), 'DarkSlateGrey': ('47', '79', '79'), 'dimgray': ('105', '105', '105'), 'DimGray': ('105', '105', '105'), 'dimgrey': ('105', '105', '105'), 'DimGrey': ('105', '105', '105'), 'slategray': ('112', '128', '144'), 'SlateGray': ('112', '128', '144'), 'slategrey': ('112', '128', '144'), 'SlateGrey': ('112', '128', '144'), 'lightslategray': ('119', '136', '153'), 'LightSlateGray': ('119', '136', '153'), 'lightslategrey': ('119', '136', '153'), 'LightSlateGrey': ('119', '136', '153'), 'gray': ('190', '190', '190'), 'grey': ('190', '190', '190'), 'lightgrey': ('211', '211', '211'), 'LightGrey': ('211', '211', '211'), 'lightgray': ('211', '211', '211'), 'LightGray': ('211', '211', '211'), 'midnightblue': ('25', '25', '112'), 'MidnightBlue': ('25', '25', '112'), 'navy': ('0', '0', '128'), 'navyblue': ('0', '0', '128'), 'NavyBlue': ('0', '0', '128'), 'cornflowerblue': ('100', '149', '237'), 'CornflowerBlue': ('100', '149', '237'), 'darkslateblue': ('72', '61', '139'), 'DarkSlateBlue': ('72', '61', '139'), 'slateblue': ('106', '90', '205'), 'SlateBlue': ('106', '90', '205'), 'mediumslateblue': ('123', '104', '238'), 'MediumSlateBlue': ('123', '104', '238'), 'lightslateblue': ('132', '112', '255'), 'LightSlateBlue': ('132', '112', '255'), 'mediumblue': ('0', '0', '205'), 'MediumBlue': ('0', '0', '205'), 'royalblue': ('65', '105', '225'), 'RoyalBlue': ('65', '105', '225'), 'blue': ('0', '0', '255'), 'dodgerblue': ('30', '144', '255'), 'DodgerBlue': ('30', '144', '255'), 'deepskyblue': ('0', '191', '255'), 'DeepSkyBlue': ('0', '191', '255'), 'skyblue': ('135', '206', '235'), 'SkyBlue': ('135', '206', '235'), 'lightskyblue': ('135', '206', '250'), 'LightSkyBlue': ('135', '206', '250'), 'steelblue': ('70', '130', '180'), 'SteelBlue': ('70', '130', '180'), 'lightsteelblue': ('176', '196', '222'), 'LightSteelBlue': ('176', '196', '222'), 'lightblue': ('173', '216', '230'), 'LightBlue': ('173', '216', '230'), 'powderblue': ('176', '224', '230'), 'PowderBlue': ('176', '224', '230'), 'paleturquoise': ('175', '238', '238'), 'PaleTurquoise': ('175', '238', '238'), 'darkturquoise': ('0', '206', '209'), 'DarkTurquoise': ('0', '206', '209'), 'mediumturquoise': ('72', '209', '204'), 'MediumTurquoise': ('72', '209', '204'), 'turquoise': ('64', '224', '208'), 'cyan': ('0', '255', '255'), 'lightcyan': ('224', '255', '255'), 'LightCyan': ('224', '255', '255'), 'cadetblue': ('95', '158', '160'), 'CadetBlue': ('95', '158', '160'), 'mediumaquamarine': ('102', '205', '170'), 'MediumAquamarine': ('102', '205', '170'), 'aquamarine': ('127', '255', '212'), 'darkgreen': ('0', '100', '0'), 'DarkGreen': ('0', '100', '0'), 'darkolivegreen': ('85', '107', '47'), 'DarkOliveGreen': ('85', '107', '47'), 'darkseagreen': ('143', '188', '143'), 'DarkSeaGreen': ('143', '188', '143'), 'seagreen': ('46', '139', '87'), 'SeaGreen': ('46', '139', '87'), 'mediumseagreen': ('60', '179', '113'), 'MediumSeaGreen': ('60', '179', '113'), 'lightseagreen': ('32', '178', '170'), 'LightSeaGreen': ('32', '178', '170'), 'palegreen': ('152', '251', '152'), 'PaleGreen': ('152', '251', '152'), 'springgreen': ('0', '255', '127'), 'SpringGreen': ('0', '255', '127'), 'lawngreen': ('124', '252', '0'), 'LawnGreen': ('124', '252', '0'), 'green': ('0', '255', '0'), 'chartreuse': ('127', '255', '0'), 'mediumspringgreen': ('0', '250', '154'), 'MediumSpringGreen': ('0', '250', '154'), 'greenyellow': ('173', '255', '47'), 'GreenYellow': ('173', '255', '47'), 'limegreen': ('50', '205', '50'), 'LimeGreen': ('50', '205', '50'), 'yellowgreen': ('154', '205', '50'), 'YellowGreen': ('154', '205', '50'), 'forestgreen': ('34', '139', '34'), 'ForestGreen': ('34', '139', '34'), 'olivedrab': ('107', '142', '35'), 'OliveDrab': ('107', '142', '35'), 'darkkhaki': ('189', '183', '107'), 'DarkKhaki': ('189', '183', '107'), 'khaki': ('240', '230', '140'), 'palegoldenrod': ('238', '232', '170'), 'PaleGoldenrod': ('238', '232', '170'), 'lightgoldenrodyellow': ('250', '250', '210'), 'LightGoldenrodYellow': ('250', '250', '210'), 'lightyellow': ('255', '255', '224'), 'LightYellow': ('255', '255', '224'), 'yellow': ('255', '255', '0'), 'gold': ('255', '215', '0'), 'lightgoldenrod': ('238', '221', '130'), 'LightGoldenrod': ('238', '221', '130'), 'goldenrod': ('218', '165', '32'), 'darkgoldenrod': ('184', '134', '11'), 'DarkGoldenrod': ('184', '134', '11'), 'rosybrown': ('188', '143', '143'), 'RosyBrown': ('188', '143', '143'), 'indianred': ('205', '92', '92'), 'IndianRed': ('205', '92', '92'), 'saddlebrown': ('139', '69', '19'), 'SaddleBrown': ('139', '69', '19'), 'sienna': ('160', '82', '45'), 'peru': ('205', '133', '63'), 'burlywood': ('222', '184', '135'), 'beige': ('245', '245', '220'), 'wheat': ('245', '222', '179'), 'sandybrown': ('244', '164', '96'), 'SandyBrown': ('244', '164', '96'), 'tan': ('210', '180', '140'), 'chocolate': ('210', '105', '30'), 'firebrick': ('178', '34', '34'), 'brown': ('165', '42', '42'), 'darksalmon': ('233', '150', '122'), 'DarkSalmon': ('233', '150', '122'), 'salmon': ('250', '128', '114'), 'lightsalmon': ('255', '160', '122'), 'LightSalmon': ('255', '160', '122'), 'orange': ('255', '165', '0'), 'darkorange': ('255', '140', '0'), 'DarkOrange': ('255', '140', '0'), 'coral': ('255', '127', '80'), 'lightcoral': ('240', '128', '128'), 'LightCoral': ('240', '128', '128'), 'tomato': ('255', '99', '71'), 'orangered': ('255', '69', '0'), 'OrangeRed': ('255', '69', '0'), 'red': ('255', '0', '0'), 'hotpink': ('255', '105', '180'), 'HotPink': ('255', '105', '180'), 'deeppink': ('255', '20', '147'), 'DeepPink': ('255', '20', '147'), 'pink': ('255', '192', '203'), 'lightpink': ('255', '182', '193'), 'LightPink': ('255', '182', '193'), 'palevioletred': ('219', '112', '147'), 'PaleVioletRed': ('219', '112', '147'), 'maroon': ('176', '48', '96'), 'mediumvioletred': ('199', '21', '133'), 'MediumVioletRed': ('199', '21', '133'), 'violetred': ('208', '32', '144'), 'VioletRed': ('208', '32', '144'), 'magenta': ('255', '0', '255'), 'violet': ('238', '130', '238'), 'plum': ('221', '160', '221'), 'orchid': ('218', '112', '214'), 'mediumorchid': ('186', '85', '211'), 'MediumOrchid': ('186', '85', '211'), 'darkorchid': ('153', '50', '204'), 'DarkOrchid': ('153', '50', '204'), 'darkviolet': ('148', '0', '211'), 'DarkViolet': ('148', '0', '211'), 'blueviolet': ('138', '43', '226'), 'BlueViolet': ('138', '43', '226'), 'purple': ('160', '32', '240'), 'mediumpurple': ('147', '112', '219'), 'MediumPurple': ('147', '112', '219'), 'thistle': ('216', '191', '216'), 'snow1': ('255', '250', '250'), 'snow2': ('238', '233', '233'), 'snow3': ('205', '201', '201'), 'snow4': ('139', '137', '137'), 'seashell1': ('255', '245', '238'), 'seashell2': ('238', '229', '222'), 'seashell3': ('205', '197', '191'), 'seashell4': ('139', '134', '130'), 'AntiqueWhite1': ('255', '239', '219'), 'AntiqueWhite2': ('238', '223', '204'), 'AntiqueWhite3': ('205', '192', '176'), 'AntiqueWhite4': ('139', '131', '120'), 'bisque1': ('255', '228', '196'), 'bisque2': ('238', '213', '183'), 'bisque3': ('205', '183', '158'), 'bisque4': ('139', '125', '107'), 'PeachPuff1': ('255', '218', '185'), 'PeachPuff2': ('238', '203', '173'), 'PeachPuff3': ('205', '175', '149'), 'PeachPuff4': ('139', '119', '101'), 'NavajoWhite1': ('255', '222', '173'), 'NavajoWhite2': ('238', '207', '161'), 'NavajoWhite3': ('205', '179', '139'), 'NavajoWhite4': ('139', '121', '94'), 'LemonChiffon1': ('255', '250', '205'), 'LemonChiffon2': ('238', '233', '191'), 'LemonChiffon3': ('205', '201', '165'), 'LemonChiffon4': ('139', '137', '112'), 'cornsilk1': ('255', '248', '220'), 'cornsilk2': ('238', '232', '205'), 'cornsilk3': ('205', '200', '177'), 'cornsilk4': ('139', '136', '120'), 'ivory1': ('255', '255', '240'), 'ivory2': ('238', '238', '224'), 'ivory3': ('205', '205', '193'), 'ivory4': ('139', '139', '131'), 'honeydew1': ('240', '255', '240'), 'honeydew2': ('224', '238', '224'), 'honeydew3': ('193', '205', '193'), 'honeydew4': ('131', '139', '131'), 'LavenderBlush1': ('255', '240', '245'), 'LavenderBlush2': ('238', '224', '229'), 'LavenderBlush3': ('205', '193', '197'), 'LavenderBlush4': ('139', '131', '134'), 'MistyRose1': ('255', '228', '225'), 'MistyRose2': ('238', '213', '210'), 'MistyRose3': ('205', '183', '181'), 'MistyRose4': ('139', '125', '123'), 'azure1': ('240', '255', '255'), 'azure2': ('224', '238', '238'), 'azure3': ('193', '205', '205'), 'azure4': ('131', '139', '139'), 'SlateBlue1': ('131', '111', '255'), 'SlateBlue2': ('122', '103', '238'), 'SlateBlue3': ('105', '89', '205'), 'SlateBlue4': ('71', '60', '139'), 'RoyalBlue1': ('72', '118', '255'), 'RoyalBlue2': ('67', '110', '238'), 'RoyalBlue3': ('58', '95', '205'), 'RoyalBlue4': ('39', '64', '139'), 'blue1': ('0', '0', '255'), 'blue2': ('0', '0', '238'), 'blue3': ('0', '0', '205'), 'blue4': ('0', '0', '139'), 'DodgerBlue1': ('30', '144', '255'), 'DodgerBlue2': ('28', '134', '238'), 'DodgerBlue3': ('24', '116', '205'), 'DodgerBlue4': ('16', '78', '139'), 'SteelBlue1': ('99', '184', '255'), 'SteelBlue2': ('92', '172', '238'), 'SteelBlue3': ('79', '148', '205'), 'SteelBlue4': ('54', '100', '139'), 'DeepSkyBlue1': ('0', '191', '255'), 'DeepSkyBlue2': ('0', '178', '238'), 'DeepSkyBlue3': ('0', '154', '205'), 'DeepSkyBlue4': ('0', '104', '139'), 'SkyBlue1': ('135', '206', '255'), 'SkyBlue2': ('126', '192', '238'), 'SkyBlue3': ('108', '166', '205'), 'SkyBlue4': ('74', '112', '139'), 'LightSkyBlue1': ('176', '226', '255'), 'LightSkyBlue2': ('164', '211', '238'), 'LightSkyBlue3': ('141', '182', '205'), 'LightSkyBlue4': ('96', '123', '139'), 'SlateGray1': ('198', '226', '255'), 'SlateGray2': ('185', '211', '238'), 'SlateGray3': ('159', '182', '205'), 'SlateGray4': ('108', '123', '139'), 'LightSteelBlue1': ('202', '225', '255'), 'LightSteelBlue2': ('188', '210', '238'), 'LightSteelBlue3': ('162', '181', '205'), 'LightSteelBlue4': ('110', '123', '139'), 'LightBlue1': ('191', '239', '255'), 'LightBlue2': ('178', '223', '238'), 'LightBlue3': ('154', '192', '205'), 'LightBlue4': ('104', '131', '139'), 'LightCyan1': ('224', '255', '255'), 'LightCyan2': ('209', '238', '238'), 'LightCyan3': ('180', '205', '205'), 'LightCyan4': ('122', '139', '139'), 'PaleTurquoise1': ('187', '255', '255'), 'PaleTurquoise2': ('174', '238', '238'), 'PaleTurquoise3': ('150', '205', '205'), 'PaleTurquoise4': ('102', '139', '139'), 'CadetBlue1': ('152', '245', '255'), 'CadetBlue2': ('142', '229', '238'), 'CadetBlue3': ('122', '197', '205'), 'CadetBlue4': ('83', '134', '139'), 'turquoise1': ('0', '245', '255'), 'turquoise2': ('0', '229', '238'), 'turquoise3': ('0', '197', '205'), 'turquoise4': ('0', '134', '139'), 'cyan1': ('0', '255', '255'), 'cyan2': ('0', '238', '238'), 'cyan3': ('0', '205', '205'), 'cyan4': ('0', '139', '139'), 'DarkSlateGray1': ('151', '255', '255'), 'DarkSlateGray2': ('141', '238', '238'), 'DarkSlateGray3': ('121', '205', '205'), 'DarkSlateGray4': ('82', '139', '139'), 'aquamarine1': ('127', '255', '212'), 'aquamarine2': ('118', '238', '198'), 'aquamarine3': ('102', '205', '170'), 'aquamarine4': ('69', '139', '116'), 'DarkSeaGreen1': ('193', '255', '193'), 'DarkSeaGreen2': ('180', '238', '180'), 'DarkSeaGreen3': ('155', '205', '155'), 'DarkSeaGreen4': ('105', '139', '105'), 'SeaGreen1': ('84', '255', '159'), 'SeaGreen2': ('78', '238', '148'), 'SeaGreen3': ('67', '205', '128'), 'SeaGreen4': ('46', '139', '87'), 'PaleGreen1': ('154', '255', '154'), 'PaleGreen2': ('144', '238', '144'), 'PaleGreen3': ('124', '205', '124'), 'PaleGreen4': ('84', '139', '84'), 'SpringGreen1': ('0', '255', '127'), 'SpringGreen2': ('0', '238', '118'), 'SpringGreen3': ('0', '205', '102'), 'SpringGreen4': ('0', '139', '69'), 'green1': ('0', '255', '0'), 'green2': ('0', '238', '0'), 'green3': ('0', '205', '0'), 'green4': ('0', '139', '0'), 'chartreuse1': ('127', '255', '0'), 'chartreuse2': ('118', '238', '0'), 'chartreuse3': ('102', '205', '0'), 'chartreuse4': ('69', '139', '0'), 'OliveDrab1': ('192', '255', '62'), 'OliveDrab2': ('179', '238', '58'), 'OliveDrab3': ('154', '205', '50'), 'OliveDrab4': ('105', '139', '34'), 'DarkOliveGreen1': ('202', '255', '112'), 'DarkOliveGreen2': ('188', '238', '104'), 'DarkOliveGreen3': ('162', '205', '90'), 'DarkOliveGreen4': ('110', '139', '61'), 'khaki1': ('255', '246', '143'), 'khaki2': ('238', '230', '133'), 'khaki3': ('205', '198', '115'), 'khaki4': ('139', '134', '78'), 'LightGoldenrod1': ('255', '236', '139'), 'LightGoldenrod2': ('238', '220', '130'), 'LightGoldenrod3': ('205', '190', '112'), 'LightGoldenrod4': ('139', '129', '76'), 'LightYellow1': ('255', '255', '224'), 'LightYellow2': ('238', '238', '209'), 'LightYellow3': ('205', '205', '180'), 'LightYellow4': ('139', '139', '122'), 'yellow1': ('255', '255', '0'), 'yellow2': ('238', '238', '0'), 'yellow3': ('205', '205', '0'), 'yellow4': ('139', '139', '0'), 'gold1': ('255', '215', '0'), 'gold2': ('238', '201', '0'), 'gold3': ('205', '173', '0'), 'gold4': ('139', '117', '0'), 'goldenrod1': ('255', '193', '37'), 'goldenrod2': ('238', '180', '34'), 'goldenrod3': ('205', '155', '29'), 'goldenrod4': ('139', '105', '20'), 'DarkGoldenrod1': ('255', '185', '15'), 'DarkGoldenrod2': ('238', '173', '14'), 'DarkGoldenrod3': ('205', '149', '12'), 'DarkGoldenrod4': ('139', '101', '8'), 'RosyBrown1': ('255', '193', '193'), 'RosyBrown2': ('238', '180', '180'), 'RosyBrown3': ('205', '155', '155'), 'RosyBrown4': ('139', '105', '105'), 'IndianRed1': ('255', '106', '106'), 'IndianRed2': ('238', '99', '99'), 'IndianRed3': ('205', '85', '85'), 'IndianRed4': ('139', '58', '58'), 'sienna1': ('255', '130', '71'), 'sienna2': ('238', '121', '66'), 'sienna3': ('205', '104', '57'), 'sienna4': ('139', '71', '38'), 'burlywood1': ('255', '211', '155'), 'burlywood2': ('238', '197', '145'), 'burlywood3': ('205', '170', '125'), 'burlywood4': ('139', '115', '85'), 'wheat1': ('255', '231', '186'), 'wheat2': ('238', '216', '174'), 'wheat3': ('205', '186', '150'), 'wheat4': ('139', '126', '102'), 'tan1': ('255', '165', '79'), 'tan2': ('238', '154', '73'), 'tan3': ('205', '133', '63'), 'tan4': ('139', '90', '43'), 'chocolate1': ('255', '127', '36'), 'chocolate2': ('238', '118', '33'), 'chocolate3': ('205', '102', '29'), 'chocolate4': ('139', '69', '19'), 'firebrick1': ('255', '48', '48'), 'firebrick2': ('238', '44', '44'), 'firebrick3': ('205', '38', '38'), 'firebrick4': ('139', '26', '26'), 'brown1': ('255', '64', '64'), 'brown2': ('238', '59', '59'), 'brown3': ('205', '51', '51'), 'brown4': ('139', '35', '35'), 'salmon1': ('255', '140', '105'), 'salmon2': ('238', '130', '98'), 'salmon3': ('205', '112', '84'), 'salmon4': ('139', '76', '57'), 'LightSalmon1': ('255', '160', '122'), 'LightSalmon2': ('238', '149', '114'), 'LightSalmon3': ('205', '129', '98'), 'LightSalmon4': ('139', '87', '66'), 'orange1': ('255', '165', '0'), 'orange2': ('238', '154', '0'), 'orange3': ('205', '133', '0'), 'orange4': ('139', '90', '0'), 'DarkOrange1': ('255', '127', '0'), 'DarkOrange2': ('238', '118', '0'), 'DarkOrange3': ('205', '102', '0'), 'DarkOrange4': ('139', '69', '0'), 'coral1': ('255', '114', '86'), 'coral2': ('238', '106', '80'), 'coral3': ('205', '91', '69'), 'coral4': ('139', '62', '47'), 'tomato1': ('255', '99', '71'), 'tomato2': ('238', '92', '66'), 'tomato3': ('205', '79', '57'), 'tomato4': ('139', '54', '38'), 'OrangeRed1': ('255', '69', '0'), 'OrangeRed2': ('238', '64', '0'), 'OrangeRed3': ('205', '55', '0'), 'OrangeRed4': ('139', '37', '0'), 'red1': ('255', '0', '0'), 'red2': ('238', '0', '0'), 'red3': ('205', '0', '0'), 'red4': ('139', '0', '0'), 'DeepPink1': ('255', '20', '147'), 'DeepPink2': ('238', '18', '137'), 'DeepPink3': ('205', '16', '118'), 'DeepPink4': ('139', '10', '80'), 'HotPink1': ('255', '110', '180'), 'HotPink2': ('238', '106', '167'), 'HotPink3': ('205', '96', '144'), 'HotPink4': ('139', '58', '98'), 'pink1': ('255', '181', '197'), 'pink2': ('238', '169', '184'), 'pink3': ('205', '145', '158'), 'pink4': ('139', '99', '108'), 'LightPink1': ('255', '174', '185'), 'LightPink2': ('238', '162', '173'), 'LightPink3': ('205', '140', '149'), 'LightPink4': ('139', '95', '101'), 'PaleVioletRed1': ('255', '130', '171'), 'PaleVioletRed2': ('238', '121', '159'), 'PaleVioletRed3': ('205', '104', '137'), 'PaleVioletRed4': ('139', '71', '93'), 'maroon1': ('255', '52', '179'), 'maroon2': ('238', '48', '167'), 'maroon3': ('205', '41', '144'), 'maroon4': ('139', '28', '98'), 'VioletRed1': ('255', '62', '150'), 'VioletRed2': ('238', '58', '140'), 'VioletRed3': ('205', '50', '120'), 'VioletRed4': ('139', '34', '82'), 'magenta1': ('255', '0', '255'), 'magenta2': ('238', '0', '238'), 'magenta3': ('205', '0', '205'), 'magenta4': ('139', '0', '139'), 'orchid1': ('255', '131', '250'), 'orchid2': ('238', '122', '233'), 'orchid3': ('205', '105', '201'), 'orchid4': ('139', '71', '137'), 'plum1': ('255', '187', '255'), 'plum2': ('238', '174', '238'), 'plum3': ('205', '150', '205'), 'plum4': ('139', '102', '139'), 'MediumOrchid1': ('224', '102', '255'), 'MediumOrchid2': ('209', '95', '238'), 'MediumOrchid3': ('180', '82', '205'), 'MediumOrchid4': ('122', '55', '139'), 'DarkOrchid1': ('191', '62', '255'), 'DarkOrchid2': ('178', '58', '238'), 'DarkOrchid3': ('154', '50', '205'), 'DarkOrchid4': ('104', '34', '139'), 'purple1': ('155', '48', '255'), 'purple2': ('145', '44', '238'), 'purple3': ('125', '38', '205'), 'purple4': ('85', '26', '139'), 'MediumPurple1': ('171', '130', '255'), 'MediumPurple2': ('159', '121', '238'), 'MediumPurple3': ('137', '104', '205'), 'MediumPurple4': ('93', '71', '139'), 'thistle1': ('255', '225', '255'), 'thistle2': ('238', '210', '238'), 'thistle3': ('205', '181', '205'), 'thistle4': ('139', '123', '139'), 'gray0': ('0', '0', '0'), 'grey0': ('0', '0', '0'), 'gray1': ('3', '3', '3'), 'grey1': ('3', '3', '3'), 'gray2': ('5', '5', '5'), 'grey2': ('5', '5', '5'), 'gray3': ('8', '8', '8'), 'grey3': ('8', '8', '8'), 'gray4': ('10', '10', '10'), 'grey4': ('10', '10', '10'), 'gray5': ('13', '13', '13'), 'grey5': ('13', '13', '13'), 'gray6': ('15', '15', '15'), 'grey6': ('15', '15', '15'), 'gray7': ('18', '18', '18'), 'grey7': ('18', '18', '18'), 'gray8': ('20', '20', '20'), 'grey8': ('20', '20', '20'), 'gray9': ('23', '23', '23'), 'grey9': ('23', '23', '23'), 'gray10': ('26', '26', '26'), 'grey10': ('26', '26', '26'), 'gray11': ('28', '28', '28'), 'grey11': ('28', '28', '28'), 'gray12': ('31', '31', '31'), 'grey12': ('31', '31', '31'), 'gray13': ('33', '33', '33'), 'grey13': ('33', '33', '33'), 'gray14': ('36', '36', '36'), 'grey14': ('36', '36', '36'), 'gray15': ('38', '38', '38'), 'grey15': ('38', '38', '38'), 'gray16': ('41', '41', '41'), 'grey16': ('41', '41', '41'), 'gray17': ('43', '43', '43'), 'grey17': ('43', '43', '43'), 'gray18': ('46', '46', '46'), 'grey18': ('46', '46', '46'), 'gray19': ('48', '48', '48'), 'grey19': ('48', '48', '48'), 'gray20': ('51', '51', '51'), 'grey20': ('51', '51', '51'), 'gray21': ('54', '54', '54'), 'grey21': ('54', '54', '54'), 'gray22': ('56', '56', '56'), 'grey22': ('56', '56', '56'), 'gray23': ('59', '59', '59'), 'grey23': ('59', '59', '59'), 'gray24': ('61', '61', '61'), 'grey24': ('61', '61', '61'), 'gray25': ('64', '64', '64'), 'grey25': ('64', '64', '64'), 'gray26': ('66', '66', '66'), 'grey26': ('66', '66', '66'), 'gray27': ('69', '69', '69'), 'grey27': ('69', '69', '69'), 'gray28': ('71', '71', '71'), 'grey28': ('71', '71', '71'), 'gray29': ('74', '74', '74'), 'grey29': ('74', '74', '74'), 'gray30': ('77', '77', '77'), 'grey30': ('77', '77', '77'), 'gray31': ('79', '79', '79'), 'grey31': ('79', '79', '79'), 'gray32': ('82', '82', '82'), 'grey32': ('82', '82', '82'), 'gray33': ('84', '84', '84'), 'grey33': ('84', '84', '84'), 'gray34': ('87', '87', '87'), 'grey34': ('87', '87', '87'), 'gray35': ('89', '89', '89'), 'grey35': ('89', '89', '89'), 'gray36': ('92', '92', '92'), 'grey36': ('92', '92', '92'), 'gray37': ('94', '94', '94'), 'grey37': ('94', '94', '94'), 'gray38': ('97', '97', '97'), 'grey38': ('97', '97', '97'), 'gray39': ('99', '99', '99'), 'grey39': ('99', '99', '99'), 'gray40': ('102', '102', '102'), 'grey40': ('102', '102', '102'), 'gray41': ('105', '105', '105'), 'grey41': ('105', '105', '105'), 'gray42': ('107', '107', '107'), 'grey42': ('107', '107', '107'), 'gray43': ('110', '110', '110'), 'grey43': ('110', '110', '110'), 'gray44': ('112', '112', '112'), 'grey44': ('112', '112', '112'), 'gray45': ('115', '115', '115'), 'grey45': ('115', '115', '115'), 'gray46': ('117', '117', '117'), 'grey46': ('117', '117', '117'), 'gray47': ('120', '120', '120'), 'grey47': ('120', '120', '120'), 'gray48': ('122', '122', '122'), 'grey48': ('122', '122', '122'), 'gray49': ('125', '125', '125'), 'grey49': ('125', '125', '125'), 'gray50': ('127', '127', '127'), 'grey50': ('127', '127', '127'), 'gray51': ('130', '130', '130'), 'grey51': ('130', '130', '130'), 'gray52': ('133', '133', '133'), 'grey52': ('133', '133', '133'), 'gray53': ('135', '135', '135'), 'grey53': ('135', '135', '135'), 'gray54': ('138', '138', '138'), 'grey54': ('138', '138', '138'), 'gray55': ('140', '140', '140'), 'grey55': ('140', '140', '140'), 'gray56': ('143', '143', '143'), 'grey56': ('143', '143', '143'), 'gray57': ('145', '145', '145'), 'grey57': ('145', '145', '145'), 'gray58': ('148', '148', '148'), 'grey58': ('148', '148', '148'), 'gray59': ('150', '150', '150'), 'grey59': ('150', '150', '150'), 'gray60': ('153', '153', '153'), 'grey60': ('153', '153', '153'), 'gray61': ('156', '156', '156'), 'grey61': ('156', '156', '156'), 'gray62': ('158', '158', '158'), 'grey62': ('158', '158', '158'), 'gray63': ('161', '161', '161'), 'grey63': ('161', '161', '161'), 'gray64': ('163', '163', '163'), 'grey64': ('163', '163', '163'), 'gray65': ('166', '166', '166'), 'grey65': ('166', '166', '166'), 'gray66': ('168', '168', '168'), 'grey66': ('168', '168', '168'), 'gray67': ('171', '171', '171'), 'grey67': ('171', '171', '171'), 'gray68': ('173', '173', '173'), 'grey68': ('173', '173', '173'), 'gray69': ('176', '176', '176'), 'grey69': ('176', '176', '176'), 'gray70': ('179', '179', '179'), 'grey70': ('179', '179', '179'), 'gray71': ('181', '181', '181'), 'grey71': ('181', '181', '181'), 'gray72': ('184', '184', '184'), 'grey72': ('184', '184', '184'), 'gray73': ('186', '186', '186'), 'grey73': ('186', '186', '186'), 'gray74': ('189', '189', '189'), 'grey74': ('189', '189', '189'), 'gray75': ('191', '191', '191'), 'grey75': ('191', '191', '191'), 'gray76': ('194', '194', '194'), 'grey76': ('194', '194', '194'), 'gray77': ('196', '196', '196'), 'grey77': ('196', '196', '196'), 'gray78': ('199', '199', '199'), 'grey78': ('199', '199', '199'), 'gray79': ('201', '201', '201'), 'grey79': ('201', '201', '201'), 'gray80': ('204', '204', '204'), 'grey80': ('204', '204', '204'), 'gray81': ('207', '207', '207'), 'grey81': ('207', '207', '207'), 'gray82': ('209', '209', '209'), 'grey82': ('209', '209', '209'), 'gray83': ('212', '212', '212'), 'grey83': ('212', '212', '212'), 'gray84': ('214', '214', '214'), 'grey84': ('214', '214', '214'), 'gray85': ('217', '217', '217'), 'grey85': ('217', '217', '217'), 'gray86': ('219', '219', '219'), 'grey86': ('219', '219', '219'), 'gray87': ('222', '222', '222'), 'grey87': ('222', '222', '222'), 'gray88': ('224', '224', '224'), 'grey88': ('224', '224', '224'), 'gray89': ('227', '227', '227'), 'grey89': ('227', '227', '227'), 'gray90': ('229', '229', '229'), 'grey90': ('229', '229', '229'), 'gray91': ('232', '232', '232'), 'grey91': ('232', '232', '232'), 'gray92': ('235', '235', '235'), 'grey92': ('235', '235', '235'), 'gray93': ('237', '237', '237'), 'grey93': ('237', '237', '237'), 'gray94': ('240', '240', '240'), 'grey94': ('240', '240', '240'), 'gray95': ('242', '242', '242'), 'grey95': ('242', '242', '242'), 'gray96': ('245', '245', '245'), 'grey96': ('245', '245', '245'), 'gray97': ('247', '247', '247'), 'grey97': ('247', '247', '247'), 'gray98': ('250', '250', '250'), 'grey98': ('250', '250', '250'), 'gray99': ('252', '252', '252'), 'grey99': ('252', '252', '252'), 'gray100': ('255', '255', '255'), 'grey100': ('255', '255', '255'), 'darkgrey': ('169', '169', '169'), 'DarkGrey': ('169', '169', '169'), 'darkgray': ('169', '169', '169'), 'DarkGray': ('169', '169', '169'), 'darkblue': ('0', '0', '139'), 'DarkBlue': ('0', '0', '139'), 'darkcyan': ('0', '139', '139'), 'DarkCyan': ('0', '139', '139'), 'darkmagenta': ('139', '0', '139'), 'DarkMagenta': ('139', '0', '139'), 'darkred': ('139', '0', '0'), 'DarkRed': ('139', '0', '0'), 'lightgreen': ('144', '238', '144'), 'LightGreen': ('144', '238', '144')}
''' Faça um Programa que leia um vetor de 5 números inteiros e mostre-os. ''' lista=[] for numero in range(1,6): lista.append(int(input("Digite um número: "))) print(lista)
class Student: def __init__(self, id: str, name: str) -> None: self.id = id self.name = name class Course: def __init__(self, id: str, name: str, hours: int, grades = None) -> None: self.id = id self.name = name self.hours = hours self.grades = grades or {} def add_grade(self, student: Student, grade: str): self.grades[student.id] = grade @staticmethod def convert_grade_to_points(grade: str) -> float: return { "A+": 4.0, "A" : 4.0, "A-": 3.7, "B+": 3.5, "B" : 3.3, "B-": 3.0, "C+": 2.7, "C" : 2.5, "C-": 2.3, "D" : 2.0, "F" : 0.0 }.get(grade, 0)
class WebServerDefinitions: name = None root = None template = None https = False default_template = 'laravel' def __init__(self, name, root, template=None, https=False): self.name = name self.root = root self.https = https if not template: template = self.default_template self.template = template
class GraphReprBase(object): @staticmethod def read_from_file(input_file): raise NotImplemented()
STATUS_MAP = { 'RECEIVED_UNREAD': b'0', 'RECEIVED_READ': b'1', 'STORED_UNSENT': b'2', 'STORED_SENT': b'3', 'ALL': b'4' } STATUS_MAP_R = { b'0': 'RECEIVED_UNREAD', b'1': 'RECEIVED_READ', b'2': 'STORED_UNSENT', b'3': 'STORED_SENT', b'4': 'ALL' } DELETE_FLAG = { 'ALL_READ': b'1', 'READ_AND_SENT': b'2', 'READ_AND_UNSENT': b'3', 'ALL': b'4' } ERROR_CODES = [ b'+CMS ERROR', b'+CME ERROR' ] # EC25 URC codes with the corresponding chunk count UNSOLICITED_RESULT_CODES = [ (b'+CREG', 1), (b'+CGREG', 1), (b'+CTZV', 1), (b'+CTZE', 1), (b'+CMTI', 1), (b'+CMT', 2), (b'^HCMT', 2), (b'+CBM', 2), (b'+CDS', 1), (b'+CDSI', 1), (b'^HCDS', 2), (b'+COLP', 1), (b'+CLIP', 1), (b'+CRING', 1), (b'+CCWA', 1), (b'+CSSI', 1), (b'+CSSU', 1), (b'+CUSD', 1), (b'RDY', 1), (b'+CFUN', 1), (b'+CPIN', 1), (b'+QIND', 1), (b'POWERED DOWN', 1), (b'+CGEV', 1), (b'NO CARRIER', 1) ]
def collatz(n, count): if n == 1: return count else: count = count + 1 if n % 2 == 0: n = n /2 else: n = 3 * n + 1 return collatz(n, count) max_collatz = 1 iteration = 1 for i in range(1, 1000000): count = 1 contesting = collatz(i, 1) if contesting > max_collatz: max_collatz = contesting iteration = i print("Final winner is integer {}".format(iteration))
# -*- coding: utf-8 -*- """ Actually, i want to design a django model-like with fields and inline validators, of course time is against me, so i wrote this; close enough (not really) xD If 'f' is None means that validator generate the content of the field """ MAIN_FIELDS = [ { 'f': None, # From JSON 't': 'offer-id', # To XML 'type': 'uuid', 'required': True }, { 'f': 'name', 't': 'title', 'type': 'text', 'max_length': 80, 'required': True }, { 'f': None, 't': 'product-url', 'type': 'url', 'max_length': None, 'required': True }, { 'f': 'price', 't': 'price', 'type': 'number', 'required': True }, { 'f': 'stock', 't': 'availability', 'type': 'check_stock', 'required': True }, { 'f': 'shipping', 't': 'deliver-cost', 'type': 'check_shipping', 'required': True }, { 'f': 'brand', 't': 'brand', 'type': 'text', 'max_length': None }, { 'f': 'description', 't': 'description', 'type': 'text', 'max_length': 300 }, { 'f': 'images', 't': 'image-url', 'type': 'image_array' }, { 'f': 'id_category', 't': 'merchant-category', 'type': 'category_array' }, { 'f': 'sku', 't': 'sku', 'type': 'text', 'max-length': None }, { 'f': None, 't': 'currency', 'type': 'currency' } ] # TODO: create custom validator for custom product """ FASHION: fashion-type fashion-gender fashion-size color """
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ # Functions allow variable-length argument lists def main(): kitten('meow', 'grrr', 'purr') # We treat it as a sequence, actually a tuple def kitten(*args): # It's denoted as *args. args is the conventional name if len(args): # If the length of args is greater than zero for s in args: print(s) # If len(args), print all the items in the tuple else: print('Meow.') # otherwise print meow if __name__ == '__main__': main() # You can call the kitten function like this: x = ('hiss', 'howl', 'roar', 'screech') kitten(*x) # note the star
for i in range(5): for j in range(5): if i==j: print('#',end='') else: print("+",end='') print("")
DATA_URL = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data' DATA_COLUMNS = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Origin'] NORMALIZE = False TARGET_VARIABLE = 'MPG' # FEATURES_TO_USE = [ 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Europe', 'Japan', 'USA'] FEATURES_TO_USE = [ 'MPG', 'Horsepower','Displacement'] NORMALIZE_HORSEPOWER = False
# # @lc app=leetcode id=286 lang=python3 # # [286] Walls and Gates # # https://leetcode.com/problems/walls-and-gates/description/ # # algorithms # Medium (53.35%) # Likes: 1050 # Dislikes: 15 # Total Accepted: 113.7K # Total Submissions: 212.9K # Testcase Example: '[[2147483647,-1,0,2147483647],[2147483647,2147483647,2147483647,-1],[2147483647,-1,2147483647,-1],[0,-1,2147483647,2147483647]]' # # You are given a m x n 2D grid initialized with these three possible # values. # # # -1 - A wall or an obstacle. # 0 - A gate. # INF - Infinity means an empty room. We use the value 2^31 - 1 = 2147483647 to # represent INF as you may assume that the distance to a gate is less than # 2147483647. # # # Fill each empty room with the distance to its nearest gate. If it is # impossible to reach a gate, it should be filled with INF. # # Example:  # # Given the 2D grid: # # # INF -1 0 INF # INF INF INF -1 # INF -1 INF -1 # ⁠ 0 -1 INF INF # # # After running your function, the 2D grid should be: # # # ⁠ 3 -1 0 1 # ⁠ 2 2 1 -1 # ⁠ 1 -1 2 -1 # ⁠ 0 -1 3 4 # # # # @lc code=start def is_inside(r, c, rooms): return r >= 0 and c >= 0 and r < len(rooms) and c < len(rooms[0]) def dfs(queue, rooms): while queue: r, c, dist = queue.popleft() if not is_inside(r, c, rooms) or rooms[r][c] == -1 or rooms[r][c] <= dist: continue rooms[r][c] = dist queue.append((r+1, c, dist+1)) queue.append((r, c+1, dist+1)) queue.append((r-1, c, dist+1)) queue.append((r, c-1, dist+1)) class Solution: def wallsAndGates(self, rooms: List[List[int]]) -> None: """ Do not return anything, modify rooms in-place instead. """ for r in range(len(rooms)): for c in range(len(rooms[0])): if rooms[r][c] == 0: rooms[r][c] = 1 dfs(collections.deque([(r, c, 0)]), rooms) rooms[r][c] = 0 # @lc code=end
# question : https://quera.ir/problemset/contest/8901 x_n = input().split(' ') x = x_n[1] n = int(x_n[0]) default_value = { 'L': 0, 'M': 0, 'R': 0, } movements = [] for one_input in range(n): movements.append(input().split(' ')) default_value[x] = 1 for one_movement in movements: temp = default_value.get(one_movement[0]) default_value[one_movement[0]] = default_value.get(one_movement[1]) default_value[one_movement[1]] = temp for index in default_value: if default_value.get(index) == 1: print(index) break
#!/usr/bin/env python3 def get_vertices(wire): x = y = steps = 0 vertices = [(x, y, 0)] for edge in wire: length = int(edge[1:]) steps += length if edge[0] == "R": x += length if edge[0] == "L": x -= length if edge[0] == "U": y += length if edge[0] == "D": y -= length vertices.append((x, y, steps)) return vertices def get_intersections(edges1, edges2): intersections = [] for i in range(len(edges1) - 1): for j in range(len(edges2) - 1): intersection = get_intersection( edges1[i], edges1[i + 1], edges2[j], edges2[j + 1] ) if intersection: intersections.append(intersection) # remove 0,0 if any try: intersections.remove((0, 0, 0)) except Exception: pass return intersections def get_distance(vert): return abs(vert[0]) + abs(vert[1]) def get_intersection(e1from, e1to, e2from, e2to): e1x1, e1y1, steps_e1 = e1from e1x2, e1y2, _ = e1to e2x1, e2y1, steps_e2 = e2from e2x2, e2y2, _ = e2to if e1y1 == e1y2 and e2x1 == e2x2: # e1 is horizontal and e2 is vertical if (e2y1 <= e1y1 <= e2y2 or e2y1 >= e1y1 >= e2y2) and ( e1x1 <= e2x1 <= e1x2 or e1x1 >= e2x1 >= e1x2 ): steps = steps_e1 + steps_e2 + abs(e2x1 - e1x1) + abs(e1y1 - e2y1) return (e2x1, e1y1, steps) elif e2y1 == e2y2 and e1x1 == e1x2: # e1 is vertical and e2 is horizontal if (e1y1 <= e2y1 <= e1y2 or e1y1 >= e2y1 >= e1y2) and ( e2x1 <= e1x1 <= e2x2 or e2x1 >= e1x1 >= e2x2 ): steps = steps_e1 + steps_e2 + abs(e1x1 - e2x1) + abs(e2y1 - e1y1) return (e1x1, e2y1, steps) def get_closest_intersection(edges1, edges2): ints = get_intersections(edges1, edges2) return min(map(lambda vert: get_distance(vert), ints)) def get_min_path_intersection(edges1, edges2): ints = get_intersections(edges1, edges2) return min(map(lambda vert: vert[2], ints)) def test1(): wire1 = ["R8", "U5", "L5", "D3"] wire2 = ["U7", "R6", "D4", "L4"] edges1 = get_vertices(wire1) edges2 = get_vertices(wire2) assert get_closest_intersection(edges1, edges2) == 6 assert get_min_path_intersection(edges1, edges2) == 30 def test2(): wire1 = ["R75", "D30", "R83", "U83", "L12", "D49", "R71", "U7", "L72"] wire2 = ["U62", "R66", "U55", "R34", "D71", "R55", "D58", "R83"] edges1 = get_vertices(wire1) edges2 = get_vertices(wire2) assert get_closest_intersection(edges1, edges2) == 159 assert get_min_path_intersection(edges1, edges2) == 610 if __name__ == "__main__": with open("../inputs/day03.txt") as ip: lines = ip.readlines() wire1 = lines[0].strip().split(",") edges1 = get_vertices(wire1) wire2 = lines[1].strip().split(",") edges2 = get_vertices(wire2) print( "Distanct to closest intersection", get_closest_intersection(edges1, edges2) ) print("Min Steps to intersection", get_min_path_intersection(edges1, edges2))
# Ex: 051 - Desenvolva um programa que leia o primeiro termo e a razão de uma # PA. No final. mostre os 10 primeiros termos dessa progressão. print(''' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --Seja bem-vindo! --Exercício 051 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ''') print('--Progressão Aritmética\n' '--Preencha os Dados') termo1 = int(input('Número Inicial: ')) razao = int(input('Razão: ')) print(f'\n{termo1}', end=', ') for c in range(1, 10): termo1 = termo1 + razao print(termo1, end=', ') print(''' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- --Obrigado pelo uso! --Desenvolvido por Thalles Torres -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-''')
dim=10.0 eta=0.5 steps=100 #must be integer (no decimal point) rneighb=eta
"""Константы для jim протокола, настройки""" ACTION = "action" # тип сообщения между клиентом и сервером TIME = "time" # время запроса DATA = "data" # данные пересылаемые в сообщении (вложенный словарь) TOKEN = "token" # токен RESPONSE = "response" # код ответа # Значения (Типы данных, передаваемых в поле data) MESSAGE = "text" # текст сообщения # TYPE = "type" # необязательное поле USER = "user" # данные о пользователе - клиенте (вложенный словарь) ACCOUNT_NAME = "account_name" # имя пользователя - чата LOGIN = "login" # логин пользователя (может отличаться от имени пользователя) PASSWORD = "password" # пароль пользователя STATUS = "status" # статус пользователя # TO = "message_to" # получатель # FROM = "account_name" # отправитель INFO = "info" # информация о контакте # DATA = "data" # сервисное сообщение (текст ошибки и т.д.) # Значения (Методы протокола (actions)) PRESENCE = "presence" # присутствие. Сервисное сообщение для извещения сервера о присутствии клиента online # PROBE = "probe" # проверка присутствия. Сервисное сообщение от сервера для проверки присутствии клиента online MSG = "msg" # простое сообщение пользователю или в чат # QUIT = "quit" # отключение от сервера AUTHENTICATE = "authenticate" # авторизация на сервере # JOIN = "join" # присоединиться к чату # LEAVE = "leave" # покинуть чат GET_CONTACTS = "get_contacts" # получить список контактов GET_CONTACT = "get_contact" # получить информацию о контакте ADD_CONTACT = "add_contact" # добавить контакт в список контактов DEL_CONTACT = "del_contact" # удалить контакт из списка контактов UPDATE_CONTACT = "update_contact" # обновить контакт в списке контактов ACT_LOGIN = "login" # вход ACT_LOGOUT = "logout" # выход ACT_REGISTRATION = "registration" # регистрация ECHO = "echo" # эхо-сообщение ACT_GET_ALL_MESSAGES = "get_all_messages" # получить все сообщения пользователя ACT_UPDATE_MESSAGE = "update_message" # обновить сообщение пользователя ACT_DELETE_MESSAGE = "delete_message" # удалить сообщение пользователя # Коды ответов (будут дополняться) # 1xx — информационные сообщения BASIC_NOTICE = 100 # базовое уведомление IMPORTANT_NOTICE = 101 # важное уведомление # 2xx — успешное завершение OK = 200 # OK CREATED = 201 # объект создан ACCEPTED = 202 # подтверждение # 4xx — ошибка на стороне клиента WRONG_REQUEST = 400 # неправильный запрос/json объект NOT_AUTORIZED = 401 # не авторизован WRONG_LOGIN_PASSWORD = 402 # неправильный логин/пароль FORBIDDEN = 403 # пользователь заблокирован NOT_FOUND = 404 # пользователь/чат отсутствует на сервере CONFLICT = 409 # уже имеется подключение с указанным логином GONE = 410 # адресат существует, но недоступен (offline) CLOSED = 499 # Client Closed Request (клиент закрыл соединение) # 5xx — ошибка на стороне сервера SERVER_ERROR = 500 # ошибка сервера # Словари - ответы: # # 200 # RESPONSE_200 = {RESPONSE: 200} # # 400 # RESPONSE_400 = { # RESPONSE: 400, # MESSAGE: None # } # 499 RESPONSE_499 = { RESPONSE: 499, MESSAGE: "Client Closed Request" } # Кортеж из кодов ответов RESPONSE_CODES = ( BASIC_NOTICE, IMPORTANT_NOTICE, OK, CREATED, ACCEPTED, WRONG_REQUEST, NOT_AUTORIZED, WRONG_LOGIN_PASSWORD, FORBIDDEN, NOT_FOUND, CONFLICT, GONE, SERVER_ERROR ) # ENCODING = "utf-8" # кодировка
# automatically generated by the FlatBuffers compiler, do not modify # namespace: apemodefb class EAnimCurvePropertyFb(object): LclTranslation = 0 RotationOffset = 1 RotationPivot = 2 PreRotation = 3 PostRotation = 4 LclRotation = 5 ScalingOffset = 6 ScalingPivot = 7 LclScaling = 8 GeometricTranslation = 9 GeometricRotation = 10 GeometricScaling = 11
__author__ = 'tylin' # from .bleu import Bleu # # __all__ = ['Bleu']
# General ES Constants COUNT = 'count' CREATE = 'create' DOCS = 'docs' FIELD = 'field' FIELDS = 'fields' HITS = 'hits' ID = '_id' INDEX = 'index' INDEX_NAME = 'index_name' ITEMS = 'items' KILOMETERS = 'km' MAPPING_DYNAMIC = 'dynamic' MAPPING_MULTI_FIELD = 'multi_field' MAPPING_NULL_VALUE = 'null_value' MILES = 'mi' OK = 'ok' PROPERTIES = 'properties' PROPERTY_TYPE = 'type' SCORE = '_score' SOURCE = '_source' TOTAL = 'total' TTL = '_ttl' TYPE = '_type' UID = '_uid' UNIT = 'unit' URL = 'url' URLS = 'urls' # Matching / Filtering AND = "and" BOOL = 'bool' DOC_TYPE = 'doc_type' FILTER = 'filter' FILTERED = 'filtered' MATCH_ALL = 'match_all' MUST = 'must' MUST_NOT = 'must_not' OR = "or" QUERY = 'query' SHOULD = 'should' SORT = 'sort' TERMS = 'terms' TERM = 'term' # Sorting / Misc. ASC = 'asc' DESC = 'desc' FACET_FILTER = 'facet_filter' FACETS = 'facets' FROM = 'from' OFFSET = 'offset' ORDER = 'order' SIZE = 'size' TO = 'to' # Runtime Constants DEFAULT_PAGE_SIZE = 20
load("//third_party:common.bzl", "err_out", "execute") _LLVM_BINARIES = [ "clang", "clang-cpp", "ld.lld", "llvm-ar", "llvm-as", "llvm-nm", "llvm-objcopy", "llvm-objdump", "llvm-profdata", "llvm-dwp", "llvm-ranlib", "llvm-readelf", "llvm-strip", "llvm-symbolizer", ] _LLVM_VERSION_MINIMAL = "10.0.0" def _label(filename): return Label("//third_party/llvm_toolchain:{}".format(filename)) def _check_llvm_binaries(repository_ctx, llvm_dir): for binary in _LLVM_BINARIES: binary_path = "{}/bin/{}".format(llvm_dir, binary) if not repository_ctx.path(binary_path).exists: fail("{} doesn't exist".format(binary_path)) def _retrieve_clang_version(repository_ctx, clang_binary): script_path = repository_ctx.path(Label("//third_party/llvm_toolchain:find_clang_version.py")) python_bin = repository_ctx.which("python3") result = execute(repository_ctx, [python_bin, script_path, clang_binary]) if result.return_code: fail("Failed to run find_clang_version.py: {}".format(err_out(result))) llvm_version = result.stdout.strip() actual_version = [int(m) for m in llvm_version.split(".")] minimal_version = [int(m) for m in _LLVM_VERSION_MINIMAL.split(".")] if actual_version < minimal_version: fail("Minimal llvm version supported is {}, got: {}".format(_LLVM_VERSION_MINIMAL, llvm_version)) return result.stdout.strip() def _local_config_llvm_impl(repository_ctx): llvm_dir = repository_ctx.os.environ.get("LLVM_DIR", None) if not llvm_dir: fail("LLVM_DIR not set.") if llvm_dir.endswith("/"): llvm_dir = llvm_dir[:-1] _check_llvm_binaries(repository_ctx, llvm_dir) clang_binary = "{}/bin/clang".format(llvm_dir) llvm_version = _retrieve_clang_version(repository_ctx, clang_binary) repository_ctx.symlink(_label("cc_toolchain_config.bzl"), "cc_toolchain_config.bzl") arch = repository_ctx.execute(["uname", "-m"]).stdout.strip() repository_ctx.template( "toolchains.bzl", _label("toolchains.bzl.tpl"), { "%{arch}": arch, }, ) repository_ctx.template( "BUILD", _label("BUILD.tpl"), { "%{arch}": arch, "%{llvm_dir}": llvm_dir, "%{llvm_version}": llvm_version, }, ) local_config_llvm = repository_rule( implementation = _local_config_llvm_impl, environ = ["LLVM_DIR"], local = True, configure = True, )
valid=False def marray(arr,*args,**kwargs): return arr def unitsDict(*args,**kwargs): return None def varMeta(*args,**kwargs): return None
{ 'OS-EXT-STS:task_state': None, 'addresses': {'int-net': [ {'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.1.8', 'OS-EXT-IPS:type': 'fixed' }, {'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.166.23', 'OS-EXT-IPS:type': 'floating' } ] }, 'OS-EXT-STS:vm_state': 'active', 'OS-EXT-SRV-ATTR:instance_name': 'instance-00000002', 'OS-SRV-USG:launched_at': '2018-10-26T09:36:46.000000', 'id': '61205745-b2bf-4db0-ad50-e7a60bf08bd5', 'security_groups': [{'name': 'defalt'}], 'user_id': 'd2fcc0c45a134de28dba429dbef2c3ba', 'progress': 0, 'OS-EXT-STS:power_state': 1, 'OS-EXT-AZ:availability_zone': 'nova', 'status': 'ACTIVE', 'updated': '2018-10-26T09:36:46Z', 'hostId': '1b6fa73a7ea8e40dc812954fe751d3aa812e6b52489ddb5360f5d36e', 'OS-EXT-SRV-ATTR:host': 'control-node', 'OS-SRV-USG:terminated_at': None, 'OS-EXT-SRV-ATTR:hypervisor_hostname': 'control-node', 'name': 'test', 'created': '2018-10-26T09:36:38Z', 'tenant_id': 'a95424bbdca6410092073d564f1f4012', } # ip netns add ns1 # ovs-vsctl add-port br-int tap0 tag=1 -- set Interface tap0 type=internal # ip a # ovs-vsctl show # ip link set tap0 netns ns1 # ip netns exec ns1 ip addr add 192.168.1.3/24 dev tap0 # ip netns exec ns1 ifconfig tap0 promisc up # ip netns exec ns1 ip a # ip netns exec ns1 ping 192.168.1.1 # ip netns add ns1 # ip netns show # ip netns exec ns1 ip a # ip netns exec ns1 ip tuntap add tap0 mode tap # ip netns exec ns1 ip a # ip netns exec ns1 ip aadr add 192.168.1.3/24 dev tap0 # ip netns exec ns1 ip addr add 192.168.1.3/24 dev tap0 # ip netns exec ns1 ip a # ip netns exec ns1 ip set tap0 up # ip netns exec ns1 ip link set tap0 up # ovs-ofctl dump-ports br-int qvo3ef787ad-67 # ovs-vsctl list interface br-ex
# 打印输出直角在左下角的等腰三角形和长方形 def put_star(n): """连续输出n个*""" for _ in range(n): print('*', end='') print('直角在左下角的等腰三角形') n = int(input('腰长:')) for i in range(1, n + 1): put_star(i) print() print('长方形') h = int(input('宽:')) w = int(input('长:')) for i in range(1, h + 1): put_star(w) print()
with open('input.txt') as f: lines = f.readlines() count = 0 curDepth = 0 for line in lines: newDepth = int(line) if curDepth != 0: if newDepth > curDepth: count += 1 curDepth = newDepth print(count)
def add(x, y=3): print(x + y) add(5) # 8 add(5, 8) # 13 add(y=3) # Error, missing x # -- Order of default parameters -- # def add(x=5, y): # Not OK, default parameters must go after non-default # print(x + y) # -- Usually don't use variables as default value -- default_y = 3 def add(x, y=default_y): sum = x + y print(sum) add(2) # 5 default_y = 4 print(default_y) # 4 add(2) # 5, even though we re-defined default_y
''' Filippo Aleotti [email protected] 29 November 2019 I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019 Given a list of integer, store the frequency of each value in a dict, where the key is the value. ''' def are_equals(dict1, dict2): ''' check if two dict are equal. Both the dicts have str keys and integer values ''' for k,v in dict1.items(): if k not in dict2.keys(): return False if dict2[k] != v: return False return True def frequency_extractor(input_list): output_dict = {} for element in input_list: if str(element) not in output_dict.keys(): output_dict[str(element)] = 1 else: output_dict[str(element)] += 1 return output_dict frequency_1 = frequency_extractor([0,1,0,2,2,1,2,1,0,0,2,1,1]) frequency_2 = frequency_extractor([1,2,2,2,0,5,3]) assert are_equals(frequency_1, {'0':4,'1':5,'2':4}) assert are_equals(frequency_2, {'0':1,'1':1,'2':3,'3':1,'5':1})
#!/usr/bin/env python print("Hello from cx_Freeze Advanced #1\n") module = __import__("testfreeze_1")
# Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers. def even_or_odd(number): if number % 2 == 0: return "Even" else: return "Odd" assert (even_or_odd(2)) == "Even", "Debe devolver Even" assert (even_or_odd(0)) == "Even", "Debe devolver Even" assert (even_or_odd(7)) == "Odd", "Debe devolver Odd" assert (even_or_odd(1)) == "Odd", "Debe devolver Odd"
class Solution: def isAlienSorted(self, words, order): """ :type words: List[str] :type order: str :rtype: bool """ order = {alpha: index for index, alpha in enumerate(order)} for i in range(len(words) - 1): flag = True for j in range(min(len(words[i]), len(words[i + 1]))): if order[words[i][j]] < order[words[i + 1][j]]: flag = False break elif order[words[i][j]] > order[words[i + 1][j]]: return False if flag and len(words[i]) > len(words[i + 1]): return False return True
class Producto: """Producto de venta""" def __init__(self, nombre, desc, precio): self.nombre = nombre self.descripcion = desc self.precio = precio # Es una salida para la muestra de la info def formateo_textual(self): textoFinal = "" for atr in [self.nombre, self.descripcion, self.precio]: textoFinal += atr + "\n" return textoFinal class ListaProductos: """Productos de una orden""" def __init__(self, productos): # Lista de ids de productos self.nombreArchivo = "save.p" self.lista = productos def carga_data(self): with open(self.nombreArchivo, "rb") as file: carga = pickle.load(file) return carga def guarda_data(self): with open(self.nombreArchivo, "wb") as file: pickle.dump(self.lista, file) listaDeProductos = [ Producto("Cafe", "chico", "30"), Producto("cafeLeche", "taza", "50") ] # Solo pata testing productos = ListaProductos(listaDeProductos)
n = int(input()) L = list(map(int,input().split())) A = list(set(L[:])) d = {} A.sort() for i in range(len(A)): d[A[i]] = i for i in L: print(d[i],end = " ")
""" Jour de fete - Django_JDF Convertion de nombres en toutes lettres @date: 2014/09/12 @copyright: 2014 by Luc LEGER <[email protected]> @license: MIT """ class numbers : def __init__(self) : self.schu=["","UN ","DEUX ","TROIS ","QUATRE ","CINQ ","SIX ","SEPT ","HUIT ","NEUF "] self.schud=["DIX ","ONZE ","DOUZE ","TREIZE ","QUATORZE ","QUINZE ","SEIZE ","DIX SEPT ","DIX HUIT ","DIX NEUF "] self.schd=["","DIX ","VINGT ","TRENTE ","QUARANTE ","CINQUANTE ","SOIXANTE ","SOIXANTE ","QUATRE VINGT ","QUATRE VINGT "] def convNumber2letter(self,nombre): s='' reste=nombre i=1000000000 while i>0: y=reste/i if y!=0: centaine=y/100 dizaine=(y - centaine*100)/10 unite=y-centaine*100-dizaine*10 if centaine==1: s+="CENT " elif centaine!=0: s+=self.schu[centaine]+"CENT " if dizaine==0 and unite==0: s=s[:-1]+"S " if dizaine not in [0,1]: s+=self.schd[dizaine] if unite==0: if dizaine in [1,7,9]: s+="DIX " elif dizaine==8: s=s[:-1]+"S " elif unite==1: if dizaine in [1,9]: s+="ONZE " elif dizaine==7: s+="ET ONZE " elif dizaine in [2,3,4,5,6]: s+="ET UN " elif dizaine in [0,8]: s+="UN " elif unite in [2,3,4,5,6,7,8,9]: if dizaine in [1,7,9]: s+=self.schud[unite] else: s+=self.schu[unite] if i==1000000000: if y>1: s+="MILLIARDS " else: s+="MILLIARD " if i==1000000: if y>1: s+="MILLIONS " else: s+="MILLIONS " if i==1000: s+="MILLE " #end if y!=0 reste -= y*i dix=False i/=1000; #end while if len(s)==0: s+="ZERO " return s
# Url https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/ class Solution: def subtractProductAndSum(self, n): prod, sum_n, curr = 1, 0, 0 while n != 0: curr = n % 10 prod = prod * curr sum_n = sum_n + curr n = n//10 return prod - sum_n if __name__ == '__main__': a = Solution() print(a.subtractProductAndSum(234))
# Work out the first ten digits of the sum of N 50 digit numbers. total = 0 for x in range(int(input())): total += int(input().rstrip()) print(str(total)[:10])
__author__ = "Sylvain Dangin" __licence__ = "Apache 2.0" __version__ = "1.0" __maintainer__ = "Sylvain Dangin" __email__ = "[email protected]" __status__ = "Development" class concat(): def action(input_data, params, current_row, current_index): """Concat multiple columns in the cell. :param input_data: Not used. :param params: Dict with following keys: - col_list: List of columns to concat in the cell. - separator (optional): Separator to put between columns. :param current_row: Not used :param current_index: Not used :return: Value to set. :rtype: str """ if isinstance(params, dict): col_list = [] if 'col_list' in params: for col in params['col_list']: col_list.append(current_row[col - 1]) if 'separator' in params: return params['separator'].join(col_list) else: return ''.join(col_list) return input_data
""" This module is for generating a Markov chain order two from a text. """ def generate_markov_chain(tweet_array): """ Input assumes text is an array of tweets, each tweet with words separated by spaces with no new lines. This requires some changes to most transcripts ahead of time. Output will be a dictionary with each pair of words that exists in the text as a key and a list of words that follow that pair as the value. """ tweets_copy = tweet_array[:] markov_chain = {} for tweet in tweets_copy: word_array = tweet.split() for i in range(len(word_array) - 2): # - 2 to not analyze the last word as first in pair first_word = strip_word(word_array[i]) second_word = strip_word(word_array[i + 1]) third_word = strip_word(word_array[i + 2]) pair = first_word + ' ' + second_word if pair not in markov_chain: markov_chain[pair] = [third_word] else: markov_chain[pair].append(third_word) return markov_chain def strip_word(string): """ This function strips the words of any surrounding spaces or quotation marks from an input string, but does not replace any single quotes inside words (e.g. "isn't") """ return string.strip().strip("'").strip('"')
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: class TaskName(): Classify_Task = "classify" Detect2d_Task = "detect2d" Segment_Task = "segment" PC_Classify_Task = "pc_classify"
class TheEquation: def leastSum(self, X, Y, P): m = 2*P for i in xrange(1, P+1): for j in xrange(1, P+1): if (X*i + Y*j)%P == 0: m = min(m, i+j) return m
#!/usr/bin/env python3 """ Top students """ def top_students(mongo_collection: object): """function that returns all students sorted by average score""" top = mongo_collection.aggregate([ { "$project": { "name": "$name", "averageScore": {"$avg": "$topics.score"} } }, {"$sort": {"averageScore": -1}} ]) return top
""" Map: Aplica una función a dcada elemento de una lista iterable, dvolviendo otra lista. """ def elevar_cuadrado(num): # return num * num return pow(num, 2) # numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numeros = list(range(1, 11)) # Del 1 al 10 print(numeros) numeros_elevados = list(map(elevar_cuadrado, numeros))
#!/usr/bin/env python3 class FakeSerial: def __init__(self): self._last_written_data = None self._response = None self.read_data = [] @property def last_written_data(self): return self._last_written_data @property def response(self): return self._response @response.setter def response(self, value): self._response = bytearray(value) def write(self, data): self._last_written_data = data def read(self): while self._response: yield bytes([self._response.pop(0)]) def read_until(self, expected): output = b'' for b in self.read(): if b == expected: break output += b return output
# coding=utf-8 # Definition for singly-linked list. class ListNode(object): def __init__(self, x, next=None): self.val = x self.next = next class DoubleNode(object): def __init__(self, key, val, pre=None, next=None): self.key = key self.val = val self.pre = pre self.next = next # Definition for a binary tree node. class TreeNode(object): def __init__(self, x, left=None, right=None): self.val = x self.left = left self.right = right class TrieNode(object): def __init__(self, end=False): self.children = [] for i in range(26): self.children.append(None) self.end = end def set_end(self): self.end = True @property def is_end(self): return self.end class RandomNode(object): def __init__(self, val, next, random): self.val = val self.next = next self.random = random class GraphNode(object): def __init__(self, val, neighbors): self.val = val self.neighbors = neighbors class QuadTreeNode(object): def __init__(self, val, is_leaf, top_left, top_right, bottom_left, bottom_right): self.val = val self.is_leaf = is_leaf self.top_left = top_left self.top_right = top_right self.bottom_left = bottom_left self.bottom_right = bottom_right
seen = [] # Prduces the length of the longest Substring # thats comprised of just unique characters def max_diff(string): seen = [0]*256 curr_start = 0 max_start = 0 unique = 0 max_unique = 0 for n,i in enumerate(string): if seen[assn_num(i)] == 0: unique += 1 else: if unique > max_unique: max_unique = unique while unique > 1: if seen[assn_num(string[curr_start])] == 1: unique -= 1 seen[assn_num(string[curr_start])] -= 1 curr_start += 1 else: seen[assn_num(string[curr_start])] -= 1 curr_start += 1 seen[assn_num(i)] += 1 if unique > max_unique: max_unique = unique return max_unique def assn_num(char): num = ord(char)-ord('a') return num
# package org.apache.helix.messaging.handling #from org.apache.helix.messaging.handling import * #from java.util import HashMap #from java.util import Map class HelixTaskResult: def __init__(self): self._success = False self._message = "" self._taskResultMap = {} self._interrupted = False self._exception = None def isSucess(self): """ Returns boolean """ return self._success def isInterrupted(self): """ Returns boolean """ return self._interrupted def setInterrupted(self, interrupted): """ Returns void Parameters: interrupted: boolean """ self._interrupted = interrupted def setSuccess(self, success): """ Returns void Parameters: success: boolean """ self._success = success def getMessage(self): """ Returns String """ return self._message def setMessage(self, message): """ Returns void Parameters: message: String """ self._message = message def getTaskResultMap(self): """ Returns Map<String, String> """ return self._taskResultMap def setException(self, e): """ Returns void Parameters: e: Exception """ self._exception = e def getException(self): """ Returns Exception """ return self._exception
def _test_sources_aspect_impl(target, ctx): result = depset() if hasattr(ctx.rule.attr, "tags") and "NODE_MODULE_MARKER" in ctx.rule.attr.tags: return struct(node_test_sources=result) if hasattr(ctx.rule.attr, "deps"): for dep in ctx.rule.attr.deps: if hasattr(dep, "node_test_sources"): result = depset(transitive=[result, dep.node_test_sources]) elif hasattr(target, "files"): result = depset([f for f in target.files.to_list() if f.path.endswith(".test.js")], transitive=[result]) return struct(node_test_sources=result) test_sources_aspect = aspect( _test_sources_aspect_impl, attr_aspects=["deps"], )
def is_prime(n): if n > 1: for i in range(2, n // 2 + 1): if (n % i) == 0: return False else: return True else: return False def fibonacci(n): n1, n2 = 1, 1 count = 0 if n == 1: print(n1) else: while count < n: if not is_prime(n1) and n1 % 5 != 0: print(n1, end=' ') else: print(0, end=' ') n3 = n1 + n2 n1 = n2 n2 = n3 count += 1 n = int(input("Enter the number:")) fibonacci(n)
###################################################################################### # Date: 2016/July/11 # # Module: module_2DScatter.py # # VERSION: 0.9 # # AUTHOR: Matt Thoburn ([email protected]); # edited by Miguel A. Ibarra-Arellano([email protected]) # # DESCRIPTION: This module contains a primary method (quickPlot) # and two depreciated methods which are not to be used # # makeScatter is to be called from other scripts which require a graph ####################################################################################### def scatter2D(ax,x,y,colorList,ec='black'): """ This function is to be called by makeScatter2D, creates a 2D scatter plot on a given axis with colors determined by the given colorHandler or an optional override :Arguments: :type ax: matplotlib Axis2D :param ax: Axis on which scatter plot will be drawn :type x: list of floats :param x: list of x values to be plotted :type y: list of floats :param y: list of y values to be plotted :type colorList: list :param colorList: list of colors to be used for plotting :type ec: str :param ec: Edge color for markers :Return: :type ax: Matplotlib Axis :param ax: axis with scatter plotted onto it """ ax.scatter(x,y,color=colorList,marker='o',s=50,edgecolors=ec) return ax def scatter3D(ax,x,y,z,colorList): """ This function is to be called by makeScatter3D, creates a 3D scatter plot on a given axis with colors determined by the given colorHandler. :Arguments: :type ax: matplotlib Axis3D :param ax: Axis on which scatter plot will be drawn :type x: list of floats :param x: list of x values to be plotted :type y: list of floats :param y: list of y values to be plotted :type z: list of floats :param z: list of z values to be plotted :type colorList: list :param colorList: list of colors to be used for plotting :Return: :type ax: Matplotlib Axis :param ax: axis with scatter plotted onto it """ ax.scatter(xs=x,ys=y,zs=z,c=colorList,marker='o',s=50,depthshade=False) return ax
class Solution: def maxProfit(self, prices: List[int]) -> int: running_min = prices[0] best_trans1 = [0] for p in prices[1:]: if p < running_min: running_min = p best_trans1.append(max(p - running_min, best_trans1[-1])) running_max = prices[-1] best = best_trans1.pop() best_trans2 = 0 for p in prices[:0:-1]: if p > running_max: running_max = p if running_max - p > best_trans2: best_trans2 = running_max - p trans1 = best_trans1.pop() if best_trans2 + trans1 > best: best = best_trans2 + trans1 return best
# -*- coding: utf-8 -*- """ Created on Wed Jan 30 16:46:12 2019 @author: Alexandre Janin """ """Exceptions raised by pypStag""" class PypStagError(Exception): """ Main class for all pypStag """ pass class PackageWarning(PypStagError): """Raised when a precise package is needed""" def __init__(self,pack): super().__init__('Error package import!\n'+\ '>> the following package is needed:'+pack) class NoFileError(PypStagError): """Raised when stagData.import find no file during the importation""" def __init__(self,directory,fname): super().__init__('Error on the input data !\n'+\ '>> The expected following file does not exist !\n'+\ ' | File requested: '+fname+'\n'+\ ' | On directory : '+directory) class StagTypeError(PypStagError): """Raised unexpected type""" def __init__(self,givenType,expectedType): super().__init__('Error on input type\n'+\ 'Unexpected type given: '+str(givenType)+'\n'+\ 'Expected type for input is: '+str(expectedType)) class InputGridGeometryError(PypStagError): """Raised when stagData.import have a wrong input geometry""" def __init__(self,geom): super().__init__('Error on the input geometry!\n'+\ "The proposed geometry '"+geom+"' is not contained in\n"+\ 'the allowed geometries supported by stagData object.') class CloudBuildIndexError(PypStagError): """Raised when stagCloudData have a wrong index input""" def __init__(self,geom): super().__init__('Error on the input index!\n'+\ "You have to set an 'indices' list or set a begining and end index and a file step.") class GridGeometryInDevError(PypStagError): """Raised when stagData.import have an unconform input geometry""" def __init__(self,geom): super().__init__('Error on the input geometry !\n'+\ "The input geometry '"+geom+"' is not suported now\n"+\ 'in the current version of pypStag... Be patient and take a coffee!') class FieldTypeInDevError(PypStagError): """Raised when stagData.import have an unknown fieldType not yet supported""" def __init__(self,fieldType): super().__init__('Error on the input stagData.fieldType !\n'+\ "The input fieldType '"+fieldType+"' is not supported now\n"+\ 'in the current versin of pypStag... Be patient and take a coffee !') class GridGeometryError(PypStagError): """Raised when the geometry of a stagData object is not the expected geometry""" def __init__(self,INgeom,EXgeom): super().__init__('Error on the input geometry !\n'+\ "The input geometry '"+INgeom+"' you chose during the construction\n"+\ 'of the StagData object is not the one expected here!\n'+\ 'Expected geometry corresponding to your input file: '+EXgeom) class VisuGridGeometryError(PypStagError): """Raised when the geometry of a stagData object is not the expected geometry for a visualization tool""" def __init__(self,INgeom,EXgeom): super().__init__('Error on the input geometry !\n'+\ "The input geometry '"+INgeom+"' of your StagData object is incoherent\n"+\ 'with the function you are using or its input parameters!\n'+\ 'Expected geometry: '+EXgeom) class GridInterpolationError(PypStagError): """Raised when unknown input for interpolation grid""" def __init__(self,interpGeom): super().__init__('Error on the proposed interpolation grid!\n'+\ "The selected grid geometry '"+interpGeom+"' is not supported\n"+\ 'for the moment or is wrong!') class fieldTypeError(PypStagError): """Raised unexpected field type""" def __init__(self,expectedFieldtype): super().__init__('Error on the StagData Field Type\n'+\ 'Unexpected value of StagData.fiedType\n'+\ 'StagData.fieldType must be here: '+expectedFieldtype) class SliceAxisError(PypStagError): """Raised when unknown axis is set in input""" def __init__(self,wrongaxis): super().__init__('Error in input axis!\n'+\ 'Unexpected value of axis: '+str(wrongaxis)) class IncoherentSliceAxisError(PypStagError): """Raised when incoherent axis is set in input, incoherent according to the grid geometry.""" def __init__(self,wrongaxis): super().__init__('Error in input axis!\n'+\ 'Incoherent value of axis: '+str(wrongaxis)+', with the grid geomtry:') class MetaFileInappropriateError(PypStagError): """Raised when the reader function of StagMetaData recieved an inappropriate file.""" def __init__(self,ftype,allowedType): super().__init__('Error on the input of the meta file reader!\n'+\ 'Inappropriate meta file in input.\n'+\ 'Type you entered: '+ftype+'\n'+\ 'Type must be in: \n'+\ str(allowedType)) class MetaCheckFieldUnknownError(PypStagError): """Raised when the reader function of StagMetaData recieved an inappropriate file.""" def __init__(self,field,allowedFields): super().__init__('Error on the input field of the StagMetaData.check() function\n'+\ 'Unknown field: '+field+'\n'+\ 'The input field must be in: \n'+\ str(allowedFields))
version = "dev 0.0" running = False def init(): global running if not running: print("JFUtils-python \"" + version + "\" by jonnelafin") running = True
"""Utility functions not closely tied to other spec_tools types.""" # Copyright (c) 2018-2019 Collabora, Ltd. # Copyright (c) 2013-2019 The Khronos Group Inc. # # 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 getElemName(elem, default=None): """Get the name associated with an element, either a name child or name attribute.""" name_elem = elem.find('name') if name_elem is not None: return name_elem.text # Fallback if there is no child. return elem.get('name', default) def getElemType(elem, default=None): """Get the type associated with an element, either a type child or type attribute.""" type_elem = elem.find('type') if type_elem is not None: return type_elem.text # Fallback if there is no child. return elem.get('type', default) def _conditional_string_strip_append(my_list, optional_str): if not optional_str: return stripped = optional_str.strip() if not stripped: return my_list.append(stripped) def getParamOrMemberFullType(elem, default=None): """Get the full type associated with a member or param element. This includes the text preceding, within, and following the 'type' tag.""" parts = [] for node in elem.iter(): _conditional_string_strip_append(parts, node.text) _conditional_string_strip_append(parts, node.tail) if node.tag == 'type': return ' '.join(parts) # Fallback if there is no child with a "type" tag return default def findFirstWithPredicate(collection, pred): """Return the first element that satisfies the predicate, or None if none exist. NOTE: Some places where this is used might be better served by changing to a dictionary. """ for elt in collection: if pred(elt): return elt return None def findNamedElem(elems, name): """Traverse a collection of elements with 'name' nodes or attributes, looking for and returning one with the right name. NOTE: Many places where this is used might be better served by changing to a dictionary. """ return findFirstWithPredicate(elems, lambda elem: getElemName(elem) == name) def findTypedElem(elems, typename): """Traverse a collection of elements with 'type' nodes or attributes, looking for and returning one with the right typename. NOTE: Many places where this is used might be better served by changing to a dictionary. """ return findFirstWithPredicate(elems, lambda elem: getElemType(elem) == typename) def findNamedObject(collection, name): """Traverse a collection of elements with 'name' attributes, looking for and returning one with the right name. NOTE: Many places where this is used might be better served by changing to a dictionary. """ return findFirstWithPredicate(collection, lambda elt: elt.name == name)
class FiniteAutomataState: def __init__(self, structure): self.states = [] self.alphabet = [] self.initial = [] self.finals = [] self.transitions = {} self._file = open(structure, "r") self._load() # print(self.validate()) def _load(self): reading = "none" reading = "none" line = self._file.readline() def classify(mode, probe): if mode == "states": spec = probe.split(', ') self.states.extend(spec) elif mode == "initial": spec = probe.split(', ') self.initial.extend(spec) elif mode == "alpha": spec = probe.split(', ') self.alphabet.extend(spec) elif mode == "trans": values = probe.split(", ") if (values[0], values[1]) in self.transitions.keys(): self.transitions[(values[0], values[1])].append(values[2]) else: self.transitions[(values[0], values[1])] = [values[2]] elif mode == "final": tokens = probe.split(", ") self.finals.extend(tokens) while line: if line.strip()[0] == '#': reading = line.strip()[1:] else: classify(reading, line.strip()) line = self._file.readline() def validate(self): if self.initial[0] not in self.states: return False for final in self.finals: if final not in self.states: return False for key in self.transitions.keys(): state = key[0] symbol = key[1] if state not in self.states or symbol not in self.alphabet: return False for dest in self.transitions[key]: if dest not in self.states: return False return True def dfa(self): for key in self.transitions.keys(): if len(self.transitions[key]) > 1: return False return True def accepted(self, sequence): if self.dfa(): crt = self.initial[0] for symbol in sequence: if (crt, symbol) in self.transitions.keys(): crt = self.transitions[(crt, symbol)][0] else: return False return crt in self.finals return False
#!/usr/bin/python compteur = 0 i,j = 3,1 terrain = [] fichier = open('day3_input.txt') for l in fichier: terrain.append(fichier.readline().strip('\n')) nblig = len(terrain) nbcol = len(terrain[0]) print('nblig : %s / nbcol : %s' % (nblig,nbcol)) for f in terrain: print(f) while j<nblig: #print(i,j,terrain[j][i],compteur) if terrain[j][i] == '#': compteur = compteur +1 print(terrain[j][0:i-1]+'X'+terrain[j][i+1:nbcol-1]) else: print(terrain[j][0:i-1]+'O'+terrain[j][i+1:nbcol-1]) i = (i+3)%nbcol j = j+1 print(compteur)