content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
ENDPOINTS = { 'auction': '/auctions/{auction_id}', 'contract': '/auctions/{auction_id}/contracts/{contract_id}', 'contracts': '/auctions/{auction_id}/contracts', 'item': '/auctions/{auction_id}/items/{item_id}', 'items': '/auctions/{auction_id}/items', }
endpoints = {'auction': '/auctions/{auction_id}', 'contract': '/auctions/{auction_id}/contracts/{contract_id}', 'contracts': '/auctions/{auction_id}/contracts', 'item': '/auctions/{auction_id}/items/{item_id}', 'items': '/auctions/{auction_id}/items'}
__version__ = '1.0.0' __author__ = 'Steven Huang' __all__ = ["file", "basic", "geo_math", "geo_transformation"]
__version__ = '1.0.0' __author__ = 'Steven Huang' __all__ = ['file', 'basic', 'geo_math', 'geo_transformation']
#!/usr/bin/env python # coding: utf-8 # In[ ]: n = int(input()) for i in range(1, n+1): if i % 2 == 0: print('{}^2 = {}'.format(i, i**2))
n = int(input()) for i in range(1, n + 1): if i % 2 == 0: print('{}^2 = {}'.format(i, i ** 2))
# Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn. num = int(input("Input an integer : ")) n1 = int( "%s" % num ) n2 = int( "%s%s" % (num,num) ) n3 = int( "%s%s%s" % (num,num,num) ) print (n1+n2+n3)
num = int(input('Input an integer : ')) n1 = int('%s' % num) n2 = int('%s%s' % (num, num)) n3 = int('%s%s%s' % (num, num, num)) print(n1 + n2 + n3)
''' example of models and GPU distribution sampler. To run models demo, you need to download data files 'mnist_gray.mat'&'TREC.pkl' and put it under pydpm.example.data data url: https://1drv.ms/u/s!AlkDawhaUUBWtHRWuNESEdOsDz7V?e=LQlGLW '''
""" example of models and GPU distribution sampler. To run models demo, you need to download data files 'mnist_gray.mat'&'TREC.pkl' and put it under pydpm.example.data data url: https://1drv.ms/u/s!AlkDawhaUUBWtHRWuNESEdOsDz7V?e=LQlGLW """
class DefaultConfig(object): DEBUG = False TESTING = False class TestConfig(DefaultConfig): TESTING = True class DebugConfig(DefaultConfig): DEBUG = True
class Defaultconfig(object): debug = False testing = False class Testconfig(DefaultConfig): testing = True class Debugconfig(DefaultConfig): debug = True
def mac2ipv6(mac): # only accept MACs separated by a colon parts = mac.split(":") # modify parts to match IPv6 value parts.insert(3, "ff") parts.insert(4, "fe") parts[0] = "%x" % (int(parts[0], 16) ^ 2) # format output ipv6Parts = [] for i in range(0, len(parts), 2): ipv6Parts.append("".join(parts[i:i+2])) ipv6 = "fe80::%s/64" % (":".join(ipv6Parts)) return ipv6 def ipv62mac(ipv6): # remove subnet info if given subnetIndex = ipv6.find("/") if subnetIndex != -1: ipv6 = ipv6[:subnetIndex] ipv6Parts = ipv6.split(":") macParts = [] for ipv6Part in ipv6Parts[-4:]: while len(ipv6Part) < 4: ipv6Part = "0" + ipv6Part macParts.append(ipv6Part[:2]) macParts.append(ipv6Part[-2:]) # modify parts to match MAC value macParts[0] = "%02x" % (int(macParts[0], 16) ^ 2) del macParts[4] del macParts[3] return ":".join(macParts) # print(mac2ipv6('80:4a:14:69:b1:5d')) print(ipv62mac('fe80::417:2066:cc4f:eff9')) # 1e:4c:54:a4:5a:77 # 80:4a:14:69:b1:5d
def mac2ipv6(mac): parts = mac.split(':') parts.insert(3, 'ff') parts.insert(4, 'fe') parts[0] = '%x' % (int(parts[0], 16) ^ 2) ipv6_parts = [] for i in range(0, len(parts), 2): ipv6Parts.append(''.join(parts[i:i + 2])) ipv6 = 'fe80::%s/64' % ':'.join(ipv6Parts) return ipv6 def ipv62mac(ipv6): subnet_index = ipv6.find('/') if subnetIndex != -1: ipv6 = ipv6[:subnetIndex] ipv6_parts = ipv6.split(':') mac_parts = [] for ipv6_part in ipv6Parts[-4:]: while len(ipv6Part) < 4: ipv6_part = '0' + ipv6Part macParts.append(ipv6Part[:2]) macParts.append(ipv6Part[-2:]) macParts[0] = '%02x' % (int(macParts[0], 16) ^ 2) del macParts[4] del macParts[3] return ':'.join(macParts) print(ipv62mac('fe80::417:2066:cc4f:eff9'))
class Error(Exception): pass class WrappedError(Error): BASE_MESSAGE = 'WrappedError' def __init__(self, *args, origin_error=None, **kwargs): self._origin_error = origin_error if self._origin_error: message = self.BASE_MESSAGE + ': ' + str(self._origin_error) else: message = self.BASE_MESSAGE super().__init__(message, *args, **kwargs) class ConnectError(WrappedError): ''' errors when connect to database ''' BASE_MESSAGE = 'ConnectError' class UnexpectedError(WrappedError): ''' uncategorized errors ''' BASE_MESSAGE = 'UnexpectedError' class OperationFailure(WrappedError): ''' errors like timeout, mysql gone away, retriable ''' BASE_MESSAGE = 'OperationFailure' class ProgrammingError(WrappedError): BASE_MESSAGE = 'ProgrammingError' class DuplicateKeyError(Error): pass
class Error(Exception): pass class Wrappederror(Error): base_message = 'WrappedError' def __init__(self, *args, origin_error=None, **kwargs): self._origin_error = origin_error if self._origin_error: message = self.BASE_MESSAGE + ': ' + str(self._origin_error) else: message = self.BASE_MESSAGE super().__init__(message, *args, **kwargs) class Connecterror(WrappedError): """ errors when connect to database """ base_message = 'ConnectError' class Unexpectederror(WrappedError): """ uncategorized errors """ base_message = 'UnexpectedError' class Operationfailure(WrappedError): """ errors like timeout, mysql gone away, retriable """ base_message = 'OperationFailure' class Programmingerror(WrappedError): base_message = 'ProgrammingError' class Duplicatekeyerror(Error): pass
def convert_iso_to_json(dateString): tempDateObject = dateString.split("-") return { "year": tempDateObject[0], "month": tempDateObject[1], "day": tempDateObject[2] } def convert_json_to_iso(json): return "{0}-{1}-{2}".format(int(json['year']), int(json['month']), int(json['day']))
def convert_iso_to_json(dateString): temp_date_object = dateString.split('-') return {'year': tempDateObject[0], 'month': tempDateObject[1], 'day': tempDateObject[2]} def convert_json_to_iso(json): return '{0}-{1}-{2}'.format(int(json['year']), int(json['month']), int(json['day']))
# # PySNMP MIB module WWP-LEOS-USER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-USER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:38:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, Counter64, iso, ModuleIdentity, Bits, TimeTicks, IpAddress, MibIdentifier, Integer32, Unsigned32, Gauge32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Counter64", "iso", "ModuleIdentity", "Bits", "TimeTicks", "IpAddress", "MibIdentifier", "Integer32", "Unsigned32", "Gauge32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity") TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString") wwpModulesLeos, = mibBuilder.importSymbols("WWP-SMI", "wwpModulesLeos") wwpLeosUserMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39)) wwpLeosUserMIB.setRevisions(('2012-07-11 00:00', '2012-06-27 00:00', '2011-07-06 00:00', '2007-03-01 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: wwpLeosUserMIB.setRevisionsDescriptions(('Changed the definitions of the wwpLeosUserPrivLevel values to match those used internally and at the CLI.', 'Corrected string lengths.', ' Added a new object wwpLeosUserAuthProviderScope.', 'Initial creation.',)) if mibBuilder.loadTexts: wwpLeosUserMIB.setLastUpdated('201207110000Z') if mibBuilder.loadTexts: wwpLeosUserMIB.setOrganization('Ciena, Inc') if mibBuilder.loadTexts: wwpLeosUserMIB.setContactInfo(' Mib Meister 115 North Sullivan Road Spokane Valley, WA 99037 USA Phone: +1 509 242 9000 Email: support@ciena.com') if mibBuilder.loadTexts: wwpLeosUserMIB.setDescription('This MIB module defines the generic managed objects for User Information on WWP devices.') wwpLeosUserMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1)) wwpLeosUser = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1)) wwpLeosUserMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 2)) wwpLeosUserMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 2, 0)) wwpLeosUserMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3)) wwpLeosUserMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3, 1)) wwpLeosUserMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3, 2)) wwpLeosUserAuthProviderTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1), ) if mibBuilder.loadTexts: wwpLeosUserAuthProviderTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderTable.setDescription('Table of UserAuth Providers.') wwpLeosUserAuthProviderEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1), ).setIndexNames((0, "WWP-LEOS-USER-MIB", "wwpLeosUserAuthProviderPriority")) if mibBuilder.loadTexts: wwpLeosUserAuthProviderEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderEntry.setDescription('An entry for each User Authorization Provider.') wwpLeosUserAuthProviderPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))) if mibBuilder.loadTexts: wwpLeosUserAuthProviderPriority.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderPriority.setDescription('The priority of this user authentication provider.') wwpLeosUserAuthProviderType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("local", 2), ("radius", 3), ("tacacs", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderType.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderType.setDescription("The type/method of this user authentication provider. At least one entry must be a provider other than 'none' and any given provider may not be used twice. When a provider is changed to 'none', lower priority providers will have their priority increased to close the gap.") wwpLeosUserAuthProviderCalled = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 3), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderCalled.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderCalled.setDescription('The number of calls to this user authentication provider. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwpLeosUserAuthProviderSuccess = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderSuccess.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSuccess.setDescription('The number of times this user authentication provider returned a Success response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwpLeosUserAuthProviderFailure = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderFailure.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderFailure.setDescription('The number of times this user authentication provider returned a Failure response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwpLeosUserAuthProviderSkipped = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 6), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderSkipped.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSkipped.setDescription('The number of times this user authentication provider returned a Skip Me response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwpLeosUserAuthProviderScope = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("serial", 1), ("remote", 2), ("all", 3))).clone('all')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserAuthProviderScope.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderScope.setDescription('The scope to be used for each authentication method.') wwpLeosUserWhoTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2), ) if mibBuilder.loadTexts: wwpLeosUserWhoTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoTable.setDescription('Table of logged in users.') wwpLeosUserWhoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1), ).setIndexNames((0, "WWP-LEOS-USER-MIB", "wwpLeosUserWhoPid")) if mibBuilder.loadTexts: wwpLeosUserWhoEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoEntry.setDescription('An entry for each logged in user.') wwpLeosUserWhoPid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 1), Unsigned32()) if mibBuilder.loadTexts: wwpLeosUserWhoPid.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoPid.setDescription('The pid of the users shell process.') wwpLeosUserWhoUser = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosUserWhoUser.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoUser.setDescription('The username used during login authentication.') wwpLeosUserWhoTerminal = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosUserWhoTerminal.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoTerminal.setDescription('The terminal the user logged in from.') wwpLeosUserWhoIdleTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosUserWhoIdleTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoIdleTime.setDescription('The users idle time in minutes. This counter is reset to zero when ever the shell process detects input from the user.') wwpLeosUserWhoStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 5), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosUserWhoStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoStatus.setDescription("Status of the users shell process. To kill a users shell, set this object to 'Destroy'.") wwpLeosUserTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3), ) if mibBuilder.loadTexts: wwpLeosUserTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserTable.setDescription('Table of locally configured users.') wwpLeosUserEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1), ).setIndexNames((0, "WWP-LEOS-USER-MIB", "wwpLeosUserUid")) if mibBuilder.loadTexts: wwpLeosUserEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserEntry.setDescription('An entry for each user in the local password file.') wwpLeosUserUid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: wwpLeosUserUid.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserUid.setDescription('The numeric userid of the user. These numbers are generated by the device in order to making indexing the table easy, but they are not tied to specific user names during a reboot. When a new user is created, the userid must be an unused value.') wwpLeosUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosUserName.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserName.setDescription('The name of the user.') wwpLeosUserPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 34))).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosUserPassword.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserPassword.setDescription('The users password in encrypted form. When setting this object you must set wwpLeosUserIsEncrypted at the same time in order to specify whether the password you are setting needs to be encrypted by the device or whether you have already encrypted it.') wwpLeosUserPrivLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 0), ("limited", 1), ("admin", 2), ("super", 3), ("diag", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosUserPrivLevel.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserPrivLevel.setDescription('The privilege level of the user.') wwpLeosUserIsDefault = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 5), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosUserIsDefault.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsDefault.setDescription('When this is set to True, the user is one of the default users created in the device at boot time.') wwpLeosUserIsEncrypted = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 6), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosUserIsEncrypted.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsEncrypted.setDescription('This will always be True on a Get as the password is always stored locally on the device in encrypted form. During a Set, it is False if you are sending wwpLeosUserPassword in the clear so the device can encrypt it, or True if wwpLeosUserPassword is already in encrypted MD5 form.') wwpLeosUserIsModified = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 7), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosUserIsModified.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsModified.setDescription('When this is set to True, the user is one of the default users created in the device, but one or more properties of the user account has been altered from the default values.') wwpLeosUserStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosUserStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserStatus.setDescription('Use CreateAndGo to create a new user, Destroy to remove a user.') mibBuilder.exportSymbols("WWP-LEOS-USER-MIB", wwpLeosUserWhoEntry=wwpLeosUserWhoEntry, wwpLeosUserPrivLevel=wwpLeosUserPrivLevel, wwpLeosUserMIBCompliances=wwpLeosUserMIBCompliances, wwpLeosUserTable=wwpLeosUserTable, wwpLeosUserIsModified=wwpLeosUserIsModified, wwpLeosUserAuthProviderEntry=wwpLeosUserAuthProviderEntry, wwpLeosUserMIBGroups=wwpLeosUserMIBGroups, wwpLeosUserMIBConformance=wwpLeosUserMIBConformance, wwpLeosUserMIBObjects=wwpLeosUserMIBObjects, wwpLeosUserWhoPid=wwpLeosUserWhoPid, wwpLeosUserUid=wwpLeosUserUid, wwpLeosUserStatus=wwpLeosUserStatus, wwpLeosUserWhoUser=wwpLeosUserWhoUser, wwpLeosUserAuthProviderTable=wwpLeosUserAuthProviderTable, wwpLeosUserMIB=wwpLeosUserMIB, wwpLeosUserName=wwpLeosUserName, wwpLeosUserAuthProviderSuccess=wwpLeosUserAuthProviderSuccess, wwpLeosUserAuthProviderCalled=wwpLeosUserAuthProviderCalled, wwpLeosUserAuthProviderPriority=wwpLeosUserAuthProviderPriority, wwpLeosUserIsDefault=wwpLeosUserIsDefault, wwpLeosUser=wwpLeosUser, wwpLeosUserWhoIdleTime=wwpLeosUserWhoIdleTime, wwpLeosUserPassword=wwpLeosUserPassword, wwpLeosUserWhoTerminal=wwpLeosUserWhoTerminal, wwpLeosUserMIBNotifications=wwpLeosUserMIBNotifications, wwpLeosUserWhoStatus=wwpLeosUserWhoStatus, wwpLeosUserAuthProviderScope=wwpLeosUserAuthProviderScope, wwpLeosUserEntry=wwpLeosUserEntry, wwpLeosUserAuthProviderFailure=wwpLeosUserAuthProviderFailure, wwpLeosUserAuthProviderType=wwpLeosUserAuthProviderType, wwpLeosUserAuthProviderSkipped=wwpLeosUserAuthProviderSkipped, PYSNMP_MODULE_ID=wwpLeosUserMIB, wwpLeosUserIsEncrypted=wwpLeosUserIsEncrypted, wwpLeosUserMIBNotificationPrefix=wwpLeosUserMIBNotificationPrefix, wwpLeosUserWhoTable=wwpLeosUserWhoTable)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter32, counter64, iso, module_identity, bits, time_ticks, ip_address, mib_identifier, integer32, unsigned32, gauge32, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Counter64', 'iso', 'ModuleIdentity', 'Bits', 'TimeTicks', 'IpAddress', 'MibIdentifier', 'Integer32', 'Unsigned32', 'Gauge32', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity') (textual_convention, truth_value, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'RowStatus', 'DisplayString') (wwp_modules_leos,) = mibBuilder.importSymbols('WWP-SMI', 'wwpModulesLeos') wwp_leos_user_mib = module_identity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39)) wwpLeosUserMIB.setRevisions(('2012-07-11 00:00', '2012-06-27 00:00', '2011-07-06 00:00', '2007-03-01 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: wwpLeosUserMIB.setRevisionsDescriptions(('Changed the definitions of the wwpLeosUserPrivLevel values to match those used internally and at the CLI.', 'Corrected string lengths.', ' Added a new object wwpLeosUserAuthProviderScope.', 'Initial creation.')) if mibBuilder.loadTexts: wwpLeosUserMIB.setLastUpdated('201207110000Z') if mibBuilder.loadTexts: wwpLeosUserMIB.setOrganization('Ciena, Inc') if mibBuilder.loadTexts: wwpLeosUserMIB.setContactInfo(' Mib Meister 115 North Sullivan Road Spokane Valley, WA 99037 USA Phone: +1 509 242 9000 Email: support@ciena.com') if mibBuilder.loadTexts: wwpLeosUserMIB.setDescription('This MIB module defines the generic managed objects for User Information on WWP devices.') wwp_leos_user_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1)) wwp_leos_user = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1)) wwp_leos_user_mib_notification_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 2)) wwp_leos_user_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 2, 0)) wwp_leos_user_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3)) wwp_leos_user_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3, 1)) wwp_leos_user_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 3, 2)) wwp_leos_user_auth_provider_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1)) if mibBuilder.loadTexts: wwpLeosUserAuthProviderTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderTable.setDescription('Table of UserAuth Providers.') wwp_leos_user_auth_provider_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1)).setIndexNames((0, 'WWP-LEOS-USER-MIB', 'wwpLeosUserAuthProviderPriority')) if mibBuilder.loadTexts: wwpLeosUserAuthProviderEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderEntry.setDescription('An entry for each User Authorization Provider.') wwp_leos_user_auth_provider_priority = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))) if mibBuilder.loadTexts: wwpLeosUserAuthProviderPriority.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderPriority.setDescription('The priority of this user authentication provider.') wwp_leos_user_auth_provider_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('local', 2), ('radius', 3), ('tacacs', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderType.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderType.setDescription("The type/method of this user authentication provider. At least one entry must be a provider other than 'none' and any given provider may not be used twice. When a provider is changed to 'none', lower priority providers will have their priority increased to close the gap.") wwp_leos_user_auth_provider_called = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 3), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderCalled.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderCalled.setDescription('The number of calls to this user authentication provider. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwp_leos_user_auth_provider_success = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 4), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSuccess.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSuccess.setDescription('The number of times this user authentication provider returned a Success response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwp_leos_user_auth_provider_failure = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 5), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderFailure.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderFailure.setDescription('The number of times this user authentication provider returned a Failure response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwp_leos_user_auth_provider_skipped = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 6), unsigned32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSkipped.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderSkipped.setDescription('The number of times this user authentication provider returned a Skip Me response. The counter is cleared automatically when AuthProviderType is changed or may be cleared manually.') wwp_leos_user_auth_provider_scope = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('none', 0), ('serial', 1), ('remote', 2), ('all', 3))).clone('all')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserAuthProviderScope.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserAuthProviderScope.setDescription('The scope to be used for each authentication method.') wwp_leos_user_who_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2)) if mibBuilder.loadTexts: wwpLeosUserWhoTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoTable.setDescription('Table of logged in users.') wwp_leos_user_who_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1)).setIndexNames((0, 'WWP-LEOS-USER-MIB', 'wwpLeosUserWhoPid')) if mibBuilder.loadTexts: wwpLeosUserWhoEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoEntry.setDescription('An entry for each logged in user.') wwp_leos_user_who_pid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 1), unsigned32()) if mibBuilder.loadTexts: wwpLeosUserWhoPid.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoPid.setDescription('The pid of the users shell process.') wwp_leos_user_who_user = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosUserWhoUser.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoUser.setDescription('The username used during login authentication.') wwp_leos_user_who_terminal = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosUserWhoTerminal.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoTerminal.setDescription('The terminal the user logged in from.') wwp_leos_user_who_idle_time = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosUserWhoIdleTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoIdleTime.setDescription('The users idle time in minutes. This counter is reset to zero when ever the shell process detects input from the user.') wwp_leos_user_who_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 2, 1, 5), row_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosUserWhoStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserWhoStatus.setDescription("Status of the users shell process. To kill a users shell, set this object to 'Destroy'.") wwp_leos_user_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3)) if mibBuilder.loadTexts: wwpLeosUserTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserTable.setDescription('Table of locally configured users.') wwp_leos_user_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1)).setIndexNames((0, 'WWP-LEOS-USER-MIB', 'wwpLeosUserUid')) if mibBuilder.loadTexts: wwpLeosUserEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserEntry.setDescription('An entry for each user in the local password file.') wwp_leos_user_uid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 1), unsigned32()) if mibBuilder.loadTexts: wwpLeosUserUid.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserUid.setDescription('The numeric userid of the user. These numbers are generated by the device in order to making indexing the table easy, but they are not tied to specific user names during a reboot. When a new user is created, the userid must be an unused value.') wwp_leos_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosUserName.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserName.setDescription('The name of the user.') wwp_leos_user_password = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 34))).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosUserPassword.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserPassword.setDescription('The users password in encrypted form. When setting this object you must set wwpLeosUserIsEncrypted at the same time in order to specify whether the password you are setting needs to be encrypted by the device or whether you have already encrypted it.') wwp_leos_user_priv_level = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4))).clone(namedValues=named_values(('none', 0), ('limited', 1), ('admin', 2), ('super', 3), ('diag', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosUserPrivLevel.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserPrivLevel.setDescription('The privilege level of the user.') wwp_leos_user_is_default = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 5), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosUserIsDefault.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsDefault.setDescription('When this is set to True, the user is one of the default users created in the device at boot time.') wwp_leos_user_is_encrypted = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 6), truth_value()).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosUserIsEncrypted.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsEncrypted.setDescription('This will always be True on a Get as the password is always stored locally on the device in encrypted form. During a Set, it is False if you are sending wwpLeosUserPassword in the clear so the device can encrypt it, or True if wwpLeosUserPassword is already in encrypted MD5 form.') wwp_leos_user_is_modified = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 7), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosUserIsModified.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserIsModified.setDescription('When this is set to True, the user is one of the default users created in the device, but one or more properties of the user account has been altered from the default values.') wwp_leos_user_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 39, 1, 1, 3, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosUserStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosUserStatus.setDescription('Use CreateAndGo to create a new user, Destroy to remove a user.') mibBuilder.exportSymbols('WWP-LEOS-USER-MIB', wwpLeosUserWhoEntry=wwpLeosUserWhoEntry, wwpLeosUserPrivLevel=wwpLeosUserPrivLevel, wwpLeosUserMIBCompliances=wwpLeosUserMIBCompliances, wwpLeosUserTable=wwpLeosUserTable, wwpLeosUserIsModified=wwpLeosUserIsModified, wwpLeosUserAuthProviderEntry=wwpLeosUserAuthProviderEntry, wwpLeosUserMIBGroups=wwpLeosUserMIBGroups, wwpLeosUserMIBConformance=wwpLeosUserMIBConformance, wwpLeosUserMIBObjects=wwpLeosUserMIBObjects, wwpLeosUserWhoPid=wwpLeosUserWhoPid, wwpLeosUserUid=wwpLeosUserUid, wwpLeosUserStatus=wwpLeosUserStatus, wwpLeosUserWhoUser=wwpLeosUserWhoUser, wwpLeosUserAuthProviderTable=wwpLeosUserAuthProviderTable, wwpLeosUserMIB=wwpLeosUserMIB, wwpLeosUserName=wwpLeosUserName, wwpLeosUserAuthProviderSuccess=wwpLeosUserAuthProviderSuccess, wwpLeosUserAuthProviderCalled=wwpLeosUserAuthProviderCalled, wwpLeosUserAuthProviderPriority=wwpLeosUserAuthProviderPriority, wwpLeosUserIsDefault=wwpLeosUserIsDefault, wwpLeosUser=wwpLeosUser, wwpLeosUserWhoIdleTime=wwpLeosUserWhoIdleTime, wwpLeosUserPassword=wwpLeosUserPassword, wwpLeosUserWhoTerminal=wwpLeosUserWhoTerminal, wwpLeosUserMIBNotifications=wwpLeosUserMIBNotifications, wwpLeosUserWhoStatus=wwpLeosUserWhoStatus, wwpLeosUserAuthProviderScope=wwpLeosUserAuthProviderScope, wwpLeosUserEntry=wwpLeosUserEntry, wwpLeosUserAuthProviderFailure=wwpLeosUserAuthProviderFailure, wwpLeosUserAuthProviderType=wwpLeosUserAuthProviderType, wwpLeosUserAuthProviderSkipped=wwpLeosUserAuthProviderSkipped, PYSNMP_MODULE_ID=wwpLeosUserMIB, wwpLeosUserIsEncrypted=wwpLeosUserIsEncrypted, wwpLeosUserMIBNotificationPrefix=wwpLeosUserMIBNotificationPrefix, wwpLeosUserWhoTable=wwpLeosUserWhoTable)
REGISTERED_PLATFORMS = {} def register_class(cls): REGISTERED_PLATFORMS[cls.BASENAME] = cls return cls
registered_platforms = {} def register_class(cls): REGISTERED_PLATFORMS[cls.BASENAME] = cls return cls
# sito eratostenesa def sito(num): x = 2 tab = [False, False] + [True for i in range(x, num+1)] while x * x <= num: if tab[x]: for i in range(x*x, num+1, x): tab[i] = False x += 1 else: x += 1 return tab if __name__ == '__main__': num = int(input('podaj liczbe: ')) tab = sito(num) for x in range(len(tab)): print(x, tab[x])
def sito(num): x = 2 tab = [False, False] + [True for i in range(x, num + 1)] while x * x <= num: if tab[x]: for i in range(x * x, num + 1, x): tab[i] = False x += 1 else: x += 1 return tab if __name__ == '__main__': num = int(input('podaj liczbe: ')) tab = sito(num) for x in range(len(tab)): print(x, tab[x])
# Copyright 2017 The Bazel Authors. All rights reserved. # # 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. load( "@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", ) load( "@bazel_gazelle//internal:go_repository.bzl", _go_repository = "go_repository", ) load( "@bazel_gazelle//internal:go_repository_cache.bzl", "go_repository_cache", ) load( "@bazel_gazelle//internal:go_repository_tools.bzl", "go_repository_tools", ) load( "@bazel_gazelle//internal:go_repository_config.bzl", "go_repository_config", ) # Re-export go_repository . Users should get it from this file. go_repository = _go_repository def gazelle_dependencies( go_sdk = "", go_repository_default_config = "@//:WORKSPACE", go_env = {}): _maybe( git_repository, name = "bazel_skylib", commit = "df3c9e2735f02a7fe8cd80db4db00fec8e13d25f", # `master` as of 2021-08-19 remote = "https://github.com/bazelbuild/bazel-skylib", ) if go_sdk: go_repository_cache( name = "bazel_gazelle_go_repository_cache", go_sdk_name = go_sdk, go_env = go_env, ) else: go_sdk_info = {} for name, r in native.existing_rules().items(): # match internal rule names but don't reference them directly. # New rules may be added in the future, and they might be # renamed (_go_download_sdk => go_download_sdk). if name != "go_sdk" and ("go_" not in r["kind"] or "_sdk" not in r["kind"]): continue if r.get("goos", "") and r.get("goarch", ""): platform = r["goos"] + "_" + r["goarch"] else: platform = "host" go_sdk_info[name] = platform go_repository_cache( name = "bazel_gazelle_go_repository_cache", go_sdk_info = go_sdk_info, go_env = go_env, ) go_repository_tools( name = "bazel_gazelle_go_repository_tools", go_cache = "@bazel_gazelle_go_repository_cache//:go.env", ) go_repository_config( name = "bazel_gazelle_go_repository_config", config = go_repository_default_config, ) _maybe( go_repository, name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=", version = "v0.0.0-20190523083050-ea95bdfd59fc", ) _maybe( go_repository, name = "com_github_bazelbuild_buildtools", importpath = "github.com/bazelbuild/buildtools", sum = "h1:VMFMISXa1RypQNG0j4KVCbsUcrxFudkY/IvWzEJCyO8=", version = "v0.0.0-20211007154642-8dd79e56e98e", build_naming_convention = "go_default_library", ) _maybe( go_repository, name = "com_github_bazelbuild_rules_go", importpath = "github.com/bazelbuild/rules_go", sum = "h1:SfxjyO/V68rVnzOHop92fB0gv/Aa75KNLAN0PMqXbIw=", version = "v0.29.0", ) _maybe( go_repository, name = "com_github_bmatcuk_doublestar", importpath = "github.com/bmatcuk/doublestar", sum = "h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=", version = "v1.3.4", ) _maybe( go_repository, name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", version = "v0.3.1", ) _maybe( go_repository, name = "com_github_census_instrumentation_opencensus_proto", importpath = "github.com/census-instrumentation/opencensus-proto", sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=", version = "v0.2.1", ) _maybe( go_repository, name = "com_github_chzyer_logex", importpath = "github.com/chzyer/logex", sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", version = "v1.1.10", ) _maybe( go_repository, name = "com_github_chzyer_readline", importpath = "github.com/chzyer/readline", sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", version = "v0.0.0-20180603132655-2972be24d48e", ) _maybe( go_repository, name = "com_github_chzyer_test", importpath = "github.com/chzyer/test", sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", version = "v0.0.0-20180213035817-a1ea475d72b1", ) _maybe( go_repository, name = "com_github_client9_misspell", importpath = "github.com/client9/misspell", sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) _maybe( go_repository, name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", version = "v1.1.1", ) _maybe( go_repository, name = "com_github_envoyproxy_go_control_plane", importpath = "github.com/envoyproxy/go-control-plane", sum = "h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=", version = "v0.9.1-0.20191026205805-5f8ba28d4473", ) _maybe( go_repository, name = "com_github_envoyproxy_protoc_gen_validate", importpath = "github.com/envoyproxy/protoc-gen-validate", sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=", version = "v0.1.0", ) _maybe( go_repository, name = "com_github_fsnotify_fsnotify", importpath = "github.com/fsnotify/fsnotify", sum = "h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=", version = "v1.5.1", ) _maybe( go_repository, name = "com_github_golang_glog", importpath = "github.com/golang/glog", sum = "h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=", version = "v0.0.0-20160126235308-23def4e6c14b", ) _maybe( go_repository, name = "com_github_golang_mock", importpath = "github.com/golang/mock", sum = "h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=", version = "v1.1.1", ) _maybe( go_repository, name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", sum = "h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=", version = "v1.4.3", ) _maybe( go_repository, name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", sum = "h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=", version = "v0.5.6", ) _maybe( go_repository, name = "com_github_pelletier_go_toml", importpath = "github.com/pelletier/go-toml", sum = "h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=", version = "v1.9.4", ) _maybe( go_repository, name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", version = "v1.0.0", ) _maybe( go_repository, name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=", version = "v0.0.0-20190812154241-14fe0d1b01d4", ) _maybe( go_repository, name = "com_github_yuin_goldmark", importpath = "github.com/yuin/goldmark", sum = "h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ=", version = "v1.4.0", ) _maybe( go_repository, name = "com_google_cloud_go", importpath = "cloud.google.com/go", sum = "h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=", version = "v0.26.0", ) _maybe( go_repository, name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", version = "v0.0.0-20161208181325-20d25e280405", ) _maybe( go_repository, name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", sum = "h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=", version = "v2.2.2", ) _maybe( go_repository, name = "net_starlark_go", importpath = "go.starlark.net", sum = "h1:xwwDQW5We85NaTk2APgoN9202w/l0DVGp+GZMfsrh7s=", version = "v0.0.0-20210223155950-e043a3d3c984", ) _maybe( go_repository, name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", sum = "h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=", version = "v1.4.0", ) _maybe( go_repository, name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", sum = "h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=", version = "v0.0.0-20200526211855-cb27e3aa2013", ) _maybe( go_repository, name = "org_golang_google_grpc", importpath = "google.golang.org/grpc", sum = "h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=", version = "v1.27.0", ) _maybe( go_repository, name = "org_golang_google_protobuf", importpath = "google.golang.org/protobuf", sum = "h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=", version = "v1.25.0", ) _maybe( go_repository, name = "org_golang_x_crypto", importpath = "golang.org/x/crypto", sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=", version = "v0.0.0-20191011191535-87dc89f01550", ) _maybe( go_repository, name = "org_golang_x_exp", importpath = "golang.org/x/exp", sum = "h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=", version = "v0.0.0-20190121172915-509febef88a4", ) _maybe( go_repository, name = "org_golang_x_lint", importpath = "golang.org/x/lint", sum = "h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=", version = "v0.0.0-20190313153728-d0100b6bd8b3", ) _maybe( go_repository, name = "org_golang_x_mod", importpath = "golang.org/x/mod", sum = "h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=", version = "v0.5.1", ) _maybe( go_repository, name = "org_golang_x_net", importpath = "golang.org/x/net", sum = "h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=", version = "v0.0.0-20210805182204-aaa1db679c0d", ) _maybe( go_repository, name = "org_golang_x_oauth2", importpath = "golang.org/x/oauth2", sum = "h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=", version = "v0.0.0-20180821212333-d2e6202438be", ) _maybe( go_repository, name = "org_golang_x_sync", importpath = "golang.org/x/sync", sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=", version = "v0.0.0-20210220032951-036812b2e83c", ) _maybe( go_repository, name = "org_golang_x_sys", importpath = "golang.org/x/sys", sum = "h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw=", version = "v0.0.0-20211007075335-d3039528d8ac", ) _maybe( go_repository, name = "org_golang_x_text", importpath = "golang.org/x/text", sum = "h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=", version = "v0.3.6", ) _maybe( go_repository, name = "org_golang_x_tools", importpath = "golang.org/x/tools", sum = "h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=", version = "v0.1.7", ) _maybe( go_repository, name = "org_golang_x_xerrors", importpath = "golang.org/x/xerrors", sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=", version = "v0.0.0-20200804184101-5ec99f83aff1", ) def _maybe(repo_rule, name, **kwargs): if name not in native.existing_rules(): repo_rule(name = name, **kwargs)
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository') load('@bazel_gazelle//internal:go_repository.bzl', _go_repository='go_repository') load('@bazel_gazelle//internal:go_repository_cache.bzl', 'go_repository_cache') load('@bazel_gazelle//internal:go_repository_tools.bzl', 'go_repository_tools') load('@bazel_gazelle//internal:go_repository_config.bzl', 'go_repository_config') go_repository = _go_repository def gazelle_dependencies(go_sdk='', go_repository_default_config='@//:WORKSPACE', go_env={}): _maybe(git_repository, name='bazel_skylib', commit='df3c9e2735f02a7fe8cd80db4db00fec8e13d25f', remote='https://github.com/bazelbuild/bazel-skylib') if go_sdk: go_repository_cache(name='bazel_gazelle_go_repository_cache', go_sdk_name=go_sdk, go_env=go_env) else: go_sdk_info = {} for (name, r) in native.existing_rules().items(): if name != 'go_sdk' and ('go_' not in r['kind'] or '_sdk' not in r['kind']): continue if r.get('goos', '') and r.get('goarch', ''): platform = r['goos'] + '_' + r['goarch'] else: platform = 'host' go_sdk_info[name] = platform go_repository_cache(name='bazel_gazelle_go_repository_cache', go_sdk_info=go_sdk_info, go_env=go_env) go_repository_tools(name='bazel_gazelle_go_repository_tools', go_cache='@bazel_gazelle_go_repository_cache//:go.env') go_repository_config(name='bazel_gazelle_go_repository_config', config=go_repository_default_config) _maybe(go_repository, name='co_honnef_go_tools', importpath='honnef.co/go/tools', sum='h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=', version='v0.0.0-20190523083050-ea95bdfd59fc') _maybe(go_repository, name='com_github_bazelbuild_buildtools', importpath='github.com/bazelbuild/buildtools', sum='h1:VMFMISXa1RypQNG0j4KVCbsUcrxFudkY/IvWzEJCyO8=', version='v0.0.0-20211007154642-8dd79e56e98e', build_naming_convention='go_default_library') _maybe(go_repository, name='com_github_bazelbuild_rules_go', importpath='github.com/bazelbuild/rules_go', sum='h1:SfxjyO/V68rVnzOHop92fB0gv/Aa75KNLAN0PMqXbIw=', version='v0.29.0') _maybe(go_repository, name='com_github_bmatcuk_doublestar', importpath='github.com/bmatcuk/doublestar', sum='h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=', version='v1.3.4') _maybe(go_repository, name='com_github_burntsushi_toml', importpath='github.com/BurntSushi/toml', sum='h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=', version='v0.3.1') _maybe(go_repository, name='com_github_census_instrumentation_opencensus_proto', importpath='github.com/census-instrumentation/opencensus-proto', sum='h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=', version='v0.2.1') _maybe(go_repository, name='com_github_chzyer_logex', importpath='github.com/chzyer/logex', sum='h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=', version='v1.1.10') _maybe(go_repository, name='com_github_chzyer_readline', importpath='github.com/chzyer/readline', sum='h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=', version='v0.0.0-20180603132655-2972be24d48e') _maybe(go_repository, name='com_github_chzyer_test', importpath='github.com/chzyer/test', sum='h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=', version='v0.0.0-20180213035817-a1ea475d72b1') _maybe(go_repository, name='com_github_client9_misspell', importpath='github.com/client9/misspell', sum='h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=', version='v0.3.4') _maybe(go_repository, name='com_github_davecgh_go_spew', importpath='github.com/davecgh/go-spew', sum='h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=', version='v1.1.1') _maybe(go_repository, name='com_github_envoyproxy_go_control_plane', importpath='github.com/envoyproxy/go-control-plane', sum='h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=', version='v0.9.1-0.20191026205805-5f8ba28d4473') _maybe(go_repository, name='com_github_envoyproxy_protoc_gen_validate', importpath='github.com/envoyproxy/protoc-gen-validate', sum='h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=', version='v0.1.0') _maybe(go_repository, name='com_github_fsnotify_fsnotify', importpath='github.com/fsnotify/fsnotify', sum='h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=', version='v1.5.1') _maybe(go_repository, name='com_github_golang_glog', importpath='github.com/golang/glog', sum='h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=', version='v0.0.0-20160126235308-23def4e6c14b') _maybe(go_repository, name='com_github_golang_mock', importpath='github.com/golang/mock', sum='h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=', version='v1.1.1') _maybe(go_repository, name='com_github_golang_protobuf', importpath='github.com/golang/protobuf', sum='h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=', version='v1.4.3') _maybe(go_repository, name='com_github_google_go_cmp', importpath='github.com/google/go-cmp', sum='h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=', version='v0.5.6') _maybe(go_repository, name='com_github_pelletier_go_toml', importpath='github.com/pelletier/go-toml', sum='h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM=', version='v1.9.4') _maybe(go_repository, name='com_github_pmezard_go_difflib', importpath='github.com/pmezard/go-difflib', sum='h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=', version='v1.0.0') _maybe(go_repository, name='com_github_prometheus_client_model', importpath='github.com/prometheus/client_model', sum='h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=', version='v0.0.0-20190812154241-14fe0d1b01d4') _maybe(go_repository, name='com_github_yuin_goldmark', importpath='github.com/yuin/goldmark', sum='h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ=', version='v1.4.0') _maybe(go_repository, name='com_google_cloud_go', importpath='cloud.google.com/go', sum='h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=', version='v0.26.0') _maybe(go_repository, name='in_gopkg_check_v1', importpath='gopkg.in/check.v1', sum='h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=', version='v0.0.0-20161208181325-20d25e280405') _maybe(go_repository, name='in_gopkg_yaml_v2', importpath='gopkg.in/yaml.v2', sum='h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=', version='v2.2.2') _maybe(go_repository, name='net_starlark_go', importpath='go.starlark.net', sum='h1:xwwDQW5We85NaTk2APgoN9202w/l0DVGp+GZMfsrh7s=', version='v0.0.0-20210223155950-e043a3d3c984') _maybe(go_repository, name='org_golang_google_appengine', importpath='google.golang.org/appengine', sum='h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=', version='v1.4.0') _maybe(go_repository, name='org_golang_google_genproto', importpath='google.golang.org/genproto', sum='h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=', version='v0.0.0-20200526211855-cb27e3aa2013') _maybe(go_repository, name='org_golang_google_grpc', importpath='google.golang.org/grpc', sum='h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=', version='v1.27.0') _maybe(go_repository, name='org_golang_google_protobuf', importpath='google.golang.org/protobuf', sum='h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=', version='v1.25.0') _maybe(go_repository, name='org_golang_x_crypto', importpath='golang.org/x/crypto', sum='h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=', version='v0.0.0-20191011191535-87dc89f01550') _maybe(go_repository, name='org_golang_x_exp', importpath='golang.org/x/exp', sum='h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=', version='v0.0.0-20190121172915-509febef88a4') _maybe(go_repository, name='org_golang_x_lint', importpath='golang.org/x/lint', sum='h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=', version='v0.0.0-20190313153728-d0100b6bd8b3') _maybe(go_repository, name='org_golang_x_mod', importpath='golang.org/x/mod', sum='h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=', version='v0.5.1') _maybe(go_repository, name='org_golang_x_net', importpath='golang.org/x/net', sum='h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=', version='v0.0.0-20210805182204-aaa1db679c0d') _maybe(go_repository, name='org_golang_x_oauth2', importpath='golang.org/x/oauth2', sum='h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=', version='v0.0.0-20180821212333-d2e6202438be') _maybe(go_repository, name='org_golang_x_sync', importpath='golang.org/x/sync', sum='h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=', version='v0.0.0-20210220032951-036812b2e83c') _maybe(go_repository, name='org_golang_x_sys', importpath='golang.org/x/sys', sum='h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw=', version='v0.0.0-20211007075335-d3039528d8ac') _maybe(go_repository, name='org_golang_x_text', importpath='golang.org/x/text', sum='h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=', version='v0.3.6') _maybe(go_repository, name='org_golang_x_tools', importpath='golang.org/x/tools', sum='h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=', version='v0.1.7') _maybe(go_repository, name='org_golang_x_xerrors', importpath='golang.org/x/xerrors', sum='h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=', version='v0.0.0-20200804184101-5ec99f83aff1') def _maybe(repo_rule, name, **kwargs): if name not in native.existing_rules(): repo_rule(name=name, **kwargs)
def user_information_helper(data) -> dict: return { "id": str(data["_id"]), "name": data["timePredict"], "email": data["email"], "phoneNumber": data["phoneNumber"], "weight": data["weight"], "createAt": str(data["createAt"]), "updateAt": str(data["updateAt"]), } def user_helper(data) -> dict: return { "id": str(data["_id"]), "username": data["username"], "password": data["password"], "hashed_password": data["password"], "role": data["role"], "createAt": str(data["createAt"]), "updateAt": str(data["updateAt"]), }
def user_information_helper(data) -> dict: return {'id': str(data['_id']), 'name': data['timePredict'], 'email': data['email'], 'phoneNumber': data['phoneNumber'], 'weight': data['weight'], 'createAt': str(data['createAt']), 'updateAt': str(data['updateAt'])} def user_helper(data) -> dict: return {'id': str(data['_id']), 'username': data['username'], 'password': data['password'], 'hashed_password': data['password'], 'role': data['role'], 'createAt': str(data['createAt']), 'updateAt': str(data['updateAt'])}
def odd_and_even_sums(numbers): even_sum = 0 odd_sum = 0 for digit in numbers: if int(digit) % 2 == 0: even_sum += int(digit) else: odd_sum += int(digit) return f"Odd sum = {odd_sum}, Even sum = {even_sum}" numbers = input() answer = odd_and_even_sums(numbers) print(answer)
def odd_and_even_sums(numbers): even_sum = 0 odd_sum = 0 for digit in numbers: if int(digit) % 2 == 0: even_sum += int(digit) else: odd_sum += int(digit) return f'Odd sum = {odd_sum}, Even sum = {even_sum}' numbers = input() answer = odd_and_even_sums(numbers) print(answer)
def selection(x): n = len(x) for i in range(0, n-1): for j in range(i+1, n): if x[i]>x[j]: x[i], x[j] = x[j], x[i] print('''{} - {} - {}'''.format(i, j, x)) return x x = [2, 7, 8, 1, 3, 6] print(selection(x))
def selection(x): n = len(x) for i in range(0, n - 1): for j in range(i + 1, n): if x[i] > x[j]: (x[i], x[j]) = (x[j], x[i]) print('{} - {} - {}'.format(i, j, x)) return x x = [2, 7, 8, 1, 3, 6] print(selection(x))
class Solution: def countUnivalSubtrees(self, root: Optional[TreeNode]) -> int: ans = 0 def isUnival(root: Optional[TreeNode], val: int) -> bool: nonlocal ans if not root: return True if isUnival(root.left, root.val) & isUnival(root.right, root.val): ans += 1 return root.val == val return False isUnival(root, math.inf) return ans
class Solution: def count_unival_subtrees(self, root: Optional[TreeNode]) -> int: ans = 0 def is_unival(root: Optional[TreeNode], val: int) -> bool: nonlocal ans if not root: return True if is_unival(root.left, root.val) & is_unival(root.right, root.val): ans += 1 return root.val == val return False is_unival(root, math.inf) return ans
POSITION_IMAGE_LEFT = 'image-left' POSITION_IMAGE_RIGHT = 'image-right' POSITION_CHOICES = ( (POSITION_IMAGE_LEFT, 'Image Left'), (POSITION_IMAGE_RIGHT, 'Image Right'), )
position_image_left = 'image-left' position_image_right = 'image-right' position_choices = ((POSITION_IMAGE_LEFT, 'Image Left'), (POSITION_IMAGE_RIGHT, 'Image Right'))
def setup(): size(1000, 500) smooth() strokeWeight(30) stroke(100) def draw(): background(0) line(frameCount, 300,100 + frameCount,400) line(100 + frameCount, 300, frameCount, 400)
def setup(): size(1000, 500) smooth() stroke_weight(30) stroke(100) def draw(): background(0) line(frameCount, 300, 100 + frameCount, 400) line(100 + frameCount, 300, frameCount, 400)
class Customer: def __init__(self, name, age, phone_no): self.name = name self.age = age self.phone_no = phone_no def purchase(self, payment): if payment.type == "card": print("Paying by card") elif payment.type == "e-wallet": print("Paying by wallet") else: print("Paying by cash") class Payment: def __init__(self, type): self.type = type payment1 = Payment("card") c = Customer("Jack", 23, 1234) c.purchase(payment1)
class Customer: def __init__(self, name, age, phone_no): self.name = name self.age = age self.phone_no = phone_no def purchase(self, payment): if payment.type == 'card': print('Paying by card') elif payment.type == 'e-wallet': print('Paying by wallet') else: print('Paying by cash') class Payment: def __init__(self, type): self.type = type payment1 = payment('card') c = customer('Jack', 23, 1234) c.purchase(payment1)
''' YTV.su Playlist Downloader Plugin configuration file ''' # Channels url url = 'http://ytv.su/tv/channels'
""" YTV.su Playlist Downloader Plugin configuration file """ url = 'http://ytv.su/tv/channels'
add2 = addN(2) add2 add2(7) 9
add2 = add_n(2) add2 add2(7) 9
#!/usr/bin/env python def times(x, y): return x * y z = times(2, 3) print("2 times 3 is " + str(z));
def times(x, y): return x * y z = times(2, 3) print('2 times 3 is ' + str(z))
# Scrapy settings for chuansong project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html BOT_NAME = "chuansong" SPIDER_MODULES = ['chuansong.spiders'] NEWSPIDER_MODULE = 'chuansong.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent USER_AGENT = [u'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0'] # Configure maximum concurrent requests performed by Scrapy (default: 16) # CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0) # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay # See also autothrottle settings and docs DOWNLOAD_DELAY = 3 # The download delay setting will honor only one of: #CONCURRENT_REQUESTS_PER_DOMAIN = 16 #CONCURRENT_REQUESTS_PER_IP = 16 # Disable cookies (enabled by default) #COOKIES_ENABLED = False # Disable Telnet Console (enabled by default) #TELNETCONSOLE_ENABLED = False # Override the default request headers: #DEFAULT_REQUEST_HEADERS = { # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', # 'Accept-Language': 'en', #} # Enable or disable spider middlewares # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html #SPIDER_MIDDLEWARES = { # 'chuansong.middlewares.MyCustomSpiderMiddleware': 543, #} # Enable or disable downloader middlewares # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html #DOWNLOADER_MIDDLEWARES = { # 'chuansong.middlewares.MyCustomDownloaderMiddleware': 543, #} #DOWNLOADER_MIDDLEWARES = { # 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware':None, # 'chuansong.middlewares.useragent_middleware.RotateUserAgentMiddleware':400, #} # Enable or disable extensions # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html #EXTENSIONS = { # 'scrapy.extensions.telnet.TelnetConsole': None, #} # Configure item pipelines # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html ITEM_PIPELINES = { 'chuansong.pipelines.JsonWriterPipeline': 0, } # Enable and configure the AutoThrottle extension (disabled by default) # See http://doc.scrapy.org/en/latest/topics/autothrottle.html #AUTOTHROTTLE_ENABLED = True # The initial download delay #AUTOTHROTTLE_START_DELAY = 5 # The maximum download delay to be set in case of high latencies #AUTOTHROTTLE_MAX_DELAY = 60 # The average number of requests Scrapy should be sending in parallel to # each remote server #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0 # Enable showing throttling stats for every response received: #AUTOTHROTTLE_DEBUG = False # Enable and configure HTTP caching (disabled by default) # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings #HTTPCACHE_ENABLED = True #HTTPCACHE_EXPIRATION_SECS = 0 #HTTPCACHE_DIR = 'httpcache' #HTTPCACHE_IGNORE_HTTP_CODES = [] #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage' # DEPTH_LIMIT = 2 IMAGES_URLS_FIELD = 'image_urls' IMAGES_RESULT_FIELD = 'images' IMAGES_STORE = "images" COUNT_DATA = True # mongo pipeline settings MONGODB_HOST = '127.0.0.1' MONGODB_PORT = 27017 MONGODB_DBNAME = 'scrapy' MONGODB_DOCNAME = 'chuansong' # elasticsearch pipeline settings ELASTICSEARCH_SERVER = 'http://127.0.0.1' ELASTICSEARCH_PORT = 9200 ELASTICSEARCH_INDEX = 'scrapy' ELASTICSEARCH_TYPE = 'items' ELASTICSEARCH_UNIQ_KEY = 'url'
bot_name = 'chuansong' spider_modules = ['chuansong.spiders'] newspider_module = 'chuansong.spiders' user_agent = [u'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0'] download_delay = 3 item_pipelines = {'chuansong.pipelines.JsonWriterPipeline': 0} images_urls_field = 'image_urls' images_result_field = 'images' images_store = 'images' count_data = True mongodb_host = '127.0.0.1' mongodb_port = 27017 mongodb_dbname = 'scrapy' mongodb_docname = 'chuansong' elasticsearch_server = 'http://127.0.0.1' elasticsearch_port = 9200 elasticsearch_index = 'scrapy' elasticsearch_type = 'items' elasticsearch_uniq_key = 'url'
a={} def fib(n): if n==0: return 0 if n==1: return 1 if n in a: return a[n] else: ans=fib(n-1)+fib(n-2) d[n]=ans return ans print(fib(int(input('Enter n : '))))
a = {} def fib(n): if n == 0: return 0 if n == 1: return 1 if n in a: return a[n] else: ans = fib(n - 1) + fib(n - 2) d[n] = ans return ans print(fib(int(input('Enter n : '))))
# This is a placeholder version of this file; in an actual installation, it # is generated from scratch by the installer. The constants defined here # are exposed by constants.py DEFAULT_DATABASE_HOST = None # XXX DEFAULT_PROXYCACHE_HOST = None # XXX MASTER_MANAGER_HOST = None # XXX - used to define BUNDLES_SRC_HOST for worker_manager below DEVPAYMENTS_API_KEY = None
default_database_host = None default_proxycache_host = None master_manager_host = None devpayments_api_key = None
class Solution: def maxChunksToSorted(self, arr: [int]) -> int: stack = [] for num in arr: if stack and num < stack[-1]: head = stack.pop() while stack and num < stack[-1]: stack.pop() stack.append(head) else: stack.append(num) return len(stack) s = Solution() print(s.maxChunksToSorted([1,1,2,1,1,3,4,5,3,6]))
class Solution: def max_chunks_to_sorted(self, arr: [int]) -> int: stack = [] for num in arr: if stack and num < stack[-1]: head = stack.pop() while stack and num < stack[-1]: stack.pop() stack.append(head) else: stack.append(num) return len(stack) s = solution() print(s.maxChunksToSorted([1, 1, 2, 1, 1, 3, 4, 5, 3, 6]))
def water_depth_press(wd: "h_l", rho_water, g=9.81) -> "p_e": p_e = rho_water * g * abs(wd) return p_e
def water_depth_press(wd: 'h_l', rho_water, g=9.81) -> 'p_e': p_e = rho_water * g * abs(wd) return p_e
def aumentar(au=0, taxa=0, show=False): au = au + ((au * taxa) / 100) if show == True: au = moeda(au) return au def diminuir(di=0, taxa=0, show=False): di = di - ((di * taxa) / 100) if show == True: di = moeda(di) return di def dobro(do=0, show=False): do *= 2 if show == True: do = moeda(do) return do def metade(me=0, show=False): me /= 2 if show == True: me = moeda(me) return me def moeda(preco=0, moeda= 'R$'): formatado = f'{preco:.2f}{moeda}'.replace('.', ',') return formatado
def aumentar(au=0, taxa=0, show=False): au = au + au * taxa / 100 if show == True: au = moeda(au) return au def diminuir(di=0, taxa=0, show=False): di = di - di * taxa / 100 if show == True: di = moeda(di) return di def dobro(do=0, show=False): do *= 2 if show == True: do = moeda(do) return do def metade(me=0, show=False): me /= 2 if show == True: me = moeda(me) return me def moeda(preco=0, moeda='R$'): formatado = f'{preco:.2f}{moeda}'.replace('.', ',') return formatado
class Card(object): def __init__(self): self.fields = [] for i in range (0, 5): self.fields.append([]) for j in range(0, 5): self.fields[i].append(Field()) class Field(object): def __init__(self): self.number = -1 self.marked = False def check_for_bingo(card): for i in range(0, 5): bingo = True for j in range(0, 5): bingo &= card.fields[i][j].marked if bingo: return True for j in range(0, 5): bingo = True for i in range(0, 5): bingo &= card.fields[i][j].marked if bingo: return True cards = [] calls = [] cards = [] with open('input.txt', 'r+') as file: lines = file.readlines() calls = list(map(lambda i: int(i), str.split(lines[0], ","))) c = 2 while c < len(lines): card = Card() for i in range(0, 5): for j in range(0, 5): card.fields[i][j].number = int(lines[c+i][0+j*3:3+j*3]) cards.append(card) c += 6 for call in calls: for card in cards: for row in card.fields: for field in row: if field.number == call: field.marked = True if check_for_bingo(card): s = 0 for row in card.fields: for field in row: if not field.marked: s += field.number print(s * call) quit()
class Card(object): def __init__(self): self.fields = [] for i in range(0, 5): self.fields.append([]) for j in range(0, 5): self.fields[i].append(field()) class Field(object): def __init__(self): self.number = -1 self.marked = False def check_for_bingo(card): for i in range(0, 5): bingo = True for j in range(0, 5): bingo &= card.fields[i][j].marked if bingo: return True for j in range(0, 5): bingo = True for i in range(0, 5): bingo &= card.fields[i][j].marked if bingo: return True cards = [] calls = [] cards = [] with open('input.txt', 'r+') as file: lines = file.readlines() calls = list(map(lambda i: int(i), str.split(lines[0], ','))) c = 2 while c < len(lines): card = card() for i in range(0, 5): for j in range(0, 5): card.fields[i][j].number = int(lines[c + i][0 + j * 3:3 + j * 3]) cards.append(card) c += 6 for call in calls: for card in cards: for row in card.fields: for field in row: if field.number == call: field.marked = True if check_for_bingo(card): s = 0 for row in card.fields: for field in row: if not field.marked: s += field.number print(s * call) quit()
class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: if sum(gas) - sum(cost) < 0: return -1 tank = start = total = 0 for i in range(len(gas)): tank += gas[i] - cost[i] if tank < 0: start = i + 1 total += tank tank = 0 return start if tank + total >= 0 else -1
class Solution: def can_complete_circuit(self, gas: List[int], cost: List[int]) -> int: if sum(gas) - sum(cost) < 0: return -1 tank = start = total = 0 for i in range(len(gas)): tank += gas[i] - cost[i] if tank < 0: start = i + 1 total += tank tank = 0 return start if tank + total >= 0 else -1
# -*- coding: utf-8 -*- ''' Created on 1983. 08. 09. @author: Hye-Churn Jang, CMBU Specialist in Korea, VMware [jangh@vmware.com] ''' name = 'VirtualPrivateZone' # custom resource name sdk = 'vra' # imported SDK at common directory inputs = { 'create': { 'VraManager': 'constant' }, 'read': { }, 'update': { 'VraManager': 'constant' }, 'delete': { 'VraManager': 'constant' } } properties = { 'name': { 'type': 'string', 'title': 'Name', 'description': 'Name of virtual private zone' }, 'computes': { 'type': 'array', 'title': 'Computes', 'items': { 'type': 'string' }, 'description': 'Compute name list of placement hosts, clusters or resource pools' }, 'networks': { 'type': 'array', 'title': 'Networks', 'items': { 'type': 'string' }, 'description': 'Network id list' }, 'storage': { 'type': 'string', 'title': 'Storage', 'description': 'Datastore name to deploy', }, 'folder': { 'type': 'string', 'title': 'Folder', 'default': '', 'description': 'Folder name to deploy', }, 'placementPolicy': { 'type': 'string', 'title': 'Placement Policy', 'default': 'default', 'enum': ['default', 'binpack', 'spread'], 'description': 'Placement policy with "default", "binpack" or "spread"' }, 'loadBalancers': { 'type': 'array', 'title': 'Load Balancer', 'default': [], 'items': { 'type': 'string' }, 'description': 'Load balancer id list' }, 'edgeCluster': { 'type': 'string', 'title': 'Edge Cluster', 'default': '', 'description': 'Edge cluster name to use deployment', }, 'storageType': { 'type': 'string', 'title': 'Storage Type', 'default': 'thin', 'enum': ['thin', 'thick', 'eagerZeroedThick'], 'description': 'Storage type with "thin", "thick" or "eagerZeroedThick"' }, }
""" Created on 1983. 08. 09. @author: Hye-Churn Jang, CMBU Specialist in Korea, VMware [jangh@vmware.com] """ name = 'VirtualPrivateZone' sdk = 'vra' inputs = {'create': {'VraManager': 'constant'}, 'read': {}, 'update': {'VraManager': 'constant'}, 'delete': {'VraManager': 'constant'}} properties = {'name': {'type': 'string', 'title': 'Name', 'description': 'Name of virtual private zone'}, 'computes': {'type': 'array', 'title': 'Computes', 'items': {'type': 'string'}, 'description': 'Compute name list of placement hosts, clusters or resource pools'}, 'networks': {'type': 'array', 'title': 'Networks', 'items': {'type': 'string'}, 'description': 'Network id list'}, 'storage': {'type': 'string', 'title': 'Storage', 'description': 'Datastore name to deploy'}, 'folder': {'type': 'string', 'title': 'Folder', 'default': '', 'description': 'Folder name to deploy'}, 'placementPolicy': {'type': 'string', 'title': 'Placement Policy', 'default': 'default', 'enum': ['default', 'binpack', 'spread'], 'description': 'Placement policy with "default", "binpack" or "spread"'}, 'loadBalancers': {'type': 'array', 'title': 'Load Balancer', 'default': [], 'items': {'type': 'string'}, 'description': 'Load balancer id list'}, 'edgeCluster': {'type': 'string', 'title': 'Edge Cluster', 'default': '', 'description': 'Edge cluster name to use deployment'}, 'storageType': {'type': 'string', 'title': 'Storage Type', 'default': 'thin', 'enum': ['thin', 'thick', 'eagerZeroedThick'], 'description': 'Storage type with "thin", "thick" or "eagerZeroedThick"'}}
def to_dict_tools(target): data = dict() attribute = dir(target) if 'public_info' in attribute: public_info = getattr(target, 'public_info') attribute = dir(target) for item in attribute: item = str(item) if not item.startswith('_') and item in public_info: data[item] = str(getattr(target, item)) return data
def to_dict_tools(target): data = dict() attribute = dir(target) if 'public_info' in attribute: public_info = getattr(target, 'public_info') attribute = dir(target) for item in attribute: item = str(item) if not item.startswith('_') and item in public_info: data[item] = str(getattr(target, item)) return data
class Person: population: int = 0 def __new__(cls): cls.population += 1 print(f'DBG: new Person created, {cls.population=}') return object.__new__(cls) def __repr__(self) -> str: return f'{self.__class__.__name__} {id(self)=} {self.population=}' def main(): people = [ Person() for _ in range(5) ] print(people[0], people[-1], sep='\n') if __name__ == '__main__': main()
class Person: population: int = 0 def __new__(cls): cls.population += 1 print(f'DBG: new Person created, cls.population={cls.population!r}') return object.__new__(cls) def __repr__(self) -> str: return f'{self.__class__.__name__} id(self)={id(self)!r} self.population={self.population!r}' def main(): people = [person() for _ in range(5)] print(people[0], people[-1], sep='\n') if __name__ == '__main__': main()
root = 'data/eval_det' train = dict( type='IcdarDataset', ann_file=f'{root}/instances_training.json', img_prefix=f'{root}/imgs', pipeline=None) test = dict( type='IcdarDataset', img_prefix=f'{root}/imgs', ann_file=f'{root}/instances_test.json', pipeline=None, test_mode=True) train_list = [train] test_list = [test]
root = 'data/eval_det' train = dict(type='IcdarDataset', ann_file=f'{root}/instances_training.json', img_prefix=f'{root}/imgs', pipeline=None) test = dict(type='IcdarDataset', img_prefix=f'{root}/imgs', ann_file=f'{root}/instances_test.json', pipeline=None, test_mode=True) train_list = [train] test_list = [test]
P = ("Rafael","Beto","Carlos") for k in range(int(input())): x, y = tuple(map(int,input().split())) players = (9*x*x + y*y, 2*x*x + 25*y*y, -100*x + y*y*y) winner = players.index(max(players)) print("{0} ganhou".format(P[winner]))
p = ('Rafael', 'Beto', 'Carlos') for k in range(int(input())): (x, y) = tuple(map(int, input().split())) players = (9 * x * x + y * y, 2 * x * x + 25 * y * y, -100 * x + y * y * y) winner = players.index(max(players)) print('{0} ganhou'.format(P[winner]))
test = { 'name': 'q3_1_2', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> type(event_result) in set([np.ndarray])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> # Your list should have 5 elements.;\n>>> len(event_result) == 5\nTrue', 'hidden': False, 'locked': False}, { 'code': '>>> # Every element of your list should be a string.;\n>>> [type(i) in set([np.str_, str]) for i in event_result]\n[True, True, True, True, True]', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
test = {'name': 'q3_1_2', 'points': 1, 'suites': [{'cases': [{'code': '>>> type(event_result) in set([np.ndarray])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> # Your list should have 5 elements.;\n>>> len(event_result) == 5\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> # Every element of your list should be a string.;\n>>> [type(i) in set([np.str_, str]) for i in event_result]\n[True, True, True, True, True]', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
class Fencepost(): vertices = [(0.25,0,0), (0.25,0.75,0), (1,0.75,0), (1,0,0), (0.25,0,1.75), (0.25,0.75,1.75), (1,0.75,1.75), (1,0,1.75), #7 # Back post (0,0.75,0.575), (0,1.05,0.575), (1.25,1.05,0.575), (1.25,0.75,0.575), (0,0.75,1.175), (0,1.05,1.175), (1.25,1.05,1.175), (1.25,0.75,1.175) #15 ] faces = [(0,1,2,3), (0,4,5,1), (1,5,6,2), (2,6,7,3), (3,7,4,0), (4,5,6,7), # Back post (8,9,10,11), (8,12,13,9), (9,13,14,10), (10,14,15,11), (11,15,12,8), (12,13,14,15), ] def load(): return Fencepost()
class Fencepost: vertices = [(0.25, 0, 0), (0.25, 0.75, 0), (1, 0.75, 0), (1, 0, 0), (0.25, 0, 1.75), (0.25, 0.75, 1.75), (1, 0.75, 1.75), (1, 0, 1.75), (0, 0.75, 0.575), (0, 1.05, 0.575), (1.25, 1.05, 0.575), (1.25, 0.75, 0.575), (0, 0.75, 1.175), (0, 1.05, 1.175), (1.25, 1.05, 1.175), (1.25, 0.75, 1.175)] faces = [(0, 1, 2, 3), (0, 4, 5, 1), (1, 5, 6, 2), (2, 6, 7, 3), (3, 7, 4, 0), (4, 5, 6, 7), (8, 9, 10, 11), (8, 12, 13, 9), (9, 13, 14, 10), (10, 14, 15, 11), (11, 15, 12, 8), (12, 13, 14, 15)] def load(): return fencepost()
################ modules for HSPICE sim ###################### ############################################################## ######### varmap definition #################### ############################################################## ### This class is to make combinations of given variables #### ### mostly used for testbench generation ################# ### EX: varmap1=HSPICE_varmap.varmap(4) %%num of var=4 ####### ### varmap1.get_var('vdd',1.5,1.8,0.2) %%vdd=1.5:0.2:1.8## ### varmap1.get_var('abc', ........ %%do this for 4 var ## ### varmap1.cal_nbigcy() %%end of var input### ### varmap1.combinate %%returns variable comb 1 by 1 #### ############################################################## class varmap: #def __init__(self,num_var): # self.n_smlcycle=1 # self.last=0 # self.smlcy=1 # self.bigcy=0 # self.vv=0 # self.vf=1 # self.size=num_var # self.map=[None]*self.size # self.comblist=[None]*self.size # self.nvar=0 def __init__(self): self.n_smlcycle=1 self.last=0 self.smlcy=1 self.bigcy=0 self.vv=0 self.vf=1 #self.map=[None] #self.comblist=[None] self.nvar=0 def get_var(self,name,start,end,step): if self.nvar==0: self.map=[None] self.comblist=[None] else: self.map.append(None) self.comblist.append(None) self.map[self.nvar]=list([name]) self.comblist[self.nvar]=list([name]) self.nswp=(end-start)//step+1 for i in range(1,self.nswp+1): self.map[self.nvar].append(start+step*(i-1)) self.nvar+=1 def cal_nbigcy(self): self.bias=[1]*(len(self.map)) for j in range(1,len(self.map)+1): self.n_smlcycle=self.n_smlcycle*(len(self.map[j-1])-1) self.n_smlcycle=self.n_smlcycle*len(self.map) def increm(self,inc): #increment bias self.bias[inc]+=1 if self.bias[inc]>len(self.map[inc])-1: self.bias[inc]%len(self.map[inc])-1 def check_end(self,vf): #When this is called, it's already last stage of self.map[vf] self.bias[vf]=1 # if vf==0 and self.bias[0]==len(self.map[0])-1: # return 0 if self.bias[vf-1]==len(self.map[vf-1])-1: #if previous column is last element self.check_end(vf-1) else: self.bias[vf-1]+=1 return 1 def combinate(self): # print self.map[self.vv][self.bias[self.vv]] self.smlcy+=1 if self.vv==len(self.map)-1: #last variable self.bigcy+=1 for vprint in range(0,len(self.map)): self.comblist[vprint].append(self.map[vprint][self.bias[vprint]]) #print self.map[vprint][self.bias[vprint]] if self.bias[self.vv]==len(self.map[self.vv])-1: #last element if self.smlcy<self.n_smlcycle: self.check_end(self.vv) self.vv=(self.vv+1)%len(self.map) self.combinate() else: pass else: self.bias[self.vv]+=1 self.vv=(self.vv+1)%len(self.map) self.combinate() else: self.vv=(self.vv+1)%len(self.map) self.combinate() ############################################################## ######### netmap ######################## ############################################################## ### This class is used for replacing lines ################ ### detects @@ for line and @ for nets ####################### ############################################################## #-------- EXAMPLE ---------------------------------------# ### netmap1=netmap(2) %input num_var ######################### ### netmap1.get_var('ab','NN',1,4,1) %flag MUST be 2 char #### ## netmap2.get_var('bc','DD',2,5,1) %length of var must match# # !!caution: do get_var in order, except for lateral prints ## ### which is using @W => varibales here, do get_var at last ## ### for line in r_file.readlines():########################### ### netmap1.printline(line,w_file) ####################### ############################################################## class netmap: #def __init__(self,num_var): # self.size=num_var # self.map=[None]*self.size # self.flag=[None]*self.size # self.name=[None]*self.size # self.nnet=[None]*self.size # self.nn=0 # self.pvar=1 # self.cnta=0 # self.line_nvar=0 # index of last variable for this line # self.nxtl_var=0 # index of variable of next line # self.ci_at=100 def __init__(self): self.nn=0 self.pvar=1 self.cnta=0 self.line_nvar=0 # index of last variable for this line self.nxtl_var=0 # index of variable of next line self.ci_at=-5 def get_net(self,flag,netname,start,end,step): #if start==None: want to repeat without incrementation(usually for tab) (end)x(step) is the num of repetition if self.nn==0: self.map=[None] self.flag=[None] self.name=[None] self.nnet=[None] else: self.map.append(None) self.name.append(None) self.flag.append(None) self.nnet.append(None) if netname==None: self.name[self.nn]=0 else: self.name[self.nn]=1 self.map[self.nn]=list([netname]) self.flag[self.nn]=(flag) if start!=None and start!='d2o': self.nnet[self.nn]=int((end-start+step/10)//step+1) if self.name[self.nn]==1: for i in range(1,self.nnet[self.nn]+1): self.map[self.nn].append('') else: for i in range(1,self.nnet[self.nn]+1): self.map[self.nn].append(start+step*(i-1)) elif start=='d2o': for i in range(0,end): if step-i>0: self.map[self.nn].append(1) else: self.map[self.nn].append(0) i+=1 else: self.map[self.nn]=list([netname]) for i in range(1,step+1): self.map[self.nn].append(end) # self.map[self.nn]=[None]*step # for i in range(1,self.nnet[self.nn]+1): # self.map[self.nn][i]=None self.nn+=1 #print self.map def add_val(self,flag,netname,start,end,step): varidx=self.flag.index(flag) if start!=None: nval=int((end-start+step/10)//step+1) for i in range(1,nval+1): self.map[varidx].append(start+step*(i-1)) else: for i in range(1,step+1): self.map[varidx].append(end) def printline(self,line,wrfile): if line[0:2]=='@@': #print('self.ci_at=%d'%(self.ci_at)) self.nline=line[3:len(line)] self.clist=list(self.nline) #character list #print(self.clist,self.nxtl_var) for iv in range (1,len(self.map[self.nxtl_var])): for ci in range(0,len(self.clist)): if (ci==self.ci_at+1 or ci==self.ci_at+2) and ci!=len(self.clist)-1: pass elif self.clist[ci]=='@': #print self.cnta self.cnta+=1 self.line_nvar+=1 varidx=self.flag.index(self.clist[ci+1]+self.clist[ci+2]) if self.name[varidx]: wrfile.write(self.map[varidx][0]) # print(self.map[varidx]) if type(self.map[varidx][self.pvar])==float: wrfile.write('%e'%(self.map[varidx][self.pvar])) #modify here!!!! elif type(self.map[varidx][self.pvar])==int: wrfile.write('%d'%(self.map[varidx][self.pvar])) self.ci_at=ci elif ci==len(self.clist)-1: #end of the line if self.pvar==len(self.map[self.nxtl_var+self.line_nvar-1])-1: #last element self.pvar=1 self.nxtl_var=self.nxtl_var+self.line_nvar self.line_nvar=0 self.cnta=0 self.ci_at=-6 #print('printed all var for this line, %d'%(ci)) else: self.pvar+=1 #self.line_nvar=self.cnta self.line_nvar=0 #print ('line_nvar= %d'%(self.line_nvar)) self.cnta=0 wrfile.write(self.clist[ci]) else: wrfile.write(self.clist[ci]) elif line[0:2]=='@W': #print('found word line') self.nline=line[3:len(line)] self.clist=list(self.nline) for ci in range(0,len(self.clist)): if (ci==self.ci_at+1 or ci==self.ci_at+2): pass elif self.clist[ci]=='@': varidx=self.flag.index(self.clist[ci+1]+self.clist[ci+2]) for iv in range(1,len(self.map[varidx])): if self.name[varidx]: wrfile.write(self.map[varidx][0]) wrfile.write('%d '%(self.map[varidx][iv])) print ('n is %d, varidx=%d, iv=%d'%(self.map[varidx][iv],varidx,iv)) self.ci_at=ci else: wrfile.write(self.clist[ci]) self.ci_at=-5 else: wrfile.write(line) ############################################################## ######### resmap ######################## ############################################################## ### This class is used to deal with results ################ ### detects @@ for line and @ for nets ####################### ############################################################## #-------- EXAMPLE ---------------------------------------# ### netmap1=netmap(2) %input num_var ######################### ### netmap1.get_var('ab','NN',1,4,1) %flag MUST be 2 char #### ## netmap2.get_var('bc','DD',2,5,1) %length of var must match# ### for line in r_file.readlines():########################### ### netmap1.printline(line,w_file) ####################### ###### self.tb[x][y][env[]]############################### ############################################################## class resmap: def __init__(self,num_tb,num_words,index): #num_words includes index self.tb=[None]*num_tb self.tbi=[None]*num_tb self.vl=[None]*num_tb self.vlinit=[None]*num_tb self.svar=[None]*num_tb self.index=index self.nenv=0 self.num_words=num_words self.vr=[None]*(num_words+index) #one set of variables per plot self.vidx=[None]*(num_words+index) self.env=[None]*(num_words+index) # self.vl=[None]*(num_words+index) #one set of variables per plot for itb in range(0,len(self.tb)): # self.tb[itb].vr=[None]*(num_words+index) self.tbi[itb]=0 #index for counting vars within tb self.vl[itb]=[None]*(num_words+index) self.vlinit[itb]=[0]*(num_words+index) def get_var(self,ntb,var): self.vr[self.tbi[ntb]]=(var) # self.vl[ntb][self.tbi[ntb]]=list([None]) self.tbi[ntb]+=1 if self.tbi[ntb]==len(self.vr): #???????? self.tbi[ntb]=0 def add(self,ntb,value): if self.vlinit[ntb][self.tbi[ntb]]==0: #initialization self.vl[ntb][self.tbi[ntb]]=[value] self.vlinit[ntb][self.tbi[ntb]]+=1 else: self.vl[ntb][self.tbi[ntb]].append(value) self.tbi[ntb]=(self.tbi[ntb]+1)%len(self.vr) def plot_env(self,ntb,start,step,xvar,xval): #setting plot environment: if ntb=='all': x axis is in terms of testbench if ntb=='all': self.nenv+=1 self.xaxis=[None]*len(self.tb) for i in range(0,len(self.tb)): self.xaxis[i]=start+i*step self.vidx[self.nenv]=self.vr.index(xvar) #print self.vl[0][self.vidx[self.nenv]] print('', self.vl[0][self.vidx[self.nenv]]) self.env[self.nenv]=[i for (i,x) in enumerate(self.vl[0][self.vidx[self.nenv]]) if x=='%s'%(xval)] else: self.nenv+=1 self.xaxis=[None] #one output self.xaxis=[start] self.vidx[self.nenv]=self.vr.index(xvar) self.env[self.nenv]=[i for (i,x) in enumerate(self.vl[0][self.vidx[self.nenv]]) if x=='%s'%(xval)] def rst_env(self): self.vidx[self.nenv]=None self.env[self.nenv]=0 self.nenv=0 #print self.vl[0][self.vidx[self.nenv]] def plot_y(self,yvar): self.yidx=self.vr.index(yvar) print ('yidx=%d'%(self.yidx)) #print self.vl[0][self.yidx][self.env[self.nenv][0]] print('', self.vl[0][self.yidx][self.env[self.nenv][0]]) self.yaxis=[None]*len(self.xaxis) for xx in range(0,len(self.xaxis)): self.yaxis[xx]=self.vl[xx][self.yidx][self.env[self.nenv][0]] #plt.plot(self.xaxis,self.yaxis) #plt.ylabel(self.vr[self.yidx]) def sort(self,var): varidx=self.vr.index(var) for k in range(len(self.vl)): #all testbenches self.svar[k]={} #define dict for i in range(len(self.vl[0][0])): #all values self.svar[k][self.vl[k][varidx][i]]=[] for j in range(len(self.vr)): #all variables if j!=varidx: self.svar[k][self.vl[k][varidx][i]].append(self.vl[k][j][i]) # if k==0: # print self.svar[k]
class Varmap: def __init__(self): self.n_smlcycle = 1 self.last = 0 self.smlcy = 1 self.bigcy = 0 self.vv = 0 self.vf = 1 self.nvar = 0 def get_var(self, name, start, end, step): if self.nvar == 0: self.map = [None] self.comblist = [None] else: self.map.append(None) self.comblist.append(None) self.map[self.nvar] = list([name]) self.comblist[self.nvar] = list([name]) self.nswp = (end - start) // step + 1 for i in range(1, self.nswp + 1): self.map[self.nvar].append(start + step * (i - 1)) self.nvar += 1 def cal_nbigcy(self): self.bias = [1] * len(self.map) for j in range(1, len(self.map) + 1): self.n_smlcycle = self.n_smlcycle * (len(self.map[j - 1]) - 1) self.n_smlcycle = self.n_smlcycle * len(self.map) def increm(self, inc): self.bias[inc] += 1 if self.bias[inc] > len(self.map[inc]) - 1: self.bias[inc] % len(self.map[inc]) - 1 def check_end(self, vf): self.bias[vf] = 1 if self.bias[vf - 1] == len(self.map[vf - 1]) - 1: self.check_end(vf - 1) else: self.bias[vf - 1] += 1 return 1 def combinate(self): self.smlcy += 1 if self.vv == len(self.map) - 1: self.bigcy += 1 for vprint in range(0, len(self.map)): self.comblist[vprint].append(self.map[vprint][self.bias[vprint]]) if self.bias[self.vv] == len(self.map[self.vv]) - 1: if self.smlcy < self.n_smlcycle: self.check_end(self.vv) self.vv = (self.vv + 1) % len(self.map) self.combinate() else: pass else: self.bias[self.vv] += 1 self.vv = (self.vv + 1) % len(self.map) self.combinate() else: self.vv = (self.vv + 1) % len(self.map) self.combinate() class Netmap: def __init__(self): self.nn = 0 self.pvar = 1 self.cnta = 0 self.line_nvar = 0 self.nxtl_var = 0 self.ci_at = -5 def get_net(self, flag, netname, start, end, step): if self.nn == 0: self.map = [None] self.flag = [None] self.name = [None] self.nnet = [None] else: self.map.append(None) self.name.append(None) self.flag.append(None) self.nnet.append(None) if netname == None: self.name[self.nn] = 0 else: self.name[self.nn] = 1 self.map[self.nn] = list([netname]) self.flag[self.nn] = flag if start != None and start != 'd2o': self.nnet[self.nn] = int((end - start + step / 10) // step + 1) if self.name[self.nn] == 1: for i in range(1, self.nnet[self.nn] + 1): self.map[self.nn].append('') else: for i in range(1, self.nnet[self.nn] + 1): self.map[self.nn].append(start + step * (i - 1)) elif start == 'd2o': for i in range(0, end): if step - i > 0: self.map[self.nn].append(1) else: self.map[self.nn].append(0) i += 1 else: self.map[self.nn] = list([netname]) for i in range(1, step + 1): self.map[self.nn].append(end) self.nn += 1 def add_val(self, flag, netname, start, end, step): varidx = self.flag.index(flag) if start != None: nval = int((end - start + step / 10) // step + 1) for i in range(1, nval + 1): self.map[varidx].append(start + step * (i - 1)) else: for i in range(1, step + 1): self.map[varidx].append(end) def printline(self, line, wrfile): if line[0:2] == '@@': self.nline = line[3:len(line)] self.clist = list(self.nline) for iv in range(1, len(self.map[self.nxtl_var])): for ci in range(0, len(self.clist)): if (ci == self.ci_at + 1 or ci == self.ci_at + 2) and ci != len(self.clist) - 1: pass elif self.clist[ci] == '@': self.cnta += 1 self.line_nvar += 1 varidx = self.flag.index(self.clist[ci + 1] + self.clist[ci + 2]) if self.name[varidx]: wrfile.write(self.map[varidx][0]) if type(self.map[varidx][self.pvar]) == float: wrfile.write('%e' % self.map[varidx][self.pvar]) elif type(self.map[varidx][self.pvar]) == int: wrfile.write('%d' % self.map[varidx][self.pvar]) self.ci_at = ci elif ci == len(self.clist) - 1: if self.pvar == len(self.map[self.nxtl_var + self.line_nvar - 1]) - 1: self.pvar = 1 self.nxtl_var = self.nxtl_var + self.line_nvar self.line_nvar = 0 self.cnta = 0 self.ci_at = -6 else: self.pvar += 1 self.line_nvar = 0 self.cnta = 0 wrfile.write(self.clist[ci]) else: wrfile.write(self.clist[ci]) elif line[0:2] == '@W': self.nline = line[3:len(line)] self.clist = list(self.nline) for ci in range(0, len(self.clist)): if ci == self.ci_at + 1 or ci == self.ci_at + 2: pass elif self.clist[ci] == '@': varidx = self.flag.index(self.clist[ci + 1] + self.clist[ci + 2]) for iv in range(1, len(self.map[varidx])): if self.name[varidx]: wrfile.write(self.map[varidx][0]) wrfile.write('%d\t' % self.map[varidx][iv]) print('n is %d, varidx=%d, iv=%d' % (self.map[varidx][iv], varidx, iv)) self.ci_at = ci else: wrfile.write(self.clist[ci]) self.ci_at = -5 else: wrfile.write(line) class Resmap: def __init__(self, num_tb, num_words, index): self.tb = [None] * num_tb self.tbi = [None] * num_tb self.vl = [None] * num_tb self.vlinit = [None] * num_tb self.svar = [None] * num_tb self.index = index self.nenv = 0 self.num_words = num_words self.vr = [None] * (num_words + index) self.vidx = [None] * (num_words + index) self.env = [None] * (num_words + index) for itb in range(0, len(self.tb)): self.tbi[itb] = 0 self.vl[itb] = [None] * (num_words + index) self.vlinit[itb] = [0] * (num_words + index) def get_var(self, ntb, var): self.vr[self.tbi[ntb]] = var self.tbi[ntb] += 1 if self.tbi[ntb] == len(self.vr): self.tbi[ntb] = 0 def add(self, ntb, value): if self.vlinit[ntb][self.tbi[ntb]] == 0: self.vl[ntb][self.tbi[ntb]] = [value] self.vlinit[ntb][self.tbi[ntb]] += 1 else: self.vl[ntb][self.tbi[ntb]].append(value) self.tbi[ntb] = (self.tbi[ntb] + 1) % len(self.vr) def plot_env(self, ntb, start, step, xvar, xval): if ntb == 'all': self.nenv += 1 self.xaxis = [None] * len(self.tb) for i in range(0, len(self.tb)): self.xaxis[i] = start + i * step self.vidx[self.nenv] = self.vr.index(xvar) print('', self.vl[0][self.vidx[self.nenv]]) self.env[self.nenv] = [i for (i, x) in enumerate(self.vl[0][self.vidx[self.nenv]]) if x == '%s' % xval] else: self.nenv += 1 self.xaxis = [None] self.xaxis = [start] self.vidx[self.nenv] = self.vr.index(xvar) self.env[self.nenv] = [i for (i, x) in enumerate(self.vl[0][self.vidx[self.nenv]]) if x == '%s' % xval] def rst_env(self): self.vidx[self.nenv] = None self.env[self.nenv] = 0 self.nenv = 0 def plot_y(self, yvar): self.yidx = self.vr.index(yvar) print('yidx=%d' % self.yidx) print('', self.vl[0][self.yidx][self.env[self.nenv][0]]) self.yaxis = [None] * len(self.xaxis) for xx in range(0, len(self.xaxis)): self.yaxis[xx] = self.vl[xx][self.yidx][self.env[self.nenv][0]] def sort(self, var): varidx = self.vr.index(var) for k in range(len(self.vl)): self.svar[k] = {} for i in range(len(self.vl[0][0])): self.svar[k][self.vl[k][varidx][i]] = [] for j in range(len(self.vr)): if j != varidx: self.svar[k][self.vl[k][varidx][i]].append(self.vl[k][j][i])
def line_br_int(win, p1, p2): if p1 == p2: win.image.setPixel(p1[0], p1[1], win.pen.color().rgb()) return dx = p2[0] - p1[0] dy = p2[1] - p1[1] sx = sign(dx) sy = sign(dy) dx = abs(dx) dy = abs(dy) x = p1[0] y = p1[1] change = False if dy > dx: temp = dx dx = dy dy = temp change = True e = 2 * dy - dx i = 1 while i <= dx: win.image.setPixel(x, y, win.pen.color().rgb()) if e >= 0: if change == 0: y += sy else: x += sx e -= 2 * dx if e < 0: if change == 0: x += sx else: y += sy e += (2 * dy) i += 1
def line_br_int(win, p1, p2): if p1 == p2: win.image.setPixel(p1[0], p1[1], win.pen.color().rgb()) return dx = p2[0] - p1[0] dy = p2[1] - p1[1] sx = sign(dx) sy = sign(dy) dx = abs(dx) dy = abs(dy) x = p1[0] y = p1[1] change = False if dy > dx: temp = dx dx = dy dy = temp change = True e = 2 * dy - dx i = 1 while i <= dx: win.image.setPixel(x, y, win.pen.color().rgb()) if e >= 0: if change == 0: y += sy else: x += sx e -= 2 * dx if e < 0: if change == 0: x += sx else: y += sy e += 2 * dy i += 1
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ADSBVehicle.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ActuatorControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Altitude.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/AttitudeTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/BatteryStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CamIMUStamp.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CommandCode.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CompanionProcessStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OnboardComputerStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/DebugValue.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCInfo.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCInfoItem.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCStatusItem.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/EstimatorStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ExtendedState.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/FileEntry.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GlobalPositionTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GPSRAW.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GPSRTK.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilActuatorControls.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilControls.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilGPS.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilSensor.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilStateQuaternion.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HomePosition.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LandingTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LogData.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LogEntry.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ManualControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Mavlink.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/MountControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OpticalFlowRad.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OverrideRCIn.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Param.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ParamValue.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/PlayTuneV2.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/PositionTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RCIn.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RCOut.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RTCM.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RadioStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RTKBaseline.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/State.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/StatusText.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Thrust.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/TimesyncStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Trajectory.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/VFR_HUD.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/VehicleInfo.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Vibration.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Waypoint.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WaypointList.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WaypointReached.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WheelOdomStamped.msg" services_str = "/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandBool.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandHome.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandInt.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandLong.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTOL.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTriggerControl.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTriggerInterval.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandVtolTransition.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileChecksum.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileClose.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileList.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileMakeDir.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileOpen.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRead.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRemove.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRemoveDir.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRename.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileTruncate.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileWrite.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestData.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestEnd.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestList.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/MountConfigure.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/MessageInterval.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamGet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamPull.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamPush.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamSet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/SetMavFrame.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/SetMode.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/StreamRate.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/VehicleInfoGet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointClear.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointPull.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointPush.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointSetCurrent.srv" pkg_name = "mavros_msgs" dependencies_str = "geographic_msgs;geometry_msgs;sensor_msgs;std_msgs" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str = "mavros_msgs;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg;geographic_msgs;/opt/ros/melodic/share/geographic_msgs/cmake/../msg;geometry_msgs;/opt/ros/melodic/share/geometry_msgs/cmake/../msg;sensor_msgs;/opt/ros/melodic/share/sensor_msgs/cmake/../msg;std_msgs;/opt/ros/melodic/share/std_msgs/cmake/../msg;uuid_msgs;/opt/ros/melodic/share/uuid_msgs/cmake/../msg" PYTHON_EXECUTABLE = "/usr/bin/python2" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
messages_str = '/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ADSBVehicle.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ActuatorControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Altitude.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/AttitudeTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/BatteryStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CamIMUStamp.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CommandCode.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/CompanionProcessStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OnboardComputerStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/DebugValue.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCInfo.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCInfoItem.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ESCStatusItem.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/EstimatorStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ExtendedState.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/FileEntry.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GlobalPositionTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GPSRAW.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/GPSRTK.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilActuatorControls.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilControls.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilGPS.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilSensor.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HilStateQuaternion.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/HomePosition.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LandingTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LogData.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/LogEntry.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ManualControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Mavlink.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/MountControl.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OpticalFlowRad.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/OverrideRCIn.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Param.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/ParamValue.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/PlayTuneV2.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/PositionTarget.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RCIn.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RCOut.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RTCM.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RadioStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/RTKBaseline.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/State.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/StatusText.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Thrust.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/TimesyncStatus.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Trajectory.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/VFR_HUD.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/VehicleInfo.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Vibration.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/Waypoint.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WaypointList.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WaypointReached.msg;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg/WheelOdomStamped.msg' services_str = '/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandBool.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandHome.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandInt.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandLong.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTOL.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTriggerControl.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandTriggerInterval.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/CommandVtolTransition.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileChecksum.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileClose.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileList.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileMakeDir.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileOpen.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRead.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRemove.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRemoveDir.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileRename.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileTruncate.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/FileWrite.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestData.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestEnd.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/LogRequestList.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/MountConfigure.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/MessageInterval.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamGet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamPull.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamPush.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/ParamSet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/SetMavFrame.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/SetMode.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/StreamRate.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/VehicleInfoGet.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointClear.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointPull.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointPush.srv;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/srv/WaypointSetCurrent.srv' pkg_name = 'mavros_msgs' dependencies_str = 'geographic_msgs;geometry_msgs;sensor_msgs;std_msgs' langs = 'gencpp;geneus;genlisp;gennodejs;genpy' dep_include_paths_str = 'mavros_msgs;/home/arijitnoobstar/UAVProjectileCatcher/src/mavros/mavros_msgs/msg;geographic_msgs;/opt/ros/melodic/share/geographic_msgs/cmake/../msg;geometry_msgs;/opt/ros/melodic/share/geometry_msgs/cmake/../msg;sensor_msgs;/opt/ros/melodic/share/sensor_msgs/cmake/../msg;std_msgs;/opt/ros/melodic/share/std_msgs/cmake/../msg;uuid_msgs;/opt/ros/melodic/share/uuid_msgs/cmake/../msg' python_executable = '/usr/bin/python2' package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = '/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py'
# *-* coding: utf-8 *-* class Customer: def __init__(self, firstname=None, lastname=None, address1=None, postcode=None, city=None, phone=None, email=None, password=None, confirmed_password=None): self.firstname = firstname self.lastname = lastname self.address1 = address1 self.postcode = postcode self.city = city self.phone = phone self.email = email self.password = password self.confirmed_password = confirmed_password
class Customer: def __init__(self, firstname=None, lastname=None, address1=None, postcode=None, city=None, phone=None, email=None, password=None, confirmed_password=None): self.firstname = firstname self.lastname = lastname self.address1 = address1 self.postcode = postcode self.city = city self.phone = phone self.email = email self.password = password self.confirmed_password = confirmed_password
class Solution(object): def longestValidParentheses(self, s): if len(s) == 0: return 0 stack = [-1] result = 0 for idx, ch in enumerate(s): if ch == "(": stack.append(idx) else: stack.pop() if len(stack) == 0: stack.append(idx) else: length = idx-stack[-1] result = max(result, length) return result def longestParentheses(string): if len(string) == 0: return 0 stk = [] longestLength = 0 for i, ch in enumerate(string): if ch == '(': stk.append(i) elif ch == ')': if stk: open_i = stk.pop() length = i-open_i + 1 if length > longestLength: longestLength = length return longestLength
class Solution(object): def longest_valid_parentheses(self, s): if len(s) == 0: return 0 stack = [-1] result = 0 for (idx, ch) in enumerate(s): if ch == '(': stack.append(idx) else: stack.pop() if len(stack) == 0: stack.append(idx) else: length = idx - stack[-1] result = max(result, length) return result def longest_parentheses(string): if len(string) == 0: return 0 stk = [] longest_length = 0 for (i, ch) in enumerate(string): if ch == '(': stk.append(i) elif ch == ')': if stk: open_i = stk.pop() length = i - open_i + 1 if length > longestLength: longest_length = length return longestLength
# You are at the zoo, and the meerkats look strange. # You will receive 3 strings: (tail, body, head). # Your task is to re-arrange the elements in a list # so that the animal looks normal again: (head, body, tail). tail = input() body = input() head = input() lst = [head,body,tail] print(lst)
tail = input() body = input() head = input() lst = [head, body, tail] print(lst)
tiles = [ # highway=steps, with route regional (Coastal Trail, Marin, II) # https://www.openstreetmap.org/way/24655593 # https://www.openstreetmap.org/relation/2260059 [12, 653, 1582], # highway=steps, no route, but has name, and designation (Levant St Stairway, SF) # https://www.openstreetmap.org/way/38060491 [13, 1309, 3166] ] for z, x, y in tiles: assert_has_feature( z, x, y, 'roads', {'highway': 'steps'}) # way 25292070 highway=steps, no route, but has name (Esmeralda, Bernal, SF) assert_no_matching_feature( 13, 1310, 3167, 'roads', {'kind': 'path', 'highway': 'steps', 'name': 'Esmeralda Ave.'}) # way 25292070 highway=steps, no route, but has name (Esmeralda, Bernal, SF) assert_has_feature( 14, 2620, 6334, 'roads', {'kind': 'path', 'highway': 'steps', 'name': 'Esmeralda Ave.'})
tiles = [[12, 653, 1582], [13, 1309, 3166]] for (z, x, y) in tiles: assert_has_feature(z, x, y, 'roads', {'highway': 'steps'}) assert_no_matching_feature(13, 1310, 3167, 'roads', {'kind': 'path', 'highway': 'steps', 'name': 'Esmeralda Ave.'}) assert_has_feature(14, 2620, 6334, 'roads', {'kind': 'path', 'highway': 'steps', 'name': 'Esmeralda Ave.'})
# Copyright 2018 BlueCat Networks. All rights reserved. # -*- coding: utf-8 -*- type = 'api' sub_pages = [ { 'name' : 'ipam_page', 'title' : u'Cisco_DNA_IPAM_Interface', 'endpoint' : 'ipam/ipam_endpoint', 'description' : u'Gateway workflow to be IPAM interface to integrate with Cisco DNA Centre' }, ]
type = 'api' sub_pages = [{'name': 'ipam_page', 'title': u'Cisco_DNA_IPAM_Interface', 'endpoint': 'ipam/ipam_endpoint', 'description': u'Gateway workflow to be IPAM interface to integrate with Cisco DNA Centre'}]
n=int(input()) alpha_code = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:' NEW_INPUT = 9 NUMERIC = 1 ALPHA = 2 BYTE_CODE = 4 KANJI = 8 TERMINATION = 0 while n: code = int(input(), 16) state = NEW_INPUT ans = '' p = 38*4 ret_size = 0 while p>0: if state == TERMINATION: break elif state == NEW_INPUT: p-=4 state = code//(2**p) code%=2**p elif state == NUMERIC: p-=10 size = code//(2**p) code%=2**p while size: if size == 1: p-=4 data = code//(2**p) code%=2**p ret_size+=1 size-=1 ans+='%01d'%data elif size == 2: p-=7 data = code//(2**p) code%=2**p ret_size+=2 size-=2 ans+='%02d'%data else: p-=10 data = code//(2**p) code%=2**p ret_size+=3 size-=3 ans+='%03d'%data state = NEW_INPUT elif state == ALPHA: p-=9 size = code//(2**p) code%=2**p while size: if size==1: p-=6 data = code//(2**p) code%=2**p ret_size+=1 size-=1 ans+=alpha_code[data] else: p-=11 data = code//(2**p) code%=2**p ret_size+=2 size-=2 data1 = alpha_code[data//45] data2 = alpha_code[data%45] ans+= data1+data2 state = NEW_INPUT elif state == BYTE_CODE: p-=8 size = code//(2**p) code%=2**p while size: p-=8 size-=1 data = code//(2**p) code%=2**p ret_size+=1 if data>=0x20 and data<=0x7e: ans+=chr(data) else: ans+='\\'+'%02X'%(data) state = NEW_INPUT elif state == KANJI: p-=8 size = code//(2**p) code%=2**p while size: p-=13 size-=1 data = code//(2**p) code%=2**p ret_size+=1 ans+='#'+'%04X'%(data) state = NEW_INPUT print(ret_size, ans) n-=1
n = int(input()) alpha_code = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:' new_input = 9 numeric = 1 alpha = 2 byte_code = 4 kanji = 8 termination = 0 while n: code = int(input(), 16) state = NEW_INPUT ans = '' p = 38 * 4 ret_size = 0 while p > 0: if state == TERMINATION: break elif state == NEW_INPUT: p -= 4 state = code // 2 ** p code %= 2 ** p elif state == NUMERIC: p -= 10 size = code // 2 ** p code %= 2 ** p while size: if size == 1: p -= 4 data = code // 2 ** p code %= 2 ** p ret_size += 1 size -= 1 ans += '%01d' % data elif size == 2: p -= 7 data = code // 2 ** p code %= 2 ** p ret_size += 2 size -= 2 ans += '%02d' % data else: p -= 10 data = code // 2 ** p code %= 2 ** p ret_size += 3 size -= 3 ans += '%03d' % data state = NEW_INPUT elif state == ALPHA: p -= 9 size = code // 2 ** p code %= 2 ** p while size: if size == 1: p -= 6 data = code // 2 ** p code %= 2 ** p ret_size += 1 size -= 1 ans += alpha_code[data] else: p -= 11 data = code // 2 ** p code %= 2 ** p ret_size += 2 size -= 2 data1 = alpha_code[data // 45] data2 = alpha_code[data % 45] ans += data1 + data2 state = NEW_INPUT elif state == BYTE_CODE: p -= 8 size = code // 2 ** p code %= 2 ** p while size: p -= 8 size -= 1 data = code // 2 ** p code %= 2 ** p ret_size += 1 if data >= 32 and data <= 126: ans += chr(data) else: ans += '\\' + '%02X' % data state = NEW_INPUT elif state == KANJI: p -= 8 size = code // 2 ** p code %= 2 ** p while size: p -= 13 size -= 1 data = code // 2 ** p code %= 2 ** p ret_size += 1 ans += '#' + '%04X' % data state = NEW_INPUT print(ret_size, ans) n -= 1
# Read two rectangles, discern wheter rect1 is inside rect2 class Rectangle: def __init__(self, *tokens): self.left, self.top, self.width, self.height = list(map(float, tokens)) def is_inside(self, other_rect): if type(other_rect) is not Rectangle: raise TypeError('other_rect is not a Point object.') inside_horiz = self.left >= other_rect.left and self.width <= other_rect.width inside_verti = self.top <= other_rect.top and self.height <= other_rect.height fully_inside = inside_horiz and inside_verti result = 'Inside' if fully_inside else 'Not inside' return(result) rectangle_list = [] for i in range(2): user_input = input().split() user_input = map(int, user_input) cur_rect = Rectangle(*user_input) rectangle_list.append(cur_rect) print(rectangle_list[0].is_inside(rectangle_list[1]))
class Rectangle: def __init__(self, *tokens): (self.left, self.top, self.width, self.height) = list(map(float, tokens)) def is_inside(self, other_rect): if type(other_rect) is not Rectangle: raise type_error('other_rect is not a Point object.') inside_horiz = self.left >= other_rect.left and self.width <= other_rect.width inside_verti = self.top <= other_rect.top and self.height <= other_rect.height fully_inside = inside_horiz and inside_verti result = 'Inside' if fully_inside else 'Not inside' return result rectangle_list = [] for i in range(2): user_input = input().split() user_input = map(int, user_input) cur_rect = rectangle(*user_input) rectangle_list.append(cur_rect) print(rectangle_list[0].is_inside(rectangle_list[1]))
#!/usr/bin/python # This is my shopping list shoplist = ['apple', 'mango', 'carrot', 'banana'] print('I have', len(shoplist), 'item to purchase.') print('These items are:', end=' ') for item in shoplist: print(item, end = ' ') print('\nI also have to buy rice.') shoplist.append('rice') print('My shopping list is now', shoplist) print('I will sort my list now') shoplist.sort() print('Sorted shopping list is', shoplist) print('The first item I will buy is', shoplist[0]) olditem = shoplist[0] del shoplist[0] print('I bought the', olditem) print('My shopping list is now', shoplist)
shoplist = ['apple', 'mango', 'carrot', 'banana'] print('I have', len(shoplist), 'item to purchase.') print('These items are:', end=' ') for item in shoplist: print(item, end=' ') print('\nI also have to buy rice.') shoplist.append('rice') print('My shopping list is now', shoplist) print('I will sort my list now') shoplist.sort() print('Sorted shopping list is', shoplist) print('The first item I will buy is', shoplist[0]) olditem = shoplist[0] del shoplist[0] print('I bought the', olditem) print('My shopping list is now', shoplist)
graph={ 'A':['B','C'], 'B':['A'], 'C':['D','E','F','S'], 'D':['C'], 'E':['C','H'], 'F':['C','G'], 'G':['F','G'], 'H':['E','G'], 'S':['A','C','G'] } visited=[] def dfs(graph,node): if node not in visited: visited.append(node) for n in graph[node]: dfs(graph,n) dfs(graph,'A') print(visited)
graph = {'A': ['B', 'C'], 'B': ['A'], 'C': ['D', 'E', 'F', 'S'], 'D': ['C'], 'E': ['C', 'H'], 'F': ['C', 'G'], 'G': ['F', 'G'], 'H': ['E', 'G'], 'S': ['A', 'C', 'G']} visited = [] def dfs(graph, node): if node not in visited: visited.append(node) for n in graph[node]: dfs(graph, n) dfs(graph, 'A') print(visited)
''' Lec 7 while loop ''' i=5 while i >=0 : try: print(1/(i-3)) except: pass i = i - 1
""" Lec 7 while loop """ i = 5 while i >= 0: try: print(1 / (i - 3)) except: pass i = i - 1
''' ''' # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. Test.Summary = 'Testing ATS TCP handshake timeout' # Skipping this in the normal CI because it requires privilege. # Comment out to run in your privileged environment Test.SkipIf(Condition.true("Test requires privilege")) ts = Test.MakeATSProcess("ts") Test.ContinueOnFail = True Test.GetTcpPort("blocked_upstream_port") Test.GetTcpPort("upstream_port") server4 = Test.MakeOriginServer("server4") ts.Disk.records_config.update({ 'proxy.config.url_remap.remap_required': 1, 'proxy.config.http.connect_attempts_timeout': 2, 'proxy.config.http.connect_attempts_max_retries': 0, 'proxy.config.http.transaction_no_activity_timeout_out': 5, 'proxy.config.diags.debug.enabled': 0, 'proxy.config.diags.debug.tags': 'http', }) ts.Disk.remap_config.AddLine('map /blocked http://10.1.1.1:{0}'.format(Test.Variables.blocked_upstream_port)) ts.Disk.remap_config.AddLine('map /not-blocked http://10.1.1.1:{0}'.format(Test.Variables.upstream_port)) ts.Disk.logging_yaml.AddLines( ''' logging: formats: - name: testformat format: '%<pssc> %<cquc> %<pscert> %<cscert>' logs: - mode: ascii format: testformat filename: squid '''.split("\n") ) # Set up the network name space. Requires privilege tr = Test.AddTestRun("tr-ns-setup") tr.Processes.Default.StartBefore(ts) tr.Processes.Default.TimeOut = 2 tr.Setup.Copy('setupnetns.sh') tr.Processes.Default.Command = 'echo start; sudo sh -x ./setupnetns.sh {0} {1}'.format( Test.Variables.blocked_upstream_port, Test.Variables.upstream_port) # Request to the port that is blocked in the network ns. The SYN should never be responded to # and the connect timeout should trigger with a 50x return. If the SYN handshake occurs, the # no activity timeout would trigger, but not before the test timeout expires tr = Test.AddTestRun("tr-blocking") tr.Processes.Default.Command = 'curl -i http://127.0.0.1:{0}/blocked {0}'.format(ts.Variables.port) tr.Processes.Default.TimeOut = 4 tr.Processes.Default.Streams.All = Testers.ContainsExpression( "HTTP/1.1 502 internal error - server connection terminated", "Connect failed") tr = Test.AddTestRun("tr-blocking-post") tr.Processes.Default.Command = 'curl -d "stuff" -i http://127.0.0.1:{0}/blocked {0}'.format(ts.Variables.port) tr.Processes.Default.TimeOut = 4 tr.Processes.Default.Streams.All = Testers.ContainsExpression( "HTTP/1.1 502 internal error - server connection terminated", "Connect failed") # Should not catch the connect timeout. Even though the first bytes are not sent until after the 2 second connect timeout # But before the no-activity timeout tr = Test.AddTestRun("tr-delayed") tr.Setup.Copy('delay-server.sh') tr.Setup.Copy('case1.sh') tr.Processes.Default.Command = 'sh ./case1.sh {0} {1}'.format(ts.Variables.port, ts.Variables.upstream_port) tr.Processes.Default.TimeOut = 7 tr.Processes.Default.Streams.All = Testers.ContainsExpression("HTTP/1.1 200", "Connect succeeded") # cleanup the network namespace and virtual network tr = Test.AddTestRun("tr-cleanup") tr.Processes.Default.Command = 'sudo ip netns del testserver; sudo ip link del veth0 type veth peer name veth1' tr.Processes.Default.TimeOut = 4 tr = Test.AddTestRun("Wait for the access log to write out") tr.Processes.Default.StartBefore(server4, ready=When.FileExists(ts.Disk.squid_log)) tr.StillRunningAfter = ts tr.Processes.Default.Command = 'echo "log file exists"' tr.Processes.Default.ReturnCode = 0
""" """ Test.Summary = 'Testing ATS TCP handshake timeout' Test.SkipIf(Condition.true('Test requires privilege')) ts = Test.MakeATSProcess('ts') Test.ContinueOnFail = True Test.GetTcpPort('blocked_upstream_port') Test.GetTcpPort('upstream_port') server4 = Test.MakeOriginServer('server4') ts.Disk.records_config.update({'proxy.config.url_remap.remap_required': 1, 'proxy.config.http.connect_attempts_timeout': 2, 'proxy.config.http.connect_attempts_max_retries': 0, 'proxy.config.http.transaction_no_activity_timeout_out': 5, 'proxy.config.diags.debug.enabled': 0, 'proxy.config.diags.debug.tags': 'http'}) ts.Disk.remap_config.AddLine('map /blocked http://10.1.1.1:{0}'.format(Test.Variables.blocked_upstream_port)) ts.Disk.remap_config.AddLine('map /not-blocked http://10.1.1.1:{0}'.format(Test.Variables.upstream_port)) ts.Disk.logging_yaml.AddLines("\nlogging:\n formats:\n - name: testformat\n format: '%<pssc> %<cquc> %<pscert> %<cscert>'\n logs:\n - mode: ascii\n format: testformat\n filename: squid\n".split('\n')) tr = Test.AddTestRun('tr-ns-setup') tr.Processes.Default.StartBefore(ts) tr.Processes.Default.TimeOut = 2 tr.Setup.Copy('setupnetns.sh') tr.Processes.Default.Command = 'echo start; sudo sh -x ./setupnetns.sh {0} {1}'.format(Test.Variables.blocked_upstream_port, Test.Variables.upstream_port) tr = Test.AddTestRun('tr-blocking') tr.Processes.Default.Command = 'curl -i http://127.0.0.1:{0}/blocked {0}'.format(ts.Variables.port) tr.Processes.Default.TimeOut = 4 tr.Processes.Default.Streams.All = Testers.ContainsExpression('HTTP/1.1 502 internal error - server connection terminated', 'Connect failed') tr = Test.AddTestRun('tr-blocking-post') tr.Processes.Default.Command = 'curl -d "stuff" -i http://127.0.0.1:{0}/blocked {0}'.format(ts.Variables.port) tr.Processes.Default.TimeOut = 4 tr.Processes.Default.Streams.All = Testers.ContainsExpression('HTTP/1.1 502 internal error - server connection terminated', 'Connect failed') tr = Test.AddTestRun('tr-delayed') tr.Setup.Copy('delay-server.sh') tr.Setup.Copy('case1.sh') tr.Processes.Default.Command = 'sh ./case1.sh {0} {1}'.format(ts.Variables.port, ts.Variables.upstream_port) tr.Processes.Default.TimeOut = 7 tr.Processes.Default.Streams.All = Testers.ContainsExpression('HTTP/1.1 200', 'Connect succeeded') tr = Test.AddTestRun('tr-cleanup') tr.Processes.Default.Command = 'sudo ip netns del testserver; sudo ip link del veth0 type veth peer name veth1' tr.Processes.Default.TimeOut = 4 tr = Test.AddTestRun('Wait for the access log to write out') tr.Processes.Default.StartBefore(server4, ready=When.FileExists(ts.Disk.squid_log)) tr.StillRunningAfter = ts tr.Processes.Default.Command = 'echo "log file exists"' tr.Processes.Default.ReturnCode = 0
# udacity solution, normaly I would have ordered it, and the traverse it being O(nlogn + N). # like this is O(2N) def longest_consecutive_subsequence(input_list): # Create a dictionary. # Each element of the input_list would become a "key", and # the corresponding index in the input_list would become the "value" element_dict = dict() # Traverse through the input_list, and populate the dictionary # Time complexity = O(n) for index, element in enumerate(input_list): element_dict[element] = index # Represents the length of longest subsequence max_length = -1 # Represents the index of smallest element in the longest subsequence starts_at = -1 # Traverse again - Time complexity = O(n) for index, element in enumerate(input_list): current_starts = index element_dict[element] = -1 # Mark as visited current_count = 1 # length of the current subsequence '''CHECK ONE ELEMENT FORWARD''' current = element + 1 # `current` is the expected number # check if the expected number is available (as a key) in the dictionary, # and it has not been visited yet (i.e., value > 0) # Time complexity: Constant time for checking a key and retrieving the value = O(1) while current in element_dict and element_dict[current] > 0: current_count += 1 # increment the length of subsequence element_dict[current] = -1 # Mark as visited current = current + 1 '''CHECK ONE ELEMENT BACKWARD''' # Time complexity: Constant time for checking a key and retrieving the value = O(1) current = element - 1 # `current` is the expected number while current in element_dict and element_dict[current] > 0: current_starts = element_dict[ current] # index of smallest element in the current subsequence current_count += 1 # increment the length of subsequence element_dict[current] = -1 current = current - 1 '''If length of current subsequence >= max length of previously visited subsequence''' if current_count >= max_length: if current_count == max_length and current_starts > starts_at: continue starts_at = current_starts # index of smallest element in the current (longest so far) subsequence max_length = current_count # store the length of current (longest so far) subsequence start_element = input_list[starts_at] # smallest element in the longest subsequence # return a NEW list starting from `start_element` to `(start_element + max_length)` return [element for element in range(start_element, start_element + max_length)] def test_function(test_case): output = longest_consecutive_subsequence(test_case[0]) if output == test_case[1]: print("Pass") else: print("Fail") test_case_1 = [[5, 4, 7, 10, 1, 3, 55, 2], [1, 2, 3, 4, 5]] test_function(test_case_1) test_case_2 = [[2, 12, 9, 16, 10, 5, 3, 20, 25, 11, 1, 8, 6 ], [8, 9, 10, 11, 12]] test_function(test_case_2) test_case_3 = [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]] test_function(test_case_3)
def longest_consecutive_subsequence(input_list): element_dict = dict() for (index, element) in enumerate(input_list): element_dict[element] = index max_length = -1 starts_at = -1 for (index, element) in enumerate(input_list): current_starts = index element_dict[element] = -1 current_count = 1 'CHECK ONE ELEMENT FORWARD' current = element + 1 while current in element_dict and element_dict[current] > 0: current_count += 1 element_dict[current] = -1 current = current + 1 'CHECK ONE ELEMENT BACKWARD' current = element - 1 while current in element_dict and element_dict[current] > 0: current_starts = element_dict[current] current_count += 1 element_dict[current] = -1 current = current - 1 'If length of current subsequence >= max length of previously visited subsequence' if current_count >= max_length: if current_count == max_length and current_starts > starts_at: continue starts_at = current_starts max_length = current_count start_element = input_list[starts_at] return [element for element in range(start_element, start_element + max_length)] def test_function(test_case): output = longest_consecutive_subsequence(test_case[0]) if output == test_case[1]: print('Pass') else: print('Fail') test_case_1 = [[5, 4, 7, 10, 1, 3, 55, 2], [1, 2, 3, 4, 5]] test_function(test_case_1) test_case_2 = [[2, 12, 9, 16, 10, 5, 3, 20, 25, 11, 1, 8, 6], [8, 9, 10, 11, 12]] test_function(test_case_2) test_case_3 = [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4]] test_function(test_case_3)
# Problem Code: HDIVISR def highest_divisor(n): for i in range(10, 0, -1): if not n % i: return i n = int(input()) print(highest_divisor(n))
def highest_divisor(n): for i in range(10, 0, -1): if not n % i: return i n = int(input()) print(highest_divisor(n))
_settings = None def set_settings(settings): global _settings _settings = settings def get_settings(): global _settings return _settings
_settings = None def set_settings(settings): global _settings _settings = settings def get_settings(): global _settings return _settings
# ======================== # Information # ======================== # Direct Link: https://www.hackerrank.com/challenges/s10-basic-statistics/problem # Difficulty: Easy # Max Score: 30 # Language: Python # ======================== # Solution # ======================== N = int(input()) NUMBER = list(map(int, input().split())) # Mean SUM = 0 for i in NUMBER: SUM = SUM + i print(float(SUM / N)) # Median NUMBER = sorted(NUMBER) if N % 2 == 0: A = NUMBER[N//2] B = NUMBER[N//2 - 1] print((A+B)/2) else: print(NUMBER[N//2]) # Mode MAX_1 = 0 NUMBER = sorted(NUMBER) for i in NUMBER: COUNTER = 0 INDEX = NUMBER.index(i) for j in range(INDEX, len(NUMBER)): if i == NUMBER[j]: COUNTER = COUNTER + 1 if COUNTER > MAX_1: MAX_1 = COUNTER if MAX_1 == 1: MODE = NUMBER[0] else: MODE = i print(MODE)
n = int(input()) number = list(map(int, input().split())) sum = 0 for i in NUMBER: sum = SUM + i print(float(SUM / N)) number = sorted(NUMBER) if N % 2 == 0: a = NUMBER[N // 2] b = NUMBER[N // 2 - 1] print((A + B) / 2) else: print(NUMBER[N // 2]) max_1 = 0 number = sorted(NUMBER) for i in NUMBER: counter = 0 index = NUMBER.index(i) for j in range(INDEX, len(NUMBER)): if i == NUMBER[j]: counter = COUNTER + 1 if COUNTER > MAX_1: max_1 = COUNTER if MAX_1 == 1: mode = NUMBER[0] else: mode = i print(MODE)
# Module 3 Assignment # Jordan Phillips myfile = open("question.txt", "r+") myquestion = myfile.read() myresponse = input(myquestion) myfile.write(myresponse) myfile.close()
myfile = open('question.txt', 'r+') myquestion = myfile.read() myresponse = input(myquestion) myfile.write(myresponse) myfile.close()
favorite_fruits = ['banana', 'orange', 'lemon'] listed_fruits = ['apple', 'banana', 'orange', 'grappe', 'blackberry', 'lemon'] for favorite_fruit in favorite_fruits: for listed_fruit in listed_fruits: if listed_fruit == favorite_fruit: print ("You really like " + listed_fruit) print ('\n') for listed_fruit in listed_fruits: check = False for favorite_fruit in favorite_fruits: if favorite_fruit == listed_fruit: check = True print ("You reallly like " + listed_fruit) if check == False: print ("You really don't like " + listed_fruit) print ('\n') for listed_fruit in listed_fruits: if listed_fruit in favorite_fruits: print ("You really like " + listed_fruit) else : print ("You really don't like " + listed_fruit)
favorite_fruits = ['banana', 'orange', 'lemon'] listed_fruits = ['apple', 'banana', 'orange', 'grappe', 'blackberry', 'lemon'] for favorite_fruit in favorite_fruits: for listed_fruit in listed_fruits: if listed_fruit == favorite_fruit: print('You really like ' + listed_fruit) print('\n') for listed_fruit in listed_fruits: check = False for favorite_fruit in favorite_fruits: if favorite_fruit == listed_fruit: check = True print('You reallly like ' + listed_fruit) if check == False: print("You really don't like " + listed_fruit) print('\n') for listed_fruit in listed_fruits: if listed_fruit in favorite_fruits: print('You really like ' + listed_fruit) else: print("You really don't like " + listed_fruit)
numbers = list(map(int, input().split())) expected = [2, 2, 2, 1.5, 1, 0] ans = 0 for n, e in zip(numbers, expected): ans += e * n print(ans)
numbers = list(map(int, input().split())) expected = [2, 2, 2, 1.5, 1, 0] ans = 0 for (n, e) in zip(numbers, expected): ans += e * n print(ans)
class Student: def __init__(self): self.name=input('Enter name') self.age=int(input('Enter age')) def display(self): print(self.name,self.age) s=Student() s.display()
class Student: def __init__(self): self.name = input('Enter name') self.age = int(input('Enter age')) def display(self): print(self.name, self.age) s = student() s.display()
i4 = Int32Scalar("b4", 2) i5 = Int32Scalar("b5", 2) i6 = Int32Scalar("b6", 2) i7 = Int32Scalar("b7", 0) i2 = Input("op2", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}") # input 0 i3 = Output("op3", "TENSOR_QUANT8_ASYMM", "{1, 1, 1, 1}") # output 0 i0 = Parameter("op0", "TENSOR_QUANT8_ASYMM", "{1, 2, 2, 1}", [1, 1, 1, 1]) # parameters i1 = Parameter("op1", "TENSOR_INT32", "{1}", [0]) # parameters model = Model() model = model.Conv(i2, i0, i1, i4, i5, i6, i7).To(i3)
i4 = int32_scalar('b4', 2) i5 = int32_scalar('b5', 2) i6 = int32_scalar('b6', 2) i7 = int32_scalar('b7', 0) i2 = input('op2', 'TENSOR_QUANT8_ASYMM', '{1, 2, 2, 1}') i3 = output('op3', 'TENSOR_QUANT8_ASYMM', '{1, 1, 1, 1}') i0 = parameter('op0', 'TENSOR_QUANT8_ASYMM', '{1, 2, 2, 1}', [1, 1, 1, 1]) i1 = parameter('op1', 'TENSOR_INT32', '{1}', [0]) model = model() model = model.Conv(i2, i0, i1, i4, i5, i6, i7).To(i3)
# ---------------------------------------------------------------- # SUNDIALS Copyright Start # Copyright (c) 2002-2022, Lawrence Livermore National Security # and Southern Methodist University. # All rights reserved. # # See the top-level LICENSE and NOTICE files for details. # # SPDX-License-Identifier: BSD-3-Clause # SUNDIALS Copyright End # ---------------------------------------------------------------- sundials_version = 'v6.1.1' arkode_version = 'v5.1.1' cvode_version = 'v6.1.1' cvodes_version = 'v6.1.1' ida_version = 'v6.1.1' idas_version = 'v5.1.1' kinsol_version = 'v6.1.1'
sundials_version = 'v6.1.1' arkode_version = 'v5.1.1' cvode_version = 'v6.1.1' cvodes_version = 'v6.1.1' ida_version = 'v6.1.1' idas_version = 'v5.1.1' kinsol_version = 'v6.1.1'
# Captain's Quarters (106030800) blackViking = 3300110 sm.spawnMob(blackViking)
black_viking = 3300110 sm.spawnMob(blackViking)
# zadanie 1 # Wygeneruj liczby podzielne przez 4 i zapisz je do pliku. plik = open('zadanie_1.txt', 'w') for i in range(0, 1000, 1): plik.write(str(i*4)+'\n') plik.close()
plik = open('zadanie_1.txt', 'w') for i in range(0, 1000, 1): plik.write(str(i * 4) + '\n') plik.close()
def find_secret_message(paragraph): unique = set() result = [] for word in (a.strip('.,:!?').lower() for a in paragraph.split()): if word in unique and word not in result: result.append(word) unique.add(word) return ' '.join(result)
def find_secret_message(paragraph): unique = set() result = [] for word in (a.strip('.,:!?').lower() for a in paragraph.split()): if word in unique and word not in result: result.append(word) unique.add(word) return ' '.join(result)
class EntityNotFoundException(Exception): pass class SessionExpiredException(Exception): pass
class Entitynotfoundexception(Exception): pass class Sessionexpiredexception(Exception): pass
def main(): NAME = input("What is your name?: ") print("Hello "+ str(NAME) + "!") if __name__ == '__main__': main()
def main(): name = input('What is your name?: ') print('Hello ' + str(NAME) + '!') if __name__ == '__main__': main()
#ipaddress validation def ip_val(ipadd): l=ipadd.split(".") if len(l)!=4: return False for i in l: if int(i) not in range(256): return False return True print(ip_val("192.168.0.1")) print(ip_val("192.168.0.1.1")) print(ip_val("192.168.258.1"))
def ip_val(ipadd): l = ipadd.split('.') if len(l) != 4: return False for i in l: if int(i) not in range(256): return False return True print(ip_val('192.168.0.1')) print(ip_val('192.168.0.1.1')) print(ip_val('192.168.258.1'))
class Solution: def XXX(self, digits: List[int]) -> List[int]: digits = [str(i) for i in digits] s = str(int(''.join(digits))+1) ans = [int(i) for i in s] return ans
class Solution: def xxx(self, digits: List[int]) -> List[int]: digits = [str(i) for i in digits] s = str(int(''.join(digits)) + 1) ans = [int(i) for i in s] return ans
X,Y,x,y=map(int,input().split()) while 1: d="" if y>Y:d+="N";y-=1 if y<Y:d+="S";y+=1 if x>X:d+="W";x-=1 if x<X:d+="E";x+=1 print(d)
(x, y, x, y) = map(int, input().split()) while 1: d = '' if y > Y: d += 'N' y -= 1 if y < Y: d += 'S' y += 1 if x > X: d += 'W' x -= 1 if x < X: d += 'E' x += 1 print(d)
with open("Input.txt", "r") as fp: lines = fp.readlines() # remove whitespace characters like `\n` at the end of each line lines = [x.strip() for x in lines] # clockwise # N # W E # S directions = [(1, 0), (0, -1), (-1, 0), (0, 1)] cur_direction = 0 # East pos_x, pos_y = (0, 0) for line in lines: instr, val = line[:1], int(line[1:]) print(f"{instr}, {val}") if instr == 'F': pos_x += directions[cur_direction][0] * val pos_y += directions[cur_direction][1] * val if instr == 'E': pos_x += val if instr == 'S': pos_y -= val if instr == 'W': pos_x -= val if instr == 'N': pos_y += val if instr == 'R': if val == 90: cur_direction = (cur_direction + 1) % 4 elif val == 180: cur_direction = (cur_direction + 2) % 4 elif val == 270: cur_direction = (cur_direction + 3) % 4 else: print(f"UNKNOSN R {val}") raise Exception if instr == 'L': if val == 90: cur_direction = (cur_direction - 1 + 4) % 4 elif val == 180: cur_direction = (cur_direction - 2 + 4) % 4 elif val == 270: cur_direction = (cur_direction - 3 + 4) % 4 else: print(f"UNKNOSN R {val}") raise Exception print(f"pos= {pos_x}, {pos_y}") print(f"solution1 = {abs(pos_x) + abs(pos_y)}") # 2847
with open('Input.txt', 'r') as fp: lines = fp.readlines() lines = [x.strip() for x in lines] directions = [(1, 0), (0, -1), (-1, 0), (0, 1)] cur_direction = 0 (pos_x, pos_y) = (0, 0) for line in lines: (instr, val) = (line[:1], int(line[1:])) print(f'{instr}, {val}') if instr == 'F': pos_x += directions[cur_direction][0] * val pos_y += directions[cur_direction][1] * val if instr == 'E': pos_x += val if instr == 'S': pos_y -= val if instr == 'W': pos_x -= val if instr == 'N': pos_y += val if instr == 'R': if val == 90: cur_direction = (cur_direction + 1) % 4 elif val == 180: cur_direction = (cur_direction + 2) % 4 elif val == 270: cur_direction = (cur_direction + 3) % 4 else: print(f'UNKNOSN R {val}') raise Exception if instr == 'L': if val == 90: cur_direction = (cur_direction - 1 + 4) % 4 elif val == 180: cur_direction = (cur_direction - 2 + 4) % 4 elif val == 270: cur_direction = (cur_direction - 3 + 4) % 4 else: print(f'UNKNOSN R {val}') raise Exception print(f'pos= {pos_x}, {pos_y}') print(f'solution1 = {abs(pos_x) + abs(pos_y)}')
# You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other # items. We want to create the text that should be displayed next to such an item. # # Implement a function likes :: [String] -> String, which must take in input array, containing the names of people # who like an item. It must return the display text as shown in the examples: # # likes([]) # must be "no one likes this" # likes(["Peter"]) # must be "Peter likes this" # likes(["Jacob", "Alex"]) # must be "Jacob and Alex like this" # likes(["Max", "John", "Mark"]) # must be "Max, John and Mark like this" # likes(["Alex", "Jacob", "Mark", "Max"]) # must be "Alex, Jacob and 2 others like this" # For 4 or more names, the number in and 2 others simply increases. def likes(names): if not names: return "no one likes this" elif len(names) == 1: return names[0] + " likes this" elif len(names) == 2: return names[0] + " and " + names[1] + " like this" elif len(names) == 3: return names[0] + ", " + names[1] + " and " + names[2] + " like this" else: return names[0] + ", " + names[1] + " and " + str(len(names)-2) + " others like this"
def likes(names): if not names: return 'no one likes this' elif len(names) == 1: return names[0] + ' likes this' elif len(names) == 2: return names[0] + ' and ' + names[1] + ' like this' elif len(names) == 3: return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like this' else: return names[0] + ', ' + names[1] + ' and ' + str(len(names) - 2) + ' others like this'
class Solution: def isValid(self, s: str) -> bool: ans = list() for x in s: if x in ['(', '{', '[']: ans.append(x) elif x == ')': if len(ans) < 1: return False if ans[-1] == '(': ans.pop(-1) else: return False elif x == ']': if len(ans) < 1: return False if ans[-1] == '[': ans.pop(-1) else: return False elif x == '}': if len(ans) < 1: return False if ans[-1] == '{': ans.pop(-1) else: return False if len(ans) > 0: return False return True
class Solution: def is_valid(self, s: str) -> bool: ans = list() for x in s: if x in ['(', '{', '[']: ans.append(x) elif x == ')': if len(ans) < 1: return False if ans[-1] == '(': ans.pop(-1) else: return False elif x == ']': if len(ans) < 1: return False if ans[-1] == '[': ans.pop(-1) else: return False elif x == '}': if len(ans) < 1: return False if ans[-1] == '{': ans.pop(-1) else: return False if len(ans) > 0: return False return True
COMMON = 'http://www.webex.com/schemas/2002/06/common' SERVICE = 'http://www.webex.com/schemas/2002/06/service' EP = '%s/ep' % SERVICE EVENT = '%s/event' % SERVICE ATTENDEE = '%s/attendee' % SERVICE HISTORY = '%s/history' % SERVICE SITE = '%s/site' % SERVICE PREFIXES = { 'com': COMMON, 'serv': SERVICE, 'ep': EP, 'event': EVENT, 'att': ATTENDEE, 'history': HISTORY, 'site': SITE }
common = 'http://www.webex.com/schemas/2002/06/common' service = 'http://www.webex.com/schemas/2002/06/service' ep = '%s/ep' % SERVICE event = '%s/event' % SERVICE attendee = '%s/attendee' % SERVICE history = '%s/history' % SERVICE site = '%s/site' % SERVICE prefixes = {'com': COMMON, 'serv': SERVICE, 'ep': EP, 'event': EVENT, 'att': ATTENDEE, 'history': HISTORY, 'site': SITE}
blosum ={ "SW": -3, "GG": 6, "EM": -2, "AN": -2, "AY": -2, "WQ": -2, "VN": -3, "FK": -3, "GE": -2, "ED": 2, "WP": -4, "IT": -1, "FD": -3, "KV": -2, "CY": -2, "GD": -1, "TN": 0, "WW": 11, "SS": 4, "KC": -3, "EF": -3, "NL": -3, "AK": -1, "QP": -1, "FG": -3, "DS": 0, "CV": -1, "VT": 0, "HP": -2, "PV": -2, "IQ": -3, "FV": -1, "WT": -2, "HF": -1, "PD": -1, "QR": 1, "DQ": 0, "KQ": 1, "DF": -3, "VW": -3, "TC": -1, "AF": -2, "TH": -2, "AQ": -1, "QT": -1, "VF": -1, "FC": -2, "CR": -3, "VP": -2, "HT": -2, "EL": -3, "FR": -3, "IG": -4, "CQ": -3, "YV": -1, "TA": 0, "TV": 0, "QV": -2, "SK": 0, "KK": 5, "EN": 0, "NT": 0, "AH": -2, "AC": 0, "VS": -2, "QH": 0, "HS": -1, "QY": -1, "PN": -2, "IY": -1, "PG": -2, "FN": -3, "HN": 1, "KH": -1, "NW": -4, "SY": -2, "WN": -4, "DY": -3, "EQ": 2, "KY": -2, "SG": 0, "YS": -2, "GR": -2, "AL": -1, "AG": 0, "TK": -1, "TP": -1, "MV": 1, "QL": -2, "ES": 0, "HW": -2, "ID": -3, "KF": -3, "NA": -2, "TI": -1, "QN": 0, "KW": -3, "SC": -1, "YY": 7, "GV": -3, "LV": 1, "AR": -1, "MR": -1, "YL": -1, "DC": -3, "PP": 7, "DH": -1, "QQ": 5, "IV": 3, "PF": -4, "IA": -1, "FF": 6, "KT": -1, "LT": -1, "SQ": 0, "WF": 1, "DA": -2, "EY": -2, "KA": -1, "QS": 0, "AD": -2, "LR": -2, "TS": 1, "AV": 0, "MN": -2, "QD": 0, "EP": -1, "VV": 4, "DN": 1, "IS": -2, "PM": -2, "HD": -1, "IL": 2, "KN": 0, "LP": -3, "YI": -1, "NI": -3, "TQ": -1, "QF": -3, "SM": -1, "ER": 0, "QW": -2, "GN": 0, "LY": -1, "LN": -3, "AS": 1, "DT": -1, "ST": 1, "PS": -1, "VR": -3, "DK": -1, "PH": -2, "HC": -3, "QI": -3, "HH": 8, "II": 4, "LW": -2, "LL": 4, "DR": -2, "SI": -2, "DI": -3, "EA": -1, "KI": -3, "QK": 1, "TD": -1, "AW": -3, "YR": -2, "MF": 0, "SP": -1, "HQ": 0, "YN": -2, "IP": -3, "EC": -4, "HG": -2, "PE": -1, "QM": 0, "HL": -3, "LS": -2, "LH": -3, "NQ": 0, "TY": -2, "KG": -2, "SE": 0, "YE": -2, "WR": -3, "VM": 1, "NR": 0, "GF": -3, "FY": 3, "LQ": -2, "MY": -1, "AP": -1, "SN": 1, "CL": -1, "LF": 0, "DW": -4, "SL": -2, "PR": -2, "PK": -1, "YG": -3, "CK": -3, "HK": -1, "QA": -1, "IF": 0, "KD": -1, "NC": -3, "LD": -4, "YK": -2, "SA": 1, "WV": -3, "EI": -3, "VI": 3, "QC": -3, "TG": -2, "TL": -1, "LM": 2, "AT": 0, "CH": -3, "PY": -3, "SH": -1, "HY": 2, "EK": 1, "CG": -3, "IC": -1, "QE": 2, "KR": 2, "TE": -1, "LK": -2, "MW": -1, "NY": -2, "NH": 1, "VE": -2, "QG": -2, "YD": -3, "FQ": -3, "GY": -3, "LI": 2, "MQ": 0, "RA": -1, "CD": -3, "SV": -2, "DD": 6, "SD": 0, "PC": -3, "CC": 9, "WK": -3, "IN": -3, "KL": -2, "NK": 0, "LG": -4, "MS": -1, "RC": -3, "RD": -2, "VA": 0, "WI": -3, "TT": 5, "FM": 0, "LE": -3, "MM": 5, "RE": 0, "WH": -2, "SR": -1, "EW": -3, "PQ": -1, "HA": -2, "YA": -2, "EH": 0, "RF": -3, "IK": -3, "NE": 0, "TM": -1, "TR": -1, "MT": -1, "GS": 0, "LC": -1, "RG": -2, "YM": -1, "NF": -3, "YQ": -1, "NP": -2, "RH": 0, "WM": -1, "CN": -3, "VL": 1, "FI": 0, "GQ": -2, "LA": -1, "MI": 1, "RI": -3, "WL": -2, "DG": -1, "DL": -4, "IR": -3, "CM": -1, "HE": 0, "YW": 2, "GP": -2, "WC": -2, "MP": -2, "NS": 1, "GW": -2, "MK": -1, "RK": 2, "DE": 2, "KE": 1, "RL": -2, "AI": -1, "VY": -1, "WA": -3, "YF": 3, "TW": -2, "VH": -3, "FE": -3, "ME": -2, "RM": -1, "ET": -1, "HR": 0, "PI": -3, "FT": -2, "CI": -1, "HI": -3, "GT": -2, "IH": -3, "RN": 0, "CW": -2, "WG": -2, "NM": -2, "ML": 2, "GK": -2, "MG": -3, "KS": 0, "EV": -2, "NN": 6, "VK": -2, "RP": -2, "AM": -1, "WE": -3, "FW": 1, "CF": -2, "VD": -3, "FA": -2, "GI": -4, "MA": -1, "RQ": 1, "CT": -1, "WD": -4, "HV": -3, "SF": -2, "PT": -1, "FP": -4, "CE": -4, "HM": -2, "IE": -3, "GH": -2, "RR": 5, "KP": -1, "CS": -1, "DV": -3, "MH": -2, "MC": -1, "RS": -1, "DM": -3, "EE": 5, "KM": -1, "VG": -3, "RT": -1, "AA": 4, "VQ": -2, "WY": 2, "FS": -2, "GM": -3, "CP": -3, "EG": -2, "IW": -3, "PA": -1, "FL": 0, "CA": 0, "GL": -4, "RV": -3, "TF": -2, "YP": -3, "MD": -3, "GC": -3, "RW": -3, "ND": 1, "NV": -3, "VC": -1, "AE": -1, "YH": 2, "DP": -1, "GA": 0, "RY": -2, "PW": -4, "YC": -2, "PL": -3, "FH": -1, "IM": 1, "YT": -2, "NG": 0, "WS": -3 } adj_blosum = { b"AA": 0, b"AC": 4, b"AD": 4, b"AE": 4, b"AF": 4, b"AG": 4, b"AH": 4, b"AI": 4, b"AK": 4, b"AL": 4, b"AM": 4, b"AN": 4, b"AP": 4, b"AQ": 4, b"AR": 4, b"AS": 3, b"AT": 4, b"AV": 4, b"AW": 4, b"AY": 4, b"CA": 4, b"CC": 0, b"CD": 4, b"CE": 4, b"CF": 4, b"CG": 4, b"CH": 4, b"CI": 4, b"CK": 4, b"CL": 4, b"CM": 4, b"CN": 4, b"CP": 4, b"CQ": 4, b"CR": 4, b"CS": 4, b"CT": 4, b"CV": 4, b"CW": 4, b"CY": 4, b"DA": 4, b"DC": 4, b"DD": 0, b"DE": 2, b"DF": 4, b"DG": 4, b"DH": 4, b"DI": 4, b"DK": 4, b"DL": 4, b"DM": 4, b"DN": 3, b"DP": 4, b"DQ": 4, b"DR": 4, b"DS": 4, b"DT": 4, b"DV": 4, b"DW": 4, b"DY": 4, b"EA": 4, b"EC": 4, b"ED": 2, b"EE": 0, b"EF": 4, b"EG": 4, b"EH": 4, b"EI": 4, b"EK": 3, b"EL": 4, b"EM": 4, b"EN": 4, b"EP": 4, b"EQ": 2, b"ER": 4, b"ES": 4, b"ET": 4, b"EV": 4, b"EW": 4, b"EY": 4, b"FA": 4, b"FC": 4, b"FD": 4, b"FE": 4, b"FF": 0, b"FG": 4, b"FH": 4, b"FI": 4, b"FK": 4, b"FL": 4, b"FM": 4, b"FN": 4, b"FP": 4, b"FQ": 4, b"FR": 4, b"FS": 4, b"FT": 4, b"FV": 4, b"FW": 3, b"FY": 1, b"GA": 4, b"GC": 4, b"GD": 4, b"GE": 4, b"GF": 4, b"GG": 0, b"GH": 4, b"GI": 4, b"GK": 4, b"GL": 4, b"GM": 4, b"GN": 4, b"GP": 4, b"GQ": 4, b"GR": 4, b"GS": 4, b"GT": 4, b"GV": 4, b"GW": 4, b"GY": 4, b"HA": 4, b"HC": 4, b"HD": 4, b"HE": 4, b"HF": 4, b"HG": 4, b"HH": 0, b"HI": 4, b"HK": 4, b"HL": 4, b"HM": 4, b"HN": 3, b"HP": 4, b"HQ": 4, b"HR": 4, b"HS": 4, b"HT": 4, b"HV": 4, b"HW": 4, b"HY": 2, b"IA": 4, b"IC": 4, b"ID": 4, b"IE": 4, b"IF": 4, b"IG": 4, b"IH": 4, b"II": 0, b"IK": 4, b"IL": 2, b"IM": 3, b"IN": 4, b"IP": 4, b"IQ": 4, b"IR": 4, b"IS": 4, b"IT": 4, b"IV": 1, b"IW": 4, b"IY": 4, b"KA": 4, b"KC": 4, b"KD": 4, b"KE": 3, b"KF": 4, b"KG": 4, b"KH": 4, b"KI": 4, b"KK": 0, b"KL": 4, b"KM": 4, b"KN": 4, b"KP": 4, b"KQ": 3, b"KR": 2, b"KS": 4, b"KT": 4, b"KV": 4, b"KW": 4, b"KY": 4, b"LA": 4, b"LC": 4, b"LD": 4, b"LE": 4, b"LF": 4, b"LG": 4, b"LH": 4, b"LI": 2, b"LK": 4, b"LL": 0, b"LM": 2, b"LN": 4, b"LP": 4, b"LQ": 4, b"LR": 4, b"LS": 4, b"LT": 4, b"LV": 3, b"LW": 4, b"LY": 4, b"MA": 4, b"MC": 4, b"MD": 4, b"ME": 4, b"MF": 4, b"MG": 4, b"MH": 4, b"MI": 3, b"MK": 4, b"ML": 2, b"MM": 0, b"MN": 4, b"MP": 4, b"MQ": 4, b"MR": 4, b"MS": 4, b"MT": 4, b"MV": 3, b"MW": 4, b"MY": 4, b"NA": 4, b"NC": 4, b"ND": 3, b"NE": 4, b"NF": 4, b"NG": 4, b"NH": 3, b"NI": 4, b"NK": 4, b"NL": 4, b"NM": 4, b"NN": 0, b"NP": 4, b"NQ": 4, b"NR": 4, b"NS": 3, b"NT": 4, b"NV": 4, b"NW": 4, b"NY": 4, b"PA": 4, b"PC": 4, b"PD": 4, b"PE": 4, b"PF": 4, b"PG": 4, b"PH": 4, b"PI": 4, b"PK": 4, b"PL": 4, b"PM": 4, b"PN": 4, b"PP": 0, b"PQ": 4, b"PR": 4, b"PS": 4, b"PT": 4, b"PV": 4, b"PW": 4, b"PY": 4, b"QA": 4, b"QC": 4, b"QD": 4, b"QE": 2, b"QF": 4, b"QG": 4, b"QH": 4, b"QI": 4, b"QK": 3, b"QL": 4, b"QM": 4, b"QN": 4, b"QP": 4, b"QQ": 0, b"QR": 3, b"QS": 4, b"QT": 4, b"QV": 4, b"QW": 4, b"QY": 4, b"RA": 4, b"RC": 4, b"RD": 4, b"RE": 4, b"RF": 4, b"RG": 4, b"RH": 4, b"RI": 4, b"RK": 2, b"RL": 4, b"RM": 4, b"RN": 4, b"RP": 4, b"RQ": 3, b"RR": 0, b"RS": 4, b"RT": 4, b"RV": 4, b"RW": 4, b"RY": 4, b"SA": 3, b"SC": 4, b"SD": 4, b"SE": 4, b"SF": 4, b"SG": 4, b"SH": 4, b"SI": 4, b"SK": 4, b"SL": 4, b"SM": 4, b"SN": 3, b"SP": 4, b"SQ": 4, b"SR": 4, b"SS": 0, b"ST": 3, b"SV": 4, b"SW": 4, b"SY": 4, b"TA": 4, b"TC": 4, b"TD": 4, b"TE": 4, b"TF": 4, b"TG": 4, b"TH": 4, b"TI": 4, b"TK": 4, b"TL": 4, b"TM": 4, b"TN": 4, b"TP": 4, b"TQ": 4, b"TR": 4, b"TS": 3, b"TT": 0, b"TV": 4, b"TW": 4, b"TY": 4, b"VA": 4, b"VC": 4, b"VD": 4, b"VE": 4, b"VF": 4, b"VG": 4, b"VH": 4, b"VI": 1, b"VK": 4, b"VL": 3, b"VM": 3, b"VN": 4, b"VP": 4, b"VQ": 4, b"VR": 4, b"VS": 4, b"VT": 4, b"VV": 0, b"VW": 4, b"VY": 4, b"WA": 4, b"WC": 4, b"WD": 4, b"WE": 4, b"WF": 3, b"WG": 4, b"WH": 4, b"WI": 4, b"WK": 4, b"WL": 4, b"WM": 4, b"WN": 4, b"WP": 4, b"WQ": 4, b"WR": 4, b"WS": 4, b"WT": 4, b"WV": 4, b"WW": 0, b"WY": 2, b"YA": 4, b"YC": 4, b"YD": 4, b"YE": 4, b"YF": 1, b"YG": 4, b"YH": 2, b"YI": 4, b"YK": 4, b"YL": 4, b"YM": 4, b"YN": 4, b"YP": 4, b"YQ": 4, b"YR": 4, b"YS": 4, b"YT": 4, b"YV": 4, b"YW": 2, b"YY": 0 }
blosum = {'SW': -3, 'GG': 6, 'EM': -2, 'AN': -2, 'AY': -2, 'WQ': -2, 'VN': -3, 'FK': -3, 'GE': -2, 'ED': 2, 'WP': -4, 'IT': -1, 'FD': -3, 'KV': -2, 'CY': -2, 'GD': -1, 'TN': 0, 'WW': 11, 'SS': 4, 'KC': -3, 'EF': -3, 'NL': -3, 'AK': -1, 'QP': -1, 'FG': -3, 'DS': 0, 'CV': -1, 'VT': 0, 'HP': -2, 'PV': -2, 'IQ': -3, 'FV': -1, 'WT': -2, 'HF': -1, 'PD': -1, 'QR': 1, 'DQ': 0, 'KQ': 1, 'DF': -3, 'VW': -3, 'TC': -1, 'AF': -2, 'TH': -2, 'AQ': -1, 'QT': -1, 'VF': -1, 'FC': -2, 'CR': -3, 'VP': -2, 'HT': -2, 'EL': -3, 'FR': -3, 'IG': -4, 'CQ': -3, 'YV': -1, 'TA': 0, 'TV': 0, 'QV': -2, 'SK': 0, 'KK': 5, 'EN': 0, 'NT': 0, 'AH': -2, 'AC': 0, 'VS': -2, 'QH': 0, 'HS': -1, 'QY': -1, 'PN': -2, 'IY': -1, 'PG': -2, 'FN': -3, 'HN': 1, 'KH': -1, 'NW': -4, 'SY': -2, 'WN': -4, 'DY': -3, 'EQ': 2, 'KY': -2, 'SG': 0, 'YS': -2, 'GR': -2, 'AL': -1, 'AG': 0, 'TK': -1, 'TP': -1, 'MV': 1, 'QL': -2, 'ES': 0, 'HW': -2, 'ID': -3, 'KF': -3, 'NA': -2, 'TI': -1, 'QN': 0, 'KW': -3, 'SC': -1, 'YY': 7, 'GV': -3, 'LV': 1, 'AR': -1, 'MR': -1, 'YL': -1, 'DC': -3, 'PP': 7, 'DH': -1, 'QQ': 5, 'IV': 3, 'PF': -4, 'IA': -1, 'FF': 6, 'KT': -1, 'LT': -1, 'SQ': 0, 'WF': 1, 'DA': -2, 'EY': -2, 'KA': -1, 'QS': 0, 'AD': -2, 'LR': -2, 'TS': 1, 'AV': 0, 'MN': -2, 'QD': 0, 'EP': -1, 'VV': 4, 'DN': 1, 'IS': -2, 'PM': -2, 'HD': -1, 'IL': 2, 'KN': 0, 'LP': -3, 'YI': -1, 'NI': -3, 'TQ': -1, 'QF': -3, 'SM': -1, 'ER': 0, 'QW': -2, 'GN': 0, 'LY': -1, 'LN': -3, 'AS': 1, 'DT': -1, 'ST': 1, 'PS': -1, 'VR': -3, 'DK': -1, 'PH': -2, 'HC': -3, 'QI': -3, 'HH': 8, 'II': 4, 'LW': -2, 'LL': 4, 'DR': -2, 'SI': -2, 'DI': -3, 'EA': -1, 'KI': -3, 'QK': 1, 'TD': -1, 'AW': -3, 'YR': -2, 'MF': 0, 'SP': -1, 'HQ': 0, 'YN': -2, 'IP': -3, 'EC': -4, 'HG': -2, 'PE': -1, 'QM': 0, 'HL': -3, 'LS': -2, 'LH': -3, 'NQ': 0, 'TY': -2, 'KG': -2, 'SE': 0, 'YE': -2, 'WR': -3, 'VM': 1, 'NR': 0, 'GF': -3, 'FY': 3, 'LQ': -2, 'MY': -1, 'AP': -1, 'SN': 1, 'CL': -1, 'LF': 0, 'DW': -4, 'SL': -2, 'PR': -2, 'PK': -1, 'YG': -3, 'CK': -3, 'HK': -1, 'QA': -1, 'IF': 0, 'KD': -1, 'NC': -3, 'LD': -4, 'YK': -2, 'SA': 1, 'WV': -3, 'EI': -3, 'VI': 3, 'QC': -3, 'TG': -2, 'TL': -1, 'LM': 2, 'AT': 0, 'CH': -3, 'PY': -3, 'SH': -1, 'HY': 2, 'EK': 1, 'CG': -3, 'IC': -1, 'QE': 2, 'KR': 2, 'TE': -1, 'LK': -2, 'MW': -1, 'NY': -2, 'NH': 1, 'VE': -2, 'QG': -2, 'YD': -3, 'FQ': -3, 'GY': -3, 'LI': 2, 'MQ': 0, 'RA': -1, 'CD': -3, 'SV': -2, 'DD': 6, 'SD': 0, 'PC': -3, 'CC': 9, 'WK': -3, 'IN': -3, 'KL': -2, 'NK': 0, 'LG': -4, 'MS': -1, 'RC': -3, 'RD': -2, 'VA': 0, 'WI': -3, 'TT': 5, 'FM': 0, 'LE': -3, 'MM': 5, 'RE': 0, 'WH': -2, 'SR': -1, 'EW': -3, 'PQ': -1, 'HA': -2, 'YA': -2, 'EH': 0, 'RF': -3, 'IK': -3, 'NE': 0, 'TM': -1, 'TR': -1, 'MT': -1, 'GS': 0, 'LC': -1, 'RG': -2, 'YM': -1, 'NF': -3, 'YQ': -1, 'NP': -2, 'RH': 0, 'WM': -1, 'CN': -3, 'VL': 1, 'FI': 0, 'GQ': -2, 'LA': -1, 'MI': 1, 'RI': -3, 'WL': -2, 'DG': -1, 'DL': -4, 'IR': -3, 'CM': -1, 'HE': 0, 'YW': 2, 'GP': -2, 'WC': -2, 'MP': -2, 'NS': 1, 'GW': -2, 'MK': -1, 'RK': 2, 'DE': 2, 'KE': 1, 'RL': -2, 'AI': -1, 'VY': -1, 'WA': -3, 'YF': 3, 'TW': -2, 'VH': -3, 'FE': -3, 'ME': -2, 'RM': -1, 'ET': -1, 'HR': 0, 'PI': -3, 'FT': -2, 'CI': -1, 'HI': -3, 'GT': -2, 'IH': -3, 'RN': 0, 'CW': -2, 'WG': -2, 'NM': -2, 'ML': 2, 'GK': -2, 'MG': -3, 'KS': 0, 'EV': -2, 'NN': 6, 'VK': -2, 'RP': -2, 'AM': -1, 'WE': -3, 'FW': 1, 'CF': -2, 'VD': -3, 'FA': -2, 'GI': -4, 'MA': -1, 'RQ': 1, 'CT': -1, 'WD': -4, 'HV': -3, 'SF': -2, 'PT': -1, 'FP': -4, 'CE': -4, 'HM': -2, 'IE': -3, 'GH': -2, 'RR': 5, 'KP': -1, 'CS': -1, 'DV': -3, 'MH': -2, 'MC': -1, 'RS': -1, 'DM': -3, 'EE': 5, 'KM': -1, 'VG': -3, 'RT': -1, 'AA': 4, 'VQ': -2, 'WY': 2, 'FS': -2, 'GM': -3, 'CP': -3, 'EG': -2, 'IW': -3, 'PA': -1, 'FL': 0, 'CA': 0, 'GL': -4, 'RV': -3, 'TF': -2, 'YP': -3, 'MD': -3, 'GC': -3, 'RW': -3, 'ND': 1, 'NV': -3, 'VC': -1, 'AE': -1, 'YH': 2, 'DP': -1, 'GA': 0, 'RY': -2, 'PW': -4, 'YC': -2, 'PL': -3, 'FH': -1, 'IM': 1, 'YT': -2, 'NG': 0, 'WS': -3} adj_blosum = {b'AA': 0, b'AC': 4, b'AD': 4, b'AE': 4, b'AF': 4, b'AG': 4, b'AH': 4, b'AI': 4, b'AK': 4, b'AL': 4, b'AM': 4, b'AN': 4, b'AP': 4, b'AQ': 4, b'AR': 4, b'AS': 3, b'AT': 4, b'AV': 4, b'AW': 4, b'AY': 4, b'CA': 4, b'CC': 0, b'CD': 4, b'CE': 4, b'CF': 4, b'CG': 4, b'CH': 4, b'CI': 4, b'CK': 4, b'CL': 4, b'CM': 4, b'CN': 4, b'CP': 4, b'CQ': 4, b'CR': 4, b'CS': 4, b'CT': 4, b'CV': 4, b'CW': 4, b'CY': 4, b'DA': 4, b'DC': 4, b'DD': 0, b'DE': 2, b'DF': 4, b'DG': 4, b'DH': 4, b'DI': 4, b'DK': 4, b'DL': 4, b'DM': 4, b'DN': 3, b'DP': 4, b'DQ': 4, b'DR': 4, b'DS': 4, b'DT': 4, b'DV': 4, b'DW': 4, b'DY': 4, b'EA': 4, b'EC': 4, b'ED': 2, b'EE': 0, b'EF': 4, b'EG': 4, b'EH': 4, b'EI': 4, b'EK': 3, b'EL': 4, b'EM': 4, b'EN': 4, b'EP': 4, b'EQ': 2, b'ER': 4, b'ES': 4, b'ET': 4, b'EV': 4, b'EW': 4, b'EY': 4, b'FA': 4, b'FC': 4, b'FD': 4, b'FE': 4, b'FF': 0, b'FG': 4, b'FH': 4, b'FI': 4, b'FK': 4, b'FL': 4, b'FM': 4, b'FN': 4, b'FP': 4, b'FQ': 4, b'FR': 4, b'FS': 4, b'FT': 4, b'FV': 4, b'FW': 3, b'FY': 1, b'GA': 4, b'GC': 4, b'GD': 4, b'GE': 4, b'GF': 4, b'GG': 0, b'GH': 4, b'GI': 4, b'GK': 4, b'GL': 4, b'GM': 4, b'GN': 4, b'GP': 4, b'GQ': 4, b'GR': 4, b'GS': 4, b'GT': 4, b'GV': 4, b'GW': 4, b'GY': 4, b'HA': 4, b'HC': 4, b'HD': 4, b'HE': 4, b'HF': 4, b'HG': 4, b'HH': 0, b'HI': 4, b'HK': 4, b'HL': 4, b'HM': 4, b'HN': 3, b'HP': 4, b'HQ': 4, b'HR': 4, b'HS': 4, b'HT': 4, b'HV': 4, b'HW': 4, b'HY': 2, b'IA': 4, b'IC': 4, b'ID': 4, b'IE': 4, b'IF': 4, b'IG': 4, b'IH': 4, b'II': 0, b'IK': 4, b'IL': 2, b'IM': 3, b'IN': 4, b'IP': 4, b'IQ': 4, b'IR': 4, b'IS': 4, b'IT': 4, b'IV': 1, b'IW': 4, b'IY': 4, b'KA': 4, b'KC': 4, b'KD': 4, b'KE': 3, b'KF': 4, b'KG': 4, b'KH': 4, b'KI': 4, b'KK': 0, b'KL': 4, b'KM': 4, b'KN': 4, b'KP': 4, b'KQ': 3, b'KR': 2, b'KS': 4, b'KT': 4, b'KV': 4, b'KW': 4, b'KY': 4, b'LA': 4, b'LC': 4, b'LD': 4, b'LE': 4, b'LF': 4, b'LG': 4, b'LH': 4, b'LI': 2, b'LK': 4, b'LL': 0, b'LM': 2, b'LN': 4, b'LP': 4, b'LQ': 4, b'LR': 4, b'LS': 4, b'LT': 4, b'LV': 3, b'LW': 4, b'LY': 4, b'MA': 4, b'MC': 4, b'MD': 4, b'ME': 4, b'MF': 4, b'MG': 4, b'MH': 4, b'MI': 3, b'MK': 4, b'ML': 2, b'MM': 0, b'MN': 4, b'MP': 4, b'MQ': 4, b'MR': 4, b'MS': 4, b'MT': 4, b'MV': 3, b'MW': 4, b'MY': 4, b'NA': 4, b'NC': 4, b'ND': 3, b'NE': 4, b'NF': 4, b'NG': 4, b'NH': 3, b'NI': 4, b'NK': 4, b'NL': 4, b'NM': 4, b'NN': 0, b'NP': 4, b'NQ': 4, b'NR': 4, b'NS': 3, b'NT': 4, b'NV': 4, b'NW': 4, b'NY': 4, b'PA': 4, b'PC': 4, b'PD': 4, b'PE': 4, b'PF': 4, b'PG': 4, b'PH': 4, b'PI': 4, b'PK': 4, b'PL': 4, b'PM': 4, b'PN': 4, b'PP': 0, b'PQ': 4, b'PR': 4, b'PS': 4, b'PT': 4, b'PV': 4, b'PW': 4, b'PY': 4, b'QA': 4, b'QC': 4, b'QD': 4, b'QE': 2, b'QF': 4, b'QG': 4, b'QH': 4, b'QI': 4, b'QK': 3, b'QL': 4, b'QM': 4, b'QN': 4, b'QP': 4, b'QQ': 0, b'QR': 3, b'QS': 4, b'QT': 4, b'QV': 4, b'QW': 4, b'QY': 4, b'RA': 4, b'RC': 4, b'RD': 4, b'RE': 4, b'RF': 4, b'RG': 4, b'RH': 4, b'RI': 4, b'RK': 2, b'RL': 4, b'RM': 4, b'RN': 4, b'RP': 4, b'RQ': 3, b'RR': 0, b'RS': 4, b'RT': 4, b'RV': 4, b'RW': 4, b'RY': 4, b'SA': 3, b'SC': 4, b'SD': 4, b'SE': 4, b'SF': 4, b'SG': 4, b'SH': 4, b'SI': 4, b'SK': 4, b'SL': 4, b'SM': 4, b'SN': 3, b'SP': 4, b'SQ': 4, b'SR': 4, b'SS': 0, b'ST': 3, b'SV': 4, b'SW': 4, b'SY': 4, b'TA': 4, b'TC': 4, b'TD': 4, b'TE': 4, b'TF': 4, b'TG': 4, b'TH': 4, b'TI': 4, b'TK': 4, b'TL': 4, b'TM': 4, b'TN': 4, b'TP': 4, b'TQ': 4, b'TR': 4, b'TS': 3, b'TT': 0, b'TV': 4, b'TW': 4, b'TY': 4, b'VA': 4, b'VC': 4, b'VD': 4, b'VE': 4, b'VF': 4, b'VG': 4, b'VH': 4, b'VI': 1, b'VK': 4, b'VL': 3, b'VM': 3, b'VN': 4, b'VP': 4, b'VQ': 4, b'VR': 4, b'VS': 4, b'VT': 4, b'VV': 0, b'VW': 4, b'VY': 4, b'WA': 4, b'WC': 4, b'WD': 4, b'WE': 4, b'WF': 3, b'WG': 4, b'WH': 4, b'WI': 4, b'WK': 4, b'WL': 4, b'WM': 4, b'WN': 4, b'WP': 4, b'WQ': 4, b'WR': 4, b'WS': 4, b'WT': 4, b'WV': 4, b'WW': 0, b'WY': 2, b'YA': 4, b'YC': 4, b'YD': 4, b'YE': 4, b'YF': 1, b'YG': 4, b'YH': 2, b'YI': 4, b'YK': 4, b'YL': 4, b'YM': 4, b'YN': 4, b'YP': 4, b'YQ': 4, b'YR': 4, b'YS': 4, b'YT': 4, b'YV': 4, b'YW': 2, b'YY': 0}
ALL = [ "add_logentry", "change_logentry", "delete_logentry", "view_logentry", "can_export_data", "can_import_historical", "can_import_third_party", "can_import_website", "add_donation", "change_donation", "delete_donation", "destroy_donation", "generate_tax_receipt", "view_donation", "add_donor", "change_donor", "delete_donor", "destroy_donor", "view_donor", "add_item", "change_item", "delete_item", "destroy_item", "update_status_item", "update_value_item", "view_item", "add_itemdevice", "change_itemdevice", "delete_itemdevice", "view_itemdevice", "add_itemdevicetype", "change_itemdevicetype", "delete_itemdevicetype", "view_itemdevicetype", "add_group", "change_group", "delete_group", "view_group", "add_permission", "change_permission", "delete_permission", "view_permission", "add_user", "change_user", "delete_user", "view_user", "add_contenttype", "change_contenttype", "delete_contenttype", "view_contenttype", "add_session", "change_session", "delete_session", "view_session", ] FRONTLINE = [ 'add_donation', 'change_donation', 'delete_donation', 'view_donation', 'add_donor', 'change_donor', 'delete_donor', 'view_donor', 'add_item', 'change_item', 'delete_item', 'view_item', 'add_itemdevice', 'change_itemdevice', 'delete_itemdevice', 'add_itemdevicetype', 'change_itemdevicetype', 'delete_itemdevicetype', ] MANAGEMENT = FRONTLINE + [ 'can_import_historical', 'can_import_third_party', 'can_import_website', 'can_export_data', 'generate_tax_receipt', 'update_status_item', 'update_value_item', 'generate_tax_receipt', ]
all = ['add_logentry', 'change_logentry', 'delete_logentry', 'view_logentry', 'can_export_data', 'can_import_historical', 'can_import_third_party', 'can_import_website', 'add_donation', 'change_donation', 'delete_donation', 'destroy_donation', 'generate_tax_receipt', 'view_donation', 'add_donor', 'change_donor', 'delete_donor', 'destroy_donor', 'view_donor', 'add_item', 'change_item', 'delete_item', 'destroy_item', 'update_status_item', 'update_value_item', 'view_item', 'add_itemdevice', 'change_itemdevice', 'delete_itemdevice', 'view_itemdevice', 'add_itemdevicetype', 'change_itemdevicetype', 'delete_itemdevicetype', 'view_itemdevicetype', 'add_group', 'change_group', 'delete_group', 'view_group', 'add_permission', 'change_permission', 'delete_permission', 'view_permission', 'add_user', 'change_user', 'delete_user', 'view_user', 'add_contenttype', 'change_contenttype', 'delete_contenttype', 'view_contenttype', 'add_session', 'change_session', 'delete_session', 'view_session'] frontline = ['add_donation', 'change_donation', 'delete_donation', 'view_donation', 'add_donor', 'change_donor', 'delete_donor', 'view_donor', 'add_item', 'change_item', 'delete_item', 'view_item', 'add_itemdevice', 'change_itemdevice', 'delete_itemdevice', 'add_itemdevicetype', 'change_itemdevicetype', 'delete_itemdevicetype'] management = FRONTLINE + ['can_import_historical', 'can_import_third_party', 'can_import_website', 'can_export_data', 'generate_tax_receipt', 'update_status_item', 'update_value_item', 'generate_tax_receipt']
a= True b = False c= a and b print("jika A={} and B={} = {}". format(a,b,c)) c= a or b print("jika A={} or B={} = {}". format(a,b,c)) c= not a print("jika A={} maka not A = {}". format)
a = True b = False c = a and b print('jika A={} and B={} = {}'.format(a, b, c)) c = a or b print('jika A={} or B={} = {}'.format(a, b, c)) c = not a print('jika A={} maka not A = {}'.format)
class GameConstants: # the maximum number of rounds, until the winner is decided by a coinflip MAX_ROUNDS = 500 # the board size BOARD_SIZE = 16 # the default seed DEFAULT_SEED = 1337
class Gameconstants: max_rounds = 500 board_size = 16 default_seed = 1337
# read file function def read_file(): file_data = open('./python_examples/file_io/input_file.txt') for single_line in file_data: print(single_line, end='') if __name__ == "__main__": read_file()
def read_file(): file_data = open('./python_examples/file_io/input_file.txt') for single_line in file_data: print(single_line, end='') if __name__ == '__main__': read_file()
{ "variables": { # Be sure to create OPENNI2 and NITE2 system vars "OPENNI2%": "$(OPENNI2)", "NITE2%": "$(NITE2)" }, "targets": [ { "target_name":"copy-files", "conditions": [ [ "OS=='win'", { "copies": [ { "files": [ "<(OPENNI2)/Redist/OpenNI2/Drivers/Kinect.dll", "<(OPENNI2)/Redist/OpenNI2/Drivers/OniFile.dll", "<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.dll", "<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini", "<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.dll", "<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini"], "destination": "<(module_root_dir)/build/Release/OpenNI2/Drivers/" }, # If NITE folder is not placed at root of project, it cannot be accessed # go up through node_modules to project root and drop in NiTE2 folder { "files": [ "<(NITE2)/Redist/NiTE2/Data/lbsdata.idx", "<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd"], "destination": "<(module_root_dir)/../../NiTE2/Data/" }, { "files": [ "<(NITE2)/Redist/NiTE2/FeatureExtraction.ini", "<(NITE2)/Redist/NiTE2/h.dat", "<(NITE2)/Redist/NiTE2/HandAlgorithms.ini", "<(NITE2)/Redist/NiTE2/s.dat"], "destination": "<(module_root_dir)/../../NiTE2/" }, { "files": [ "<(OPENNI2)/Redist/OpenNI2.dll", "<(OPENNI2)/Redist/OpenNI.ini", "<(NITE2)/Redist/NiTE2.dll", "<(NITE2)/Redist/NiTE.ini" ], "destination": "<(module_root_dir)/build/Release/" } ], "libraries": ["-l<(OPENNI2)/Lib/OpenNI2", "-l<(NITE2)/Lib/NiTE2"] }], ["OS=='mac'", { "copies": [ { "files": [ "<(OPENNI2)/Redist/OpenNI2/Drivers/libOniFile.dylib", "<(OPENNI2)/Redist/OpenNI2/Drivers/libPS1080.dylib", "<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini", "<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini"], "destination": "<(module_root_dir)/build/Release/OpenNI2/Drivers/" }, # If NITE folder is not placed at root of project, it cannot be accessed # go up through node_modules to project root and drop in NiTE2 folder { "files": [ "<(NITE2)/Redist/NiTE2/Data/lbsdata.idx", "<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd"], "destination": "<(module_root_dir)/../../NiTE2/Data/" }, { "files": [ "<(NITE2)/Redist/NiTE2/FeatureExtraction.ini", "<(NITE2)/Redist/NiTE2/h.dat", "<(NITE2)/Redist/NiTE2/HandAlgorithms.ini", "<(NITE2)/Redist/NiTE2/s.dat"], "destination": "<(module_root_dir)/../../NiTE2/" }, { "files": [ "<(OPENNI2)/Redist/libOpenNI2.dylib", "<(OPENNI2)/Redist/OpenNI.ini", "<(NITE2)/Redist/libNiTE2.dylib", "<(NITE2)/Redist/NiTE.ini" ], "destination": "<(module_root_dir)/build/Release/" } ] }], ["OS=='linux'", { "copies": [ { "files": [ "<(OPENNI2)/Redist/OpenNI2/Drivers/libOniFile.so", "<(OPENNI2)/Redist/OpenNI2/Drivers/libPS1080.so", "<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini", "<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini"], "destination": "<(module_root_dir)/build/Release/OpenNI2/Drivers/" }, # If NITE folder is not placed at root of project, it cannot be accessed # go up through node_modules to project root and drop in NiTE2 folder { "files": [ "<(NITE2)/Redist/NiTE2/Data/lbsdata.idx", "<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd", "<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd"], "destination": "<(module_root_dir)/../../NiTE2/Data/" }, { "files": [ "<(NITE2)/Redist/NiTE2/FeatureExtraction.ini", "<(NITE2)/Redist/NiTE2/h.dat", "<(NITE2)/Redist/NiTE2/HandAlgorithms.ini", "<(NITE2)/Redist/NiTE2/s.dat"], "destination": "<(module_root_dir)/../../NiTE2/" }, { "files": [ "<(OPENNI2)/Redist/libOpenNI2.so", "<(OPENNI2)/Redist/OpenNI.ini", "<(NITE2)/Redist/libNiTE2.so", "<(NITE2)/Redist/NiTE.ini" ], "destination": "<(module_root_dir)/build/Release/" } ] }] ] }, { "target_name": "nuimotion", "sources": [ "src/Main.cpp", "src/enums/EnumMapping.cpp", "src/gestures/GestureRecognizer.cpp", "src/gestures/Swipe.cpp", "src/gestures/Wave.cpp" ], "conditions": [ [ "OS=='win'", { "libraries": ["-l<(OPENNI2)/Lib/OpenNI2", "-l<(NITE2)/Lib/NiTE2"] }], ["OS=='mac'", { "libraries": ["<(OPENNI2)/Tools/libOpenNI2.dylib", "<(NITE2)/Redist/libNiTE2.dylib"] }], ["OS=='linux'", { "libraries": ["<(OPENNI2)/Tools/libOpenNI2.so", "<(NITE2)/Redist/libNiTE2.so"] }], ], "include_dirs": [ "./src/enums", "./build/Release", "<(OPENNI2)/Include/", "<(NITE2)/Include/" ], }, { "target_name": "nuimotion-depth", "sources": [ "src/Depth.cpp", "src/enums/EnumMapping.cpp", "src/gestures/GestureRecognizer.cpp", "src/gestures/Swipe.cpp", "src/gestures/Wave.cpp" ], "conditions": [ [ "OS=='win'", { "libraries": ["-l<(OPENNI2)/Lib/OpenNI2"] }], ["OS=='mac'", { "libraries": ["<(OPENNI2)/Tools/libOpenNI2.dylib"] }], ["OS=='linux'", { "libraries": ["<(OPENNI2)/Tools/libOpenNI2.so"] }], ], "include_dirs": [ "<(OPENNI2)/Include/"] } ] }
{'variables': {'OPENNI2%': '$(OPENNI2)', 'NITE2%': '$(NITE2)'}, 'targets': [{'target_name': 'copy-files', 'conditions': [["OS=='win'", {'copies': [{'files': ['<(OPENNI2)/Redist/OpenNI2/Drivers/Kinect.dll', '<(OPENNI2)/Redist/OpenNI2/Drivers/OniFile.dll', '<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.dll', '<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini', '<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.dll', '<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini'], 'destination': '<(module_root_dir)/build/Release/OpenNI2/Drivers/'}, {'files': ['<(NITE2)/Redist/NiTE2/Data/lbsdata.idx', '<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd'], 'destination': '<(module_root_dir)/../../NiTE2/Data/'}, {'files': ['<(NITE2)/Redist/NiTE2/FeatureExtraction.ini', '<(NITE2)/Redist/NiTE2/h.dat', '<(NITE2)/Redist/NiTE2/HandAlgorithms.ini', '<(NITE2)/Redist/NiTE2/s.dat'], 'destination': '<(module_root_dir)/../../NiTE2/'}, {'files': ['<(OPENNI2)/Redist/OpenNI2.dll', '<(OPENNI2)/Redist/OpenNI.ini', '<(NITE2)/Redist/NiTE2.dll', '<(NITE2)/Redist/NiTE.ini'], 'destination': '<(module_root_dir)/build/Release/'}], 'libraries': ['-l<(OPENNI2)/Lib/OpenNI2', '-l<(NITE2)/Lib/NiTE2']}], ["OS=='mac'", {'copies': [{'files': ['<(OPENNI2)/Redist/OpenNI2/Drivers/libOniFile.dylib', '<(OPENNI2)/Redist/OpenNI2/Drivers/libPS1080.dylib', '<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini', '<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini'], 'destination': '<(module_root_dir)/build/Release/OpenNI2/Drivers/'}, {'files': ['<(NITE2)/Redist/NiTE2/Data/lbsdata.idx', '<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd'], 'destination': '<(module_root_dir)/../../NiTE2/Data/'}, {'files': ['<(NITE2)/Redist/NiTE2/FeatureExtraction.ini', '<(NITE2)/Redist/NiTE2/h.dat', '<(NITE2)/Redist/NiTE2/HandAlgorithms.ini', '<(NITE2)/Redist/NiTE2/s.dat'], 'destination': '<(module_root_dir)/../../NiTE2/'}, {'files': ['<(OPENNI2)/Redist/libOpenNI2.dylib', '<(OPENNI2)/Redist/OpenNI.ini', '<(NITE2)/Redist/libNiTE2.dylib', '<(NITE2)/Redist/NiTE.ini'], 'destination': '<(module_root_dir)/build/Release/'}]}], ["OS=='linux'", {'copies': [{'files': ['<(OPENNI2)/Redist/OpenNI2/Drivers/libOniFile.so', '<(OPENNI2)/Redist/OpenNI2/Drivers/libPS1080.so', '<(OPENNI2)/Redist/OpenNI2/Drivers/PS1080.ini', '<(OPENNI2)/Redist/OpenNI2/Drivers/PSLink.ini'], 'destination': '<(module_root_dir)/build/Release/OpenNI2/Drivers/'}, {'files': ['<(NITE2)/Redist/NiTE2/Data/lbsdata.idx', '<(NITE2)/Redist/NiTE2/Data/lbsdata.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam1.lbd', '<(NITE2)/Redist/NiTE2/Data/lbsparam2.lbd'], 'destination': '<(module_root_dir)/../../NiTE2/Data/'}, {'files': ['<(NITE2)/Redist/NiTE2/FeatureExtraction.ini', '<(NITE2)/Redist/NiTE2/h.dat', '<(NITE2)/Redist/NiTE2/HandAlgorithms.ini', '<(NITE2)/Redist/NiTE2/s.dat'], 'destination': '<(module_root_dir)/../../NiTE2/'}, {'files': ['<(OPENNI2)/Redist/libOpenNI2.so', '<(OPENNI2)/Redist/OpenNI.ini', '<(NITE2)/Redist/libNiTE2.so', '<(NITE2)/Redist/NiTE.ini'], 'destination': '<(module_root_dir)/build/Release/'}]}]]}, {'target_name': 'nuimotion', 'sources': ['src/Main.cpp', 'src/enums/EnumMapping.cpp', 'src/gestures/GestureRecognizer.cpp', 'src/gestures/Swipe.cpp', 'src/gestures/Wave.cpp'], 'conditions': [["OS=='win'", {'libraries': ['-l<(OPENNI2)/Lib/OpenNI2', '-l<(NITE2)/Lib/NiTE2']}], ["OS=='mac'", {'libraries': ['<(OPENNI2)/Tools/libOpenNI2.dylib', '<(NITE2)/Redist/libNiTE2.dylib']}], ["OS=='linux'", {'libraries': ['<(OPENNI2)/Tools/libOpenNI2.so', '<(NITE2)/Redist/libNiTE2.so']}]], 'include_dirs': ['./src/enums', './build/Release', '<(OPENNI2)/Include/', '<(NITE2)/Include/']}, {'target_name': 'nuimotion-depth', 'sources': ['src/Depth.cpp', 'src/enums/EnumMapping.cpp', 'src/gestures/GestureRecognizer.cpp', 'src/gestures/Swipe.cpp', 'src/gestures/Wave.cpp'], 'conditions': [["OS=='win'", {'libraries': ['-l<(OPENNI2)/Lib/OpenNI2']}], ["OS=='mac'", {'libraries': ['<(OPENNI2)/Tools/libOpenNI2.dylib']}], ["OS=='linux'", {'libraries': ['<(OPENNI2)/Tools/libOpenNI2.so']}]], 'include_dirs': ['<(OPENNI2)/Include/']}]}
def is_palindrome(number): if int(number)%15 == 0: rev = number[::-1] return True if rev == number else False else: return False num = input("Enter a number to check palindrome divisible by 3 and 5: ") if is_palindrome(number=num): print(num, "is a Palindrome divisible by 3 and 5") else: print(num, "is not Palindrome divisible by 3 and 5")
def is_palindrome(number): if int(number) % 15 == 0: rev = number[::-1] return True if rev == number else False else: return False num = input('Enter a number to check palindrome divisible by 3 and 5: ') if is_palindrome(number=num): print(num, 'is a Palindrome divisible by 3 and 5') else: print(num, 'is not Palindrome divisible by 3 and 5')
# Container With Most Water # https://www.interviewbit.com/problems/container-with-most-water/ # # Given n non-negative integers a1, a2, ..., an, # where each represents a point at coordinate (i, ai). # 'n' vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). # # Find two lines, which together with x-axis forms a container, such that the container contains the most water. # # Your program should return an integer which corresponds to the maximum area of water that can be # contained ( Yes, we know maximum area instead of maximum volume sounds weird. But this is 2D plane # we are working with for simplicity ). # # Note: You may not slant the container. # # Example : # # Input : [1, 5, 4, 3] # Output : 6 # # Explanation : 5 and 3 are distance 2 apart. So size of the base = 2. Height of container = min(5, 3) = 3. # So total area = 3 * 2 = 6 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class Solution: # @param A : list of integers # @return an integer def maxArea(self, A): i, j = 0, len(A) - 1 area = 0 while i < j: area = max(area, (j - i) * min(A[i], A[j])) if A[i] < A[j]: i += 1 else: j -= 1 return area # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # if __name__ == "__main__": s = Solution() print(s.maxArea([1, 5, 4, 3]))
class Solution: def max_area(self, A): (i, j) = (0, len(A) - 1) area = 0 while i < j: area = max(area, (j - i) * min(A[i], A[j])) if A[i] < A[j]: i += 1 else: j -= 1 return area if __name__ == '__main__': s = solution() print(s.maxArea([1, 5, 4, 3]))
class Mazmorra(): def __init__(self): self.__salas = [] @property def salas(self): return self.__salas def addSala(self, sala): self.__salas.append(sala)
class Mazmorra: def __init__(self): self.__salas = [] @property def salas(self): return self.__salas def add_sala(self, sala): self.__salas.append(sala)
a = 33 b = 200 if b > a: pass
a = 33 b = 200 if b > a: pass
# # PySNMP MIB module CISCO-WRED-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WRED-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:21:31 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") ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") Counter32, Integer32, IpAddress, ModuleIdentity, Gauge32, NotificationType, Counter64, Bits, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, TimeTicks, Unsigned32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Integer32", "IpAddress", "ModuleIdentity", "Gauge32", "NotificationType", "Counter64", "Bits", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "TimeTicks", "Unsigned32", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ciscoWredMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 83)) ciscoWredMIB.setRevisions(('1997-07-18 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoWredMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoWredMIB.setLastUpdated('9707180000Z') if mibBuilder.loadTexts: ciscoWredMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoWredMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W. Tasman Drive San Jose, CA 95134-1706 USA Tel: +1 800 553-NETS E-mail: tgrennan-group@cisco.com') if mibBuilder.loadTexts: ciscoWredMIB.setDescription('Cisco WRED MIB - Overview Cisco Weighted Random Early Detection/Drop is a method which avoids traffic congestion on an output interface. Congestion is detected by computing the average output queue size against preset thresholds. WRED support are on the IP fast switching and IP flow switching only. It does not apply to IP process switching. This MIB incorporates objects from the Cisco WRED line interfaces. Its purpose is to provide Weighted Random Early Detection/Drop packet configuration and packet filtering information. WRED are configured/enabled through the CLI command. Defaults configuration values are assigned and values can be modified through additional CLI commands. ') ciscoWredMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1)) cwredConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1)) cwredStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2)) cwredConfigGlobTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1), ) if mibBuilder.loadTexts: cwredConfigGlobTable.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobTable.setDescription('A table of WRED global configuration variables.') cwredConfigGlobEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cwredConfigGlobEntry.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobEntry.setDescription('A collection of configuration entries on this interface. Entries are created and deleted via red command line interface.') cwredConfigGlobQueueWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cwredConfigGlobQueueWeight.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobQueueWeight.setDescription("The decay factor for the queue average calculation. Numbers are 2's exponent up to 16. The smaller the number, the faster it decays.") cwredConfigPrecedTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2), ) if mibBuilder.loadTexts: cwredConfigPrecedTable.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedTable.setDescription('A table of WRED configuration values with respect to the IP precedence of packets.') cwredConfigPrecedEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-WRED-MIB", "cwredConfigPrecedPrecedence")) if mibBuilder.loadTexts: cwredConfigPrecedEntry.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedEntry.setDescription('WRED IP precedence configuration table entry. Entries are created and deleted via red command interface.') cwredConfigPrecedPrecedence = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))) if mibBuilder.loadTexts: cwredConfigPrecedPrecedence.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedPrecedence.setDescription('The IP precedence of this entry.') cwredConfigPrecedMinDepthThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 2), Integer32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredConfigPrecedMinDepthThreshold.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedMinDepthThreshold.setDescription('The average queue depth at which WRED begins to drop packets.') cwredConfigPrecedMaxDepthThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 3), Integer32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredConfigPrecedMaxDepthThreshold.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedMaxDepthThreshold.setDescription('The average queue depth at which WRED may begin to drop all packets.') cwredConfigPrecedPktsDropFraction = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cwredConfigPrecedPktsDropFraction.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedPktsDropFraction.setDescription('The fraction of packets to be dropped when the average queue depth is above cwredConfigPrecedMinDepthThreshold but below cwredConfigPrecedMaxDepthThreshold.') cwredQueueTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1), ) if mibBuilder.loadTexts: cwredQueueTable.setStatus('current') if mibBuilder.loadTexts: cwredQueueTable.setDescription('A table of WRED queue status variable.') cwredQueueEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1), ) cwredConfigGlobEntry.registerAugmentions(("CISCO-WRED-MIB", "cwredQueueEntry")) cwredQueueEntry.setIndexNames(*cwredConfigGlobEntry.getIndexNames()) if mibBuilder.loadTexts: cwredQueueEntry.setStatus('current') if mibBuilder.loadTexts: cwredQueueEntry.setDescription('A table of WRED queue status variable entry. Entries are created and deleted via the red command line interface.') cwredQueueAverage = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1, 1), Gauge32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredQueueAverage.setStatus('current') if mibBuilder.loadTexts: cwredQueueAverage.setDescription('The computed queue average length.') cwredQueueDepth = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1, 2), Gauge32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredQueueDepth.setStatus('current') if mibBuilder.loadTexts: cwredQueueDepth.setDescription('The number of buffers/particles currently withheld in queue.') cwredStatTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2), ) if mibBuilder.loadTexts: cwredStatTable.setStatus('current') if mibBuilder.loadTexts: cwredStatTable.setDescription('A table of WRED status information with respect to the IP precedence of packets.') cwredStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1), ) cwredConfigPrecedEntry.registerAugmentions(("CISCO-WRED-MIB", "cwredStatEntry")) cwredStatEntry.setIndexNames(*cwredConfigPrecedEntry.getIndexNames()) if mibBuilder.loadTexts: cwredStatEntry.setStatus('current') if mibBuilder.loadTexts: cwredStatEntry.setDescription('The WRED interface status information entry. Entries are created and deleted via the red red command line interface.') cwredStatSwitchedPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 1), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredStatSwitchedPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatSwitchedPkts.setDescription('The number of packets output by WRED.') cwredStatRandomFilteredPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredStatRandomFilteredPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatRandomFilteredPkts.setDescription('The number of packets filtered/dropped due to average queue length exceeds cwredConfigMinDepthThreshold and meet a defined random drop policy.') cwredStatMaxFilteredPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cwredStatMaxFilteredPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatMaxFilteredPkts.setDescription('The number of packets filtered/dropped due to average queue length exceeds cwredConfigMaxDepthThreshold.') ciscoWredMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3)) ciscoWredMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 1)) ciscoWredMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 2)) ciscoWredMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 1, 1)).setObjects(("CISCO-WRED-MIB", "ciscoWredMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoWredMIBCompliance = ciscoWredMIBCompliance.setStatus('current') if mibBuilder.loadTexts: ciscoWredMIBCompliance.setDescription('The compliance statement for entities which implement the WRED on a Cisco RSP platform.') ciscoWredMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 2, 1)).setObjects(("CISCO-WRED-MIB", "cwredConfigGlobQueueWeight"), ("CISCO-WRED-MIB", "cwredConfigPrecedMinDepthThreshold"), ("CISCO-WRED-MIB", "cwredConfigPrecedMaxDepthThreshold"), ("CISCO-WRED-MIB", "cwredConfigPrecedPktsDropFraction"), ("CISCO-WRED-MIB", "cwredQueueAverage"), ("CISCO-WRED-MIB", "cwredQueueDepth"), ("CISCO-WRED-MIB", "cwredStatSwitchedPkts"), ("CISCO-WRED-MIB", "cwredStatRandomFilteredPkts"), ("CISCO-WRED-MIB", "cwredStatMaxFilteredPkts")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoWredMIBGroup = ciscoWredMIBGroup.setStatus('current') if mibBuilder.loadTexts: ciscoWredMIBGroup.setDescription('A collection of objects providing WRED monitoring.') mibBuilder.exportSymbols("CISCO-WRED-MIB", cwredConfigPrecedEntry=cwredConfigPrecedEntry, ciscoWredMIBCompliance=ciscoWredMIBCompliance, cwredConfigPrecedTable=cwredConfigPrecedTable, ciscoWredMIBGroups=ciscoWredMIBGroups, cwredStatSwitchedPkts=cwredStatSwitchedPkts, cwredQueueEntry=cwredQueueEntry, cwredStatMaxFilteredPkts=cwredStatMaxFilteredPkts, cwredConfigPrecedMinDepthThreshold=cwredConfigPrecedMinDepthThreshold, cwredStatEntry=cwredStatEntry, cwredQueueTable=cwredQueueTable, ciscoWredMIBGroup=ciscoWredMIBGroup, cwredConfigGlobEntry=cwredConfigGlobEntry, cwredConfig=cwredConfig, cwredConfigGlobTable=cwredConfigGlobTable, ciscoWredMIB=ciscoWredMIB, cwredQueueDepth=cwredQueueDepth, ciscoWredMIBConformance=ciscoWredMIBConformance, cwredQueueAverage=cwredQueueAverage, cwredStatTable=cwredStatTable, PYSNMP_MODULE_ID=ciscoWredMIB, ciscoWredMIBObjects=ciscoWredMIBObjects, cwredConfigPrecedPrecedence=cwredConfigPrecedPrecedence, cwredConfigPrecedMaxDepthThreshold=cwredConfigPrecedMaxDepthThreshold, cwredStats=cwredStats, cwredStatRandomFilteredPkts=cwredStatRandomFilteredPkts, ciscoWredMIBCompliances=ciscoWredMIBCompliances, cwredConfigPrecedPktsDropFraction=cwredConfigPrecedPktsDropFraction, cwredConfigGlobQueueWeight=cwredConfigGlobQueueWeight)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint') (cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup') (counter32, integer32, ip_address, module_identity, gauge32, notification_type, counter64, bits, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, time_ticks, unsigned32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Integer32', 'IpAddress', 'ModuleIdentity', 'Gauge32', 'NotificationType', 'Counter64', 'Bits', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'TimeTicks', 'Unsigned32', 'MibIdentifier') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') cisco_wred_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 83)) ciscoWredMIB.setRevisions(('1997-07-18 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoWredMIB.setRevisionsDescriptions(('Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoWredMIB.setLastUpdated('9707180000Z') if mibBuilder.loadTexts: ciscoWredMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoWredMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W. Tasman Drive San Jose, CA 95134-1706 USA Tel: +1 800 553-NETS E-mail: tgrennan-group@cisco.com') if mibBuilder.loadTexts: ciscoWredMIB.setDescription('Cisco WRED MIB - Overview Cisco Weighted Random Early Detection/Drop is a method which avoids traffic congestion on an output interface. Congestion is detected by computing the average output queue size against preset thresholds. WRED support are on the IP fast switching and IP flow switching only. It does not apply to IP process switching. This MIB incorporates objects from the Cisco WRED line interfaces. Its purpose is to provide Weighted Random Early Detection/Drop packet configuration and packet filtering information. WRED are configured/enabled through the CLI command. Defaults configuration values are assigned and values can be modified through additional CLI commands. ') cisco_wred_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1)) cwred_config = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1)) cwred_stats = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2)) cwred_config_glob_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1)) if mibBuilder.loadTexts: cwredConfigGlobTable.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobTable.setDescription('A table of WRED global configuration variables.') cwred_config_glob_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: cwredConfigGlobEntry.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobEntry.setDescription('A collection of configuration entries on this interface. Entries are created and deleted via red command line interface.') cwred_config_glob_queue_weight = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cwredConfigGlobQueueWeight.setStatus('current') if mibBuilder.loadTexts: cwredConfigGlobQueueWeight.setDescription("The decay factor for the queue average calculation. Numbers are 2's exponent up to 16. The smaller the number, the faster it decays.") cwred_config_preced_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2)) if mibBuilder.loadTexts: cwredConfigPrecedTable.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedTable.setDescription('A table of WRED configuration values with respect to the IP precedence of packets.') cwred_config_preced_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'CISCO-WRED-MIB', 'cwredConfigPrecedPrecedence')) if mibBuilder.loadTexts: cwredConfigPrecedEntry.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedEntry.setDescription('WRED IP precedence configuration table entry. Entries are created and deleted via red command interface.') cwred_config_preced_precedence = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))) if mibBuilder.loadTexts: cwredConfigPrecedPrecedence.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedPrecedence.setDescription('The IP precedence of this entry.') cwred_config_preced_min_depth_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 2), integer32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredConfigPrecedMinDepthThreshold.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedMinDepthThreshold.setDescription('The average queue depth at which WRED begins to drop packets.') cwred_config_preced_max_depth_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 3), integer32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredConfigPrecedMaxDepthThreshold.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedMaxDepthThreshold.setDescription('The average queue depth at which WRED may begin to drop all packets.') cwred_config_preced_pkts_drop_fraction = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 1, 2, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cwredConfigPrecedPktsDropFraction.setStatus('current') if mibBuilder.loadTexts: cwredConfigPrecedPktsDropFraction.setDescription('The fraction of packets to be dropped when the average queue depth is above cwredConfigPrecedMinDepthThreshold but below cwredConfigPrecedMaxDepthThreshold.') cwred_queue_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1)) if mibBuilder.loadTexts: cwredQueueTable.setStatus('current') if mibBuilder.loadTexts: cwredQueueTable.setDescription('A table of WRED queue status variable.') cwred_queue_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1)) cwredConfigGlobEntry.registerAugmentions(('CISCO-WRED-MIB', 'cwredQueueEntry')) cwredQueueEntry.setIndexNames(*cwredConfigGlobEntry.getIndexNames()) if mibBuilder.loadTexts: cwredQueueEntry.setStatus('current') if mibBuilder.loadTexts: cwredQueueEntry.setDescription('A table of WRED queue status variable entry. Entries are created and deleted via the red command line interface.') cwred_queue_average = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1, 1), gauge32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredQueueAverage.setStatus('current') if mibBuilder.loadTexts: cwredQueueAverage.setDescription('The computed queue average length.') cwred_queue_depth = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 1, 1, 2), gauge32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredQueueDepth.setStatus('current') if mibBuilder.loadTexts: cwredQueueDepth.setDescription('The number of buffers/particles currently withheld in queue.') cwred_stat_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2)) if mibBuilder.loadTexts: cwredStatTable.setStatus('current') if mibBuilder.loadTexts: cwredStatTable.setDescription('A table of WRED status information with respect to the IP precedence of packets.') cwred_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1)) cwredConfigPrecedEntry.registerAugmentions(('CISCO-WRED-MIB', 'cwredStatEntry')) cwredStatEntry.setIndexNames(*cwredConfigPrecedEntry.getIndexNames()) if mibBuilder.loadTexts: cwredStatEntry.setStatus('current') if mibBuilder.loadTexts: cwredStatEntry.setDescription('The WRED interface status information entry. Entries are created and deleted via the red red command line interface.') cwred_stat_switched_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 1), counter32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredStatSwitchedPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatSwitchedPkts.setDescription('The number of packets output by WRED.') cwred_stat_random_filtered_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 2), counter32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredStatRandomFilteredPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatRandomFilteredPkts.setDescription('The number of packets filtered/dropped due to average queue length exceeds cwredConfigMinDepthThreshold and meet a defined random drop policy.') cwred_stat_max_filtered_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 83, 1, 2, 2, 1, 3), counter32()).setUnits('packets').setMaxAccess('readonly') if mibBuilder.loadTexts: cwredStatMaxFilteredPkts.setStatus('current') if mibBuilder.loadTexts: cwredStatMaxFilteredPkts.setDescription('The number of packets filtered/dropped due to average queue length exceeds cwredConfigMaxDepthThreshold.') cisco_wred_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3)) cisco_wred_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 1)) cisco_wred_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 2)) cisco_wred_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 1, 1)).setObjects(('CISCO-WRED-MIB', 'ciscoWredMIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_wred_mib_compliance = ciscoWredMIBCompliance.setStatus('current') if mibBuilder.loadTexts: ciscoWredMIBCompliance.setDescription('The compliance statement for entities which implement the WRED on a Cisco RSP platform.') cisco_wred_mib_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 83, 3, 2, 1)).setObjects(('CISCO-WRED-MIB', 'cwredConfigGlobQueueWeight'), ('CISCO-WRED-MIB', 'cwredConfigPrecedMinDepthThreshold'), ('CISCO-WRED-MIB', 'cwredConfigPrecedMaxDepthThreshold'), ('CISCO-WRED-MIB', 'cwredConfigPrecedPktsDropFraction'), ('CISCO-WRED-MIB', 'cwredQueueAverage'), ('CISCO-WRED-MIB', 'cwredQueueDepth'), ('CISCO-WRED-MIB', 'cwredStatSwitchedPkts'), ('CISCO-WRED-MIB', 'cwredStatRandomFilteredPkts'), ('CISCO-WRED-MIB', 'cwredStatMaxFilteredPkts')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_wred_mib_group = ciscoWredMIBGroup.setStatus('current') if mibBuilder.loadTexts: ciscoWredMIBGroup.setDescription('A collection of objects providing WRED monitoring.') mibBuilder.exportSymbols('CISCO-WRED-MIB', cwredConfigPrecedEntry=cwredConfigPrecedEntry, ciscoWredMIBCompliance=ciscoWredMIBCompliance, cwredConfigPrecedTable=cwredConfigPrecedTable, ciscoWredMIBGroups=ciscoWredMIBGroups, cwredStatSwitchedPkts=cwredStatSwitchedPkts, cwredQueueEntry=cwredQueueEntry, cwredStatMaxFilteredPkts=cwredStatMaxFilteredPkts, cwredConfigPrecedMinDepthThreshold=cwredConfigPrecedMinDepthThreshold, cwredStatEntry=cwredStatEntry, cwredQueueTable=cwredQueueTable, ciscoWredMIBGroup=ciscoWredMIBGroup, cwredConfigGlobEntry=cwredConfigGlobEntry, cwredConfig=cwredConfig, cwredConfigGlobTable=cwredConfigGlobTable, ciscoWredMIB=ciscoWredMIB, cwredQueueDepth=cwredQueueDepth, ciscoWredMIBConformance=ciscoWredMIBConformance, cwredQueueAverage=cwredQueueAverage, cwredStatTable=cwredStatTable, PYSNMP_MODULE_ID=ciscoWredMIB, ciscoWredMIBObjects=ciscoWredMIBObjects, cwredConfigPrecedPrecedence=cwredConfigPrecedPrecedence, cwredConfigPrecedMaxDepthThreshold=cwredConfigPrecedMaxDepthThreshold, cwredStats=cwredStats, cwredStatRandomFilteredPkts=cwredStatRandomFilteredPkts, ciscoWredMIBCompliances=ciscoWredMIBCompliances, cwredConfigPrecedPktsDropFraction=cwredConfigPrecedPktsDropFraction, cwredConfigGlobQueueWeight=cwredConfigGlobQueueWeight)
with open('fun_file.txt') as close_this_file: setup = close_this_file.readline() punchline = close_this_file.readline() print(setup)
with open('fun_file.txt') as close_this_file: setup = close_this_file.readline() punchline = close_this_file.readline() print(setup)
def teleport(a,b,x,y): d1 = abs(a-b) d2 = abs(a-x)+abs(b-y) d3 = abs(a-y)+abs(b-x) print(d1,d2,d3) if d1 <= d2 and d1 <= d3: return d1 elif d2 <= d1 and d2 <= d3: return d2 else: return d3 print(teleport(3,10,8,2)) print(teleport(86,84,15,78)) print(teleport(35,94,92,87))
def teleport(a, b, x, y): d1 = abs(a - b) d2 = abs(a - x) + abs(b - y) d3 = abs(a - y) + abs(b - x) print(d1, d2, d3) if d1 <= d2 and d1 <= d3: return d1 elif d2 <= d1 and d2 <= d3: return d2 else: return d3 print(teleport(3, 10, 8, 2)) print(teleport(86, 84, 15, 78)) print(teleport(35, 94, 92, 87))
# Write a program that reads an integer n. Then, for all numbers in the range [1, n], prints the number and if it is special or not (True / False). # A number is special when the sum of its digits is 5, 7, or 11. # Examples # Input Output # 15 1 -> False # 2 -> False # 3 -> False # 4 -> False # 5 -> True # 6 -> False # 7 -> True # 8 -> False # 9 -> False # 10 -> False # 11 -> False # 12 -> False # 13 -> False # 14 -> True # 15 -> False # 6 1 -> False # 2 -> False # 3 -> False # 4 -> False # 5 -> True # 6 -> False special_range = (5,7,11) num = int(input()) for i in range(1, num + 1): str_i = str(i) char_sum = 0 for j in range(len(str_i)): char_sum += int(str_i[j]) is_special = True if char_sum in special_range else False print(f"{i} -> {is_special}")
special_range = (5, 7, 11) num = int(input()) for i in range(1, num + 1): str_i = str(i) char_sum = 0 for j in range(len(str_i)): char_sum += int(str_i[j]) is_special = True if char_sum in special_range else False print(f'{i} -> {is_special}')
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def mergeTwoLists(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: if l1 is None and l2 is None: return None if l1 is None: return l2 if l2 is None: return l1 # same as #if None in [l1, l2]: # return l1 or l2 n1 = l1 n2 = l2 if n1.val <= n2.val: result = n1 n1 = n1.next else: result = n2 n2 = n2.next n3 = result while n1 is not None and n2 is not None: if n1.val <= n2.val: n3.next = n1 n1 = n1.next else: n3.next = n2 n2 = n2.next n3 = n3.next if n1 is not None: n3.next = n1 if n2 is not None: n3.next = n2 return result
class Solution: def merge_two_lists(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]: if l1 is None and l2 is None: return None if l1 is None: return l2 if l2 is None: return l1 n1 = l1 n2 = l2 if n1.val <= n2.val: result = n1 n1 = n1.next else: result = n2 n2 = n2.next n3 = result while n1 is not None and n2 is not None: if n1.val <= n2.val: n3.next = n1 n1 = n1.next else: n3.next = n2 n2 = n2.next n3 = n3.next if n1 is not None: n3.next = n1 if n2 is not None: n3.next = n2 return result
f = open("nine.txt", "r") lines = [x.strip() for x in f.readlines()] height = len(lines) width = len(lines[0]) map = [] for line in lines: cur = [int(ch) for ch in list(line)] map.append(cur) risk = 0 for y in range(height): for x in range(width): val = map[y][x] if y !=0 and map[y-1][x] <= val: continue if y != height - 1 and map[y+1][x] <= val: continue if x != 0 and map[y][x-1] <= val: continue if x != width - 1 and map[y][x+1] <= val: continue risk += map[y][x] + 1 print(risk) height = len(lines) width = len(lines[0]) map = [] for line in lines: cur = [int(ch) for ch in list(line)] map.append(cur) basins = [] low_points = [] for y in range(height): for x in range(width): val = map[y][x] if y !=0 and map[y-1][x] <= val: continue if y != height - 1 and map[y+1][x] <= val: continue if x != 0 and map[y][x-1] <= val: continue if x != width - 1 and map[y][x+1] <= val: continue low_points.append((x,y)) for (x,y) in low_points: size = 0 # low point grow outwards to_check = [(x,y)] while len(to_check) != 0: pos = to_check.pop(0) x,y = pos val = map[y][x] if val == 9: continue size += 1 if y !=0 and map[y-1][x] > val and map[y-1][x] != 9: to_check.append((x,y-1)) if y != height - 1 and map[y+1][x] > val and map[y+1][x] != 9: to_check.append((x, y + 1)) if x != 0 and map[y][x-1] > val and map[y][x-1] != 9: to_check.append((x-1, y)) if x != width - 1 and map[y][x+1] > val and map[y][x+1] != 9: to_check.append((x+1,y)) map[y][x] = 9 basins.append(size) basins = sorted(basins, reverse=True) print(basins[0] * basins[1] * basins[2])
f = open('nine.txt', 'r') lines = [x.strip() for x in f.readlines()] height = len(lines) width = len(lines[0]) map = [] for line in lines: cur = [int(ch) for ch in list(line)] map.append(cur) risk = 0 for y in range(height): for x in range(width): val = map[y][x] if y != 0 and map[y - 1][x] <= val: continue if y != height - 1 and map[y + 1][x] <= val: continue if x != 0 and map[y][x - 1] <= val: continue if x != width - 1 and map[y][x + 1] <= val: continue risk += map[y][x] + 1 print(risk) height = len(lines) width = len(lines[0]) map = [] for line in lines: cur = [int(ch) for ch in list(line)] map.append(cur) basins = [] low_points = [] for y in range(height): for x in range(width): val = map[y][x] if y != 0 and map[y - 1][x] <= val: continue if y != height - 1 and map[y + 1][x] <= val: continue if x != 0 and map[y][x - 1] <= val: continue if x != width - 1 and map[y][x + 1] <= val: continue low_points.append((x, y)) for (x, y) in low_points: size = 0 to_check = [(x, y)] while len(to_check) != 0: pos = to_check.pop(0) (x, y) = pos val = map[y][x] if val == 9: continue size += 1 if y != 0 and map[y - 1][x] > val and (map[y - 1][x] != 9): to_check.append((x, y - 1)) if y != height - 1 and map[y + 1][x] > val and (map[y + 1][x] != 9): to_check.append((x, y + 1)) if x != 0 and map[y][x - 1] > val and (map[y][x - 1] != 9): to_check.append((x - 1, y)) if x != width - 1 and map[y][x + 1] > val and (map[y][x + 1] != 9): to_check.append((x + 1, y)) map[y][x] = 9 basins.append(size) basins = sorted(basins, reverse=True) print(basins[0] * basins[1] * basins[2])
adult = int(input()) crian = int(input()) preco = float(input()) preco_final = (crian * (preco/2)) + (adult * preco) print('Total: R$ {:.2f}'.format(preco_final))
adult = int(input()) crian = int(input()) preco = float(input()) preco_final = crian * (preco / 2) + adult * preco print('Total: R$ {:.2f}'.format(preco_final))
# ranges sets #range1 ghmin1, ghmax1, gsdmin1, gsdmax1= 0.35, 0.4, 0.197, 0.207 #range chaos 1 gh/gsd T36 ghmin2, ghmax2, gsdmin2, gsdmax2= 0.1, 0.15, 0.197, 0.207 #range nonchaos 1 gh/gsd T36 #range2 ghmin1b, ghmax1b, gsdmin1b, gsdmax1b= 0.35, 0.40, 0.275, 0.285 #range chaos 4 gh/gsd T36 ghmin2b, ghmax2b, gsdmin2b, gsdmax2b= 0.18, 0.23, 0.275,0.285 #range nonchaos 4 gh/gsd T36 # paremeters for the network Nnode = 50 # the number of neurons lyap_min=0 #minmum lyapunov value lyap_max=1.6 #maxsimum lyapunov value dt = 0.05 # the time step of simulation Xdata=0 Ydata=4 Ydata2=3 tEnd=50000 nsim=50 tbin=40 rseed0=[0,20,25,33,40] # the seed for simulation ranges0=[2,2,2,2,2] # the index of ranges2 Nindex=1 # The number of example ranges for fixed size
(ghmin1, ghmax1, gsdmin1, gsdmax1) = (0.35, 0.4, 0.197, 0.207) (ghmin2, ghmax2, gsdmin2, gsdmax2) = (0.1, 0.15, 0.197, 0.207) (ghmin1b, ghmax1b, gsdmin1b, gsdmax1b) = (0.35, 0.4, 0.275, 0.285) (ghmin2b, ghmax2b, gsdmin2b, gsdmax2b) = (0.18, 0.23, 0.275, 0.285) nnode = 50 lyap_min = 0 lyap_max = 1.6 dt = 0.05 xdata = 0 ydata = 4 ydata2 = 3 t_end = 50000 nsim = 50 tbin = 40 rseed0 = [0, 20, 25, 33, 40] ranges0 = [2, 2, 2, 2, 2] nindex = 1
''' Given an array of integers, sort the array into a wave like array and return it, In other words, arrange the elements into a sequence such that a1 >= a2 <= a3 >= a4 <= a5..... Example Given [1, 2, 3, 4] One possible answer : [2, 1, 4, 3] Another possible answer : [4, 1, 3, 2] ''' def wave_list(A: list) -> list: A.sort() for i in range(0, len(A)-1, 2): A[i], A[i+1] = A[i+1], A[i] return A if __name__ == "__main__": A = [1, 2, 3, 4] print(wave_list(A))
""" Given an array of integers, sort the array into a wave like array and return it, In other words, arrange the elements into a sequence such that a1 >= a2 <= a3 >= a4 <= a5..... Example Given [1, 2, 3, 4] One possible answer : [2, 1, 4, 3] Another possible answer : [4, 1, 3, 2] """ def wave_list(A: list) -> list: A.sort() for i in range(0, len(A) - 1, 2): (A[i], A[i + 1]) = (A[i + 1], A[i]) return A if __name__ == '__main__': a = [1, 2, 3, 4] print(wave_list(A))
KEYS = { "SPOTIFY_CLIENT_ID": "PLACEHOLDER_CLIENT_ID", # Create an app from [here](https://developer.spotify.com/dashboard/applications) "SPOTIFY_CLIENT_SECRET": "PLACEHOLDER_CLIENT_SECRET", # Create an app from [here](https://developer.spotify.com/dashboard/applications) "SPOTIFY_REDIRECT_URI": "http://localhost:5000/callback/spotify", # You have to register this call back in your Application's dashboard https://developer.spotify.com/dashboard/applications }
keys = {'SPOTIFY_CLIENT_ID': 'PLACEHOLDER_CLIENT_ID', 'SPOTIFY_CLIENT_SECRET': 'PLACEHOLDER_CLIENT_SECRET', 'SPOTIFY_REDIRECT_URI': 'http://localhost:5000/callback/spotify'}
# https://www.codewars.com/kata/52c31f8e6605bcc646000082 def two_sum(numbers, target): for i, n1 in enumerate(numbers): for j, n2 in enumerate(numbers[i+1:]): if n1+n2 == target: return [i, i+j+1]
def two_sum(numbers, target): for (i, n1) in enumerate(numbers): for (j, n2) in enumerate(numbers[i + 1:]): if n1 + n2 == target: return [i, i + j + 1]
class Constants: NUM_ARMS = "num_arms" NUM_LEGS = "num_legs" PERSON = "person" ANIMAL_TYPE = "animal_type" CAT = "cat" DOG = "dog" ANIMAL = "animal" NAME = "name" SURNAME = "surname" WHISKERS = "whiskers" TYPE = "type"
class Constants: num_arms = 'num_arms' num_legs = 'num_legs' person = 'person' animal_type = 'animal_type' cat = 'cat' dog = 'dog' animal = 'animal' name = 'name' surname = 'surname' whiskers = 'whiskers' type = 'type'
lista = [('Comestibles', 'Loby Bar', 1, 305.2), ('Comestibles', 'Loby Bar', 5, 87.23), ('Comestibles', 'Piano Bar', 2, 236.9), ('Comestibles', 'Piano Bar', 8, 412.69), ('Bebidas', 'Loby Bar', 3, 145.37), ('Bebidas', 'Loby Bar', 5, 640.81), ('Bebidas', 'Piano Bar', 12, 94.51), ('Tabacos', 'Cafeteria', 4, 498.12), ('Tabacos', 'Cafeteria', 6, 651.3), ('Tabacos', 'Piano Bar', 8, 813.5), ('Tabacos', 'Piano Bar', 11, 843.25), ('Otros', 'Loby Bar', 6, 140.24), ('Otros', 'Piano Bar', 9, 267.06), ('Otros', 'Cafeteria', 12, 695.12)] if len(lista) > 0: data = [] cur_fami = lista[0][0] cur_pvta = lista[0][1] pvtas = [] meses = ['', '', '', '', '', '', '', '', '', '', '', '', 0] tot_fami = [0] * 13 tot = [0] * 13 for pvfa in lista: if pvfa[1] != cur_pvta: pvtas.append((cur_pvta, meses[:])) cur_pvta = pvfa[1] meses = ['', '', '', '', '', '', '', '', '', '', '', '', 0] if pvfa[0] != cur_fami: data.append((cur_fami, pvtas[:], tot_fami[:])) cur_fami = pvfa[0] pvtas = [] tot_fami = [0] * 13 meses[pvfa[2] - 1] = pvfa[3] meses[12] += pvfa[3] tot_fami[pvfa[2] - 1] += pvfa[3] tot_fami[12] += pvfa[3] tot[pvfa[2] - 1] += pvfa[3] tot[12] += pvfa[3] pvtas.append((cur_pvta, meses[:])) data.append((cur_fami, pvtas[:], tot_fami[:])) data.append(tot) print(data) x = [('Comestibles', [('Loby Bar', [305.2, '', '', '', 87.23, '', '', '', '', '', '', '', 392.43]), ('Piano Bar', ['', 236.9, '', '', '', '', '', 412.69, '', '', '', '', 649.59])], [305.2, 236.9, 0, 0, 87.23, 0, 0, 412.69, 0, 0, 0, 0, 1042.02]), ('Bebidas', [('Loby Bar', ['', '', 145.37, '', 640.81, '', '', '', '', '', '', '', 786.18]), ('Piano Bar', ['', '', '', '', '', '', '', '', '', '', '', 94.51, 94.51])], [0, 0, 145.37, 0, 640.81, 0, 0, 0, 0, 0, 0, 94.51, 880.6899999999999]), ('Tabacos', [('Cafeteria', ['', '', '', 498.12, '', 651.3, '', '', '', '', '', '', 1149.42]), ('Piano Bar', ['', '', '', '', '', '', '', 813.5, '', '', 843.25, '', 1656.75])], [0, 0, 0, 498.12, 0, 651.3, 0, 813.5, 0, 0, 843.25, 0, 2806.17]), ('Otros', [('Loby Bar', ['', '', '', '', '', 140.24, '', '', '', '', '', '', 140.24]), ('Piano Bar', ['', '', '', '', '', '', '', '', 267.06, '', '', '', 267.06]), ('Cafeteria', ['', '', '', '', '', '', '', '', '', '', '', 695.12, 695.12])], [0, 0, 0, 0, 0, 140.24, 0, 0, 267.06, 0, 0, 695.12, 1102.42]), [305.2, 236.9, 145.37, 498.12, 728.04, 791.54, 0, 1226.19, 267.06, 0, 843.25, 789.63, 5831.3]]
lista = [('Comestibles', 'Loby Bar', 1, 305.2), ('Comestibles', 'Loby Bar', 5, 87.23), ('Comestibles', 'Piano Bar', 2, 236.9), ('Comestibles', 'Piano Bar', 8, 412.69), ('Bebidas', 'Loby Bar', 3, 145.37), ('Bebidas', 'Loby Bar', 5, 640.81), ('Bebidas', 'Piano Bar', 12, 94.51), ('Tabacos', 'Cafeteria', 4, 498.12), ('Tabacos', 'Cafeteria', 6, 651.3), ('Tabacos', 'Piano Bar', 8, 813.5), ('Tabacos', 'Piano Bar', 11, 843.25), ('Otros', 'Loby Bar', 6, 140.24), ('Otros', 'Piano Bar', 9, 267.06), ('Otros', 'Cafeteria', 12, 695.12)] if len(lista) > 0: data = [] cur_fami = lista[0][0] cur_pvta = lista[0][1] pvtas = [] meses = ['', '', '', '', '', '', '', '', '', '', '', '', 0] tot_fami = [0] * 13 tot = [0] * 13 for pvfa in lista: if pvfa[1] != cur_pvta: pvtas.append((cur_pvta, meses[:])) cur_pvta = pvfa[1] meses = ['', '', '', '', '', '', '', '', '', '', '', '', 0] if pvfa[0] != cur_fami: data.append((cur_fami, pvtas[:], tot_fami[:])) cur_fami = pvfa[0] pvtas = [] tot_fami = [0] * 13 meses[pvfa[2] - 1] = pvfa[3] meses[12] += pvfa[3] tot_fami[pvfa[2] - 1] += pvfa[3] tot_fami[12] += pvfa[3] tot[pvfa[2] - 1] += pvfa[3] tot[12] += pvfa[3] pvtas.append((cur_pvta, meses[:])) data.append((cur_fami, pvtas[:], tot_fami[:])) data.append(tot) print(data) x = [('Comestibles', [('Loby Bar', [305.2, '', '', '', 87.23, '', '', '', '', '', '', '', 392.43]), ('Piano Bar', ['', 236.9, '', '', '', '', '', 412.69, '', '', '', '', 649.59])], [305.2, 236.9, 0, 0, 87.23, 0, 0, 412.69, 0, 0, 0, 0, 1042.02]), ('Bebidas', [('Loby Bar', ['', '', 145.37, '', 640.81, '', '', '', '', '', '', '', 786.18]), ('Piano Bar', ['', '', '', '', '', '', '', '', '', '', '', 94.51, 94.51])], [0, 0, 145.37, 0, 640.81, 0, 0, 0, 0, 0, 0, 94.51, 880.6899999999999]), ('Tabacos', [('Cafeteria', ['', '', '', 498.12, '', 651.3, '', '', '', '', '', '', 1149.42]), ('Piano Bar', ['', '', '', '', '', '', '', 813.5, '', '', 843.25, '', 1656.75])], [0, 0, 0, 498.12, 0, 651.3, 0, 813.5, 0, 0, 843.25, 0, 2806.17]), ('Otros', [('Loby Bar', ['', '', '', '', '', 140.24, '', '', '', '', '', '', 140.24]), ('Piano Bar', ['', '', '', '', '', '', '', '', 267.06, '', '', '', 267.06]), ('Cafeteria', ['', '', '', '', '', '', '', '', '', '', '', 695.12, 695.12])], [0, 0, 0, 0, 0, 140.24, 0, 0, 267.06, 0, 0, 695.12, 1102.42]), [305.2, 236.9, 145.37, 498.12, 728.04, 791.54, 0, 1226.19, 267.06, 0, 843.25, 789.63, 5831.3]]
for _ in range(int(input())): t = 24*60 h, m = map(int, input().split()) print(t-(h*60)-m)
for _ in range(int(input())): t = 24 * 60 (h, m) = map(int, input().split()) print(t - h * 60 - m)
''' My functions that I created to support me during my lessons. ''' def title(msg): #This function will show up a title covered by two lines, one above and other below the msg print('-'*30) print(msg) print('-'*30)
""" My functions that I created to support me during my lessons. """ def title(msg): print('-' * 30) print(msg) print('-' * 30)
N=int(input()) for i in range(1,10): m=N/i if m.is_integer() and 1<=m<=9: print("Yes") break else: print("No")
n = int(input()) for i in range(1, 10): m = N / i if m.is_integer() and 1 <= m <= 9: print('Yes') break else: print('No')