content
stringlengths
7
1.05M
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Distance # {"feature": "Coupon", "instances": 51, "metric_value": 0.9975, "depth": 1} if obj[0]>1: # {"feature": "Education", "instances": 37, "metric_value": 0.9353, "depth": 2} if obj[1]>0: # {"feature": "Occupation", "instances": 29, "metric_value": 0.9784, "depth": 3} if obj[2]<=20: # {"feature": "Distance", "instances": 28, "metric_value": 0.9666, "depth": 4} if obj[3]<=2: return 'True' elif obj[3]>2: return 'True' else: return 'True' elif obj[2]>20: return 'False' else: return 'False' elif obj[1]<=0: # {"feature": "Occupation", "instances": 8, "metric_value": 0.5436, "depth": 3} if obj[2]>5: return 'True' elif obj[2]<=5: # {"feature": "Distance", "instances": 2, "metric_value": 1.0, "depth": 4} if obj[3]<=1: return 'True' elif obj[3]>1: return 'False' else: return 'False' else: return 'True' else: return 'True' elif obj[0]<=1: # {"feature": "Occupation", "instances": 14, "metric_value": 0.7496, "depth": 2} if obj[2]>4: return 'False' elif obj[2]<=4: # {"feature": "Education", "instances": 6, "metric_value": 1.0, "depth": 3} if obj[1]>1: # {"feature": "Distance", "instances": 4, "metric_value": 0.8113, "depth": 4} if obj[3]<=2: return 'True' elif obj[3]>2: return 'True' else: return 'True' elif obj[1]<=1: return 'False' else: return 'False' else: return 'False' else: return 'False'
# -*- coding: utf-8 -*- """ Auth* related model. This is where the models used by the authentication stack are defined. It's perfectly fine to re-use this definition in the redrugs application, though. """
#! /Users/michael/anaconda3/bin/python # @Date: 2018-09-01 09:00:44 # 评分算法实现 # 基础天梯分数 R0 = 1400 def rating(Ra, Rb): """ Ra: 赢的一方玩家 a 的分数 Rb: 输的一方玩家 b 的分数 """ # K值,用于控制分数改变的幅度,数字越大幅度越大 K = 16 Sa = 1 Sb = 0 Ea = 1 / (1 + 10**((Ra - Rb)/400)) Eb = 1 / (1 + 10**((Rb - Ra)/400)) Ra = Ra + K * (Sa - Ea) Rb = Rb + K * (Sb - Eb) return Ra, Rb if __name__ == '__main__': Ra = 1400 Rb = 1400 for i in range(100): Ra, Rb = rating(Ra, Rb, 1) print(Ra, Rb)
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2020, Brian Scholer <@briantist> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' --- module: win_psrepository_copy short_description: Copies registered PSRepositories to other user profiles version_added: '1.3.0' description: - Copies specified registered PSRepositories to other user profiles on the system. - Can include the C(Default) profile so that new users start with the selected repositories. - Can include special service accounts like the local SYSTEM user, LocalService, NetworkService. options: source: description: - The full path to the source repositories XML file. - Defaults to the repositories registered to the current user. type: path default: '%LOCALAPPDATA%\Microsoft\Windows\PowerShell\PowerShellGet\PSRepositories.xml' name: description: - The names of repositories to copy. - Names are interpreted as wildcards. type: list elements: str default: ['*'] exclude: description: - The names of repositories to exclude. - Names are interpreted as wildcards. - If a name matches both an include (I(name)) and I(exclude), it will be excluded. type: list elements: str profiles: description: - The names of user profiles to populate with repositories. - Names are interpreted as wildcards. - The C(Default) profile can also be matched. - The C(Public) and C(All Users) profiles cannot be targeted, as PSRepositories are not loaded from them. type: list elements: str default: ['*'] exclude_profiles: description: - The names of user profiles to exclude. - If a profile matches both an include (I(profiles)) and I(exclude_profiles), it will be excluded. - By default, the service account profiles are excluded. - To explcitly exclude nothing, set I(exclude_profiles=[]). type: list elements: str default: - systemprofile - LocalService - NetworkService notes: - Does not require the C(PowerShellGet) module or any other external dependencies. - User profiles are loaded from the registry. If a given path does not exist (like if the profile directory was deleted), it is silently skipped. - If setting service account profiles, you may need C(become=yes). See examples. - "When PowerShellGet first sets up a repositories file, it always adds C(PSGallery), however if this module creates a new repos file and your selected repositories don't include C(PSGallery), it won't be in your destination." - "The values searched in I(profiles) (and I(exclude_profiles)) are profile names, not necessarily user names. This can happen when the profile path is deliberately changed or when domain user names conflict with users from the local computer or another domain. In this case the second+ user may have the domain name or local computer name appended, like C(JoeUser.Contoso) vs. C(JoeUser). If you intend to filter user profiles, ensure your filters catch the right names." - "In the case of the service accounts, the specific profiles are C(systemprofile) (for the C(SYSTEM) user), and C(LocalService) or C(NetworkService) for those accounts respectively." - "Repositories with credentials (requiring authentication) or proxy information will copy, but the credentials and proxy details will not as that information is not stored with repository." seealso: - module: community.windows.win_psrepository - module: community.windows.win_psrepository_info author: - Brian Scholer (@briantist) ''' EXAMPLES = r''' - name: Copy the current user's PSRepositories to all non-service account profiles and Default profile community.windows.win_psrepository_copy: - name: Copy the current user's PSRepositories to all profiles and Default profile community.windows.win_psrepository_copy: exclude_profiles: [] - name: Copy the current user's PSRepositories to all profiles beginning with A, B, or C community.windows.win_psrepository_copy: profiles: - 'A*' - 'B*' - 'C*' - name: Copy the current user's PSRepositories to all profiles beginning B except Brian and Brianna community.windows.win_psrepository_copy: profiles: 'B*' exclude_profiles: - Brian - Brianna - name: Copy a specific set of repositories to profiles beginning with 'svc' with exceptions community.windows.win_psrepository_copy: name: - CompanyRepo1 - CompanyRepo2 - PSGallery profiles: 'svc*' exclude_profiles: 'svc-restricted' - name: Copy repos matching a pattern with exceptions community.windows.win_psrepository_copy: name: 'CompanyRepo*' exclude: 'CompanyRepo*-Beta' - name: Copy repositories from a custom XML file on the target host community.windows.win_psrepository_copy: source: 'C:\data\CustomRepostories.xml' ### A sample workflow of seeding a system with a custom repository # A playbook that does initial host setup or builds system images - name: Register custom respository community.windows.win_psrepository: name: PrivateRepo source_location: https://example.com/nuget/feed/etc installation_policy: trusted - name: Ensure all current and new users have this repository registered community.windows.win_psrepository_copy: name: PrivateRepo # In another playbook, run by other users (who may have been created later) - name: Install a module community.windows.win_psmodule: name: CompanyModule repository: PrivateRepo state: present ''' RETURN = r''' '''
# -*- coding: utf-8 -*- __version__ = '4.4.0' __description__ = """Sequoia Python Client SDK""" __url__ = "https://github.com/pikselpalette/sequoia-python-client-sdk" __author__ = 'Piksel'
print('Olá mundo!') # A função print recebe um argumento, ou mais. print('Tudo', 'otimo', '?') # Argumentos nomeados print('Cleberton', 'Francisco', sep='-') # separador sera - print('Esta', 'Tudo', 'bem?', end='... \n') # adiciona algo no final da string print('826', '231', '070', sep='.', end='-') # Formatando CPF com print print('18')
class MockupSpineLog(object): def debug(self, message, *args): pass class MockupSpine(object): def __init__(self): self.queryHandlers = {} self.commandHandlers = {} self.eventHandlers = {} self.events={} self.log = MockupSpineLog() def register_query_handler(self, query, func, **kwargs): self.queryHandlers[query] = func def register_command_handler(self, query, func, **kwargs): self.commandHandlers[query] = func def register_event_handler(self, query, func, **kwargs): self.eventHandlers[query] = func def trigger_event(self, event, id, *args, **kwargs): self.events[event] = {"id":id, "args":args, "kwargs":kwargs}
class BaseError(Exception): """Base error class""" pass class UtilError(BaseError): """Base util error class""" pass class CCMAPIError(UtilError): """Raised when a ccm_api returned status is not `ok`""" pass
def interchange(array,k): low,high,n = 0, len(array)-1,len(array) x = min(k,n-k) for i in range(x): array[low],array[high] = array[high],array[low] low +=1 high -= 1 def rotateArray(array,k): for i in range(k): temp = array[0] for j in range(len(array)-1): array[j]=array[j+1] array[j+1] = temp # Round robin tournamnet scheduling: def leftRotate(array): temp = array[1] length = len(array) for i in range(1, length-1): array[i] = array[i + 1] array[length - 1] = temp def insertPairing(array): n = len(array) // 2 for i in range(n): print(str(array[i])+" "+str(array[i+n])) pass def getTimeTable(array): for i in range(len(array)-1): insertPairing(array) leftRotate(array) print("--------------") x = [1, 2, 3, 4, 5, 6] getTimeTable(x)
class TestClass: def test_deepsegmenter(self): """here is my test code https://docs.pytest.org/en/stable/getting-started.html#create-your-first-test """ # no test now assert True
""" RISC-V disassemble helper (c) 2019 The Bonfire Project License: See LICENSE """ abi_regnames = ( "zero","ra","sp","gp","tp","t0","t1","t2","s0","s1","a0","a1","a2","a3","a4","a5", \ "a6","a7","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","t3","t4","t5","t6") def abi_name(x): return abi_regnames[x]
class Record(): def __init__(self, record_id, parent_id): self.record_id = record_id self.parent_id = parent_id class Node(): def __init__(self, node_id): self.node_id = node_id self.children = [] def BuildTree(records): root = None records.sort(key=lambda x: x.record_id) ordered_id = [i.record_id for i in records] if records: if ordered_id[-1] != len(ordered_id) - 1: raise ValueError('Tree must be continuous') if ordered_id[0] != 0: raise ValueError('Tree must start with id 0') trees = [] parent = {} for i in range(len(ordered_id)): for j in records: if ordered_id[i] == j.record_id: if j.record_id == 0: if j.parent_id != 0: raise ValueError('Root node cannot have a parent') if j.record_id < j.parent_id: raise ValueError('Parent id must be lower than child id') if j.record_id == j.parent_id: if j.record_id != 0: raise ValueError('Tree is a cycle') trees.append(Node(ordered_id[i])) for i in range(len(ordered_id)): for j in trees: if i == j.node_id: parent = j for j in records: if j.parent_id == i: for k in trees: if k.node_id == 0: continue if j.record_id == k.node_id: child = k parent.children.append(child) if len(trees) > 0: root = trees[0] return root
def restrict_level(mobs, level): for mob, priority in mobs: if level < mob.level: continue yield (mob, priority) def restrict_terrain(mobs, terrain): for mob, priority in mobs: if terrain not in mob.terrains: continue yield (mob, priority) def restrict_mercenary(mobs, mercenary): for mob, priority in mobs: if mercenary != mob.is_mercenary: continue yield (mob, priority) def change_type_priority(mobs, types, delta): for mob, priority in mobs: if mob.type in types: yield (mob, priority + delta) continue yield (mob, priority)
# noinspection PyBroadException def computegrade(score): try: score = float(input("Enter the score")) if score >= 0.9: print("Grade A") elif score >= 0.8: print("Grade B") elif score >= 0.7: print("Grade C") elif score >= 0.6: print("Grade D") elif score < 0.6: print("Grade F") else: print("Bad score") except: print("please revise ur values") score = float(input("Enter the score:")) if score >= 1.1: computegrade(score) else: print("Enter correct numeric values")
""" LOL! I need = (One; Javascript) ~please . bin/djet.lang:print :Note! 13; Street, Lulin10, Sofia; Boril B. Boyanov; (13 = Streetno); ... ([&1] -> Small Addreess) ~please Nigga, Im :l33t{wracker, hacker, physici\ an & physicist} """
# __init__.py # Copyright 2021 Roger Marsh # Licence: See LICENCE (BSD licence) """Access Berkeley DB database of chess games using berkeleydb package. This interface can be used if the berkeleydb package is installed. berkeleydb is available as a source package, from PyPI for example. Follow the instructions to build and install berkeleydb. This includes installing Berkeley DB. """
''' На вход программе подается два целых числа. Напишите программу, которая выводит разницу их произведения с их суммой. Sample Input 1: 3 4 Sample Output 1: 5 Sample Input 2: 10 15 Sample Output 2: 125 ''' n1, n2 = int(input()), int(input()) print(n1 * n2 - (n1 + n2))
"""Shared modules for template-based document generation. This is how the file generation from a yWriter project is generally done: The write method runs through all chapters, scenes, and world building elements, such as characters, locations ans items, and fills templates. The package's README file contains a list of templates and placeholders: https://github.com/peter88213/PyWriter/tree/master/src/pywriter/file#readme Modules: file_export.py -- Provide a generic class for template-based file export. filter.py -- Provide a generic filter class for template-based file export. sc_lc_filter.py -- Provide a scene per location filter class for template-based file export. sc_cr_filter.py -- Provide a scene per character filter class for template-based file export. sc_tg_filter.py -- Provide a scene per tag filter class for template-based file export. sc_it_filter.py -- Provide a scene per item filter class for template-based file export. sc_vp_filter.py -- Provide a scene per viewpoint filter class for template-based file export. """
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## # Generated by the Odoo plugin for Dia ! # -*- coding: utf-8 -*- { 'name': "libro_compras", 'summary': """ Libro de Compras """, 'description': """ Libro de Compras """, 'author': "Softw & Hardw Solutions SSH", 'website': "https://solutionssh.com/", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml # for the full list 'category': 'Contabilidad', 'version': '0.1', # any module necessary for this one to work correctly "depends" : ['base','account'], # always loaded 'data': ['views/wizard_libro_compras.xml','reports/report_factura_proveedores.xml'], # only loaded in demonstration mode 'demo': [ ], 'installable': True, }
cases = int(input()) for case in range(cases): k,p = [int(x) for x in input().split(' ')] print(k,int(p+(p*(p+1))/2))
test_cases = int(input().strip()) def get_days_of_month(month): if month == 2: return 28 if month in [1, 3, 5, 7, 8, 10, 12]: return 31 return 30 for i in range(1, test_cases + 1): month1, day1, month2, day2 = map(int, input().strip().split()) if month1 == month2: print('#{} {}'.format(i, day2 - day1 + 1)) else: total = 0 for j in range(month1, month2): total += get_days_of_month(j) total = total - day1 + 1 total += day2 print('#{} {}'.format(i, total))
# # PySNMP MIB module CISCO-DOT11-QOS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-QOS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:38:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint") CDot11IfVlanIdOrZero, = mibBuilder.importSymbols("CISCO-DOT11-IF-MIB", "CDot11IfVlanIdOrZero") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") ObjectIdentity, ModuleIdentity, Unsigned32, Integer32, iso, Gauge32, MibIdentifier, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, Counter32, Bits, TimeTicks, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "ModuleIdentity", "Unsigned32", "Integer32", "iso", "Gauge32", "MibIdentifier", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "Counter32", "Bits", "TimeTicks", "IpAddress") TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "TextualConvention") ciscoDot11QosMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 416)) ciscoDot11QosMIB.setRevisions(('2006-05-09 00:00', '2003-11-24 00:00',)) if mibBuilder.loadTexts: ciscoDot11QosMIB.setLastUpdated('200605090000Z') if mibBuilder.loadTexts: ciscoDot11QosMIB.setOrganization('Cisco Systems Inc.') ciscoDot11QosMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 0)) ciscoDot11QosMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 1)) ciscoDot11QosMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 2)) ciscoDot11QosConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1)) ciscoDot11QosQueue = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2)) ciscoDot11QosStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3)) ciscoDot11QosNotifControl = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 4)) class Cdot11QosTrafficClass(TextualConvention, Integer32): reference = 'IEEE 802.1D-1998, Annex H.2.10 and IEEE 802.11E-2001, section 7.5.1.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3)) namedValues = NamedValues(("background", 0), ("bestEffort", 1), ("video", 2), ("voice", 3)) cdot11QosConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1), ) if mibBuilder.loadTexts: cdot11QosConfigTable.setStatus('current') cdot11QosConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-QOS-MIB", "cdot11TrafficQueue")) if mibBuilder.loadTexts: cdot11QosConfigEntry.setStatus('current') cdot11TrafficQueue = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cdot11TrafficQueue.setStatus('current') cdot11TrafficClass = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 2), Cdot11QosTrafficClass()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11TrafficClass.setStatus('current') cdot11QosCWmin = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cdot11QosCWmin.setStatus('current') cdot11QosCWmax = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cdot11QosCWmax.setStatus('current') cdot11QosBackoffOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 20))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cdot11QosBackoffOffset.setStatus('current') cdot11QosMaxRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cdot11QosMaxRetry.setStatus('current') cdot11QosSupportTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 2), ) if mibBuilder.loadTexts: cdot11QosSupportTable.setStatus('current') cdot11QosSupportEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cdot11QosSupportEntry.setStatus('current') cdot11QosOptionImplemented = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 2, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosOptionImplemented.setStatus('current') cdot11QosOptionEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 2, 1, 2), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosOptionEnabled.setStatus('current') cdot11QosQueuesAvailable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 2, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(4, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosQueuesAvailable.setStatus('current') cdot11QosQueueTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2, 1), ) if mibBuilder.loadTexts: cdot11QosQueueTable.setStatus('current') cdot11QosQueueEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-QOS-MIB", "cdot11TrafficQueue")) if mibBuilder.loadTexts: cdot11QosQueueEntry.setStatus('current') cdot11QosQueueQuota = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosQueueQuota.setStatus('current') cdot11QosQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2, 1, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosQueueSize.setStatus('current') cdot11QosQueuePeakSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 2, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosQueuePeakSize.setStatus('current') cdot11QosStatisticsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1), ) if mibBuilder.loadTexts: cdot11QosStatisticsTable.setStatus('current') cdot11QosStatisticsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-QOS-MIB", "cdot11TrafficQueue")) if mibBuilder.loadTexts: cdot11QosStatisticsEntry.setStatus('current') cdot11QosDiscardedFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosDiscardedFrames.setStatus('current') cdot11QosFails = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosFails.setStatus('current') cdot11QosRetries = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosRetries.setStatus('current') cdot11QosMutipleRetries = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosMutipleRetries.setStatus('current') cdot11QosTransmittedFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosTransmittedFrames.setStatus('current') cdot11QosIfStatisticsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 2), ) if mibBuilder.loadTexts: cdot11QosIfStatisticsTable.setStatus('current') cdot11QosIfStatisticsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cdot11QosIfStatisticsEntry.setStatus('current') cdot11QosIfDiscardedFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 3, 2, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosIfDiscardedFragments.setStatus('current') cdot11QosIfVlanTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 3), ) if mibBuilder.loadTexts: cdot11QosIfVlanTable.setStatus('current') cdot11QosIfVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-QOS-MIB", "cdot11QosIfVlanId")) if mibBuilder.loadTexts: cdot11QosIfVlanEntry.setStatus('current') cdot11QosIfVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 3, 1, 1), CDot11IfVlanIdOrZero().subtype(subtypeSpec=ValueRangeConstraint(1, 4095))) if mibBuilder.loadTexts: cdot11QosIfVlanId.setStatus('current') cdot11QosIfVlanTrafficClass = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 1, 3, 1, 2), Cdot11QosTrafficClass()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdot11QosIfVlanTrafficClass.setStatus('current') cdot11QosNotifEnabled = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 416, 1, 4, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cdot11QosNotifEnabled.setStatus('current') cdot11QosChangeNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 416, 0, 1)).setObjects(("CISCO-DOT11-QOS-MIB", "cdot11TrafficClass")) if mibBuilder.loadTexts: cdot11QosChangeNotif.setStatus('current') ciscoDot11QosMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 1)) ciscoDot11QosMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 2)) ciscoDot11QosMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 1, 1)).setObjects(("CISCO-DOT11-QOS-MIB", "ciscoDot11QosConfigGroup"), ("CISCO-DOT11-QOS-MIB", "ciscoDot11QosStatsGroup"), ("CISCO-DOT11-QOS-MIB", "ciscoDot11QosNotifControlGroup"), ("CISCO-DOT11-QOS-MIB", "ciscoDot11QosNotificationGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoDot11QosMIBCompliance = ciscoDot11QosMIBCompliance.setStatus('current') ciscoDot11QosConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 2, 1)).setObjects(("CISCO-DOT11-QOS-MIB", "cdot11TrafficClass"), ("CISCO-DOT11-QOS-MIB", "cdot11QosCWmin"), ("CISCO-DOT11-QOS-MIB", "cdot11QosCWmax"), ("CISCO-DOT11-QOS-MIB", "cdot11QosBackoffOffset"), ("CISCO-DOT11-QOS-MIB", "cdot11QosMaxRetry"), ("CISCO-DOT11-QOS-MIB", "cdot11QosOptionImplemented"), ("CISCO-DOT11-QOS-MIB", "cdot11QosOptionEnabled"), ("CISCO-DOT11-QOS-MIB", "cdot11QosQueuesAvailable"), ("CISCO-DOT11-QOS-MIB", "cdot11QosQueueQuota"), ("CISCO-DOT11-QOS-MIB", "cdot11QosQueueSize"), ("CISCO-DOT11-QOS-MIB", "cdot11QosQueuePeakSize"), ("CISCO-DOT11-QOS-MIB", "cdot11QosIfVlanTrafficClass")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoDot11QosConfigGroup = ciscoDot11QosConfigGroup.setStatus('current') ciscoDot11QosStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 2, 2)).setObjects(("CISCO-DOT11-QOS-MIB", "cdot11QosIfDiscardedFragments"), ("CISCO-DOT11-QOS-MIB", "cdot11QosDiscardedFrames"), ("CISCO-DOT11-QOS-MIB", "cdot11QosFails"), ("CISCO-DOT11-QOS-MIB", "cdot11QosRetries"), ("CISCO-DOT11-QOS-MIB", "cdot11QosMutipleRetries"), ("CISCO-DOT11-QOS-MIB", "cdot11QosTransmittedFrames")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoDot11QosStatsGroup = ciscoDot11QosStatsGroup.setStatus('current') ciscoDot11QosNotifControlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 2, 3)).setObjects(("CISCO-DOT11-QOS-MIB", "cdot11QosNotifEnabled")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoDot11QosNotifControlGroup = ciscoDot11QosNotifControlGroup.setStatus('current') ciscoDot11QosNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 416, 2, 2, 4)).setObjects(("CISCO-DOT11-QOS-MIB", "cdot11QosChangeNotif")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoDot11QosNotificationGroup = ciscoDot11QosNotificationGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-DOT11-QOS-MIB", PYSNMP_MODULE_ID=ciscoDot11QosMIB, ciscoDot11QosMIBObjects=ciscoDot11QosMIBObjects, ciscoDot11QosMIBCompliances=ciscoDot11QosMIBCompliances, cdot11QosDiscardedFrames=cdot11QosDiscardedFrames, ciscoDot11QosNotifControl=ciscoDot11QosNotifControl, cdot11QosQueueTable=cdot11QosQueueTable, cdot11QosQueuePeakSize=cdot11QosQueuePeakSize, ciscoDot11QosMIBConformance=ciscoDot11QosMIBConformance, cdot11QosIfDiscardedFragments=cdot11QosIfDiscardedFragments, ciscoDot11QosStatsGroup=ciscoDot11QosStatsGroup, cdot11QosSupportEntry=cdot11QosSupportEntry, cdot11QosQueuesAvailable=cdot11QosQueuesAvailable, cdot11QosRetries=cdot11QosRetries, cdot11QosIfVlanId=cdot11QosIfVlanId, ciscoDot11QosMIBGroups=ciscoDot11QosMIBGroups, cdot11QosSupportTable=cdot11QosSupportTable, Cdot11QosTrafficClass=Cdot11QosTrafficClass, cdot11QosTransmittedFrames=cdot11QosTransmittedFrames, cdot11QosOptionEnabled=cdot11QosOptionEnabled, ciscoDot11QosQueue=ciscoDot11QosQueue, ciscoDot11QosMIB=ciscoDot11QosMIB, cdot11QosConfigEntry=cdot11QosConfigEntry, cdot11QosConfigTable=cdot11QosConfigTable, ciscoDot11QosConfig=ciscoDot11QosConfig, cdot11QosQueueEntry=cdot11QosQueueEntry, cdot11QosIfVlanEntry=cdot11QosIfVlanEntry, ciscoDot11QosMIBCompliance=ciscoDot11QosMIBCompliance, cdot11QosBackoffOffset=cdot11QosBackoffOffset, cdot11QosIfStatisticsEntry=cdot11QosIfStatisticsEntry, cdot11QosMutipleRetries=cdot11QosMutipleRetries, cdot11QosMaxRetry=cdot11QosMaxRetry, ciscoDot11QosNotifControlGroup=ciscoDot11QosNotifControlGroup, cdot11QosChangeNotif=cdot11QosChangeNotif, cdot11QosNotifEnabled=cdot11QosNotifEnabled, cdot11QosQueueSize=cdot11QosQueueSize, cdot11QosCWmin=cdot11QosCWmin, cdot11QosQueueQuota=cdot11QosQueueQuota, cdot11TrafficClass=cdot11TrafficClass, cdot11QosIfVlanTable=cdot11QosIfVlanTable, ciscoDot11QosNotificationGroup=ciscoDot11QosNotificationGroup, cdot11QosStatisticsEntry=cdot11QosStatisticsEntry, ciscoDot11QosStatistics=ciscoDot11QosStatistics, cdot11QosOptionImplemented=cdot11QosOptionImplemented, cdot11QosIfVlanTrafficClass=cdot11QosIfVlanTrafficClass, ciscoDot11QosMIBNotifs=ciscoDot11QosMIBNotifs, cdot11QosCWmax=cdot11QosCWmax, cdot11QosIfStatisticsTable=cdot11QosIfStatisticsTable, ciscoDot11QosConfigGroup=ciscoDot11QosConfigGroup, cdot11TrafficQueue=cdot11TrafficQueue, cdot11QosFails=cdot11QosFails, cdot11QosStatisticsTable=cdot11QosStatisticsTable)
def fibonacci(n): a = 1 b = 1 while b <= n: yield b a, b = b, a + b print("Numbers:", list(fibonacci(40))) print("Sum:", sum(filter(lambda x: x % 2 == 0, fibonacci(4e6))))
class NeureCtr: def __init__(self, content_label): self._uuid = content_label self._relevants = {} @property def uuid(self): return self._uuid @property def relevants(self): return self._relevants @relevants.setter def relevants(self, value): if value[0] not in self._relevants: self._relevants[value[0]] = [value[1]] else: info = self._relevants[value[0]] info.append(value[1])
def boxplot(x_data, y_data, base_color="#539caf", median_color="#297083", x_label="", y_label="", title=""): _, ax = plt.subplots() # Draw boxplots, specifying desired style ax.boxplot(y_data # patch_artist must be True to control box fill , patch_artist = True # Properties of median line , medianprops = {'color': median_color} # Properties of box , boxprops = {'color': base_color, 'facecolor': base_color} # Properties of whiskers , whiskerprops = {'color': base_color} # Properties of whisker caps , capprops = {'color': base_color}) # By default, the tick label starts at 1 and increments by 1 for # each box drawn. This sets the labels to the ones we want ax.set_xticklabels(x_data) ax.set_ylabel(y_label) ax.set_xlabel(x_label) ax.set_title(title)
# -*- coding: utf-8 -*- def get_lam_list(self, is_int_to_ext=True): """Returns the ordered list of lamination of the machine Parameters ---------- self : MachineUD MachineUD object is_int_to_ext : bool true to order the list from the inner lamination to the extrenal one Returns ------- lam_list : list Ordered lamination list """ lam_list = self.lam_list # Sort by Rint by assuming the lamination are not colliding return sorted(lam_list, key=lambda x: x.Rint, reverse=not is_int_to_ext)
def lambda_handler(event, context): # TODO implement return { 'statusCode': 200, 'body': 'Hello from Lambda!' }
# # PySNMP MIB module WLSX-SYSTEMEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WLSX-SYSTEMEXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:30:06 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) # wlsxEnterpriseMibModules, = mibBuilder.importSymbols("ARUBA-MIB", "wlsxEnterpriseMibModules") ArubaSwitchRole, ArubaActiveState, ArubaCardType = mibBuilder.importSymbols("ARUBA-TC", "ArubaSwitchRole", "ArubaActiveState", "ArubaCardType") ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") Unsigned32, ModuleIdentity, Counter64, TimeTicks, Integer32, snmpModules, iso, Bits, MibIdentifier, IpAddress, TextualConvention, NotificationType, Counter32, Gauge32, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "ModuleIdentity", "Counter64", "TimeTicks", "Integer32", "snmpModules", "iso", "Bits", "MibIdentifier", "IpAddress", "TextualConvention", "NotificationType", "Counter32", "Gauge32", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TAddress, TruthValue, TimeInterval, TestAndIncr, DisplayString, MacAddress, PhysAddress, TextualConvention, RowStatus, TDomain, StorageType = mibBuilder.importSymbols("SNMPv2-TC", "TAddress", "TruthValue", "TimeInterval", "TestAndIncr", "DisplayString", "MacAddress", "PhysAddress", "TextualConvention", "RowStatus", "TDomain", "StorageType") wlsxSystemExtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2)) wlsxSystemExtMIB.setRevisions(('1908-12-11 21:08',)) if mibBuilder.loadTexts: wlsxSystemExtMIB.setLastUpdated('0812112108Z') if mibBuilder.loadTexts: wlsxSystemExtMIB.setOrganization('Aruba Wireless Networks') wlsxSystemExtGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1)) wlsxSystemExtTableGenNumberGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2)) wlsxSysExtSwitchIp = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchIp.setStatus('current') wlsxSysExtHostname = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtHostname.setStatus('current') wlsxSysExtModelName = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtModelName.setStatus('current') wlsxSysExtSwitchRole = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 4), ArubaSwitchRole()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchRole.setStatus('current') wlsxSysExtSwitchMasterIp = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchMasterIp.setStatus('current') wlsxSysExtSwitchDate = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wlsxSysExtSwitchDate.setStatus('current') wlsxSysExtSwitchBaseMacaddress = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 7), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchBaseMacaddress.setStatus('current') wlsxSysExtFanTrayAssemblyNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtFanTrayAssemblyNumber.setStatus('current') wlsxSysExtFanTraySerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtFanTraySerialNumber.setStatus('current') wlsxSysExtInternalTemparature = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtInternalTemparature.setStatus('current') wlsxSysExtLicenseSerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtLicenseSerialNumber.setStatus('current') wlsxSysExtSwitchLicenseCount = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchLicenseCount.setStatus('current') wlsxSysExtProcessorTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 13), ) if mibBuilder.loadTexts: wlsxSysExtProcessorTable.setStatus('current') wlsxSysExtProcessorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 13, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtProcessorID")) if mibBuilder.loadTexts: wlsxSysExtProcessorEntry.setStatus('current') sysExtProcessorID = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 13, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtProcessorID.setStatus('current') sysExtProcessorDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 13, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtProcessorDescr.setStatus('current') sysExtProcessorLoad = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 13, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtProcessorLoad.setStatus('current') wlsxSysExtStorageTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14), ) if mibBuilder.loadTexts: wlsxSysExtStorageTable.setStatus('current') wlsxSysExtStorageEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtStorageIndex")) if mibBuilder.loadTexts: wlsxSysExtStorageEntry.setStatus('current') sysExtStorageIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtStorageIndex.setStatus('current') sysExtStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ram", 1), ("flashMemory", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtStorageType.setStatus('current') sysExtStorageSize = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtStorageSize.setStatus('current') sysExtStorageUsed = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtStorageUsed.setStatus('current') sysExtStorageName = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 14, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtStorageName.setStatus('current') wlsxSysExtMemoryTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15), ) if mibBuilder.loadTexts: wlsxSysExtMemoryTable.setStatus('current') wlsxSysExtMemoryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtMemoryIndex")) if mibBuilder.loadTexts: wlsxSysExtMemoryEntry.setStatus('current') sysExtMemoryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtMemoryIndex.setStatus('current') sysExtMemorySize = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtMemorySize.setStatus('current') sysExtMemoryUsed = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtMemoryUsed.setStatus('current') sysExtMemoryFree = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 15, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtMemoryFree.setStatus('current') wlsxSysExtCardTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16), ) if mibBuilder.loadTexts: wlsxSysExtCardTable.setStatus('current') wlsxSysExtCardEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtCardSlot")) if mibBuilder.loadTexts: wlsxSysExtCardEntry.setStatus('current') sysExtCardSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtCardSlot.setStatus('current') sysExtCardType = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 2), ArubaCardType()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardType.setStatus('current') sysExtCardNumOfPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardNumOfPorts.setStatus('current') sysExtCardNumOfFastethernetPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardNumOfFastethernetPorts.setStatus('current') sysExtCardNumOfGigPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardNumOfGigPorts.setStatus('current') sysExtCardSerialNo = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardSerialNo.setStatus('current') sysExtCardAssemblyNo = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardAssemblyNo.setStatus('current') sysExtCardManufacturingDate = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardManufacturingDate.setStatus('current') sysExtCardHwRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardHwRevision.setStatus('current') sysExtCardFpgaRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardFpgaRevision.setStatus('current') sysExtCardSwitchChip = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardSwitchChip.setStatus('current') sysExtCardStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 12), ArubaActiveState()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardStatus.setStatus('current') sysExtCardUserSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 16, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtCardUserSlot.setStatus('current') wlsxSysExtFanTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 17), ) if mibBuilder.loadTexts: wlsxSysExtFanTable.setStatus('current') wlsxSysExtFanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 17, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtFanIndex")) if mibBuilder.loadTexts: wlsxSysExtFanEntry.setStatus('current') sysExtFanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 17, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtFanIndex.setStatus('current') sysExtFanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 17, 1, 2), ArubaActiveState()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtFanStatus.setStatus('current') wlsxSysExtPowerSupplyTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 18), ) if mibBuilder.loadTexts: wlsxSysExtPowerSupplyTable.setStatus('current') wlsxSysExtPowerSupplyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 18, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtPowerSupplyIndex")) if mibBuilder.loadTexts: wlsxSysExtPowerSupplyEntry.setStatus('current') sysExtPowerSupplyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 18, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtPowerSupplyIndex.setStatus('current') sysExtPowerSupplyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 18, 1, 2), ArubaActiveState()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtPowerSupplyStatus.setStatus('current') wlsxSysExtSwitchListTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19), ) if mibBuilder.loadTexts: wlsxSysExtSwitchListTable.setStatus('current') wlsxSysExtSwitchListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtSwitchIPAddress")) if mibBuilder.loadTexts: wlsxSysExtSwitchListEntry.setStatus('current') sysExtSwitchIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 1), IpAddress()) if mibBuilder.loadTexts: sysExtSwitchIPAddress.setStatus('current') sysExtSwitchRole = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 2), ArubaSwitchRole()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchRole.setStatus('current') sysExtSwitchLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchLocation.setStatus('current') sysExtSwitchSWVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchSWVersion.setStatus('current') sysExtSwitchStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 5), ArubaActiveState()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchStatus.setStatus('current') sysExtSwitchName = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchName.setStatus('current') sysExtSwitchSerNo = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 19, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtSwitchSerNo.setStatus('current') wlsxSysExtSwitchLicenseTable = MibTable((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20), ) if mibBuilder.loadTexts: wlsxSysExtSwitchLicenseTable.setStatus('current') wlsxSysExtLicenseEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1), ).setIndexNames((0, "WLSX-SYSTEMEXT-MIB", "sysExtLicenseIndex")) if mibBuilder.loadTexts: wlsxSysExtLicenseEntry.setStatus('current') sysExtLicenseIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 1), Integer32()) if mibBuilder.loadTexts: sysExtLicenseIndex.setStatus('current') sysExtLicenseKey = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtLicenseKey.setStatus('current') sysExtLicenseInstalled = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtLicenseInstalled.setStatus('current') sysExtLicenseExpires = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtLicenseExpires.setStatus('current') sysExtLicenseFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtLicenseFlags.setStatus('current') sysExtLicenseService = MibTableColumn((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 20, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysExtLicenseService.setStatus('current') wlsxSysExtMMSCompatLevel = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 21), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtMMSCompatLevel.setStatus('current') wlsxSysExtMMSConfigID = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 22), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtMMSConfigID.setStatus('current') wlsxSysExtControllerConfigID = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtControllerConfigID.setStatus('current') wlsxSysExtIsMMSConfigUpdateEnabled = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 24), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wlsxSysExtIsMMSConfigUpdateEnabled.setStatus('current') wlsxSysExtSwitchLastReload = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 25), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchLastReload.setStatus('current') wlsxSysExtLastStatsReset = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 1, 26), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtLastStatsReset.setStatus('current') wlsxSysExtUserTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtUserTableGenNumber.setStatus('current') wlsxSysExtAPBssidTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtAPBssidTableGenNumber.setStatus('current') wlsxSysExtAPRadioTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtAPRadioTableGenNumber.setStatus('current') wlsxSysExtAPTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtAPTableGenNumber.setStatus('current') wlsxSysExtSwitchListTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtSwitchListTableGenNumber.setStatus('current') wlsxSysExtPortTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtPortTableGenNumber.setStatus('current') wlsxSysExtVlanTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtVlanTableGenNumber.setStatus('current') wlsxSysExtVlanInterfaceTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtVlanInterfaceTableGenNumber.setStatus('current') wlsxSysExtLicenseTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtLicenseTableGenNumber.setStatus('current') wlsxSysExtMonAPTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtMonAPTableGenNumber.setStatus('current') wlsxSysExtMonStationTableGenNumber = MibScalar((1, 3, 6, 1, 4, 1, 14823, 2, 2, 1, 2, 2, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wlsxSysExtMonStationTableGenNumber.setStatus('current') mibBuilder.exportSymbols("WLSX-SYSTEMEXT-MIB", sysExtCardStatus=sysExtCardStatus, wlsxSysExtStorageTable=wlsxSysExtStorageTable, wlsxSysExtPowerSupplyEntry=wlsxSysExtPowerSupplyEntry, wlsxSysExtAPRadioTableGenNumber=wlsxSysExtAPRadioTableGenNumber, sysExtCardSerialNo=sysExtCardSerialNo, sysExtMemoryIndex=sysExtMemoryIndex, wlsxSysExtSwitchBaseMacaddress=wlsxSysExtSwitchBaseMacaddress, sysExtProcessorID=sysExtProcessorID, sysExtCardNumOfGigPorts=sysExtCardNumOfGigPorts, sysExtCardManufacturingDate=sysExtCardManufacturingDate, wlsxSysExtControllerConfigID=wlsxSysExtControllerConfigID, wlsxSysExtIsMMSConfigUpdateEnabled=wlsxSysExtIsMMSConfigUpdateEnabled, wlsxSysExtMonStationTableGenNumber=wlsxSysExtMonStationTableGenNumber, wlsxSystemExtTableGenNumberGroup=wlsxSystemExtTableGenNumberGroup, wlsxSystemExtMIB=wlsxSystemExtMIB, wlsxSysExtFanTable=wlsxSysExtFanTable, wlsxSysExtCardTable=wlsxSysExtCardTable, wlsxSysExtMMSCompatLevel=wlsxSysExtMMSCompatLevel, sysExtLicenseFlags=sysExtLicenseFlags, wlsxSystemExtGroup=wlsxSystemExtGroup, sysExtSwitchLocation=sysExtSwitchLocation, wlsxSysExtSwitchListTable=wlsxSysExtSwitchListTable, sysExtCardNumOfFastethernetPorts=sysExtCardNumOfFastethernetPorts, wlsxSysExtHostname=wlsxSysExtHostname, sysExtCardNumOfPorts=sysExtCardNumOfPorts, sysExtSwitchName=sysExtSwitchName, sysExtSwitchRole=sysExtSwitchRole, wlsxSysExtSwitchLastReload=wlsxSysExtSwitchLastReload, sysExtLicenseKey=sysExtLicenseKey, wlsxSysExtFanTraySerialNumber=wlsxSysExtFanTraySerialNumber, wlsxSysExtModelName=wlsxSysExtModelName, PYSNMP_MODULE_ID=wlsxSystemExtMIB, sysExtStorageName=sysExtStorageName, wlsxSysExtAPTableGenNumber=wlsxSysExtAPTableGenNumber, wlsxSysExtSwitchListEntry=wlsxSysExtSwitchListEntry, sysExtStorageType=sysExtStorageType, wlsxSysExtFanEntry=wlsxSysExtFanEntry, wlsxSysExtLicenseEntry=wlsxSysExtLicenseEntry, sysExtSwitchStatus=sysExtSwitchStatus, wlsxSysExtUserTableGenNumber=wlsxSysExtUserTableGenNumber, sysExtStorageSize=sysExtStorageSize, sysExtCardFpgaRevision=sysExtCardFpgaRevision, sysExtCardSlot=sysExtCardSlot, sysExtFanStatus=sysExtFanStatus, sysExtCardType=sysExtCardType, wlsxSysExtMMSConfigID=wlsxSysExtMMSConfigID, sysExtLicenseExpires=sysExtLicenseExpires, wlsxSysExtVlanInterfaceTableGenNumber=wlsxSysExtVlanInterfaceTableGenNumber, wlsxSysExtSwitchDate=wlsxSysExtSwitchDate, wlsxSysExtLastStatsReset=wlsxSysExtLastStatsReset, sysExtMemorySize=sysExtMemorySize, wlsxSysExtSwitchIp=wlsxSysExtSwitchIp, sysExtMemoryUsed=sysExtMemoryUsed, wlsxSysExtSwitchListTableGenNumber=wlsxSysExtSwitchListTableGenNumber, wlsxSysExtVlanTableGenNumber=wlsxSysExtVlanTableGenNumber, sysExtSwitchIPAddress=sysExtSwitchIPAddress, sysExtProcessorLoad=sysExtProcessorLoad, sysExtStorageIndex=sysExtStorageIndex, wlsxSysExtFanTrayAssemblyNumber=wlsxSysExtFanTrayAssemblyNumber, sysExtPowerSupplyIndex=sysExtPowerSupplyIndex, wlsxSysExtProcessorEntry=wlsxSysExtProcessorEntry, sysExtProcessorDescr=sysExtProcessorDescr, wlsxSysExtMemoryTable=wlsxSysExtMemoryTable, sysExtLicenseIndex=sysExtLicenseIndex, wlsxSysExtStorageEntry=wlsxSysExtStorageEntry, wlsxSysExtProcessorTable=wlsxSysExtProcessorTable, wlsxSysExtSwitchLicenseTable=wlsxSysExtSwitchLicenseTable, sysExtCardSwitchChip=sysExtCardSwitchChip, wlsxSysExtLicenseSerialNumber=wlsxSysExtLicenseSerialNumber, sysExtLicenseService=sysExtLicenseService, wlsxSysExtPowerSupplyTable=wlsxSysExtPowerSupplyTable, wlsxSysExtInternalTemparature=wlsxSysExtInternalTemparature, sysExtSwitchSWVersion=sysExtSwitchSWVersion, sysExtLicenseInstalled=sysExtLicenseInstalled, sysExtFanIndex=sysExtFanIndex, wlsxSysExtMonAPTableGenNumber=wlsxSysExtMonAPTableGenNumber, wlsxSysExtAPBssidTableGenNumber=wlsxSysExtAPBssidTableGenNumber, wlsxSysExtPortTableGenNumber=wlsxSysExtPortTableGenNumber, wlsxSysExtSwitchMasterIp=wlsxSysExtSwitchMasterIp, wlsxSysExtMemoryEntry=wlsxSysExtMemoryEntry, sysExtMemoryFree=sysExtMemoryFree, wlsxSysExtSwitchRole=wlsxSysExtSwitchRole, sysExtCardUserSlot=sysExtCardUserSlot, wlsxSysExtSwitchLicenseCount=wlsxSysExtSwitchLicenseCount, wlsxSysExtCardEntry=wlsxSysExtCardEntry, sysExtSwitchSerNo=sysExtSwitchSerNo, wlsxSysExtLicenseTableGenNumber=wlsxSysExtLicenseTableGenNumber, sysExtCardHwRevision=sysExtCardHwRevision, sysExtCardAssemblyNo=sysExtCardAssemblyNo, sysExtPowerSupplyStatus=sysExtPowerSupplyStatus, sysExtStorageUsed=sysExtStorageUsed)
with open('input', 'r') as f: lengths = [ord(x) for x in f.read()] + [17, 31, 73, 47, 23] inp = [x for x in range(0, 256)] curr_position = 0 skip_size = 0 for i in range(64): for length in lengths: start_sublist = [] if curr_position + length >= len(inp): start_sublist = inp[0:curr_position + length - len(inp)] reversed_sublist = list( reversed(inp[curr_position:curr_position + length] + start_sublist)) start_position = curr_position for i in range(start_position, start_position + len(reversed_sublist)): inp[i % len(inp)] = reversed_sublist[i - start_position] curr_position = (curr_position + length + skip_size) % len(inp) skip_size += 1 result = [] for i in range(16): start_index = i * 16 end_index = start_index + 16 sub_list = inp[start_index:end_index] res = 0 for i in range(0, 16): res ^= sub_list[i] result.append(res) print("result", "".join([x[2:] for x in map(hex, result)]))
products = {'gucci boots': 10000, 'channel': 20000, 'adidas boots': 8000, 'nike sport-suit': 23000, 'gucci sport-suit': 24000, 'Lonsdale suit': 8000, 'nike boots': 9000, 'dior chest': 10000, 'raben waist': 15000, 'wedding dress': 500000} user = 'user' password = 'user123456' def check_login(login, password): if len(login) < 20 and user == login and password == password and not password.isalpha() and not password.isdigit(): print('Vy voshli v sistemu!') else: print('Nepravelnye dannye!') check_login('user', 'user123456') def counter(money, price): if money > price: money = money - price return money else: return 'Ne dostatochno sredst!' def cart(): cart_list = [] for i in range(3): product = input('Vvedite nazvanie tovara: ') if product in products: cart_list.append(product) return cart_list test_cart = cart() def wallet(money): test_cart1 = [] for line in test_cart: if money >= products[line]: money = counter(money, products[line]) test_cart1.append(line) return {'4to ya hotel kupit:':test_cart1, 'Konechniy vybor:': test_cart, 'Sdacha:':money} print(wallet(50000))
def l1_norm(lst): """ Calculates the l1 norm of a list of numbers """ return sum([abs(x) for x in lst]) def l2_norm(lst): """ Calculates the l2 norm of a list of numbers """ return sum([x*x for x in lst]) def linf_norm(lst): """ Calculates the l_infinity norm of a list of numbers """ return max([abs(x) for x in lst])
''' Textos podem conter mensagens ocultas. Neste problema a mensagem oculta em um texto é composto pelas primeiras letras de cada palavra do texto, na ordem em que aparecem. É dado um texto composto apenas por letras minúsculas ou espaços. Pode haver mais de um espaço entre as palavras. O texto pode iniciar ou terminar em espaços, ou mesmo conter somente espaços. Entrada A entrada contém vários casos de testes. A primeira linha de entrada contém um inteiro N que indica a quantidade de casos de teste que vem a seguir. Cada caso de teste consiste de uma única linha contendo de um a 50 caracteres, formado por letras minúsculas (‘a’-‘z’) ou espaços (‘ ’). Atenção para possíveis espaços no início ou no final do texto! Nota: No exemplo de entrada os espaços foram substituídos por pequenos pontos (‘·’) para facilitar o entendimento dos exemplos. Saída Para cada caso de teste imprima a mensagem oculta no texto de entrada. ''' N = int(input()) for i in range(N): final_text = '' text = str(input()).split() for t in text: final_text += t[0] print(final_text)
#!/usr/bin/env python __author__ = "bt3" class Queue(object): def __init__(self): self.in_stack = [] self.out_stack = [] def _transfer(self): while self.in_stack: self.out_stack.append(self.in_stack.pop()) def enqueue(self, item): return self.in_stack.append(item) def dequeue(self): if not self.out_stack: self._transfer() if self.out_stack: return self.out_stack.pop() else: return "Queue empty!" def size(self): return len(self.in_stack) + len(self.out_stack) def peek(self): if not self.out_stack: self._transfer() if self.out_stack: return self.out_stack[-1] else: return "Queue empty!" def __repr__(self): if not self.out_stack: self._transfer() if self.out_stack: return '{}'.format(self.out_stack) else: return "Queue empty!" def isEmpty(self): return not (bool(self.in_stack) or bool(self.out_stack)) if __name__ == '__main__': queue = Queue() print("Is the queue empty? ", queue.isEmpty()) print("Adding 0 to 10 in the queue...") for i in range(10): queue.enqueue(i) print("Queue size: ", queue.size()) print("Queue peek : ", queue.peek()) print("Dequeue...", queue.dequeue()) print("Queue peek: ", queue.peek()) print("Is the queue empty? ", queue.isEmpty()) print("Printing the queue...") print(queue)
print("----------------------------------------------") print(" Even/Odd Number Identifier") print("----------------------------------------------") play_again = 'Y' while play_again == 'Y': user_num = input("Enter any whole number: ") user_int = int(user_num) if user_int % 2 == 0: print("The number entered is EVEN!") print() print() else: print("The number entered is ODD!") print() print() play_again = input("Do you want to try again? (Y/N)") if play_again == 'N': print("Thank you for playing!") print() print()
# 1. Exemplo de um trecho de codigo sem o uso da interupcao de repeticoes. num = soma = 0 while num != 90: num = int(input("Digite um numero: ")) soma += num soma -= 90 print(f"A soma dos valores e' igual a {soma}.") print("FIM!") # 2. Com a interupcao de repeticoes while. n = s = 0 while True: n = int(input("Digite um numero: ")) if n == 90: break s += n print(f"A soma dos valores e' igual a: {s}.") print("FIM!") # NB: A forma corecta de executar essa operacao e' usando o formato de codigo n.2
# coding=utf-8 b1 = bytes() print(b1) b2 = b'hello' print(b2) b3 = bytes('我爱Python', encoding='utf-8') print(b3) st3 = b3.decode("utf-8") print(st3)
M_PI = 3.14159265358979323846 EPSILON = 1.0e-38 MAX_TRANSIENTS = 4 BASE_N = 44 # The base number of segments of tract.
#!/usr/bin/env python3 # Create a function named remove_middle which has three parameters named # lst, start, and end. The function should return a list where all elements # in lst with an index between start and end(inclusive) have been removed. def remove_middle(lst, start, end): return lst[:start] + lst[end+1:] print(remove_middle([9, 7, 3, 10, 2, 4], 1, 2))
user_input = input("Type a two digit number: ") first_digit = user_input[0] second_digit = user_input[1] print(int(first_digit) + int(second_digit))
__program__ = "config" __version__ = "0.1.0" __author__ = "Darcy Jones" __date__ = "30 December 2014" __author_email__ = "[email protected]" __license__ = """ ############################################################################## Copyright (C) 2014 Darcy Jones This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ############################################################################## """ DEBUG = False WTF_CSRF_ENABLED = False SECRET_KEY = 'development key'
""" Python makes performing file I/O simple. Take a look at how to read and write to files here: https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files """ # Open up the "foo.txt" file (which already exists) for reading # Print all the contents of the file, then close the file # YOUR CODE HERE # Open up a file called "bar.txt" (which doesn't exist yet) for # writing. Write three lines of arbitrary content to that file, # then close the file. Open up "bar.txt" and inspect it to make # sure that it contains what you expect it to contain # YOUR CODE HERE
""" List of variables common to every workflow, that can change the result in multiple workflows """ # Table Names COMPANY_TABLE = "companies" COMPANY_USERS_TABLE = "company_users" SURVEYS_REPLIES_TABLE = "survey_replies" COMPANIES_TABLE = 'companies' SURVEYS_QUESTIONS_TABLE = 'survey_questions' SURVEYS_ITERATIONS_TABLE = "survey_iterations" TOPIC_ENTITIES_TABLE = "company_topic_entities" SURVEY_ITERATION_ENTITIES_TABLE = "survey_iteration_entities" SURVEY_ENTITIES_TABLE_SURVEY_ITERATION_ID = "survey_iteration_id" ENTITIES_TABLE_COMPANY_ID = "company_id" TOPIC_ENTITIES_TABLE_COMPANY_TOPIC_ID = "company_topic_id" ENTITIES_TABLE_YEAR = "year" ENTITIES_TABLE_WEEK = "week" TOPIC_ENTITIES_TABLE_CATEGORIES = "categories" TOPIC_ENTITIES_TABLE_TAGS = "tags" SURVEYS_TABLE = "surveys" QUESTIONS_TABLE = "questions" DIMENSIONS_TABLE = "dimensions" TOPICS_TABLE = "company_topics" TOPIC_COMMENTS_TABLE = "company_topic_comments" COMPANY_FF_TABLE = "company_feature_flags" COMPANY_WEEK_TABLE = "company_week" # Table Names for Active Companies ACTIVE_COMPANIES_TABLE = "weekly_active_companies" # Column names for mood_release COMPANIES_COLUMN_NAMES = ["id", "name", "domain", "created_at", 'language', 'is_enabled', 'deleted_at'] COMPANY_USERS_COLUMN_NAMES = ["id", "company_id", "user_id", "is_general_manager", "is_admin", "roles", "created_at", "deleted_at", "is_enabled"] SURVEYS_REPLIES_COLUMN_NAMES = ["id", "survey_question_id", "user_id", "rating", "created_at", "user_timezone", "system_timezone", "survey_iteration_token_id", "comment", "comment_deleted_at"] TOPICS_COLUMN_NAMES = ["topic_id", "company_id", 'is_archived', "topic_content", "created_at", "topic_comment"] ACTIVE_COMPANIES_COLUMNS = ["company_ids"] SURVEY_REPLIES_DIMENSIONS_QUESTIONS_COLUMN_NAMES = ["survey_reply_id", 'user_id', 'rating', 'comment_created_at', 'comment', 'survey_iteration_id', 'survey_iteration_created_at', 'iteration_year', 'iteration_week', 'company_id', 'question_id', 'question_description', "dimension_id", 'question_week', 'dimension_description'] # Tables Names JOBS_ACTIVE_COMPANIES_TABLE = "logs_active_company" JOBS_ACTIVE_COMPANIES_DETAILS_TABLE = "logs_detail_active_company" # Columns Names for validation_logs JOBS_ACTIVE_COMPANIES_COLUMNS_NAMES = ["ID", "date", "survey_year", "survey_week", "percent_accuracy", "error_msg"] JOBS_ACTIVE_COMPANIES_DETAILS_COLUMNS_NAMES = ["ID", "log_id", "company_id", "label_company_python", "label_company_php"] TEST_COMPANIES = ["guerrilla.net", "guerrillamail.net", "mood0253.com", "grr.la", "sharklasers.com"] # Oliver Classifiers Algorithms ############################################################## # Variable to Connect to CSV files PATH_COMPANY = "/data_connection/companies.csv" PATH_USER = "/data_connection/company_users" PATH_SURVEY_MOOD = "/data_connection/survey_moods.csv" # Oliver Classifiers Time Series Algorithms ########################################################################## TIME_TRIAL = 10 DELAY_WEEKS = 2
def steps(number): ''' The Collatz Conjecture or 3x+1 problem. Given a number n, return the number of steps required to reach 1. :param number: :return: ''' # The Collatz Conjecture is only concerned with strictly positive integers, # so your solution should raise a ValueError with a meaningful # message if given 0 or a negative integer. if number <= 0: raise ValueError('.+') steps_total = 0 while number != 1: # If n is even, divide n by 2 to get n / 2. if number % 2 == 0: number = number / 2 else: # If n is odd, multiply n by 3 and add 1 to get 3n + 1. number = number * 3 + 1 steps_total += 1 return steps_total
class Word: def __init__(self): self.hanzi = '' self.pinyin = '' self.english = '' self.strokes = [] self.mnemonics = '' self.audio = '' self.notes = '' def __str__(self): format_str = '{} ({}) - {}\n' return format_str.format(self.hanzi, self.pinyin, self.english) def write_to_file(self, filename_out): '''Append the word to a tsv file.''' fields = (self.hanzi, self.pinyin, self.english, ''.join(self.strokes), self.audio) with open(filename_out, 'a') as fout: line = '\t'.join(fields) fout.write(line) fout.write('\n')
######################################## # QUESTION ######################################## # The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate. # Examples # "din" => "(((" # "recede" => "()()()" # "Success" => ")())())" # "(( @" => "))((" ################################### # SOLUTION ################################### def duplicate_encode(word): x = list(word.lower()) u = [] for k in x: if x.count(k) == 1: u.append("(") elif x.count(k) > 1: u.append(")") j = "" for k in u: j += k return j
x = "zabavan" print("Python je " + x) #string concatenation primjer: x_conc = "Python je " y_conc = "zabavan" spojeno = x_conc + y_conc #U ovom slučaju varijablom 'spojeno' spajamo x_conc i y_conc print(spojeno)
try: None < 0 def NoneAndDictComparable(v): return v except TypeError: # comparator to allow comparisons against None and dict # comparisons (these were allowed in Python 2, but aren't allowed # in Python 3 any more) class NoneAndDictComparable(object): def __init__(self, value): self.value = value def __cmp__(self, other): if not isinstance(other, self.__class__): raise TypeError('not comparable') if self.value == other.value: return 0 elif self.value is None: return -1 elif other.value is None: return 1 elif type(self.value) == tuple and type(other.value) == tuple: for lhs, rhs in zip(self.value, other.value): lhsCmp = NoneAndDictComparable(lhs) rhsCmp = NoneAndDictComparable(rhs) result = lhsCmp.__cmp__(rhsCmp) if result != 0: return result return len(self.value) - len(other.value) elif type(self.value) == dict and type(other.value) == dict: diff = len(self.value) - len(other.value) if diff == 0: lhsItems = tuple(sorted(self.value.items(), key=NoneAndDictComparable)) rhsItems = tuple(sorted(other.value.items(), key=NoneAndDictComparable)) return -1 if NoneAndDictComparable(lhsItems) < NoneAndDictComparable(rhsItems) else 1 else: return diff elif self.value < other.value: return -1 else: return 1 def __eq__(self, other): return self.__cmp__(other) == 0 def __ne__(self, other): return self.__cmp__(other) != 0 def __lt__(self, other): return self.__cmp__(other) < 0 def __le__(self, other): return self.__cmp__(other) <= 0 def __ge__(self, other): return self.__cmp__(other) >= 0 def __gt__(self, other): return self.__cmp__(other) > 0 def _test(): Comp = NoneAndDictComparable assert Comp(None) < Comp(0) assert Comp(None) < Comp('') assert Comp(None) < Comp({}) assert Comp((0, None)) < Comp((0, 0)) assert not Comp(0) < Comp(None) assert not Comp('') < Comp(None) assert not Comp({}) < Comp(None) assert not Comp((0, 0)) < Comp((0, None)) assert Comp((0, 0)) < Comp((0, 0, None)) assert Comp((0, None, None)) < Comp((0, 0, 0)) assert Comp(0) < Comp(1) assert Comp(1) > Comp(0) assert not Comp(1) < Comp(0) assert not Comp(0) > Comp(0) assert Comp({0: None}) < Comp({0: 0}) assert Comp({0: 0}) < Comp({0: 1}) assert Comp({0: 0}) == Comp({0: 0}) assert Comp({0: 0}) != Comp({0: 1}) assert Comp({0: 0, 1: 1}) > Comp({0: 1}) assert Comp({0: 0, 1: 1}) < Comp({0: 0, 2: 2}) if __name__ == '__main__': _test()
"""Function class.""" def hello(name='persona', lastname='exposito'): """Function that return 'Hello World'. name: string, lastname: string, return:string """ if name != 'persona': return f'¿Como estas {name}?' return f'Hola {name} {lastname}' print(hello(lastname=5, name=True))
# pylint: disable=W0613, C0111, C0103, C0301 """ The software package. version: 4.1 ExtronLibraray version: 3.1r5 ControlScript version: 3.1.8 GlobalScripter version: 2.1.0.116 Release date: 13.11.2018 Author: Roni Starc ([email protected]) ChangeLog: v2.0 - Fixed some mistakes, updated GS v2.8.r3, added description texts for the entire library v3.0 - Updated to ControlScript 2.9.25 with FW 3.00.0000-b022 v4.0 : - updated/fixed layout of ExtronLibrary, ControlScript and GlobalScripter versions - Updated to ExtronLibrary 3.1r5 with FW v4.1 - Fix in other file, increased version number to preserve consistency Note: This module is work in progress as it is an adapted version of the standard XML module integrated into python Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ exml = {}
class Transect: def __init__(self, name="Transect", files=[]): self.name = name self.files = files @property def numFiles(self): return len(self.files) @property def firstLastText(self): first = self.files[0] last = self.files[-1] return f"{first.name} . . . {last.name}" def addFile(self, fp): self.files.append(fp) def clearFiles(self): self.files.clear()
def fib(n): if n == 0 or n == 1: return 1 else: answer = fib(n-1) + fib(n-2) return answer def memoise(f): memo = {} def g(n): if n in memo: return memo[n] else: answer = f(n) memo[n] = answer return answer return g fib = memoise(fib)
def get_start_button(user_id): _hero = db.get_hero(user_id) set_hand(user_id, start_game_hand) button = [['👤Герой','🏕B приключeниe'],['🏛Город'],['⚙️Профиль', '👥Гильдия']] return button def start_game(user_id): text = get_hero(user_id) button = get_start_button(user_id) send_message(user_id, text, button) def start_game_hand(user_id, message): _hero = db.get_hero(user_id) if message == '👤Герой': bot_hero(user_id) return elif message == '👥Гильдия': guild_info(user_id) return elif message == '🏕B приключeниe': adventure().choice(user_id) return elif message == '🏛Город': bot_city(user_id) return elif message == '⚙️Профиль': bot_setting(user_id) return else : start_game(user_id) return
f = open('input.txt') time = int(f.readline()[:-1]) busses = [[int(bus), i] for i, bus in enumerate(f.readline()[:-1].split(',')) if bus != 'x'] product = 1 for bus in busses: product *= bus[0] res = 0 for bus in busses: l = product / bus[0] % bus[0] k = 1 tmp = l while l % bus[0] != 1: k += 1 l = tmp * k res += (bus[0] - bus[1]) * (product / bus[0]) * k print(res % product)
filepath = '/Users/royce/Dropbox/Documents/Memorize/web/blank.txt' with open(filepath, 'r') as f: card_count = 0 card = "" do_skip = False template = """@Tags: {} {} {} """ for line in f: in_html5 = 'Not supported in HTML5' not in line if line.strip(' ') != "\n": if not in_html5: do_skip = True continue if do_skip or 'Property\tDescription' in line: do_skip = False continue if line.count("\t") == 0: tag = line is_table_header = True else: array = [val.strip() for val in line.split("\t")] card = template.format(tag.strip('\n').strip(), array[0], array[1].strip()) print(card) card_count += 1 print("Total cards: {}".format(card_count))
# # PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:18:07 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) # routingIND1Ipx, = mibBuilder.importSymbols("ALCATEL-IND1-BASE", "routingIND1Ipx") ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") ModuleIdentity, Counter64, Gauge32, Bits, ObjectIdentity, MibIdentifier, iso, NotificationType, TimeTicks, Integer32, IpAddress, Counter32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Counter64", "Gauge32", "Bits", "ObjectIdentity", "MibIdentifier", "iso", "NotificationType", "TimeTicks", "Integer32", "IpAddress", "Counter32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") DisplayString, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "RowStatus") alcatelIND1IPXMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1)) alcatelIND1IPXMIB.setRevisions(('2007-04-03 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: alcatelIND1IPXMIB.setRevisionsDescriptions(('The latest version of this MIB Module.',)) if mibBuilder.loadTexts: alcatelIND1IPXMIB.setLastUpdated('200704030000Z') if mibBuilder.loadTexts: alcatelIND1IPXMIB.setOrganization('Alcatel-Lucent') if mibBuilder.loadTexts: alcatelIND1IPXMIB.setContactInfo('Please consult with Customer Service to ensure the most appropriate version of this document is used with the products in question: Alcatel-Lucent, Enterprise Solutions Division (Formerly Alcatel Internetworking, Incorporated) 26801 West Agoura Road Agoura Hills, CA 91301-5122 United States Of America Telephone: North America +1 800 995 2696 Latin America +1 877 919 9526 Europe +31 23 556 0100 Asia +65 394 7933 All Other +1 818 878 4507 Electronic Mail: [email protected] World Wide Web: http://alcatel-lucent.com/wps/portal/enterprise File Transfer Protocol: ftp://ftp.ind.alcatel.com/pub/products/mibs') if mibBuilder.loadTexts: alcatelIND1IPXMIB.setDescription('This module describes an authoritative enterprise-specific Simple Network Management Protocol (SNMP) Management Information Base (MIB): This is the proprietary MIB for the IPX routing sub-sytem. The right to make changes in specification and other information contained in this document without prior notice is reserved. No liability shall be assumed for any incidental, indirect, special, or consequential damages whatsoever arising from or related to this document or the information contained herein. Vendors, end-users, and other interested parties are granted non-exclusive license to use this specification in connection with management of the products for which it is intended to be used. Copyright (C) 1995-2007 Alcatel-Lucent ALL RIGHTS RESERVED WORLDWIDE') alcatelIND1IPXMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1)) class NetNumber(TextualConvention, OctetString): description = 'IPX network number. It is a 32-bit value divided into 4 octets.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(4, 4) fixedLength = 4 class HostAddress(TextualConvention, OctetString): description = 'IPX host MAC address. It is a group of the 6 octets from the MAC address.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6) fixedLength = 6 alaIpxRoutingGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1)) if mibBuilder.loadTexts: alaIpxRoutingGroup.setStatus('current') if mibBuilder.loadTexts: alaIpxRoutingGroup.setDescription('IPX routing information.') alaIpxFilterGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2)) if mibBuilder.loadTexts: alaIpxFilterGroup.setStatus('current') if mibBuilder.loadTexts: alaIpxFilterGroup.setDescription('IPX filtering information.') alaIpxTimerGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3)) if mibBuilder.loadTexts: alaIpxTimerGroup.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerGroup.setDescription('IPX timer information.') alaIpxStaticRouteTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1), ) if mibBuilder.loadTexts: alaIpxStaticRouteTable.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteTable.setDescription('The Static Routes table is used and add entries and extract information from the static routes configured in the system.') alaIpxStaticRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteNetNum")) if mibBuilder.loadTexts: alaIpxStaticRouteEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteEntry.setDescription('Each entry corresponds to one static route.') alaIpxStaticRouteNetNum = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 1), NetNumber().clone(hexValue="00000000")) if mibBuilder.loadTexts: alaIpxStaticRouteNetNum.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteNetNum.setDescription("The IPX network number of the route's destination.") alaIpxStaticRouteNextHopNet = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 2), NetNumber().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxStaticRouteNextHopNet.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteNextHopNet.setDescription('The IPX network number of the router used to reach the first hop in the static route.') alaIpxStaticRouteNextHopNode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 3), HostAddress().clone(hexValue="000000000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxStaticRouteNextHopNode.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteNextHopNode.setDescription('The IPX node number of the router used to reach the first hop in the static route.') alaIpxStaticRouteTicks = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxStaticRouteTicks.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteTicks.setDescription("The delay, in ticks, to reach the route's destination.") alaIpxStaticRouteHopCount = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16))).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxStaticRouteHopCount.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteHopCount.setDescription('The number of hops necessary to reach the destination.') alaIpxStaticRouteRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 1, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxStaticRouteRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxStaticRouteRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxStaticRouteTable is constrained by the operational state of the corresponding static route. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxDefRouteTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2), ) if mibBuilder.loadTexts: alaIpxDefRouteTable.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteTable.setDescription('The default route table contains information about the destinations to which all packets are sent when the destination network is not known.') alaIpxDefRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxDefRouteVlanId")) if mibBuilder.loadTexts: alaIpxDefRouteEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteEntry.setDescription('One table entry per switch for default route.') alaIpxDefRouteVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxDefRouteVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteVlanId.setDescription('The VlanId for this filter. If VlanId equals 0, the filter is applied globally.') alaIpxDefRouteNet = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2, 1, 2), NetNumber().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxDefRouteNet.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteNet.setDescription('The IPX network number of the router used to reach the first hop in the default route.') alaIpxDefRouteNode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2, 1, 3), HostAddress().clone(hexValue="000000000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxDefRouteNode.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteNode.setDescription('The IPX node number of the router used to reach the first hop in the default route.') alaIpxDefRouteRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxDefRouteRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxDefRouteRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxDefRouteTable is constrained by the operational state of the corresponding default route entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxExtMsgTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 3), ) if mibBuilder.loadTexts: alaIpxExtMsgTable.setStatus('current') if mibBuilder.loadTexts: alaIpxExtMsgTable.setDescription('The extended RIP and SAP messages table contains information about which vlans use extended RIP and SAP packets.') alaIpxExtMsgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 3, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxExtMsgVlanId")) if mibBuilder.loadTexts: alaIpxExtMsgEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxExtMsgEntry.setDescription('One table entry per Vlan.') alaIpxExtMsgVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxExtMsgVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxExtMsgVlanId.setDescription('The VlanId for this filter. If VlanId equals 0, the filter is applied globally.') alaIpxExtMsgMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxExtMsgMode.setStatus('current') if mibBuilder.loadTexts: alaIpxExtMsgMode.setDescription('Indicates whether extended RIP/SAP packets are sent and received.') alaIpxExtMsgRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 3, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxExtMsgRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxExtMsgRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxExtMsgTable is constrained by the operational state of the corresponding watchdog entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxFlush = MibScalar((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("rip", 1), ("sap", 2), ("both", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: alaIpxFlush.setStatus('current') if mibBuilder.loadTexts: alaIpxFlush.setDescription('Flushes the routing and the SAP tables. The tables will then be rebuilt from the broadcast messages received from the networks. Reading this variable is undefined') alaIpxRipSapFilterTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1), ) if mibBuilder.loadTexts: alaIpxRipSapFilterTable.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterTable.setDescription('The IPX Rip/Sap Filter Table contains information about all filters that have been defined.') alaIpxRipSapFilterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterVlanId"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterType"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterNet"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterNetMask"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterNode"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterNodeMask"), (0, "ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterSvcType")) if mibBuilder.loadTexts: alaIpxRipSapFilterEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterEntry.setDescription('Each entry corresponds to one filter.') alaIpxRipSapFilterVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxRipSapFilterVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterVlanId.setDescription('The VlanId for this filter. If VlanId equals 0, the filter is applied globally.') alaIpxRipSapFilterType = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("sapOutput", 1), ("sapInput", 2), ("gnsOutput", 3), ("ripOutput", 4), ("ripInput", 5))).clone(1)) if mibBuilder.loadTexts: alaIpxRipSapFilterType.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterType.setDescription('The type of filter. ') alaIpxRipSapFilterNet = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 3), NetNumber().clone(hexValue="00000000")) if mibBuilder.loadTexts: alaIpxRipSapFilterNet.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterNet.setDescription("The IPX Network Address to filter. A network address of all 0 's is used to denote All Networks.") alaIpxRipSapFilterNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 4), NetNumber().clone(hexValue="ffffffff")) if mibBuilder.loadTexts: alaIpxRipSapFilterNetMask.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterNetMask.setDescription('The IPX Network Mask to be used.') alaIpxRipSapFilterNode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 5), HostAddress().clone(hexValue="000000000000")) if mibBuilder.loadTexts: alaIpxRipSapFilterNode.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterNode.setDescription("The IPX node address to filter. A node address of all 0 's is used to denote All Nodes.") alaIpxRipSapFilterNodeMask = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 6), HostAddress().clone(hexValue="ffffffffffff")) if mibBuilder.loadTexts: alaIpxRipSapFilterNodeMask.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterNodeMask.setDescription('The IPX node address mask to be used.') alaIpxRipSapFilterSvcType = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(65535)) if mibBuilder.loadTexts: alaIpxRipSapFilterSvcType.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterSvcType.setDescription('The SAP service type on which to filter. The SAP service types are defined by Novell.A value of ALL(65535) indicates that all services will be filtered.') alaIpxRipSapFilterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("allow", 1), ("block", 2))).clone('allow')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxRipSapFilterMode.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterMode.setDescription('The action defined by this filter. block (1) means packets matching this filter will be blocked, and allow(0) means that packets matching this filter will be allowed.') alaIpxRipSapFilterRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 1, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxRipSapFilterRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxRipSapFilterRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxRipSapFilterTable is constrained by the operational state of the corresponding filter entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxWatchdogSpoofTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 2), ) if mibBuilder.loadTexts: alaIpxWatchdogSpoofTable.setStatus('current') if mibBuilder.loadTexts: alaIpxWatchdogSpoofTable.setDescription('The IPX Watchdog Spoofing Table contains information about all of the current IPX WAN watchdog spoofing entry statuses.') alaIpxWatchdogSpoofEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 2, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxWatchdogSpoofVlanId")) if mibBuilder.loadTexts: alaIpxWatchdogSpoofEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxWatchdogSpoofEntry.setDescription('Each entry corresponds to one WAN routing service.') alaIpxWatchdogSpoofVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxWatchdogSpoofVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxWatchdogSpoofVlanId.setDescription('The VlanId of the WAN routing service that this entry applies to. If VlanId equals 0, the filter is applied globally to all WAN Vlans.') alaIpxWatchdogSpoofMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxWatchdogSpoofMode.setStatus('current') if mibBuilder.loadTexts: alaIpxWatchdogSpoofMode.setDescription('This controls whether the IPX Watchdog Spoofing is enabled or disabled.When enabled, this routing service will spoof IPX Watchdog packets.When disabled, this routing service will not spoof IPX Watchdog packets.') alaIpxWatchdogSpoofRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 2, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxWatchdogSpoofRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxWatchdogSpoofRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxWatchdogSpoofTable is constrained by the operational state of the corresponding watchdog entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxSerialFilterTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 3), ) if mibBuilder.loadTexts: alaIpxSerialFilterTable.setStatus('current') if mibBuilder.loadTexts: alaIpxSerialFilterTable.setDescription('The IPX Serialization Filtering Table contains information about all of the current IPX WAN serialization filtering entry statuses.') alaIpxSerialFilterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 3, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxSerialFilterVlanId")) if mibBuilder.loadTexts: alaIpxSerialFilterEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxSerialFilterEntry.setDescription('Each entry corresponds to one WAN routing service.') alaIpxSerialFilterVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxSerialFilterVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxSerialFilterVlanId.setDescription('The VlanId of the WAN routing service that this entry applies to. If VlanId equals 0, the filter is applied globally to all WAN Vlans.') alaIpxSerialFilterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxSerialFilterMode.setStatus('current') if mibBuilder.loadTexts: alaIpxSerialFilterMode.setDescription('This controls whether the IPX Serialization Filtering is enabled or disabled.When enabled, this routing service will filter IPX Serialization packets.When disabled, this routing service will not filter IPX Serialization packets.') alaIpxSerialFilterRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 3, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxSerialFilterRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxSerialFilterRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxSerialFilterTable is constrained by the operational state of the corresponding filter entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaSpxKeepaliveSpoofTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 4), ) if mibBuilder.loadTexts: alaSpxKeepaliveSpoofTable.setStatus('current') if mibBuilder.loadTexts: alaSpxKeepaliveSpoofTable.setDescription('The SPX Keepalive Spoofing Table contains information about all of the current IPX WAN SPX spoofing filtering entry statuses.') alaSpxKeepaliveSpoofEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 4, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaSpxKeepaliveSpoofVlanId")) if mibBuilder.loadTexts: alaSpxKeepaliveSpoofEntry.setStatus('current') if mibBuilder.loadTexts: alaSpxKeepaliveSpoofEntry.setDescription('Each entry corresponds to one WAN routing service.') alaSpxKeepaliveSpoofVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaSpxKeepaliveSpoofVlanId.setStatus('current') if mibBuilder.loadTexts: alaSpxKeepaliveSpoofVlanId.setDescription('The VlanId of the WAN routing service that this entry applies to. If VlanId equals 0, the filter is applied globally to all WAN Vlans.') alaSpxKeepaliveSpoofMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaSpxKeepaliveSpoofMode.setStatus('current') if mibBuilder.loadTexts: alaSpxKeepaliveSpoofMode.setDescription('This controls whether the SPX Keepalive Spoofing is enabled or disabled.When enabled, this routing service will spoof SPX Keepalive packets.When disabled, this routing service will not spoof SPX Keepalive packets.') alaSpxKeepaliveSpoofRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 4, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaSpxKeepaliveSpoofRowStatus.setStatus('current') if mibBuilder.loadTexts: alaSpxKeepaliveSpoofRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxKeepaliveSpoofTable is constrained by the operational state of the corresponding keepalive entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxType20Table = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 5), ) if mibBuilder.loadTexts: alaIpxType20Table.setStatus('current') if mibBuilder.loadTexts: alaIpxType20Table.setDescription('The IPX Type 20 Table contains information about all of the current Type 20 filtering entry statuses.') alaIpxType20Entry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 5, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxType20VlanId")) if mibBuilder.loadTexts: alaIpxType20Entry.setStatus('current') if mibBuilder.loadTexts: alaIpxType20Entry.setDescription('Each entry corresponds to one Virtual LAN.') alaIpxType20VlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxType20VlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxType20VlanId.setDescription('The VLAN Id of the routing interface that this entry applies to. If VlanId equals 0, the filter is applied globally.') alaIpxType20Mode = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxType20Mode.setStatus('current') if mibBuilder.loadTexts: alaIpxType20Mode.setDescription('This controls whether IPX Type 20 packet are enabled or disabled.When enabled, this routing interface will forward Type 20 packets.When disabled, the packets will not.') alaIpxType20RowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 2, 5, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxType20RowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxType20RowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxType20Table is constrained by the operational state of the corresponding type 20 entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alaIpxTimerTable = MibTable((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1), ) if mibBuilder.loadTexts: alaIpxTimerTable.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerTable.setDescription('The IPX Timer Table contains information about all of the current Timer adjustments entry statuses.') alaIpxTimerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1, 1), ).setIndexNames((0, "ALCATEL-IND1-IPX-MIB", "alaIpxTimerVlanId")) if mibBuilder.loadTexts: alaIpxTimerEntry.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerEntry.setDescription('Each entry corresponds to one Virtual LAN.') alaIpxTimerVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))) if mibBuilder.loadTexts: alaIpxTimerVlanId.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerVlanId.setDescription('The VLAN Id of the routing interface that this entry applies to. If VlanId equals 0, the filter is applied globally.') alaIpxTimerSap = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 180)).clone(60)).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxTimerSap.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerSap.setDescription('This controls whether IPX SAP packet timer duration.') alaIpxTimerRip = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 180)).clone(60)).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxTimerRip.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerRip.setDescription('This controls whether IPX RIP packet timer duration.') alaIpxTimerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 1, 3, 1, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: alaIpxTimerRowStatus.setStatus('current') if mibBuilder.loadTexts: alaIpxTimerRowStatus.setDescription('The row status variable, used in accordance to installation and removal conventions for conceptual rows. The RowStatus of a currenty active row in the alaIpxTimerTable is constrained by the operational state of the corresponding timer entry. The RowStatus values that are supported are the following: active: This indicates that the row is active and valid. createAndGo: This will create the row and activate it. destroy: This value will deactivate the row and delete from the system.') alcatelIND1IPXMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2)) alcatelIND1IPXMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 1)) alcatelIND1IPXMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2)) alcatelIND1IPXMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 1, 1)).setObjects(("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBStaticRouteGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBDefRouteGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBExtMsgGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBFlushGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBRipSapFilterGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBWatchdogSpoofGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBSerialFilterGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBKeepaliveSpoofGroup"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBType20Group"), ("ALCATEL-IND1-IPX-MIB", "alcatelIND1IPXMIBTimerGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBCompliance = alcatelIND1IPXMIBCompliance.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBCompliance.setDescription('The compliance statement for IPX Subsystem and ALCATEL-IND1-IPX-MIB.') alcatelIND1IPXMIBStaticRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 1)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteNextHopNet"), ("ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteNextHopNode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteTicks"), ("ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteHopCount"), ("ALCATEL-IND1-IPX-MIB", "alaIpxStaticRouteRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBStaticRouteGroup = alcatelIND1IPXMIBStaticRouteGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBStaticRouteGroup.setDescription('A collection of objects from Static Route Table.') alcatelIND1IPXMIBDefRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 2)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxDefRouteNet"), ("ALCATEL-IND1-IPX-MIB", "alaIpxDefRouteNode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxDefRouteRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBDefRouteGroup = alcatelIND1IPXMIBDefRouteGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBDefRouteGroup.setDescription('A collection of objects from Default Route Table.') alcatelIND1IPXMIBExtMsgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 3)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxExtMsgMode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxExtMsgRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBExtMsgGroup = alcatelIND1IPXMIBExtMsgGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBExtMsgGroup.setDescription('A collection of objects from Extended Message Table.') alcatelIND1IPXMIBFlushGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 4)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxFlush")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBFlushGroup = alcatelIND1IPXMIBFlushGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBFlushGroup.setDescription('A collection of objects to flush the RIP and SAP tables.') alcatelIND1IPXMIBRipSapFilterGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 5)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterMode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxRipSapFilterRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBRipSapFilterGroup = alcatelIND1IPXMIBRipSapFilterGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBRipSapFilterGroup.setDescription('A collection of objects from the RIP and SAP Filter tables.') alcatelIND1IPXMIBWatchdogSpoofGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 6)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxWatchdogSpoofMode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxWatchdogSpoofRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBWatchdogSpoofGroup = alcatelIND1IPXMIBWatchdogSpoofGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBWatchdogSpoofGroup.setDescription('A collection of objects from the Watchdog spoof tables.') alcatelIND1IPXMIBSerialFilterGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 7)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxSerialFilterMode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxSerialFilterRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBSerialFilterGroup = alcatelIND1IPXMIBSerialFilterGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBSerialFilterGroup.setDescription('A collection of objects from the Serialization Filter tables.') alcatelIND1IPXMIBKeepaliveSpoofGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 8)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaSpxKeepaliveSpoofMode"), ("ALCATEL-IND1-IPX-MIB", "alaSpxKeepaliveSpoofRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBKeepaliveSpoofGroup = alcatelIND1IPXMIBKeepaliveSpoofGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBKeepaliveSpoofGroup.setDescription('A collection of objects from the Keepalive Spoof tables.') alcatelIND1IPXMIBType20Group = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 9)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxType20Mode"), ("ALCATEL-IND1-IPX-MIB", "alaIpxType20RowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBType20Group = alcatelIND1IPXMIBType20Group.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBType20Group.setDescription('A collection of objects from the Type 20 packet tables.') alcatelIND1IPXMIBTimerGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6486, 801, 1, 2, 1, 10, 8, 1, 2, 2, 10)).setObjects(("ALCATEL-IND1-IPX-MIB", "alaIpxTimerRip"), ("ALCATEL-IND1-IPX-MIB", "alaIpxTimerSap"), ("ALCATEL-IND1-IPX-MIB", "alaIpxTimerRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alcatelIND1IPXMIBTimerGroup = alcatelIND1IPXMIBTimerGroup.setStatus('current') if mibBuilder.loadTexts: alcatelIND1IPXMIBTimerGroup.setDescription('A collection of objects from the RIP and SAP Timer tables.') mibBuilder.exportSymbols("ALCATEL-IND1-IPX-MIB", alaSpxKeepaliveSpoofVlanId=alaSpxKeepaliveSpoofVlanId, alaIpxFlush=alaIpxFlush, alaIpxWatchdogSpoofEntry=alaIpxWatchdogSpoofEntry, alaIpxTimerSap=alaIpxTimerSap, alcatelIND1IPXMIBCompliances=alcatelIND1IPXMIBCompliances, alcatelIND1IPXMIBRipSapFilterGroup=alcatelIND1IPXMIBRipSapFilterGroup, alcatelIND1IPXMIBType20Group=alcatelIND1IPXMIBType20Group, alaIpxWatchdogSpoofMode=alaIpxWatchdogSpoofMode, alaIpxRoutingGroup=alaIpxRoutingGroup, alaIpxTimerVlanId=alaIpxTimerVlanId, alaIpxFilterGroup=alaIpxFilterGroup, alcatelIND1IPXMIBWatchdogSpoofGroup=alcatelIND1IPXMIBWatchdogSpoofGroup, alcatelIND1IPXMIBDefRouteGroup=alcatelIND1IPXMIBDefRouteGroup, alaIpxRipSapFilterType=alaIpxRipSapFilterType, alaIpxSerialFilterTable=alaIpxSerialFilterTable, alaSpxKeepaliveSpoofTable=alaSpxKeepaliveSpoofTable, alaSpxKeepaliveSpoofEntry=alaSpxKeepaliveSpoofEntry, alaIpxType20Mode=alaIpxType20Mode, alaIpxDefRouteNode=alaIpxDefRouteNode, alaIpxType20RowStatus=alaIpxType20RowStatus, alcatelIND1IPXMIB=alcatelIND1IPXMIB, alaIpxRipSapFilterMode=alaIpxRipSapFilterMode, alaIpxStaticRouteEntry=alaIpxStaticRouteEntry, alcatelIND1IPXMIBStaticRouteGroup=alcatelIND1IPXMIBStaticRouteGroup, alaIpxDefRouteVlanId=alaIpxDefRouteVlanId, HostAddress=HostAddress, alaIpxTimerRip=alaIpxTimerRip, alcatelIND1IPXMIBCompliance=alcatelIND1IPXMIBCompliance, alcatelIND1IPXMIBKeepaliveSpoofGroup=alcatelIND1IPXMIBKeepaliveSpoofGroup, alaIpxRipSapFilterNodeMask=alaIpxRipSapFilterNodeMask, alaIpxRipSapFilterEntry=alaIpxRipSapFilterEntry, alaIpxExtMsgRowStatus=alaIpxExtMsgRowStatus, alcatelIND1IPXMIBObjects=alcatelIND1IPXMIBObjects, alaIpxTimerEntry=alaIpxTimerEntry, alaIpxDefRouteTable=alaIpxDefRouteTable, alcatelIND1IPXMIBFlushGroup=alcatelIND1IPXMIBFlushGroup, PYSNMP_MODULE_ID=alcatelIND1IPXMIB, alaIpxSerialFilterVlanId=alaIpxSerialFilterVlanId, alaIpxType20VlanId=alaIpxType20VlanId, alaIpxDefRouteNet=alaIpxDefRouteNet, alcatelIND1IPXMIBTimerGroup=alcatelIND1IPXMIBTimerGroup, alaIpxDefRouteEntry=alaIpxDefRouteEntry, alaIpxSerialFilterMode=alaIpxSerialFilterMode, alaIpxStaticRouteNextHopNet=alaIpxStaticRouteNextHopNet, alaIpxWatchdogSpoofTable=alaIpxWatchdogSpoofTable, alaIpxExtMsgTable=alaIpxExtMsgTable, alaIpxStaticRouteHopCount=alaIpxStaticRouteHopCount, alaIpxStaticRouteNetNum=alaIpxStaticRouteNetNum, alaIpxStaticRouteTicks=alaIpxStaticRouteTicks, alaIpxExtMsgVlanId=alaIpxExtMsgVlanId, alaIpxDefRouteRowStatus=alaIpxDefRouteRowStatus, alaIpxExtMsgMode=alaIpxExtMsgMode, alaIpxType20Entry=alaIpxType20Entry, alaIpxRipSapFilterSvcType=alaIpxRipSapFilterSvcType, alaIpxSerialFilterEntry=alaIpxSerialFilterEntry, alaIpxRipSapFilterVlanId=alaIpxRipSapFilterVlanId, alaIpxRipSapFilterNode=alaIpxRipSapFilterNode, alcatelIND1IPXMIBExtMsgGroup=alcatelIND1IPXMIBExtMsgGroup, alaIpxStaticRouteNextHopNode=alaIpxStaticRouteNextHopNode, alaIpxWatchdogSpoofVlanId=alaIpxWatchdogSpoofVlanId, alcatelIND1IPXMIBGroups=alcatelIND1IPXMIBGroups, alaIpxTimerTable=alaIpxTimerTable, alaIpxStaticRouteRowStatus=alaIpxStaticRouteRowStatus, alaIpxWatchdogSpoofRowStatus=alaIpxWatchdogSpoofRowStatus, alcatelIND1IPXMIBSerialFilterGroup=alcatelIND1IPXMIBSerialFilterGroup, alaIpxRipSapFilterTable=alaIpxRipSapFilterTable, alaIpxRipSapFilterNet=alaIpxRipSapFilterNet, alaIpxStaticRouteTable=alaIpxStaticRouteTable, NetNumber=NetNumber, alaIpxTimerRowStatus=alaIpxTimerRowStatus, alcatelIND1IPXMIBConformance=alcatelIND1IPXMIBConformance, alaIpxExtMsgEntry=alaIpxExtMsgEntry, alaIpxRipSapFilterNetMask=alaIpxRipSapFilterNetMask, alaSpxKeepaliveSpoofRowStatus=alaSpxKeepaliveSpoofRowStatus, alaIpxType20Table=alaIpxType20Table, alaIpxSerialFilterRowStatus=alaIpxSerialFilterRowStatus, alaSpxKeepaliveSpoofMode=alaSpxKeepaliveSpoofMode, alaIpxTimerGroup=alaIpxTimerGroup, alaIpxRipSapFilterRowStatus=alaIpxRipSapFilterRowStatus)
def importEXPH(fdata): ENCHVM = dict() MOTORI = dict() cline = 3 while cline < len(fdata): coduhe = fdata[cline][0:5].strip() nome = fdata[cline][5:18].strip() if fdata[cline][17:43].strip(): # Enchimento de Volume Morto iniench = fdata[cline][17:26].strip() durmeses = fdata[cline][26:36].strip() pct = fdata[cline][36:43].strip() cline = cline + 1 ENCHVM[coduhe] = {'nome': nome, 'iniench': iniench, 'durmeses': durmeses, 'pct': pct} if fdata[cline].strip() == '9999': cline = cline + 1 continue # Motorizacao MOTORI[coduhe] = list() while fdata[cline].strip() != '9999': # loop no bloco maq = None conj = None if len(fdata[cline]) > 61: # Formato novo, entao informa nro de maq e do cnj # if fdata[cline][:4].strip() == '': if '(' in fdata[cline]: portion = fdata[cline].split('(')[1].split(')')[0].split() maq = int(portion[0]) conj = int(portion[1]) else: maq = int(fdata[cline][59:62].strip().replace('(', '')) conj = int(fdata[cline][62:].strip()) dataexp = fdata[cline][33:51].strip() potexp = fdata[cline][51:59].strip() MOTORI[coduhe].append({'data': dataexp, 'pot': potexp, 'nome': nome, 'maq': maq, 'conj': conj}) cline = cline + 1 return ENCHVM, MOTORI
with open('Chal08.txt','r') as f: sum = 0 for i in f.readlines(): i = i.strip().split(' | ') output = i[1].split() for i in output: if len(i) == 2 or len(i) == 4 or len(i) == 3 or len(i) == 7: sum += 1 print(sum)
# -*- coding: utf-8 -*- """ Created on Sun Sep 1 19:39:48 2019 @author: amukher3 """ def remove_smallest(numbers): a=numbers[:] if a ==[]: return a else: a.remove(min(a)) return a
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices: return 0 ans = 0 pre = prices[0] for i in range(1, len(prices)): pre = min(pre, prices[i]) ans = max(prices[i] - pre, ans) return ans
#!/usr/bin/python # This file is used as a global config file while PCBmodE is running. # DO NOT EDIT THIS FILE cfg = {} # PCBmodE configuration brd = {} # board data stl = {} # style data pth = {} # path database msg = {} # message database stk = {} # stackup data
# -*- coding: utf-8 -*- """ [memo.py] Memory Use Illustration Plugin [Author] Abdur-Rahmaan Janhangeer, pythonmembers.club [About] responds to .memo, demo of a basic memory plugin [Commands] >>> .memo add <key> <value> >>> .memo rem <key> >>> .memo fetch <key> """ class Plugin: def __init__(self): pass def run(self, incoming, methods, info, bot_info): try: msgs = info['args'][1:][0].split() if info['command'] == 'PRIVMSG' and msgs[0] == '.memo' and \ msgs[1] == 'add': methods['mem_add']('global', 'VALUES', msgs[2], msgs[3]) if info['command'] == 'PRIVMSG' and msgs[0] == '.memo' and \ msgs[1] == 'rem': methods['mem_rem']('global', 'VALUES', msgs[2]) if info['command'] == 'PRIVMSG' and msgs[0] == '.memo' and \ msgs[1] == 'fetch': try: val = methods['mem_fetch']('global', 'VALUES', msgs[2]) methods['send'](info['address'], val) except KeyError: methods['send'](info['address'], 'value not found') except Exception as e: print('woops plug', e)
# coding: utf-8 a_tuple = ('crazyit', 20, 5.6, 'fkit', -17) # 访问从第2个到倒数第4个(不包含)所有元素 print(a_tuple[1: 3]) # (20, 5.6) # 访问从倒数第3个到倒数第1个(不包含)所有元素 print(a_tuple[-3: -1]) # (5.6, 'fkit') # 访问从第2个到倒数第2个(不包含)所有元素 print(a_tuple[1: -2]) # (20, 5.6) # 访问从倒数第3个到第5个(不包含)所有元素 print(a_tuple[-3: 4]) # (5.6, 'fkit') b_tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9) # 访问从第3个到第9个(不包含)、间隔为2的所有元素 print(b_tuple[2: 8: 2]) # (3, 5, 7) # 访问从第3个到第9个(不包含)、间隔为3的所有元素 print(b_tuple[2: 8: 3]) # (3, 6) # 访问从第3个到倒数第2个(不包含)、间隔为3的所有元素 print(b_tuple[2: -2: 2]) # (3, 5, 7)
"""Blacklist particular articles from doing particular activities""" def publication_email_article_do_not_send_list(): """ Return list of do not send article DOI id """ do_not_send_list = [ "00003", "00005", "00007", "00011", "00012", "00013", "00031", "00036", "00047", "00048", "00049", "00051", "00065", "00067", "00068", "00070", "00078", "00090", "00093", "00102", "00105", "00109", "00116", "00117", "00133", "00160", "00170", "00171", "00173", "00178", "00181", "00183", "00184", "00190", "00205", "00218", "00220", "00230", "00231", "00240", "00242", "00243", "00247", "00248", "00260", "00269", "00270", "00278", "00281", "00286", "00288", "00290", "00291", "00299", "00301", "00302", "00306", "00308", "00311", "00312", "00321", "00324", "00326", "00327", "00329", "00333", "00334", "00336", "00337", "00340", "00347", "00348", "00351", "00352", "00353", "00354", "00358", "00362", "00365", "00367", "00378", "00380", "00385", "00386", "00387", "00400", "00411", "00415", "00421", "00422", "00425", "00426", "00429", "00435", "00444", "00450", "00452", "00458", "00459", "00461", "00467", "00471", "00473", "00475", "00476", "00477", "00481", "00482", "00488", "00491", "00498", "00499", "00505", "00508", "00515", "00518", "00522", "00523", "00533", "00534", "00537", "00542", "00558", "00563", "00565", "00569", "00571", "00572", "00573", "00577", "00590", "00592", "00593", "00594", "00603", "00605", "00615", "00625", "00626", "00631", "00632", "00633", "00638", "00639", "00640", "00641", "00642", "00646", "00647", "00648", "00654", "00655", "00658", "00659", "00662", "00663", "00666", "00668", "00669", "00672", "00675", "00676", "00683", "00691", "00692", "00699", "00704", "00708", "00710", "00712", "00723", "00726", "00729", "00731", "00736", "00744", "00745", "00747", "00750", "00757", "00759", "00762", "00767", "00768", "00772", "00776", "00778", "00780", "00782", "00785", "00790", "00791", "00792", "00799", "00800", "00801", "00802", "00804", "00806", "00808", "00813", "00822", "00824", "00825", "00828", "00829", "00842", "00844", "00845", "00855", "00856", "00857", "00861", "00862", "00863", "00866", "00868", "00873", "00882", "00884", "00886", "00895", "00899", "00903", "00905", "00914", "00924", "00926", "00932", "00933", "00940", "00943", "00947", "00948", "00951", "00953", "00954", "00958", "00960", "00961", "00963", "00966", "00967", "00969", "00971", "00983", "00992", "00994", "00996", "00999", "01004", "01008", "01009", "01020", "01029", "01030", "01042", "01045", "01061", "01064", "01067", "01071", "01074", "01084", "01085", "01086", "01089", "01096", "01098", "01102", "01104", "01108", "01114", "01115", "01119", "01120", "01123", "01127", "01133", "01135", "01136", "01138", "01139", "01140", "01149", "01157", "01159", "01160", "01169", "01179", "01180", "01197", "01201", "01202", "01206", "01211", "01213", "01214", "01221", "01222", "01228", "01229", "01233", "01234", "01236", "01239", "01252", "01256", "01257", "01267", "01270", "01273", "01279", "01287", "01289", "01291", "01293", "01294", "01295", "01296", "01298", "01299", "01305", "01308", "01310", "01311", "01312", "01319", "01322", "01323", "01326", "01328", "01339", "01340", "01341", "01345", "01350", "01355", "01369", "01370", "01374", "01381", "01385", "01386", "01387", "01388", "01402", "01403", "01412", "01414", "01426", "01428", "01433", "01434", "01438", "01439", "01440", "01456", "01457", "01460", "01462", "01465", "01469", "01473", "01479", "01481", "01482", "01483", "01488", "01489", "01494", "01496", "01498", "01501", "01503", "01514", "01515", "01516", "01519", "01524", "01530", "01535", "01539", "01541", "01557", "01561", "01566", "01567", "01569", "01574", "01579", "01581", "01584", "01587", "01596", "01597", "01599", "01603", "01604", "01605", "01607", "01608", "01610", "01612", "01621", "01623", "01630", "01632", "01633", "01637", "01641", "01658", "01659", "01662", "01663", "01671", "01680", "01681", "01684", "01694", "01695", "01699", "01700", "01710", "01715", "01724", "01730", "01738", "01739", "01741", "01749", "01751", "01754", "01760", "01763", "01775", "01776", "01779", "01808", "01809", "01812", "01816", "01817", "01820", "01828", "01831", "01832", "01833", "01834", "01839", "01845", "01846", "01849", "01856", "01857", "01861", "01867", "01873", "01879", "01883", "01888", "01892", "01893", "01901", "01906", "01911", "01913", "01914", "01916", "01917", "01926", "01928", "01936", "01939", "01944", "01948", "01949", "01958", "01963", "01964", "01967", "01968", "01977", "01979", "01982", "01990", "01993", "01998", "02001", "02008", "02009", "02020", "02024", "02025", "02028", "02030", "02040", "02041", "02042", "02043", "02046", "02053", "02057", "02061", "02062", "02069", "02076", "02077", "02078", "02087", "02088", "02094", "02104", "02105", "02109", "02112", "02115", "02130", "02131", "02137", "02148", "02151", "02152", "02164", "02171", "02172", "02181", "02184", "02189", "02190", "02196", "02199", "02200", "02203", "02206", "02208", "02217", "02218", "02224", "02230", "02236", "02238", "02242", "02245", "02252", "02257", "02260", "02265", "02270", "02272", "02273", "02277", "02283", "02286", "02289", "02304", "02313", "02322", "02324", "02349", "02362", "02365", "02369", "02370", "02372", "02375", "02384", "02386", "02387", "02391", "02394", "02395", "02397", "02403", "02407", "02409", "02419", "02439", "02440", "02443", "02444", "02445", "02450", "02451", "02475", "02478", "02481", "02482", "02490", "02501", "02504", "02510", "02511", "02515", "02516", "02517", "02523", "02525", "02531", "02535", "02536", "02555", "02557", "02559", "02564", "02565", "02576", "02583", "02589", "02590", "02598", "02615", "02618", "02619", "02626", "02630", "02634", "02637", "02641", "02653", "02658", "02663", "02667", "02669", "02670", "02671", "02674", "02676", "02678", "02687", "02715", "02725", "02726", "02730", "02734", "02736", "02740", "02743", "02747", "02750", "02755", "02758", "02763", "02772", "02777", "02780", "02784", "02786", "02791", "02792", "02798", "02805", "02809", "02811", "02812", "02813", "02833", "02839", "02840", "02844", "02848", "02851", "02854", "02860", "02862", "02863", "02866", "02872", "02875", "02882", "02893", "02897", "02904", "02907", "02910", "02917", "02923", "02935", "02938", "02945", "02949", "02950", "02951", "02956", "02963", "02964", "02975", "02978", "02981", "02993", "02996", "02999", "03005", "03007", "03011", "03023", "03025", "03031", "03032", "03035", "03043", "03058", "03061", "03068", "03069", "03075", "03077", "03080", "03083", "03091", "03100", "03104", "03110", "03115", "03116", "03125", "03126", "03128", "03145", "03146", "03159", "03164", "03176", "03178", "03180", "03185", "03191", "03197", "03198", "03205", "03206", "03222", "03229", "03233", "03235", "03239", "03245", "03251", "03254", "03255", "03271", "03273", "03275", "03282", "03285", "03293", "03297", "03300", "03307", "03311", "03318", "03342", "03346", "03348", "03351", "03357", "03363", "03371", "03372", "03374", "03375", "03383", "03385", "03397", "03398", "03399", "03401", "03405", "03406", "03416", "03421", "03422", "03427", "03430", "03433", "03435", "03440", "03443", "03464", "03467", "03468", "03473", "03475", "03476", "03487", "03496", "03497", "03498", "03502", "03504", "03521", "03522", "03523", "03526", "03528", "03532", "03542", "03545", "03549", "03553", "03558", "03563", "03564", "03568", "03573", "03574", "03575", "03579", "03581", "03582", "03583", "03587", "03596", "03600", "03602", "03604", "03606", "03609", "03613", "03626", "03635", "03638", "03640", "03641", "03648", "03650", "03653", "03656", "03658", "03663", "03665", "03671", "03674", "03676", "03678", "03679", "03680", "03683", "03695", "03696", "03697", "03701", "03702", "03703", "03706", "03711", "03714", "03720", "03722", "03724", "03726", "03727", "03728", "03735", "03737", "03743", "03751", "03753", "03754", "03756", "03764", "03765", "03766", "03772", "03778", "03779", "03781", "03785", "03790", "03804", "03811", "03819", "03821", "03830", "03842", "03848", "03851", "03868", "03881", "03883", "03891", "03892", "03895", "03896", "03908", "03915", "03925", "03939", "03941", "03943", "03949", "03952", "03962", "03970", "03971", "03977", "03978", "03980", "03981", "03997", "04000", "04006", "04008", "04014", "04024", "04034", "04037", "04040", "04046", "04047", "04057", "04059", "04066", "04069", "04070", "04094", "04105", "04106", "04111", "04114", "04120", "04121", "04123", "04126", "04132", "04135", "04137", "04147", "04158", "04165", "04168", "04177", "04180", "04187", "04193", "04205", "04207", "04220", "04234", "04235", "04236", "04246", "04247", "04249", "04251", "04263", "04265", "04266", "04273", "04279", "04287", "04288", "04300", "04316", "04333", "04353", "04363", "04366", "04371", "04378", "04380", "04387", "04389", "04390", "04395", "04402", "04406", "04415", "04418", "04433", "04437", "04449", "04476", "04478", "04489", "04491", "04494", "04499", "04501", "04506", "04517", "04525", "04530", "04531", "04534", "04543", "04551", "04553", "04563", "04565", "04577", "04580", "04581", "04586", "04591", "04600", "04601", "04603", "04605", "04617", "04629", "04630", "04631", "04645", "04660", "04664", "04686", "04692", "04693", "04711", "04729", "04741", "04742", "04766", "04775", "04779", "04785", "04801", "04806", "04811", "04851", "04854", "04869", "04875", "04876", "04878", "04885", "04889", "04901", "04902", "04909", "04919", "04969", "04970", "04986", "04995", "04996", "04997", "04998", "05000", "05007", "05025", "05031", "05033", "05041", "05048", "05055", "05060", "05075", "05087", "05105", "05115", "05116", "05125", "05151", "05161", "05169", "05178", "05179", "05198", "05216", "05218", "05244", "05256", "05259", "05269", "05289", "05290", "05334", "05352", "05375", "05377", "05394", "05401", "05418", "05419", "05422", "05427", "05438", "05490", "05504", "05508", "05553", "05558", "05564", "05570", "05580", "05597", "05614", "05657", "05663", "05720", "05770", "05787", "05789", "05816", "05846", "05896", "05983", "06156", "06193", "06200", "06235", "06303", "06306", "06351", "06424", "06430", "06453", "06494", "06656", "06720", "06740", "06900", "06986"] # More do not send circa July 2015 # Do not send email if they are revised, since the duplicate check will not # trigger since they were not sent in the first place do_not_send_list = do_not_send_list + ["04186", "06416", "06847", "06938", "06959", "07072"] return do_not_send_list def pub_router_deposit_article_blacklist(workflow): """ Return list of do not send article DOI id """ if workflow == "HEFCE": article_blacklist = [ "00003", "00005", "00007", "00011", "00013", "00031", "00047", "00048", "00049", "00051", "00065", "00067", "00068", "00070", "00078", "00090", "00093", "00102", "00109", "00117", "00171", "00173", "00181", "00184", "00205", "00240", "00242", "00243", "00248", "00270", "00281", "00286", "00301", "00302", "00311", "00326", "00340", "00347", "00351", "00352", "00353", "00365", "00385", "00386", "00387", "00475", "00012", "00036", "00105", "00116", "00133", "00160", "00170", "00178", "00183", "00190", "00218", "00220", "00230", "00231", "00247", "00260", "00269", "00278", "00288", "00290", "00291", "00299", "00306", "00308", "00312", "00321", "00324", "00327", "00329", "00333", "00334", "00336", "00337", "00348", "00354", "00358", "00362", "00367", "00378", "00380", "00400", "00411", "00415", "00421", "00422", "00425", "00426", "00429", "00435", "00444", "00450", "00452", "00458", "00459", "00461", "00467", "00471", "00473", "00476", "00477", "00481", "00482", "00488", "00491", "00498", "00499", "00505", "00508", "00515", "00518", "00522", "00523", "00533", "00534", "00537", "00542", "00558", "00563", "00565", "00569", "00571", "00572", "00573", "00577", "00592", "00593", "00594", "00603", "00605", "00615", "00625", "00626", "00631", "00632", "00633", "00638", "00639", "00640", "00641", "00642", "00646", "00647", "00648", "00654", "00655", "00658", "00659", "00663", "00666", "00668", "00669", "00672", "00675", "00676", "00683", "00691", "00692", "00699", "00704", "00708", "00710", "00712", "00723", "00726", "00729", "00731", "00736", "00744", "00745", "00747", "00750", "00757", "00759", "00762", "00767", "00768", "00772", "00776", "00778", "00780", "00782", "00785", "00790", "00791", "00792", "00799", "00800", "00801", "00802", "00804", "00806", "00808", "00813", "00822", "00824", "00825", "00828", "00842", "00844", "00845", "00855", "00856", "00857", "00861", "00862", "00863", "00866", "00868", "00873", "00882", "00884", "00886", "00895", "00899", "00903", "00905", "00914", "00924", "00926", "00932", "00933", "00940", "00943", "00947", "00948", "00951", "00953", "00954", "00958", "00960", "00961", "00963", "00966", "00967", "00969", "00971", "00983", "00992", "00994", "00996", "00999", "01004", "01008", "01009", "01020", "01029", "01030", "01042", "01045", "01061", "01064", "01067", "01071", "01074", "01084", "01085", "01086", "01089", "01096", "01098", "01102", "01104", "01108", "01114", "01115", "01119", "01120", "01123", "01127", "01133", "01135", "01136", "01138", "01139", "01140", "01149", "01157", "01159", "01160", "01169", "01179", "01180", "01197", "01202", "01206", "01211", "01213", "01214", "01221", "01222", "01228", "01229", "01233", "01234", "01236", "01252", "01256", "01270", "01273", "01279", "01287", "01289", "01291", "01293", "01294", "01295", "01296", "01298", "01299", "01305", "01312", "01319", "01323", "01326", "01328", "01339", "01340", "01341", "01345", "01350", "01387", "01388", "01402", "01403", "01414", "01426", "01428", "01456", "01462", "01469", "01482", "01494", "01501", "01503", "01514", "01515", "01516", "01519", "01541", "01557", "01561", "01574", "01587", "01597", "01599", "01605", "01608", "01633", "01658", "01662", "01663", "01680", "01700", "01710", "01738", "01749", "01760", "01779", "01809", "01816", "01820", "01839", "01845", "01873", "01893", "01926", "01968", "01979", "02094", "00590", "00662", "00829", "01201", "01239", "01257", "01267", "01308", "01310", "01311", "01322", "01355", "01369", "01370", "01374", "01381", "01385", "01386", "01412", "01433", "01434", "01438", "01439", "01440", "01457", "01460", "01465", "01473", "01479", "01481", "01483", "01488", "01489", "01496", "01498", "01524", "01530", "01535", "01539", "01566", "01567", "01569", "01579", "01581", "01584", "01596", "01603", "01604", "01607", "01610", "01612", "01621", "01623", "01630", "01632", "01637", "01641", "01659", "01671", "01681", "01684", "01694", "01695", "01699", "01715", "01724", "01730", "01739", "01741", "01751", "01754", "01763", "01775", "01776", "01808", "01812", "01817", "01828", "01831", "01832", "01833", "01834", "01846", "01849", "01856", "01857", "01861", "01867", "01879", "01883", "01888", "01892", "01901", "01906", "01911", "01913", "01914", "01916", "01917", "01928", "01936", "01939", "01944", "01948", "01949", "01958", "01963", "01964", "01967", "01977", "01982", "01990", "01993", "01998", "02001", "02008", "02009", "02020", "02024", "02025", "02028", "02030", "02040", "02041", "02042", "02043", "02046", "02053", "02057", "02061", "02062", "02069", "02076", "02077", "02078", "02087", "02088", "02104", "02105", "02109", "02112", "02115", "02130", "02131", "02137", "02148", "02151", "02152", "02164", "02171", "02172", "02181", "02184", "02189", "02190", "02196", "02199", "02200", "02203", "02206", "02208", "02217", "02218", "02224", "02230", "02236", "02238", "02242", "02245", "02252", "02257", "02260", "02265", "02270", "02272", "02273", "02277", "02283", "02286", "02289", "02304", "02313", "02322", "02324", "02349", "02362", "02365", "02369", "02370", "02372", "02375", "02384", "02386", "02387", "02391", "02394", "02395", "02397", "02403", "02407", "02409", "02419", "02439", "02440", "02443", "02444", "02445", "02450", "02451", "02475", "02478", "02481", "02482", "02490", "02501", "02504", "02510", "02511", "02515", "02516", "02517", "02523", "02525", "02531", "02535", "02536", "02555", "02557", "02559", "02564", "02565", "02576", "02583", "02589", "02590", "02598", "02615", "02618", "02619", "02626", "02630", "02634", "02637", "02641", "02653", "02658", "02663", "02667", "02669", "02670", "02671", "02674", "02676", "02678", "02687", "02715", "02725", "02726", "02730", "02734", "02736", "02740", "02743", "02747", "02750", "02755", "02758", "02763", "02772", "02777", "02780", "02784", "02786", "02791", "02792", "02798", "02805", "02809", "02811", "02812", "02813", "02833", "02839", "02840", "02844", "02848", "02851", "02854", "02860", "02862", "02863", "02866", "02869", "02872", "02875", "02882", "02893", "02897", "02904", "02907", "02910", "02917", "02923", "02935", "02938", "02945", "02949", "02950", "02951", "02956", "02963", "02964", "02975", "02978", "02981", "02993", "02996", "02999", "03005", "03007", "03011", "03023", "03025", "03031", "03032", "03035", "03043", "03058", "03061", "03068", "03069", "03075", "03077", "03080", "03083", "03091", "03100", "03104", "03110", "03115", "03116", "03125", "03126", "03128", "03145", "03146", "03159", "03164", "03176", "03178", "03180", "03185", "03191", "03197", "03198", "03205", "03206", "03222", "03229", "03233", "03235", "03239", "03245", "03251", "03254", "03255", "03271", "03273", "03275", "03282", "03285", "03293", "03297", "03300", "03307", "03311", "03318", "03342", "03346", "03348", "03351", "03357", "03363", "03371", "03372", "03374", "03375", "03383", "03385", "03397", "03398", "03399", "03401", "03405", "03406", "03416", "03421", "03422", "03427", "03430", "03433", "03435", "03440", "03443", "03445", "03464", "03467", "03468", "03473", "03475", "03476", "03487", "03496", "03497", "03498", "03502", "03504", "03521", "03522", "03523", "03526", "03528", "03532", "03542", "03545", "03549", "03553", "03558", "03563", "03564", "03568", "03573", "03574", "03575", "03579", "03581", "03582", "03583", "03587", "03596", "03600", "03602", "03604", "03606", "03609", "03613", "03626", "03635", "03638", "03640", "03641", "03648", "03650", "03653", "03656", "03658", "03663", "03665", "03671", "03674", "03676", "03678", "03679", "03680", "03683", "03695", "03696", "03697", "03701", "03702", "03703", "03706", "03711", "03714", "03720", "03722", "03724", "03726", "03727", "03728", "03735", "03737", "03743", "03751", "03753", "03754", "03756", "03764", "03765", "03766", "03772", "03778", "03779", "03781", "03785", "03790", "03804", "03811", "03819", "03821", "03830", "03842", "03848", "03851", "03868", "03881", "03883", "03891", "03892", "03895", "03896", "03908", "03915", "03925", "03939", "03941", "03943", "03949", "03952", "03962", "03970", "03971", "03977", "03978", "03980", "03981", "03997", "04000", "04006", "04008", "04014", "04024", "04034", "04037", "04040", "04046", "04047", "04057", "04059", "04066", "04069", "04070", "04094", "04105", "04106", "04111", "04114", "04120", "04121", "04123", "04126", "04132", "04135", "04137", "04147", "04158", "04165", "04168", "04177", "04180", "04187", "04193", "04205", "04207", "04220", "04234", "04235", "04236", "04246", "04247", "04249", "04251", "04263", "04265", "04266", "04273", "04279", "04287", "04288", "04300", "04316", "04333", "04353", "04363", "04366", "04371", "04378", "04380", "04387", "04389", "04390", "04395", "04402", "04406", "04407", "04415", "04418", "04433", "04437", "04449", "04476", "04478", "04489", "04491", "04494", "04499", "04501", "04506", "04517", "04525", "04530", "04531", "04534", "04543", "04551", "04553", "04563", "04565", "04577", "04580", "04581", "04586", "04591", "04600", "04601", "04603", "04605", "04617", "04629", "04630", "04631", "04645", "04660", "04664", "04686", "04692", "04693", "04711", "04729", "04741", "04742", "04766", "04775", "04779", "04785", "04801", "04806", "04811", "04851", "04854", "04869", "04875", "04876", "04878", "04885", "04889", "04901", "04902", "04909", "04919", "04969", "04970", "04986", "04995", "04996", "04997", "04998", "05000", "05007", "05025", "05031", "05033", "05041", "05048", "05055", "05060", "05075", "05087", "05105", "05115", "05116", "05125", "05151", "05161", "05169", "05178", "05179", "05198", "05216", "05218", "05244", "05256", "05259", "05269", "05289", "05290", "05334", "05352", "05375", "05377", "05394", "05401", "05418", "05419", "05422", "05427", "05438", "05490", "05504", "05508", "05553", "05558", "05564", "05570", "05580", "05597", "05614", "05657", "05663", "05720", "05770", "05787", "05789", "05816", "05846", "05896", "05983", "06156", "06193", "06200", "06235", "06303", "06306", "06351", "06424", "06430", "06453", "06494", "06656", "06720", "06740", "06900", "06986"] elif workflow == "Cengage": article_blacklist = [ "00003", "00005", "00007", "00011", "00012", "00013", "00031", "00036", "00047", "00048", "00049", "00051", "00065", "00067", "00068", "00070", "00078", "00090", "00093", "00102", "00105", "00109", "00116", "00117", "00133", "00160", "00170", "00171", "00173", "00178", "00181", "00183", "00184", "00190", "00205", "00218", "00220", "00230", "00231", "00240", "00242", "00243", "00247", "00248", "00260", "00269", "00270", "00278", "00281", "00286", "00288", "00290", "00291", "00299", "00301", "00302", "00306", "00308", "00311", "00312", "00321", "00324", "00326", "00327", "00329", "00333", "00334", "00336", "00337", "00340", "00347", "00348", "00351", "00352", "00353", "00354", "00358", "00362", "00365", "00367", "00378", "00380", "00385", "00386", "00387", "00400", "00411", "00415", "00421", "00422", "00425", "00426", "00429", "00435", "00444", "00450", "00452", "00458", "00459", "00461", "00467", "00471", "00473", "00475", "00476", "00477", "00481", "00482", "00488", "00491", "00498", "00499", "00505", "00508", "00515", "00518", "00522", "00523", "00533", "00534", "00537", "00542", "00558", "00563", "00565", "00569", "00571", "00572", "00573", "00577", "00590", "00592", "00593", "00594", "00603", "00605", "00615", "00625", "00626", "00631", "00632", "00633", "00638", "00639", "00640", "00641", "00642", "00646", "00647", "00648", "00654", "00655", "00658", "00659", "00662", "00663", "00666", "00668", "00669", "00672", "00675", "00676", "00683", "00691", "00692", "00699", "00704", "00708", "00710", "00712", "00723", "00726", "00729", "00731", "00736", "00744", "00745", "00747", "00750", "00757", "00759", "00762", "00767", "00768", "00772", "00776", "00778", "00780", "00782", "00785", "00790", "00791", "00792", "00799", "00800", "00801", "00802", "00804", "00806", "00808", "00813", "00822", "00824", "00825", "00828", "00829", "00842", "00844", "00845", "00855", "00856", "00857", "00861", "00862", "00863", "00866", "00868", "00873", "00882", "00884", "00886", "00895", "00899", "00903", "00905", "00914", "00924", "00926", "00932", "00933", "00940", "00943", "00947", "00948", "00951", "00953", "00954", "00958", "00960", "00961", "00963", "00966", "00967", "00969", "00971", "00983", "00992", "00994", "00996", "00999", "01004", "01008", "01009", "01020", "01029", "01030", "01042", "01045", "01061", "01064", "01067", "01071", "01074", "01084", "01085", "01086", "01089", "01096", "01098", "01102", "01104", "01108", "01114", "01115", "01119", "01120", "01123", "01127", "01133", "01135", "01136", "01138", "01139", "01140", "01149", "01157", "01159", "01160", "01169", "01179", "01180", "01197", "01201", "01202", "01206", "01211", "01213", "01214", "01221", "01222", "01228", "01229", "01233", "01234", "01236", "01239", "01252", "01256", "01257", "01267", "01270", "01273", "01279", "01287", "01289", "01291", "01293", "01294", "01295", "01296", "01298", "01299", "01305", "01308", "01310", "01311", "01312", "01319", "01322", "01323", "01326", "01328", "01339", "01340", "01341", "01345", "01350", "01355", "01369", "01370", "01374", "01381", "01385", "01386", "01387", "01388", "01402", "01403", "01412", "01414", "01426", "01428", "01433", "01434", "01438", "01439", "01440", "01456", "01457", "01460", "01462", "01465", "01469", "01473", "01479", "01481", "01482", "01483", "01488", "01489", "01494", "01496", "01498", "01501", "01503", "01514", "01515", "01516", "01519", "01524", "01530", "01535", "01539", "01541", "01557", "01561", "01566", "01567", "01569", "01574", "01579", "01581", "01584", "01587", "01596", "01597", "01599", "01603", "01604", "01605", "01607", "01608", "01610", "01612", "01621", "01623", "01630", "01632", "01633", "01637", "01641", "01658", "01659", "01662", "01663", "01671", "01680", "01681", "01684", "01694", "01695", "01699", "01700", "01710", "01715", "01724", "01730", "01738", "01739", "01741", "01749", "01751", "01754", "01760", "01763", "01775", "01776", "01779", "01808", "01809", "01812", "01816", "01817", "01820", "01828", "01831", "01832", "01833", "01834", "01839", "01845", "01846", "01849", "01856", "01857", "01861", "01867", "01873", "01879", "01883", "01888", "01892", "01893", "01901", "01906", "01911", "01913", "01914", "01916", "01917", "01926", "01928", "01936", "01939", "01944", "01948", "01949", "01958", "01963", "01964", "01967", "01968", "01977", "01979", "01982", "01990", "01993", "01998", "02001", "02008", "02009", "02020", "02024", "02025", "02028", "02030", "02040", "02041", "02042", "02043", "02046", "02053", "02057", "02061", "02062", "02069", "02076", "02077", "02078", "02087", "02088", "02094", "02104", "02105", "02109", "02112", "02115", "02130", "02131", "02137", "02148", "02151", "02152", "02164", "02171", "02172", "02181", "02184", "02189", "02190", "02196", "02199", "02200", "02203", "02206", "02208", "02217", "02218", "02224", "02230", "02236", "02238", "02242", "02245", "02252", "02257", "02260", "02265", "02270", "02272", "02273", "02277", "02283", "02286", "02289", "02304", "02313", "02322", "02324", "02349", "02362", "02365", "02369", "02370", "02372", "02375", "02384", "02386", "02387", "02391", "02394", "02395", "02397", "02403", "02407", "02409", "02419", "02439", "02440", "02443", "02444", "02445", "02450", "02451", "02475", "02478", "02481", "02482", "02490", "02501", "02504", "02510", "02511", "02515", "02516", "02517", "02523", "02525", "02531", "02535", "02536", "02555", "02557", "02559", "02564", "02565", "02576", "02583", "02589", "02590", "02598", "02615", "02618", "02619", "02626", "02630", "02634", "02637", "02641", "02653", "02658", "02663", "02667", "02669", "02670", "02671", "02674", "02676", "02678", "02687", "02715", "02725", "02726", "02730", "02734", "02736", "02740", "02743", "02747", "02750", "02755", "02758", "02763", "02772", "02777", "02780", "02784", "02786", "02791", "02792", "02798", "02805", "02809", "02811", "02812", "02813", "02833", "02839", "02840", "02844", "02848", "02851", "02854", "02860", "02862", "02863", "02866", "02869", "02872", "02875", "02882", "02893", "02897", "02904", "02907", "02910", "02917", "02923", "02935", "02938", "02945", "02948", "02949", "02950", "02951", "02956", "02963", "02964", "02975", "02978", "02981", "02993", "02996", "02999", "03005", "03007", "03011", "03023", "03025", "03031", "03032", "03035", "03043", "03058", "03061", "03068", "03069", "03075", "03077", "03080", "03083", "03091", "03100", "03104", "03110", "03115", "03116", "03125", "03126", "03128", "03145", "03146", "03159", "03164", "03176", "03178", "03180", "03185", "03189", "03191", "03197", "03198", "03205", "03206", "03222", "03229", "03233", "03235", "03239", "03245", "03251", "03254", "03255", "03256", "03270", "03271", "03273", "03275", "03282", "03285", "03293", "03297", "03300", "03307", "03311", "03318", "03342", "03346", "03348", "03351", "03357", "03363", "03371", "03372", "03374", "03375", "03383", "03385", "03397", "03398", "03399", "03401", "03405", "03406", "03416", "03421", "03422", "03427", "03430", "03433", "03435", "03440", "03443", "03445", "03464", "03467", "03468", "03473", "03475", "03476", "03487", "03496", "03497", "03498", "03502", "03504", "03521", "03522", "03523", "03526", "03528", "03532", "03542", "03545", "03549", "03553", "03558", "03563", "03564", "03568", "03573", "03574", "03575", "03579", "03581", "03582", "03583", "03587", "03596", "03600", "03602", "03604", "03606", "03609", "03613", "03614", "03626", "03635", "03638", "03640", "03641", "03648", "03650", "03653", "03656", "03658", "03663", "03665", "03671", "03674", "03676", "03678", "03679", "03680", "03683", "03695", "03696", "03697", "03701", "03702", "03703", "03706", "03711", "03714", "03720", "03722", "03724", "03726", "03727", "03728", "03735", "03737", "03743", "03751", "03753", "03754", "03756", "03764", "03765", "03766", "03772", "03778", "03779", "03781", "03785", "03790", "03804", "03811", "03819", "03821", "03830", "03842", "03848", "03851", "03868", "03881", "03883", "03891", "03892", "03895", "03896", "03908", "03915", "03925", "03939", "03941", "03943", "03949", "03952", "03962", "03970", "03971", "03977", "03978", "03980", "03981", "03997", "04000", "04006", "04008", "04014", "04024", "04034", "04037", "04040", "04046", "04047", "04052", "04057", "04059", "04066", "04069", "04070", "04094", "04105", "04106", "04111", "04114", "04120", "04121", "04123", "04126", "04132", "04135", "04137", "04147", "04158", "04165", "04168", "04177", "04180", "04186", "04187", "04193", "04205", "04207", "04220", "04232", "04234", "04235", "04236", "04246", "04247", "04249", "04251", "04260", "04263", "04265", "04266", "04273", "04279", "04287", "04288", "04300", "04316", "04333", "04346", "04353", "04363", "04366", "04371", "04378", "04379", "04380", "04387", "04389", "04390", "04395", "04402", "04406", "04407", "04415", "04418", "04433", "04437", "04449", "04463", "04476", "04478", "04489", "04490", "04491", "04494", "04499", "04501", "04506", "04517", "04525", "04530", "04531", "04534", "04535", "04543", "04550", "04551", "04553", "04563", "04565", "04577", "04580", "04581", "04585", "04586", "04591", "04599", "04600", "04601", "04603", "04605", "04617", "04629", "04630", "04631", "04634", "04645", "04660", "04664", "04686", "04692", "04693", "04711", "04726", "04729", "04741", "04742", "04766", "04775", "04779", "04785", "04790", "04801", "04803", "04806", "04811", "04837", "04851", "04854", "04869", "04871", "04872", "04875", "04876", "04878", "04883", "04885", "04889", "04901", "04902", "04909", "04919", "04940", "04953", "04960", "04969", "04970", "04979", "04986", "04995", "04996", "04997", "04998", "05000", "05003", "05007", "05025", "05031", "05033", "05041", "05042", "05048", "05055", "05060", "05075", "05087", "05098", "05105", "05115", "05116", "05118", "05125", "05151", "05154", "05161", "05165", "05166", "05169", "05178", "05179", "05198", "05216", "05218", "05224", "05242", "05244", "05256", "05259", "05269", "05279", "05289", "05290", "05291", "05334", "05338", "05352", "05375", "05377", "05378", "05394", "05401", "05413", "05418", "05419", "05421", "05422", "05423", "05427", "05438", "05447", "05449", "05457", "05463", "05464", "05472", "05477", "05490", "05491", "05503", "05504", "05508", "05534", "05544", "05553", "05557", "05558", "05560", "05564", "05570", "05580", "05597", "05604", "05606", "05608", "05614", "05635", "05657", "05663", "05701", "05720", "05733", "05770", "05787", "05789", "05808", "05816", "05826", "05835", "05846", "05849", "05861", "05868", "05871", "05875", "05896", "05899", "05959", "05983", "06003", "06024", "06034", "06054", "06068", "06074", "06100", "06132", "06156", "06166", "06179", "06184", "06193", "06200", "06235", "06250", "06303", "06306", "06346", "06351", "06369", "06380", "06400", "06412", "06424", "06430", "06453", "06494", "06536", "06557", "06565", "06633", "06656", "06717", "06720", "06740", "06758", "06782", "06808", "06837", "06877", "06883", "06900", "06956", "06986", "06995", "07074", "07083", "07108", "07157", "07204", "07239", "07322", "07364", "07390", "07431", "07482", "07527", "07532", "07586", "07604" ] elif workflow == "GoOA": article_blacklist = [] else: article_blacklist = [] return article_blacklist
class JSONDL(object): def __init__(self, jsondl_url=None, jsondl_data=None): pass def __attrMethod(self, method): class MethodCaller(object): #TODO: This implementation is horrible improve both code and apijson def __init__(self, ssp_instance, method): self.ssp_instance = ssp_instance api_instance = self.ssp_instance.api self.method = method self.data = dict([('request', dict()), ('response', dict())]) requestparams = self.method.get('def').get('params') responsetype = self.method.get('def').get('returnType').get('type') types = api_instance[self.method['src']].get('types') requesttypes = [t.get('type').get('type') for t in requestparams] # annotationtypes = [t.get('type').get('type') for t in [a.get('annotations') for a in requesttypes][0]] for _type in types: if _type == responsetype: self.data['response'] = json.loads(types[_type]) if _type in requesttypes: self.data['request'] = json.loads(types[_type]) # TODO: BUG: not in types definition # if _type in annotationtypes: # print "annotation" # print types[_type] mappingkey = 'org.springframework.web.bind.annotation.RequestMapping' self.requestMapping = self.method.get('def').get('annotations').get(mappingkey) def __call__(self, kwargs={}): request_json = dict() #### Validation type_mapping = {'string': str, 'boolean': bool, 'string': str, 'null': None, 'integer': int, 'character': chr, 'double': long, 'float': float, 'complex': complex} properties = self.data['request'].get('properties') if properties is not None: for prop in properties: # if kwargs.get(prop, False) != False: # if type_mapping[properties[prop].get('type')] == type(kwargs[prop]): # print "right type %s" % type(kwargs[prop]) # else: # print "wrong type %s expected %s" % (type(kwargs[prop]),properties[prop].get('type')) request_json[prop] = kwargs.get(prop, None) #TODO: make a validation log with properties method = self.requestMapping.get('properties').get('method')[0] path = self.requestMapping.get('properties').get('value')[0] #Query String builder for key in request_json.keys(): if key in path: path = path.replace('{'+key+'}', str(kwargs[key])) # print path response = http.http_send(method, self.ssp_instance.get_proxy(path), self.ssp_instance.headers, json.dumps(request_json), None) return response return MethodCaller(self, method) def __getattr__(self, attr): method = self.api_methods.get(attr, None) if method is not None: return self.__attrMethod(method) else: emsg = "%s object has no attribute '%s'" % (self.__class__.__name__, attr) raise AttributeError(emsg)
#Algoritmos Computacionais e Estruturas de Dados #Lista de exercício função e recursão #Prof.: Laercio Brito #Dia: 16/12/2021 #Turma 2BINFO #Alunos: #Dora Tezulino Santos #Guilherme de Almeida Torrão #Mauro Campos Pahoor #Victor Kauã Martins Nunes #Victor Pinheiro Palmeira #Lucas Lima #Questão 1 def ler_bin(binario,vetor, end,i=0): if i < end: vetor.append(binario[i]) ler_bin(binario,vetor,end,i+1) else: return 0 def som_bin(b1, b2, i1, i2, carry = 0, result = ""): if(i1 == -1 or i2 == -1): print("O resultado é :", result[::-1]) return "Sucesso" else: if(int(b1[i1]) + int(b2[i2]) + carry == 3): result += '1' carry=1 som_bin(b1, b2, i1 - 1, i2 - 1, carry, result) if(int(b1[i1]) + int(b2[i2]) == 2): result += '0' carry=1 som_bin(b1, b2, i1 - 1, i2 - 1, carry, result) if(int(b1[i1]) + int(b2[i2]) == 1): result += '1' carry=0 som_bin(b1, b2, i1 - 1, i2 - 1, carry, result) if(int(b1[i1]) + int(b2[i2]) == 0): result += '0' carry=0 som_bin(b1, b2, i1 - 1, i2 - 1, carry, result) bin1_vet = [] bin2_vet = [] b1 = input("Digite um número binário:") b2 = input("Digite outro número binário:") ler_bin(b1, bin1_vet, len(b1)) ler_bin(b2, bin2_vet, len(b2)) som_bin(bin1_vet , bin2_vet, len(bin1_vet) - 1, len(bin2_vet) - 1)
# -*- coding: utf-8 -*- translations = { # Days 'days': { 0: 'søndag', 1: 'mandag', 2: 'tirsdag', 3: 'onsdag', 4: 'torsdag', 5: 'fredag', 6: 'lørdag' }, 'days_abbrev': { 0: 'søn', 1: 'man', 2: 'tir', 3: 'ons', 4: 'tor', 5: 'fre', 6: 'lør' }, # Months 'months': { 1: 'januar', 2: 'februar', 3: 'marts', 4: 'april', 5: 'maj', 6: 'juni', 7: 'juli', 8: 'august', 9: 'september', 10: 'oktober', 11: 'november', 12: 'december', }, 'months_abbrev': { 1: 'jan', 2: 'feb', 3: 'mar', 4: 'apr', 5: 'maj', 6: 'jun', 7: 'jul', 8: 'aug', 9: 'sep', 10: 'okt', 11: 'nov', 12: 'dec', }, # Units of time 'year': ['{count} år', '{count} år'], 'month': ['{count} måned', '{count} måneder'], 'week': ['{count} uge', '{count} uger'], 'day': ['{count} dag', '{count} dage'], 'hour': ['{count} time', '{count} timer'], 'minute': ['{count} minut', '{count} minutter'], 'second': ['{count} sekund', '{count} sekunder'], # Relative time 'ago': '{time} siden', 'from_now': 'om {time}', 'after': '{time} efter', 'before': '{time} før', # Date formats 'date_formats': { 'LTS': 'HH:mm:ss', 'LT': 'HH:mm', 'LLLL': 'dddd [d.] D. MMMM YYYY HH:mm', 'LLL': 'D. MMMM YYYY HH:mm', 'LL': 'D. MMMM YYYY', 'L': 'DD/MM/YYYY', }, }
f = open("input", "r").read() f = f[:-1] # remove trailing char floor = 0 position = 1 entered_basement = False for i in f: if i == '(': floor = floor + 1 else: floor = floor - 1 if (floor < 0) and (entered_basement == False): print('entering basement on move ' + str(position)) entered_basement = True position = position + 1 print(floor)
######################################################################################################################## ######################################################################################################################## ######################################################################################################################## ########################################### 정현희 선생님 ############################################################### # #########################################section2) print()함수 서식#################################################### #cf.정현희 p.63 {중요} print() # # print("\nIt\'s") # print("%d" % 123) print("%5d" % 123) #총 5자리로 만들기+ 빈칸 포함 print("%05d" % 123) #총 5자리 만들기 + 빈칸은 0으로 채워 # # print("%f" % 123.45) #소수점 이하 6자리까지 출력 # print("%7.1f" % 123.45) #총 7자리, 소수점은 1자리까지 # print("%7.3f" % 123.45) # 총 7자리, 소수점은 3자리까지 # # print("%s" % "Python") #"Python"의 자릿수만큼 출력 # print("%10s" % "Python") #총 10자리 만들기 + 빈칸 포함 # print("%s10" % "Python") #옆에 10붙이기 #############################################Section 3) 중첩 for 문 #################################################### # #1.중첩 for 문의 개념 # #2. 활용 # 2)구구단-가로(p.155) # 전역 변수 # i, k, guguLine = 0, 0, "" # # 메인 코드 # for i in range(2, 10): # guguLine = guguLine + ("# %d단 #" % i) #{중요}모두 모은 후 한번에 all 출력(각 하나씩 출력x) # # print(guguLine) # # for i in range(1, 10): # guguLine = "" #Q)쓰임? # for k in range(2, 10): # guguLine = guguLine + str("%2dX %2d= %2d" % (k, i, k*i)) # print(guguLine) #############################################Section 4) while 문 ####################################################### # # # 2. 무한 루프(loop)(=무한반복)를 하는 while 문 # while True : # print("무한 루프", end="") # # p.161 숫자 2개 입력, 연산자 1개 입력 # ch="" # a,b=0,0 # # while True : # a = int(input("a의 숫자 입력 : ")) # b = int(input("b의 숫자 입력 : ")) # ch = input("연산자 입력 : ") # # if(ch == "+") : # print("%d + %d = %d" % (a,b,a+b)) # elif(ch == "-") : # print("%d - %d = %d" % (a,b,a-b)) # elif(ch == "*") : # print("%d * %d = %d" % (a, b, a * b)) # elif (ch == "/"): # print("%d / %d = %d" % (a, b, a / b)) # elif (ch == "%"): # print("%d %% %d = %d" % (a, b, a % b)) #{조심} %% # elif (ch == "//"): # print("%d // %d = %d" % (a, b, a // b)) # elif (ch == "**"): # print("%d ** %d = %d" % (a, b, a ** b)) # else : # print("연산자를 잘못 입력했습니다.") ######################################## Section2) 리스트의 기본 ######################################################## #{중요} 리스트끼리 연산(+,*) # aa = [10,20,30] # bb = [40,50,60] # print(aa+bb) #붙이기 #=>[10, 20, 30, 40, 50, 60] # print(aa*30) #30번 반복 #=>[10, 20, 30, 10, 20, 30,....] # aa=[10,20,30,40,50,60,70] # print(aa[::2]) #2칸씩 건너뛰라 # print(aa[::-2]) #뒤에서부터 2칸씩 건너뛰라 # print(aa[::-1]) #뒤에서부터 1칸씩 건너뛰라 # print(aa[1::2]) #1번째부터 2칸씩 건너뛰라 # myList = [[1,2,[0,3]], [4,5], [6]] # print(myList) # print(myList[0]) # print(myList[1][1]) # print(myList[0][2][0]) # # ## 6. 리스트 값 변경하기 # aa=[10,20,30] # aa[1:2]=[200,201] #연속된 범위의 값을 변경하기 # print(aa) #=>[10, 200, 201, 30] # #{주의} # aa=[10,20,30] # aa[1]=[200,201] # print(aa) #=>[10, [200, 201], 30] # #cf.정현희 cf7 p.189 # # #sort() : 오름차순 정렬 # myList = [30,0,20,0,-12] # newList = [5,6,7] # print("myList : ", myList) # print("newList : ", newList) # # myList.sort() # print("sort() 이렇게 작성하기 :", myList) #=>[-12, 0, 0, 20, 30] # # a=myList.sort() # print("sort() 오류 :", a) #=>None # # ## 7.리스트 조작 함수 (p.189) {중요} # #count() :리스트에서 해당 값의 개수를 센다->반환한다 # #정답{중요} # print("count() : ", newList.count(5)) # # # cnt=newList.count(5) # # print("count() : ", cnt) # # # #오답 # # # newList.count(5) # # newList.count(newList) #count(newList) 작성하면 안됨 # # print("count() : ", newList) # # ## 7.리스트 조작 함수 (p.189) {중요} # # # myList = [30,0,20,0,-12] # newList = [5,6,7] # print("myList : ", myList) # print("newList : ", newList) # # #clear() : 리스트 내용 모두 지우기 # # myList.clear() # # print("clear() : ", myList) # # #copy() : 리스트의 내용을 새로운 리스트에 복사한다 # newLsit = myList.copy() # print("copy() : ", myList) # print("copy() : ", newLsit) # # #del() : 리스트에서 해당 위치의 '항목을 삭제((리스트 자체를 삭제x))'한다 # del(myList[1]) # print("del() : ", myList) # # #len() : 리스트에 포함된 전체 항목의 개수를 센다=리스트의 개수 확인하기=리스트 내 요소의 개수를 돌려주는 함수 # print("len() : ", len(myList)) # # #count() :리스트에서 해당 값의 개수를 센다->반환한다 # #정답{중요} # print("count() : ", newList.count(5)) # # # cnt=newList.count(5) # # print("count() : ", cnt) # # # #오답 # # # newList.count(5) # # newList.count(newList) #count(newList) 작성하면 안됨 # # print("count() : ", newList) # # #extend() : 리스트 뒤에 리스트를 추가한다. 리스트의 더하기(+) 연산과 기능이 동일하다. # # myList.extend([1,2,3]) # # print("extend() 1 : ", myList) # # myList.extend(newList) # # print("extend() 2 : ", myList) # # # # nnewList = myList + newList # # myList.extend([1,2,3]) # # myList.extend(newList) # # print("extend() 3 : ", nnewList) # # myList.extend([1,2,3]) # myList.extend(newList) # print("extend() 4 : ", myList) # # #remove() : 리스트에서 지정한 값을 삭제한다. 단 지정한 값이 여러 개면 첫번째 값만 지운다. # myList = [30,10,0,20,0,-12] # print("remove() 전 : ", myList) # myList.remove(0) #remove() : 앞에 있는 0만 지움 # print("remove() 후 : ", myList) # # #insert(): 지정된 위치에 값을 '삽입'한다 # myList.insert(1,50) #1번째 위치에 50이란 값을 삽입 # print("insert() : ",myList) # # #index() : 지정한 값을 찾아 해당 '위치'를 반환한다 # print(myList) # a=myList.index(0) # print("index() 0 위치 찾기 : ", a) # print("index() 10 위치 찾기 : ", myList.index(10)) # # #reverse() : 거꾸로 뒤집기 # myList.reverse() # print("reverse() : ", myList) # # #sorted() : 리스트의 항목을 정렬해서 새로운 리스트에 대입한다(오름차순 정렬+대입) # newList=sorted(myList) # print(myList) # print("sorted()",newList) # #to do 대입해보기! # # # # #sort() : 오름차순 정렬 # myList.sort() # print("sort() 이렇게 작성하기 :", myList) #=>[-12, 0, 0, 20, 30] # # a=myList.sort() # print("sort() 오류 :", a) #=>None # # # # #append() : 리스트의 '맨 마지막'에 항목을 추가 # # myList.append(20) # # print("append()", myList) # # # # #pop() :리스트 맨 뒤의 항목을 빼낸다(리스트에서 해당 항목이 삭제된다) # print("pop() 전 : ", myList) # print("pop() 빼내기 : ", myList.pop()) # print("pop() 후 : ", myList) # print("-"*50) # print("pop() 전 : ", myList) # print("pop() 빼내기 : ", myList.pop()) # print("pop() 후 : ", myList) ######################################## Section2) 리스트의 기본 ######################################################## #{중요} 리스트끼리 연산(+,*) # aa = [10,20,30] # bb = [40,50,60] # print(aa+bb) #붙이기 #=>[10, 20, 30, 40, 50, 60] # print(aa*30) #30번 반복 #=>[10, 20, 30, 10, 20, 30,....] ######################################## Section4) 튜플 ######################################################## #3){중요} 연산(+,*)가능 tt2=('A','B') print(tt1 + tt2) #덧붙이기 print(tt2 * 3) # 3번 반복하기 ######################################## Section5) 딕셔너리 ######################################################## # 1. 딕셔너리 생성(p.199) # 삭제하기 : del(딕셔너리명[키]) del(student1['이름']) # del(student1['안철수']) #값으로 지정해 지우려면 오류 print(student1) # 키-유일함 student1={'학번':1000,'이름':'홍길동', '학번':2000} print(student1) #{중요} 동일한 키일 경우 마지막에 있는 키가 적용됨 # 2. 딕셔너리 사용 {중요} # #딕셔너리명.get(키): 없는 키 호출 시 오류x(#=>None) # #딕셔너리명[키]:없는 키 호출 시 오류o(#=>KeyError) # student1={'학번':1000,'이름':'홍길동'} # print(student1.get('회장')) # # student1={'학번':1000,'이름':'홍길동'} # print(student1['회장']) # 출력 관련 student1={'학번':1000,'이름':'홍길동'} print(student1.keys()) #딕셔너리명.keys() : 모든 키 반환 print(list(student1.keys()))#list(딕셔너리명.keys()) : 출력 결과에서 dict_keys 지우고 출력 print(student1.items()) #딕셔너리명.items() : 키와 값의 쌍을 튜플 형태로 반환 print(student1.values()) # 딕셔너리명.values() : 딕셔너리의 모든 값을 리스트로 반환 print(list(student1.values())) # list(딕셔너리명.values()) : 출력 결과에서 dict_values 지우고 출력 # in : 해당 키 유무 확인 : 있으면 T, 없으면 F. print('이름' in student1) print('전공' in student1) #ex)p.204 ab=[] dic1 = {'반장':'황미나', '부반장':'이하림', '총무':'곽소희'} print(dic1['총무']) print(dic1.get('부반장')) #{중요} get() : key에 대응되는 value를 돌려준다 print(dic1.get('회장','회장:안철수')) #{중요} get(찾으려는 키, '디폴트 값') : 딕셔너리 안에 찾으려는 key 값이 없을 경우 미리 정해 둔 디폴트 값을 대신 가져오게 하고 싶을 때에사용. # print(dic1.keys()) #키만 출력 ab=dic1.keys() # print(ab) abList=list(ab)#ab는 리스트임. 일반 문자열 변수가 아님. 즉, 리스트로 키를 담고자 할 때. # print(abList) abList.append('부총무') # 새 키 삽입 # print(abList) cd=dic1.values() cdList = list(cd) # 값만 리스트로 담아 출력 # print(cdList) #p.205 Self Study 7-5 #변수 선언 animals = {"닭":"병아리","개":"강아지","곰":"능소니","고등어":"고도리","명태":"노가리","말":"망아지","호랑이":"개호주"}; #Q); 왜 썼어? #메인 코드 while(True) : myanimal = input(str(list(animals.keys())) + "중 새끼 이름을 알고 싶은 동물은?") if myanimal in animals : print("<%s>의 새끼는<%s>입니다." % (myanimal, animals.get(myanimal))) #{중요} elif myanimal == "끝" : break else : print("아이구, 그런 동물은 없네요. 확인해 보세요.") ######################################## Section6) 심화내용 ######################################################## #여기서부터 복습하기 # # #1. 세트(set)(p.206) #중복된 키는 자동으로 하나만 남는다(정렬x) # mySet1={1,2,3,3,3,4} # print(mySet1) # #{중요}리스트, 튜플, 딕셔너리 등을 세트로 변경시켜 준다. # saleList=['삼각김밥','바나나','도시락','삼각김밥','도시락','삼각김밥'] # print(set(saleList)) # #{중요}집합 # mySet1={1,2,3,4,5} # mySet2={4,5,6,7} # # # #방법1) # # #교집합(두 세트에 공통으로 들어 있는 값) : & # # print(mySet1 & mySet2) # # #합집합(두 세트의 값을 모두 모은 것) : | # # print(mySet1 | mySet2) # # #차집밥(첫 번째 세트에만 있고 두 번째 세트에는 없는 값) : - # # print(mySet1 - mySet2) # # #대칭차집합(한 쪽 세트에만 포함되어 있는 값) : ^ # # print(mySet1 ^ mySet2) # # #방법2) # print(mySet1.intersection(mySet2)) #교집합 # print(mySet1.union(mySet2)) #합집합 # print(mySet1.difference(mySet2)) #차집합 # print(mySet1.symmetric_difference(mySet2)) #대칭차집합 # # #방법3) # my1=mySet1 & mySet2 # my1=mySet1 | mySet2 # my1=mySet1 - mySet2 # my1=mySet1 ^ mySet2 # print(my1) # # # #방법4) # my1=mySet1.intersection(mySet2) # my1=mySet1.union(mySet2) # my1=mySet1.difference(mySet2) # my1=mySet1.symmetric_difference(mySet2) # print(my1) # # #2.컴프리헨션(Comprehension.함축)(p.207) # 리스트 컴프리헨션(많이 사용)과 딕셔너리 컴프리헨션(적게 사용)으로 나뉜다. # 리스트 컴프리헨션의 형식 : # 리스트=[수식 for 항목 in range() if 조건식] # 해석순서 : if 조건식->for 항목 in range()->수식 # # #ex) 1~5까지 저장된 리스트 만들기 # #컴프리헨션 사용해 만들기 # numList=[num for num in range(1,6)] # print(numList) # #컴프리헨션 사용하지 않고 만들기 # numList=[] # for num in range(1,6): # numList.append(num) # print(numList) # # #ex) 1~5의 제곱으로 구성된 리스트 만들기 # numList = [num * num for num in range(1,6)] # print(numList) # #=>[1, 4, 9, 16, 25] # #해석 : 1x1=1, 2x2=4, 3x3=9, 4x4=16, 5x5=25 # # #ex) 1~100까지 숫자에서 5의 배수만 리스트에 넣기 # #컴프리헨션 사용해 만들기 # numList = [num for num in range(1,101) if num % 5 ==0] # print(numList) # #컴프리헨션 사용하지 않고 만들기 # numList=[] # for i in range(1,101): # if i % 5 == 0: # numList.append(i) # print(numList) # # #3.동시에 여러 리스트에 접근 가능(p.208) ### zip : 자료들을 묶어주는 함수 #작은 개수 기준으로 묶는다 : 피자,맥주-zip(x) # foods = ['떡볶이','짜장면','라면','피자','맥주'] # sides = ['오뎅','단무지','김치'] # for food, side in zip(foods, sides): # print(food,'-->',side) # #리스트,튜플,딕셔너리로 묶기 가능 # foods = ['떡볶이','짜장면','라면','피자','맥주'] # sides = ['오뎅','단무지','김치'] # #튜플+리스트로 묶기 # tupList=list(zip(foods,sides)) # print(tupList) # #튜플 # print(tuple(zip(foods,sides))) # # tuple=zip(foods,sides) # # print(tuple) #=><zip object at 0x0000028703389948> # #딕셔너리 # dic=dict(zip(foods,sides)) # print(dic) # # #4.리스트의 복사(p.209) # 얕은 복사(Shallow Copy) : 메모리 공간 1개 공유 ex)나와 너 - 냉장고 1대 공유 # 깊은 복사(Deep Copy)(리스트명[:] or 리스트명.copy()) : 메모리 공간 각자 소유 ex)나-내 냉장고 1대, 너-네 냉장고 1대 각각 소유 # # 1) 얕은 복사 # oldList=['짜장면','탕수육','군만두'] # newList=oldList # print(oldList) # print(newList) # # oldList[0]='짬뽕' # print(oldList) # print(newList) # # oldList.append('깐풍기') # print(oldList) # print(newList) # # 2) 깊은 복사 : 리스트명[:] or 리스트명.copy() 로 싸용 # oldList=['짜장면','탕수육','군만두'] # newList=oldList[:] # # newList=oldList.copy() # print(oldList) # print(newList) # # oldList[0]='짬뽕' # print(oldList) # print(newList) # 변경되지 않음 # # oldList.append('깐풍기') # print(oldList) # print(newList) # 변경되지 않음 # # #5.{중요}리스트를 이용한 스택(stack) 구현(p.210) #리스트를 이용해 초기화함 parking=[] top=0 #push : 데이터 넣기. append()함수 사용 parking.append('자동차A') #자동차 한대 넣기 top += 1 #자동차A는 top의 위치에 들어감->top은 0에서 1로 바뀜 print(parking) parking.append('자동차B') top += 1 print(parking) parking.append('자동차C') top += 1 print(parking) #pop : 데이터 빼기 top -= 1 outCar=parking.pop() # 자동차 한대(C) 빼기 print(outCar) top -= 1 outCar=parking.pop() # 자동차 한대(B) 빼기 print(outCar) top -= 1 outCar=parking.pop() # 자동차 한대(A) 빼기 print(outCar) outCar=parking.pop() print(outCar) #=>IndexError: pop from empty list(뺄 차 없다) ######################################################################################################################## ####################################################8장 문자열(String)################################################### ######################################################################################################################## ################################################# Section2) 문자열 기본 ################################################# ####{중요}프로그램1(p.227) : 문자열 거꾸로 출력하기 #내 풀이) 전체 문자열의 개수에서 하나씩 빼나가며(가감) 뒤에서부터 앞으로 계속토록 한다. #변수 선언 inStr, outStr = "", "" #inStr : 문자열 입력 받을 변수 #outStr : 문자열 거꾸로 저장하는 변수 count, i = 0, 0 #count : 문자열 개수 저장 #메인 코드 inStr = input("문자열을 입력하세요 : ") count = len(inStr) for i in range(0, count) : # print(inStr[i],end='') outStr += inStr[count - (i + 1)] #{중요. 핵심임) # print(outStr) print("내용을 거꾸로 출력 --> %s" % outStr) # #요약) # outStr = "" # inStr=input("문자열을 입력하세요 : ") # count=len(inStr) # for i in range(0,count) : # outStr += inStr[count-i-1] # print(outStr) ################################################# Section3) 문자열 함수 ################################################# # #3. 문자열 공백 삭제, 변경하기 : strip(), rstrip(), lstrip(), replace() # ss = ' 파 이 썬 ' # print(ss) # #1){중요} 변수명.strip() : '앞뒤' 공백 삭제 # print(ss.strip()) # print(type(ss.strip())) # # #2){중요} 변수명.rstrip() : '오른쪽' 공백 삭제 # print(ss.rstrip()) # print(type(ss.strip())) # # #3){중요} 변수명.lstrip() : '왼쪽' 공백 삭제 # print(ss.lstrip()) # print(type(ss.strip())) # # # #4){중요} 문자열 '중간' 공백 삭제하기(#p.231 Code 8-4) # inStr = " 문자열 중간 공백 삭제 전 " # outStr = "" # # for i in range(0, len(inStr)): # if inStr[i] != ' ': # outStr += inStr[i] # # print(outStr) # print("중간 공백 삭제 전 : " + '[' + inStr+ ']') # print("중간 공백 삭제 후 : " + '[' + outStr+ ']') # # # Ex) p.231 Self Study 8-2 :'<<<파<<이>>썬>>>' -> '파이썬'으로 출력하기 # inStr="<<<파<<이>>썬>>>" # outStr = "" # # for i in range(0,len(inStr)) : # if inStr[i] != '<' and inStr[i] !='>': # outStr += inStr[i] # print(outStr) # # 5){중요} 변수명.replace('기존문자열', '새문자열') : 문자열 변경 # ss = '열심히 파이썬 공부 중~' # print(ss) # print(ss.replace('파이썬', 'Py')) # # print(type(ss.replace('파이썬', 'Py'))) # # # #Ex) p.232 code8-5 : 영문자 'o'를 찾아 '$'로 변경 # inStr = input("입력받을 문자열 : ") # outStr = '' # # print(inStr.replace('o','$')) # # # 만약 print(inStr.replace('o','$')) 문장을 쓰지 않으면 아래와 같이 길어진다. # # for i in range(0,len(inStr)) : # # if inStr[i] != 'o': # # print(inStr[i], end='') # # else: # # print('$', end='') # # #4. 문자열 분리, 결합하기 : split(), splitlines(). join() # #1){중요} 변수명.split() : 문자열을 공백/다른 문자로 분리해 리스트로 반환함. # ss = 'Python을 열심히 공부 중' # print(ss.split()) #공백 기준으로 분리 # # ss = 'Python:열심히:공부: 중' # # print(ss.split(':')) #:기준으로 분리 ##2)변수명.splitlines() : 행 단위로 분리시켜줌 # ss = '하나\n둘\n셋' # print(ss.splitlines()) # print(ss.split('\n')) # # #3){중요} 구분자.join('문자열') : 문자열 결합하기 # ss = '%' # print(ss.join('파이썬')) # print(type(ss.join('파이썬'))) # Ex) p.233 Code 08-06 : 연/월/일 형식의 문자열을 입력 -> 10년 후 날짜를 출력 # 내 답안) # # 얼거리 : /제거->리스트화->연에 10 더하기 # inStr = input("연/월/일 형식 날짜 입력 : ") # # inStr = "2010/01/01" # outStr = "" # # chList=inStr.split('/') # # print(chList) # print("10년 후 날짜 출력 : ", str(int(chList[0])+10) + '년' + chList[1] + '월' + chList[2] + '일') # # 책 답안) # ss = input("연/월/일 형식 날짜 입력 : ") # # ssList=ss.split('/') # print("입력한 날짜의 10년 후 ==>", end='') # print(str(int(ssList[0])+10) + '년', end='') # print(ssList[1] + '월', end='') # print(ssList[2] + '일', end='') # # #5. 함수명에 대입하기 # # map(함수명, 리스트명) : ("리스트명"에 있는)리스트값 하나하나를 "함수명"에 대입 # before = ['2019', '12', '31'] # after = list(map(int, before)) #문자->숫자 변환->리스트로 변환 # print(after) # # print(type(after)) # # before = [2019, 12, 31] # after = list(map(str, before)) #숫자->문자 변환->리스트로 변환 # print(after) # # #6. 문자열 정렬하기, 채우기 : center(). ljust(), rjust(), zfill() ss = '파이썬' # #1) 변수명.center(숫자) : 숫자만큼 전체 자릿수를 잡은 후 문자열을 가운데 배치 print(ss.center(10)) #변수명.center(숫자,'문자') : 앞뒤 빈 공간에 문자로 채워 넣음 print(ss.center(10,'-')) # print(type(ss.center(10,'-'))) # #2) 변수명.ljust(숫자) : 왼쪽에 붙여서 출력 print(ss.ljust(10)) # print(type(ss.ljust(10))) # #3) 변수명.rjust(숫자) : 오른쪽에 붙여서 출력 print(ss.rjust(10)) # print(type(ss.rjust(10))) # #4) 변수명.zfill(숫자) : 오른쪽에 붙여 쓰고, 왼쪽 빈 공간은 0으로 채움 print(ss.zfill(10)) # print(type(ss.zfill(10))) # #7. 문자열 구성 파악하기 : isdigit(), isalpha(), isalnum(), islower(), isupper(), isspace() # 개념 : 문자열의 구성을 확인한 후 T/F로 반환 # 방식(2) : # 1) ss='1234' # 2) '1234'.메서드() # (반환 시)자료구조 : bool # # 1) 변수명.isdigit() : 숫자로만 구성되었나 확인 ss='1234' # print(ss.isdigit()) # print(type(ss.isdigit())) #=>bool # # print('1234'.isdigit()) # # # 2) 변수명.isalpha() : 글자(한글, 영어)로만 구성되었나 확인 print(ss.isalpha()) # print('1234'.isalpha()) # print('ab가나'.isalpha()) # print(type(ss.isalpha())) # # 3) 변수명.isalnum() : 글자+숫자 섞여 있나 확인 # print(ss.isalnum()) # print('12rk가나'.isalnum()) # print('12rk가나#$#$'.isalnum()) # print(type(ss.isalnum())) # # 4) 변수명.islower() : 전체가 소문자로만 구성되었는지 확인 # ss="abvf" # print(ss.islower()) # print("abvf".islower()) # # ss="abvf가나" # print(ss.islower()) #소문자 영문+한글 섞일 때 True # # ss="가나" # print(ss.islower()) # 순 한글일 때는 False # # 5) 변수명.isupper() : 대문자로만 구성되었는지 확인 # ss = "AAFF" # print(ss.isupper()) # print("AAFF".isupper()) # # ss = "AabbB" # print(ss.isupper()) # # ss = "AAFF가나" # print(ss.isupper()) # 대문자 영문+한글 섞일 때 True # # ss = "가나" # print(ss.isupper()) # 순 한글일 때는 False # # 6) 변수명.isspace() : 공백 문자로만 구성되었는지 확인 # ss = ' ' # print(ss.isspace()) # # print(' '.isspace()) ######################################################################################################################## ############################################9장 함수와 모듈(Function, module)############################################ ######################################################################################################################## ################################################# Section2) 문자열 기본 ################################################# # # ex) p.251 : plus()함수 작성하기 # #전역 변수 # hap = 0 # # #함수 선언 = 함수를 정의함 = 요리하자 # def plus(c,d,e,f=1) : #{중요} f=1->f=50으로 바뀜 # hap=c+d+e+f # return hap # # def pp() : # print("다른 함수") # # #메인 코드 = 함수를 실행함 = 요리 먹자 # a=int(input("숫자1 ")) # b=int(input("숫자2 ")) # dap = plus(a,b,30,50) # print(dap) ######################################## Section 4) 함수의 반환값과 매개변수 ############################################# # ex) 3)개수 지정 않고 전달 ## 함수 선언 부분 ## def para_func(*para) : #{조심}*:튜플로 만듦, para :매개변수명 result = 0 for num in para : result = result + num return result ## 전역 변수 선언 부분 ## hap = 0 ## 메인 코드 부분 ## hap = para_func(10, 20) print("매개변수가 2개인 함수를 호출한 결과 ==> %d" % hap) # print(type("매개변수가 2개인 함수를 호출한 결과 ==> %d" % hap)) hap = para_func(10, 20, 30) print("매개변수가 3개인 함수를 호출한 결과 ==> %d" % hap) ############################################# Section 6) 함수의 심화 내용 ############################################### # ## 3.{중요}람다함수 # 형식 : 함수명=lambda 매개변수:함수내용 # 1)개념 # 1-1)람다 사용 전 # def hap(num1, num2): # res = num1 + num2 # return res # print(hap(10, 20)) # # 1-2)람다 사용 후 # hap2 = lambda num1, num2 : num1 + num2 #lamda함수를 이용해 매개변수(num1, num2)를 계산(num1 + num2)해 hap2에 넣겠다 # print(hap2(10,20)) # # 1-3)매개변수에 기본값 설정해 사용하기도 가능 # hap3 = lambda num1 = 10, num2 = 20 : num1 + num2 ## 매개변수에 기본값 설정해 사용하기도 가능 # # print(hap3) #이렇게 작성하면 출력 안됨 #Q)어떤 형식이라고 하나? # print(hap3()) # print(hap3(100,200)) #기본값을 설정해도 매개변수를 넘겨주면 기본값은 무시됨. # 2){중요}람다 + map 함수 사용(p.274) # #2-1)람다 사용 전 # myList = [1,2,3,4,5] # # 함수 선언 # def add10(num) : # return num + 10 # # 메인 코드 # for i in range(len(myList)): # myList[i] = add10(myList[i]) # # print(myList) # # #2-2){중요}람다+map 함수 표현 방법 # myList = [1,2,3,4,5] # add10 = lambda num : num + 10 # myList = list(map(add10, myList)) # map(함수명, 리스트명) : 리스트(muList)의 모든 내용을 하나씩 함수(add10)에 적용 {num으로 들어감} # print(myList) # # #2-3){중요}람다+map 함수 표현 방법 # myList = [1,2,3,4,5] # myList = list(map(lambda num : num+10, myList)) # print(myList) # #2-4){중요}람다+map 함수 표현 방법-리스트가 2개 이상 있을 경우 # list1 = [1,2,3,4] # list2 = [10,20,30,40] # # #람다함수 -> 일반함수 # def hapfunc(n1,n2) : # return n1+n2 # # haplist = list(map(hapfunc,list1,list2)) # print(haplist) ######################################################################################################################## ######################################################################################################################## ######################################################################################################################## ############################################# 박길식 선생님 ############################################################# # pi=3.14 # print("{0:10.4f}".format(pi)) #pi를 0으로 넣어 10 + 소수자리 4까지 출력 =>10은 10진수? ################################################# Day 2-2 ############################################################## # #8. 비교-계산, 리턴값 # # 1) # def two_times(num): # res=[] #[2,4,6] # for n in num: # res.append(n*2) # return res #[2,4,6] # # res=two_times([1,2,3]) # print(res)#[2,4,6] # # 2) # def two_times(num): # res=[] #3번 반복됨 [[1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3]] # for n in num: #n:2 # # print(n) # res.append(num*2) #[1,2,3]이 2번 반복돼 [1,2,3,1,2,3] # # return res #리턴 위치에 따라 다른 결과값 # return res # # print(two_times([1,2,3])) #(출력 시)None:함수를 호출하여 수행한 결과가 리턴되지 않았다. 즉, 리턴문 빠짐 # # # 3) # def two_times(num): # res=[] #3번 반복됨 [[1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3], [1, 2, 3, 1, 2, 3]] # for n in num: #n:2 # # print(n) # res.append(num*2) #[1,2,3]이 2번 반복돼 [1,2,3,1,2,3] # return res #리턴 위치에 따라 다른 결과값 # # return res # # print(two_times([1,2,3])) #(출력 시)None:함수를 호출하여 수행한 결과가 리턴되지 않았다. 즉, 리턴문 빠짐 ################################################# Day 2-3 ############################################################## # #1.출력값-sorted/sort 차이 # # # 1)sorted 함수 : 값을 "정렬" -> 결과를 "리스트"로 리턴해주는 함수. 순차 자료형으로 반환. 오름차순. 출력값은 리스트 형식. # print(sorted("seoul")) #=>['e', 'l', 'o', 's', 'u'] # # #혹은 # # #ss = sorted([5,3,4]) # # #print(ss) #=>[3, 4, 5] # # # 2)sort 함수 : 리턴값이 없음.아래 처럼 작성. 오름차순. # myList=[31,10,20] # myList.sort() # # myList.sorted() #=>오류 # print(myList) #=>[10, 20, 31] # ########cf. 배열 VS 리스트 # #공통점 : 여러개 값이 나열되는 측면이 같다 # #차이점 : 배열-저장되는 타입이 모두 동일해야함. # # 리스트-타입 달라도 됨(문자 ,숫자 섞여있어도 괜찮음) # print(sorted([5,3,4])) #정렬! 공통점 답이 다 리스트로 나옴. #=>[3, 4, 5] # print(sorted(['k','i','m'])) #=>['i', 'k', 'm'] # print(sorted("seoul")) #=>['e', 'l', 'o', 's', 'u'] # ss = sorted([5,3,4]) # print(ss) #=>[3, 4, 5] # ex) sorted data=[5,3,4] sorted(data) print(data) #=>[5, 3, 4] data=[5,3,4] data=(sorted(data)) print(data) #=>[3, 4, 5] #Q) 왜 이렇게 출력될까? # ex)sort data2 =[5,3,4] print(data2.sort()) #=>None data2 =[5,3,4] data2.sort() print(data2)#=>[3, 4, 5]
''' Strange substraction Input The first line of the input contains two integer numbers 𝑛 and 𝑘 (2≤𝑛≤109, 1≤𝑘≤50) — the number from which Tanya will subtract and the number of subtractions correspondingly. Output Print one integer number — the result of the decreasing 𝑛 by one 𝑘 times. It is guaranteed that the result will be positive integer number. ''' n, k = input().split() k = int(k) for i in range(k): if n[-1] != '0': lastdig = int(n[-1]) -1 n = n[:-1] + str(lastdig) else: n = n[:-1] print(n)
def generate_instance_identity_document(instance): return { "instanceId": instance.id, }
# iterating over a list print('-- list --') a = [1,2,3,4,5] for x in a: print(x) # iterating over a tuple print('-- tuple --') a = ('cats','dogs','squirrels') for x in a: print(x) # iterating over a dictionary # sort order in python is undefined, so need to sort the results # explictly before comparing output print('-- dict keys --') a = {'a':1,'b':2,'c':3 } keys = [] for x in a.keys(): keys.append(x) keys.sort() for k in keys: print(k) print('-- dict values --') values = list() for v in a.values(): values.append(v) values.sort() for v in values: print(v) items = dict() for k, v in a.items(): items[k] = v print('-- dict item --') print(items['a']) print(items['b']) print(items['c']) # iterating over a string print('-- string --') a = 'defabc' for x in a: print(x)
def _get_combined_method(method_list): def new_func(*args, **kwargs): [m(*args, **kwargs) for m in method_list] return new_func def component_method(func): """ method decorator """ func._is_component_method = True return func class Component(object): """ data descriptor """ _is_component = True def __init__(self): self._cache = {} # id(instance) -> component obj def __get__(self, instance, owner): if instance is None: return self else: return self._cache.get(id(instance), None) def __set__(self, instance, value): self._cache[id(instance)] = value self._refresh_component_methods(instance) def __delete__(self, instance): # delete this instance from the cache del(self._cache[id(instance)]) self._refresh_component_methods(instance) def _refresh_component_methods(self, instance): icls = instance.__class__ # get all components defined in instance cls components = [] for attr in dir(icls): obj = getattr(icls, attr) if getattr(obj, '_is_component', False): comp = getattr(instance, attr, None) if comp is not None: components.append(comp) # clear all of the current instance _component_methods icms = getattr(instance, '_instance_component_methods', []) for meth in icms: delattr(instance, meth) # generate new set of instance component methods icms = {} for c in components: ccls = c.__class__ for attr in dir(ccls): obj = getattr(ccls, attr) if getattr(obj, '_is_component_method', False): if attr not in icms: icms[attr] = [] icms[attr].append(getattr(c, attr)) # also maintain the instance's class original functionality for attr, meths in list(icms.items()): obj = getattr(icls, attr, None) if obj is not None: if callable(obj): icms[attr].insert(0, getattr(instance, attr)) else: raise ValueError("Component method overrides attribute!") # assign the methods to the instance for attr, meths in list(icms.items()): if len(meths) == 1: setattr(instance, attr, icms[attr][0]) else: setattr(instance, attr, _get_combined_method(meths)) # write all of the assigned methods in a list so we know which ones to # remove later instance._instance_component_methods = list(icms.keys()) if __name__ == "__main__": class Robot(object): firmware = Component() arm = Component() def power_on(self): print('Robot.power_on') def kill_all_humans(self): """ demonstrates a method that components didn't take over """ print('Robot.kill_all_humans') class RobotFW(object): @component_method def power_on(self): print('RobotFW.power_on') self.power_on_checks() def power_on_checks(self): """ demonstrates object encapsulation of methods """ print('RobotFW.power_on_checks') class UpgradedRobotFW(RobotFW): """ demonstrates inheritance of components possible """ @component_method def laser_eyes(self, wattage): print("UpgradedRobotFW.laser_eyes(%d)" % wattage) class RobotArm(object): @component_method def power_on(self): print('RobotArm.power_on') @component_method def bend_girder(self): print('RobotArm.bend_girder') r = Robot() print(dir(r)) r.power_on() print('-'*20 + '\n') r.firmware = RobotFW() print(dir(r)) r.power_on() print('-'*20 + '\n') print("try to bend girder (demonstrating adding a component)") try: r.bend_girder() except AttributeError: print("Could not bend girder (I have no arms)") print("adding an arm...") r.arm = RobotArm() print("try to bend girder") r.bend_girder() print(dir(r)) print('-'*20 + '\n') print("upgrading firmware (demonstrating inheritance)") r.firmware = UpgradedRobotFW() r.power_on() r.laser_eyes(300) del(r.firmware) try: r.laser_eyes(300) except AttributeError: print("I don't have laser eyes!")
# Se define la clase "piso" con 4 atributos class piso(): numero = 0 escalera = '' ventanas = 0 cuartos = 0 # Se le da la funcion "timbre" a cada piso def timbre(self): print("ding dong") # __init__ se usa para "llenar" los 4 atributos preestablecidos def __init__(self, numero, ventanas, escaleras, cuartos): self.numero = numero self.ventanas = ventanas self.escaleras = escaleras self.cuartos = cuartos class planta_baja(piso): puerta_principal = True # Se da un override del timbre para la "planta_baja" def timbre(self): print("bzzzzzp") class azotea(piso): antena = True # Se da un override del timbre para la "azotea" def timbre(self): print("Fuera de servicio") primer_piso = piso(2,"si",4,2) cuarto_visitas = planta_baja(1,4,"si",1) segundo_piso = azotea(3,0,"no",0) cuarto_visitas.timbre()
''' Blockchain Backup version. Copyright 2020-2022 DeNova Last modified: 2022-02-01 ''' CURRENT_VERSION = '1.3.5'
#Desenvolva um programa que leia as duas nota de um aluno, calcule e mostre a sua média. n1 = float(input('Primeira nota: ')) n2 = float(input('Segunda nota: ')) m = (n1 + n2) / 2 print('O calculo entre as notas {} e {}, a média é {}'.format(n1,n2,m))
for i in range(1, 5): print(" "*(4-i), end="") for j in range(1, 2*i): print("*", end="") print() for i in range(1, 4): print(" "*(i), end="") for j in range(7-2*i): print("*", end="") print()
class Lint: def __init__(self, file): pass
def sort(keys): _sort(keys, 0, len(keys)-1, 0) def _sort(keys, lo, hi, start): if hi <= lo: return lt = lo gt = hi v = get_r(keys[lt], start) i = lt + 1 while i <= gt: c = get_r(keys[i], start) if c < v: keys[lt], keys[i] = keys[i], keys[lt] lt += 1 i += 1 elif c > v: keys[i], keys[gt] = keys[gt], keys[i] gt -= 1 else: i += 1 _sort(keys, lo, lt-1, start) if v >= 0: _sort(keys, lt, gt, start+1) _sort(keys, gt+1, hi, start) def get_r(key, i): if i < len(key): return ord(key[i]) return -1 if __name__ == '__main__': keys = [ 'she', 'sells', 'seashells', 'by', 'the', 'seashore', 'the', 'shells', 'she', 'sells', 'are', 'surely', 'seashells', ] expected = sorted(keys[:]) assert keys != expected sort(keys) assert keys == expected
#!/usr/bin/python #coding = utf-8 class average: """ This is the base class of average. Inherit from this class will make attribute into the average version. """ def __init__(self,numberOfSamplesNum): self.numberOfSamples = numberOfSamplesNum def setNumberOfSamples(self,numberOfSamplesNum): self.numberOfSamples = numberOfSamplesNum
c = get_config() # Add users here that are allowed admin access to JupyterHub. c.Authenticator.admin_users = ["instructor1"] # Add users here that are allowed to login to JupyterHub. c.Authenticator.whitelist = [ "instructor1", "instructor2", "student1", "student2", "student3" ]
# -*- coding: utf-8 -*- HOST = '0.0.0.0' PORT = 4999 DEBUG = 'true' APP_NAME = 'DingDing' DOMAIN = 'https://oapi.dingtalk.com/'
class Movie: def __init__(self, movie_id, category, title, genres, year, minutes, language, actors, director, imdb): self.id = movie_id self.category = category self.title = title self.genres = genres self.year = year self.minutes = minutes self.language = language self.actors = actors self.director = director self.imdb = imdb def as_dict(self): return vars(self)
#!/usr/bin/env python3 operations = { 'a': lambda a, b : a+b, 's': lambda a, b : a-b, 'm': lambda a, b : a*b, 'd': lambda a, b : a/b, } data = [ ['a', 4, 5], ['d', 0, 3], ['m', 4, 8], ['s', 1, 4], ] [el.append(operations[el[0]](el[1], el[2])) for el in data] [print(el) for el in data]
# -*- coding: utf-8 -*- __version__ = '3.0.0' __description__ = 'Password generator to generate a password based\ on the specified pattern.' __author__ = 'rgb-24bit' __author_email__ = '[email protected]' __license__ = 'MIT' __copyright__ = 'Copyright 2018 - 2019 rgb-24bit'
class SRTF(): processes = [] map_ordered_by_entry = {} total_time = 0 count_processes = 0 wait_list = [] actual_process = None def __init__(self, *procesos): self.processes = procesos self.map_ordered_by_entry.clear() for proceso in self.processes: self.total_time += proceso.rafaga self.count_processes += 1 proceso.wait = 0 if proceso.entrada in self.map_ordered_by_entry: if proceso not in self.map_ordered_by_entry[proceso.entrada]: self.map_ordered_by_entry[proceso.entrada].append(proceso) else: self.map_ordered_by_entry[proceso.entrada] = [proceso] print(self.map_ordered_by_entry) def srtf(self): gantt = {} for i in range(0, self.total_time): if i in self.map_ordered_by_entry: # Si se ingresan nuevos procesos, se añaden a la lista de espera self.wait_list += self.map_ordered_by_entry[i] # Siempre será el primero, se hace una comparación de cual de los # procesos tiene menor tiempo de rafaga restante shortest = self.wait_list[0] # El tiempo de ráfaga restante se calcula con la siguiente formula # tiempo restante = ráfaga - (momento del algoritmo - tiempo de entrada del proceso + tiempo de espera total del proceso) for proceso in self.wait_list[1:]: if shortest.remaining_time(i) > proceso.remaining_time(i): shortest = proceso if i == 0: self.remove_from_wait_list(shortest) self.actual_process = shortest gantt[i] = {} gantt[i]["Proceso"] = self.actual_process.nombre # gantt[i]["Ráfaga restante"] = self.actual_process.remaining_time(i) elif self.actual_process.remaining_time(i) == 0: self.remove_from_wait_list(shortest) self.actual_process = shortest gantt[i] = {} gantt[i]["Proceso"] = self.actual_process.nombre # gantt[i]["Ráfaga restante"] = self.actual_process.remaining_time(i) elif shortest.remaining_time(i) < self.actual_process.remaining_time(i): self.remove_from_wait_list(shortest) self.wait_list.append(self.actual_process) self.actual_process = shortest gantt[i] = {} gantt[i]["Proceso"] = self.actual_process.nombre # gantt[i]["Ráfaga restante"] = self.actual_process.remaining_time(i) else: if shortest not in self.wait_list: self.wait_list.append(shortest) gantt[i] = {} gantt[i]["Proceso"] = self.actual_process.nombre #gantt[i]["Ráfaga restante"] = self.actual_process.remaining_time(i) elif self.actual_process.remaining_time(i) != 0: # gantt[i]["Proceso"] = self.actual_process.nombre # gantt[i]["Ráfaga restante"] = self.actual_process.remaining_time(i) pass else: shortest = self.wait_list[0] for proceso in self.wait_list[1:]: if shortest.remaining_time(i) > proceso.remaining_time(i): shortest = proceso elif shortest.remaining_time(i) == proceso.remaining_time(i): if shortest.entrada > proceso.entrada: shortest = proceso gantt[i] = {} gantt[i]["Proceso"] = shortest.nombre # gantt[i]["Ráfaga restante"] = shortest.remaining_time(i) self.wait_list.remove(shortest) self.actual_process = shortest for proceso in self.wait_list: proceso.wait += 1 return gantt def total_wait_time(self): total = 0 for proceso in self.processes: total += proceso.wait return total def remove_from_wait_list(self, process): if process in self.wait_list: self.wait_list.remove(process)
class C2: pass class C3: pass class C1(C2, C3): print("passing") class C1(C2, C3): """ If a class wants to guarantee that an attribute like name is always set in its instances, it more typically will fill out the attribute at construction time, like this: """ def __init__(self, who): # Set name when constructed self.name = who I1 = C1("bob") I2 = C1("mel") print(I1.name, I2.name) """ The __init__ method is known as the constructor because of when it is run. It's the most commonly used representative of a larger class of methods called operator overloading methods, """ """ The definition of operator overloading methods: Such methods are inherited in class trees as usual and have double underscores at the start and end of their names to make them distinct. Python runs them automatically when instances that support them appear in the corresponding operations, and they are mostly an alternative to using simple method calls. They're also optional: if omitted, the operations are not supported. pattern: __xxxx__ """ class test: def __init__(self, x, y): self.x = x self.y = y def __setattr__(self, name, value): #self.name1 = name1 #self.name2 = name2 self.__dict__[name] = value object.__setattr__(self, name, value) object.__init__ return self.__dict__[name]#, object.name t1 = test(3,5) t1.z = 23 print(t1.x, t1.y, t1.z) print(dir(object.__setattr__)) """ As an example, suppose you're assigned the task of implementing an employee database application. As a Python OOP programmer, you might begin by coding a general superclass that defines default behavior common to all the kinds of employees in your organization: """ class Employee: # General superclass def computeSalary(self): # Common or default behavior pass def giveRaise(self): pass def promote(self): pass def retire(self): pass """ That is, you can code subclasses that customize just the bits of behavior that differ per employee type the rest of the employee types' behavior will be inherited from the more general class. For example, if engineers have a unique salary computation rule(i.e., not hours times rate), you can replace just that one method in a subclass. """ class Engineer(Employee): def computeSalary(self): pass """ Because the computeSalary version here appears lower in the class tree, it will replace (override) the general verison in Employee. You then create instances of the kinds of employee classes that the real employees belong to, to get the correct behavior. """ bob = Employee() mel = Engineer() """ when you later ask for these employees' salaries, they will be computed according to the classes from which the objects were made, due to the principles of the inheritance search """ company = [bob, mel] # A composite object for emp in company: print(emp.computeSalary()) # Run this object's version """ This is yet another instance of the idea of polymorphism introduced in Chapter 4 and revisited in Chapter 16. Recall that polymorphism means that the meaning of an operation depends on the object being operated on. Here, the method computeSalary is located by inheritance search in each object before it is called. In other applications, polymorphism might also be used to hide(i.e., encapsulate) interface differences. For example, a program that processes data streams might be coded to expect objects with input and output methods, without caring what those methods actually do: """ def processor(reader, converter, writer): while 1: data = reader.read() if not data: break data = converter(data) writer.write(data) class Reader: def read(self): pass # Default behavior and tools def other(self): pass class FileReader(Reader): def read(self): pass # Read from a local file class SocketReader(Reader): def read(self): pass # Read from a network socket #processor(FileReader(), Converter, FileWriter()) #processor(SocketReader(), Converter, TapeWriter()) #proceesor(FtpReader(), Converter, XmlWriter()) """ Inheritance hierarchy Note that company list in this example could be stored in a file with Python object pickling, introduced in Chapter 9 when we met files, to yield a persistent employee database. Python also comes with a module named shelve, which would allow you to store the pickled representation of the class instances in an access- by-key filesystem; the third-party open source ZODB system does the same but has better support for production- quality object-oriented databases. """ """ Programming in such an OOP world is just a matter of combining and specializing already debugged code by writing subclasses of your own """ """ Objects at the bottom of the tree inherit attributes from objects higher up in the tree-a feature that enables us to program by customizing code, rather than changing it, or starting from scratch. """ """ 2. Where does an inheritance search look for an attribute? An inheritance search looks for an attribute first in the instance object, then in the class the instance was created from, then in all higher superclasses, progressing from the bottom to the top of the object tree, and from left to right (by default). The search stops at the first place the attribute is found. Because the lowest version of a name found along the way wins, class hiearchies naturally support customization by extension. 3. What is the difference between a class object and an instance object? Both class and instance objects are namespace(package of variablee that appear as attributes). The main difference between is that classes are a kind of factory for creating multiple instances. Classes also support operator overloading methods, which instances inherit, and treat any functions nested within them as special methods for processing instances. 4. Why is the first argument in a class method function special? The first argument in a class method function is special because it always receives the instance object that is the implied subject of the method call. It's usually called self by convention. Because method functions always have this implied subject object context by default, we say they are "object-oriented" --i.e., designed to process or change objects. 5. What is the __init__ method used for? If the __init__ method is coded or inherited in a class, Python calls it automatically each time an instance of that class is created. It's known as the constructor method; it is passed the new instance implicitly, as well as any arguments passed explicitly to the class name. It's also the most commonly used operator overloading method. If no __init__ method is present, instances simply begin life as empty namespaces. 6. How do you create a class instance? You create a class instance by calling the class name as though it were a function; any arguments passed into the class name show up as arguments two and beyond in the __init-_ constructor method. The new instance remembers the class it was created from for inheritance purposes. 8. How do you specify a class's superclasses? You specify a class's superclasses by listing them in parentheses in the class statement, after the new class's name. The left-to-right order in which the classes are listed in the parentheses gives the left-to-right inheritance search order in the class tree, """
def post_register_types(root_module): root_module.add_include('"ns3/propagation-module.h"')
class Cache(dict): def __init__(self): self['test_key'] = 'test_value'
Classes = ['GFI1-1', 'O622-8', 'GFI1-2', 'XGI2', 'E1-63', 'fake', 'O2500-4', 'O9953', 'unrecognizable', 'O622-4', 'GFI2', 'others', '10GFEC', 'empty', 'GFI2-R', 'O155-8', 'GFI1-3', 'O2500'] serial = list(range(len(Classes))) # Classes = dict(zip(Classes, serial)) # print(Classes) tranfer = ['GFI1-1', 'O622155-8', 'GFI12R2', 'XGI2', 'E1-63', 'fake', 'O2500622-4', 'O9953GFEC', 'unrecognizable', 'O2500622-4', 'GFI12R2', 'others', 'O9953GFEC', 'empty', 'GFI12R2', 'O622155-8', 'GFI1-3', 'O2500'] trans = dict(zip(Classes, tranfer)) print(trans) Classes = ['GFI1-1', 'O2500622-4', 'others', 'O2500', 'O9953GFEC', 'unrecognizable', 'O622155-8', 'XGI2', 'GFI1-3', 'fake', 'GFI12R2', 'E1-63', 'empty'] serial = list(range(len(Classes))) print(dict(zip(Classes, serial))) # 保存模型 https://zhuanlan.zhihu.com/p/38056115 # torch.save({'epoch': epochID + 1, 'state_dict': model.state_dict(), 'best_loss': lossMIN, # 'optimizer': optimizer.state_dict(),'alpha': loss.alpha, 'gamma': loss.gamma}, # checkpoint_path + '/m-' + launchTimestamp + '-' + str("%.4f" % lossMIN) + '.pth.tar') Classes = list(set(tranfer)) print(Classes) print(len(Classes))
olha_eu_aqui = """Hey!!! Oie, eu sou uma docString!!!!!!! também funciona como string """ print(olha_eu_aqui)
def friends(n): arr = [0 for i in range(n + 1)] i = 0 while n+1 != 0: if i <= 2: arr[i] = i else: arr[i] = arr[i - 1] + (i - 1) * arr[i - 2] i += 1 n -= 1 return arr[n] if __name__ == '__main__': ## n = 1 ## n = 3 ## n = 4 ## n = 8 n = 10 print(friends(n))
'''https://leetcode.com/problems/n-queens/''' class Solution: def solveNQueens(self, n: int) -> List[List[str]]: board = [['.' for _ in range(n)] for _ in range(n)] ans = [] def placeQ(row, col): board[row][col] = 'Q' def removeQ(row, col): board[row][col] = '.' def display(board): res = [] for rows in board: res.append(''.join(rows)) return res def check(row, col): for i in range(n): if board[row][i]=='Q': return False if board[i][col]=='Q': return False i, j =row, col while i<n and j<n: if board[i][j]=='Q': return False i+=1 j+=1 i,j = row, col while i>-1 and j<n: if board[i][j]=='Q': return False i-=1 j+=1 i, j = row, col while i>-1 and j>-1: if board[i][j]=='Q': return False i-=1 j-=1 i, j = row, col while i<n and j>-1: if board[i][j]=='Q': return False i+=1 j-=1 return True def backtrack(row=0, count=0): for col in range(n): if check(row, col): placeQ(row, col) if row+1==n: count+=1 # print(board) ans.append(display(board)) else: count = backtrack(row+1, count) removeQ(row, col) return count backtrack() return ans
# Review: # Create a function called greet(). # Write 3 print statements inside the function. # Call the greet() function and run your code. name = input("What's your name? ") location = input("Where are you from? ") def greet(name, location): print(f"Hello Mr.{name}") print(f"{location} is a nice place!") greet(name, location) #Keyword arguments, avoid sequential params greet(location=location, name=name)
#Valor do Pagamento print('============ LOJAS TABAJARA ===========') preco = float(input('Valor das compras: R$')) print(' ') print('FORMAS DE PAGAMENTO') print('[ 1 ] À VISTA DINHEIRO/CHEQUE') print('[ 2 ] À VISTA CARTÃO') print('[ 3 ] 2x NO CARTÃO') print('[ 4 ] 3x ou mais NO CARTÃO') print(' ') desconto_10 = preco - ((preco*10)/100) desconto_5 = preco - ((preco*5)/100) juros_20 = preco + ((preco*20)/100) opcao = int(input('Escolha uma opção: ')) print(' ') if opcao == 1: print(f'Sua compra de R${preco} teve um desconto de 10% e agora vai custar R${desconto_10:.2f}') if opcao == 2: print(f'Sua compra de R${preco} teve um desconto de 10% e agora vai custar R${desconto_5:.2f}') if opcao == 3: print(f'Esse formato não tem descontos seu pagamento é de {preco}') if opcao == 4: parcelas = int(input('Quantas parcelas? ')) print(' ') print(f'Sua compra será parcelada em {parcelas}x de R${juros_20/parcelas:.2f} com juros') print(f'Sua compra de R${preco} teve um juros de 20% e agora vai custar R${juros_20:.2f}')
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. 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. # File called _pytest for PyCharm compatability class TestDataFrameDrop: def test_drop(self, df): df.drop(["Carrier", "DestCityName"], axis=1) df.drop(columns=["Carrier", "DestCityName"]) df.drop(["1", "2"]) df.drop(["1", "2"], axis=0) df.drop(index=["1", "2"]) def test_drop_all_columns(self, df): all_columns = list(df.columns) rows = df.shape[0] for dropped in ( df.drop(labels=all_columns, axis=1), df.drop(columns=all_columns), df.drop(all_columns, axis=1), ): assert dropped.shape == (rows, 0) assert list(dropped.columns) == [] def test_drop_all_index(self, df): all_index = list(df.pd.index) cols = df.shape[1] for dropped in ( df.drop(all_index), df.drop(all_index, axis=0), df.drop(index=all_index), ): assert dropped.shape == (0, cols) assert list(dropped.to_pandas().index) == []
# Basic Structure for Stack using Linked List class Node: def __init__(self,data): self.data = data self.next = None class Stack: def __init__(self): self.head = None def is_empty(self): if self.head == None: return True else: return False def push(self, data): if not self.is_empty(): self.head = Node(data) else: newNode = Node(data) newNode.next = self.head self.head = newNode def pop(self): if self.is_empty(): return None else: poppedNode = self.head self.head = self.head.next poppedNode.next = None return poppedNode.data def peek(self): if self.is_empty(): return None else: return self.head.data def display(self): iternode = self.head if self.is_empty(): print('Nothing here') else: while(iternode != None): print()
nomePres1 = "CANDIDATO-1" nomePres2 = "CANDIDATO-2" nomePres3 = "CANDIDATO-3" nomePres4 = "CANDIDATO-4" nomePres5 = "CANDIDATO-5" votoPres1 = 0 votoPres2 = 0 votoPres3 = 0 votoPres4 = 0 votoPres5 = 0 print("\n\n+----------- Urna Eletrônica 1.0 -----------+") print("| |") print("| [1] Listar candidatos. |") print("| [2] Votar para presidente. |") print("| [3] Apurar votos. |") print("| [4] Desligar a urna. |") print("| |") print("+-------------------------------------------+") print("|") op = int(input("+--> Digite a sua opção: ")) if op == 1: print(f"\n\ \r+------ Lista de candidatos ------+\n\ \r| |\n\ \r| Candidato(a) 1: {nomePres1} |\n\ \r| Candidato(a) 2: {nomePres2} |\n\ \r| Candidato(a) 3: {nomePres3} |\n\ \r| Candidato(a) 4: {nomePres4} |\n\ \r| Candidato(a) 5: {nomePres5} |\n\ \r| |\n\ \r+---------------------------------+\n\ ") elif op == 2: votoPres = int(input('\n>>> Informe o número de seu candidato: ')) if votoPres == 1: confirmar = input(f'\n>>> Confirmar voto no candidato {nomePres1} (s ou n): ') if confirmar == 's': votoPres1 += 1 print('\n[*] Voto confirmado!') print('[*] Obrigado por utilizar a urna eletrônica!') elif confirmar == 'n': print('\n[!] Voto cancelado.') print('[*] Obrigado por utilizar a urna eletrônica!') else: print("\n[!] Opção inválida.") print('[*] Obrigado por utilizar a urna eletrônica!') elif votoPres == 2: confirmar = input(f'\n>>> Confirmar voto no candidato {nomePres2} (s ou n): ') if confirmar == 's': votoPres2 += 1 print('\n[*] Voto confirmado!') print('[*] Obrigado por utilizar a urna eletrônica!') elif confirmar == 'n': print('\n[!] Voto cancelado.') print('[*] Obrigado por utilizar a urna eletrônica!') else: print("\n[!] Opção inválida.") print('[*] Obrigado por utilizar a urna eletrônica!') elif votoPres == 3: confirmar = input(f'\n>>> Confirmar voto no candidato {nomePres3} (s ou n): ') if confirmar == 's': votoPres3 += 1 print('\n[*] Voto confirmado!') print('[*] Obrigado por utilizar a urna eletrônica!') elif confirmar == 'n': print('\n[!] Voto cancelado.') print('[*] Obrigado por utilizar a urna eletrônica!') else: print("\n[!] Opção inválida.") print('[*] Obrigado por utilizar a urna eletrônica!') elif votoPres == 4: confirmar = input(f'\n>>> Confirmar voto no candidato {nomePres4} (s ou n): ') if confirmar == 's': votoPres4 += 1 print('\n[*] Voto confirmado!') print('[*] Obrigado por utilizar a urna eletrônica!') elif confirmar == 'n': print('\n[!] Voto cancelado.') print('[*] Obrigado por utilizar a urna eletrônica!') else: print("\n[!] Opção inválida.") print('[*] Obrigado por utilizar a urna eletrônica!') elif votoPres == 5: confirmar = input(f'\n>>> Confirmar voto no candidato {nomePres5} (s ou n): ') if confirmar == 's': votoPres5 += 1 print('\n[*] Voto confirmado!') print('[*] Obrigado por utilizar a urna eletrônica!') elif confirmar == 'n': print('\n[!] Voto cancelado.') print('[*] Obrigado por utilizar a urna eletrônica!') else: print("\n[!] Opção inválida.") print('[*] Obrigado por utilizar a urna eletrônica!') else: print('\n[!] Opção inválida.') print('[*] Obrigado por utilizar a urna eletrônica!') elif op == 3: print(f"\n\ \r+------------ Apuração de votos --------------+\n\ \r| |\n\ \r| Votos do(a) candidato(a) {nomePres1}: {votoPres1} |\n\ \r| Votos do(a) candidato(a) {nomePres2}: {votoPres2} |\n\ \r| Votos do(a) candidato(a) {nomePres3}: {votoPres3} |\n\ \r| Votos do(a) candidato(a) {nomePres4}: {votoPres4} |\n\ \r| Votos do(a) candidato(a) {nomePres5}: {votoPres5} |\n\ \r| |\n\ \r+---------------------------------------------+\n\ ") elif op == 4: print('\n[*] Obrigado por utilizar a urna eletrônica!') else: print('\n[!] Opção inválida.') print('\n[*] Obrigado por utilizar a urna eletrônica!')
# -*- coding: utf-8 -*- info = { "%%spellout-prefixed": { "0": "ERROR;", "1": "vien;", "2": "div;", "3": "trīs;", "4": "četr;", "5": "piec;", "6": "seš;", "7": "septiņ;", "8": "astoņ;", "9": "deviņ;", "(10, 'inf')": "ERROR;" }, "%spellout-cardinal-feminine": { "0": "nulle;", "1": "viena;", "2": "divas;", "3": "trīs;", "4": "četras;", "5": "piecas;", "6": "sešas;", "7": "septiņas;", "8": "astoņas;", "9": "deviņas;", "(10, 19)": "=%spellout-cardinal-masculine=;", "(20, 99)": "<%%spellout-prefixed<desmit[ >>];", "(100, 199)": "simt[ >>];", "(200, 999)": "<%%spellout-prefixed<simt[ >>];", "(1000, 1999)": "tūkstoš[ >>];", "(2000, 999999)": "<%%spellout-prefixed<tūkstoš[ >>];", "(1000000, 1999999)": "viens miljons[ >>];", "(2000000, 999999999)": "<%spellout-cardinal-masculine< miljoni[ >>];", "(1000000000, 1999999999)": "viens miljards[ >>];", "(2000000000, 999999999999)": "<%spellout-cardinal-masculine< miljardi[ >>];", "(1000000000000, 1999999999999)": "viens biljons[ >>];", "(2000000000000, 999999999999999)": "<%spellout-cardinal-masculine< biljoni[ >>];", "(1000000000000000, 1999999999999999)": "viens biljards[ >>];", "(2000000000000000, 999999999999999999)": "<%spellout-cardinal-masculine< biljardi[ >>];", "(1000000000000000000, 'inf')": "=#,##0=;" }, "%spellout-cardinal-masculine": { "0": "nulle;", "1": "viens;", "2": "divi;", "3": "trīs;", "4": "četri;", "5": "pieci;", "6": "seši;", "7": "septiņi;", "8": "astoņi;", "9": "deviņi;", "10": "desmit;", "(11, 19)": ">%%spellout-prefixed>padsmit;", "(20, 99)": "<%%spellout-prefixed<desmit[ >>];", "(100, 199)": "simt[ >>];", "(200, 999)": "<%%spellout-prefixed<simt[ >>];", "(1000, 1999)": "tūkstoš[ >>];", "(2000, 999999)": "<%%spellout-prefixed<tūkstoš[ >>];", "(1000000, 1999999)": "viens miljons[ >>];", "(2000000, 999999999)": "<%spellout-cardinal-masculine< miljoni[ >>];", "(1000000000, 1999999999)": "viens miljards[ >>];", "(2000000000, 999999999999)": "<%spellout-cardinal-masculine< miljardi[ >>];", "(1000000000000, 1999999999999)": "viens biljons[ >>];", "(2000000000000, 999999999999999)": "<%spellout-cardinal-masculine< biljoni[ >>];", "(1000000000000000, 1999999999999999)": "viens biljards[ >>];", "(2000000000000000, 999999999999999999)": "<%spellout-cardinal-masculine< biljardi[ >>];", "(1000000000000000000, 'inf')": "=#,##0=;" }, "%spellout-numbering": { "(0, 'inf')": "=%spellout-cardinal-masculine=;" }, "%spellout-numbering-year": { "(0, 'inf')": "=%spellout-numbering=;" } }
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. # # WSO2 Inc. 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. def encodeField(value, encode_function=str): ''' Encodes a field value using encode_function :param value: :param encode_function: :return: ''' if value is None: return None return encode_function(value) def decodeField(value, decode_function): ''' Decodes a field value using given decode_function :param value: :param decode_function: :return: ''' if value is None: return None return decode_function(value) def decodeObject(jsonObject, target, decodeMap): ''' Decodes a JSON Object and assigns attributes to target. :param jsonObject: :param target: :param decodeMap: :return: ''' for (key, value) in jsonObject.items(): setattr(target, key, decodeField(value, decodeMap[key])) return target
class Node(object): def __init__(self, *contents): self.contents = contents def __repr__(self): return "<{0} {1}>".format(self.__class__.__name__, ', '.join(map(repr, self.contents))) def __eq__(self, other): same_class = (isinstance(other, self.__class__) or isinstance(self, other.__class__)) return same_class and self.contents == other.contents class UnitNode(Node): def __repr__(self): return repr(self.contents[0]) class NumberNode(UnitNode): pass class StringNode(UnitNode): def __repr__(self): return repr(self.contents[0]) class IdentifierNode(UnitNode): def __repr__(self): return self.contents[0] class FunctionNode(Node): def __init__(self, func, *arguments): super(FunctionNode, self).__init__(func, *arguments) self.func = func self.arguments = arguments def __repr__(self): return "{0}({1})".format(repr(self.func), ', '.join(map(repr, self.arguments))) class BinOpNode(FunctionNode): def __init__(self, opname, *arguments): super(FunctionNode, self).__init__(opname, *arguments) self.func = IdentifierNode('binop.' + opname) self.arguments = arguments class UnaryOpNode(FunctionNode): def __init__(self, opname, argument): super(UnaryOpNode, self).__init__(opname, argument) self.func = IdentifierNode('unaryop.' + opname) self.arguments = (argument,) class CommaNode(Node): def __init__(self, *args): expanded_args = [] for arg in args: if isinstance(arg, CommaNode): expanded_args.extend(arg.contents) else: expanded_args.append(arg) super(CommaNode, self).__init__(*expanded_args) def __repr__(self): return ', '.join(map(repr, self.contents)) class TupleNode(Node): def __init__(self, commas): self.commas = commas super(TupleNode, self).__init__(commas) def __repr__(self): return "({0})".format(self.commas)