content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# This is where all of our model classes are defined
class PhysicalAttributes:
def __init__(self, width=None, height=None, depth=None, dimensions=None, mass=None):
self.width = width
self.height = height
self.depth = depth
self.dimensions = dimensions
self.mass = mass
def serialize(self):
return {
'width': self.width,
'height': self.height,
'depth': self.depth,
'dimensions': self.dimensions,
'mass': self.mass
}
def __repr__(self):
return repr(self.serialize())
class Hardware:
def __init__(self, cpu=None, gpu=None, ram=None, nonvolatile_memory=None):
self.cpu = cpu
self.gpu = gpu
self.ram = ram
self.nonvolatile_memory = nonvolatile_memory
def serialize(self):
return {
'cpu': self.cpu.serialize() if self.cpu is not None else None,
'gpu': self.gpu.serialize() if self.gpu is not None else None,
'ram': self.ram.serialize() if self.ram is not None else None,
'nonvolatile_memory': self.nonvolatile_memory.serialize() if self.nonvolatile_memory is not None else None
}
def __repr__(self):
return repr(self.serialize())
class Cpu:
def __init__(self, model=None, additional_info=None, clock_speed=None):
self.model = model
self.clock_speed = clock_speed
self.additional_info = additional_info \
if not additional_info or not isinstance(additional_info, str) \
else [additional_info]
def serialize(self):
return {
'model': self.model,
'additional_info': self.additional_info,
'clock_speed': self.clock_speed
}
def __repr__(self):
return repr(self.serialize())
class Gpu:
def __init__(self, model=None, clock_speed=None):
self.model = model
self.clock_speed = clock_speed
def serialize(self):
return {
'model': self.model,
'clock_speed': self.clock_speed
}
def __repr__(self):
return repr(self.serialize())
class Ram:
def __init__(self, type_m=None, capacity=None):
self.type_m = type_m
self.capacity = capacity
def serialize(self):
return {
'type': self.type_m,
'capacity': self.capacity
}
def __repr__(self):
return repr(self.serialize())
class NonvolatileMemory:
def __init__(self, type_m=None, capacity=None):
self.type_m = type_m
self.capacity = capacity
def serialize(self):
return {
'type': self.type_m,
'capacity': self.capacity
}
def __repr__(self):
return repr(self.serialize())
class Display:
def __init__(self, resolution=None, diagonal=None, width=None, height=None, bezel_width=None,
area_utilization=None, pixel_density=None, type_m=None, color_depth=None, screen=None):
self.resolution = resolution
self.diagonal = diagonal
self.width = width
self.height = height
self.bezel_width = bezel_width
self.area_utilization = area_utilization
self.pixel_density = pixel_density
self.type_m = type_m
self.color_depth = color_depth
self.screen = screen
def serialize(self):
return {
'resolution': self.resolution,
'diagonal': self.diagonal,
'width': self.width,
'height': self.height,
'bezel_width': self.bezel_width,
'area_utilization': self.area_utilization,
'pixel_density': self.pixel_density,
'type': self.type_m,
'color_depth': self.color_depth,
'screen': self.screen
}
def __repr__(self):
return repr(self.serialize())
class Camera:
def __init__(self, placement=None, module=None, sensor=None, sensor_format=None, resolution=None,
num_pixels=None, aperture=None, optical_zoom=None, digital_zoom=None, focus=None,
camcorder=None, flash=None):
self.placement = placement
self.module = module
self.sensor = sensor
self.sensor_format = sensor_format
self.resolution = resolution
self.num_pixels = num_pixels
self.aperture = aperture
self.optical_zoom = optical_zoom
self.digital_zoom = digital_zoom
self.focus = focus
self.camcorder = camcorder
self.flash = flash
def serialize(self):
return {
'placement': self.placement,
'module': self.module,
'sensor': self.sensor,
'sensor_format': self.sensor_format,
'resolution': self.resolution,
'num_pixels': self.num_pixels,
'aperture': self.aperture,
'optical_zoom': self.optical_zoom,
'digital_zoom': self.digital_zoom,
'focus': self.focus,
'camcorder': self.camcorder.serialize() if self.camcorder is not None else None,
'flash': self.flash
}
def __repr__(self):
return repr(self.serialize())
class Camcorder:
def __init__(self, resolution=None, formats=None):
self.resolution = resolution
self.formats = formats
def serialize(self):
return {
'resolution': self.resolution,
'formats': self.formats
}
def __repr__(self):
return repr(self.serialize())
class Software:
def __init__(self, platform=None, os=None, software_extras=None):
self.platform = platform
self.os = os
self.software_extras = software_extras \
if not software_extras or not isinstance(software_extras, str) \
else [software_extras]
def serialize(self):
return {
'platform': self.platform,
'os': self.os,
'software_extras': self.software_extras
}
def __repr__(self):
return repr(self.serialize())
class Model:
def __init__(self, image=None, name=None, brand=None, model=None, release_date=None,
hardware_designer=None, manufacturers=None, codename=None, market_countries=None,
market_regions=None, carriers=None, physical_attributes=None,
hardware=None, software=None, display=None, cameras=None):
# singular attributes
self.image = image
self.name = name
self.brand = brand
self.model = model
self.release_date = release_date
self.hardware_designer = hardware_designer
self.codename = codename
# list attributes (convert to list if it's neither str nor None)
self.manufacturers = manufacturers \
if not manufacturers or not isinstance(manufacturers, str) else [manufacturers]
self.market_countries = market_countries \
if not market_countries or not isinstance(market_countries, str) else [market_countries]
self.market_regions = market_regions \
if not market_regions or not isinstance(market_regions, str) else [market_regions]
self.carriers = carriers \
if not carriers or not isinstance(carriers, str) else [carriers]
# classed attributes
self.physical_attributes = physical_attributes
self.hardware = hardware
self.software = software
self.display = display
self.cameras = cameras
def serialize(self):
return {
'image': self.image,
'name': self.name,
'brand': self.brand,
'model': self.model,
'release_date': self.release_date,
'hardware_designer': self.hardware_designer,
'manufacturers': self.manufacturers,
'codename': self.codename,
'market_countries': self.market_countries,
'market_regions': self.market_regions,
'carriers': self.carriers,
'physical_attributes': self.physical_attributes.serialize() if self.physical_attributes is not None else None,
'software': self.software.serialize() if self.software is not None else None,
'hardware': self.hardware.serialize() if self.hardware is not None else None,
'display': self.display.serialize() if self.display is not None else None,
'cameras': [camera.serialize() for camera in self.cameras]
}
def __repr__(self):
return repr(self.serialize())
class Brand:
def __init__(self, image=None, name=None, type_m=None, industries=None, found_date=None, location=None,
area_served=None, phone_models=None, carriers=None, os=None, founders=None,
parent=None):
self.image = image
self.name = name
self.type_m = type_m
self.found_date = found_date
self.location = location
self.area_served = area_served
self.parent = parent
self.industries = industries \
if not industries or not isinstance(industries, str) else [industries]
self.phone_models = phone_models \
if not phone_models or not isinstance(phone_models, str) else [phone_models]
self.carriers = carriers \
if not carriers or not isinstance(carriers, str) else [carriers]
self.os = os \
if not os or not isinstance(os, str) else [os]
self.founders = founders \
if not founders or not isinstance(founders, str) else [founders]
def serialize(self):
return {
'image': self.image,
'name': self.name,
'type': self.type_m,
'industries': self.industries,
'found_date': self.found_date,
'location': self.location,
'area_served': self.area_served,
'phone_models': self.phone_models,
'carriers': self.carriers,
'os': self.os,
'founders': self.founders,
'parent': self.parent
}
def __repr__(self):
return repr(self.serialize())
class OS:
def __init__(self, image=None, name=None, developer=None, release_date=None, version=None,
os_kernel=None, os_family=None, supported_cpu_instruction_sets=None,
predecessor=None, brands=None, models=None, codename=None,
successor=None):
self.image = image
self.name = name
self.developer = developer
self.release_date = release_date
self.version = version
self.os_kernel = os_kernel
self.os_family = os_family
self.supported_cpu_instruction_sets = supported_cpu_instruction_sets \
if not supported_cpu_instruction_sets or not isinstance(supported_cpu_instruction_sets, str) \
else [supported_cpu_instruction_sets]
self.predecessor = predecessor
self.brands = brands \
if not brands or not isinstance(brands, str) else [brands]
self.models = models \
if not models or not isinstance(models, str) else [models]
self.codename = codename
self.successor = successor
def serialize(self):
return {
'image': self.image,
'name': self.name,
'developer': self.developer,
'release_date': self.release_date,
'version': self.version,
'os_kernel': self.os_kernel,
'os_family': self.os_family,
'supported_cpu_instruction_sets': self.supported_cpu_instruction_sets,
'predecessor': self.predecessor,
'brands': self.brands,
'models': self.models,
'codename': self.codename,
'successor': self.successor
}
def __repr__(self):
return repr(self.serialize())
class Carrier:
def __init__(self, image=None, name=None, short_name=None, cellular_networks=None,
covered_countries=None, brands=None, models=None):
self.image = image
self.name = name
self.short_name = short_name
self.cellular_networks = cellular_networks \
if not cellular_networks or not isinstance(cellular_networks, str) else [cellular_networks]
self.covered_countries = covered_countries \
if not covered_countries or not isinstance(covered_countries, str) else [covered_countries]
self.brands = brands \
if not brands or not isinstance(brands, str) else [brands]
self.models = models \
if not models or not isinstance(models, str) else [models]
def serialize(self):
return {
'image': self.image,
'name': self.name,
'short_name': self.short_name,
'cellular_networks': self.cellular_networks,
'covered_countries': self.covered_countries,
'brands': self.brands,
'models': self.models
}
def __repr__(self):
return repr(self.serialize())
| class Physicalattributes:
def __init__(self, width=None, height=None, depth=None, dimensions=None, mass=None):
self.width = width
self.height = height
self.depth = depth
self.dimensions = dimensions
self.mass = mass
def serialize(self):
return {'width': self.width, 'height': self.height, 'depth': self.depth, 'dimensions': self.dimensions, 'mass': self.mass}
def __repr__(self):
return repr(self.serialize())
class Hardware:
def __init__(self, cpu=None, gpu=None, ram=None, nonvolatile_memory=None):
self.cpu = cpu
self.gpu = gpu
self.ram = ram
self.nonvolatile_memory = nonvolatile_memory
def serialize(self):
return {'cpu': self.cpu.serialize() if self.cpu is not None else None, 'gpu': self.gpu.serialize() if self.gpu is not None else None, 'ram': self.ram.serialize() if self.ram is not None else None, 'nonvolatile_memory': self.nonvolatile_memory.serialize() if self.nonvolatile_memory is not None else None}
def __repr__(self):
return repr(self.serialize())
class Cpu:
def __init__(self, model=None, additional_info=None, clock_speed=None):
self.model = model
self.clock_speed = clock_speed
self.additional_info = additional_info if not additional_info or not isinstance(additional_info, str) else [additional_info]
def serialize(self):
return {'model': self.model, 'additional_info': self.additional_info, 'clock_speed': self.clock_speed}
def __repr__(self):
return repr(self.serialize())
class Gpu:
def __init__(self, model=None, clock_speed=None):
self.model = model
self.clock_speed = clock_speed
def serialize(self):
return {'model': self.model, 'clock_speed': self.clock_speed}
def __repr__(self):
return repr(self.serialize())
class Ram:
def __init__(self, type_m=None, capacity=None):
self.type_m = type_m
self.capacity = capacity
def serialize(self):
return {'type': self.type_m, 'capacity': self.capacity}
def __repr__(self):
return repr(self.serialize())
class Nonvolatilememory:
def __init__(self, type_m=None, capacity=None):
self.type_m = type_m
self.capacity = capacity
def serialize(self):
return {'type': self.type_m, 'capacity': self.capacity}
def __repr__(self):
return repr(self.serialize())
class Display:
def __init__(self, resolution=None, diagonal=None, width=None, height=None, bezel_width=None, area_utilization=None, pixel_density=None, type_m=None, color_depth=None, screen=None):
self.resolution = resolution
self.diagonal = diagonal
self.width = width
self.height = height
self.bezel_width = bezel_width
self.area_utilization = area_utilization
self.pixel_density = pixel_density
self.type_m = type_m
self.color_depth = color_depth
self.screen = screen
def serialize(self):
return {'resolution': self.resolution, 'diagonal': self.diagonal, 'width': self.width, 'height': self.height, 'bezel_width': self.bezel_width, 'area_utilization': self.area_utilization, 'pixel_density': self.pixel_density, 'type': self.type_m, 'color_depth': self.color_depth, 'screen': self.screen}
def __repr__(self):
return repr(self.serialize())
class Camera:
def __init__(self, placement=None, module=None, sensor=None, sensor_format=None, resolution=None, num_pixels=None, aperture=None, optical_zoom=None, digital_zoom=None, focus=None, camcorder=None, flash=None):
self.placement = placement
self.module = module
self.sensor = sensor
self.sensor_format = sensor_format
self.resolution = resolution
self.num_pixels = num_pixels
self.aperture = aperture
self.optical_zoom = optical_zoom
self.digital_zoom = digital_zoom
self.focus = focus
self.camcorder = camcorder
self.flash = flash
def serialize(self):
return {'placement': self.placement, 'module': self.module, 'sensor': self.sensor, 'sensor_format': self.sensor_format, 'resolution': self.resolution, 'num_pixels': self.num_pixels, 'aperture': self.aperture, 'optical_zoom': self.optical_zoom, 'digital_zoom': self.digital_zoom, 'focus': self.focus, 'camcorder': self.camcorder.serialize() if self.camcorder is not None else None, 'flash': self.flash}
def __repr__(self):
return repr(self.serialize())
class Camcorder:
def __init__(self, resolution=None, formats=None):
self.resolution = resolution
self.formats = formats
def serialize(self):
return {'resolution': self.resolution, 'formats': self.formats}
def __repr__(self):
return repr(self.serialize())
class Software:
def __init__(self, platform=None, os=None, software_extras=None):
self.platform = platform
self.os = os
self.software_extras = software_extras if not software_extras or not isinstance(software_extras, str) else [software_extras]
def serialize(self):
return {'platform': self.platform, 'os': self.os, 'software_extras': self.software_extras}
def __repr__(self):
return repr(self.serialize())
class Model:
def __init__(self, image=None, name=None, brand=None, model=None, release_date=None, hardware_designer=None, manufacturers=None, codename=None, market_countries=None, market_regions=None, carriers=None, physical_attributes=None, hardware=None, software=None, display=None, cameras=None):
self.image = image
self.name = name
self.brand = brand
self.model = model
self.release_date = release_date
self.hardware_designer = hardware_designer
self.codename = codename
self.manufacturers = manufacturers if not manufacturers or not isinstance(manufacturers, str) else [manufacturers]
self.market_countries = market_countries if not market_countries or not isinstance(market_countries, str) else [market_countries]
self.market_regions = market_regions if not market_regions or not isinstance(market_regions, str) else [market_regions]
self.carriers = carriers if not carriers or not isinstance(carriers, str) else [carriers]
self.physical_attributes = physical_attributes
self.hardware = hardware
self.software = software
self.display = display
self.cameras = cameras
def serialize(self):
return {'image': self.image, 'name': self.name, 'brand': self.brand, 'model': self.model, 'release_date': self.release_date, 'hardware_designer': self.hardware_designer, 'manufacturers': self.manufacturers, 'codename': self.codename, 'market_countries': self.market_countries, 'market_regions': self.market_regions, 'carriers': self.carriers, 'physical_attributes': self.physical_attributes.serialize() if self.physical_attributes is not None else None, 'software': self.software.serialize() if self.software is not None else None, 'hardware': self.hardware.serialize() if self.hardware is not None else None, 'display': self.display.serialize() if self.display is not None else None, 'cameras': [camera.serialize() for camera in self.cameras]}
def __repr__(self):
return repr(self.serialize())
class Brand:
def __init__(self, image=None, name=None, type_m=None, industries=None, found_date=None, location=None, area_served=None, phone_models=None, carriers=None, os=None, founders=None, parent=None):
self.image = image
self.name = name
self.type_m = type_m
self.found_date = found_date
self.location = location
self.area_served = area_served
self.parent = parent
self.industries = industries if not industries or not isinstance(industries, str) else [industries]
self.phone_models = phone_models if not phone_models or not isinstance(phone_models, str) else [phone_models]
self.carriers = carriers if not carriers or not isinstance(carriers, str) else [carriers]
self.os = os if not os or not isinstance(os, str) else [os]
self.founders = founders if not founders or not isinstance(founders, str) else [founders]
def serialize(self):
return {'image': self.image, 'name': self.name, 'type': self.type_m, 'industries': self.industries, 'found_date': self.found_date, 'location': self.location, 'area_served': self.area_served, 'phone_models': self.phone_models, 'carriers': self.carriers, 'os': self.os, 'founders': self.founders, 'parent': self.parent}
def __repr__(self):
return repr(self.serialize())
class Os:
def __init__(self, image=None, name=None, developer=None, release_date=None, version=None, os_kernel=None, os_family=None, supported_cpu_instruction_sets=None, predecessor=None, brands=None, models=None, codename=None, successor=None):
self.image = image
self.name = name
self.developer = developer
self.release_date = release_date
self.version = version
self.os_kernel = os_kernel
self.os_family = os_family
self.supported_cpu_instruction_sets = supported_cpu_instruction_sets if not supported_cpu_instruction_sets or not isinstance(supported_cpu_instruction_sets, str) else [supported_cpu_instruction_sets]
self.predecessor = predecessor
self.brands = brands if not brands or not isinstance(brands, str) else [brands]
self.models = models if not models or not isinstance(models, str) else [models]
self.codename = codename
self.successor = successor
def serialize(self):
return {'image': self.image, 'name': self.name, 'developer': self.developer, 'release_date': self.release_date, 'version': self.version, 'os_kernel': self.os_kernel, 'os_family': self.os_family, 'supported_cpu_instruction_sets': self.supported_cpu_instruction_sets, 'predecessor': self.predecessor, 'brands': self.brands, 'models': self.models, 'codename': self.codename, 'successor': self.successor}
def __repr__(self):
return repr(self.serialize())
class Carrier:
def __init__(self, image=None, name=None, short_name=None, cellular_networks=None, covered_countries=None, brands=None, models=None):
self.image = image
self.name = name
self.short_name = short_name
self.cellular_networks = cellular_networks if not cellular_networks or not isinstance(cellular_networks, str) else [cellular_networks]
self.covered_countries = covered_countries if not covered_countries or not isinstance(covered_countries, str) else [covered_countries]
self.brands = brands if not brands or not isinstance(brands, str) else [brands]
self.models = models if not models or not isinstance(models, str) else [models]
def serialize(self):
return {'image': self.image, 'name': self.name, 'short_name': self.short_name, 'cellular_networks': self.cellular_networks, 'covered_countries': self.covered_countries, 'brands': self.brands, 'models': self.models}
def __repr__(self):
return repr(self.serialize()) |
class Identifier(object):
def __init__(self, name, value, declared=False, id_type=None, constant=False):
self.name = name
self.value = value
self.declared = declared
self.type = id_type
self.constant = constant
def __str__(self):
return self.name | class Identifier(object):
def __init__(self, name, value, declared=False, id_type=None, constant=False):
self.name = name
self.value = value
self.declared = declared
self.type = id_type
self.constant = constant
def __str__(self):
return self.name |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 28 21:34:17 2017
@author: chen
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
# class Solution(object):
# def hasCycle(self, head):
# """
# :type head: ListNode
# :rtype: bool
# """
# if head == None:
# return False
# middleN = endN = head
# count = 1
# while endN != None:
# if endN.next ==None:
# return False
# endN = endN.next
# if count%2 ==0:
# middleN = middleN.next
# if endN == middleN:
# return True
# count+=1
# return False
class Solution:
def hasCycle(self, head: ListNode) -> bool:
if head is None:
return False
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
a= ListNode(0)
b = ListNode(1)
c = ListNode(2)
a.next = b
b.next = c
c.next = b
D = None
A = Solution()
print(A.hasCycle(a))
| """
Created on Thu Dec 28 21:34:17 2017
@author: chen
"""
class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def has_cycle(self, head: ListNode) -> bool:
if head is None:
return False
slow = fast = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if slow == fast:
return True
return False
a = list_node(0)
b = list_node(1)
c = list_node(2)
a.next = b
b.next = c
c.next = b
d = None
a = solution()
print(A.hasCycle(a)) |
def mostra_adicionais(*args):
telaProduto = args[0]
cursor = args[1]
QtWidgets = args[2]
telaProduto.frame_adc.show()
listaAdc = []
sql1 = ("select * from adcBroto")
cursor.execute(sql1)
dados1 = cursor.fetchall()
sql2 = ("select * from adcSeis ")
cursor.execute(sql2)
dados2 = cursor.fetchall()
sql3 = ("select * from adcOito")
cursor.execute(sql3)
dados3 = cursor.fetchall()
sql4 = ("select * from adcDez")
cursor.execute(sql4)
dados4 = cursor.fetchall()
slq5 = ("select * from adcSem")
cursor.execute(slq5)
dados5 = cursor.fetchall()
for i, j, k, l in zip(dados1, dados2, dados3, dados4):
listaAdc.append(i)
listaAdc.append(j)
listaAdc.append(k)
listaAdc.append(l)
for m in dados5:
listaAdc.append(m)
telaProduto.tableWidget_cadastro_2.setRowCount(len(listaAdc))
telaProduto.tableWidget_cadastro_2.setColumnCount(4)
for i in range(0, len(listaAdc)):
for j in range(4):
telaProduto.tableWidget_cadastro_2.setItem(i, j, QtWidgets.QTableWidgetItem(str(listaAdc[i][j]))) | def mostra_adicionais(*args):
tela_produto = args[0]
cursor = args[1]
qt_widgets = args[2]
telaProduto.frame_adc.show()
lista_adc = []
sql1 = 'select * from adcBroto'
cursor.execute(sql1)
dados1 = cursor.fetchall()
sql2 = 'select * from adcSeis '
cursor.execute(sql2)
dados2 = cursor.fetchall()
sql3 = 'select * from adcOito'
cursor.execute(sql3)
dados3 = cursor.fetchall()
sql4 = 'select * from adcDez'
cursor.execute(sql4)
dados4 = cursor.fetchall()
slq5 = 'select * from adcSem'
cursor.execute(slq5)
dados5 = cursor.fetchall()
for (i, j, k, l) in zip(dados1, dados2, dados3, dados4):
listaAdc.append(i)
listaAdc.append(j)
listaAdc.append(k)
listaAdc.append(l)
for m in dados5:
listaAdc.append(m)
telaProduto.tableWidget_cadastro_2.setRowCount(len(listaAdc))
telaProduto.tableWidget_cadastro_2.setColumnCount(4)
for i in range(0, len(listaAdc)):
for j in range(4):
telaProduto.tableWidget_cadastro_2.setItem(i, j, QtWidgets.QTableWidgetItem(str(listaAdc[i][j]))) |
"""
describe all supported datasets.
"""
DATASET_LSUN = 0x00010000
DATASET_LSUN_BEDROOM_TRAINING = DATASET_LSUN + 0x00000000
DATASET_LSUN_BEDROOM_VALIDATION = DATASET_LSUN + 0x00000001
DATASET_LSUN_BRIDGE_TRAINING = DATASET_LSUN + 0x00000002
DATASET_LSUN_BRIDGE_VALIDATION = DATASET_LSUN + 0x00000003
DATASET_LSUN_CHURCH_OUTDOOR_TRAINING = DATASET_LSUN + 0x00000004
DATASET_LSUN_CHURCH_OUTDOOR_VALIDATION = DATASET_LSUN + 0x00000005
DATASET_LSUN_CLASSROOM_TRAINING = DATASET_LSUN + 0x00000006
DATASET_LSUN_CLASSROOM_VALIDATION = DATASET_LSUN + 0x00000007
DATASET_LSUN_CONFERENCE_ROOM_TRAINING = DATASET_LSUN + 0x00000008
DATASET_LSUN_CONFERENCE_ROOM_VALIDATION = DATASET_LSUN + 0x00000009
DATASET_LSUN_DINING_ROOM_TRAINING = DATASET_LSUN + 0x0000000a
DATASET_LSUN_DINING_ROOM_VALIDATION = DATASET_LSUN + 0x0000000b
DATASET_LSUN_KITCHEN_TRAINING = DATASET_LSUN + 0x0000000c
DATASET_LSUN_KITCHEN_VALIDATION = DATASET_LSUN + 0x0000000d
DATASET_LSUN_LIVING_ROOM_TRAINING = DATASET_LSUN + 0x0000000e
DATASET_LSUN_LIVING_ROOM_VALIDATION = DATASET_LSUN + 0x0000000f
DATASET_LSUN_RESTAURANT_TRAINING = DATASET_LSUN + 0x00000010
DATASET_LSUN_RESTAURANT_VALIDATION = DATASET_LSUN + 0x00000011
DATASET_LSUN_TOWER_TRAINING = DATASET_LSUN + 0x00000012
DATASET_LSUN_TOWER_VALIDATION = DATASET_LSUN + 0x00000013
DATASET_LSUN_TEST = DATASET_LSUN + 0x00000014
DATASET_MNIST = 0x00020000
DATASET_MNIST_TRAINING = DATASET_MNIST + 0x00000000
DATASET_MNIST_TEST = DATASET_MNIST + 0x00000001
DATASET_CIFAR_10 = 0x00030000
DATASET_CIFAR_10_TRAINING = DATASET_CIFAR_10 + 0x00000000
DATASET_CIFAR_10_TEST = DATASET_CIFAR_10 + 0x00000001
DATASET_KAGGLE_MNIST = 0x00040000
DATASET_KAGGLE_MNIST_TRAINING = DATASET_KAGGLE_MNIST + 0x00000000
DATASET_KAGGLE_MNIST_TEST = DATASET_KAGGLE_MNIST + 0x00000001
LABEL_INVALID = -1
# https://github.com/fyu/lsun/blob/master/category_indices.txt
LABEL_LSUN_BEDROOM = 0
LABEL_LSUN_BRIDGE = 1
LABEL_LSUN_CHURCH_OUTDOOR = 2
LABEL_LSUN_CLASSROOM = 3
LABEL_LSUN_CONFERENCE_ROOM = 4
LABEL_LSUN_DINING_ROOM = 5
LABEL_LSUN_KITCHEN = 6
LABEL_LSUN_LIVING_ROOM = 7
LABEL_LSUN_RESTAURANT = 8
LABEL_LSUN_TOWER = 9
LABEL_MNIST_0 = 0
LABEL_MNIST_1 = 1
LABEL_MNIST_2 = 2
LABEL_MNIST_3 = 3
LABEL_MNIST_4 = 4
LABEL_MNIST_5 = 5
LABEL_MNIST_6 = 6
LABEL_MNIST_7 = 7
LABEL_MNIST_8 = 8
LABEL_MNIST_9 = 9
LABEL_KAGGLE_MNIST_0 = 0
LABEL_KAGGLE_MNIST_1 = 1
LABEL_KAGGLE_MNIST_2 = 2
LABEL_KAGGLE_MNIST_3 = 3
LABEL_KAGGLE_MNIST_4 = 4
LABEL_KAGGLE_MNIST_5 = 5
LABEL_KAGGLE_MNIST_6 = 6
LABEL_KAGGLE_MNIST_7 = 7
LABEL_KAGGLE_MNIST_8 = 8
LABEL_KAGGLE_MNIST_9 = 9
| """
describe all supported datasets.
"""
dataset_lsun = 65536
dataset_lsun_bedroom_training = DATASET_LSUN + 0
dataset_lsun_bedroom_validation = DATASET_LSUN + 1
dataset_lsun_bridge_training = DATASET_LSUN + 2
dataset_lsun_bridge_validation = DATASET_LSUN + 3
dataset_lsun_church_outdoor_training = DATASET_LSUN + 4
dataset_lsun_church_outdoor_validation = DATASET_LSUN + 5
dataset_lsun_classroom_training = DATASET_LSUN + 6
dataset_lsun_classroom_validation = DATASET_LSUN + 7
dataset_lsun_conference_room_training = DATASET_LSUN + 8
dataset_lsun_conference_room_validation = DATASET_LSUN + 9
dataset_lsun_dining_room_training = DATASET_LSUN + 10
dataset_lsun_dining_room_validation = DATASET_LSUN + 11
dataset_lsun_kitchen_training = DATASET_LSUN + 12
dataset_lsun_kitchen_validation = DATASET_LSUN + 13
dataset_lsun_living_room_training = DATASET_LSUN + 14
dataset_lsun_living_room_validation = DATASET_LSUN + 15
dataset_lsun_restaurant_training = DATASET_LSUN + 16
dataset_lsun_restaurant_validation = DATASET_LSUN + 17
dataset_lsun_tower_training = DATASET_LSUN + 18
dataset_lsun_tower_validation = DATASET_LSUN + 19
dataset_lsun_test = DATASET_LSUN + 20
dataset_mnist = 131072
dataset_mnist_training = DATASET_MNIST + 0
dataset_mnist_test = DATASET_MNIST + 1
dataset_cifar_10 = 196608
dataset_cifar_10_training = DATASET_CIFAR_10 + 0
dataset_cifar_10_test = DATASET_CIFAR_10 + 1
dataset_kaggle_mnist = 262144
dataset_kaggle_mnist_training = DATASET_KAGGLE_MNIST + 0
dataset_kaggle_mnist_test = DATASET_KAGGLE_MNIST + 1
label_invalid = -1
label_lsun_bedroom = 0
label_lsun_bridge = 1
label_lsun_church_outdoor = 2
label_lsun_classroom = 3
label_lsun_conference_room = 4
label_lsun_dining_room = 5
label_lsun_kitchen = 6
label_lsun_living_room = 7
label_lsun_restaurant = 8
label_lsun_tower = 9
label_mnist_0 = 0
label_mnist_1 = 1
label_mnist_2 = 2
label_mnist_3 = 3
label_mnist_4 = 4
label_mnist_5 = 5
label_mnist_6 = 6
label_mnist_7 = 7
label_mnist_8 = 8
label_mnist_9 = 9
label_kaggle_mnist_0 = 0
label_kaggle_mnist_1 = 1
label_kaggle_mnist_2 = 2
label_kaggle_mnist_3 = 3
label_kaggle_mnist_4 = 4
label_kaggle_mnist_5 = 5
label_kaggle_mnist_6 = 6
label_kaggle_mnist_7 = 7
label_kaggle_mnist_8 = 8
label_kaggle_mnist_9 = 9 |
#!/usr/bin/env pyrate
foo_obj = object_file('foo_obj', ['foo.cpp'], compiler_opts = '-O3')
executable('example07.bin', ['test.cpp', foo_obj])
| foo_obj = object_file('foo_obj', ['foo.cpp'], compiler_opts='-O3')
executable('example07.bin', ['test.cpp', foo_obj]) |
#! /usr/bin/python
Ada, C, GUI, SIMULINK, VHDL, OG, RTDS, SYSTEM_C, SCADE6, VDM, CPP = range(11)
thread, passive, unknown = range(3)
PI, RI = range(2)
synch, asynch = range(2)
param_in, param_out = range(2)
UPER, NATIVE, ACN = range(3)
cyclic, sporadic, variator, protected, unprotected = range(5)
enumerated, sequenceof, sequence, set, setof, integer, boolean, real, choice, octetstring, string = range(11)
functions = {}
functions['joystickdriver'] = {
'name_with_case' : 'JoystickDriver',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['joystickdriver']['interfaces']['step'] = {
'port_name': 'step',
'parent_fv': 'joystickdriver',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': cyclic,
'period': 100,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['joystickdriver']['interfaces']['step']['paramsInOrdered'] = []
functions['joystickdriver']['interfaces']['step']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd'] = {
'port_name': 'cmd',
'parent_fv': 'joystickdriver',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'cmddispatcher',
'calling_threads': {},
'distant_name': 'cmd',
'queue_size': 1
}
functions['joystickdriver']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['joystickdriver']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'cmd',
'param_direction': param_in
}
functions['cmddispatcher'] = {
'name_with_case' : 'CmdDispatcher',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['cmddispatcher']['interfaces']['cmd'] = {
'port_name': 'cmd',
'parent_fv': 'cmddispatcher',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'cmd',
'param_direction': param_in
}
functions['cmddispatcher']['interfaces']['log_cmd'] = {
'port_name': 'log_cmd',
'parent_fv': 'cmddispatcher',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'logger',
'calling_threads': {},
'distant_name': 'log_cmd',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['log_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'log_cmd',
'param_direction': param_in
}
functions['cmddispatcher']['interfaces']['test_cmd'] = {
'port_name': 'test_cmd',
'parent_fv': 'cmddispatcher',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'watchdog',
'calling_threads': {},
'distant_name': 'test_cmd',
'queue_size': 1
}
functions['cmddispatcher']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['test_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'test_cmd',
'param_direction': param_in
}
functions['watchdog'] = {
'name_with_case' : 'Watchdog',
'runtime_nature': thread,
'language': CPP,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['watchdog']['interfaces']['test_cmd'] = {
'port_name': 'test_cmd',
'parent_fv': 'watchdog',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['watchdog']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['test_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'test_cmd',
'param_direction': param_in
}
functions['watchdog']['interfaces']['purge'] = {
'port_name': 'purge',
'parent_fv': 'watchdog',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': cyclic,
'period': 80,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['watchdog']['interfaces']['purge']['paramsInOrdered'] = []
functions['watchdog']['interfaces']['purge']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd'] = {
'port_name': 'mot_cmd',
'parent_fv': 'watchdog',
'direction': RI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 0,
'wcet_low': 0,
'wcet_low_unit': '',
'wcet_high': 0,
'wcet_high_unit': '',
'distant_fv': 'blsclient',
'calling_threads': {},
'distant_name': 'mot_cmd',
'queue_size': 1
}
functions['watchdog']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'mot_cmd',
'param_direction': param_in
}
functions['logger'] = {
'name_with_case' : 'Logger',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['logger']['interfaces']['log_cmd'] = {
'port_name': 'log_cmd',
'parent_fv': 'logger',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['logger']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['logger']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['logger']['interfaces']['log_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'log_cmd',
'param_direction': param_in
}
functions['blsclient'] = {
'name_with_case' : 'BLSClient',
'runtime_nature': thread,
'language': OG,
'zipfile': '',
'interfaces': {},
'functional_states' : {}
}
functions['blsclient']['interfaces']['mot_cmd'] = {
'port_name': 'mot_cmd',
'parent_fv': 'blsclient',
'direction': PI,
'in': {},
'out': {},
'synchronism': asynch,
'rcm': sporadic,
'period': 10,
'wcet_low': 0,
'wcet_low_unit': 'ms',
'wcet_high': 10,
'wcet_high_unit': 'ms',
'distant_fv': '',
'calling_threads': {},
'distant_name': '',
'queue_size': 1
}
functions['blsclient']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['blsclient']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['blsclient']['interfaces']['mot_cmd']['in']['cmd_val'] = {
'type': 'Base_commands_Motion2D',
'asn1_module': 'Base_Types',
'basic_type': sequence,
'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn',
'encoding': NATIVE,
'interface': 'mot_cmd',
'param_direction': param_in
}
| (ada, c, gui, simulink, vhdl, og, rtds, system_c, scade6, vdm, cpp) = range(11)
(thread, passive, unknown) = range(3)
(pi, ri) = range(2)
(synch, asynch) = range(2)
(param_in, param_out) = range(2)
(uper, native, acn) = range(3)
(cyclic, sporadic, variator, protected, unprotected) = range(5)
(enumerated, sequenceof, sequence, set, setof, integer, boolean, real, choice, octetstring, string) = range(11)
functions = {}
functions['joystickdriver'] = {'name_with_case': 'JoystickDriver', 'runtime_nature': thread, 'language': OG, 'zipfile': '', 'interfaces': {}, 'functional_states': {}}
functions['joystickdriver']['interfaces']['step'] = {'port_name': 'step', 'parent_fv': 'joystickdriver', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': cyclic, 'period': 100, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['joystickdriver']['interfaces']['step']['paramsInOrdered'] = []
functions['joystickdriver']['interfaces']['step']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd'] = {'port_name': 'cmd', 'parent_fv': 'joystickdriver', 'direction': RI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 0, 'wcet_low': 0, 'wcet_low_unit': '', 'wcet_high': 0, 'wcet_high_unit': '', 'distant_fv': 'cmddispatcher', 'calling_threads': {}, 'distant_name': 'cmd', 'queue_size': 1}
functions['joystickdriver']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['joystickdriver']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['joystickdriver']['interfaces']['cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'cmd', 'param_direction': param_in}
functions['cmddispatcher'] = {'name_with_case': 'CmdDispatcher', 'runtime_nature': thread, 'language': OG, 'zipfile': '', 'interfaces': {}, 'functional_states': {}}
functions['cmddispatcher']['interfaces']['cmd'] = {'port_name': 'cmd', 'parent_fv': 'cmddispatcher', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 10, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['cmddispatcher']['interfaces']['cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'cmd', 'param_direction': param_in}
functions['cmddispatcher']['interfaces']['log_cmd'] = {'port_name': 'log_cmd', 'parent_fv': 'cmddispatcher', 'direction': RI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 0, 'wcet_low': 0, 'wcet_low_unit': '', 'wcet_high': 0, 'wcet_high_unit': '', 'distant_fv': 'logger', 'calling_threads': {}, 'distant_name': 'log_cmd', 'queue_size': 1}
functions['cmddispatcher']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['log_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'log_cmd', 'param_direction': param_in}
functions['cmddispatcher']['interfaces']['test_cmd'] = {'port_name': 'test_cmd', 'parent_fv': 'cmddispatcher', 'direction': RI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 0, 'wcet_low': 0, 'wcet_low_unit': '', 'wcet_high': 0, 'wcet_high_unit': '', 'distant_fv': 'watchdog', 'calling_threads': {}, 'distant_name': 'test_cmd', 'queue_size': 1}
functions['cmddispatcher']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['cmddispatcher']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['cmddispatcher']['interfaces']['test_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'test_cmd', 'param_direction': param_in}
functions['watchdog'] = {'name_with_case': 'Watchdog', 'runtime_nature': thread, 'language': CPP, 'zipfile': '', 'interfaces': {}, 'functional_states': {}}
functions['watchdog']['interfaces']['test_cmd'] = {'port_name': 'test_cmd', 'parent_fv': 'watchdog', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 10, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['watchdog']['interfaces']['test_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['test_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['test_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'test_cmd', 'param_direction': param_in}
functions['watchdog']['interfaces']['purge'] = {'port_name': 'purge', 'parent_fv': 'watchdog', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': cyclic, 'period': 80, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['watchdog']['interfaces']['purge']['paramsInOrdered'] = []
functions['watchdog']['interfaces']['purge']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd'] = {'port_name': 'mot_cmd', 'parent_fv': 'watchdog', 'direction': RI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 0, 'wcet_low': 0, 'wcet_low_unit': '', 'wcet_high': 0, 'wcet_high_unit': '', 'distant_fv': 'blsclient', 'calling_threads': {}, 'distant_name': 'mot_cmd', 'queue_size': 1}
functions['watchdog']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['watchdog']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['watchdog']['interfaces']['mot_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'mot_cmd', 'param_direction': param_in}
functions['logger'] = {'name_with_case': 'Logger', 'runtime_nature': thread, 'language': OG, 'zipfile': '', 'interfaces': {}, 'functional_states': {}}
functions['logger']['interfaces']['log_cmd'] = {'port_name': 'log_cmd', 'parent_fv': 'logger', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 10, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['logger']['interfaces']['log_cmd']['paramsInOrdered'] = ['cmd_val']
functions['logger']['interfaces']['log_cmd']['paramsOutOrdered'] = []
functions['logger']['interfaces']['log_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'log_cmd', 'param_direction': param_in}
functions['blsclient'] = {'name_with_case': 'BLSClient', 'runtime_nature': thread, 'language': OG, 'zipfile': '', 'interfaces': {}, 'functional_states': {}}
functions['blsclient']['interfaces']['mot_cmd'] = {'port_name': 'mot_cmd', 'parent_fv': 'blsclient', 'direction': PI, 'in': {}, 'out': {}, 'synchronism': asynch, 'rcm': sporadic, 'period': 10, 'wcet_low': 0, 'wcet_low_unit': 'ms', 'wcet_high': 10, 'wcet_high_unit': 'ms', 'distant_fv': '', 'calling_threads': {}, 'distant_name': '', 'queue_size': 1}
functions['blsclient']['interfaces']['mot_cmd']['paramsInOrdered'] = ['cmd_val']
functions['blsclient']['interfaces']['mot_cmd']['paramsOutOrdered'] = []
functions['blsclient']['interfaces']['mot_cmd']['in']['cmd_val'] = {'type': 'Base_commands_Motion2D', 'asn1_module': 'Base_Types', 'basic_type': sequence, 'asn1_filename': '/home/taste/esrocos_workspace/tutorial_integration_bip/dataview-uniq.asn', 'encoding': NATIVE, 'interface': 'mot_cmd', 'param_direction': param_in} |
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'futures',
'step',
]
def RunSteps(api):
futures = []
for i in range(10):
def _runner(i):
api.step(
'sleep loop [%d]' % (i+1),
['python3', '-u', api.resource('sleep_loop.py'), i],
cost=api.step.ResourceCost(),
)
return i + 1
futures.append(api.futures.spawn(_runner, i))
for helper in api.futures.iwait(futures):
api.step('Sleeper %d complete' % helper.result(), cmd=None)
def GenTests(api):
yield api.test('basic')
| python_version_compatibility = 'PY2+3'
deps = ['futures', 'step']
def run_steps(api):
futures = []
for i in range(10):
def _runner(i):
api.step('sleep loop [%d]' % (i + 1), ['python3', '-u', api.resource('sleep_loop.py'), i], cost=api.step.ResourceCost())
return i + 1
futures.append(api.futures.spawn(_runner, i))
for helper in api.futures.iwait(futures):
api.step('Sleeper %d complete' % helper.result(), cmd=None)
def gen_tests(api):
yield api.test('basic') |
"""
hello module
"""
__version__ = '0.7.0dev'
| """
hello module
"""
__version__ = '0.7.0dev' |
'''Defines the `google_java_format_toolchain` rule.
'''
GoogleJavaFormatToolchainInfo = provider(
fields = {
"google_java_format_deploy_jar": "A JAR `File` containing Google Java Format and all of its run-time dependencies.",
"colordiff_executable": "A `File` pointing to `colordiff` executable (in the host configuration)."
},
)
def _google_java_format_toolchain_impl(ctx):
toolchain_info = platform_common.ToolchainInfo(
google_java_format_toolchain_info = GoogleJavaFormatToolchainInfo(
google_java_format_deploy_jar = ctx.file.google_java_format_deploy_jar,
colordiff_executable = ctx.file.colordiff_executable,
),
)
return [toolchain_info]
google_java_format_toolchain = rule(
implementation = _google_java_format_toolchain_impl,
attrs = {
"google_java_format_deploy_jar": attr.label(
allow_single_file = True,
mandatory = True,
executable = True,
cfg = "host",
),
"colordiff_executable": attr.label(
allow_single_file = True,
mandatory = True,
executable = True,
cfg = "host",
),
},
)
| """Defines the `google_java_format_toolchain` rule.
"""
google_java_format_toolchain_info = provider(fields={'google_java_format_deploy_jar': 'A JAR `File` containing Google Java Format and all of its run-time dependencies.', 'colordiff_executable': 'A `File` pointing to `colordiff` executable (in the host configuration).'})
def _google_java_format_toolchain_impl(ctx):
toolchain_info = platform_common.ToolchainInfo(google_java_format_toolchain_info=google_java_format_toolchain_info(google_java_format_deploy_jar=ctx.file.google_java_format_deploy_jar, colordiff_executable=ctx.file.colordiff_executable))
return [toolchain_info]
google_java_format_toolchain = rule(implementation=_google_java_format_toolchain_impl, attrs={'google_java_format_deploy_jar': attr.label(allow_single_file=True, mandatory=True, executable=True, cfg='host'), 'colordiff_executable': attr.label(allow_single_file=True, mandatory=True, executable=True, cfg='host')}) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: lilatomic.api.http
short_description: A nice and friendly HTTP API
description:
- An easy way to use the [requests](https://docs.python-requests.org/en/master/) library to make HTTP requests
- Define connections and re-use them across tasks
version_added: "0.1.0"
options:
connection:
description: the name of the connection to use
required: true
type: string
method:
description: the HTTP method to use
required: true
default: GET
type: string
path:
description: the slug to join to the connection's base
data:
description: object to send in the body of the request.
required: false
type: string or dict
json:
description: json data to send in the body of the request.
required: false
type: string or dict
headers:
description: HTTP headers for the request
required: false
type: dict
default: dict()
status_code:
description: acceptable status codes
required: false
default: requests default, status_code < 400
type: list
elements: int
timeout:
description: timeout in seconds of the request
required: false
default: 15
type: float
log_request:
description: returns information about the request. Useful for debugging. Censors Authorization header unless log_auth is used.
required: false
default: false
type: bool
log_auth:
description: uncensors the Authorization header.
required: false
default: false
type: bool
kwargs:
description: Access hatch for passing kwargs to the requests.request method. Recursively merged with and overrides kwargs set on the connection.
required: false
default: None
type: dict
"""
EXAMPLES = """
---
- name: post
lilatomic.api.http:
connection: httpbin
method: POST
path: /post
data:
1: 1
2: 2
vars:
lilatomic_api_http:
httpbin:
base: "https://httpbingo.org/"
- name: GET with logging of the request
lilatomic.api.http:
connection: fishbike
path: /
log_request: true
vars:
lilatomic_api_http:
httpbin:
base: "https://httpbingo.org/"
- name: GET with Bearer auth
lilatomic.api.http:
connection: httpbin_bearer
path: /bearer
log_request: true
log_auth: true
vars:
lilatomic_api_http:
httpbin_bearer:
base: "https://httpbin.org"
auth:
method: bearer
token: hihello
- name: Use Kwargs for disallowing redirects
lilatomic.api.http:
connection: httpbin
path: redirect-to?url=get
kwargs:
allow_redirects: false
status_code: [ 302 ]
vars:
lilatomic_api_http:
httpbin:
base: "https://httpbingo.org/"
"""
RETURN = """
---
json:
description: json body
returned: response has headers Content-Type == "application/json"
type: complex
sample: {
"authenticated": true,
"token": "hihello"
}
content:
description: response.content
returned: always
type: str
sample: |
{\\n "authenticated": true, \\n "token": "hihello"\\n}\\n
msg:
description: response body
returned: always
type: str
sample: |
{\\n "authenticated": true, \\n "token": "hihello"\\n}\\n
content-length:
description: response Content-Length header
returned: always
type: int
sample: 51
content-type:
description: response Content-Type header
returned: always
type: string
sample: "application/json"
cookies:
description: the cookies from the response
returned: always
type: dict
sample: { }
date:
description: response Date header
returned: always
type: str
sample: "Sat, 10 Jul 2021 23:14:14 GMT"
elapsed:
description: seconds elapsed making the request
returned: always
type: int
sample: 0
redirected:
description: if response was redirected
returned: always
type: bool
sample: false
server:
description: response Server header
returned: always
type: str
sample: "gunicorn/19.9.0"
status:
description: response status code; alias for status_code
returned: always
type: str
sample: 200
url:
description: the URL from the response
returned: always
type: str
sample: "https://httpbin.org/bearer"
encoding:
description: response encoding
returned: always
type: str
sample: "utf-8"
headers:
description: response headers
returned: always
type: dict
elements: str
sample: {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Origin": "*",
"Connection": "keep-alive",
"Content-Length": "51",
"Content-Type": "application/json",
"Date": "Sat, 10 Jul 2021 23:14:14 GMT",
"Server": "gunicorn/19.9.0"
}
reason:
description: response status reason
returned: always
type: str
sample: "OK"
status_code:
description: response status code
returned: always
type: str
sample: 200
request:
description: the original request, useful for debugging
returned: when log_request == true
type: complex
contains:
body:
description: request body
returned: always
type: str
headers:
description: request headers. Authorization will be censored unless `log_auth` == true
returned: always
type: dict
elements: str
method:
description: request HTTP method
returned: always
type: str
path_url:
description: request path url; the part of the url which is called the path; that's its technical name
returned: always
type: str
url:
description: the full url
returned: always
type: str
sample: {
"body": null,
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Authorization": "Bearer hihello",
"Connection": "keep-alive",
"User-Agent": "python-requests/2.25.1"
},
"method": "GET",
"path_url": "/bearer",
"url": "https://httpbin.org/bearer"
}
""" | documentation = '\n---\nmodule: lilatomic.api.http\nshort_description: A nice and friendly HTTP API\ndescription:\n - An easy way to use the [requests](https://docs.python-requests.org/en/master/) library to make HTTP requests\n - Define connections and re-use them across tasks\nversion_added: "0.1.0"\noptions:\n connection:\n description: the name of the connection to use\n required: true\n type: string\n method:\n description: the HTTP method to use\n required: true\n default: GET\n type: string\n path:\n description: the slug to join to the connection\'s base\n data:\n description: object to send in the body of the request.\n required: false\n type: string or dict\n json:\n description: json data to send in the body of the request.\n required: false\n type: string or dict\n headers:\n description: HTTP headers for the request\n required: false\n type: dict\n default: dict()\n status_code:\n description: acceptable status codes\n required: false\n default: requests default, status_code < 400\n type: list\n elements: int\n timeout:\n description: timeout in seconds of the request\n required: false\n default: 15\n type: float\n log_request:\n description: returns information about the request. Useful for debugging. Censors Authorization header unless log_auth is used.\n required: false\n default: false\n type: bool\n log_auth:\n description: uncensors the Authorization header.\n required: false\n default: false\n type: bool\n kwargs:\n description: Access hatch for passing kwargs to the requests.request method. Recursively merged with and overrides kwargs set on the connection.\n required: false\n default: None\n type: dict\n'
examples = '\n---\n- name: post\n lilatomic.api.http:\n connection: httpbin\n method: POST\n path: /post\n data:\n 1: 1\n 2: 2\n vars:\n lilatomic_api_http:\n httpbin:\n base: "https://httpbingo.org/"\n\n- name: GET with logging of the request\n lilatomic.api.http:\n connection: fishbike\n path: /\n log_request: true\n vars:\n lilatomic_api_http:\n httpbin:\n base: "https://httpbingo.org/"\n\n- name: GET with Bearer auth\n lilatomic.api.http:\n connection: httpbin_bearer\n path: /bearer\n log_request: true\n log_auth: true\n vars:\n lilatomic_api_http:\n httpbin_bearer:\n base: "https://httpbin.org"\n auth:\n method: bearer\n token: hihello\n\n- name: Use Kwargs for disallowing redirects\n lilatomic.api.http:\n connection: httpbin\n path: redirect-to?url=get\n kwargs:\n allow_redirects: false\n status_code: [ 302 ]\n vars:\n lilatomic_api_http:\n httpbin:\n base: "https://httpbingo.org/"\n'
return = '\n---\njson:\n description: json body\n returned: response has headers Content-Type == "application/json"\n type: complex\n sample: {\n "authenticated": true,\n "token": "hihello"\n }\ncontent:\n description: response.content\n returned: always\n type: str\n sample: |\n {\\n "authenticated": true, \\n "token": "hihello"\\n}\\n\nmsg:\n description: response body\n returned: always\n type: str\n sample: |\n {\\n "authenticated": true, \\n "token": "hihello"\\n}\\n\ncontent-length:\n description: response Content-Length header\n returned: always\n type: int\n sample: 51\ncontent-type:\n description: response Content-Type header\n returned: always\n type: string\n sample: "application/json"\ncookies:\n description: the cookies from the response\n returned: always\n type: dict\n sample: { }\ndate:\n description: response Date header\n returned: always\n type: str\n sample: "Sat, 10 Jul 2021 23:14:14 GMT"\nelapsed:\n description: seconds elapsed making the request\n returned: always\n type: int\n sample: 0\nredirected:\n description: if response was redirected\n returned: always\n type: bool\n sample: false\nserver:\n description: response Server header\n returned: always\n type: str\n sample: "gunicorn/19.9.0"\nstatus:\n description: response status code; alias for status_code\n returned: always\n type: str\n sample: 200\nurl:\n description: the URL from the response\n returned: always\n type: str\n sample: "https://httpbin.org/bearer"\nencoding:\n description: response encoding\n returned: always\n type: str\n sample: "utf-8"\nheaders:\n description: response headers\n returned: always\n type: dict\n elements: str\n sample: {\n "Access-Control-Allow-Credentials": "true",\n "Access-Control-Allow-Origin": "*",\n "Connection": "keep-alive",\n "Content-Length": "51",\n "Content-Type": "application/json",\n "Date": "Sat, 10 Jul 2021 23:14:14 GMT",\n "Server": "gunicorn/19.9.0"\n }\nreason:\n description: response status reason\n returned: always\n type: str\n sample: "OK"\nstatus_code:\n description: response status code\n returned: always\n type: str\n sample: 200\nrequest:\n description: the original request, useful for debugging\n returned: when log_request == true\n type: complex\n contains:\n body:\n description: request body\n returned: always\n type: str\n headers:\n description: request headers. Authorization will be censored unless `log_auth` == true\n returned: always\n type: dict\n elements: str\n method:\n description: request HTTP method\n returned: always\n type: str\n path_url:\n description: request path url; the part of the url which is called the path; that\'s its technical name\n returned: always\n type: str\n url:\n description: the full url\n returned: always\n type: str\n sample: {\n "body": null,\n "headers": {\n "Accept": "*/*",\n "Accept-Encoding": "gzip, deflate",\n "Authorization": "Bearer hihello",\n "Connection": "keep-alive",\n "User-Agent": "python-requests/2.25.1"\n },\n "method": "GET",\n "path_url": "/bearer",\n "url": "https://httpbin.org/bearer"\n }\n' |
def getScore(savings, monthly, bills, cost, payDay):
score = 0
if cost > savings:
score = 0
elif savings < 1000:
score = savings/pow(cost,1.1)
else:
a = savings/(cost*1.1)
score += (1300*(monthly-bills))/(max(1,a)*pow(cost,1.1)*pow(payDay,0.8)) + (30*savings)/(pow(cost,1.1))
score = round(score/100,2)
if score > 10:
score = 9.99
return score
'''
while True:
savings = int(input("savings"))
monthly = int(input("monthly"))
bills = int(input("bills per month"))
cost = int(input("cost"))
payDay = int(input("days until next pay")) #days until next payday
print(getScore(savings, monthly, bills, cost, payDay))
#score += ((monthly - bills)/(max(1,(pow(a,1.5))*1.2))/cost)*(700/payDay)
#score = (4840*monthly)/(savings*pow(payDay,0.8)*pow(cost,0.1)) + (70*savings) / (cost*1.1)
'''
| def get_score(savings, monthly, bills, cost, payDay):
score = 0
if cost > savings:
score = 0
elif savings < 1000:
score = savings / pow(cost, 1.1)
else:
a = savings / (cost * 1.1)
score += 1300 * (monthly - bills) / (max(1, a) * pow(cost, 1.1) * pow(payDay, 0.8)) + 30 * savings / pow(cost, 1.1)
score = round(score / 100, 2)
if score > 10:
score = 9.99
return score
'\nwhile True:\n savings = int(input("savings"))\n monthly = int(input("monthly"))\n bills = int(input("bills per month"))\n cost = int(input("cost"))\n payDay = int(input("days until next pay")) #days until next payday\n print(getScore(savings, monthly, bills, cost, payDay))\n\n #score += ((monthly - bills)/(max(1,(pow(a,1.5))*1.2))/cost)*(700/payDay)\n #score = (4840*monthly)/(savings*pow(payDay,0.8)*pow(cost,0.1)) + (70*savings) / (cost*1.1)\n' |
#!/usr/bin/env python
# Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
'''Test instances data.'''
FAKE_API_RESPONSE1 = [
{
'kind': 'compute#instance',
'id': '6440513679799924564',
'creationTimestamp': '2017-05-26T22:08:11.094-07:00',
'name': 'iap-ig-79bj',
'tags': {
'items': [
'iap-tag'
],
'fingerprint': 'gilEhx3hEXk='
},
'machineType': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro',
'status': 'RUNNING',
'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c',
'canIpForward': False,
'networkInterfaces': [
{
'kind': 'compute#networkInterface',
'network': 'https://www.googleapis.com/compute/v1/projects/project1/global/networks/default',
'subnetwork': 'https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default',
'networkIP': '10.128.0.2',
'name': 'nic0',
'accessConfigs': [
{
'kind': 'compute#accessConfig',
'type': 'ONE_TO_ONE_NAT',
'name': 'External NAT',
'natIP': '104.198.131.130'
}
]
}
],
'disks': [
{
'kind': 'compute#attachedDisk',
'type': 'PERSISTENT',
'mode': 'READ_WRITE',
'source': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj',
'deviceName': 'iap-it-1',
'index': 0,
'boot': True,
'autoDelete': True,
'licenses': [
'https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie'
],
'interface': 'SCSI'
}
],
'metadata': {
'kind': 'compute#metadata',
'fingerprint': '3MpZMMvDTyo=',
'items': [
{
'key': 'instance-template',
'value': 'projects/600687511243/global/instanceTemplates/iap-it-1'
},
{
'key': 'created-by',
'value': 'projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig'
}
]
},
'serviceAccounts': [
{
'email': '600687511243-compute@developer.gserviceaccount.com',
'scopes': [
'https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/logging.write',
'https://www.googleapis.com/auth/monitoring.write',
'https://www.googleapis.com/auth/servicecontrol',
'https://www.googleapis.com/auth/service.management.readonly',
'https://www.googleapis.com/auth/trace.append'
]
}
],
'selfLink': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj',
'scheduling': {
'onHostMaintenance': 'MIGRATE',
'automaticRestart': True,
'preemptible': False
},
'cpuPlatform': 'Intel Haswell'
}
]
FAKE_API_RESPONSE2 = []
FAKE_PROJECT_INSTANCES_MAP = {
'project1': [
{
'kind': 'compute#instance',
'id': '6440513679799924564',
'creationTimestamp': '2017-05-26T22:08:11.094-07:00',
'name': 'iap-ig-79bj',
'tags': {
'items': [
'iap-tag'
],
'fingerprint': 'gilEhx3hEXk='
},
'machineType': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro',
'status': 'RUNNING',
'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c',
'canIpForward': False,
'networkInterfaces': [
{
'kind': 'compute#networkInterface',
'network': 'https://www.googleapis.com/compute/v1/projects/project1/global/networks/default',
'subnetwork': 'https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default',
'networkIP': '10.128.0.2',
'name': 'nic0',
'accessConfigs': [
{
'kind': 'compute#accessConfig',
'type': 'ONE_TO_ONE_NAT',
'name': 'External NAT',
'natIP': '104.198.131.130'
}
]
}
],
'disks': [
{
'kind': 'compute#attachedDisk',
'type': 'PERSISTENT',
'mode': 'READ_WRITE',
'source': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj',
'deviceName': 'iap-it-1',
'index': 0,
'boot': True,
'autoDelete': True,
'licenses': [
'https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie'
],
'interface': 'SCSI'
}
],
'metadata': {
'kind': 'compute#metadata',
'fingerprint': '3MpZMMvDTyo=',
'items': [
{
'key': 'instance-template',
'value': 'projects/600687511243/global/instanceTemplates/iap-it-1'
},
{
'key': 'created-by',
'value': 'projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig'
}
]
},
'serviceAccounts': [
{
'email': '600687511243-compute@developer.gserviceaccount.com',
'scopes': [
'https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/logging.write',
'https://www.googleapis.com/auth/monitoring.write',
'https://www.googleapis.com/auth/servicecontrol',
'https://www.googleapis.com/auth/service.management.readonly',
'https://www.googleapis.com/auth/trace.append'
]
}
],
'selfLink': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj',
'scheduling': {
'onHostMaintenance': 'MIGRATE',
'automaticRestart': True,
'preemptible': False
},
'cpuPlatform': 'Intel Haswell'
}
],
}
EXPECTED_LOADABLE_INSTANCES = [
{
'can_ip_forward': False,
'cpu_platform': 'Intel Haswell',
'creation_timestamp': '2017-05-26 22:08:11',
'description': None,
'disks': '[{"source": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj", "kind": "compute#attachedDisk", "mode": "READ_WRITE", "autoDelete": true, "deviceName": "iap-it-1", "licenses": ["https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie"], "index": 0, "interface": "SCSI", "boot": true, "type": "PERSISTENT"}]',
'id': '6440513679799924564',
'machine_type': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro',
'metadata': '{"items": [{"value": "projects/600687511243/global/instanceTemplates/iap-it-1", "key": "instance-template"}, {"value": "projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig", "key": "created-by"}], "kind": "compute#metadata", "fingerprint": "3MpZMMvDTyo="}',
'name': 'iap-ig-79bj',
'network_interfaces': '[{"kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/project1/global/networks/default", "accessConfigs": [{"kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "natIP": "104.198.131.130"}], "networkIP": "10.128.0.2", "subnetwork": "https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default", "name": "nic0"}]',
'project_id': 'project1',
'scheduling': '{"automaticRestart": true, "preemptible": false, "onHostMaintenance": "MIGRATE"}',
'service_accounts': '[{"scopes": ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append"], "email": "600687511243-compute@developer.gserviceaccount.com"}]',
'status': 'RUNNING',
'status_message': None,
'tags': '{"items": ["iap-tag"], "fingerprint": "gilEhx3hEXk="}',
'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c',
'raw_instance': '{"status": "RUNNING", "cpuPlatform": "Intel Haswell", "kind": "compute#instance", "machineType": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro", "name": "iap-ig-79bj", "zone": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c", "tags": {"items": ["iap-tag"], "fingerprint": "gilEhx3hEXk="}, "disks": [{"source": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj", "kind": "compute#attachedDisk", "mode": "READ_WRITE", "autoDelete": true, "deviceName": "iap-it-1", "licenses": ["https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie"], "index": 0, "interface": "SCSI", "boot": true, "type": "PERSISTENT"}], "scheduling": {"automaticRestart": true, "preemptible": false, "onHostMaintenance": "MIGRATE"}, "canIpForward": false, "serviceAccounts": [{"scopes": ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append"], "email": "600687511243-compute@developer.gserviceaccount.com"}], "metadata": {"items": [{"value": "projects/600687511243/global/instanceTemplates/iap-it-1", "key": "instance-template"}, {"value": "projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig", "key": "created-by"}], "kind": "compute#metadata", "fingerprint": "3MpZMMvDTyo="}, "creationTimestamp": "2017-05-26T22:08:11.094-07:00", "id": "6440513679799924564", "selfLink": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj", "networkInterfaces": [{"kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/project1/global/networks/default", "accessConfigs": [{"kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "natIP": "104.198.131.130"}], "networkIP": "10.128.0.2", "subnetwork": "https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default", "name": "nic0"}]}',
}
]
| """Test instances data."""
fake_api_response1 = [{'kind': 'compute#instance', 'id': '6440513679799924564', 'creationTimestamp': '2017-05-26T22:08:11.094-07:00', 'name': 'iap-ig-79bj', 'tags': {'items': ['iap-tag'], 'fingerprint': 'gilEhx3hEXk='}, 'machineType': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro', 'status': 'RUNNING', 'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c', 'canIpForward': False, 'networkInterfaces': [{'kind': 'compute#networkInterface', 'network': 'https://www.googleapis.com/compute/v1/projects/project1/global/networks/default', 'subnetwork': 'https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default', 'networkIP': '10.128.0.2', 'name': 'nic0', 'accessConfigs': [{'kind': 'compute#accessConfig', 'type': 'ONE_TO_ONE_NAT', 'name': 'External NAT', 'natIP': '104.198.131.130'}]}], 'disks': [{'kind': 'compute#attachedDisk', 'type': 'PERSISTENT', 'mode': 'READ_WRITE', 'source': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj', 'deviceName': 'iap-it-1', 'index': 0, 'boot': True, 'autoDelete': True, 'licenses': ['https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie'], 'interface': 'SCSI'}], 'metadata': {'kind': 'compute#metadata', 'fingerprint': '3MpZMMvDTyo=', 'items': [{'key': 'instance-template', 'value': 'projects/600687511243/global/instanceTemplates/iap-it-1'}, {'key': 'created-by', 'value': 'projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig'}]}, 'serviceAccounts': [{'email': '600687511243-compute@developer.gserviceaccount.com', 'scopes': ['https://www.googleapis.com/auth/devstorage.read_only', 'https://www.googleapis.com/auth/logging.write', 'https://www.googleapis.com/auth/monitoring.write', 'https://www.googleapis.com/auth/servicecontrol', 'https://www.googleapis.com/auth/service.management.readonly', 'https://www.googleapis.com/auth/trace.append']}], 'selfLink': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj', 'scheduling': {'onHostMaintenance': 'MIGRATE', 'automaticRestart': True, 'preemptible': False}, 'cpuPlatform': 'Intel Haswell'}]
fake_api_response2 = []
fake_project_instances_map = {'project1': [{'kind': 'compute#instance', 'id': '6440513679799924564', 'creationTimestamp': '2017-05-26T22:08:11.094-07:00', 'name': 'iap-ig-79bj', 'tags': {'items': ['iap-tag'], 'fingerprint': 'gilEhx3hEXk='}, 'machineType': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro', 'status': 'RUNNING', 'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c', 'canIpForward': False, 'networkInterfaces': [{'kind': 'compute#networkInterface', 'network': 'https://www.googleapis.com/compute/v1/projects/project1/global/networks/default', 'subnetwork': 'https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default', 'networkIP': '10.128.0.2', 'name': 'nic0', 'accessConfigs': [{'kind': 'compute#accessConfig', 'type': 'ONE_TO_ONE_NAT', 'name': 'External NAT', 'natIP': '104.198.131.130'}]}], 'disks': [{'kind': 'compute#attachedDisk', 'type': 'PERSISTENT', 'mode': 'READ_WRITE', 'source': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj', 'deviceName': 'iap-it-1', 'index': 0, 'boot': True, 'autoDelete': True, 'licenses': ['https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie'], 'interface': 'SCSI'}], 'metadata': {'kind': 'compute#metadata', 'fingerprint': '3MpZMMvDTyo=', 'items': [{'key': 'instance-template', 'value': 'projects/600687511243/global/instanceTemplates/iap-it-1'}, {'key': 'created-by', 'value': 'projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig'}]}, 'serviceAccounts': [{'email': '600687511243-compute@developer.gserviceaccount.com', 'scopes': ['https://www.googleapis.com/auth/devstorage.read_only', 'https://www.googleapis.com/auth/logging.write', 'https://www.googleapis.com/auth/monitoring.write', 'https://www.googleapis.com/auth/servicecontrol', 'https://www.googleapis.com/auth/service.management.readonly', 'https://www.googleapis.com/auth/trace.append']}], 'selfLink': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj', 'scheduling': {'onHostMaintenance': 'MIGRATE', 'automaticRestart': True, 'preemptible': False}, 'cpuPlatform': 'Intel Haswell'}]}
expected_loadable_instances = [{'can_ip_forward': False, 'cpu_platform': 'Intel Haswell', 'creation_timestamp': '2017-05-26 22:08:11', 'description': None, 'disks': '[{"source": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj", "kind": "compute#attachedDisk", "mode": "READ_WRITE", "autoDelete": true, "deviceName": "iap-it-1", "licenses": ["https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie"], "index": 0, "interface": "SCSI", "boot": true, "type": "PERSISTENT"}]', 'id': '6440513679799924564', 'machine_type': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro', 'metadata': '{"items": [{"value": "projects/600687511243/global/instanceTemplates/iap-it-1", "key": "instance-template"}, {"value": "projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig", "key": "created-by"}], "kind": "compute#metadata", "fingerprint": "3MpZMMvDTyo="}', 'name': 'iap-ig-79bj', 'network_interfaces': '[{"kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/project1/global/networks/default", "accessConfigs": [{"kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "natIP": "104.198.131.130"}], "networkIP": "10.128.0.2", "subnetwork": "https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default", "name": "nic0"}]', 'project_id': 'project1', 'scheduling': '{"automaticRestart": true, "preemptible": false, "onHostMaintenance": "MIGRATE"}', 'service_accounts': '[{"scopes": ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append"], "email": "600687511243-compute@developer.gserviceaccount.com"}]', 'status': 'RUNNING', 'status_message': None, 'tags': '{"items": ["iap-tag"], "fingerprint": "gilEhx3hEXk="}', 'zone': 'https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c', 'raw_instance': '{"status": "RUNNING", "cpuPlatform": "Intel Haswell", "kind": "compute#instance", "machineType": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/machineTypes/f1-micro", "name": "iap-ig-79bj", "zone": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c", "tags": {"items": ["iap-tag"], "fingerprint": "gilEhx3hEXk="}, "disks": [{"source": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/disks/iap-ig-79bj", "kind": "compute#attachedDisk", "mode": "READ_WRITE", "autoDelete": true, "deviceName": "iap-it-1", "licenses": ["https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-8-jessie"], "index": 0, "interface": "SCSI", "boot": true, "type": "PERSISTENT"}], "scheduling": {"automaticRestart": true, "preemptible": false, "onHostMaintenance": "MIGRATE"}, "canIpForward": false, "serviceAccounts": [{"scopes": ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring.write", "https://www.googleapis.com/auth/servicecontrol", "https://www.googleapis.com/auth/service.management.readonly", "https://www.googleapis.com/auth/trace.append"], "email": "600687511243-compute@developer.gserviceaccount.com"}], "metadata": {"items": [{"value": "projects/600687511243/global/instanceTemplates/iap-it-1", "key": "instance-template"}, {"value": "projects/600687511243/zones/us-central1-c/instanceGroupManagers/iap-ig", "key": "created-by"}], "kind": "compute#metadata", "fingerprint": "3MpZMMvDTyo="}, "creationTimestamp": "2017-05-26T22:08:11.094-07:00", "id": "6440513679799924564", "selfLink": "https://www.googleapis.com/compute/v1/projects/project1/zones/us-central1-c/instances/iap-ig-79bj", "networkInterfaces": [{"kind": "compute#networkInterface", "network": "https://www.googleapis.com/compute/v1/projects/project1/global/networks/default", "accessConfigs": [{"kind": "compute#accessConfig", "type": "ONE_TO_ONE_NAT", "name": "External NAT", "natIP": "104.198.131.130"}], "networkIP": "10.128.0.2", "subnetwork": "https://www.googleapis.com/compute/v1/projects/project1/regions/us-central1/subnetworks/default", "name": "nic0"}]}'}] |
# coding: utf-8
##########################################################################
# NSAp - Copyright (C) CEA, 2019
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########################################################################
# Module current version
version_major = 0
version_minor = 0
version_micro = 5
# Expected by setup.py: string of form "X.Y.Z"
__version__ = "{0}.{1}.{2}".format(version_major, version_minor, version_micro)
# Expected by setup.py: the status of the project
CLASSIFIERS = ["Development Status :: 1 - Planning",
"Environment :: Console",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Scientific/Engineering"]
# Project descriptions
description = """
pycaravel: Python package that enables you to parse various source of data.
"""
SUMMARY = """
.. container:: summary-carousel
pycaravel is a Python module for **data searching** that offers:
* a common API for parsing multiple source of data (BIDS, CubicWeb, ...).
* a common API to search in those datasets.
* some utilities to load the retrived data.
"""
long_description = (
"This module has been created to simplify the search of datasets in "
"a BIDS directory or a CubicWeb instance.")
# Main setup parameters
NAME = "pycaravel"
ORGANISATION = "CEA"
MAINTAINER = "Antoine Grigis"
MAINTAINER_EMAIL = "antoine.grigis@cea.fr"
DESCRIPTION = description
LONG_DESCRIPTION = long_description
EXTRANAME = "NeuroSpin webPage"
EXTRAURL = "http://joliot.cea.fr/drf/joliot/Pages/Entites_de_recherche/NeuroSpin.aspx"
URL = "https://github.com/neurospin/pycaravel"
DOWNLOAD_URL = "https://github.com/neurospin/pycaravel"
LICENSE = "CeCILL-B"
CLASSIFIERS = CLASSIFIERS
AUTHOR = """
Antoine Grigis <antoine.grigis@cea.fr>
"""
AUTHOR_EMAIL = "antoine.grigis@cea.fr"
PLATFORMS = "Linux,OSX"
ISRELEASE = True
VERSION = __version__
PROVIDES = ["caravel"]
REQUIRES = [
"pandas>=0.19.2",
"grabbit>=0.2.5",
"nibabel>=2.3.1",
"cwbrowser>=2.2.1",
"numpy>=1.11.0",
"imageio"
]
EXTRA_REQUIRES = {}
| version_major = 0
version_minor = 0
version_micro = 5
__version__ = '{0}.{1}.{2}'.format(version_major, version_minor, version_micro)
classifiers = ['Development Status :: 1 - Planning', 'Environment :: Console', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Scientific/Engineering']
description = '\npycaravel: Python package that enables you to parse various source of data.\n'
summary = '\n.. container:: summary-carousel\n\n pycaravel is a Python module for **data searching** that offers:\n\n * a common API for parsing multiple source of data (BIDS, CubicWeb, ...).\n * a common API to search in those datasets.\n * some utilities to load the retrived data.\n'
long_description = 'This module has been created to simplify the search of datasets in a BIDS directory or a CubicWeb instance.'
name = 'pycaravel'
organisation = 'CEA'
maintainer = 'Antoine Grigis'
maintainer_email = 'antoine.grigis@cea.fr'
description = description
long_description = long_description
extraname = 'NeuroSpin webPage'
extraurl = 'http://joliot.cea.fr/drf/joliot/Pages/Entites_de_recherche/NeuroSpin.aspx'
url = 'https://github.com/neurospin/pycaravel'
download_url = 'https://github.com/neurospin/pycaravel'
license = 'CeCILL-B'
classifiers = CLASSIFIERS
author = '\nAntoine Grigis <antoine.grigis@cea.fr>\n'
author_email = 'antoine.grigis@cea.fr'
platforms = 'Linux,OSX'
isrelease = True
version = __version__
provides = ['caravel']
requires = ['pandas>=0.19.2', 'grabbit>=0.2.5', 'nibabel>=2.3.1', 'cwbrowser>=2.2.1', 'numpy>=1.11.0', 'imageio']
extra_requires = {} |
s=input("Enter string: ")
word=s.split()
word=list(reversed(word))
print("OUTPUT: ",end="")
print(" ".join(word)) | s = input('Enter string: ')
word = s.split()
word = list(reversed(word))
print('OUTPUT: ', end='')
print(' '.join(word)) |
# encoding: utf-8
__author__ = "Patrick Lampe"
__email__ = "uni at lampep.de"
class Point:
def __init__(self, id, location):
self.id = id
self.location = location
def getId(self):
return self.id
def get_distance_in_m(self, snd_node):
return self.get_distance_in_km(snd_node) * 1000
def get_distance_in_km(self, snd_node):
return self.location.get_distance_in_km(snd_node.location)
def get_heading(self, snd_node):
return self.location.get_heading(snd_node.location)
def get_lat(self):
return self.location.get_lat_lon().to_string()[0]
def get_lon(self):
return self.location.get_lat_lon().to_string()[1]
| __author__ = 'Patrick Lampe'
__email__ = 'uni at lampep.de'
class Point:
def __init__(self, id, location):
self.id = id
self.location = location
def get_id(self):
return self.id
def get_distance_in_m(self, snd_node):
return self.get_distance_in_km(snd_node) * 1000
def get_distance_in_km(self, snd_node):
return self.location.get_distance_in_km(snd_node.location)
def get_heading(self, snd_node):
return self.location.get_heading(snd_node.location)
def get_lat(self):
return self.location.get_lat_lon().to_string()[0]
def get_lon(self):
return self.location.get_lat_lon().to_string()[1] |
"""
Error and Exceptions in the SciTokens library
"""
class MissingKeyException(Exception):
"""
No private key is present.
The SciToken required the use of a public or private key, but
it was not provided by the caller.
"""
pass
class UnsupportedKeyException(Exception):
"""
Key is present but is of an unsupported format.
A public or private key was provided to the SciToken, but
could not be handled by this library.
"""
pass
class MissingIssuerException(Exception):
"""
Missing the issuer in the SciToken, unable to verify token
"""
pass
class NonHTTPSIssuer(Exception):
"""
Non HTTPs issuer, as required by draft-ietf-oauth-discovery-07
https://tools.ietf.org/html/draft-ietf-oauth-discovery-07
"""
pass
class InvalidTokenFormat(Exception):
"""
Encoded token has an invalid format.
"""
pass
class UnableToCreateCache(Exception):
"""
Unable to make the KeyCache
"""
| """
Error and Exceptions in the SciTokens library
"""
class Missingkeyexception(Exception):
"""
No private key is present.
The SciToken required the use of a public or private key, but
it was not provided by the caller.
"""
pass
class Unsupportedkeyexception(Exception):
"""
Key is present but is of an unsupported format.
A public or private key was provided to the SciToken, but
could not be handled by this library.
"""
pass
class Missingissuerexception(Exception):
"""
Missing the issuer in the SciToken, unable to verify token
"""
pass
class Nonhttpsissuer(Exception):
"""
Non HTTPs issuer, as required by draft-ietf-oauth-discovery-07
https://tools.ietf.org/html/draft-ietf-oauth-discovery-07
"""
pass
class Invalidtokenformat(Exception):
"""
Encoded token has an invalid format.
"""
pass
class Unabletocreatecache(Exception):
"""
Unable to make the KeyCache
""" |
# Given a linked list, remove the n-th node from the end of list and return its head.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int):
# maintaining dummy to resolve edge cases
dummy = ListNode(0)
dummy.next = head
# this is a two pointer technique.
# Here we will be advancing one of the pointer to the n number of nodes and then advancing them equally
prevPtr, nextPtr = dummy, dummy
for i in range(n+1):
nextPtr = nextPtr.next
while nextPtr:
prevPtr = prevPtr.next
nextPtr = nextPtr.next
prevPtr.next = prevPtr.next.next
return dummy.next
if __name__ == "__main__":
a = ListNode(1)
b = ListNode(2)
c = ListNode(3)
d = ListNode(4)
e = ListNode(5)
a.next = b
b.next = c
c.next = d
d.next = e
head = Solution().removeNthFromEnd(a, 2)
while head:
print(head.val)
head = head.next
| class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def remove_nth_from_end(self, head: ListNode, n: int):
dummy = list_node(0)
dummy.next = head
(prev_ptr, next_ptr) = (dummy, dummy)
for i in range(n + 1):
next_ptr = nextPtr.next
while nextPtr:
prev_ptr = prevPtr.next
next_ptr = nextPtr.next
prevPtr.next = prevPtr.next.next
return dummy.next
if __name__ == '__main__':
a = list_node(1)
b = list_node(2)
c = list_node(3)
d = list_node(4)
e = list_node(5)
a.next = b
b.next = c
c.next = d
d.next = e
head = solution().removeNthFromEnd(a, 2)
while head:
print(head.val)
head = head.next |
def bmi_calculator(weight, height):
'''
Function calculates bmi according to passed arguments
weight (int or float) = weight of the person; ex: 61 or 61.0 kg
height (float) = height of the person, in meter; ex: 1.7 m
'''
bmi = weight / (height**2)
return bmi | def bmi_calculator(weight, height):
"""
Function calculates bmi according to passed arguments
weight (int or float) = weight of the person; ex: 61 or 61.0 kg
height (float) = height of the person, in meter; ex: 1.7 m
"""
bmi = weight / height ** 2
return bmi |
class VertexWeightProximityModifier:
falloff_type = None
mask_constant = None
mask_tex_map_object = None
mask_tex_mapping = None
mask_tex_use_channel = None
mask_tex_uv_layer = None
mask_texture = None
mask_vertex_group = None
max_dist = None
min_dist = None
proximity_geometry = None
proximity_mode = None
target = None
vertex_group = None
| class Vertexweightproximitymodifier:
falloff_type = None
mask_constant = None
mask_tex_map_object = None
mask_tex_mapping = None
mask_tex_use_channel = None
mask_tex_uv_layer = None
mask_texture = None
mask_vertex_group = None
max_dist = None
min_dist = None
proximity_geometry = None
proximity_mode = None
target = None
vertex_group = None |
class Solution:
def trimMean(self, arr: List[int]) -> float:
count = int(len(arr) * 0.05)
arr = sorted(arr)[count:-count]
return sum(arr) / len(arr)
| class Solution:
def trim_mean(self, arr: List[int]) -> float:
count = int(len(arr) * 0.05)
arr = sorted(arr)[count:-count]
return sum(arr) / len(arr) |
class Solution:
# @return a list of integers
def getRow(self, rowIndex):
row = []
for i in range(rowIndex+1):
n = i+1
tmp = [1]*n
for j in range(1, n-1):
tmp[j] = row[j-1] + row[j]
row = tmp
return row
| class Solution:
def get_row(self, rowIndex):
row = []
for i in range(rowIndex + 1):
n = i + 1
tmp = [1] * n
for j in range(1, n - 1):
tmp[j] = row[j - 1] + row[j]
row = tmp
return row |
def get_twos_sum(result, arr):
i, k = 0, len(arr) - 1
while i < k:
a, b = arr[i], arr[k]
res = a + b
if res == result:
return (a, b)
elif res < result:
i += 1
else:
k -= 1
def get_threes_sum(result, arr):
arr.sort()
for i in range(len(arr)):
c = arr[i]
if c > result:
continue
twos = get_twos_sum(result - c, arr[:i] + arr[i+1:])
if twos:
return True
return get_twos_sum(result, arr)
# Tests
assert get_threes_sum(49, [20, 303, 3, 4, 25])
assert not get_threes_sum(50, [20, 303, 3, 4, 25])
| def get_twos_sum(result, arr):
(i, k) = (0, len(arr) - 1)
while i < k:
(a, b) = (arr[i], arr[k])
res = a + b
if res == result:
return (a, b)
elif res < result:
i += 1
else:
k -= 1
def get_threes_sum(result, arr):
arr.sort()
for i in range(len(arr)):
c = arr[i]
if c > result:
continue
twos = get_twos_sum(result - c, arr[:i] + arr[i + 1:])
if twos:
return True
return get_twos_sum(result, arr)
assert get_threes_sum(49, [20, 303, 3, 4, 25])
assert not get_threes_sum(50, [20, 303, 3, 4, 25]) |
# Skill: Bitwise XOR
#Given an array of integers, arr, where all numbers occur twice except one number which occurs once, find the number. Your solution should ideally be O(n) time and use constant extra space.
#Example:
#Input: arr = [7, 3, 5, 5, 4, 3, 4, 8, 8]
#Output: 7
#Analysis
# Exploit the question of all numbers occurs twice except one number
# we use chain of bitwise operator XOR to "zero" the duplicate
# With XOR property, it allow single occur number remain
# Example:
# 1 ^ 3 ^ 5 ^ 1 ^ 5 = 3
# Time complexity O(N) space complexity O(1)
class Solution(object):
def findSingle(self, nums):
# Fill this in.
tmp = 0
for n in nums:
tmp = tmp ^ n
return tmp
if __name__ == "__main__":
nums = [1, 1, 3, 4, 4, 5, 6, 5, 6]
print(Solution().findSingle(nums))
# 3 | class Solution(object):
def find_single(self, nums):
tmp = 0
for n in nums:
tmp = tmp ^ n
return tmp
if __name__ == '__main__':
nums = [1, 1, 3, 4, 4, 5, 6, 5, 6]
print(solution().findSingle(nums)) |
email = input("What is your email id ").strip()
user_name = email[:email.index('@')]
domain_name = email[email.index('@')+1:]
result = "Your username is '{}' and your domain is '{}'".format(user_name, domain_name)
print(result)
| email = input('What is your email id ').strip()
user_name = email[:email.index('@')]
domain_name = email[email.index('@') + 1:]
result = "Your username is '{}' and your domain is '{}'".format(user_name, domain_name)
print(result) |
def step(part, instruction, pos, dir):
c, n = instruction
if c in "FNEWS":
change = {"N": 1j, "E": 1, "W": -1, "S": -1j, "F": dir}[c] * n
if c == "F" or part == 1:
return pos + change, dir
else:
return pos, dir + change
else:
return pos, dir * (1j - 2j * (c == "R")) ** (n // 90)
def dist_to_endpoint(part, steps, pos, dir):
if not steps:
return int(abs(pos.real) + abs(pos.imag))
return dist_to_endpoint(part, steps[1:], *step(part, steps[0], pos, dir))
with open("input.txt") as f:
instructions = [(line[0], int(line[1:])) for line in f]
print("Part 1:", dist_to_endpoint(part=1, steps=instructions, pos=0, dir=1))
print("Part 2:", dist_to_endpoint(part=2, steps=instructions, pos=0, dir=10 + 1j))
| def step(part, instruction, pos, dir):
(c, n) = instruction
if c in 'FNEWS':
change = {'N': 1j, 'E': 1, 'W': -1, 'S': -1j, 'F': dir}[c] * n
if c == 'F' or part == 1:
return (pos + change, dir)
else:
return (pos, dir + change)
else:
return (pos, dir * (1j - 2j * (c == 'R')) ** (n // 90))
def dist_to_endpoint(part, steps, pos, dir):
if not steps:
return int(abs(pos.real) + abs(pos.imag))
return dist_to_endpoint(part, steps[1:], *step(part, steps[0], pos, dir))
with open('input.txt') as f:
instructions = [(line[0], int(line[1:])) for line in f]
print('Part 1:', dist_to_endpoint(part=1, steps=instructions, pos=0, dir=1))
print('Part 2:', dist_to_endpoint(part=2, steps=instructions, pos=0, dir=10 + 1j)) |
#!/usr/bin/env python
# coding: utf-8
def mi_funcion():
print("una funcion")
class MiClase:
def __init__(self):
print ("una clase")
print ("un modulo") | def mi_funcion():
print('una funcion')
class Miclase:
def __init__(self):
print('una clase')
print('un modulo') |
NON_RELATION_TAG = "NonRel"
BRAT_REL_TEMPLATE = "R{}\t{} Arg1:{} Arg2:{}"
EN1_START = "[s1]"
EN1_END = "[e1]"
EN2_START = "[s2]"
EN2_END = "[e2]"
SPEC_TAGS = [EN1_START, EN1_END, EN2_START, EN2_END] | non_relation_tag = 'NonRel'
brat_rel_template = 'R{}\t{} Arg1:{} Arg2:{}'
en1_start = '[s1]'
en1_end = '[e1]'
en2_start = '[s2]'
en2_end = '[e2]'
spec_tags = [EN1_START, EN1_END, EN2_START, EN2_END] |
class InvalidEpubException(Exception):
'''Exception class to hold errors that occur during processing of an ePub file'''
archive = None
def __init__(self, *args, **kwargs):
if 'archive' in kwargs:
self.archive = kwargs['archive']
super(InvalidEpubException, self).__init__(*args)
| class Invalidepubexception(Exception):
"""Exception class to hold errors that occur during processing of an ePub file"""
archive = None
def __init__(self, *args, **kwargs):
if 'archive' in kwargs:
self.archive = kwargs['archive']
super(InvalidEpubException, self).__init__(*args) |
S = input()
if S == 'RRR':
print(3)
elif S.find('RR') != -1:
print(2)
elif S == 'SSS':
print(0)
else:
print(1) | s = input()
if S == 'RRR':
print(3)
elif S.find('RR') != -1:
print(2)
elif S == 'SSS':
print(0)
else:
print(1) |
class SpecialOffer:
""" Represents a special offer that can be done by a supermarket.
Attributes:
count(int): number of items needed to perform the special offer.
price(int): new price for the count of items.
free_item(<StockKeepingUnit>): the special offer instead of a different price offers a free item.
"""
def __init__(self, count, price, free_item):
self.count = count
self.price = price
self.free_item = free_item
| class Specialoffer:
""" Represents a special offer that can be done by a supermarket.
Attributes:
count(int): number of items needed to perform the special offer.
price(int): new price for the count of items.
free_item(<StockKeepingUnit>): the special offer instead of a different price offers a free item.
"""
def __init__(self, count, price, free_item):
self.count = count
self.price = price
self.free_item = free_item |
"""
Wrappers for the `torch.nn.Module` class, and can be used to parameterize policy
functions, value functions, cost functions, etc. for use in reinforcement
learning and imitation learning algorithms.
To create a custom network, see `BaseNetwork` for more details.
""" | """
Wrappers for the `torch.nn.Module` class, and can be used to parameterize policy
functions, value functions, cost functions, etc. for use in reinforcement
learning and imitation learning algorithms.
To create a custom network, see `BaseNetwork` for more details.
""" |
# These are the compilation flags that will be used in case there's no
# compilation database set.
flags = [
'-Wall',
'-Wextra',
'-std=c++14',
'-stdlib=libc++',
'-x', 'c++',
'-I', '.',
'-I', 'include',
'-isystem', '/usr/include/c++/v1',
'-isystem', '/usr/include'
]
def FlagsForFile(filename):
return {
'flags': flags,
'do_cache': True
}
| flags = ['-Wall', '-Wextra', '-std=c++14', '-stdlib=libc++', '-x', 'c++', '-I', '.', '-I', 'include', '-isystem', '/usr/include/c++/v1', '-isystem', '/usr/include']
def flags_for_file(filename):
return {'flags': flags, 'do_cache': True} |
# Link to the problem: http://www.spoj.com/problems/ANARC09A/
def main():
n = input()
count = 1
while n[0] != '-':
o, c, ans = 0, 0, 0
for i in n:
if i == '{':
o += 1
elif i == '}':
if o > 0:
o -= 1
else:
c += 1
ans += (o // 2) + (c // 2)
if o % 2 == 1 and c % 2 == 1:
ans += 2
print('{}. {}'.format(count, ans))
count += 1
n = input()
if __name__ == '__main__':
main()
| def main():
n = input()
count = 1
while n[0] != '-':
(o, c, ans) = (0, 0, 0)
for i in n:
if i == '{':
o += 1
elif i == '}':
if o > 0:
o -= 1
else:
c += 1
ans += o // 2 + c // 2
if o % 2 == 1 and c % 2 == 1:
ans += 2
print('{}. {}'.format(count, ans))
count += 1
n = input()
if __name__ == '__main__':
main() |
"""
@author Yuto Watanabe
@version 1.0.0
Copyright (c) 2020 Yuto Watanabe
"""
| """
@author Yuto Watanabe
@version 1.0.0
Copyright (c) 2020 Yuto Watanabe
""" |
class RunResultError(Exception):
"""Exception thrown when running a command fails"""
def __init__(self, runresult):
super(RunResultError, self).__init__(str(runresult))
self.runresult = runresult
class MatchError(Exception):
"""Exception for output match errors"""
def __init__(self, match, output):
message = "Could not match " + match
message += " in:\n" + output
super(MatchError, self).__init__(message)
| class Runresulterror(Exception):
"""Exception thrown when running a command fails"""
def __init__(self, runresult):
super(RunResultError, self).__init__(str(runresult))
self.runresult = runresult
class Matcherror(Exception):
"""Exception for output match errors"""
def __init__(self, match, output):
message = 'Could not match ' + match
message += ' in:\n' + output
super(MatchError, self).__init__(message) |
# Credits:
# 1) https://gist.github.com/evansneath/4650991
# 2) https://www.tutorialspoint.com/How-to-convert-string-to-binary-in-Python
def crc(msg, div, code='000'):
# Append the code to the message. If no code is given, default to '000'
msg = msg + code
# Convert msg and div into list form for easier handling
msg = list(msg)
div = list(div)
# Loop over every message bit (minus the appended code)
for i in range(len(msg)-len(code)):
# If that messsage bit is 1, perform modulo 2 multiplication
if msg[i] == '1':
for j in range(len(div)):
# Perform modulo 2 multiplication on each index of the divisor
# msg[i+j] = str((int(msg[i+j])+int(div[j])) % 2)
msg[i+j] = str(int(msg[i+j]) ^ int(div[j]))
# Output the last error-checking code portion of the message generated
return ''.join(msg[-len(code):])
print("Sender's side....")
# Use a divisor that simulates: x^3 + x + 1
div = '1011'
msg = input('Enter message: ')
msg = ''.join(format(ord(x), 'b') for x in msg)
print(f'Binary encoded input message: {msg}')
print(f'Binary encoded G(x): {div}')
code = crc(msg, div)
print(f"Remaider calculated at sender's side: {code}")
print("\nReceiver's side....")
def printCheck(msg, div, code):
remainder = crc(msg, div, code)
print(f'Remainder is: {remainder}')
print('Success:', remainder == '000')
def errorFunc(msg, div, code):
Error = input("Introduce error(T/F): ")
if Error in ('T', 't'):
msg = list(msg)
msg[7] = str(int(msg[7]) ^ 1)
msg = ''.join(msg)
printCheck(msg, div, code)
else:
printCheck(msg, div, code)
errorFunc(msg, div, code)
| def crc(msg, div, code='000'):
msg = msg + code
msg = list(msg)
div = list(div)
for i in range(len(msg) - len(code)):
if msg[i] == '1':
for j in range(len(div)):
msg[i + j] = str(int(msg[i + j]) ^ int(div[j]))
return ''.join(msg[-len(code):])
print("Sender's side....")
div = '1011'
msg = input('Enter message: ')
msg = ''.join((format(ord(x), 'b') for x in msg))
print(f'Binary encoded input message: {msg}')
print(f'Binary encoded G(x): {div}')
code = crc(msg, div)
print(f"Remaider calculated at sender's side: {code}")
print("\nReceiver's side....")
def print_check(msg, div, code):
remainder = crc(msg, div, code)
print(f'Remainder is: {remainder}')
print('Success:', remainder == '000')
def error_func(msg, div, code):
error = input('Introduce error(T/F): ')
if Error in ('T', 't'):
msg = list(msg)
msg[7] = str(int(msg[7]) ^ 1)
msg = ''.join(msg)
print_check(msg, div, code)
else:
print_check(msg, div, code)
error_func(msg, div, code) |
class Employee:
"""This class represents employees in a company """
num_of_employees = 0 #public static attribute
# init method or constructor
def __init__(self , first , last , pay):
self._first = first #protected Attribute
self._last = last #protected Attribute
self._pay = pay
Employee.num_of_employees += 1
@property
def full_name(self)-> str:
return f'{self._first} {self._last}'
@property
def first(self)->str:
return self._first
@property
def last(self)->str:
return self._last
@property
def pay(self)-> int:
return self._pay
@property
def email(self):
return f'{self.first}.{self.last}@gmail.com'
def __str__(self):
return f'Full Name: {self.full_name}.\
\nPayment: {self.pay}.\
\nEmail: {self.email}'
def __repr__(self):
return f"Employee('{self.first}' , '{self.last}' , {self.pay})"
#Additional constructor
@classmethod
def from_string(cls , str , delimiter = '-'):
first , last , pay = str.split(delimiter)
return cls(first , last , pay)
@staticmethod
def is_workday(day):
if day.weekday() == 5 or day.weekday() == 6:
return False
return True
if __name__ == '__main__':
hussein = Employee('Hussein' , 'Sarea' , 15000)
print(hussein)
moataz = Employee.from_string('Moataz-Sarea-20000')
print(moataz)
#import datetime
#date = datetime.date(2021 , 6 , 23)
#print(Employee.is_workday(date))
#print(hussein.get_full_name())
print(hussein.__repr__()) #Employee('Hussein' , 'Sarea' , 15000)
| class Employee:
"""This class represents employees in a company """
num_of_employees = 0
def __init__(self, first, last, pay):
self._first = first
self._last = last
self._pay = pay
Employee.num_of_employees += 1
@property
def full_name(self) -> str:
return f'{self._first} {self._last}'
@property
def first(self) -> str:
return self._first
@property
def last(self) -> str:
return self._last
@property
def pay(self) -> int:
return self._pay
@property
def email(self):
return f'{self.first}.{self.last}@gmail.com'
def __str__(self):
return f'Full Name: {self.full_name}. \nPayment: {self.pay}. \nEmail: {self.email}'
def __repr__(self):
return f"Employee('{self.first}' , '{self.last}' , {self.pay})"
@classmethod
def from_string(cls, str, delimiter='-'):
(first, last, pay) = str.split(delimiter)
return cls(first, last, pay)
@staticmethod
def is_workday(day):
if day.weekday() == 5 or day.weekday() == 6:
return False
return True
if __name__ == '__main__':
hussein = employee('Hussein', 'Sarea', 15000)
print(hussein)
moataz = Employee.from_string('Moataz-Sarea-20000')
print(moataz)
print(hussein.__repr__()) |
class HDateException(Exception):
pass
class HMoneyException(Exception):
pass
class Dict_Exception(Exception):
pass
| class Hdateexception(Exception):
pass
class Hmoneyexception(Exception):
pass
class Dict_Exception(Exception):
pass |
"""
**qecsimext** is an example Python 3 package that extends `qecsim`_ with additional components.
See the README at `qecsimext`_ for details.
.. _qecsim: https://github.com/qecsim/qecsim
.. _qecsimext: https://github.com/qecsim/qecsimext
"""
__version__ = '0.1b9'
| """
**qecsimext** is an example Python 3 package that extends `qecsim`_ with additional components.
See the README at `qecsimext`_ for details.
.. _qecsim: https://github.com/qecsim/qecsim
.. _qecsimext: https://github.com/qecsim/qecsimext
"""
__version__ = '0.1b9' |
# -*- coding: utf-8 -*-
__author__ = 'PCPC'
sumList = [n for n in range(1000) if n%3==0 or n%5==0]
print(sum(sumList)) | __author__ = 'PCPC'
sum_list = [n for n in range(1000) if n % 3 == 0 or n % 5 == 0]
print(sum(sumList)) |
def factory(x):
def fn():
return x
return fn
a1 = factory("foo")
a2 = factory("bar")
print(a1())
print(a2())
| def factory(x):
def fn():
return x
return fn
a1 = factory('foo')
a2 = factory('bar')
print(a1())
print(a2()) |
""" var object
this is for storing system variables
"""
class Var(object):
@classmethod
def fetch(cls,name):
"fetch var with given name"
return cls.list(name=name)[0]
@classmethod
def next(cls,name,advance=True):
"give (and, if advance, then increment) a counter variable"
v=cls.fetch(name)
next=v.value
if advance:
v.value=next+1
v.flush()
return next
@classmethod
def add(cls,name,value=0,textvalue='',datevalue=None,comment=''):
"add a new var of given name with given values"
v=cls.new()
v.name=name
v.value=value
v.textvalue=textvalue
v.datevalue=datevalue
v.comment=comment
v.flush()
@classmethod
def amend(cls,name,value=None,textvalue=None,datevalue=None,comment=None):
"update var of given name with given values"
v=cls.fetch(name)
if value is not None:
v.value=value
if textvalue is not None:
v.textvalue=textvalue
if datevalue is not None:
v.datevalue=datevalue
if comment is not None:
v.comment=comment
v.flush()
@classmethod
def say(cls,name):
v=cls.fetch(name)
return "%s : %s (%s) (%s) %s" % (v.name,v.value,v.textvalue,v.datevalue,v.comment)
| """ var object
this is for storing system variables
"""
class Var(object):
@classmethod
def fetch(cls, name):
"""fetch var with given name"""
return cls.list(name=name)[0]
@classmethod
def next(cls, name, advance=True):
"""give (and, if advance, then increment) a counter variable"""
v = cls.fetch(name)
next = v.value
if advance:
v.value = next + 1
v.flush()
return next
@classmethod
def add(cls, name, value=0, textvalue='', datevalue=None, comment=''):
"""add a new var of given name with given values"""
v = cls.new()
v.name = name
v.value = value
v.textvalue = textvalue
v.datevalue = datevalue
v.comment = comment
v.flush()
@classmethod
def amend(cls, name, value=None, textvalue=None, datevalue=None, comment=None):
"""update var of given name with given values"""
v = cls.fetch(name)
if value is not None:
v.value = value
if textvalue is not None:
v.textvalue = textvalue
if datevalue is not None:
v.datevalue = datevalue
if comment is not None:
v.comment = comment
v.flush()
@classmethod
def say(cls, name):
v = cls.fetch(name)
return '%s : %s (%s) (%s) %s' % (v.name, v.value, v.textvalue, v.datevalue, v.comment) |
def find_pivot(arr, low, high):
if high < low:
return -1
if high == low:
return low
mid = int((low + high)/2)
if mid < high and arr[mid] > arr[mid + 1]:
return mid
if mid > low and arr[mid] < arr[mid - 1]:
return mid-1
if arr[low] >= arr[mid]:
return find_pivot(arr, low, mid-1)
return find_pivot(arr, mid+1, high)
def binary_search(arr, low, high, key):
if high < low:
return -1
mid = int((low+high)/2)
if key == arr[mid]:
return mid
if key > arr[mid]:
return binary_search(arr, mid+1, high, key)
return binary_search(arr, low, mid-1,key)
def pivoted_search(arr, low, high, key):
pivot = find_pivot(arr, 0, n-1)
if pivot == -1:
return binary_search(arr, 0, n-1, key)
if arr[pivot] == key:
return pivot
if arr[0] <= key:
return binary_search(arr, 0, pivot-1, key)
return binary_search(arr, pivot+1, n-1, key)
| def find_pivot(arr, low, high):
if high < low:
return -1
if high == low:
return low
mid = int((low + high) / 2)
if mid < high and arr[mid] > arr[mid + 1]:
return mid
if mid > low and arr[mid] < arr[mid - 1]:
return mid - 1
if arr[low] >= arr[mid]:
return find_pivot(arr, low, mid - 1)
return find_pivot(arr, mid + 1, high)
def binary_search(arr, low, high, key):
if high < low:
return -1
mid = int((low + high) / 2)
if key == arr[mid]:
return mid
if key > arr[mid]:
return binary_search(arr, mid + 1, high, key)
return binary_search(arr, low, mid - 1, key)
def pivoted_search(arr, low, high, key):
pivot = find_pivot(arr, 0, n - 1)
if pivot == -1:
return binary_search(arr, 0, n - 1, key)
if arr[pivot] == key:
return pivot
if arr[0] <= key:
return binary_search(arr, 0, pivot - 1, key)
return binary_search(arr, pivot + 1, n - 1, key) |
_base_ = './pascal_voc12.py'
# dataset settings
data = dict(
train=dict(
ann_dir='SegmentationClassAug',
split=[
'ImageSets/Segmentation/train.txt',
'ImageSets/Segmentation/aug.txt'
]
),
val=dict(
ann_dir='SegmentationClassAug',
),
test=dict(
ann_dir='SegmentationClassAug',
)
)
| _base_ = './pascal_voc12.py'
data = dict(train=dict(ann_dir='SegmentationClassAug', split=['ImageSets/Segmentation/train.txt', 'ImageSets/Segmentation/aug.txt']), val=dict(ann_dir='SegmentationClassAug'), test=dict(ann_dir='SegmentationClassAug')) |
"""
# Useful git config for working with git submodules in this repo
(
git config status.submodulesummary 1
git config push.recurseSubmodules check
git config diff.submodule log
git config checkout.recurseSubmodules 1
git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
git config alias.spush 'push --recurse-submodules=on-demand'
)
"""
"""
# Disable prompting for passwords - works with git version 2.3 or above
export GIT_TERMINAL_PROMPT=0
# Harder core version of disabling the username/password prompt.
GIT_CREDENTIAL_HELPER=$PWD/.git/git-credential-stop
cat > $GIT_CREDENTIAL_HELPER <<EOF
cat
echo "username=git"
echo "password=git"
EOF
chmod a+x $GIT_CREDENTIAL_HELPER
git config credential.helper $GIT_CREDENTIAL_HELPER
"""
"""
# Fetching non shallow + tags to allow `git describe` information.
git fetch origin --unshallow || true
git fetch origin --tags
"""
"""
Clone a users version of a submodule if they have one.
Original from https://github.com/timvideos/litex-buildenv/blob/master/.travis/add-local-submodule.sh
USER_SLUG="$1"
SUBMODULE="$2"
REV=$(git rev-parse HEAD)
echo "Submodule $SUBMODULE"
# Get the pull request info
REQUEST_USER="$(echo $USER_SLUG | perl -pe 's|^([^/]*)/.*|\1|')"
REQUEST_REPO="$(echo $USER_SLUG | perl -pe 's|.*?/([^/]*)$|\1|')"
echo "Request user is '$REQUEST_USER'".
echo "Request repo is '$REQUEST_REPO'".
# Get current origin from git
ORIGIN_URL="$(git config -f .gitmodules submodule.$SUBMODULE.url)"
#ORIGIN_URL="$(git remote get-url origin)"
if echo $ORIGIN_URL | grep -q "github.com"; then
echo "Found github"
else
echo "Did not find github, skipping"
exit 0
fi
ORIGIN_SLUG=$(echo $ORIGIN_URL | perl -pe 's|.*github.com/(.*?)(.git)?$|\1|')
echo "Origin slug is '$ORIGIN_SLUG'"
ORIGIN_USER="$(echo $ORIGIN_SLUG | perl -pe 's|^([^/]*)/.*|\1|')"
ORIGIN_REPO="$(echo $ORIGIN_SLUG | perl -pe 's|.*?/([^/]*)$|\1|')"
echo "Origin user is '$ORIGIN_USER'"
echo "Origin repo is '$ORIGIN_REPO'"
USER_URL="git://github.com/$REQUEST_USER/$ORIGIN_REPO.git"
# Check if the user's repo exists
echo -n "User's repo would be '$USER_URL' "
if git ls-remote --exit-code --heads "$USER_URL" > /dev/null 2>&1; then
echo "which exists!"
else
echo "which does *not* exist!"
USER_URL="$ORIGIN_URL"
fi
# If submodule doesn't exist, clone directly from the users repo
if [ ! -e $SUBMODULE/.git ]; then
echo "Cloning '$ORIGIN_REPO' from repo '$USER_URL'"
git clone $USER_URL $SUBMODULE --origin user
fi
# If the submodule does exist, add a new remote.
(
cd $SUBMODULE
git remote rm user >/dev/null 2>&1 || true
if [ "$USER_URL" != "$ORIGIN_URL" ]; then
git remote add user $USER_URL
git fetch user
fi
git remote rm origin >/dev/null 2>&1 || true
git remote add origin $ORIGIN_URL
git fetch origin
)
# Checkout the submodule at the right revision
git submodule update --init $SUBMODULE
# Call ourselves recursively.
(
cd $SUBMODULE
git submodule status
echo
git submodule status | while read SHA1 MODULE_PATH DESC
do
"$SCRIPT_SRC" "$USER_SLUG" "$MODULE_PATH"
done
exit 0
) || exit 1
exit 0
"""
# Return True if the given tree needs to be initialized
def check_module_recursive(root_path, depth, verbose=False):
if verbose:
print('git-dep: checking if "{}" requires updating...'.format(root_path))
# If the directory isn't a valid git repo, initialization is required
if not os.path.exists(root_path + os.path.sep + '.git'):
return True
# If there are no submodules, no initialization needs to be done
if not os.path.isfile(root_path + os.path.sep + '.gitmodules'):
return False
# Loop through the gitmodules to check all submodules
gitmodules = open(root_path + os.path.sep + '.gitmodules', 'r')
for line in gitmodules:
parts = line.split("=", 2)
if parts[0].strip() == "path":
path = parts[1].strip()
if check_module_recursive(root_path + os.path.sep + path, depth + 1, verbose=verbose):
return True
return False
# Determine whether we need to invoke "git submodules init --recurse"
def check_submodules(script_path, args):
if check_module_recursive(script_path, 0, verbose=args.lx_verbose):
print("Missing submodules -- updating")
subprocess.Popen(["git", "submodule", "update",
"--init", "--recursive"], cwd=script_path).wait()
elif args.lx_verbose:
print("Submodule check: Submodules found")
| """
# Useful git config for working with git submodules in this repo
(
git config status.submodulesummary 1
git config push.recurseSubmodules check
git config diff.submodule log
git config checkout.recurseSubmodules 1
git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
git config alias.spush 'push --recurse-submodules=on-demand'
)
"""
'\n# Disable prompting for passwords - works with git version 2.3 or above\nexport GIT_TERMINAL_PROMPT=0\n# Harder core version of disabling the username/password prompt.\nGIT_CREDENTIAL_HELPER=$PWD/.git/git-credential-stop\ncat > $GIT_CREDENTIAL_HELPER <<EOF\ncat\necho "username=git"\necho "password=git"\nEOF\nchmod a+x $GIT_CREDENTIAL_HELPER\ngit config credential.helper $GIT_CREDENTIAL_HELPER\n'
'\n# Fetching non shallow + tags to allow `git describe` information.\ngit fetch origin --unshallow || true\ngit fetch origin --tags\n'
'\nClone a users version of a submodule if they have one.\n\nOriginal from https://github.com/timvideos/litex-buildenv/blob/master/.travis/add-local-submodule.sh\nUSER_SLUG="$1"\nSUBMODULE="$2"\nREV=$(git rev-parse HEAD)\n\necho "Submodule $SUBMODULE"\n\n# Get the pull request info\nREQUEST_USER="$(echo $USER_SLUG | perl -pe \'s|^([^/]*)/.*|\x01|\')"\nREQUEST_REPO="$(echo $USER_SLUG | perl -pe \'s|.*?/([^/]*)$|\x01|\')"\n\necho "Request user is \'$REQUEST_USER\'".\necho "Request repo is \'$REQUEST_REPO\'".\n\n# Get current origin from git\nORIGIN_URL="$(git config -f .gitmodules submodule.$SUBMODULE.url)"\n#ORIGIN_URL="$(git remote get-url origin)"\nif echo $ORIGIN_URL | grep -q "github.com"; then\n\techo "Found github"\nelse\n\techo "Did not find github, skipping"\n\texit 0\nfi\n\nORIGIN_SLUG=$(echo $ORIGIN_URL | perl -pe \'s|.*github.com/(.*?)(.git)?$|\x01|\')\necho "Origin slug is \'$ORIGIN_SLUG\'"\n\nORIGIN_USER="$(echo $ORIGIN_SLUG | perl -pe \'s|^([^/]*)/.*|\x01|\')"\nORIGIN_REPO="$(echo $ORIGIN_SLUG | perl -pe \'s|.*?/([^/]*)$|\x01|\')"\n\necho "Origin user is \'$ORIGIN_USER\'"\necho "Origin repo is \'$ORIGIN_REPO\'"\n\nUSER_URL="git://github.com/$REQUEST_USER/$ORIGIN_REPO.git"\n\n# Check if the user\'s repo exists\necho -n "User\'s repo would be \'$USER_URL\' "\nif git ls-remote --exit-code --heads "$USER_URL" > /dev/null 2>&1; then\n\techo "which exists!"\nelse\n\techo "which does *not* exist!"\n\tUSER_URL="$ORIGIN_URL"\nfi\n\n# If submodule doesn\'t exist, clone directly from the users repo\nif [ ! -e $SUBMODULE/.git ]; then\n\techo "Cloning \'$ORIGIN_REPO\' from repo \'$USER_URL\'"\n\tgit clone $USER_URL $SUBMODULE --origin user\nfi\n# If the submodule does exist, add a new remote.\n(\n\tcd $SUBMODULE\n\n\tgit remote rm user >/dev/null 2>&1 || true\n\tif [ "$USER_URL" != "$ORIGIN_URL" ]; then\n\t\tgit remote add user $USER_URL\n\t\tgit fetch user\n\tfi\n\n\tgit remote rm origin >/dev/null 2>&1 || true\n\tgit remote add origin $ORIGIN_URL\n\tgit fetch origin\n)\n\n# Checkout the submodule at the right revision\ngit submodule update --init $SUBMODULE\n\n# Call ourselves recursively.\n(\n\tcd $SUBMODULE\n\tgit submodule status\n\techo\n\tgit submodule status | while read SHA1 MODULE_PATH DESC\n\tdo\n\t\t"$SCRIPT_SRC" "$USER_SLUG" "$MODULE_PATH"\n\tdone\n\texit 0\n) || exit 1\n\nexit 0\n'
def check_module_recursive(root_path, depth, verbose=False):
if verbose:
print('git-dep: checking if "{}" requires updating...'.format(root_path))
if not os.path.exists(root_path + os.path.sep + '.git'):
return True
if not os.path.isfile(root_path + os.path.sep + '.gitmodules'):
return False
gitmodules = open(root_path + os.path.sep + '.gitmodules', 'r')
for line in gitmodules:
parts = line.split('=', 2)
if parts[0].strip() == 'path':
path = parts[1].strip()
if check_module_recursive(root_path + os.path.sep + path, depth + 1, verbose=verbose):
return True
return False
def check_submodules(script_path, args):
if check_module_recursive(script_path, 0, verbose=args.lx_verbose):
print('Missing submodules -- updating')
subprocess.Popen(['git', 'submodule', 'update', '--init', '--recursive'], cwd=script_path).wait()
elif args.lx_verbose:
print('Submodule check: Submodules found') |
def out(status, message, padding=0, custom=None):
if status == '?':
return input(
' ' * padding
+ '\033[1;36m'
+ '[?]'
+ '\033[0;0m'
+ ' ' + message
+ ': '
)
elif status == 'I':
print(
' ' * padding
+ '\033[1;32m['
+ (str(custom) if custom != None else 'I')
+ ']\033[0;0m'
+ ' '
+ message
)
elif status == 'E':
print(
' ' * padding
+ '\033[1;31m['
+ (str(custom) if custom != None else 'E')
+ ']\033[0;0m'
+ ' '
+ message
)
elif status == 'W':
print(
' ' * padding
+ '\033[1;33m['
+ (str(custom) if custom != None else 'W')
+ ']\033[0;0m'
+ ' '
+ message
)
| def out(status, message, padding=0, custom=None):
if status == '?':
return input(' ' * padding + '\x1b[1;36m' + '[?]' + '\x1b[0;0m' + ' ' + message + ': ')
elif status == 'I':
print(' ' * padding + '\x1b[1;32m[' + (str(custom) if custom != None else 'I') + ']\x1b[0;0m' + ' ' + message)
elif status == 'E':
print(' ' * padding + '\x1b[1;31m[' + (str(custom) if custom != None else 'E') + ']\x1b[0;0m' + ' ' + message)
elif status == 'W':
print(' ' * padding + '\x1b[1;33m[' + (str(custom) if custom != None else 'W') + ']\x1b[0;0m' + ' ' + message) |
class Animal(object):
"""docstring for Animal"""
def __init__(self):
super(Animal, self).__init__()
def keu(self):
print("I am an animal")
class Plant(object):
"""docstring for Plant"""
def __init__(self):
super(Plant, self).__init__()
def keu(self):
print("I am a plant")
def qh(self):
print("I am qhing")
class Cat(Animal):
"""docstring for Cat"""
def __init__(self, arg):
super(Cat, self).__init__()
self.arg = arg
def keu(self):
print("I am a cat")
class BlackCat(Animal, Plant):
"""docstring for BlackCat"""
def __init__(self, arg):
super(BlackCat, self).__init__()
self.arg = arg
# def keu():
# print("I am a black cat")
if __name__ == '__main__':
bc = BlackCat(1)
bc.keu()
bc.qh()
| class Animal(object):
"""docstring for Animal"""
def __init__(self):
super(Animal, self).__init__()
def keu(self):
print('I am an animal')
class Plant(object):
"""docstring for Plant"""
def __init__(self):
super(Plant, self).__init__()
def keu(self):
print('I am a plant')
def qh(self):
print('I am qhing')
class Cat(Animal):
"""docstring for Cat"""
def __init__(self, arg):
super(Cat, self).__init__()
self.arg = arg
def keu(self):
print('I am a cat')
class Blackcat(Animal, Plant):
"""docstring for BlackCat"""
def __init__(self, arg):
super(BlackCat, self).__init__()
self.arg = arg
if __name__ == '__main__':
bc = black_cat(1)
bc.keu()
bc.qh() |
description = ''
pages = ['header']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
header.verify_product_categories('Accessories, iMacs, iPads, iPhones, iPods, MacBooks')
capture('Verify product categories')
def teardown(data):
pass
| description = ''
pages = ['header']
def setup(data):
pass
def test(data):
navigate('http://store.demoqa.com/')
header.verify_product_categories('Accessories, iMacs, iPads, iPhones, iPods, MacBooks')
capture('Verify product categories')
def teardown(data):
pass |
while True:
e = str(input()).split()
a = int(e[0])
b = int(e[1])
if a == 0 == b: break
print(2 * a - b)
| while True:
e = str(input()).split()
a = int(e[0])
b = int(e[1])
if a == 0 == b:
break
print(2 * a - b) |
#
# PySNMP MIB module CISCO-LWAPP-LINKTEST-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-LWAPP-LINKTEST-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:05:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Counter32, Counter64, Bits, iso, ObjectIdentity, ModuleIdentity, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Integer32, TimeTicks, IpAddress, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Counter64", "Bits", "iso", "ObjectIdentity", "ModuleIdentity", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Integer32", "TimeTicks", "IpAddress", "NotificationType", "MibIdentifier")
MacAddress, TruthValue, DisplayString, TimeInterval, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "TruthValue", "DisplayString", "TimeInterval", "TextualConvention", "RowStatus")
ciscoLwappLinkTestMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 516))
ciscoLwappLinkTestMIB.setRevisions(('2006-04-06 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setRevisionsDescriptions(('Initial version of this MIB module. ',))
if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setLastUpdated('200604060000Z')
if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setOrganization('Cisco Systems Inc.')
if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setContactInfo(' Cisco Systems, Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS Email: cs-wnbu-snmp@cisco.com')
if mibBuilder.loadTexts: ciscoLwappLinkTestMIB.setDescription("This MIB is intended to be implemented on all those devices operating as Central controllers, that terminate the Light Weight Access Point Protocol tunnel from Cisco Light-weight LWAPP Access Points. Link Test is performed to learn the radio link quality between AP and Client. CCX linktest is performed for CCX clients. With CCX linktest radio link can be measured in both direction i.e. AP->Client(downLink) and Client->AP(uplink). When client does not support CCX or CCX linktest fails,ping is done between AP and Client. In ping test, only uplink (client->AP) quality can be measured. The relationship between the controller and the LWAPP APs is depicted as follows. +......+ +......+ +......+ +......+ + + + + + + + + + CC + + CC + + CC + + CC + + + + + + + + + +......+ +......+ +......+ +......+ .. . . . .. . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + AP + + AP + + AP + + AP + + AP + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ . . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + MN + + MN + + MN + + MN + + MN + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ The LWAPP tunnel exists between the controller and the APs. The MNs communicate with the APs through the protocol defined by the 802.11 standard. LWAPP APs, upon bootup, discover and join one of the controllers and forward all the 802.11 frames to them encapsulated inside LWAPP frames. GLOSSARY Access Point ( AP ) An entity that contains an 802.11 medium access control ( MAC ) and physical layer ( PHY ) interface and provides access to the distribution services via the wireless medium for associated clients. LWAPP APs encapsulate all the 802.11 frames in LWAPP frames and sends them to the controller to which it is logically connected. Central Controller ( CC ) The central entity that terminates the LWAPP protocol tunnel from the LWAPP APs. Throughout this MIB, this entity also referred to as 'controller'. Cisco Compatible eXtensions (CCX) Wireless LAN Access Points (APs) manufactured by Cisco Systems have features and capabilities beyond those in related standards (e.g., IEEE 802.11 suite of standards, Wi-Fi recommendations by WECA, 802.1X security suite, etc). A number of features provide higher performance. For example, Cisco AP transmits a specific Information Element, which the clients adapt to for enhanced performance. Similarly, a number of features are implemented by means of proprietary Information Elements, which Cisco clients use in specific ways to carry out tasks above and beyond the standard.Other examples of feature categories are roaming and power saving. Light Weight Access Point Protocol ( LWAPP ) This is a generic protocol that defines the communication between the Access Points and the Central controller. Mobile Node ( MN ) A roaming 802.11 wireless device in a wireless network associated with an access point. Mobile Node and client are used interchangeably. Received Signal Strength Indicator ( RSSI ) A measure of the strength of the signal as observed by the entity that received it, expressed in 'dbm'. Signal-Noise Ratio ( SNR ) A measure of the quality of the signal relative to the strength of noise expressed in 'dB'. REFERENCE [1] Wireless LAN Medium Access Control ( MAC ) and Physical Layer ( PHY ) Specifications. [2] Draft-obara-capwap-lwapp-00.txt, IETF Light Weight Access Point Protocol ")
ciscoLwappLinkTestMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 0))
ciscoLwappLinkTestMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1))
ciscoLwappLinkTestMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2))
ciscoLwappLinkTestConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1))
ciscoLwappLinkTestRun = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2))
ciscoLwappLinkTestStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3))
cLLtResponder = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cLLtResponder.setStatus('current')
if mibBuilder.loadTexts: cLLtResponder.setDescription("This object is used to control the AP's response to the linktests initiated by the client. When set to 'true', the AP is expected to respond to the linktests performed by the client. The AP won't respond to the linktests initiated by the client, when this object is set to 'false'. ")
cLLtPacketSize = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1500)).clone(50)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cLLtPacketSize.setStatus('current')
if mibBuilder.loadTexts: cLLtPacketSize.setDescription('This object indicates the number of bytes to be sent by the AP to the client in one linktest packet. ')
cLLtNumberOfPackets = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)).clone(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cLLtNumberOfPackets.setStatus('current')
if mibBuilder.loadTexts: cLLtNumberOfPackets.setDescription('This object indicates the number of linktest packets sent by the AP to the client. ')
cLLtTestPurgeTime = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(15, 1800)).clone(15)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cLLtTestPurgeTime.setStatus('current')
if mibBuilder.loadTexts: cLLtTestPurgeTime.setDescription('This object indicates the duration for which the results of a particular run of linktest is available in cLLtClientLtResultsTable from the time of completion of that run of linktest. At the expiry of this time after the completion of the linktest, the entries corresponding to the linktest and the corresponding results are removed from cLLtClientLinkTestTable and cLLtClientLtResultsTable respectively. ')
cLLtClientLinkTestTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1), )
if mibBuilder.loadTexts: cLLtClientLinkTestTable.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLinkTestTable.setDescription("This table is used to initiate linktests between an AP and one of its associated clients. CCX linktests are done on clients that support CCX. For all non-CCX clients, ping test is done. Note that ping test is also done when the CCX linktests fail. With CCX LinkTest support, the controller can test the link quality in downstream (direction of traffic from AP to client) direction by issuing LinkTest requests towards the client and let client record in the response packet the RF parameters like received signal strength, signal-to-noise etc., of the received request packet. With ping test only those RF parameters that are seen by the AP are measured. User initiates one run of linktest by adding a row to this table through explicit management action from the network manager. A row is created by specifying cLLtClientLtIndex, cLLtClientLtMacAddress and setting the RowStatus object to 'createAndGo'. This indicates the the request made to start the linktest on the client identified by cLLtClientLtMacAddress. cLLtClientLtIndex identifies the particular instance of the test. The added row is deleted by setting the corresponding instance of the RowStatus object to 'destroy'. In case if the agent finds that the time duration represented by cLLtTestPurgeTime has elapsed since the completion of the linktest, it proceeds to delete the row automatically, if the row exists at that point of time. The results of the linktest identified by cLLtClientLtIndex can be obtained from the queries to cLLtClientLtResultsTable. ")
cLLtClientLinkTestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex"))
if mibBuilder.loadTexts: cLLtClientLinkTestEntry.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLinkTestEntry.setDescription('Each entry in this table represents one instance of the linktest initiated by the user through a network manager. ')
cLLtClientLtIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32)))
if mibBuilder.loadTexts: cLLtClientLtIndex.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtIndex.setDescription('This object uniquely identifies one particular run of the linktest initiated between the client identified by cLLtClientLtMacAddress and the AP it is currently associated with. ')
cLLtClientLtMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 2), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cLLtClientLtMacAddress.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtMacAddress.setDescription("This object represents the mac address of the client involved in the particular run of linktest. This object must be set to a valid value when setting cLLtClientRowStatus to 'createAndGo' to initiate a run of linktest. ")
cLLtClientLtRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cLLtClientLtRowStatus.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtRowStatus.setDescription('This object is the status column used for creating and deleting instances of the columnar objects in this table. ')
cLLtClientLTResultsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2), )
if mibBuilder.loadTexts: cLLtClientLTResultsTable.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLTResultsTable.setDescription('This table populates the results of the linktests initiated by the user through the cLLtClientLinkTestTable. This table has a sparse dependent relationship with cLLtClientLinkTestTable. There exists a row in this table corresponding to the row for each row in cLLtClientLinkTestTable identified by cLLtClientLtIndex. A row is added to this table when user, through the network manager, adds a row to cLLtClientLinkTestTable and initiates one run of linktest. A row is deleted by the agent when the corresponding row of cLLtClientLinkTestTable is deleted. The manager is expected to poll cLLtClientLtStatus to check the status of the linktest. Depending on the status read through this object cLLtClientLtStatus, the appropriate columns for CCX or ping tests are read and linktest statistics are gathered. ')
cLLtClientLTResultsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex"))
if mibBuilder.loadTexts: cLLtClientLTResultsEntry.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLTResultsEntry.setDescription('Each entry in this table represents the results of the linktest identified by cLLtClientLtIndex. ')
cLLtClientLtPacketsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 1), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtPacketsSent.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtPacketsSent.setDescription('The number of packets sent to the target client specified by cLLtClientLtMacAddress by the AP it is associated to. ')
cLLtClientLtPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtPacketsRx.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtPacketsRx.setDescription('The number of packets sent by the client specified by cLLtClientLtMacAddress to the AP it is associated to. ')
cLLtClientLtTotalPacketsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtTotalPacketsLost.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtTotalPacketsLost.setDescription('The total number of packets lost during the linktest in both the upstream and downstream directions. ')
cLLtClientLtApToClientPktsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 4), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtApToClientPktsLost.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtApToClientPktsLost.setDescription('The number of packets lost during the linktest in the downstream (direction of traffic from AP to client) direction. ')
cLLtClientLtClientToApPktsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 5), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtClientToApPktsLost.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtClientToApPktsLost.setDescription('The number of packets lost during the linktest in the upstream (direction of traffic from client to AP) direction. ')
cLLtClientLtMinRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 6), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtMinRoundTripTime.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtMinRoundTripTime.setDescription('The minimum round trip time observed on the linktest packet between the AP and the client. ')
cLLtClientLtMaxRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 7), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtMaxRoundTripTime.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtMaxRoundTripTime.setDescription('The maximum round trip time observed on the linktest packet between the AP and the client. ')
cLLtClientLtAvgRoundTripTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 8), TimeInterval()).setUnits('hundredths-seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtAvgRoundTripTime.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtAvgRoundTripTime.setDescription('The average round trip time observed on the linktest packet between the AP and the client. ')
cLLtClientLtUplinkMinRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 9), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkMinRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkMinRSSI.setDescription('The minimum RSSI value as observed at the AP. ')
cLLtClientLtUplinkMaxRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 10), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkMaxRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkMaxRSSI.setDescription('The maximum RSSI value as observed at the AP. ')
cLLtClientLtUplinkAvgRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 11), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkAvgRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkAvgRSSI.setDescription('The average RSSI value as observed at the AP. ')
cLLtClientLtDownlinkMinRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 12), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkMinRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkMinRSSI.setDescription('The minimum RSSI value as observed at the client. ')
cLLtClientLtDownlinkMaxRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 13), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxRSSI.setDescription('The maximum RSSI value as observed at the client. ')
cLLtClientLtDownlinkAvgRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 14), Integer32()).setUnits('dBm').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgRSSI.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgRSSI.setDescription('The average RSSI value as observed at the client. ')
cLLtClientLtUplinkMinSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 15), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkMinSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkMinSNR.setDescription('The minimum SNR value as observed at the AP. ')
cLLtClientLtUplinkMaxSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 16), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkMaxSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkMaxSNR.setDescription('The maximum SNR value as observed at the AP. ')
cLLtClientLtUplinkAvgSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 17), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtUplinkAvgSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtUplinkAvgSNR.setDescription('The average SNR value as observed at the AP. ')
cLLtClientLtDownlinkMinSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 18), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkMinSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkMinSNR.setDescription('The minimum SNR value as observed at the client. ')
cLLtClientLtDownlinkMaxSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 19), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkMaxSNR.setDescription('The maximum SNR value as observed at the client. ')
cLLtClientLtDownlinkAvgSNR = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 20), Integer32()).setUnits('dB').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgSNR.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDownlinkAvgSNR.setDescription('The average SNR value as observed at the client. ')
cLLtClientLtTotalTxRetriesAP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 21), Counter32()).setUnits('retries').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesAP.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesAP.setDescription('The total number of linktest packet transmission retries as observed at the AP. ')
cLLtClientLtMaxTxRetriesAP = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 22), Counter32()).setUnits('retries').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesAP.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesAP.setDescription('The maximum number of linktest packet transmission retries observed at the AP. ')
cLLtClientLtTotalTxRetriesClient = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 23), Counter32()).setUnits('retries').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesClient.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtTotalTxRetriesClient.setDescription('The total number of linktest packet transmission retries at the client. ')
cLLtClientLtMaxTxRetriesClient = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 24), Counter32()).setUnits('retries').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesClient.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtMaxTxRetriesClient.setDescription('The maximum number of linktest packet transmission retries observed at the client. ')
cLLtClientLtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("cLLtClientLtStatusFailed", 0), ("cLLtClientLtStatusCcxInProgress", 1), ("cLLtClientLtStatusPngInProgress", 2), ("cLLtClientLtStatusPingSuccess", 3), ("cLLtClientLtStatusCcxLtSuccess", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtStatus.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtStatus.setDescription("This object indicates the status of the linktest this particular entry corresponds to. The semantics as follows. 'cLLtClientLtStatusFailed' - This value indicates that this particular linktest has failed. 'cLLtClientLtCcxStatusInProgress' - This value indicates that the CCX linktest is in progress. 'cLLtClientLtPngStatusInProgress' - This value indicates that the Ping-based linktest is in progress. 'cLLtClientLtStatusPingSuccess' - This value indicates that ping-based linktest between AP and client has succeeded. Only the following columns of this table should be considered for collecting data from the ping responses. cLLtClientLtPacketsSent, cLLtClientLtPacketsRx, cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkAvgSNR cLLtClientLtStatusCcxLtSuccess - This value indicates that CCX linktest done to test the link between the client and the AP is successful. All the columns of this table are applicable and valid for collecting data from the CCX responses. ")
cLLtClientLtDataRateTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1), )
if mibBuilder.loadTexts: cLLtClientLtDataRateTable.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDataRateTable.setDescription('This table provides the results of CCX Link tests classified on different data rates between AP and clients. A row is added to this table automatically by the agent corresponding to one linktest identified by cLLtClientLtIndex and deleted when the corresponding row in cLLtClientLinkTestTable is deleted. ')
cLLtClientLtDataRateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtIndex"), (0, "CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDataRate"))
if mibBuilder.loadTexts: cLLtClientLtDataRateEntry.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDataRateEntry.setDescription('Each entry represents a conceptual row and populates the number of packets sent in the linktest identified by cLLtClientLtIndex. The statistics of the linktest are classified based on the respective data rates identified by cLLtClientLtDataRate. ')
cLLtClientLtDataRate = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 255)))
if mibBuilder.loadTexts: cLLtClientLtDataRate.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtDataRate.setDescription('This object identifies the rate at which packets are transmitted. The rates are defined in Mbps with the following being the possible values. Rates - 1,2,5.5,6,9,11,12,18,24,36,48,54,108. ')
cLLtClientLtRateDownlinkPktsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 2), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtRateDownlinkPktsSent.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtRateDownlinkPktsSent.setDescription('The number of packets sent by the AP at the rate identified by cLLtClientLtDataRate. ')
cLLtClientLtRateUplinkPktsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 3), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cLLtClientLtRateUplinkPktsSent.setStatus('current')
if mibBuilder.loadTexts: cLLtClientLtRateUplinkPktsSent.setDescription('The number of packets sent by the client at the rate identified by cLLtClientLtDataRate. ')
ciscoLwappLinkTestMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1))
ciscoLwappLinkTestMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2))
ciscoLwappLinkTestMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1, 1)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestConfigGroup"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestRunsGroup"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLinkTestStatusGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoLwappLinkTestMIBCompliance = ciscoLwappLinkTestMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: ciscoLwappLinkTestMIBCompliance.setDescription('The compliance statement for the SNMP entities that implement the ciscoLwappLinkTestMIB module.')
cLLinkTestConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 1)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtResponder"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtPacketSize"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtNumberOfPackets"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtTestPurgeTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cLLinkTestConfigGroup = cLLinkTestConfigGroup.setStatus('current')
if mibBuilder.loadTexts: cLLinkTestConfigGroup.setDescription('This collection of objects represent the linktest parameters for use during the various of the tests. ')
cLLinkTestRunsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 2)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMacAddress"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtPacketsSent"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtPacketsRx"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalPacketsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtApToClientPktsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtClientToApPktsLost"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMinRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtAvgRoundTripTime"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMinRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMaxRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkAvgRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMinRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMaxRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkAvgRSSI"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMinSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkMaxSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtUplinkAvgSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMinSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkMaxSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtDownlinkAvgSNR"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalTxRetriesAP"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxTxRetriesAP"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtTotalTxRetriesClient"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtMaxTxRetriesClient"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtStatus"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cLLinkTestRunsGroup = cLLinkTestRunsGroup.setStatus('current')
if mibBuilder.loadTexts: cLLinkTestRunsGroup.setDescription('This collection of objects is used to initiate linktests and retrieve the results of the respective runs of the tests. ')
cLLinkTestStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 3)).setObjects(("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRateDownlinkPktsSent"), ("CISCO-LWAPP-LINKTEST-MIB", "cLLtClientLtRateUplinkPktsSent"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cLLinkTestStatusGroup = cLLinkTestStatusGroup.setStatus('current')
if mibBuilder.loadTexts: cLLinkTestStatusGroup.setDescription('This collection of objects provide information about the linktest results. ')
mibBuilder.exportSymbols("CISCO-LWAPP-LINKTEST-MIB", ciscoLwappLinkTestMIBCompliances=ciscoLwappLinkTestMIBCompliances, cLLtClientLtTotalTxRetriesClient=cLLtClientLtTotalTxRetriesClient, cLLtClientLtUplinkMinSNR=cLLtClientLtUplinkMinSNR, cLLtClientLinkTestTable=cLLtClientLinkTestTable, cLLtClientLtRateUplinkPktsSent=cLLtClientLtRateUplinkPktsSent, cLLtClientLTResultsTable=cLLtClientLTResultsTable, PYSNMP_MODULE_ID=ciscoLwappLinkTestMIB, cLLtResponder=cLLtResponder, cLLtClientLTResultsEntry=cLLtClientLTResultsEntry, cLLtClientLtUplinkAvgRSSI=cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkMaxSNR=cLLtClientLtUplinkMaxSNR, cLLtNumberOfPackets=cLLtNumberOfPackets, cLLtClientLtUplinkAvgSNR=cLLtClientLtUplinkAvgSNR, cLLtClientLtDataRateTable=cLLtClientLtDataRateTable, ciscoLwappLinkTestRun=ciscoLwappLinkTestRun, cLLtClientLtUplinkMinRSSI=cLLtClientLtUplinkMinRSSI, cLLtClientLtPacketsRx=cLLtClientLtPacketsRx, cLLtClientLtDownlinkAvgSNR=cLLtClientLtDownlinkAvgSNR, cLLtClientLtClientToApPktsLost=cLLtClientLtClientToApPktsLost, cLLtClientLtDataRateEntry=cLLtClientLtDataRateEntry, cLLtClientLtRateDownlinkPktsSent=cLLtClientLtRateDownlinkPktsSent, cLLtClientLtMacAddress=cLLtClientLtMacAddress, cLLtClientLtMaxRoundTripTime=cLLtClientLtMaxRoundTripTime, cLLtClientLtMinRoundTripTime=cLLtClientLtMinRoundTripTime, cLLtClientLtPacketsSent=cLLtClientLtPacketsSent, cLLtClientLtAvgRoundTripTime=cLLtClientLtAvgRoundTripTime, cLLtClientLtDownlinkAvgRSSI=cLLtClientLtDownlinkAvgRSSI, cLLtClientLtMaxTxRetriesClient=cLLtClientLtMaxTxRetriesClient, cLLtClientLtDataRate=cLLtClientLtDataRate, cLLtClientLtApToClientPktsLost=cLLtClientLtApToClientPktsLost, cLLtPacketSize=cLLtPacketSize, cLLtClientLtDownlinkMinRSSI=cLLtClientLtDownlinkMinRSSI, ciscoLwappLinkTestStatus=ciscoLwappLinkTestStatus, cLLtClientLtDownlinkMaxRSSI=cLLtClientLtDownlinkMaxRSSI, cLLtClientLtIndex=cLLtClientLtIndex, cLLtClientLtDownlinkMinSNR=cLLtClientLtDownlinkMinSNR, cLLinkTestRunsGroup=cLLinkTestRunsGroup, ciscoLwappLinkTestMIBNotifs=ciscoLwappLinkTestMIBNotifs, ciscoLwappLinkTestConfig=ciscoLwappLinkTestConfig, cLLtClientLtUplinkMaxRSSI=cLLtClientLtUplinkMaxRSSI, ciscoLwappLinkTestMIBCompliance=ciscoLwappLinkTestMIBCompliance, cLLtClientLinkTestEntry=cLLtClientLinkTestEntry, ciscoLwappLinkTestMIBObjects=ciscoLwappLinkTestMIBObjects, cLLtTestPurgeTime=cLLtTestPurgeTime, cLLtClientLtRowStatus=cLLtClientLtRowStatus, cLLtClientLtDownlinkMaxSNR=cLLtClientLtDownlinkMaxSNR, cLLtClientLtMaxTxRetriesAP=cLLtClientLtMaxTxRetriesAP, cLLinkTestStatusGroup=cLLinkTestStatusGroup, ciscoLwappLinkTestMIB=ciscoLwappLinkTestMIB, cLLinkTestConfigGroup=cLLinkTestConfigGroup, cLLtClientLtTotalPacketsLost=cLLtClientLtTotalPacketsLost, ciscoLwappLinkTestMIBGroups=ciscoLwappLinkTestMIBGroups, cLLtClientLtTotalTxRetriesAP=cLLtClientLtTotalTxRetriesAP, cLLtClientLtStatus=cLLtClientLtStatus, ciscoLwappLinkTestMIBConform=ciscoLwappLinkTestMIBConform)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(counter32, counter64, bits, iso, object_identity, module_identity, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, integer32, time_ticks, ip_address, notification_type, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Counter64', 'Bits', 'iso', 'ObjectIdentity', 'ModuleIdentity', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'Integer32', 'TimeTicks', 'IpAddress', 'NotificationType', 'MibIdentifier')
(mac_address, truth_value, display_string, time_interval, textual_convention, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'MacAddress', 'TruthValue', 'DisplayString', 'TimeInterval', 'TextualConvention', 'RowStatus')
cisco_lwapp_link_test_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 516))
ciscoLwappLinkTestMIB.setRevisions(('2006-04-06 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIB.setRevisionsDescriptions(('Initial version of this MIB module. ',))
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIB.setLastUpdated('200604060000Z')
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIB.setOrganization('Cisco Systems Inc.')
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIB.setContactInfo(' Cisco Systems, Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS Email: cs-wnbu-snmp@cisco.com')
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIB.setDescription("This MIB is intended to be implemented on all those devices operating as Central controllers, that terminate the Light Weight Access Point Protocol tunnel from Cisco Light-weight LWAPP Access Points. Link Test is performed to learn the radio link quality between AP and Client. CCX linktest is performed for CCX clients. With CCX linktest radio link can be measured in both direction i.e. AP->Client(downLink) and Client->AP(uplink). When client does not support CCX or CCX linktest fails,ping is done between AP and Client. In ping test, only uplink (client->AP) quality can be measured. The relationship between the controller and the LWAPP APs is depicted as follows. +......+ +......+ +......+ +......+ + + + + + + + + + CC + + CC + + CC + + CC + + + + + + + + + +......+ +......+ +......+ +......+ .. . . . .. . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + AP + + AP + + AP + + AP + + AP + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ . . . . . . . . . . . . . . . . . . . . . . . . +......+ +......+ +......+ +......+ +......+ + + + + + + + + + + + MN + + MN + + MN + + MN + + MN + + + + + + + + + + + +......+ +......+ +......+ +......+ +......+ The LWAPP tunnel exists between the controller and the APs. The MNs communicate with the APs through the protocol defined by the 802.11 standard. LWAPP APs, upon bootup, discover and join one of the controllers and forward all the 802.11 frames to them encapsulated inside LWAPP frames. GLOSSARY Access Point ( AP ) An entity that contains an 802.11 medium access control ( MAC ) and physical layer ( PHY ) interface and provides access to the distribution services via the wireless medium for associated clients. LWAPP APs encapsulate all the 802.11 frames in LWAPP frames and sends them to the controller to which it is logically connected. Central Controller ( CC ) The central entity that terminates the LWAPP protocol tunnel from the LWAPP APs. Throughout this MIB, this entity also referred to as 'controller'. Cisco Compatible eXtensions (CCX) Wireless LAN Access Points (APs) manufactured by Cisco Systems have features and capabilities beyond those in related standards (e.g., IEEE 802.11 suite of standards, Wi-Fi recommendations by WECA, 802.1X security suite, etc). A number of features provide higher performance. For example, Cisco AP transmits a specific Information Element, which the clients adapt to for enhanced performance. Similarly, a number of features are implemented by means of proprietary Information Elements, which Cisco clients use in specific ways to carry out tasks above and beyond the standard.Other examples of feature categories are roaming and power saving. Light Weight Access Point Protocol ( LWAPP ) This is a generic protocol that defines the communication between the Access Points and the Central controller. Mobile Node ( MN ) A roaming 802.11 wireless device in a wireless network associated with an access point. Mobile Node and client are used interchangeably. Received Signal Strength Indicator ( RSSI ) A measure of the strength of the signal as observed by the entity that received it, expressed in 'dbm'. Signal-Noise Ratio ( SNR ) A measure of the quality of the signal relative to the strength of noise expressed in 'dB'. REFERENCE [1] Wireless LAN Medium Access Control ( MAC ) and Physical Layer ( PHY ) Specifications. [2] Draft-obara-capwap-lwapp-00.txt, IETF Light Weight Access Point Protocol ")
cisco_lwapp_link_test_mib_notifs = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 0))
cisco_lwapp_link_test_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1))
cisco_lwapp_link_test_mib_conform = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2))
cisco_lwapp_link_test_config = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1))
cisco_lwapp_link_test_run = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2))
cisco_lwapp_link_test_status = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3))
c_l_lt_responder = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 1), truth_value().clone('true')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cLLtResponder.setStatus('current')
if mibBuilder.loadTexts:
cLLtResponder.setDescription("This object is used to control the AP's response to the linktests initiated by the client. When set to 'true', the AP is expected to respond to the linktests performed by the client. The AP won't respond to the linktests initiated by the client, when this object is set to 'false'. ")
c_l_lt_packet_size = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 1500)).clone(50)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cLLtPacketSize.setStatus('current')
if mibBuilder.loadTexts:
cLLtPacketSize.setDescription('This object indicates the number of bytes to be sent by the AP to the client in one linktest packet. ')
c_l_lt_number_of_packets = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 100)).clone(20)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cLLtNumberOfPackets.setStatus('current')
if mibBuilder.loadTexts:
cLLtNumberOfPackets.setDescription('This object indicates the number of linktest packets sent by the AP to the client. ')
c_l_lt_test_purge_time = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(15, 1800)).clone(15)).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cLLtTestPurgeTime.setStatus('current')
if mibBuilder.loadTexts:
cLLtTestPurgeTime.setDescription('This object indicates the duration for which the results of a particular run of linktest is available in cLLtClientLtResultsTable from the time of completion of that run of linktest. At the expiry of this time after the completion of the linktest, the entries corresponding to the linktest and the corresponding results are removed from cLLtClientLinkTestTable and cLLtClientLtResultsTable respectively. ')
c_l_lt_client_link_test_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1))
if mibBuilder.loadTexts:
cLLtClientLinkTestTable.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLinkTestTable.setDescription("This table is used to initiate linktests between an AP and one of its associated clients. CCX linktests are done on clients that support CCX. For all non-CCX clients, ping test is done. Note that ping test is also done when the CCX linktests fail. With CCX LinkTest support, the controller can test the link quality in downstream (direction of traffic from AP to client) direction by issuing LinkTest requests towards the client and let client record in the response packet the RF parameters like received signal strength, signal-to-noise etc., of the received request packet. With ping test only those RF parameters that are seen by the AP are measured. User initiates one run of linktest by adding a row to this table through explicit management action from the network manager. A row is created by specifying cLLtClientLtIndex, cLLtClientLtMacAddress and setting the RowStatus object to 'createAndGo'. This indicates the the request made to start the linktest on the client identified by cLLtClientLtMacAddress. cLLtClientLtIndex identifies the particular instance of the test. The added row is deleted by setting the corresponding instance of the RowStatus object to 'destroy'. In case if the agent finds that the time duration represented by cLLtTestPurgeTime has elapsed since the completion of the linktest, it proceeds to delete the row automatically, if the row exists at that point of time. The results of the linktest identified by cLLtClientLtIndex can be obtained from the queries to cLLtClientLtResultsTable. ")
c_l_lt_client_link_test_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1)).setIndexNames((0, 'CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtIndex'))
if mibBuilder.loadTexts:
cLLtClientLinkTestEntry.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLinkTestEntry.setDescription('Each entry in this table represents one instance of the linktest initiated by the user through a network manager. ')
c_l_lt_client_lt_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 32)))
if mibBuilder.loadTexts:
cLLtClientLtIndex.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtIndex.setDescription('This object uniquely identifies one particular run of the linktest initiated between the client identified by cLLtClientLtMacAddress and the AP it is currently associated with. ')
c_l_lt_client_lt_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 2), mac_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cLLtClientLtMacAddress.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtMacAddress.setDescription("This object represents the mac address of the client involved in the particular run of linktest. This object must be set to a valid value when setting cLLtClientRowStatus to 'createAndGo' to initiate a run of linktest. ")
c_l_lt_client_lt_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 1, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cLLtClientLtRowStatus.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtRowStatus.setDescription('This object is the status column used for creating and deleting instances of the columnar objects in this table. ')
c_l_lt_client_lt_results_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2))
if mibBuilder.loadTexts:
cLLtClientLTResultsTable.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLTResultsTable.setDescription('This table populates the results of the linktests initiated by the user through the cLLtClientLinkTestTable. This table has a sparse dependent relationship with cLLtClientLinkTestTable. There exists a row in this table corresponding to the row for each row in cLLtClientLinkTestTable identified by cLLtClientLtIndex. A row is added to this table when user, through the network manager, adds a row to cLLtClientLinkTestTable and initiates one run of linktest. A row is deleted by the agent when the corresponding row of cLLtClientLinkTestTable is deleted. The manager is expected to poll cLLtClientLtStatus to check the status of the linktest. Depending on the status read through this object cLLtClientLtStatus, the appropriate columns for CCX or ping tests are read and linktest statistics are gathered. ')
c_l_lt_client_lt_results_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1)).setIndexNames((0, 'CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtIndex'))
if mibBuilder.loadTexts:
cLLtClientLTResultsEntry.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLTResultsEntry.setDescription('Each entry in this table represents the results of the linktest identified by cLLtClientLtIndex. ')
c_l_lt_client_lt_packets_sent = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 1), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtPacketsSent.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtPacketsSent.setDescription('The number of packets sent to the target client specified by cLLtClientLtMacAddress by the AP it is associated to. ')
c_l_lt_client_lt_packets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 2), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtPacketsRx.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtPacketsRx.setDescription('The number of packets sent by the client specified by cLLtClientLtMacAddress to the AP it is associated to. ')
c_l_lt_client_lt_total_packets_lost = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 3), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtTotalPacketsLost.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtTotalPacketsLost.setDescription('The total number of packets lost during the linktest in both the upstream and downstream directions. ')
c_l_lt_client_lt_ap_to_client_pkts_lost = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 4), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtApToClientPktsLost.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtApToClientPktsLost.setDescription('The number of packets lost during the linktest in the downstream (direction of traffic from AP to client) direction. ')
c_l_lt_client_lt_client_to_ap_pkts_lost = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 5), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtClientToApPktsLost.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtClientToApPktsLost.setDescription('The number of packets lost during the linktest in the upstream (direction of traffic from client to AP) direction. ')
c_l_lt_client_lt_min_round_trip_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 6), time_interval()).setUnits('hundredths-seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtMinRoundTripTime.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtMinRoundTripTime.setDescription('The minimum round trip time observed on the linktest packet between the AP and the client. ')
c_l_lt_client_lt_max_round_trip_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 7), time_interval()).setUnits('hundredths-seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtMaxRoundTripTime.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtMaxRoundTripTime.setDescription('The maximum round trip time observed on the linktest packet between the AP and the client. ')
c_l_lt_client_lt_avg_round_trip_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 8), time_interval()).setUnits('hundredths-seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtAvgRoundTripTime.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtAvgRoundTripTime.setDescription('The average round trip time observed on the linktest packet between the AP and the client. ')
c_l_lt_client_lt_uplink_min_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 9), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMinRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMinRSSI.setDescription('The minimum RSSI value as observed at the AP. ')
c_l_lt_client_lt_uplink_max_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 10), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMaxRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMaxRSSI.setDescription('The maximum RSSI value as observed at the AP. ')
c_l_lt_client_lt_uplink_avg_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 11), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkAvgRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkAvgRSSI.setDescription('The average RSSI value as observed at the AP. ')
c_l_lt_client_lt_downlink_min_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 12), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMinRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMinRSSI.setDescription('The minimum RSSI value as observed at the client. ')
c_l_lt_client_lt_downlink_max_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 13), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMaxRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMaxRSSI.setDescription('The maximum RSSI value as observed at the client. ')
c_l_lt_client_lt_downlink_avg_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 14), integer32()).setUnits('dBm').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkAvgRSSI.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkAvgRSSI.setDescription('The average RSSI value as observed at the client. ')
c_l_lt_client_lt_uplink_min_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 15), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMinSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMinSNR.setDescription('The minimum SNR value as observed at the AP. ')
c_l_lt_client_lt_uplink_max_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 16), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMaxSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkMaxSNR.setDescription('The maximum SNR value as observed at the AP. ')
c_l_lt_client_lt_uplink_avg_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 17), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtUplinkAvgSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtUplinkAvgSNR.setDescription('The average SNR value as observed at the AP. ')
c_l_lt_client_lt_downlink_min_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 18), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMinSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMinSNR.setDescription('The minimum SNR value as observed at the client. ')
c_l_lt_client_lt_downlink_max_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 19), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMaxSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkMaxSNR.setDescription('The maximum SNR value as observed at the client. ')
c_l_lt_client_lt_downlink_avg_snr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 20), integer32()).setUnits('dB').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkAvgSNR.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDownlinkAvgSNR.setDescription('The average SNR value as observed at the client. ')
c_l_lt_client_lt_total_tx_retries_ap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 21), counter32()).setUnits('retries').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtTotalTxRetriesAP.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtTotalTxRetriesAP.setDescription('The total number of linktest packet transmission retries as observed at the AP. ')
c_l_lt_client_lt_max_tx_retries_ap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 22), counter32()).setUnits('retries').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtMaxTxRetriesAP.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtMaxTxRetriesAP.setDescription('The maximum number of linktest packet transmission retries observed at the AP. ')
c_l_lt_client_lt_total_tx_retries_client = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 23), counter32()).setUnits('retries').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtTotalTxRetriesClient.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtTotalTxRetriesClient.setDescription('The total number of linktest packet transmission retries at the client. ')
c_l_lt_client_lt_max_tx_retries_client = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 24), counter32()).setUnits('retries').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtMaxTxRetriesClient.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtMaxTxRetriesClient.setDescription('The maximum number of linktest packet transmission retries observed at the client. ')
c_l_lt_client_lt_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 2, 2, 1, 25), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4))).clone(namedValues=named_values(('cLLtClientLtStatusFailed', 0), ('cLLtClientLtStatusCcxInProgress', 1), ('cLLtClientLtStatusPngInProgress', 2), ('cLLtClientLtStatusPingSuccess', 3), ('cLLtClientLtStatusCcxLtSuccess', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtStatus.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtStatus.setDescription("This object indicates the status of the linktest this particular entry corresponds to. The semantics as follows. 'cLLtClientLtStatusFailed' - This value indicates that this particular linktest has failed. 'cLLtClientLtCcxStatusInProgress' - This value indicates that the CCX linktest is in progress. 'cLLtClientLtPngStatusInProgress' - This value indicates that the Ping-based linktest is in progress. 'cLLtClientLtStatusPingSuccess' - This value indicates that ping-based linktest between AP and client has succeeded. Only the following columns of this table should be considered for collecting data from the ping responses. cLLtClientLtPacketsSent, cLLtClientLtPacketsRx, cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkAvgSNR cLLtClientLtStatusCcxLtSuccess - This value indicates that CCX linktest done to test the link between the client and the AP is successful. All the columns of this table are applicable and valid for collecting data from the CCX responses. ")
c_l_lt_client_lt_data_rate_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1))
if mibBuilder.loadTexts:
cLLtClientLtDataRateTable.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDataRateTable.setDescription('This table provides the results of CCX Link tests classified on different data rates between AP and clients. A row is added to this table automatically by the agent corresponding to one linktest identified by cLLtClientLtIndex and deleted when the corresponding row in cLLtClientLinkTestTable is deleted. ')
c_l_lt_client_lt_data_rate_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1)).setIndexNames((0, 'CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtIndex'), (0, 'CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDataRate'))
if mibBuilder.loadTexts:
cLLtClientLtDataRateEntry.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDataRateEntry.setDescription('Each entry represents a conceptual row and populates the number of packets sent in the linktest identified by cLLtClientLtIndex. The statistics of the linktest are classified based on the respective data rates identified by cLLtClientLtDataRate. ')
c_l_lt_client_lt_data_rate = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(1, 255)))
if mibBuilder.loadTexts:
cLLtClientLtDataRate.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtDataRate.setDescription('This object identifies the rate at which packets are transmitted. The rates are defined in Mbps with the following being the possible values. Rates - 1,2,5.5,6,9,11,12,18,24,36,48,54,108. ')
c_l_lt_client_lt_rate_downlink_pkts_sent = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 2), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtRateDownlinkPktsSent.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtRateDownlinkPktsSent.setDescription('The number of packets sent by the AP at the rate identified by cLLtClientLtDataRate. ')
c_l_lt_client_lt_rate_uplink_pkts_sent = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 516, 1, 3, 1, 1, 3), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cLLtClientLtRateUplinkPktsSent.setStatus('current')
if mibBuilder.loadTexts:
cLLtClientLtRateUplinkPktsSent.setDescription('The number of packets sent by the client at the rate identified by cLLtClientLtDataRate. ')
cisco_lwapp_link_test_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1))
cisco_lwapp_link_test_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2))
cisco_lwapp_link_test_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 1, 1)).setObjects(('CISCO-LWAPP-LINKTEST-MIB', 'cLLinkTestConfigGroup'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLinkTestRunsGroup'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLinkTestStatusGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_lwapp_link_test_mib_compliance = ciscoLwappLinkTestMIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
ciscoLwappLinkTestMIBCompliance.setDescription('The compliance statement for the SNMP entities that implement the ciscoLwappLinkTestMIB module.')
c_l_link_test_config_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 1)).setObjects(('CISCO-LWAPP-LINKTEST-MIB', 'cLLtResponder'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtPacketSize'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtNumberOfPackets'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtTestPurgeTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_l_link_test_config_group = cLLinkTestConfigGroup.setStatus('current')
if mibBuilder.loadTexts:
cLLinkTestConfigGroup.setDescription('This collection of objects represent the linktest parameters for use during the various of the tests. ')
c_l_link_test_runs_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 2)).setObjects(('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtMacAddress'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtPacketsSent'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtPacketsRx'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtTotalPacketsLost'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtApToClientPktsLost'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtClientToApPktsLost'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtMinRoundTripTime'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtMaxRoundTripTime'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtAvgRoundTripTime'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkMinRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkMaxRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkAvgRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkMinRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkMaxRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkAvgRSSI'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkMinSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkMaxSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtUplinkAvgSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkMinSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkMaxSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtDownlinkAvgSNR'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtTotalTxRetriesAP'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtMaxTxRetriesAP'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtTotalTxRetriesClient'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtMaxTxRetriesClient'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtStatus'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtRowStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_l_link_test_runs_group = cLLinkTestRunsGroup.setStatus('current')
if mibBuilder.loadTexts:
cLLinkTestRunsGroup.setDescription('This collection of objects is used to initiate linktests and retrieve the results of the respective runs of the tests. ')
c_l_link_test_status_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 516, 2, 2, 3)).setObjects(('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtRateDownlinkPktsSent'), ('CISCO-LWAPP-LINKTEST-MIB', 'cLLtClientLtRateUplinkPktsSent'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_l_link_test_status_group = cLLinkTestStatusGroup.setStatus('current')
if mibBuilder.loadTexts:
cLLinkTestStatusGroup.setDescription('This collection of objects provide information about the linktest results. ')
mibBuilder.exportSymbols('CISCO-LWAPP-LINKTEST-MIB', ciscoLwappLinkTestMIBCompliances=ciscoLwappLinkTestMIBCompliances, cLLtClientLtTotalTxRetriesClient=cLLtClientLtTotalTxRetriesClient, cLLtClientLtUplinkMinSNR=cLLtClientLtUplinkMinSNR, cLLtClientLinkTestTable=cLLtClientLinkTestTable, cLLtClientLtRateUplinkPktsSent=cLLtClientLtRateUplinkPktsSent, cLLtClientLTResultsTable=cLLtClientLTResultsTable, PYSNMP_MODULE_ID=ciscoLwappLinkTestMIB, cLLtResponder=cLLtResponder, cLLtClientLTResultsEntry=cLLtClientLTResultsEntry, cLLtClientLtUplinkAvgRSSI=cLLtClientLtUplinkAvgRSSI, cLLtClientLtUplinkMaxSNR=cLLtClientLtUplinkMaxSNR, cLLtNumberOfPackets=cLLtNumberOfPackets, cLLtClientLtUplinkAvgSNR=cLLtClientLtUplinkAvgSNR, cLLtClientLtDataRateTable=cLLtClientLtDataRateTable, ciscoLwappLinkTestRun=ciscoLwappLinkTestRun, cLLtClientLtUplinkMinRSSI=cLLtClientLtUplinkMinRSSI, cLLtClientLtPacketsRx=cLLtClientLtPacketsRx, cLLtClientLtDownlinkAvgSNR=cLLtClientLtDownlinkAvgSNR, cLLtClientLtClientToApPktsLost=cLLtClientLtClientToApPktsLost, cLLtClientLtDataRateEntry=cLLtClientLtDataRateEntry, cLLtClientLtRateDownlinkPktsSent=cLLtClientLtRateDownlinkPktsSent, cLLtClientLtMacAddress=cLLtClientLtMacAddress, cLLtClientLtMaxRoundTripTime=cLLtClientLtMaxRoundTripTime, cLLtClientLtMinRoundTripTime=cLLtClientLtMinRoundTripTime, cLLtClientLtPacketsSent=cLLtClientLtPacketsSent, cLLtClientLtAvgRoundTripTime=cLLtClientLtAvgRoundTripTime, cLLtClientLtDownlinkAvgRSSI=cLLtClientLtDownlinkAvgRSSI, cLLtClientLtMaxTxRetriesClient=cLLtClientLtMaxTxRetriesClient, cLLtClientLtDataRate=cLLtClientLtDataRate, cLLtClientLtApToClientPktsLost=cLLtClientLtApToClientPktsLost, cLLtPacketSize=cLLtPacketSize, cLLtClientLtDownlinkMinRSSI=cLLtClientLtDownlinkMinRSSI, ciscoLwappLinkTestStatus=ciscoLwappLinkTestStatus, cLLtClientLtDownlinkMaxRSSI=cLLtClientLtDownlinkMaxRSSI, cLLtClientLtIndex=cLLtClientLtIndex, cLLtClientLtDownlinkMinSNR=cLLtClientLtDownlinkMinSNR, cLLinkTestRunsGroup=cLLinkTestRunsGroup, ciscoLwappLinkTestMIBNotifs=ciscoLwappLinkTestMIBNotifs, ciscoLwappLinkTestConfig=ciscoLwappLinkTestConfig, cLLtClientLtUplinkMaxRSSI=cLLtClientLtUplinkMaxRSSI, ciscoLwappLinkTestMIBCompliance=ciscoLwappLinkTestMIBCompliance, cLLtClientLinkTestEntry=cLLtClientLinkTestEntry, ciscoLwappLinkTestMIBObjects=ciscoLwappLinkTestMIBObjects, cLLtTestPurgeTime=cLLtTestPurgeTime, cLLtClientLtRowStatus=cLLtClientLtRowStatus, cLLtClientLtDownlinkMaxSNR=cLLtClientLtDownlinkMaxSNR, cLLtClientLtMaxTxRetriesAP=cLLtClientLtMaxTxRetriesAP, cLLinkTestStatusGroup=cLLinkTestStatusGroup, ciscoLwappLinkTestMIB=ciscoLwappLinkTestMIB, cLLinkTestConfigGroup=cLLinkTestConfigGroup, cLLtClientLtTotalPacketsLost=cLLtClientLtTotalPacketsLost, ciscoLwappLinkTestMIBGroups=ciscoLwappLinkTestMIBGroups, cLLtClientLtTotalTxRetriesAP=cLLtClientLtTotalTxRetriesAP, cLLtClientLtStatus=cLLtClientLtStatus, ciscoLwappLinkTestMIBConform=ciscoLwappLinkTestMIBConform) |
'''Play on numbers with arthitemetic'''
def simple_math_calc():
"""Do simple mathematical calculation"""
num_value1 = 10
num_value2 = 20
num_pi = 22/7
print(num_pi)
print('{0} + {1} = {2}'.format(num_value1, num_value2, num_value1+num_value2))
input1 = input("Enter first number for addition? ")
input2 = input("Enter second number for addition? ")
print(f'String number addition {input1}, {input2}, {input1+input2}')
print(f'number addition {input1} + {input2} = {float(input1)+float(input2)}')
return input1, input2, num_pi, num_value1, num_value2
def is_prime(number_to_test):
"""Find whether the given number is primte"""
for index in range(2, number_to_test-1, 1):
if number_to_test%index == 0:
return False
return True
if __name__ == "__main__":
for NUM in [3, 5, 7, 20, 17, 51, 98, 45, 67, 37, 62]:
print("Given number {0} - Is Prime? {1}".format(NUM, is_prime(NUM)))
#simple_math_calc()
| """Play on numbers with arthitemetic"""
def simple_math_calc():
"""Do simple mathematical calculation"""
num_value1 = 10
num_value2 = 20
num_pi = 22 / 7
print(num_pi)
print('{0} + {1} = {2}'.format(num_value1, num_value2, num_value1 + num_value2))
input1 = input('Enter first number for addition? ')
input2 = input('Enter second number for addition? ')
print(f'String number addition {input1}, {input2}, {input1 + input2}')
print(f'number addition {input1} + {input2} = {float(input1) + float(input2)}')
return (input1, input2, num_pi, num_value1, num_value2)
def is_prime(number_to_test):
"""Find whether the given number is primte"""
for index in range(2, number_to_test - 1, 1):
if number_to_test % index == 0:
return False
return True
if __name__ == '__main__':
for num in [3, 5, 7, 20, 17, 51, 98, 45, 67, 37, 62]:
print('Given number {0} - Is Prime? {1}'.format(NUM, is_prime(NUM))) |
"""
This folder is modified from https://github.com/sungyubkim/MINE-Mutual-Information-Neural-Estimation-
from mutual information estimation
"""
| """
This folder is modified from https://github.com/sungyubkim/MINE-Mutual-Information-Neural-Estimation-
from mutual information estimation
""" |
#!python
def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
# implement linear_search_iterative and linear_search_recursive below, then
# change this to call your implementation to verify it passes all tests
return linear_search_iterative(array, item)
# return linear_search_recursive(array, item)
def linear_search_iterative(array, item):
# loop over all array values until item is found
for index, value in enumerate(array):
if item == value:
return index # found
return None # not found
def linear_search_recursive(array, item, index=0):
# TODO: implement linear search recursively here
# once implemented, change linear_search to call linear_search_recursive
# to verify that your recursive implementation passes all tests
if array[index] == item:
return index
elif index < len(array) - 1:
return linear_search_recursive(array, item, index + 1)
else:
return None
def binary_search(array, item):
"""return the index of item in sorted array or None if item is not found"""
# implement binary_search_iterative and binary_search_recursive below, then
# change this to call your implementation to verify it passes all tests
return binary_search_iterative(array, item)
# return binary_search_recursive(array, item)
def binary_search_iterative(array, item):
# TODO: implement binary search iteratively here
# once implemented, change binary_search to call binary_search_iterative
# to verify that your iterative implementation passes all tests
index = len(array) // 2
left, right = None, None
while array[index] != item:
if left and right:
index = (right + left) // 2
elif left:
index = (len(array) + left) // 2
elif right:
index = right // 2
elif not (left or right):
index = len(array) // 2
if index == left or index == right:
return None
elif item < array[index]:
right = index
elif item > array[index]:
left = index
return index
#The time complexity for this function would be O(log n) as any algorithm which multiplies by 1/2.
# The best case would be O(1)
def binary_search_recursive(array, item, left=None, right=None):
# TODO: implement binary search recursively here
# once implemented, change binary_search to call binary_search_recursive
# to verify that your recursive implementation passes all tests
if left and right:
index = (right + left) // 2
elif left:
index = (len(array) + left) // 2
elif right:
index = right // 2
elif not (left or right):
index = len(array) // 2
if index == left or index == right:
return None
if array[index] == item:
return index
elif item < array[index]:
return binary_search_recursive(array, item, left=left, right =index)
elif item > array[index]:
return binary_search_recursive(array, item, left = index, right=right)
#The time complexity for this would be O(log n).
#The best case complexity would be O(1).
| def linear_search(array, item):
"""return the first index of item in array or None if item is not found"""
return linear_search_iterative(array, item)
def linear_search_iterative(array, item):
for (index, value) in enumerate(array):
if item == value:
return index
return None
def linear_search_recursive(array, item, index=0):
if array[index] == item:
return index
elif index < len(array) - 1:
return linear_search_recursive(array, item, index + 1)
else:
return None
def binary_search(array, item):
"""return the index of item in sorted array or None if item is not found"""
return binary_search_iterative(array, item)
def binary_search_iterative(array, item):
index = len(array) // 2
(left, right) = (None, None)
while array[index] != item:
if left and right:
index = (right + left) // 2
elif left:
index = (len(array) + left) // 2
elif right:
index = right // 2
elif not (left or right):
index = len(array) // 2
if index == left or index == right:
return None
elif item < array[index]:
right = index
elif item > array[index]:
left = index
return index
def binary_search_recursive(array, item, left=None, right=None):
if left and right:
index = (right + left) // 2
elif left:
index = (len(array) + left) // 2
elif right:
index = right // 2
elif not (left or right):
index = len(array) // 2
if index == left or index == right:
return None
if array[index] == item:
return index
elif item < array[index]:
return binary_search_recursive(array, item, left=left, right=index)
elif item > array[index]:
return binary_search_recursive(array, item, left=index, right=right) |
class BaseTestFunction(object):
r"""Base class for all test functions in optimization.
For more details, please refer to `this Wikipedia page`_.
.. _this Wikipedia page:
https://en.wikipedia.org/wiki/Test_functions_for_optimization
The subclass should implement at least the following:
- :meth:`__call__`
"""
def __call__(self, x):
raise NotImplementedError
| class Basetestfunction(object):
"""Base class for all test functions in optimization.
For more details, please refer to `this Wikipedia page`_.
.. _this Wikipedia page:
https://en.wikipedia.org/wiki/Test_functions_for_optimization
The subclass should implement at least the following:
- :meth:`__call__`
"""
def __call__(self, x):
raise NotImplementedError |
# Test that returning of NotImplemented from binary op methods leads to
# TypeError.
try:
NotImplemented
except NameError:
print("SKIP")
raise SystemExit
class C:
def __init__(self, value):
self.value = value
def __str__(self):
return "C({})".format(self.value)
def __add__(self, rhs):
print(self, '+', rhs)
return NotImplemented
def __sub__(self, rhs):
print(self, '-', rhs)
return NotImplemented
def __lt__(self, rhs):
print(self, '<', rhs)
return NotImplemented
def __neg__(self):
print('-', self)
return NotImplemented
c = C(0)
try:
c + 1
except TypeError:
print("TypeError")
try:
c - 2
except TypeError:
print("TypeError")
try:
c < 1
except TypeError:
print("TypeError")
# NotImplemented isn't handled specially in unary methods
print(-c)
# Test that NotImplemented can be hashed
print(type(hash(NotImplemented)))
| try:
NotImplemented
except NameError:
print('SKIP')
raise SystemExit
class C:
def __init__(self, value):
self.value = value
def __str__(self):
return 'C({})'.format(self.value)
def __add__(self, rhs):
print(self, '+', rhs)
return NotImplemented
def __sub__(self, rhs):
print(self, '-', rhs)
return NotImplemented
def __lt__(self, rhs):
print(self, '<', rhs)
return NotImplemented
def __neg__(self):
print('-', self)
return NotImplemented
c = c(0)
try:
c + 1
except TypeError:
print('TypeError')
try:
c - 2
except TypeError:
print('TypeError')
try:
c < 1
except TypeError:
print('TypeError')
print(-c)
print(type(hash(NotImplemented))) |
# POWER OF THREE LEETCODE SOLUTION:
# creating a class.
class Solution(object):
# creating a function to solve the problem.
def isPowerOfThree(self, n):
# creating a variable to track the exponent.
i = 0
# creating a while-loop to iterate until the desired number.
while 3 ** i <= n:
# creating a nested if-statement to check if the desired number is met.
if 3 ** i == n:
# returning true if the condition is met.
return True
# code to increment the exponent by one after each iteration.
i += 1
# returning False if the condition is not met.
return False | class Solution(object):
def is_power_of_three(self, n):
i = 0
while 3 ** i <= n:
if 3 ** i == n:
return True
i += 1
return False |
if False:
print("Really, really false.")
elif False:
print("nested")
else:
if "seems rediculous":
print("it is.")
| if False:
print('Really, really false.')
elif False:
print('nested')
elif 'seems rediculous':
print('it is.') |
nome = str(input('Qual e o seu nome?'))
if nome =='Gustavo':
print('Que nome lindo voce tem!')
else:
print('Seu nome e tao normal!')
print('Bom dia {}!'.format(nome))
| nome = str(input('Qual e o seu nome?'))
if nome == 'Gustavo':
print('Que nome lindo voce tem!')
else:
print('Seu nome e tao normal!')
print('Bom dia {}!'.format(nome)) |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
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 decode_imsi(imsi64):
"""
Convert from the compacted uint back to a string, using the second two bits
to determine the padding
Args:
imsi64 - compacted representation of imsi with padding at end
Returns:
imsi string in the form IMSI00101...
"""
prefix_len = (imsi64 >> 1) & 0x3
return 'IMSI' + '0' * prefix_len + str(imsi64 >> 3)
def encode_imsi(imsi):
"""
Convert a IMSI string to a uint + length. IMSI strings can contain two
prefix zeros for test MCC and maximum fifteen digits. Bit 1 of the
compacted uint is always 1, so that we can match on it set. Bits 2-3
the compacted uint contain how many leading 0's are in the IMSI. For
example, if the IMSI is 001010000000013, the first bit is 0b1, the second
two bits would be 0b10 and the remaining bits would be 1010000000013 << 3
Args:
imsi - string representation of imsi
Returns:
int representation of imsi with padding amount at end
"""
if imsi.startswith('IMSI'):
imsi = imsi[4:] # strip IMSI off of string
prefix_len = len(imsi) - len(imsi.lstrip('0'))
compacted = (int(imsi) << 2) | (prefix_len & 0x3)
return compacted << 1 | 0x1
| """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
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 decode_imsi(imsi64):
"""
Convert from the compacted uint back to a string, using the second two bits
to determine the padding
Args:
imsi64 - compacted representation of imsi with padding at end
Returns:
imsi string in the form IMSI00101...
"""
prefix_len = imsi64 >> 1 & 3
return 'IMSI' + '0' * prefix_len + str(imsi64 >> 3)
def encode_imsi(imsi):
"""
Convert a IMSI string to a uint + length. IMSI strings can contain two
prefix zeros for test MCC and maximum fifteen digits. Bit 1 of the
compacted uint is always 1, so that we can match on it set. Bits 2-3
the compacted uint contain how many leading 0's are in the IMSI. For
example, if the IMSI is 001010000000013, the first bit is 0b1, the second
two bits would be 0b10 and the remaining bits would be 1010000000013 << 3
Args:
imsi - string representation of imsi
Returns:
int representation of imsi with padding amount at end
"""
if imsi.startswith('IMSI'):
imsi = imsi[4:]
prefix_len = len(imsi) - len(imsi.lstrip('0'))
compacted = int(imsi) << 2 | prefix_len & 3
return compacted << 1 | 1 |
class Solution:
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
inverse1 = {e: i for i, e in enumerate(list1)}
overlap = collections.defaultdict(list) # stored by index sum
for j, e in enumerate(list2):
try:
overlap[inverse1[e] + j].append(e)
except KeyError:
pass
return overlap[min(overlap)]
| class Solution:
def find_restaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
inverse1 = {e: i for (i, e) in enumerate(list1)}
overlap = collections.defaultdict(list)
for (j, e) in enumerate(list2):
try:
overlap[inverse1[e] + j].append(e)
except KeyError:
pass
return overlap[min(overlap)] |
class DescriptorTypesEnum():
_ECFP = "ecfp"
_ECFP_COUNTS = "ecfp_counts"
_MACCS_KEYS = "maccs_keys"
_AVALON = "avalon"
@property
def ECFP(self):
return self._ECFP
@ECFP.setter
def ECFP(self, value):
raise ValueError("Do not assign value to a DescriptorTypesEnum field")
@property
def ECFP_COUNTS(self):
return self._ECFP_COUNTS
@ECFP_COUNTS.setter
def ECFP_COUNTS(self, value):
raise ValueError("Do not assign value to a DescriptorTypesEnum field")
@property
def MACCS_KEYS(self):
return self._MACCS_KEYS
@MACCS_KEYS.setter
def MACCS_KEYS(self, value):
raise ValueError("Do not assign value to a DescriptorTypesEnum field")
@property
def AVALON(self):
return self._AVALON
@AVALON.setter
def AVALON(self, value):
raise ValueError("Do not assign value to a DescriptorTypesEnum field") | class Descriptortypesenum:
_ecfp = 'ecfp'
_ecfp_counts = 'ecfp_counts'
_maccs_keys = 'maccs_keys'
_avalon = 'avalon'
@property
def ecfp(self):
return self._ECFP
@ECFP.setter
def ecfp(self, value):
raise value_error('Do not assign value to a DescriptorTypesEnum field')
@property
def ecfp_counts(self):
return self._ECFP_COUNTS
@ECFP_COUNTS.setter
def ecfp_counts(self, value):
raise value_error('Do not assign value to a DescriptorTypesEnum field')
@property
def maccs_keys(self):
return self._MACCS_KEYS
@MACCS_KEYS.setter
def maccs_keys(self, value):
raise value_error('Do not assign value to a DescriptorTypesEnum field')
@property
def avalon(self):
return self._AVALON
@AVALON.setter
def avalon(self, value):
raise value_error('Do not assign value to a DescriptorTypesEnum field') |
day_events_list = input().split("|")
MAX_ENERGY = 100
ORDER_ENERGY = 30
REST_ENERGY = 50
energy = 100
coins = 100
is_not_bankrupt = True
for event in day_events_list:
single_events_list = event.split("-")
name = single_events_list[0]
value = int(single_events_list[1])
if name == "rest":
gained_energy = 0
if energy + value > MAX_ENERGY:
gained_energy = MAX_ENERGY - energy
energy = MAX_ENERGY
else:
energy += value
gained_energy = value
print(f"You gained {gained_energy} energy.")
print(f"Current energy: {energy}.")
elif name == "order":
if energy >= ORDER_ENERGY:
energy -= ORDER_ENERGY
coins += value
print(f"You earned {value} coins.")
else:
energy += REST_ENERGY
print("You had to rest!")
continue
else:
if coins > value:
coins -= value
print(f"You bought {name}.")
else:
print(f"Closed! Cannot afford {name}.")
is_not_bankrupt = False
break
if is_not_bankrupt:
print("Day completed!")
print(f"Coins: {coins}")
print(f"Energy: {energy}")
| day_events_list = input().split('|')
max_energy = 100
order_energy = 30
rest_energy = 50
energy = 100
coins = 100
is_not_bankrupt = True
for event in day_events_list:
single_events_list = event.split('-')
name = single_events_list[0]
value = int(single_events_list[1])
if name == 'rest':
gained_energy = 0
if energy + value > MAX_ENERGY:
gained_energy = MAX_ENERGY - energy
energy = MAX_ENERGY
else:
energy += value
gained_energy = value
print(f'You gained {gained_energy} energy.')
print(f'Current energy: {energy}.')
elif name == 'order':
if energy >= ORDER_ENERGY:
energy -= ORDER_ENERGY
coins += value
print(f'You earned {value} coins.')
else:
energy += REST_ENERGY
print('You had to rest!')
continue
elif coins > value:
coins -= value
print(f'You bought {name}.')
else:
print(f'Closed! Cannot afford {name}.')
is_not_bankrupt = False
break
if is_not_bankrupt:
print('Day completed!')
print(f'Coins: {coins}')
print(f'Energy: {energy}') |
class WebpreviewException(Exception):
"""
Base Webpreview Exception.
"""
pass
class EmptyURL(WebpreviewException):
"""
WebpreviewException for empty URL.
"""
pass
class EmptyProperties(WebpreviewException):
"""
WebpreviewException for empty properties.
"""
pass
class URLNotFound(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass
class URLUnreachable(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass
| class Webpreviewexception(Exception):
"""
Base Webpreview Exception.
"""
pass
class Emptyurl(WebpreviewException):
"""
WebpreviewException for empty URL.
"""
pass
class Emptyproperties(WebpreviewException):
"""
WebpreviewException for empty properties.
"""
pass
class Urlnotfound(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass
class Urlunreachable(WebpreviewException):
"""
WebpreviewException for 404 URLs.
"""
pass |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
# tags = params.tags
actor=j.apps.actorsloader.getActor("system","gridmanager")
organization = args.getTag("organization")
name = args.getTag("jsname")
out = ''
missing = False
for k,v in {'organization':organization, 'name':name}.items():
if not v:
out += 'Missing param %s.\n' % k
missing = True
if not missing:
obj = actor.getJumpscript(organization=organization, name=name)
out = ['||Property||Value||']
for k,v in obj.items():
if k in ('args', 'roles'):
v = ' ,'.join(v)
if k == 'source':
continue
v = j.data.text.toStr(v)
out.append("|%s|%s|" % (k.capitalize(), v.replace('\n', '') if v else v))
out.append('\n{{code:\n%s\n}}' % obj['source'])
out = '\n'.join(out)
doc.applyTemplate({'name': name})
params.result = (out, doc)
return params
def match(j, args, params, tags, tasklet):
return True
| def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
actor = j.apps.actorsloader.getActor('system', 'gridmanager')
organization = args.getTag('organization')
name = args.getTag('jsname')
out = ''
missing = False
for (k, v) in {'organization': organization, 'name': name}.items():
if not v:
out += 'Missing param %s.\n' % k
missing = True
if not missing:
obj = actor.getJumpscript(organization=organization, name=name)
out = ['||Property||Value||']
for (k, v) in obj.items():
if k in ('args', 'roles'):
v = ' ,'.join(v)
if k == 'source':
continue
v = j.data.text.toStr(v)
out.append('|%s|%s|' % (k.capitalize(), v.replace('\n', '') if v else v))
out.append('\n{{code:\n%s\n}}' % obj['source'])
out = '\n'.join(out)
doc.applyTemplate({'name': name})
params.result = (out, doc)
return params
def match(j, args, params, tags, tasklet):
return True |
class color:
black = "\033[30m"
red = "\033[31m"
green = "\033[32m"
yellow = "\033[33m"
blue = "\033[34m"
magenta = "\033[35m"
cyan = "\033[36m"
white = "\033[37m"
class bright:
black_1 = "\033[1;30m"
red_1 = "\033[1;31m"
green_1 = "\033[1;32m"
yellow_1 = "\033[1;33m"
blue_1 = "\033[1;34m"
magenta_1 = "\033[1;35m"
cyan_1 = "\033[1;36m"
white_1 = "\033[1;37m" | class Color:
black = '\x1b[30m'
red = '\x1b[31m'
green = '\x1b[32m'
yellow = '\x1b[33m'
blue = '\x1b[34m'
magenta = '\x1b[35m'
cyan = '\x1b[36m'
white = '\x1b[37m'
class Bright:
black_1 = '\x1b[1;30m'
red_1 = '\x1b[1;31m'
green_1 = '\x1b[1;32m'
yellow_1 = '\x1b[1;33m'
blue_1 = '\x1b[1;34m'
magenta_1 = '\x1b[1;35m'
cyan_1 = '\x1b[1;36m'
white_1 = '\x1b[1;37m' |
# -*- coding: utf-8 -*-
"""
dicts contains a number of special-case dictionaries.
.. testsetup:: *
import kutils.dicts as kd
"""
class AttrDict(dict):
"""
AttrDict represents a dictionary where the keys are represented as
attributes.
>>> d = kd.AttrDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
"""
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class NoneDict(dict):
"""
NoneDict is a dictionary that returns ``None`` if a key
is unavailable.
>>> d = kd.NoneDict(foo='bar')
>>> d['foo']
'bar'
>>> d['baz'] is None
True
"""
def __init__(self, *args, **kwargs):
super(NoneDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, None)
class StrDict(dict):
"""
StrDict is a dictionary that returns an empty string if a key
is unavailable.
>>> d = kd.StrDict(foo='bar')
>>> d['foo']
'bar'
>>> d['baz']
''
"""
def __init__(self, *args, **kwargs):
super(StrDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, str())
class DictDict(dict):
"""
DictDict is a dictionary that returns an empty StrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.DictDict()
>>> d['foo']
{}
>>> type(d['foo'])
<class 'kutils.dicts.StrDict'>
"""
def __init__(self, *args, **kwargs):
super(DictDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, StrDict())
class AttrNoneDict(AttrDict, NoneDict):
"""
AttrNoneDict returns an AttrDict that returns None if a
key isn't present.
>>> d = kd.AttrNoneDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
>>> d.bar is None
True
>>> d['bar'] is None
True
"""
def __init__(self, *args, **kwargs):
super(AttrNoneDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return None
class AttrStrDict(AttrDict, StrDict):
"""
AttrStrDict returns an AttrDict that returns an empty string if a
key isn't present.
>>> d = kd.AttrStrDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
>>> d.bar
''
>>> d['bar']
''
"""
def __init__(self, *args, **kwargs):
super(AttrStrDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return str()
class DictDict(dict):
"""
DictDict is a dictionary that returns an empty AttrStrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.DictDict()
>>> d['foo']
{}
>>> type(d['foo'])
<class 'kutils.dicts.AttrStrDict'>
>>> d.foo.bar
''
"""
def __init__(self, *args, **kwargs):
super(DictDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, AttrStrDict())
def __getattr__(self, item):
if item in self:
return self[item]
return AttrStrDict()
class AttrDictDict(AttrDict, DictDict):
"""
AttrDictDict is a dictionary that returns an empty StrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.AttrDictDict()
>>> d.foo
{}
>>> d['foo']
{}
>>> d.foo.bar
''
>>> d['foo']['bar']
''
"""
def __init__(self, *args, **kwargs):
super(AttrDictDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return AttrStrDict()
| """
dicts contains a number of special-case dictionaries.
.. testsetup:: *
import kutils.dicts as kd
"""
class Attrdict(dict):
"""
AttrDict represents a dictionary where the keys are represented as
attributes.
>>> d = kd.AttrDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
"""
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
class Nonedict(dict):
"""
NoneDict is a dictionary that returns ``None`` if a key
is unavailable.
>>> d = kd.NoneDict(foo='bar')
>>> d['foo']
'bar'
>>> d['baz'] is None
True
"""
def __init__(self, *args, **kwargs):
super(NoneDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, None)
class Strdict(dict):
"""
StrDict is a dictionary that returns an empty string if a key
is unavailable.
>>> d = kd.StrDict(foo='bar')
>>> d['foo']
'bar'
>>> d['baz']
''
"""
def __init__(self, *args, **kwargs):
super(StrDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, str())
class Dictdict(dict):
"""
DictDict is a dictionary that returns an empty StrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.DictDict()
>>> d['foo']
{}
>>> type(d['foo'])
<class 'kutils.dicts.StrDict'>
"""
def __init__(self, *args, **kwargs):
super(DictDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, str_dict())
class Attrnonedict(AttrDict, NoneDict):
"""
AttrNoneDict returns an AttrDict that returns None if a
key isn't present.
>>> d = kd.AttrNoneDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
>>> d.bar is None
True
>>> d['bar'] is None
True
"""
def __init__(self, *args, **kwargs):
super(AttrNoneDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return None
class Attrstrdict(AttrDict, StrDict):
"""
AttrStrDict returns an AttrDict that returns an empty string if a
key isn't present.
>>> d = kd.AttrStrDict(foo='bar')
>>> d.foo
'bar'
>>> d['foo']
'bar'
>>> d.bar
''
>>> d['bar']
''
"""
def __init__(self, *args, **kwargs):
super(AttrStrDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return str()
class Dictdict(dict):
"""
DictDict is a dictionary that returns an empty AttrStrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.DictDict()
>>> d['foo']
{}
>>> type(d['foo'])
<class 'kutils.dicts.AttrStrDict'>
>>> d.foo.bar
''
"""
def __init__(self, *args, **kwargs):
super(DictDict, self).__init__(*args, **kwargs)
def __getitem__(self, item):
return self.get(item, attr_str_dict())
def __getattr__(self, item):
if item in self:
return self[item]
return attr_str_dict()
class Attrdictdict(AttrDict, DictDict):
"""
AttrDictDict is a dictionary that returns an empty StrDict if a key
is unavailable. This is meant for a dictionary of dictionaries
of string values.
>>> d = kd.AttrDictDict()
>>> d.foo
{}
>>> d['foo']
{}
>>> d.foo.bar
''
>>> d['foo']['bar']
''
"""
def __init__(self, *args, **kwargs):
super(AttrDictDict, self).__init__(*args, **kwargs)
def __getattr__(self, item):
if item in self:
return self[item]
return attr_str_dict() |
##This does nothing yet...
class Broker(object):
def __init__(self):
self.name = 'ETrade'
self.tradeFee = 4.95
| class Broker(object):
def __init__(self):
self.name = 'ETrade'
self.tradeFee = 4.95 |
def direct_path(string):
"""
Given a Linux Path "/users/john/documents/../desktop/./../"
return the direct equivalent path "/users/john/"
O(n) time
O(n) space
"""
pile = []
for directory in string.split('/'):
if directory:
if directory == '.':
pass
else:
if directory == '..':
pile.pop()
else:
pile.append(directory)
return '/' + '/'.join(pile) + '/' | def direct_path(string):
"""
Given a Linux Path "/users/john/documents/../desktop/./../"
return the direct equivalent path "/users/john/"
O(n) time
O(n) space
"""
pile = []
for directory in string.split('/'):
if directory:
if directory == '.':
pass
elif directory == '..':
pile.pop()
else:
pile.append(directory)
return '/' + '/'.join(pile) + '/' |
class Neuron(object):
def __init__(self, *args, **kwargs):
super(Neuron, self).__init__() | class Neuron(object):
def __init__(self, *args, **kwargs):
super(Neuron, self).__init__() |
num = int(input('Digite uma numero:'))
b = bin(num)
o = oct(num)
h = hex(num)
print('''Escolha
[1] binario
[2] octal
[3] hex ''')
opcao = int(input('sua Opcao: '))
if opcao == 1:
print('{} convertido {}'.format(num,b[2:]))
elif opcao == 2:
print('{} convertido {}'.format(num,o[2:]))
elif opcao == 3:
print('{} convertido {}'.format(num,h[2:]))
| num = int(input('Digite uma numero:'))
b = bin(num)
o = oct(num)
h = hex(num)
print('Escolha\n[1] binario\n[2] octal\n[3] hex ')
opcao = int(input('sua Opcao: '))
if opcao == 1:
print('{} convertido {}'.format(num, b[2:]))
elif opcao == 2:
print('{} convertido {}'.format(num, o[2:]))
elif opcao == 3:
print('{} convertido {}'.format(num, h[2:])) |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and The Qt Company. For licensing terms
# and conditions see https://www.qt.io/terms-conditions. For further
# information use the contact form at https://www.qt.io/contact-us.
#
# GNU General Public License Usage
# Alternatively, this file may be used under the terms of the GNU
# General Public License version 3 as published by the Free Software
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
# included in the packaging of this file. Please review the following
# information to ensure the GNU General Public License requirements will
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
#
############################################################################
source("../../shared/qtcreator.py")
qmlEditor = ":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"
outline = ":Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView"
treebase = "keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus."
def main():
sourceExample = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_6_1_DEFAULT),
"quick", "keyinteraction")
proFile = "keyinteraction.pro"
if not neededFilePresent(os.path.join(sourceExample, proFile)):
return
templateDir = prepareTemplate(sourceExample)
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
openQmakeProject(os.path.join(templateDir, proFile), [Targets.DESKTOP_5_6_1_DEFAULT])
qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"]
checkOutlineFor(qmlFiles)
testModify()
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
def checkOutlineFor(qmlFiles):
for qmlFile in qmlFiles:
if not openDocument(qmlFile):
test.fatal("Failed to open file '%s'" % simpleFileName(qmlFile))
continue
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Outline")
pseudoTree = buildTreeFromOutline()
# __writeOutlineFile__(pseudoTree, simpleFileName(qmlFile)+"_outline.tsv")
verifyOutline(pseudoTree, simpleFileName(qmlFile) + "_outline.tsv")
def buildTreeFromOutline():
global outline
model = waitForObject(outline).model()
waitFor("model.rowCount() > 0")
snooze(1) # if model updates delayed processChildren() results in AUT crash
return processChildren(model, QModelIndex(), 0)
def processChildren(model, startIndex, level):
children = []
for index in dumpIndices(model, startIndex):
annotationData = str(index.data(Qt.UserRole + 3)) # HACK - taken from source
children.append((str(index.data()), level, annotationData))
if model.hasChildren(index):
children.extend(processChildren(model, index, level + 1))
return children
def testModify():
global qmlEditor
if not openDocument(treebase + "focus\\.qml"):
test.fatal("Failed to open file focus.qml")
return
test.log("Testing whether modifications show up inside outline.")
if not placeCursorToLine(qmlEditor, 'color: "#3E606F"'):
return
test.log("Modification: adding a QML element")
typeLines(qmlEditor, ['', '', 'Text {', 'id: addedText', 'text: "Squish QML outline test"',
'color: "darkcyan"', 'font.bold: true', 'anchors.centerIn: parent'])
selectFromCombo(":Qt Creator_Core::Internal::NavComboBox", "Outline")
snooze(1) # no way to wait for a private signal
pseudoTree = buildTreeFromOutline()
# __writeOutlineFile__(pseudoTree, "focus.qml_mod1_outline.tsv")
verifyOutline(pseudoTree, "focus.qml_mod1_outline.tsv")
test.log("Modification: change existing content")
performModification('color: "#3E606F"', "<Left>", 7, "Left", "white")
performModification('color: "black"', "<Left>", 5, "Left", "#cc00bb")
performModification('rotation: 90', None, 2, "Left", "180")
snooze(1) # no way to wait for a private signal
pseudoTree = buildTreeFromOutline()
# __writeOutlineFile__(pseudoTree, "focus.qml_mod2_outline.tsv")
verifyOutline(pseudoTree, "focus.qml_mod2_outline.tsv")
test.log("Modification: add special elements")
placeCursorToLine(qmlEditor, 'id: window')
typeLines(qmlEditor, ['', '', 'property string txtCnt: "Property"', 'signal clicked', '',
'function clicked() {','console.log("click")'])
performModification('onClicked: contextMenu.focus = true', None, 24, "Left", '{')
performModification('onClicked: {contextMenu.focus = true}', "<Left>", 0, None,
';window.clicked()')
snooze(1) # no way to wait for a private signal
pseudoTree = buildTreeFromOutline()
# __writeOutlineFile__(pseudoTree, "focus.qml_mod3_outline.tsv")
verifyOutline(pseudoTree, "focus.qml_mod3_outline.tsv")
def performModification(afterLine, typing, markCount, markDirection, newText):
global qmlEditor
if not placeCursorToLine(qmlEditor, afterLine):
return
if typing:
type(qmlEditor, typing)
markText(qmlEditor, markDirection, markCount)
type(qmlEditor, newText)
# used to create the tsv file(s)
def __writeOutlineFile__(outlinePseudoTree, filename):
f = open(filename, "w+")
f.write('"element"\t"nestinglevel"\t"value"\n')
for elem in outlinePseudoTree:
f.write('"%s"\t"%s"\t"%s"\n' % (elem[0], elem[1], elem[2].replace('"', '\"\"')))
f.close()
def retrieveData(record):
return (testData.field(record, "element"),
__builtin__.int(testData.field(record, "nestinglevel")),
testData.field(record, "value"))
def verifyOutline(outlinePseudoTree, datasetFileName):
fileName = datasetFileName[:datasetFileName.index("_")]
expected = map(retrieveData, testData.dataset(datasetFileName))
if len(expected) != len(outlinePseudoTree):
test.fail("Mismatch in length of expected and found elements of outline. Skipping "
"verification of nodes.",
"Found %d elements, but expected %d" % (len(outlinePseudoTree), len(expected)))
return
for counter, (expectedItem, foundItem) in enumerate(zip(expected, outlinePseudoTree)):
if expectedItem != foundItem:
test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName),
"%s != %s" % (str(expectedItem), str(foundItem)))
return
test.passes("All nodes (%d) inside outline match expected nodes for '%s'."
% (len(expected), fileName))
| source('../../shared/qtcreator.py')
qml_editor = ':Qt Creator_QmlJSEditor::QmlJSTextEditorWidget'
outline = ':Qt Creator_QmlJSEditor::Internal::QmlJSOutlineTreeView'
treebase = 'keyinteraction.Resources.keyinteraction\\.qrc./keyinteraction.focus.'
def main():
source_example = os.path.join(Qt5Path.examplesPath(Targets.DESKTOP_5_6_1_DEFAULT), 'quick', 'keyinteraction')
pro_file = 'keyinteraction.pro'
if not needed_file_present(os.path.join(sourceExample, proFile)):
return
template_dir = prepare_template(sourceExample)
start_application('qtcreator' + SettingsPath)
if not started_without_plugin_error():
return
open_qmake_project(os.path.join(templateDir, proFile), [Targets.DESKTOP_5_6_1_DEFAULT])
qml_files = [treebase + 'focus\\.qml', treebase + 'Core.ListMenu\\.qml']
check_outline_for(qmlFiles)
test_modify()
invoke_menu_item('File', 'Save All')
invoke_menu_item('File', 'Exit')
def check_outline_for(qmlFiles):
for qml_file in qmlFiles:
if not open_document(qmlFile):
test.fatal("Failed to open file '%s'" % simple_file_name(qmlFile))
continue
select_from_combo(':Qt Creator_Core::Internal::NavComboBox', 'Outline')
pseudo_tree = build_tree_from_outline()
verify_outline(pseudoTree, simple_file_name(qmlFile) + '_outline.tsv')
def build_tree_from_outline():
global outline
model = wait_for_object(outline).model()
wait_for('model.rowCount() > 0')
snooze(1)
return process_children(model, q_model_index(), 0)
def process_children(model, startIndex, level):
children = []
for index in dump_indices(model, startIndex):
annotation_data = str(index.data(Qt.UserRole + 3))
children.append((str(index.data()), level, annotationData))
if model.hasChildren(index):
children.extend(process_children(model, index, level + 1))
return children
def test_modify():
global qmlEditor
if not open_document(treebase + 'focus\\.qml'):
test.fatal('Failed to open file focus.qml')
return
test.log('Testing whether modifications show up inside outline.')
if not place_cursor_to_line(qmlEditor, 'color: "#3E606F"'):
return
test.log('Modification: adding a QML element')
type_lines(qmlEditor, ['', '', 'Text {', 'id: addedText', 'text: "Squish QML outline test"', 'color: "darkcyan"', 'font.bold: true', 'anchors.centerIn: parent'])
select_from_combo(':Qt Creator_Core::Internal::NavComboBox', 'Outline')
snooze(1)
pseudo_tree = build_tree_from_outline()
verify_outline(pseudoTree, 'focus.qml_mod1_outline.tsv')
test.log('Modification: change existing content')
perform_modification('color: "#3E606F"', '<Left>', 7, 'Left', 'white')
perform_modification('color: "black"', '<Left>', 5, 'Left', '#cc00bb')
perform_modification('rotation: 90', None, 2, 'Left', '180')
snooze(1)
pseudo_tree = build_tree_from_outline()
verify_outline(pseudoTree, 'focus.qml_mod2_outline.tsv')
test.log('Modification: add special elements')
place_cursor_to_line(qmlEditor, 'id: window')
type_lines(qmlEditor, ['', '', 'property string txtCnt: "Property"', 'signal clicked', '', 'function clicked() {', 'console.log("click")'])
perform_modification('onClicked: contextMenu.focus = true', None, 24, 'Left', '{')
perform_modification('onClicked: {contextMenu.focus = true}', '<Left>', 0, None, ';window.clicked()')
snooze(1)
pseudo_tree = build_tree_from_outline()
verify_outline(pseudoTree, 'focus.qml_mod3_outline.tsv')
def perform_modification(afterLine, typing, markCount, markDirection, newText):
global qmlEditor
if not place_cursor_to_line(qmlEditor, afterLine):
return
if typing:
type(qmlEditor, typing)
mark_text(qmlEditor, markDirection, markCount)
type(qmlEditor, newText)
def __write_outline_file__(outlinePseudoTree, filename):
f = open(filename, 'w+')
f.write('"element"\t"nestinglevel"\t"value"\n')
for elem in outlinePseudoTree:
f.write('"%s"\t"%s"\t"%s"\n' % (elem[0], elem[1], elem[2].replace('"', '""')))
f.close()
def retrieve_data(record):
return (testData.field(record, 'element'), __builtin__.int(testData.field(record, 'nestinglevel')), testData.field(record, 'value'))
def verify_outline(outlinePseudoTree, datasetFileName):
file_name = datasetFileName[:datasetFileName.index('_')]
expected = map(retrieveData, testData.dataset(datasetFileName))
if len(expected) != len(outlinePseudoTree):
test.fail('Mismatch in length of expected and found elements of outline. Skipping verification of nodes.', 'Found %d elements, but expected %d' % (len(outlinePseudoTree), len(expected)))
return
for (counter, (expected_item, found_item)) in enumerate(zip(expected, outlinePseudoTree)):
if expectedItem != foundItem:
test.fail("Mismatch in element number %d for '%s'" % (counter + 1, fileName), '%s != %s' % (str(expectedItem), str(foundItem)))
return
test.passes("All nodes (%d) inside outline match expected nodes for '%s'." % (len(expected), fileName)) |
def extra_end(str):
if len(str) <= 2:
return (str * 3)
return (str[-2:]*3)
| def extra_end(str):
if len(str) <= 2:
return str * 3
return str[-2:] * 3 |
class Obstacle(object):
def __init__(self, position):
self.position = position
self.positionHistory = [position]
self.ObstaclePotentialForces = [] | class Obstacle(object):
def __init__(self, position):
self.position = position
self.positionHistory = [position]
self.ObstaclePotentialForces = [] |
"""
At_initial_setup module template
Copy this module up one level to /gamesrc/conf, name it what you like
and then use it as a template to modify.
Then edit settings.AT_INITIAL_SETUP_HOOK_MODULE to point to your new
module.
Custom at_initial_setup method. This allows you to hook special
modifications to the initial server startup process. Note that this
will only be run once - when the server starts up for the very first
time! It is called last in the startup process and can thus be used to
overload things that happened before it.
The module must contain a global function at_initial_setup(). This
will be called without arguments. Note that tracebacks in this module
will be QUIETLY ignored, so make sure to check it well to make sure it
does what you expect it to.
"""
def at_initial_setup():
pass
| """
At_initial_setup module template
Copy this module up one level to /gamesrc/conf, name it what you like
and then use it as a template to modify.
Then edit settings.AT_INITIAL_SETUP_HOOK_MODULE to point to your new
module.
Custom at_initial_setup method. This allows you to hook special
modifications to the initial server startup process. Note that this
will only be run once - when the server starts up for the very first
time! It is called last in the startup process and can thus be used to
overload things that happened before it.
The module must contain a global function at_initial_setup(). This
will be called without arguments. Note that tracebacks in this module
will be QUIETLY ignored, so make sure to check it well to make sure it
does what you expect it to.
"""
def at_initial_setup():
pass |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-LLDP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-LLDP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:16:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
CiscoNetworkAddress, CiscoAlarmSeverity, CiscoInetAddressMask, Unsigned64, TimeIntervalSec = mibBuilder.importSymbols("CISCO-TC", "CiscoNetworkAddress", "CiscoAlarmSeverity", "CiscoInetAddressMask", "Unsigned64", "TimeIntervalSec")
ciscoUnifiedComputingMIBObjects, CucsManagedObjectDn, CucsManagedObjectId = mibBuilder.importSymbols("CISCO-UNIFIED-COMPUTING-MIB", "ciscoUnifiedComputingMIBObjects", "CucsManagedObjectDn", "CucsManagedObjectId")
InetAddressIPv6, InetAddressIPv4 = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6", "InetAddressIPv4")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, ModuleIdentity, Unsigned32, Bits, ObjectIdentity, Counter64, MibIdentifier, TimeTicks, iso, IpAddress, Integer32, Gauge32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "ModuleIdentity", "Unsigned32", "Bits", "ObjectIdentity", "Counter64", "MibIdentifier", "TimeTicks", "iso", "IpAddress", "Integer32", "Gauge32", "Counter32")
RowPointer, TimeInterval, TimeStamp, TruthValue, MacAddress, DisplayString, TextualConvention, DateAndTime = mibBuilder.importSymbols("SNMPv2-TC", "RowPointer", "TimeInterval", "TimeStamp", "TruthValue", "MacAddress", "DisplayString", "TextualConvention", "DateAndTime")
cucsLldpObjects = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58))
if mibBuilder.loadTexts: cucsLldpObjects.setLastUpdated('201601180000Z')
if mibBuilder.loadTexts: cucsLldpObjects.setOrganization('Cisco Systems Inc.')
if mibBuilder.loadTexts: cucsLldpObjects.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553 -NETS E-mail: cs-san@cisco.com, cs-lan-switch-snmp@cisco.com')
if mibBuilder.loadTexts: cucsLldpObjects.setDescription('MIB representation of the Cisco Unified Computing System LLDP management information model package')
cucsLldpAcquiredTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1), )
if mibBuilder.loadTexts: cucsLldpAcquiredTable.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredTable.setDescription('Cisco UCS lldp:Acquired managed object table')
cucsLldpAcquiredEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1), ).setIndexNames((0, "CISCO-UNIFIED-COMPUTING-LLDP-MIB", "cucsLldpAcquiredInstanceId"))
if mibBuilder.loadTexts: cucsLldpAcquiredEntry.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredEntry.setDescription('Entry for the cucsLldpAcquiredTable table.')
cucsLldpAcquiredInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 1), CucsManagedObjectId())
if mibBuilder.loadTexts: cucsLldpAcquiredInstanceId.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredInstanceId.setDescription('Instance identifier of the managed object.')
cucsLldpAcquiredDn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 2), CucsManagedObjectDn()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredDn.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredDn.setDescription('Cisco UCS lldp:Acquired:dn managed object property')
cucsLldpAcquiredRn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 3), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredRn.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredRn.setDescription('Cisco UCS lldp:Acquired:rn managed object property')
cucsLldpAcquiredAcqts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 4), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredAcqts.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredAcqts.setDescription('Cisco UCS lldp:Acquired:acqts managed object property')
cucsLldpAcquiredChassisMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 5), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredChassisMac.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredChassisMac.setDescription('Cisco UCS lldp:Acquired:chassisMac managed object property')
cucsLldpAcquiredPeerDn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 6), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredPeerDn.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredPeerDn.setDescription('Cisco UCS lldp:Acquired:peerDn managed object property')
cucsLldpAcquiredPortMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 7), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cucsLldpAcquiredPortMac.setStatus('current')
if mibBuilder.loadTexts: cucsLldpAcquiredPortMac.setDescription('Cisco UCS lldp:Acquired:portMac managed object property')
mibBuilder.exportSymbols("CISCO-UNIFIED-COMPUTING-LLDP-MIB", cucsLldpObjects=cucsLldpObjects, cucsLldpAcquiredAcqts=cucsLldpAcquiredAcqts, cucsLldpAcquiredTable=cucsLldpAcquiredTable, cucsLldpAcquiredPeerDn=cucsLldpAcquiredPeerDn, cucsLldpAcquiredEntry=cucsLldpAcquiredEntry, cucsLldpAcquiredPortMac=cucsLldpAcquiredPortMac, cucsLldpAcquiredInstanceId=cucsLldpAcquiredInstanceId, PYSNMP_MODULE_ID=cucsLldpObjects, cucsLldpAcquiredRn=cucsLldpAcquiredRn, cucsLldpAcquiredDn=cucsLldpAcquiredDn, cucsLldpAcquiredChassisMac=cucsLldpAcquiredChassisMac)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(cisco_network_address, cisco_alarm_severity, cisco_inet_address_mask, unsigned64, time_interval_sec) = mibBuilder.importSymbols('CISCO-TC', 'CiscoNetworkAddress', 'CiscoAlarmSeverity', 'CiscoInetAddressMask', 'Unsigned64', 'TimeIntervalSec')
(cisco_unified_computing_mib_objects, cucs_managed_object_dn, cucs_managed_object_id) = mibBuilder.importSymbols('CISCO-UNIFIED-COMPUTING-MIB', 'ciscoUnifiedComputingMIBObjects', 'CucsManagedObjectDn', 'CucsManagedObjectId')
(inet_address_i_pv6, inet_address_i_pv4) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressIPv6', 'InetAddressIPv4')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, module_identity, unsigned32, bits, object_identity, counter64, mib_identifier, time_ticks, iso, ip_address, integer32, gauge32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'ModuleIdentity', 'Unsigned32', 'Bits', 'ObjectIdentity', 'Counter64', 'MibIdentifier', 'TimeTicks', 'iso', 'IpAddress', 'Integer32', 'Gauge32', 'Counter32')
(row_pointer, time_interval, time_stamp, truth_value, mac_address, display_string, textual_convention, date_and_time) = mibBuilder.importSymbols('SNMPv2-TC', 'RowPointer', 'TimeInterval', 'TimeStamp', 'TruthValue', 'MacAddress', 'DisplayString', 'TextualConvention', 'DateAndTime')
cucs_lldp_objects = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58))
if mibBuilder.loadTexts:
cucsLldpObjects.setLastUpdated('201601180000Z')
if mibBuilder.loadTexts:
cucsLldpObjects.setOrganization('Cisco Systems Inc.')
if mibBuilder.loadTexts:
cucsLldpObjects.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553 -NETS E-mail: cs-san@cisco.com, cs-lan-switch-snmp@cisco.com')
if mibBuilder.loadTexts:
cucsLldpObjects.setDescription('MIB representation of the Cisco Unified Computing System LLDP management information model package')
cucs_lldp_acquired_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1))
if mibBuilder.loadTexts:
cucsLldpAcquiredTable.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredTable.setDescription('Cisco UCS lldp:Acquired managed object table')
cucs_lldp_acquired_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1)).setIndexNames((0, 'CISCO-UNIFIED-COMPUTING-LLDP-MIB', 'cucsLldpAcquiredInstanceId'))
if mibBuilder.loadTexts:
cucsLldpAcquiredEntry.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredEntry.setDescription('Entry for the cucsLldpAcquiredTable table.')
cucs_lldp_acquired_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 1), cucs_managed_object_id())
if mibBuilder.loadTexts:
cucsLldpAcquiredInstanceId.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredInstanceId.setDescription('Instance identifier of the managed object.')
cucs_lldp_acquired_dn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 2), cucs_managed_object_dn()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredDn.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredDn.setDescription('Cisco UCS lldp:Acquired:dn managed object property')
cucs_lldp_acquired_rn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 3), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredRn.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredRn.setDescription('Cisco UCS lldp:Acquired:rn managed object property')
cucs_lldp_acquired_acqts = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 4), date_and_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredAcqts.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredAcqts.setDescription('Cisco UCS lldp:Acquired:acqts managed object property')
cucs_lldp_acquired_chassis_mac = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 5), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredChassisMac.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredChassisMac.setDescription('Cisco UCS lldp:Acquired:chassisMac managed object property')
cucs_lldp_acquired_peer_dn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 6), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredPeerDn.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredPeerDn.setDescription('Cisco UCS lldp:Acquired:peerDn managed object property')
cucs_lldp_acquired_port_mac = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 719, 1, 58, 1, 1, 7), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cucsLldpAcquiredPortMac.setStatus('current')
if mibBuilder.loadTexts:
cucsLldpAcquiredPortMac.setDescription('Cisco UCS lldp:Acquired:portMac managed object property')
mibBuilder.exportSymbols('CISCO-UNIFIED-COMPUTING-LLDP-MIB', cucsLldpObjects=cucsLldpObjects, cucsLldpAcquiredAcqts=cucsLldpAcquiredAcqts, cucsLldpAcquiredTable=cucsLldpAcquiredTable, cucsLldpAcquiredPeerDn=cucsLldpAcquiredPeerDn, cucsLldpAcquiredEntry=cucsLldpAcquiredEntry, cucsLldpAcquiredPortMac=cucsLldpAcquiredPortMac, cucsLldpAcquiredInstanceId=cucsLldpAcquiredInstanceId, PYSNMP_MODULE_ID=cucsLldpObjects, cucsLldpAcquiredRn=cucsLldpAcquiredRn, cucsLldpAcquiredDn=cucsLldpAcquiredDn, cucsLldpAcquiredChassisMac=cucsLldpAcquiredChassisMac) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# input
input_data = []
with open('input.txt', 'r') as f:
lines = f.readlines()
input_data = [l.strip().split(')') for l in lines]
# structures
orbits_down = dict(zip([inp[1] for inp in input_data], [inp[0] for inp in input_data]))
# task 1
total = 0
all_centers = orbits_down.values()
for center, satellite in orbits_down.items():
current = 0
current += satellite not in all_centers
next_center = center
while next_center != 'COM':
current += 1
next_center = orbits_down[next_center]
total += current
print(total)
# task 2
def track(satellite):
trace = []
center = orbits_down[satellite]
while center != 'COM':
trace.append(center)
center = orbits_down[center]
return trace
trace_you = track('YOU')
trace_san = track('SAN')
last_common = 'COM'
while True:
if trace_you[-1] == trace_san[-1]:
last_common = trace_san[-1]
trace_you.pop()
trace_san.pop()
else:
break
print(len(trace_you) + len(trace_san)) | input_data = []
with open('input.txt', 'r') as f:
lines = f.readlines()
input_data = [l.strip().split(')') for l in lines]
orbits_down = dict(zip([inp[1] for inp in input_data], [inp[0] for inp in input_data]))
total = 0
all_centers = orbits_down.values()
for (center, satellite) in orbits_down.items():
current = 0
current += satellite not in all_centers
next_center = center
while next_center != 'COM':
current += 1
next_center = orbits_down[next_center]
total += current
print(total)
def track(satellite):
trace = []
center = orbits_down[satellite]
while center != 'COM':
trace.append(center)
center = orbits_down[center]
return trace
trace_you = track('YOU')
trace_san = track('SAN')
last_common = 'COM'
while True:
if trace_you[-1] == trace_san[-1]:
last_common = trace_san[-1]
trace_you.pop()
trace_san.pop()
else:
break
print(len(trace_you) + len(trace_san)) |
"""
DockCI exceptions
"""
class InvalidOperationError(Exception):
"""
Raised when a call is not valid at the current time
"""
pass
class AlreadyBuiltError(Exception):
"""
Raised when a versioned build already exists in the repository
"""
pass
class AlreadyRunError(InvalidOperationError):
"""
Raised when a build or stage is attempted to be run that has already been
started/completed
"""
runnable = None
def __init__(self, runnable):
super(AlreadyRunError, self).__init__()
self.runnable = runnable
| """
DockCI exceptions
"""
class Invalidoperationerror(Exception):
"""
Raised when a call is not valid at the current time
"""
pass
class Alreadybuilterror(Exception):
"""
Raised when a versioned build already exists in the repository
"""
pass
class Alreadyrunerror(InvalidOperationError):
"""
Raised when a build or stage is attempted to be run that has already been
started/completed
"""
runnable = None
def __init__(self, runnable):
super(AlreadyRunError, self).__init__()
self.runnable = runnable |
def Num14681():
x = int(input())
y = int(input())
result = 0
if x > 0:
if y > 0:
result = 1
else:
result = 4
else:
if y < 0:
result = 3
else:
result = 2
print(str(result))
Num14681() | def num14681():
x = int(input())
y = int(input())
result = 0
if x > 0:
if y > 0:
result = 1
else:
result = 4
elif y < 0:
result = 3
else:
result = 2
print(str(result))
num14681() |
#Given an array of integers, find the one that appears an odd number of times.
#There will always be only one integer that appears an odd number of times.
def find_it(arr):
res = 0
for element in arr:
res = res ^ element
return res
| def find_it(arr):
res = 0
for element in arr:
res = res ^ element
return res |
__author__ = 'samantha'
def checkio(words):
#l = list()
#for word in words.split():
# l.append(word.isalpha())
print(words)
res = False
l = [wd.isalpha() for wd in words.split()]
#r = [l[i:i+3] for i in range(0,len(l)-3) ]
#print ('r=',r)
print ('l=',l)
if len(l)>3:
print ('len(l)=', len(l))
print('range', range(0,len(l)-2))
for i in range(0,(len(l)-2)):
print ('i=', i)
l2 = l[i:i+3]
print('l2=', l2)
res = all(x == True for x in l2)
print ('res=', res)
elif len(l) == 3:
res = all(x == True for x in l)
return res
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("Hello World hello") == True, "Hello"
assert checkio("He is 123 man") == False, "123 man"
assert checkio("1 2 3 4") == False, "Digits"
assert checkio("bla bla bla bla") == True, "Bla Bla"
assert checkio("Hi") == False, "Hi"
assert checkio("0 qwerty iddqd asdfg") == True, "0 qwert"
| __author__ = 'samantha'
def checkio(words):
print(words)
res = False
l = [wd.isalpha() for wd in words.split()]
print('l=', l)
if len(l) > 3:
print('len(l)=', len(l))
print('range', range(0, len(l) - 2))
for i in range(0, len(l) - 2):
print('i=', i)
l2 = l[i:i + 3]
print('l2=', l2)
res = all((x == True for x in l2))
print('res=', res)
elif len(l) == 3:
res = all((x == True for x in l))
return res
if __name__ == '__main__':
assert checkio('Hello World hello') == True, 'Hello'
assert checkio('He is 123 man') == False, '123 man'
assert checkio('1 2 3 4') == False, 'Digits'
assert checkio('bla bla bla bla') == True, 'Bla Bla'
assert checkio('Hi') == False, 'Hi'
assert checkio('0 qwerty iddqd asdfg') == True, '0 qwert' |
class FrontendPortTotalThroughput(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_frontend_port_total_iops(idx_name)
class FrontendPortTotalThroughputColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_frontend_ports()
| class Frontendporttotalthroughput(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_frontend_port_total_iops(idx_name)
class Frontendporttotalthroughputcolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_frontend_ports() |
DEBUG = True
MOLLIE_API_KEY = ''
REDIS_HOST = 'localhost'
COOKIE_NAME = 'Paywall-Voucher'
CSRF_SECRET_KEY = 'NeVeR WoUnD a SnAke KiLl It'
| debug = True
mollie_api_key = ''
redis_host = 'localhost'
cookie_name = 'Paywall-Voucher'
csrf_secret_key = 'NeVeR WoUnD a SnAke KiLl It' |
def field_validator(keys, data_):
"""
Validates the submitted data are POSTed with the required fields
:param keys:
:param data_:
:return:
"""
data = {}
for v in keys:
if v not in data_:
data[v] = ["This field may not be null."]
if len(data) != 0:
return {"success": False, "data": data}
elif len(data) == 0:
return {"success": True, "data": data}
| def field_validator(keys, data_):
"""
Validates the submitted data are POSTed with the required fields
:param keys:
:param data_:
:return:
"""
data = {}
for v in keys:
if v not in data_:
data[v] = ['This field may not be null.']
if len(data) != 0:
return {'success': False, 'data': data}
elif len(data) == 0:
return {'success': True, 'data': data} |
# Copyright 2017 Rice University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LABELS = ['swing', 'awt', 'security', 'sql', 'net', 'xml', 'crypto', 'math']
def get_api(config, calls, apiOrNot):
apis = []
for call, api_bool in zip(calls, apiOrNot):
if api_bool and call > 0:
api = config.vocab.chars_api[call]
apis.append(api)
apis_ = []
for api in apis:
try:
api_mid = api.split('.')[1]
except:
api_mid = []
apis_.append(api_mid)
guard = []
for api in apis_:
if api in LABELS:
label = api
guard.append(label)
if len(set(guard)) != 1:
return 'N/A'
else:
return guard[0]
| labels = ['swing', 'awt', 'security', 'sql', 'net', 'xml', 'crypto', 'math']
def get_api(config, calls, apiOrNot):
apis = []
for (call, api_bool) in zip(calls, apiOrNot):
if api_bool and call > 0:
api = config.vocab.chars_api[call]
apis.append(api)
apis_ = []
for api in apis:
try:
api_mid = api.split('.')[1]
except:
api_mid = []
apis_.append(api_mid)
guard = []
for api in apis_:
if api in LABELS:
label = api
guard.append(label)
if len(set(guard)) != 1:
return 'N/A'
else:
return guard[0] |
__all__ = ['VERSION']
VERSION = '7.6.0'
SAVE_PATH = '~/.spotifydl'
SPOTIPY_CLIENT_ID = "4fe3fecfe5334023a1472516cc99d805"
SPOTIPY_CLIENT_SECRET = "0f02b7c483c04257984695007a4a8d5c"
| __all__ = ['VERSION']
version = '7.6.0'
save_path = '~/.spotifydl'
spotipy_client_id = '4fe3fecfe5334023a1472516cc99d805'
spotipy_client_secret = '0f02b7c483c04257984695007a4a8d5c' |
#!/usr/bin/env python3
print("Hello Inderpal Singh!")
print("Welcome to python scripting.")
print("Learning python opens new doors of opportunity.")
| print('Hello Inderpal Singh!')
print('Welcome to python scripting.')
print('Learning python opens new doors of opportunity.') |
while True:
try:
bil = input("masukan bilangan: ")
bil = int(bil)
break
except ValueError:
print("anda salah memasukan bilangan")
print("anda memasukan bilangan %s, data harus angka" % bil )
print("anda memasukan bilangan", bil) | while True:
try:
bil = input('masukan bilangan: ')
bil = int(bil)
break
except ValueError:
print('anda salah memasukan bilangan')
print('anda memasukan bilangan %s, data harus angka' % bil)
print('anda memasukan bilangan', bil) |
class ViewportInfo(object,IDisposable,ISerializable):
"""
Represents a viewing frustum.
ViewportInfo()
ViewportInfo(other: ViewportInfo)
ViewportInfo(rhinoViewport: RhinoViewport)
"""
def ChangeToParallelProjection(self,symmetricFrustum):
"""
ChangeToParallelProjection(self: ViewportInfo,symmetricFrustum: bool) -> bool
Use this function to change projections of valid viewports
from parallel to
perspective. It will make common additional
adjustments to the frustum and camera
location so the resulting
views are similar. The camera direction and target point
are
not be changed.
If the current projection is parallel and
symmetricFrustum,
FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric()
are all equal,then no changes are made and true is returned.
symmetricFrustum: true if you want the resulting frustum to be symmetric.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def ChangeToPerspectiveProjection(self,targetDistance,symmetricFrustum,lensLength):
"""
ChangeToPerspectiveProjection(self: ViewportInfo,targetDistance: float,symmetricFrustum: bool,lensLength: float) -> bool
Use this function to change projections of valid viewports
from parallel to
perspective. It will make common additional
adjustments to the frustum and camera
location so the resulting
views are similar. The camera direction and target point
are
not changed.
If the current projection is perspective and
symmetricFrustum,
IsFrustumIsLeftRightSymmetric,and IsFrustumIsTopBottomSymmetric
are all equal,then no changes are made and true is returned.
targetDistance: If RhinoMath.UnsetValue this parameter is ignored.
Otherwise it must be > 0 and
indicates which plane in the current view frustum should be perserved.
symmetricFrustum: true if you want the resulting frustum to be symmetric.
lensLength: (pass 50.0 when in doubt)
35 mm lens length to use when changing from parallel
to perspective projections. If the current projection
is perspective or
lens_length is <= 0.0,
then this parameter is ignored.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def ChangeToSymmetricFrustum(self,isLeftRightSymmetric,isTopBottomSymmetric,targetDistance):
"""
ChangeToSymmetricFrustum(self: ViewportInfo,isLeftRightSymmetric: bool,isTopBottomSymmetric: bool,targetDistance: float) -> bool
If needed,adjusts the current frustum so it has the
specified symmetries and
adjust the camera location
so the target plane remains visible.
isLeftRightSymmetric: If true,the frustum will be adjusted so left=-right.
isTopBottomSymmetric: If true,the frustum will be adjusted so top=-bottom.
targetDistance: If projection is not perspective or target_distance is RhinoMath.UnsetValue,
then
this parameter is ignored. If the projection is perspective and targetDistance
is
not RhinoMath.UnsetValue,then it must be > 0.0 and it is used to determine
which
plane in the old frustum will appear unchanged in the new frustum.
Returns: Returns true if the viewport has now a frustum with the specified symmetries.
"""
pass
def ChangeToTwoPointPerspectiveProjection(self,targetDistance,up,lensLength):
"""
ChangeToTwoPointPerspectiveProjection(self: ViewportInfo,targetDistance: float,up: Vector3d,lensLength: float) -> bool
Changes projections of valid viewports
to a two point perspective. It will make
common additional
adjustments to the frustum and camera location and direction
so the resulting views are similar.
If the current projection is
perspective and
IsFrustumIsLeftRightSymmetric is true and
IsFrustumIsTopBottomSymmetric is false,then no changes are
made and true is
returned.
targetDistance: If RhinoMath.UnsetValue this parameter is ignored. Otherwise
it must be > 0 and
indicates which plane in the current
view frustum should be perserved.
up: The locked up direction. Pass Vector3d.Zero if you want to use the world
axis
direction that is closest to the current up direction.
Pass CameraY() if you want
to preserve the current up direction.
lensLength: (pass 50.0 when in doubt)
35 mm lens length to use when changing from parallel
to perspective projections. If the current projection
is perspective or
lens_length is <= 0.0,
then this parameter is ignored.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def Dispose(self):
"""
Dispose(self: ViewportInfo)
Actively reclaims unmanaged resources that this instance uses.
"""
pass
def DollyCamera(self,dollyVector):
"""
DollyCamera(self: ViewportInfo,dollyVector: Vector3d) -> bool
DollyCamera() does not update the frustum's clipping planes.
To update the
frustum's clipping planes call DollyFrustum(d)
with d=dollyVector o cameraFrameZ.
To convert screen locations
into a dolly vector,use GetDollyCameraVector().
Does not update frustum. To update frustum use DollyFrustum(d) with d=dollyVector o
cameraFrameZ.
dollyVector: dolly vector in world coordinates.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def DollyExtents(self,*__args):
"""
DollyExtents(self: ViewportInfo,cameraCoordinateBoundingBox: BoundingBox,border: float) -> bool
Dolly the camera location and so that the view frustum contains
all of the document
objects that can be seen in view.
If the projection is perspective,the camera
angle is not changed.
border: If border > 1.0,then the fustum in enlarged by this factor
to provide a border
around the view. 1.1 works well for
parallel projections; 0.0 is suggested for
perspective projections.
Returns: True if successful.
DollyExtents(self: ViewportInfo,geometry: IEnumerable[GeometryBase],border: float) -> bool
"""
pass
def DollyFrustum(self,dollyDistance):
"""
DollyFrustum(self: ViewportInfo,dollyDistance: float) -> bool
Moves the frustum clipping planes.
dollyDistance: Distance to move in camera direction.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def Extents(self,halfViewAngleRadians,*__args):
"""
Extents(self: ViewportInfo,halfViewAngleRadians: float,sphere: Sphere) -> bool
Extends this viewport view to include a sphere.
Use Extents() as a quick way to set
a viewport to so that bounding
volume is inside of a viewports frustrum.
The view angle is used to determine the position of the camera.
halfViewAngleRadians: 1/2 smallest subtended view angle in radians.
sphere: A sphere in 3d world coordinates.
Returns: true if the operation succeeded; otherwise,false.
Extents(self: ViewportInfo,halfViewAngleRadians: float,bbox: BoundingBox) -> bool
Extends this viewport view to include a bounding box.
Use Extents() as a quick way
to set a viewport to so that bounding
volume is inside of a viewports frustrum.
The view angle is used to determine the position of the camera.
halfViewAngleRadians: 1/2 smallest subtended view angle in radians.
bbox: A bounding box in 3d world coordinates.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def FrustumCenterPoint(self,targetDistance):
"""
FrustumCenterPoint(self: ViewportInfo,targetDistance: float) -> Point3d
Return a point on the central axis of the view frustum.
This point is a good choice
for a general purpose target point.
targetDistance: If targetDistance > 0.0,then the distance from the returned
point to the camera
plane will be targetDistance. Note that
if the frustum is not symmetric,the
distance from the
returned point to the camera location will be larger than
targetDistance.
If targetDistance == ON_UNSET_VALUE and the frustum
is valid with near > 0.0,then 0.5*(near + far) will be used
as the
targetDistance.
Returns: A point on the frustum's central axis. If the viewport or input
is not valid,then
ON_3dPoint::UnsetPoint is returned.
"""
pass
def GetBoundingBoxDepth(self,bbox,nearDistance,farDistance):
"""
GetBoundingBoxDepth(self: ViewportInfo,bbox: BoundingBox) -> (bool,float,float)
Gets near and far clipping distances of a bounding box.
This function ignores the
current value of the viewport's
near and far settings. If the viewport is a
perspective
projection,the it intersects the semi infinite frustum
volume with the bounding box and returns the near and far
distances of the
intersection. If the viewport is a parallel
projection,it instersects the infinte
view region with the
bounding box and returns the near and far distances of the
projection.
bbox: The bounding box to sample.
Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set.
false if the bounding box does not intesect the view frustum.
"""
pass
def GetCameraAngles(self,halfDiagonalAngleRadians,halfVerticalAngleRadians,halfHorizontalAngleRadians):
"""
GetCameraAngles(self: ViewportInfo) -> (bool,float,float,float)
Gets the field of view angles.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def GetCameraFrame(self,location,cameraX,cameraY,cameraZ):
"""
GetCameraFrame(self: ViewportInfo) -> (bool,Point3d,Vector3d,Vector3d,Vector3d)
Gets location and vectors of this camera.
Returns: true if current camera orientation is valid; otherwise false.
"""
pass
def GetDollyCameraVector(self,*__args):
"""
GetDollyCameraVector(self: ViewportInfo,screen0: Point,screen1: Point,projectionPlaneDistance: float) -> Vector3d
Gets a world coordinate dolly vector that can be passed to DollyCamera().
screen0: Start point.
screen1: End point.
projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far).
Returns: The world coordinate dolly vector.
GetDollyCameraVector(self: ViewportInfo,screenX0: int,screenY0: int,screenX1: int,screenY1: int,projectionPlaneDistance: float) -> Vector3d
Gets a world coordinate dolly vector that can be passed to DollyCamera().
screenX0: Screen coords of start point.
screenY0: Screen coords of start point.
screenX1: Screen coords of end point.
screenY1: Screen coords of end point.
projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far).
Returns: The world coordinate dolly vector.
"""
pass
def GetFarPlaneCorners(self):
"""
GetFarPlaneCorners(self: ViewportInfo) -> Array[Point3d]
Gets the corners of far clipping plane rectangle.
4 points are returned in the
order of bottom left,bottom right,
top left,top right.
Returns: Four corner points on success.
Empty array if viewport is not valid.
"""
pass
def GetFrustum(self,left,right,bottom,top,nearDistance,farDistance):
"""
GetFrustum(self: ViewportInfo) -> (bool,float,float,float,float,float,float)
Gets the view frustum.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def GetFrustumLine(self,*__args):
"""
GetFrustumLine(self: ViewportInfo,screenPoint: PointF) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenPoint: screen location
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
GetFrustumLine(self: ViewportInfo,screenPoint: Point) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenPoint: screen location
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
GetFrustumLine(self: ViewportInfo,screenX: float,screenY: float) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenX: (screenx,screeny)=screen location.
screenY: (screenx,screeny)=screen location.
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
"""
pass
def GetNearPlaneCorners(self):
"""
GetNearPlaneCorners(self: ViewportInfo) -> Array[Point3d]
Gets the corners of near clipping plane rectangle.
4 points are returned in the
order of bottom left,bottom right,
top left,top right.
Returns: Four corner points on success.
Empty array if viewport is not valid.
"""
pass
def GetObjectData(self,info,context):
"""
GetObjectData(self: ViewportInfo,info: SerializationInfo,context: StreamingContext)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the
target object.
info: The System.Runtime.Serialization.SerializationInfo to populate with data.
context: The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.
"""
pass
def GetPointDepth(self,point,distance):
"""
GetPointDepth(self: ViewportInfo,point: Point3d) -> (bool,float)
Gets the clipping distance of a point. This function ignores the
current value of
the viewport's near and far settings. If
the viewport is a perspective projection,
then it intersects
the semi infinite frustum volume with the bounding box and
returns the near and far distances of the intersection.
If the viewport is a
parallel projection,it instersects the
infinte view region with the bounding box
and returns the
near and far distances of the projection.
point: A point to measure.
Returns: true if the bounding box intersects the view frustum and
near_dist/far_dist were
set.
false if the bounding box does not intesect the view frustum.
"""
pass
def GetScreenPort(self,near=None,far=None):
"""
GetScreenPort(self: ViewportInfo) -> Rectangle
Gets the location of viewport in pixels.
See documentation for
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error.
GetScreenPort(self: ViewportInfo) -> (Rectangle,int,int)
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error.
"""
pass
def GetSphereDepth(self,sphere,nearDistance,farDistance):
"""
GetSphereDepth(self: ViewportInfo,sphere: Sphere) -> (bool,float,float)
Gets near and far clipping distances of a bounding sphere.
sphere: The sphere to sample.
Returns: true if the sphere intersects the view frustum and near_dist/far_dist were set.
false if the sphere does not intesect the view frustum.
"""
pass
def GetWorldToScreenScale(self,pointInFrustum):
"""
GetWorldToScreenScale(self: ViewportInfo,pointInFrustum: Point3d) -> float
Gets the scale factor from point in frustum to screen scale.
pointInFrustum: point in viewing frustum.
Returns: number of pixels per world unit at the 3d point.
"""
pass
def GetXform(self,sourceSystem,destinationSystem):
"""
GetXform(self: ViewportInfo,sourceSystem: CoordinateSystem,destinationSystem: CoordinateSystem) -> Transform
Computes a transform from a coordinate system to another.
sourceSystem: The coordinate system to map from.
destinationSystem: The coordinate system to map into.
Returns: The 4x4 transformation matrix (acts on the left).
"""
pass
def SetCameraDirection(self,direction):
"""
SetCameraDirection(self: ViewportInfo,direction: Vector3d) -> bool
Sets the direction that the camera faces.
direction: A new direction.
Returns: true if the direction was set; otherwise false.
"""
pass
def SetCameraLocation(self,location):
"""
SetCameraLocation(self: ViewportInfo,location: Point3d) -> bool
Sets the camera location (position) point.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def SetCameraUp(self,up):
"""
SetCameraUp(self: ViewportInfo,up: Vector3d) -> bool
Sets the camera up vector.
up: A new direction.
Returns: true if the direction was set; otherwise false.
"""
pass
def SetFrustum(self,left,right,bottom,top,nearDistance,farDistance):
"""
SetFrustum(self: ViewportInfo,left: float,right: float,bottom: float,top: float,nearDistance: float,farDistance: float) -> bool
Sets the view frustum. If FrustumSymmetryIsLocked() is true
and left != -right or
bottom != -top,then they will be
adjusted so the resulting frustum is symmetric.
left: A new left value.
right: A new right value.
bottom: A new bottom value.
top: A new top value.
nearDistance: A new near distance value.
farDistance: A new far distance value.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def SetFrustumNearFar(self,*__args):
"""
SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float) -> bool
Sets the frustum near and far distances using two values.
nearDistance: The new near distance.
farDistance: The new far distance.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float,minNearDistance: float,minNearOverFar: float,targetDistance: float) -> bool
Sets near and far clipping distance subject to constraints.
nearDistance: (>0) desired near clipping distance.
farDistance: (>near_dist) desired near clipping distance.
minNearDistance: If min_near_dist <= 0.0,it is ignored.
If min_near_dist > 0 and near_dist <
min_near_dist,then the frustum's near_dist will be increased to min_near_dist.
minNearOverFar: If min_near_over_far <= 0.0,it is ignored.
If near_dist <
far_dist*min_near_over_far,then
near_dist is increased and/or far_dist is
decreased
so that near_dist=far_dist*min_near_over_far.
If near_dist
< target_dist < far_dist,then near_dist
near_dist is increased and far_dist is
decreased so that
projection precision will be good at target_dist.
Otherwise,near_dist is simply set to
far_dist*min_near_over_far.
targetDistance: If target_dist <= 0.0,it is ignored.
If target_dist > 0,it is used as described
in the
description of the min_near_over_far parameter.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,boundingBox: BoundingBox) -> bool
Sets the frustum near and far using a bounding box.
boundingBox: A bounding box to use.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,center: Point3d,radius: float) -> bool
Sets the frustum near and far using a center point and radius.
center: A center point.
radius: A radius value.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def SetScreenPort(self,*__args):
"""
SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle) -> bool
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
windowRectangle: A new rectangle.
Returns: true if input is valid.
SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle,near: int,far: int) -> bool
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
windowRectangle: A new rectangle.
near: The near value.
far: The far value.
Returns: true if input is valid.
SetScreenPort(self: ViewportInfo,left: int,right: int,bottom: int,top: int,near: int,far: int) -> bool
Location of viewport in pixels.
These are provided so you can set the port you are
using
and get the appropriate transformations to and from
screen
space.
// For a Windows window
/ int width=width of window
client area in pixels;
/ int height=height of window client area in pixels;
/ port_left=0;
/ port_right=width;
/
port_top=0;
/ port_bottom=height;
/ port_near=0;
/ port_far=1;
/ SetScreenPort( port_left,port_right,
/ port_bottom,port_top,
/ port_near,
port_far );
left: A left value.
right: A left value. (port_left != port_right)
bottom: A bottom value.
top: A top value. (port_top != port_bottom)
near: A near value.
far: A far value.
Returns: true if input is valid.
"""
pass
def TargetDistance(self,useFrustumCenterFallback):
"""
TargetDistance(self: ViewportInfo,useFrustumCenterFallback: bool) -> float
Gets the distance from the target point to the camera plane.
Note that if the
frustum is not symmetric,then this distance
is shorter than the distance from the
target to the camera location.
useFrustumCenterFallback: If bUseFrustumCenterFallback is false and the target point is
not valid,then
ON_UNSET_VALUE is returned.
If bUseFrustumCenterFallback is true and the frustum is
valid
and current target point is not valid or is behind the camera,
then 0.5*(near + far) is returned.
Returns: Shortest signed distance from camera plane to target point.
If the target point is
on the visible side of the camera,
a positive value is returned. ON_UNSET_VALUE is
returned
when the input of view is not valid.
"""
pass
def UnlockCamera(self):
"""
UnlockCamera(self: ViewportInfo)
Unlocks the camera vectors and location.
"""
pass
def UnlockFrustumSymmetry(self):
"""
UnlockFrustumSymmetry(self: ViewportInfo)
Unlocks frustum horizontal and vertical symmetries.
"""
pass
def ZoomToScreenRect(self,*__args):
"""
ZoomToScreenRect(self: ViewportInfo,windowRectangle: Rectangle) -> bool
Zooms to a screen zone.
View changing from screen input points. Handy for
using a mouse to manipulate a view.
ZoomToScreenRect() may change camera and
frustum settings.
windowRectangle: The new window rectangle in screen space.
Returns: true if the operation succeeded; otherwise,false.
ZoomToScreenRect(self: ViewportInfo,left: int,top: int,right: int,bottom: int) -> bool
Zooms to a screen zone.
View changing from screen input points. Handy for
using a mouse to manipulate a view.
ZoomToScreenRect() may change camera and
frustum settings.
left: Screen coord.
top: Screen coord.
right: Screen coord.
bottom: Screen coord.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def __enter__(self,*args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __enter__ for objects which implement IDisposable.
"""
pass
def __exit__(self,*args):
"""
__exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object)
Provides the implementation of __exit__ for objects which implement IDisposable.
"""
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*__args):
"""
__new__(cls: type)
__new__(cls: type,other: ViewportInfo)
__new__(cls: type,rhinoViewport: RhinoViewport)
"""
pass
def __reduce_ex__(self,*args):
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
Camera35mmLensLength=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""This property assumes the camera is horizontal and crop the
film rather than the image when the aspect of the frustum
is not 36/24. (35mm film is 36mm wide and 24mm high.)
Setting preserves camera location,
changes the frustum,but maintains the frustum's aspect.
Get: Camera35mmLensLength(self: ViewportInfo) -> float
Set: Camera35mmLensLength(self: ViewportInfo)=value
"""
CameraAngle=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the 1/2 smallest angle. See Rhino.DocObjects.ViewportInfo.GetCameraAngles(System.Double@,System.Double@,System.Double@) for more information.
Get: CameraAngle(self: ViewportInfo) -> float
Set: CameraAngle(self: ViewportInfo)=value
"""
CameraDirection=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the direction that the camera faces.
Get: CameraDirection(self: ViewportInfo) -> Vector3d
"""
CameraLocation=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the camera location (position) point.
Get: CameraLocation(self: ViewportInfo) -> Point3d
"""
CameraUp=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the camera up vector.
Get: CameraUp(self: ViewportInfo) -> Vector3d
"""
CameraX=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the unit "to the right" vector.
Get: CameraX(self: ViewportInfo) -> Vector3d
"""
CameraY=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the unit "up" vector.
Get: CameraY(self: ViewportInfo) -> Vector3d
"""
CameraZ=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the unit vector in -CameraDirection.
Get: CameraZ(self: ViewportInfo) -> Vector3d
"""
FrustumAspect=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Setting FrustumAspect changes the larger of the frustum's width/height
so that the resulting value of width/height matches the requested
aspect. The camera angle is not changed. If you change the shape
of the view port with a call SetScreenPort(),then you generally
want to call SetFrustumAspect() with the value returned by
GetScreenPortAspect().
Get: FrustumAspect(self: ViewportInfo) -> float
Set: FrustumAspect(self: ViewportInfo)=value
"""
FrustumBottom=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum bottom value. This is -top if the frustum has a horizontal symmetry axis.
This number is usually negative.
Get: FrustumBottom(self: ViewportInfo) -> float
"""
FrustumBottomPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum bottom plane that separates visibile from off-screen.
Get: FrustumBottomPlane(self: ViewportInfo) -> Plane
"""
FrustumCenter=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum center point.
Get: FrustumCenter(self: ViewportInfo) -> Point3d
"""
FrustumFar=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum far-cutting value.
Get: FrustumFar(self: ViewportInfo) -> float
"""
FrustumFarPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets far clipping plane if camera and frustum
are valid. The plane's frame is the same as the camera's
frame. The origin is located at the intersection of the
camera direction ray and the far clipping plane. The plane's
normal points into the frustum towards the camera location.
Get: FrustumFarPlane(self: ViewportInfo) -> Plane
"""
FrustumHeight=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum height. This is Rhino.DocObjects.ViewportInfo.FrustumTop - Rhino.DocObjects.ViewportInfo.FrustumBottom.
Get: FrustumHeight(self: ViewportInfo) -> float
"""
FrustumLeft=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum left value. This is -right if the frustum has a vertical symmetry axis.
This number is usually negative.
Get: FrustumLeft(self: ViewportInfo) -> float
"""
FrustumLeftPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum left plane that separates visibile from off-screen.
Get: FrustumLeftPlane(self: ViewportInfo) -> Plane
"""
FrustumMaximumDiameter=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum maximum diameter,or the maximum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight.
Get: FrustumMaximumDiameter(self: ViewportInfo) -> float
"""
FrustumMinimumDiameter=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum minimum diameter,or the minimum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight.
Get: FrustumMinimumDiameter(self: ViewportInfo) -> float
"""
FrustumNear=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum near-cutting value.
Get: FrustumNear(self: ViewportInfo) -> float
"""
FrustumNearPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets near clipping plane if camera and frustum
are valid. The plane's frame is the same as the camera's
frame. The origin is located at the intersection of the
camera direction ray and the near clipping plane. The plane's
normal points out of the frustum towards the camera
location.
Get: FrustumNearPlane(self: ViewportInfo) -> Plane
"""
FrustumRight=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum right value. This is -left if the frustum has a vertical symmetry axis.
This number is usually positive.
Get: FrustumRight(self: ViewportInfo) -> float
"""
FrustumRightPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum right plane that separates visibile from off-screen.
Get: FrustumRightPlane(self: ViewportInfo) -> Plane
"""
FrustumTop=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum top value. This is -bottom if the frustum has a horizontal symmetry axis.
This number is usually positive.
Get: FrustumTop(self: ViewportInfo) -> float
"""
FrustumTopPlane=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum top plane that separates visibile from off-screen.
Get: FrustumTopPlane(self: ViewportInfo) -> Plane
"""
FrustumWidth=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the frustum width. This is Rhino.DocObjects.ViewportInfo.FrustumRight - Rhino.DocObjects.ViewportInfo.FrustumLeft.
Get: FrustumWidth(self: ViewportInfo) -> float
"""
Id=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Sets the viewport's id to the value used to
uniquely identify this viewport.
There is no approved way to change the viewport
id once it is set in order to maintain consistency
across multiple viewports and those routines that
manage them.
Get: Id(self: ViewportInfo) -> Guid
"""
IsCameraDirectionLocked=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether the direction that the camera faces is unmodifiable.
Get: IsCameraDirectionLocked(self: ViewportInfo) -> bool
Set: IsCameraDirectionLocked(self: ViewportInfo)=value
"""
IsCameraLocationLocked=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether the camera location is unmodifiable.
Get: IsCameraLocationLocked(self: ViewportInfo) -> bool
Set: IsCameraLocationLocked(self: ViewportInfo)=value
"""
IsCameraUpLocked=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether the camera up vector is unmodifiable.
Get: IsCameraUpLocked(self: ViewportInfo) -> bool
Set: IsCameraUpLocked(self: ViewportInfo)=value
"""
IsFrustumLeftRightSymmetric=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether the camera frustum has a vertical symmetry axis.
Get: IsFrustumLeftRightSymmetric(self: ViewportInfo) -> bool
Set: IsFrustumLeftRightSymmetric(self: ViewportInfo)=value
"""
IsFrustumTopBottomSymmetric=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether the camera frustum has a horizontal symmetry axis.
Get: IsFrustumTopBottomSymmetric(self: ViewportInfo) -> bool
Set: IsFrustumTopBottomSymmetric(self: ViewportInfo)=value
"""
IsParallelProjection=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get or set whether this projection is parallel.
Get: IsParallelProjection(self: ViewportInfo) -> bool
Set: IsParallelProjection(self: ViewportInfo)=value
"""
IsPerspectiveProjection=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get or set whether this projection is perspective.
Get: IsPerspectiveProjection(self: ViewportInfo) -> bool
Set: IsPerspectiveProjection(self: ViewportInfo)=value
"""
IsTwoPointPerspectiveProjection=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that indicates whether this projection is a two-point perspective.
Get: IsTwoPointPerspectiveProjection(self: ViewportInfo) -> bool
"""
IsValid=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that indicates whether this complete object is valid.
Get: IsValid(self: ViewportInfo) -> bool
"""
IsValidCamera=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that indicates whether the camera is valid.
Get: IsValidCamera(self: ViewportInfo) -> bool
"""
IsValidFrustum=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that indicates whether the frustum is valid.
Get: IsValidFrustum(self: ViewportInfo) -> bool
"""
ScreenPortAspect=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the sceen aspect ratio.
This is width / height.
Get: ScreenPortAspect(self: ViewportInfo) -> float
"""
TargetPoint=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The current value of the target point. This point does not play
a role in the view projection calculations. It can be used as a
fixed point when changing the camera so the visible regions of the
before and after frustums both contain the region of interest.
The default constructor sets this point on ON_3dPoint::UnsetPoint.
You must explicitly call one SetTargetPoint() functions to set
the target point.
Get: TargetPoint(self: ViewportInfo) -> Point3d
Set: TargetPoint(self: ViewportInfo)=value
"""
ViewScale=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Applies scaling factors to parallel projection clipping coordinates
by setting the m_clip_mod transformation.
If you want to compress the view projection across the viewing
plane,then set x=0.5,y=1.0,and z=1.0.
Get: ViewScale(self: ViewportInfo) -> SizeF
Set: ViewScale(self: ViewportInfo)=value
"""
# variables with complex values
| class Viewportinfo(object, IDisposable, ISerializable):
"""
Represents a viewing frustum.
ViewportInfo()
ViewportInfo(other: ViewportInfo)
ViewportInfo(rhinoViewport: RhinoViewport)
"""
def change_to_parallel_projection(self, symmetricFrustum):
"""
ChangeToParallelProjection(self: ViewportInfo,symmetricFrustum: bool) -> bool
Use this function to change projections of valid viewports
from parallel to
perspective. It will make common additional
adjustments to the frustum and camera
location so the resulting
views are similar. The camera direction and target point
are
not be changed.
If the current projection is parallel and
symmetricFrustum,
FrustumIsLeftRightSymmetric() and FrustumIsTopBottomSymmetric()
are all equal,then no changes are made and true is returned.
symmetricFrustum: true if you want the resulting frustum to be symmetric.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def change_to_perspective_projection(self, targetDistance, symmetricFrustum, lensLength):
"""
ChangeToPerspectiveProjection(self: ViewportInfo,targetDistance: float,symmetricFrustum: bool,lensLength: float) -> bool
Use this function to change projections of valid viewports
from parallel to
perspective. It will make common additional
adjustments to the frustum and camera
location so the resulting
views are similar. The camera direction and target point
are
not changed.
If the current projection is perspective and
symmetricFrustum,
IsFrustumIsLeftRightSymmetric,and IsFrustumIsTopBottomSymmetric
are all equal,then no changes are made and true is returned.
targetDistance: If RhinoMath.UnsetValue this parameter is ignored.
Otherwise it must be > 0 and
indicates which plane in the current view frustum should be perserved.
symmetricFrustum: true if you want the resulting frustum to be symmetric.
lensLength: (pass 50.0 when in doubt)
35 mm lens length to use when changing from parallel
to perspective projections. If the current projection
is perspective or
lens_length is <= 0.0,
then this parameter is ignored.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def change_to_symmetric_frustum(self, isLeftRightSymmetric, isTopBottomSymmetric, targetDistance):
"""
ChangeToSymmetricFrustum(self: ViewportInfo,isLeftRightSymmetric: bool,isTopBottomSymmetric: bool,targetDistance: float) -> bool
If needed,adjusts the current frustum so it has the
specified symmetries and
adjust the camera location
so the target plane remains visible.
isLeftRightSymmetric: If true,the frustum will be adjusted so left=-right.
isTopBottomSymmetric: If true,the frustum will be adjusted so top=-bottom.
targetDistance: If projection is not perspective or target_distance is RhinoMath.UnsetValue,
then
this parameter is ignored. If the projection is perspective and targetDistance
is
not RhinoMath.UnsetValue,then it must be > 0.0 and it is used to determine
which
plane in the old frustum will appear unchanged in the new frustum.
Returns: Returns true if the viewport has now a frustum with the specified symmetries.
"""
pass
def change_to_two_point_perspective_projection(self, targetDistance, up, lensLength):
"""
ChangeToTwoPointPerspectiveProjection(self: ViewportInfo,targetDistance: float,up: Vector3d,lensLength: float) -> bool
Changes projections of valid viewports
to a two point perspective. It will make
common additional
adjustments to the frustum and camera location and direction
so the resulting views are similar.
If the current projection is
perspective and
IsFrustumIsLeftRightSymmetric is true and
IsFrustumIsTopBottomSymmetric is false,then no changes are
made and true is
returned.
targetDistance: If RhinoMath.UnsetValue this parameter is ignored. Otherwise
it must be > 0 and
indicates which plane in the current
view frustum should be perserved.
up: The locked up direction. Pass Vector3d.Zero if you want to use the world
axis
direction that is closest to the current up direction.
Pass CameraY() if you want
to preserve the current up direction.
lensLength: (pass 50.0 when in doubt)
35 mm lens length to use when changing from parallel
to perspective projections. If the current projection
is perspective or
lens_length is <= 0.0,
then this parameter is ignored.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def dispose(self):
"""
Dispose(self: ViewportInfo)
Actively reclaims unmanaged resources that this instance uses.
"""
pass
def dolly_camera(self, dollyVector):
"""
DollyCamera(self: ViewportInfo,dollyVector: Vector3d) -> bool
DollyCamera() does not update the frustum's clipping planes.
To update the
frustum's clipping planes call DollyFrustum(d)
with d=dollyVector o cameraFrameZ.
To convert screen locations
into a dolly vector,use GetDollyCameraVector().
Does not update frustum. To update frustum use DollyFrustum(d) with d=dollyVector o
cameraFrameZ.
dollyVector: dolly vector in world coordinates.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def dolly_extents(self, *__args):
"""
DollyExtents(self: ViewportInfo,cameraCoordinateBoundingBox: BoundingBox,border: float) -> bool
Dolly the camera location and so that the view frustum contains
all of the document
objects that can be seen in view.
If the projection is perspective,the camera
angle is not changed.
border: If border > 1.0,then the fustum in enlarged by this factor
to provide a border
around the view. 1.1 works well for
parallel projections; 0.0 is suggested for
perspective projections.
Returns: True if successful.
DollyExtents(self: ViewportInfo,geometry: IEnumerable[GeometryBase],border: float) -> bool
"""
pass
def dolly_frustum(self, dollyDistance):
"""
DollyFrustum(self: ViewportInfo,dollyDistance: float) -> bool
Moves the frustum clipping planes.
dollyDistance: Distance to move in camera direction.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def extents(self, halfViewAngleRadians, *__args):
"""
Extents(self: ViewportInfo,halfViewAngleRadians: float,sphere: Sphere) -> bool
Extends this viewport view to include a sphere.
Use Extents() as a quick way to set
a viewport to so that bounding
volume is inside of a viewports frustrum.
The view angle is used to determine the position of the camera.
halfViewAngleRadians: 1/2 smallest subtended view angle in radians.
sphere: A sphere in 3d world coordinates.
Returns: true if the operation succeeded; otherwise,false.
Extents(self: ViewportInfo,halfViewAngleRadians: float,bbox: BoundingBox) -> bool
Extends this viewport view to include a bounding box.
Use Extents() as a quick way
to set a viewport to so that bounding
volume is inside of a viewports frustrum.
The view angle is used to determine the position of the camera.
halfViewAngleRadians: 1/2 smallest subtended view angle in radians.
bbox: A bounding box in 3d world coordinates.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def frustum_center_point(self, targetDistance):
"""
FrustumCenterPoint(self: ViewportInfo,targetDistance: float) -> Point3d
Return a point on the central axis of the view frustum.
This point is a good choice
for a general purpose target point.
targetDistance: If targetDistance > 0.0,then the distance from the returned
point to the camera
plane will be targetDistance. Note that
if the frustum is not symmetric,the
distance from the
returned point to the camera location will be larger than
targetDistance.
If targetDistance == ON_UNSET_VALUE and the frustum
is valid with near > 0.0,then 0.5*(near + far) will be used
as the
targetDistance.
Returns: A point on the frustum's central axis. If the viewport or input
is not valid,then
ON_3dPoint::UnsetPoint is returned.
"""
pass
def get_bounding_box_depth(self, bbox, nearDistance, farDistance):
"""
GetBoundingBoxDepth(self: ViewportInfo,bbox: BoundingBox) -> (bool,float,float)
Gets near and far clipping distances of a bounding box.
This function ignores the
current value of the viewport's
near and far settings. If the viewport is a
perspective
projection,the it intersects the semi infinite frustum
volume with the bounding box and returns the near and far
distances of the
intersection. If the viewport is a parallel
projection,it instersects the infinte
view region with the
bounding box and returns the near and far distances of the
projection.
bbox: The bounding box to sample.
Returns: true if the bounding box intersects the view frustum and near_dist/far_dist were set.
false if the bounding box does not intesect the view frustum.
"""
pass
def get_camera_angles(self, halfDiagonalAngleRadians, halfVerticalAngleRadians, halfHorizontalAngleRadians):
"""
GetCameraAngles(self: ViewportInfo) -> (bool,float,float,float)
Gets the field of view angles.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def get_camera_frame(self, location, cameraX, cameraY, cameraZ):
"""
GetCameraFrame(self: ViewportInfo) -> (bool,Point3d,Vector3d,Vector3d,Vector3d)
Gets location and vectors of this camera.
Returns: true if current camera orientation is valid; otherwise false.
"""
pass
def get_dolly_camera_vector(self, *__args):
"""
GetDollyCameraVector(self: ViewportInfo,screen0: Point,screen1: Point,projectionPlaneDistance: float) -> Vector3d
Gets a world coordinate dolly vector that can be passed to DollyCamera().
screen0: Start point.
screen1: End point.
projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far).
Returns: The world coordinate dolly vector.
GetDollyCameraVector(self: ViewportInfo,screenX0: int,screenY0: int,screenX1: int,screenY1: int,projectionPlaneDistance: float) -> Vector3d
Gets a world coordinate dolly vector that can be passed to DollyCamera().
screenX0: Screen coords of start point.
screenY0: Screen coords of start point.
screenX1: Screen coords of end point.
screenY1: Screen coords of end point.
projectionPlaneDistance: Distance of projection plane from camera. When in doubt,use 0.5*(frus_near+frus_far).
Returns: The world coordinate dolly vector.
"""
pass
def get_far_plane_corners(self):
"""
GetFarPlaneCorners(self: ViewportInfo) -> Array[Point3d]
Gets the corners of far clipping plane rectangle.
4 points are returned in the
order of bottom left,bottom right,
top left,top right.
Returns: Four corner points on success.
Empty array if viewport is not valid.
"""
pass
def get_frustum(self, left, right, bottom, top, nearDistance, farDistance):
"""
GetFrustum(self: ViewportInfo) -> (bool,float,float,float,float,float,float)
Gets the view frustum.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def get_frustum_line(self, *__args):
"""
GetFrustumLine(self: ViewportInfo,screenPoint: PointF) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenPoint: screen location
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
GetFrustumLine(self: ViewportInfo,screenPoint: Point) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenPoint: screen location
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
GetFrustumLine(self: ViewportInfo,screenX: float,screenY: float) -> Line
Gets the world coordinate line in the view frustum
that projects to a point on the
screen.
screenX: (screenx,screeny)=screen location.
screenY: (screenx,screeny)=screen location.
Returns: 3d world coordinate line segment starting on the near clipping plane and ending on the far
clipping plane.
"""
pass
def get_near_plane_corners(self):
"""
GetNearPlaneCorners(self: ViewportInfo) -> Array[Point3d]
Gets the corners of near clipping plane rectangle.
4 points are returned in the
order of bottom left,bottom right,
top left,top right.
Returns: Four corner points on success.
Empty array if viewport is not valid.
"""
pass
def get_object_data(self, info, context):
"""
GetObjectData(self: ViewportInfo,info: SerializationInfo,context: StreamingContext)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the
target object.
info: The System.Runtime.Serialization.SerializationInfo to populate with data.
context: The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.
"""
pass
def get_point_depth(self, point, distance):
"""
GetPointDepth(self: ViewportInfo,point: Point3d) -> (bool,float)
Gets the clipping distance of a point. This function ignores the
current value of
the viewport's near and far settings. If
the viewport is a perspective projection,
then it intersects
the semi infinite frustum volume with the bounding box and
returns the near and far distances of the intersection.
If the viewport is a
parallel projection,it instersects the
infinte view region with the bounding box
and returns the
near and far distances of the projection.
point: A point to measure.
Returns: true if the bounding box intersects the view frustum and
near_dist/far_dist were
set.
false if the bounding box does not intesect the view frustum.
"""
pass
def get_screen_port(self, near=None, far=None):
"""
GetScreenPort(self: ViewportInfo) -> Rectangle
Gets the location of viewport in pixels.
See documentation for
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error.
GetScreenPort(self: ViewportInfo) -> (Rectangle,int,int)
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
Returns: The rectangle,or System.Drawing.Rectangle.EmptyEmpty rectangle on error.
"""
pass
def get_sphere_depth(self, sphere, nearDistance, farDistance):
"""
GetSphereDepth(self: ViewportInfo,sphere: Sphere) -> (bool,float,float)
Gets near and far clipping distances of a bounding sphere.
sphere: The sphere to sample.
Returns: true if the sphere intersects the view frustum and near_dist/far_dist were set.
false if the sphere does not intesect the view frustum.
"""
pass
def get_world_to_screen_scale(self, pointInFrustum):
"""
GetWorldToScreenScale(self: ViewportInfo,pointInFrustum: Point3d) -> float
Gets the scale factor from point in frustum to screen scale.
pointInFrustum: point in viewing frustum.
Returns: number of pixels per world unit at the 3d point.
"""
pass
def get_xform(self, sourceSystem, destinationSystem):
"""
GetXform(self: ViewportInfo,sourceSystem: CoordinateSystem,destinationSystem: CoordinateSystem) -> Transform
Computes a transform from a coordinate system to another.
sourceSystem: The coordinate system to map from.
destinationSystem: The coordinate system to map into.
Returns: The 4x4 transformation matrix (acts on the left).
"""
pass
def set_camera_direction(self, direction):
"""
SetCameraDirection(self: ViewportInfo,direction: Vector3d) -> bool
Sets the direction that the camera faces.
direction: A new direction.
Returns: true if the direction was set; otherwise false.
"""
pass
def set_camera_location(self, location):
"""
SetCameraLocation(self: ViewportInfo,location: Point3d) -> bool
Sets the camera location (position) point.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def set_camera_up(self, up):
"""
SetCameraUp(self: ViewportInfo,up: Vector3d) -> bool
Sets the camera up vector.
up: A new direction.
Returns: true if the direction was set; otherwise false.
"""
pass
def set_frustum(self, left, right, bottom, top, nearDistance, farDistance):
"""
SetFrustum(self: ViewportInfo,left: float,right: float,bottom: float,top: float,nearDistance: float,farDistance: float) -> bool
Sets the view frustum. If FrustumSymmetryIsLocked() is true
and left != -right or
bottom != -top,then they will be
adjusted so the resulting frustum is symmetric.
left: A new left value.
right: A new right value.
bottom: A new bottom value.
top: A new top value.
nearDistance: A new near distance value.
farDistance: A new far distance value.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def set_frustum_near_far(self, *__args):
"""
SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float) -> bool
Sets the frustum near and far distances using two values.
nearDistance: The new near distance.
farDistance: The new far distance.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,nearDistance: float,farDistance: float,minNearDistance: float,minNearOverFar: float,targetDistance: float) -> bool
Sets near and far clipping distance subject to constraints.
nearDistance: (>0) desired near clipping distance.
farDistance: (>near_dist) desired near clipping distance.
minNearDistance: If min_near_dist <= 0.0,it is ignored.
If min_near_dist > 0 and near_dist <
min_near_dist,then the frustum's near_dist will be increased to min_near_dist.
minNearOverFar: If min_near_over_far <= 0.0,it is ignored.
If near_dist <
far_dist*min_near_over_far,then
near_dist is increased and/or far_dist is
decreased
so that near_dist=far_dist*min_near_over_far.
If near_dist
< target_dist < far_dist,then near_dist
near_dist is increased and far_dist is
decreased so that
projection precision will be good at target_dist.
Otherwise,near_dist is simply set to
far_dist*min_near_over_far.
targetDistance: If target_dist <= 0.0,it is ignored.
If target_dist > 0,it is used as described
in the
description of the min_near_over_far parameter.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,boundingBox: BoundingBox) -> bool
Sets the frustum near and far using a bounding box.
boundingBox: A bounding box to use.
Returns: true if operation succeeded; otherwise,false.
SetFrustumNearFar(self: ViewportInfo,center: Point3d,radius: float) -> bool
Sets the frustum near and far using a center point and radius.
center: A center point.
radius: A radius value.
Returns: true if operation succeeded; otherwise,false.
"""
pass
def set_screen_port(self, *__args):
"""
SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle) -> bool
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
windowRectangle: A new rectangle.
Returns: true if input is valid.
SetScreenPort(self: ViewportInfo,windowRectangle: Rectangle,near: int,far: int) -> bool
Gets the location of viewport in pixels.
See value meanings in
Rhino.DocObjects.ViewportInfo.SetScreenPort(System.Int32,System.Int32,System.Int32,System.Int32,S
ystem.Int32,System.Int32)SetScreenPort.
windowRectangle: A new rectangle.
near: The near value.
far: The far value.
Returns: true if input is valid.
SetScreenPort(self: ViewportInfo,left: int,right: int,bottom: int,top: int,near: int,far: int) -> bool
Location of viewport in pixels.
These are provided so you can set the port you are
using
and get the appropriate transformations to and from
screen
space.
// For a Windows window
/ int width=width of window
client area in pixels;
/ int height=height of window client area in pixels;
/ port_left=0;
/ port_right=width;
/
port_top=0;
/ port_bottom=height;
/ port_near=0;
/ port_far=1;
/ SetScreenPort( port_left,port_right,
/ port_bottom,port_top,
/ port_near,
port_far );
left: A left value.
right: A left value. (port_left != port_right)
bottom: A bottom value.
top: A top value. (port_top != port_bottom)
near: A near value.
far: A far value.
Returns: true if input is valid.
"""
pass
def target_distance(self, useFrustumCenterFallback):
"""
TargetDistance(self: ViewportInfo,useFrustumCenterFallback: bool) -> float
Gets the distance from the target point to the camera plane.
Note that if the
frustum is not symmetric,then this distance
is shorter than the distance from the
target to the camera location.
useFrustumCenterFallback: If bUseFrustumCenterFallback is false and the target point is
not valid,then
ON_UNSET_VALUE is returned.
If bUseFrustumCenterFallback is true and the frustum is
valid
and current target point is not valid or is behind the camera,
then 0.5*(near + far) is returned.
Returns: Shortest signed distance from camera plane to target point.
If the target point is
on the visible side of the camera,
a positive value is returned. ON_UNSET_VALUE is
returned
when the input of view is not valid.
"""
pass
def unlock_camera(self):
"""
UnlockCamera(self: ViewportInfo)
Unlocks the camera vectors and location.
"""
pass
def unlock_frustum_symmetry(self):
"""
UnlockFrustumSymmetry(self: ViewportInfo)
Unlocks frustum horizontal and vertical symmetries.
"""
pass
def zoom_to_screen_rect(self, *__args):
"""
ZoomToScreenRect(self: ViewportInfo,windowRectangle: Rectangle) -> bool
Zooms to a screen zone.
View changing from screen input points. Handy for
using a mouse to manipulate a view.
ZoomToScreenRect() may change camera and
frustum settings.
windowRectangle: The new window rectangle in screen space.
Returns: true if the operation succeeded; otherwise,false.
ZoomToScreenRect(self: ViewportInfo,left: int,top: int,right: int,bottom: int) -> bool
Zooms to a screen zone.
View changing from screen input points. Handy for
using a mouse to manipulate a view.
ZoomToScreenRect() may change camera and
frustum settings.
left: Screen coord.
top: Screen coord.
right: Screen coord.
bottom: Screen coord.
Returns: true if the operation succeeded; otherwise,false.
"""
pass
def __enter__(self, *args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __enter__ for objects which implement IDisposable.
"""
pass
def __exit__(self, *args):
"""
__exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object)
Provides the implementation of __exit__ for objects which implement IDisposable.
"""
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, *__args):
"""
__new__(cls: type)
__new__(cls: type,other: ViewportInfo)
__new__(cls: type,rhinoViewport: RhinoViewport)
"""
pass
def __reduce_ex__(self, *args):
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
camera35mm_lens_length = property(lambda self: object(), lambda self, v: None, lambda self: None)
"This property assumes the camera is horizontal and crop the\n\n film rather than the image when the aspect of the frustum\n\n is not 36/24. (35mm film is 36mm wide and 24mm high.)\n\n Setting preserves camera location,\n\n changes the frustum,but maintains the frustum's aspect.\n\n\n\nGet: Camera35mmLensLength(self: ViewportInfo) -> float\n\n\n\nSet: Camera35mmLensLength(self: ViewportInfo)=value\n\n"
camera_angle = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the 1/2 smallest angle. See Rhino.DocObjects.ViewportInfo.GetCameraAngles(System.Double@,System.Double@,System.Double@) for more information.\n\n\n\nGet: CameraAngle(self: ViewportInfo) -> float\n\n\n\nSet: CameraAngle(self: ViewportInfo)=value\n\n'
camera_direction = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the direction that the camera faces.\n\n\n\nGet: CameraDirection(self: ViewportInfo) -> Vector3d\n\n\n\n'
camera_location = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the camera location (position) point.\n\n\n\nGet: CameraLocation(self: ViewportInfo) -> Point3d\n\n\n\n'
camera_up = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the camera up vector.\n\n\n\nGet: CameraUp(self: ViewportInfo) -> Vector3d\n\n\n\n'
camera_x = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the unit "to the right" vector.\n\n\n\nGet: CameraX(self: ViewportInfo) -> Vector3d\n\n\n\n'
camera_y = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the unit "up" vector.\n\n\n\nGet: CameraY(self: ViewportInfo) -> Vector3d\n\n\n\n'
camera_z = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the unit vector in -CameraDirection.\n\n\n\nGet: CameraZ(self: ViewportInfo) -> Vector3d\n\n\n\n'
frustum_aspect = property(lambda self: object(), lambda self, v: None, lambda self: None)
"Setting FrustumAspect changes the larger of the frustum's width/height\n\n so that the resulting value of width/height matches the requested\n\n aspect. The camera angle is not changed. If you change the shape\n\n of the view port with a call SetScreenPort(),then you generally \n\n want to call SetFrustumAspect() with the value returned by \n\n GetScreenPortAspect().\n\n\n\nGet: FrustumAspect(self: ViewportInfo) -> float\n\n\n\nSet: FrustumAspect(self: ViewportInfo)=value\n\n"
frustum_bottom = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum bottom value. This is -top if the frustum has a horizontal symmetry axis.\n\n This number is usually negative.\n\n\n\nGet: FrustumBottom(self: ViewportInfo) -> float\n\n\n\n'
frustum_bottom_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum bottom plane that separates visibile from off-screen.\n\n\n\nGet: FrustumBottomPlane(self: ViewportInfo) -> Plane\n\n\n\n'
frustum_center = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum center point.\n\n\n\nGet: FrustumCenter(self: ViewportInfo) -> Point3d\n\n\n\n'
frustum_far = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum far-cutting value.\n\n\n\nGet: FrustumFar(self: ViewportInfo) -> float\n\n\n\n'
frustum_far_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
"Gets far clipping plane if camera and frustum\n\n are valid. The plane's frame is the same as the camera's\n\n frame. The origin is located at the intersection of the\n\n camera direction ray and the far clipping plane. The plane's\n\n normal points into the frustum towards the camera location.\n\n\n\nGet: FrustumFarPlane(self: ViewportInfo) -> Plane\n\n\n\n"
frustum_height = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum height. This is Rhino.DocObjects.ViewportInfo.FrustumTop - Rhino.DocObjects.ViewportInfo.FrustumBottom.\n\n\n\nGet: FrustumHeight(self: ViewportInfo) -> float\n\n\n\n'
frustum_left = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum left value. This is -right if the frustum has a vertical symmetry axis.\n\n This number is usually negative.\n\n\n\nGet: FrustumLeft(self: ViewportInfo) -> float\n\n\n\n'
frustum_left_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum left plane that separates visibile from off-screen.\n\n\n\nGet: FrustumLeftPlane(self: ViewportInfo) -> Plane\n\n\n\n'
frustum_maximum_diameter = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum maximum diameter,or the maximum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight.\n\n\n\nGet: FrustumMaximumDiameter(self: ViewportInfo) -> float\n\n\n\n'
frustum_minimum_diameter = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum minimum diameter,or the minimum between Rhino.DocObjects.ViewportInfo.FrustumWidth and Rhino.DocObjects.ViewportInfo.FrustumHeight.\n\n\n\nGet: FrustumMinimumDiameter(self: ViewportInfo) -> float\n\n\n\n'
frustum_near = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum near-cutting value.\n\n\n\nGet: FrustumNear(self: ViewportInfo) -> float\n\n\n\n'
frustum_near_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
"Gets near clipping plane if camera and frustum\n\n are valid. The plane's frame is the same as the camera's\n\n frame. The origin is located at the intersection of the\n\n camera direction ray and the near clipping plane. The plane's\n\n normal points out of the frustum towards the camera\n\n location.\n\n\n\nGet: FrustumNearPlane(self: ViewportInfo) -> Plane\n\n\n\n"
frustum_right = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum right value. This is -left if the frustum has a vertical symmetry axis.\n\n This number is usually positive.\n\n\n\nGet: FrustumRight(self: ViewportInfo) -> float\n\n\n\n'
frustum_right_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum right plane that separates visibile from off-screen.\n\n\n\nGet: FrustumRightPlane(self: ViewportInfo) -> Plane\n\n\n\n'
frustum_top = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum top value. This is -bottom if the frustum has a horizontal symmetry axis.\n\n This number is usually positive.\n\n\n\nGet: FrustumTop(self: ViewportInfo) -> float\n\n\n\n'
frustum_top_plane = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum top plane that separates visibile from off-screen.\n\n\n\nGet: FrustumTopPlane(self: ViewportInfo) -> Plane\n\n\n\n'
frustum_width = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the frustum width. This is Rhino.DocObjects.ViewportInfo.FrustumRight - Rhino.DocObjects.ViewportInfo.FrustumLeft.\n\n\n\nGet: FrustumWidth(self: ViewportInfo) -> float\n\n\n\n'
id = property(lambda self: object(), lambda self, v: None, lambda self: None)
"Sets the viewport's id to the value used to \n\n uniquely identify this viewport.\n\n There is no approved way to change the viewport \n\n id once it is set in order to maintain consistency\n\n across multiple viewports and those routines that \n\n manage them.\n\n\n\nGet: Id(self: ViewportInfo) -> Guid\n\n\n\n"
is_camera_direction_locked = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether the direction that the camera faces is unmodifiable.\n\n\n\nGet: IsCameraDirectionLocked(self: ViewportInfo) -> bool\n\n\n\nSet: IsCameraDirectionLocked(self: ViewportInfo)=value\n\n'
is_camera_location_locked = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether the camera location is unmodifiable.\n\n\n\nGet: IsCameraLocationLocked(self: ViewportInfo) -> bool\n\n\n\nSet: IsCameraLocationLocked(self: ViewportInfo)=value\n\n'
is_camera_up_locked = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether the camera up vector is unmodifiable.\n\n\n\nGet: IsCameraUpLocked(self: ViewportInfo) -> bool\n\n\n\nSet: IsCameraUpLocked(self: ViewportInfo)=value\n\n'
is_frustum_left_right_symmetric = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether the camera frustum has a vertical symmetry axis.\n\n\n\nGet: IsFrustumLeftRightSymmetric(self: ViewportInfo) -> bool\n\n\n\nSet: IsFrustumLeftRightSymmetric(self: ViewportInfo)=value\n\n'
is_frustum_top_bottom_symmetric = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether the camera frustum has a horizontal symmetry axis.\n\n\n\nGet: IsFrustumTopBottomSymmetric(self: ViewportInfo) -> bool\n\n\n\nSet: IsFrustumTopBottomSymmetric(self: ViewportInfo)=value\n\n'
is_parallel_projection = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get or set whether this projection is parallel.\n\n\n\nGet: IsParallelProjection(self: ViewportInfo) -> bool\n\n\n\nSet: IsParallelProjection(self: ViewportInfo)=value\n\n'
is_perspective_projection = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get or set whether this projection is perspective.\n\n\n\nGet: IsPerspectiveProjection(self: ViewportInfo) -> bool\n\n\n\nSet: IsPerspectiveProjection(self: ViewportInfo)=value\n\n'
is_two_point_perspective_projection = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that indicates whether this projection is a two-point perspective.\n\n\n\nGet: IsTwoPointPerspectiveProjection(self: ViewportInfo) -> bool\n\n\n\n'
is_valid = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that indicates whether this complete object is valid.\n\n\n\nGet: IsValid(self: ViewportInfo) -> bool\n\n\n\n'
is_valid_camera = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that indicates whether the camera is valid.\n\n\n\nGet: IsValidCamera(self: ViewportInfo) -> bool\n\n\n\n'
is_valid_frustum = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that indicates whether the frustum is valid.\n\n\n\nGet: IsValidFrustum(self: ViewportInfo) -> bool\n\n\n\n'
screen_port_aspect = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the sceen aspect ratio.\n\n This is width / height.\n\n\n\nGet: ScreenPortAspect(self: ViewportInfo) -> float\n\n\n\n'
target_point = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The current value of the target point. This point does not play\n\n a role in the view projection calculations. It can be used as a \n\n fixed point when changing the camera so the visible regions of the\n\n before and after frustums both contain the region of interest.\n\n The default constructor sets this point on ON_3dPoint::UnsetPoint.\n\n You must explicitly call one SetTargetPoint() functions to set\n\n the target point.\n\n\n\nGet: TargetPoint(self: ViewportInfo) -> Point3d\n\n\n\nSet: TargetPoint(self: ViewportInfo)=value\n\n'
view_scale = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Applies scaling factors to parallel projection clipping coordinates\n\n by setting the m_clip_mod transformation. \n\n If you want to compress the view projection across the viewing\n\n plane,then set x=0.5,y=1.0,and z=1.0.\n\n\n\nGet: ViewScale(self: ViewportInfo) -> SizeF\n\n\n\nSet: ViewScale(self: ViewportInfo)=value\n\n' |
"""
A selection of job objects used in testing.
"""
EMPTY_JOB = '''\
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>
'''.strip()
LONG_RUNNING_JOB = """
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>ping -c 200 localhost</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
</project>""".strip()
SHORTISH_JOB = """
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>ping -c 10 localhost</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
</project>""".strip()
SCM_GIT_JOB = """
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name></name>
<refspec></refspec>
<url>https://github.com/salimfadhley/jenkinsapi.git</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>**</name>
</hudson.plugins.git.BranchSpec>
</branches>
<disableSubmodules>false</disableSubmodules>
<recursiveSubmodules>false</recursiveSubmodules>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<authorOrCommitter>false</authorOrCommitter>
<clean>false</clean>
<wipeOutWorkspace>false</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
<ignoreNotifyCommit>false</ignoreNotifyCommit>
<useShallowClone>false</useShallowClone>
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir></relativeTargetDir>
<reference></reference>
<excludedRegions></excludedRegions>
<excludedUsers></excludedUsers>
<gitConfigName></gitConfigName>
<gitConfigEmail></gitConfigEmail>
<skipTag>true</skipTag>
<includedRegions></includedRegions>
<scmName></scmName>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>""".strip()
JOB_WITH_ARTIFACTS = """
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description>Ping a load of stuff for about 10s</description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>ping -c 5 localhost | tee out.txt
gzip < out.txt > out.gz</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>*.txt,*.gz</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
<hudson.tasks.Fingerprinter>
<targets></targets>
<recordBuildArtifacts>true</recordBuildArtifacts>
</hudson.tasks.Fingerprinter>
</publishers>
<buildWrappers/>
</project>""".strip()
MATRIX_JOB = """
<?xml version='1.0' encoding='UTF-8'?>
<matrix-project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<axes>
<hudson.matrix.TextAxis>
<name>foo</name>
<values>
<string>one</string>
<string>two</string>
<string>three</string>
</values>
</hudson.matrix.TextAxis>
</axes>
<builders>
<hudson.tasks.Shell>
<command>ping -c 10 localhost</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
</matrix-project>""".strip()
| """
A selection of job objects used in testing.
"""
empty_job = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<project>\n <actions/>\n <description></description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.scm.NullSCM"/>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <builders/>\n <publishers/>\n <buildWrappers/>\n</project>\n'.strip()
long_running_job = '\n<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<project>\n <actions/>\n <description></description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.scm.NullSCM"/>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <builders>\n <hudson.tasks.Shell>\n <command>ping -c 200 localhost</command>\n </hudson.tasks.Shell>\n </builders>\n <publishers/>\n <buildWrappers/>\n</project>'.strip()
shortish_job = '\n<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<project>\n <actions/>\n <description></description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.scm.NullSCM"/>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <builders>\n <hudson.tasks.Shell>\n <command>ping -c 10 localhost</command>\n </hudson.tasks.Shell>\n </builders>\n <publishers/>\n <buildWrappers/>\n</project>'.strip()
scm_git_job = '\n<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<project>\n <actions/>\n <description></description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.plugins.git.GitSCM">\n <configVersion>2</configVersion>\n <userRemoteConfigs>\n <hudson.plugins.git.UserRemoteConfig>\n <name></name>\n <refspec></refspec>\n <url>https://github.com/salimfadhley/jenkinsapi.git</url>\n </hudson.plugins.git.UserRemoteConfig>\n </userRemoteConfigs>\n <branches>\n <hudson.plugins.git.BranchSpec>\n <name>**</name>\n </hudson.plugins.git.BranchSpec>\n </branches>\n <disableSubmodules>false</disableSubmodules>\n <recursiveSubmodules>false</recursiveSubmodules>\n <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>\n <authorOrCommitter>false</authorOrCommitter>\n <clean>false</clean>\n <wipeOutWorkspace>false</wipeOutWorkspace>\n <pruneBranches>false</pruneBranches>\n <remotePoll>false</remotePoll>\n <ignoreNotifyCommit>false</ignoreNotifyCommit>\n <useShallowClone>false</useShallowClone>\n <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>\n <gitTool>Default</gitTool>\n <submoduleCfg class="list"/>\n <relativeTargetDir></relativeTargetDir>\n <reference></reference>\n <excludedRegions></excludedRegions>\n <excludedUsers></excludedUsers>\n <gitConfigName></gitConfigName>\n <gitConfigEmail></gitConfigEmail>\n <skipTag>true</skipTag>\n <includedRegions></includedRegions>\n <scmName></scmName>\n </scm>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <builders/>\n <publishers/>\n <buildWrappers/>\n</project>'.strip()
job_with_artifacts = '\n<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<project>\n <actions/>\n <description>Ping a load of stuff for about 10s</description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.scm.NullSCM"/>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <builders>\n <hudson.tasks.Shell>\n <command>ping -c 5 localhost | tee out.txt\ngzip < out.txt > out.gz</command>\n </hudson.tasks.Shell>\n </builders>\n <publishers>\n <hudson.tasks.ArtifactArchiver>\n <artifacts>*.txt,*.gz</artifacts>\n <latestOnly>false</latestOnly>\n </hudson.tasks.ArtifactArchiver>\n <hudson.tasks.Fingerprinter>\n <targets></targets>\n <recordBuildArtifacts>true</recordBuildArtifacts>\n </hudson.tasks.Fingerprinter>\n </publishers>\n <buildWrappers/>\n</project>'.strip()
matrix_job = '\n<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<matrix-project>\n <actions/>\n <description></description>\n <keepDependencies>false</keepDependencies>\n <properties/>\n <scm class="hudson.scm.NullSCM"/>\n <canRoam>true</canRoam>\n <disabled>false</disabled>\n <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>\n <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>\n <triggers class="vector"/>\n <concurrentBuild>false</concurrentBuild>\n <axes>\n <hudson.matrix.TextAxis>\n <name>foo</name>\n <values>\n <string>one</string>\n <string>two</string>\n <string>three</string>\n </values>\n </hudson.matrix.TextAxis>\n </axes>\n <builders>\n <hudson.tasks.Shell>\n <command>ping -c 10 localhost</command>\n </hudson.tasks.Shell>\n </builders>\n <publishers/>\n <buildWrappers/>\n</matrix-project>'.strip() |
# Comma Code
# Say you have a list value like this:
# spam = ['apples', 'bananas', 'tofu', 'cats']
# Write a function that takes a list value as an argument and returns a string wit
# h all the items separated by a comma and a space, with and inserted before the l
# ast item. For example, passing the previous spam list to the function would retu
# rn 'apples, bananas, tofu, and cats'. But your function should be able to work w
# ith any list value passed to it. Be sure to test the case where an empty list []
# is passed to your function.
spam = ['apples', 'bananas', 'tofu', 'cats']
def comma_code(l):
if (len(l) <= 0):
return ""
elif (len(l) == 1):
return l[0]
else:
return ', '.join(l[:-1]) + " and " + l[-1]
print(comma_code(spam)) | spam = ['apples', 'bananas', 'tofu', 'cats']
def comma_code(l):
if len(l) <= 0:
return ''
elif len(l) == 1:
return l[0]
else:
return ', '.join(l[:-1]) + ' and ' + l[-1]
print(comma_code(spam)) |
a = [1, 0, 5, -2, -5, 7]
soma = a[0] + a[1] + a[5]
print(soma)
a[4] = 100
print(a)
for v in a:
print(v)
| a = [1, 0, 5, -2, -5, 7]
soma = a[0] + a[1] + a[5]
print(soma)
a[4] = 100
print(a)
for v in a:
print(v) |
sums_new_methodology = {
"Total revenue": {
"A01",
"A03",
"A09",
"A10",
"A12",
"A16",
"A18",
"A21",
"A36",
"A44",
"A45",
"A50",
"A54",
"A56",
"A59",
"A60",
"A61",
"A80",
"A81",
"A87",
"A89",
"A90",
"A91",
"A92",
"A93",
"A94",
"B01",
"B21",
"B22",
"B30",
"B42",
"B43",
"B46",
"B50",
"B54",
"B59",
"B79",
"B80",
"B89",
"B91",
"B92",
"B93",
"B94",
"D21",
"D30",
"D42",
"D46",
"D50",
"D79",
"D80",
"D89",
"D91",
"D92",
"D93",
"D94",
"T01",
"T09",
"T10",
"T11",
"T12",
"T13",
"T14",
"T15",
"T16",
"T19",
"T20",
"T21",
"T22",
"T23",
"T24",
"T25",
"T27",
"T28",
"T29",
"T40",
"T41",
"T50",
"T51",
"T53",
"T99",
"U01",
"U11",
"U20",
"U21",
"U30",
"U40",
"U41",
"U50",
"U95",
"U99",
"X01",
"X02",
"X05",
"X08",
"Y01",
"Y02",
"Y04",
"Y11",
"Y12",
"Y51",
"Y52",
},
"General revenue": {
"A01",
"A03",
"A09",
"A10",
"A12",
"A16",
"A18",
"A21",
"A36",
"A44",
"A45",
"A50",
"A54",
"A56",
"A59",
"A60",
"A61",
"A80",
"A81",
"A87",
"A89",
"B01",
"B21",
"B22",
"B30",
"B42",
"B43",
"B46",
"B50",
"B54",
"B59",
"B79",
"B80",
"B89",
"B91",
"B92",
"B93",
"B94",
"D21",
"D30",
"D42",
"D46",
"D50",
"D79",
"D80",
"D89",
"D91",
"D92",
"D93",
"D94",
"T01",
"T09",
"T10",
"T11",
"T12",
"T13",
"T14",
"T15",
"T16",
"T19",
"T20",
"T21",
"T22",
"T23",
"T24",
"T25",
"T27",
"T28",
"T29",
"T40",
"T41",
"T50",
"T51",
"T53",
"T99",
"U01",
"U11",
"U20",
"U21",
"U30",
"U40",
"U41",
"U50",
"U95",
"U99",
},
"Intergovernmental revenue": {
"B01",
"B21",
"B22",
"B30",
"B42",
"B43",
"B46",
"B50",
"B54",
"B59",
"B79",
"B80",
"B89",
"B91",
"B92",
"B93",
"B94",
"D21",
"D30",
"D42",
"D46",
"D50",
"D79",
"D80",
"D89",
"D91",
"D92",
"D93",
"D94",
},
"Taxes": {
"T01",
"T09",
"T10",
"T11",
"T12",
"T13",
"T14",
"T15",
"T16",
"T19",
"T20",
"T21",
"T22",
"T23",
"T24",
"T25",
"T27",
"T28",
"T29",
"T40",
"T41",
"T50",
"T51",
"T53",
"T99",
},
"General sales": {"T09"},
"Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"},
"License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"},
"Individual income tax": {"T40"},
"Corporate income tax": {"T41"},
"Other taxes": {"T01", "T50", "T51", "T53", "T99"},
"Current charge": {
"A01",
"A03",
"A09",
"A10",
"A12",
"A16",
"A18",
"A21",
"A36",
"A44",
"A45",
"A50",
"A54",
"A56",
"A59",
"A60",
"A61",
"A80",
"A81",
"A87",
"A89",
},
"Miscellaneous general revenue": {
"U01",
"U11",
"U20",
"U21",
"U30",
"U40",
"U41",
"U50",
"U95",
"U99",
},
"Utility revenue": {"A91", "A92", "A93", "A94"},
"Liquor stores revenue": {"A90"},
"Insurance trust revenue": {
"X01",
"X02",
"X05",
"X08",
"Y01",
"Y02",
"Y04",
"Y11",
"Y12",
"Y50",
"Y51",
"Y52",
},
"Total expenditure": {
"E01",
"E03",
"E04",
"E05",
"E12",
"E16",
"E18",
"E21",
"E22",
"E23",
"E25",
"E26",
"E27",
"E29",
"E31",
"E32",
"E36",
"E44",
"E45",
"E50",
"E52",
"E54",
"E55",
"E56",
"E59",
"E60",
"E61",
"E62",
"E66",
"E74",
"E75",
"E77",
"E79",
"E80",
"E81",
"E85",
"E87",
"E89",
"E90",
"E91",
"E92",
"E93",
"E94",
"F01",
"F03",
"F04",
"F05",
"F12",
"F16",
"F18",
"F21",
"F22",
"F23",
"F25",
"F26",
"F27",
"F29",
"F31",
"F32",
"F36",
"F44",
"F45",
"F50",
"F52",
"F54",
"F55",
"F56",
"F59",
"F60",
"F61",
"F62",
"F66",
"F77",
"F79",
"F80",
"F81",
"F85",
"F87",
"F89",
"F90",
"F91",
"F92",
"F93",
"F94",
"G01",
"G03",
"G04",
"G05",
"G12",
"G16",
"G18",
"G21",
"G22",
"G23",
"G25",
"G26",
"G27",
"G29",
"G31",
"G32",
"G36",
"G44",
"G45",
"G50",
"G52",
"G54",
"G55",
"G56",
"G59",
"G60",
"G61",
"G62",
"G66",
"G77",
"G79",
"G80",
"G81",
"G85",
"G87",
"G89",
"G90",
"G91",
"G92",
"G93",
"G94",
"I89",
"I91",
"I92",
"I93",
"I94",
"J19",
"J67",
"J68",
"J85",
"M01",
"M04",
"M05",
"M12",
"M18",
"M21",
"M23",
"M25",
"M27",
"M29",
"M30",
"M32",
"M36",
"M44",
"M50",
"M52",
"M54",
"M55",
"M56",
"M59",
"M60",
"M61",
"M62",
"M66",
"M67",
"M68",
"M79",
"M80",
"M81",
"M87",
"M89",
"M91",
"M92",
"M93",
"M94",
"Q12",
"Q18",
"S67",
"S89",
"X11",
"X12",
"Y05",
"Y06",
"Y14",
"Y53",
},
"Intergovernmental expenditure": {
"M01",
"M04",
"M05",
"M12",
"M18",
"M21",
"M23",
"M25",
"M27",
"M29",
"M30",
"M32",
"M36",
"M44",
"M50",
"M52",
"M54",
"M55",
"M56",
"M59",
"M60",
"M61",
"M62",
"M66",
"M67",
"M68",
"M79",
"M80",
"M81",
"M87",
"M89",
"M91",
"M92",
"M93",
"M94",
"Q12",
"Q18",
"S67",
"S89",
},
"Direct expenditure": {
"E01",
"E03",
"E04",
"E05",
"E12",
"E16",
"E18",
"E21",
"E22",
"E23",
"E25",
"E26",
"E27",
"E29",
"E31",
"E32",
"E36",
"E44",
"E45",
"E50",
"E52",
"E54",
"E55",
"E56",
"E59",
"E60",
"E61",
"E62",
"E66",
"E74",
"E75",
"E77",
"E79",
"E80",
"E81",
"E85",
"E87",
"E89",
"E90",
"E91",
"E92",
"E93",
"E94",
"F01",
"F03",
"F04",
"F05",
"F12",
"F16",
"F18",
"F21",
"F22",
"F23",
"F25",
"F26",
"F27",
"F29",
"F31",
"F32",
"F36",
"F44",
"F45",
"F50",
"F52",
"F54",
"F55",
"F56",
"F59",
"F60",
"F61",
"F62",
"F66",
"F77",
"F79",
"F80",
"F81",
"F85",
"F87",
"F89",
"F90",
"F91",
"F92",
"F93",
"F94",
"G01",
"G03",
"G04",
"G05",
"G12",
"G16",
"G18",
"G21",
"G22",
"G23",
"G25",
"G26",
"G27",
"G29",
"G31",
"G32",
"G36",
"G44",
"G45",
"G50",
"G52",
"G54",
"G55",
"G56",
"G59",
"G60",
"G61",
"G62",
"G66",
"G77",
"G79",
"G80",
"G81",
"G85",
"G87",
"G89",
"G90",
"G91",
"G92",
"G93",
"G94",
"I89",
"I91",
"I92",
"I93",
"I94",
"J19",
"J67",
"J68",
"J85",
"X11",
"X12",
"Y05",
"Y06",
"Y14",
"Y53",
},
"Current operation": {
"E01",
"E03",
"E04",
"E05",
"E12",
"E16",
"E18",
"E21",
"E22",
"E23",
"E25",
"E26",
"E27",
"E29",
"E31",
"E32",
"E36",
"E44",
"E45",
"E50",
"E52",
"E54",
"E55",
"E56",
"E59",
"E60",
"E61",
"E62",
"E66",
"E74",
"E75",
"E77",
"E79",
"E80",
"E81",
"E85",
"E87",
"E89",
"E90",
"E91",
"E92",
"E93",
"E94",
},
"Capital outlay": {
"F01",
"F03",
"F04",
"F05",
"F12",
"F16",
"F18",
"F21",
"F22",
"F23",
"F25",
"F26",
"F27",
"F29",
"F31",
"F32",
"F36",
"F44",
"F45",
"F50",
"F52",
"F54",
"F55",
"F56",
"F59",
"F60",
"F61",
"F62",
"F66",
"F77",
"F79",
"F80",
"F81",
"F85",
"F87",
"F89",
"F90",
"F91",
"F92",
"F93",
"F94",
"G01",
"G03",
"G04",
"G05",
"G12",
"G16",
"G18",
"G21",
"G22",
"G23",
"G25",
"G26",
"G27",
"G29",
"G31",
"G32",
"G36",
"G44",
"G45",
"G50",
"G52",
"G54",
"G55",
"G56",
"G59",
"G60",
"G61",
"G62",
"G66",
"G77",
"G79",
"G80",
"G81",
"G85",
"G87",
"G89",
"G90",
"G91",
"G92",
"G93",
"G94",
},
"Insurance benefits and repayments": {"X11", "X12", "Y05", "Y06", "Y14", "Y53",},
"Assistance and subsidies": {"J19", "J67", "J68", "J85"},
"Interest on debt": {"I89", "I91", "I92", "I93", "I94"},
"Exhibit: Salaries and wages": {"Z00"},
"General expenditure": {
"E01",
"E03",
"E04",
"E05",
"E12",
"E16",
"E18",
"E21",
"E22",
"E23",
"E25",
"E26",
"E27",
"E29",
"E31",
"E32",
"E36",
"E44",
"E45",
"E50",
"E52",
"E54",
"E55",
"E56",
"E59",
"E60",
"E61",
"E62",
"E66",
"E74",
"E75",
"E77",
"E79",
"E80",
"E81",
"E85",
"E87",
"E89",
"F01",
"F03",
"F04",
"F05",
"F12",
"F16",
"F18",
"F21",
"F22",
"F23",
"F25",
"F26",
"F27",
"F29",
"F31",
"F32",
"F36",
"F44",
"F45",
"F50",
"F52",
"F54",
"F55",
"F56",
"F59",
"F60",
"F61",
"F62",
"F66",
"F77",
"F79",
"F80",
"F81",
"F85",
"F87",
"F89",
"G01",
"G03",
"G04",
"G05",
"G12",
"G16",
"G18",
"G21",
"G22",
"G23",
"G25",
"G26",
"G27",
"G29",
"G31",
"G32",
"G36",
"G44",
"G45",
"G50",
"G52",
"G54",
"G55",
"G56",
"G59",
"G60",
"G61",
"G62",
"G66",
"G77",
"G79",
"G80",
"G81",
"G85",
"G87",
"G89",
"I89",
"J19",
"J67",
"J68",
"J85",
"M01",
"M04",
"M05",
"M12",
"M18",
"M21",
"M23",
"M25",
"M27",
"M29",
"M30",
"M32",
"M36",
"M44",
"M50",
"M52",
"M54",
"M55",
"M56",
"M59",
"M60",
"M61",
"M62",
"M66",
"M67",
"M68",
"M79",
"M80",
"M81",
"M87",
"M89",
"M91",
"M92",
"M93",
"M94",
"Q12",
"Q18",
"S67",
"S89",
},
"Direct general expenditure": {
"E01",
"E03",
"E04",
"E05",
"E12",
"E16",
"E18",
"E21",
"E22",
"E23",
"E25",
"E26",
"E27",
"E29",
"E31",
"E32",
"E36",
"E44",
"E45",
"E50",
"E52",
"E54",
"E55",
"E56",
"E59",
"E60",
"E61",
"E62",
"E66",
"E74",
"E75",
"E77",
"E79",
"E80",
"E81",
"E85",
"E87",
"E89",
"F01",
"F03",
"F04",
"F05",
"F12",
"F16",
"F18",
"F21",
"F22",
"F23",
"F25",
"F26",
"F27",
"F29",
"F31",
"F32",
"F36",
"F44",
"F45",
"F50",
"F52",
"F54",
"F55",
"F56",
"F59",
"F60",
"F61",
"F62",
"F66",
"F77",
"F79",
"F80",
"F81",
"F85",
"F87",
"F89",
"G01",
"G03",
"G04",
"G05",
"G12",
"G16",
"G18",
"G21",
"G22",
"G23",
"G25",
"G26",
"G27",
"G29",
"G31",
"G32",
"G36",
"G44",
"G45",
"G50",
"G52",
"G54",
"G55",
"G56",
"G59",
"G60",
"G61",
"G62",
"G66",
"G77",
"G79",
"G80",
"G81",
"G85",
"G87",
"G89",
"I89",
"J19",
"J67",
"J68",
"J85",
},
"Education": {
"E12",
"E16",
"E18",
"E21",
"F12",
"F16",
"F18",
"F21",
"G12",
"G16",
"G18",
"G21",
"J19",
"M12",
"M18",
"M21",
"Q12",
"Q18",
},
"Public welfare": {
"E74",
"E75",
"E77",
"E79",
"F77",
"F79",
"G77",
"G79",
"J67",
"J68",
"M67",
"M68",
"M79",
"S67",
},
"Hospitals": {"E36", "F36", "G36", "M36"},
"Health": {"E32", "F32", "G32", "M32"},
"Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"},
"Police protection": {"E62", "F62", "G62", "M62"},
"Correction": {"E04", "E05", "F04", "F05", "G04", "G05", "M04", "M05",},
"Natural resources": {
"E54",
"E55",
"E56",
"E59",
"F54",
"F55",
"F56",
"F59",
"G54",
"G55",
"G56",
"G59",
"M54",
"M55",
"M56",
"M59",
},
"Parks and recreation": {"E61", "F61", "G61", "M61"},
"Governmental administration": {
"E23",
"E25",
"E26",
"E29",
"E31",
"F23",
"F25",
"F26",
"F29",
"F31",
"G23",
"G25",
"G26",
"G29",
"G31",
"M23",
"M25",
"M29",
},
"Interest on general debt": {"I89"},
"Other and unallocable": {
"E01",
"E03",
"E22",
"E50",
"E52",
"E60",
"E66",
"E80",
"E81",
"E85",
"E87",
"E89",
"F01",
"F03",
"F22",
"F50",
"F52",
"F60",
"F66",
"F80",
"F81",
"F85",
"F87",
"F89",
"G01",
"G03",
"G22",
"G50",
"G52",
"G60",
"G66",
"G80",
"G81",
"G85",
"G87",
"G89",
"M01",
"M50",
"M52",
"M60",
"M66",
"M80",
"M81",
"M87",
"M89",
"S89",
},
"Utility expenditure": {
"E91",
"E92",
"E93",
"E94",
"F91",
"F92",
"F93",
"F94",
"G91",
"G92",
"G93",
"G94",
"I91",
"I92",
"I93",
"I94",
"M91",
"M92",
"M93",
"M94",
},
"Liquor stores expenditure": {"E90", "F90", "G90"},
"Insurance trust expenditure": {"X11", "X12", "Y05", "Y06", "Y14", "Y53",},
"Debt at end of fiscal year": {"64V", "44T", "49U"},
"Cash and security holdings": {
"W01",
"W31",
"W61",
"X21",
"X30",
"X42",
"X44",
"X47",
"Y07",
"Y08",
"Y21",
"Y61",
"Z77",
"Z78",
},
}
# sums_1992_2004 = {
# "Total revenue": {
# "T01",
# "T08",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A06",
# "A09",
# "A10",
# "A12",
# "A14",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U10",
# "U11",
# "U20",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# "B01",
# "B21",
# "B22",
# "B27",
# "B30",
# "B42",
# "B46",
# "B47",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "C21",
# "C28",
# "C30",
# "C42",
# "C46",
# "C47",
# "C50",
# "C67",
# "C79",
# "C80",
# "C89",
# "C91",
# "C92",
# "C93",
# "C94",
# "D11",
# "D21",
# "D30",
# "D42",
# "D46",
# "D47",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# "A91",
# "A92",
# "A93",
# "A94",
# "A90",
# "X01",
# "X02",
# "X05",
# "X08",
# "X09",
# "X03",
# "Y01",
# "Y02",
# "Y03",
# "Y04",
# "Y11",
# "Y12",
# "Y13",
# "Y51",
# "Y52",
# "Y20",
# "Y31",
# "Y41",
# "Y55",
# },
# "General revenue": {
# "T01",
# "T08",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A06",
# "A09",
# "A10",
# "A12",
# "A14",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U10",
# "U11",
# "U20",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# "B01",
# "B21",
# "B22",
# "B27",
# "B30",
# "B42",
# "B46",
# "B47",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "C21",
# "C28",
# "C30",
# "C42",
# "C46",
# "C47",
# "C50",
# "C67",
# "C79",
# "C80",
# "C89",
# "C91",
# "C92",
# "C93",
# "C94",
# "D11",
# "D21",
# "D30",
# "D42",
# "D46",
# "D47",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# },
# "Intergovernmental revenue": {
# "B01",
# "B21",
# "B22",
# "B27",
# "B30",
# "B42",
# "B46",
# "B47",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "C21",
# "C28",
# "C30",
# "C42",
# "C46",
# "C47",
# "C50",
# "C67",
# "C79",
# "C80",
# "C89",
# "C91",
# "C92",
# "C93",
# "C94",
# "D11",
# "D21",
# "D30",
# "D42",
# "D46",
# "D47",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# },
# "Taxes": {
# "T01",
# "T08",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# },
# "General sales": {"T09",},
# "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"},
# "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29",},
# "Individual income tax": {"T40"},
# "Corporate income tax": {"T41"},
# "Other taxes": {"T01", "T50", "T51", "T53", "T99"},
# "Current charge": {
# "A01",
# "A03",
# "A06",
# "A09",
# "A10",
# "A12",
# "A14",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# },
# "Miscellaneous general revenue": {
# "U01",
# "U10",
# "U11",
# "U20",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# },
# "Utility revenue": {"A91", "A92", "A93", "A94"},
# "Liquor stores revenue": {"A90"},
# "Insurance trust revenue": {
# "X01",
# "X02",
# "X05",
# "X08",
# "Y01",
# "Y02",
# "Y04",
# "Y10",
# "Y11",
# "Y12",
# "Y50",
# "Y51",
# "Y52",
# },
# "Total expenditure": {
# "E01",
# "F01",
# "G01",
# "I01",
# "L01",
# "M01",
# "N01",
# "O01",
# "P01",
# "R01",
# "E02",
# "F02",
# "G02",
# "I02",
# "L02",
# "M02",
# "E03",
# "F03",
# "G03",
# "E04",
# "F04",
# "G04",
# "I04",
# "L04",
# "M04",
# "E05",
# "F05",
# "G05",
# "L05",
# "M05",
# "N05",
# "O05",
# "P05",
# "S05",
# "E06",
# "F06",
# "G06",
# "I06",
# "L06",
# "M06",
# "E12",
# "F12",
# "G12",
# "L12",
# "M12",
# "N12",
# "O12",
# "P12",
# "Q12",
# "R12",
# "E14",
# "F14",
# "G14",
# "I14",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "L18",
# "M18",
# "N18",
# "O18",
# "P18",
# "Q18",
# "R18",
# "E19",
# "E20",
# "F20",
# "G20",
# "I20",
# "L20",
# "M20",
# "E21",
# "F21",
# "G21",
# "I21",
# "L21",
# "M21",
# "N21",
# "O21",
# "P21",
# "Q21",
# "S21",
# "E22",
# "F22",
# "G22",
# "I22",
# "L22",
# "M22",
# "E23",
# "F23",
# "G23",
# "I23",
# "L23",
# "M23",
# "N23",
# "O23",
# "P23",
# "E24",
# "F24",
# "G24",
# "L24",
# "M24",
# "N24",
# "O24",
# "P24",
# "R24",
# "E25",
# "F25",
# "G25",
# "I25",
# "L25",
# "M25",
# "N25",
# "O25",
# "P25",
# "S25",
# "E26",
# "F26",
# "G26",
# "E28",
# "F28",
# "G28",
# "I28",
# "L28",
# "M28",
# "E29",
# "F29",
# "G29",
# "I29",
# "L29",
# "M29",
# "N29",
# "O29",
# "P29",
# "M30",
# "N30",
# "O30",
# "P30",
# "R30",
# "E31",
# "F31",
# "G31",
# "E32",
# "F32",
# "G32",
# "I32",
# "L32",
# "M32",
# "N32",
# "O32",
# "P32",
# "R32",
# "E36",
# "F36",
# "G36",
# "E37",
# "F37",
# "G37",
# "I37",
# "L37",
# "M37",
# "E38",
# "F38",
# "G38",
# "I38",
# "L38",
# "M38",
# "N38",
# "O38",
# "P38",
# "R38",
# "E39",
# "F39",
# "G39",
# "I39",
# "L39",
# "M39",
# "E44",
# "F44",
# "G44",
# "I44",
# "L44",
# "M44",
# "N44",
# "O44",
# "P44",
# "R44",
# "E45",
# "F45",
# "G45",
# "E47",
# "I47",
# "L47",
# "M47",
# "N47",
# "O47",
# "P47",
# "R47",
# "E50",
# "F50",
# "G50",
# "I50",
# "L50",
# "M50",
# "N50",
# "O50",
# "P50",
# "R50",
# "E51",
# "I51",
# "L51",
# "M51",
# "E52",
# "F52",
# "G52",
# "I52",
# "L52",
# "M52",
# "N52",
# "O52",
# "P52",
# "R52",
# "E53",
# "F53",
# "G53",
# "I53",
# "L53",
# "M53",
# "E54",
# "F54",
# "G54",
# "I54",
# "L54",
# "M54",
# "N54",
# "O54",
# "P54",
# "R54",
# "E55",
# "F55",
# "G55",
# "M55",
# "N55",
# "O55",
# "P55",
# "R55",
# "E56",
# "F56",
# "G56",
# "I56",
# "L56",
# "M56",
# "N56",
# "O56",
# "P56",
# "R56",
# "E57",
# "F57",
# "G57",
# "I57",
# "L57",
# "M57",
# "E58",
# "F58",
# "G58",
# "I58",
# "L58",
# "M58",
# "E59",
# "F59",
# "G59",
# "I59",
# "L59",
# "M59",
# "N59",
# "O59",
# "P59",
# "R59",
# "S59",
# "E60",
# "F60",
# "G60",
# "I60",
# "L60",
# "M60",
# "N60",
# "O60",
# "P60",
# "R60",
# "E61",
# "F61",
# "G61",
# "I61",
# "L61",
# "M61",
# "N61",
# "O61",
# "P61",
# "R61",
# "E62",
# "F62",
# "G62",
# "I62",
# "L62",
# "M62",
# "N62",
# "O62",
# "P62",
# "R62",
# "E66",
# "F66",
# "G66",
# "I66",
# "L66",
# "M66",
# "N66",
# "O66",
# "P66",
# "R66",
# "E67",
# "I67",
# "L67",
# "M67",
# "N67",
# "O67",
# "P67",
# "S67",
# "E68",
# "I68",
# "M68",
# "N68",
# "O68",
# "P68",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "G79",
# "F79",
# "I79",
# "L79",
# "M79",
# "N79",
# "O79",
# "P79",
# "R79",
# "E80",
# "F80",
# "G80",
# "I80",
# "L80",
# "M80",
# "N80",
# "O80",
# "P80",
# "R80",
# "E81",
# "F81",
# "G81",
# "I81",
# "L81",
# "M81",
# "N81",
# "O81",
# "P81",
# "R81",
# "E84",
# "E85",
# "F85",
# "G85",
# "I85",
# "E87",
# "F87",
# "G87",
# "I87",
# "L87",
# "M87",
# "N87",
# "O87",
# "P87",
# "R87",
# "E89",
# "F89",
# "G89",
# "I89",
# "J89",
# "L89",
# "M89",
# "N89",
# "O89",
# "P89",
# "R89",
# "S89",
# "E90",
# "F90",
# "G90",
# "E91",
# "F91",
# "G91",
# "I91",
# "E92",
# "F92",
# "G92",
# "I92",
# "E93",
# "F93",
# "G93",
# "I93",
# "E94",
# "F94",
# "G94",
# "I94",
# "L91",
# "L92",
# "L93",
# "L94",
# "M91",
# "M92",
# "M93",
# "M94",
# "N91",
# "N92",
# "N93",
# "N94",
# "R91",
# "R92",
# "R93",
# "R94",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y53",
# "Y25",
# "Y34",
# "Y45",
# },
# "Intergovernmental expenditure": {
# "L01",
# "M01",
# "N01",
# "O01",
# "P01",
# "R01",
# "L02",
# "M02",
# "L04",
# "M04",
# "L05",
# "M05",
# "N05",
# "O05",
# "P05",
# "S05",
# "L06",
# "M06",
# "L12",
# "M12",
# "N12",
# "O12",
# "P12",
# "Q12",
# "R12",
# "L18",
# "M18",
# "N18",
# "O18",
# "P18",
# "Q18",
# "R18",
# "L20",
# "M20",
# "L21",
# "M21",
# "N21",
# "O21",
# "P21",
# "Q21",
# "S21",
# "L22",
# "M22",
# "L23",
# "M23",
# "N23",
# "O23",
# "P23",
# "L24",
# "M24",
# "N24",
# "O24",
# "P24",
# "R24",
# "L25",
# "M25",
# "N25",
# "O25",
# "P25",
# "S25",
# "L28",
# "M28",
# "L29",
# "M29",
# "N29",
# "O29",
# "P29",
# "M30",
# "N30",
# "O30",
# "P30",
# "R30",
# "L32",
# "M32",
# "N32",
# "O32",
# "P32",
# "R32",
# "L37",
# "M37",
# "L38",
# "M38",
# "N38",
# "O38",
# "P38",
# "R38",
# "L39",
# "M39",
# "L44",
# "M44",
# "N44",
# "O44",
# "P44",
# "R44",
# "L47",
# "M47",
# "N47",
# "O47",
# "P47",
# "R47",
# "L50",
# "M50",
# "N50",
# "O50",
# "P50",
# "R50",
# "L51",
# "M51",
# "L52",
# "M52",
# "N52",
# "O52",
# "P52",
# "R52",
# "L53",
# "M53",
# "L54",
# "M54",
# "N54",
# "O54",
# "P54",
# "R54",
# "M55",
# "N55",
# "O55",
# "P55",
# "R55",
# "L56",
# "M56",
# "N56",
# "O56",
# "P56",
# "R56",
# "L57",
# "M57",
# "L58",
# "M58",
# "L59",
# "M59",
# "N59",
# "O59",
# "P59",
# "R59",
# "S59",
# "L60",
# "M60",
# "N60",
# "O60",
# "P60",
# "R60",
# "L61",
# "M61",
# "N61",
# "O61",
# "P61",
# "R61",
# "L62",
# "M62",
# "N62",
# "O62",
# "P62",
# "R62",
# "L66",
# "M66",
# "N66",
# "O66",
# "P66",
# "R66",
# "L67",
# "M67",
# "N67",
# "O67",
# "P67",
# "S67",
# "M68",
# "N68",
# "O68",
# "P68",
# "L79",
# "M79",
# "N79",
# "O79",
# "P79",
# "R79",
# "L80",
# "M80",
# "N80",
# "O80",
# "P80",
# "R80",
# "L81",
# "M81",
# "N81",
# "O81",
# "P81",
# "R81",
# "L87",
# "M87",
# "N87",
# "O87",
# "P87",
# "R87",
# "L89",
# "M89",
# "N89",
# "O89",
# "P89",
# "R89",
# "S89",
# "L91",
# "L92",
# "L93",
# "L94",
# "M91",
# "M92",
# "M93",
# "M94",
# "N91",
# "N92",
# "N93",
# "N94",
# "R91",
# "R92",
# "R93",
# "R94",
# },
# "Direct expenditure": {
# "E01",
# "G01",
# "F01",
# "I01",
# "I02",
# "E02",
# "G02",
# "F02",
# "E03",
# "F03",
# "G03",
# "E04",
# "F04",
# "G04",
# "I04",
# "E05",
# "F05",
# "G05",
# "E06",
# "F06",
# "G06",
# "I06",
# "E12",
# "F12",
# "G12",
# "E14",
# "F14",
# "G14",
# "I14",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "E19",
# "E20",
# "F20",
# "G20",
# "I20",
# "E21",
# "F21",
# "G21",
# "I21",
# "E22",
# "F22",
# "G22",
# "I22",
# "E23",
# "F23",
# "G23",
# "I23",
# "E24",
# "F24",
# "G24",
# "E25",
# "F25",
# "G25",
# "I25",
# "E26",
# "F26",
# "G26",
# "E28",
# "F28",
# "G28",
# "I28",
# "E29",
# "F29",
# "G29",
# "I29",
# "E31",
# "F31",
# "G31",
# "E32",
# "F32",
# "G32",
# "I32",
# "E36",
# "F36",
# "G36",
# "E37",
# "F37",
# "G37",
# "I37",
# "E38",
# "F38",
# "G38",
# "I38",
# "E39",
# "F39",
# "G39",
# "I39",
# "E44",
# "F44",
# "G44",
# "I44",
# "E45",
# "F45",
# "G45",
# "E47",
# "I47",
# "E50",
# "F50",
# "G50",
# "I50",
# "E51",
# "I51",
# "E52",
# "F52",
# "G52",
# "I52",
# "E53",
# "F53",
# "G53",
# "I53",
# "E54",
# "F54",
# "G54",
# "I54",
# "E55",
# "F55",
# "G55",
# "E56",
# "F56",
# "G56",
# "I56",
# "E57",
# "F57",
# "G57",
# "I57",
# "E58",
# "F58",
# "G58",
# "I58",
# "E59",
# "F59",
# "G59",
# "I59",
# "E60",
# "F60",
# "G60",
# "I60",
# "E61",
# "F61",
# "G61",
# "I61",
# "E62",
# "F62",
# "G62",
# "I62",
# "E66",
# "F66",
# "G66",
# "I66",
# "E67",
# "I67",
# "E68",
# "I68",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "F79",
# "G79",
# "I79",
# "E80",
# "F80",
# "G80",
# "I80",
# "E81",
# "F81",
# "G81",
# "I81",
# "E84",
# "E85",
# "F85",
# "G85",
# "I85",
# "E87",
# "F87",
# "G87",
# "I87",
# "E89",
# "F89",
# "G89",
# "I89",
# "J89",
# "E90",
# "F90",
# "G90",
# "E91",
# "F91",
# "G91",
# "I91",
# "E92",
# "F92",
# "G92",
# "I92",
# "E93",
# "F93",
# "G93",
# "I93",
# "E94",
# "F94",
# "G94",
# "I94",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y53",
# "Y25",
# "Y34",
# "Y45",
# },
# "Current operation": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# },
# "Capital outlay": {
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# },
# "Insurance benefits and repayments": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Assistance and subsidies": {
# "I01",
# "I02",
# "I04",
# "I06",
# "I14",
# "E19",
# "I20",
# "I21",
# "I22",
# "I23",
# "I25",
# "I28",
# "I29",
# "I32",
# "I37",
# "I38",
# "I39",
# "I44",
# "I47",
# "I50",
# "I51",
# "I52",
# "I53",
# "I54",
# "I56",
# "I57",
# "I58",
# "I59",
# "I60",
# "I61",
# "I62",
# "I66",
# "E67",
# "I67",
# "E68",
# "I68",
# "I79",
# "I80",
# "I81",
# "E84",
# "I85",
# "I87",
# "J89",
# },
# "Interest on debt": {"I89", "I91", "I92", "I93", "I94"},
# "Exhibit: Salaries and wages": {"Z00"},
# "General expenditure": {
# "E01",
# "F01",
# "G01",
# "I01",
# "L01",
# "M01",
# "N01",
# "O01",
# "P01",
# "R01",
# "E02",
# "F02",
# "G02",
# "I02",
# "L02",
# "M02",
# "E03",
# "F03",
# "G03",
# "E04",
# "F04",
# "G04",
# "I04",
# "L04",
# "M04",
# "E05",
# "F05",
# "G05",
# "L05",
# "M05",
# "N05",
# "O05",
# "P05",
# "S05",
# "E06",
# "F06",
# "G06",
# "I06",
# "L06",
# "M06",
# "E12",
# "F12",
# "G12",
# "L12",
# "M12",
# "N12",
# "O12",
# "P12",
# "Q12",
# "R12",
# "E14",
# "F14",
# "G14",
# "I14",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "L18",
# "M18",
# "N18",
# "O18",
# "P18",
# "Q18",
# "R18",
# "E19",
# "E20",
# "F20",
# "G20",
# "I20",
# "L20",
# "M20",
# "E21",
# "F21",
# "G21",
# "I21",
# "L21",
# "M21",
# "N21",
# "O21",
# "P21",
# "Q21",
# "S21",
# "E22",
# "F22",
# "G22",
# "I22",
# "L22",
# "M22",
# "E23",
# "F23",
# "G23",
# "I23",
# "L23",
# "M23",
# "N23",
# "O23",
# "P23",
# "E24",
# "F24",
# "G24",
# "L24",
# "M24",
# "N24",
# "O24",
# "P24",
# "R24",
# "E25",
# "F25",
# "G25",
# "I25",
# "L25",
# "M25",
# "N25",
# "O25",
# "P25",
# "S25",
# "E26",
# "F26",
# "G26",
# "E28",
# "F28",
# "G28",
# "I28",
# "L28",
# "M28",
# "E29",
# "F29",
# "G29",
# "I29",
# "L29",
# "M29",
# "N29",
# "O29",
# "P29",
# "M30",
# "N30",
# "O30",
# "P30",
# "R30",
# "E31",
# "F31",
# "G31",
# "E32",
# "F32",
# "G32",
# "I32",
# "L32",
# "M32",
# "N32",
# "O32",
# "P32",
# "R32",
# "E36",
# "F36",
# "G36",
# "E37",
# "F37",
# "G37",
# "I37",
# "L37",
# "M37",
# "E38",
# "F38",
# "G38",
# "I38",
# "L38",
# "M38",
# "N38",
# "O38",
# "P38",
# "R38",
# "E39",
# "F39",
# "G39",
# "I39",
# "L39",
# "M39",
# "E44",
# "F44",
# "G44",
# "I44",
# "L44",
# "M44",
# "N44",
# "O44",
# "P44",
# "R44",
# "E45",
# "F45",
# "G45",
# "E47",
# "I47",
# "L47",
# "M47",
# "N47",
# "O47",
# "P47",
# "R47",
# "E50",
# "F50",
# "G50",
# "I50",
# "L50",
# "M50",
# "N50",
# "O50",
# "P50",
# "R50",
# "E51",
# "I51",
# "L51",
# "M51",
# "E52",
# "F52",
# "G52",
# "I52",
# "L52",
# "M52",
# "N52",
# "O52",
# "P52",
# "R52",
# "E53",
# "F53",
# "G53",
# "I53",
# "L53",
# "M53",
# "E54",
# "F54",
# "G54",
# "I54",
# "L54",
# "M54",
# "N54",
# "O54",
# "P54",
# "R54",
# "E55",
# "F55",
# "G55",
# "M55",
# "N55",
# "O55",
# "P55",
# "R55",
# "E56",
# "F56",
# "G56",
# "I56",
# "L56",
# "M56",
# "N56",
# "O56",
# "P56",
# "R56",
# "E57",
# "F57",
# "G57",
# "I57",
# "L57",
# "M57",
# "E58",
# "F58",
# "G58",
# "I58",
# "L58",
# "M58",
# "E59",
# "F59",
# "G59",
# "I59",
# "L59",
# "M59",
# "N59",
# "O59",
# "P59",
# "R59",
# "S59",
# "E60",
# "F60",
# "G60",
# "I60",
# "L60",
# "M60",
# "N60",
# "O60",
# "P60",
# "R60",
# "E61",
# "F61",
# "G61",
# "I61",
# "L61",
# "M61",
# "N61",
# "O61",
# "P61",
# "R61",
# "E62",
# "F62",
# "G62",
# "I62",
# "L62",
# "M62",
# "N62",
# "O62",
# "P62",
# "R62",
# "E66",
# "F66",
# "G66",
# "I66",
# "L66",
# "M66",
# "N66",
# "O66",
# "P66",
# "R66",
# "E67",
# "I67",
# "L67",
# "M67",
# "N67",
# "O67",
# "P67",
# "S67",
# "E68",
# "I68",
# "M68",
# "N68",
# "O68",
# "P68",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "F79",
# "G79",
# "I79",
# "L79",
# "M79",
# "N79",
# "O79",
# "P79",
# "R79",
# "E80",
# "F80",
# "G80",
# "I80",
# "L80",
# "M80",
# "N80",
# "O80",
# "P80",
# "R80",
# "E81",
# "F81",
# "G81",
# "I81",
# "L81",
# "M81",
# "N81",
# "O81",
# "P81",
# "R81",
# "E84",
# "E85",
# "F85",
# "G85",
# "I85",
# "E87",
# "F87",
# "G87",
# "I87",
# "L87",
# "M87",
# "N87",
# "O87",
# "P87",
# "R87",
# "E89",
# "F89",
# "G89",
# "I89",
# "J89",
# "L89",
# "M89",
# "N89",
# "O89",
# "P89",
# "R89",
# "S89",
# "L91",
# "M91",
# "N91",
# "R91",
# "L92",
# "M92",
# "N92",
# "R92",
# "L93",
# "M93",
# "N93",
# "R93",
# "L94",
# "M94",
# "N94",
# "R94",
# },
# "Direct general expenditure": {
# "E01",
# "G01",
# "F01",
# "I01",
# "I02",
# "E02",
# "G02",
# "F02",
# "E03",
# "F03",
# "G03",
# "E04",
# "F04",
# "G04",
# "I04",
# "E05",
# "F05",
# "G05",
# "E06",
# "F06",
# "G06",
# "I06",
# "E12",
# "F12",
# "G12",
# "E14",
# "F14",
# "G14",
# "I14",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "E19",
# "E20",
# "F20",
# "G20",
# "I20",
# "E21",
# "F21",
# "G21",
# "I21",
# "E22",
# "F22",
# "G22",
# "I22",
# "E23",
# "F23",
# "G23",
# "I23",
# "E24",
# "F24",
# "G24",
# "E25",
# "F25",
# "G25",
# "I25",
# "E26",
# "F26",
# "G26",
# "E28",
# "F28",
# "G28",
# "I28",
# "E29",
# "F29",
# "G29",
# "I29",
# "E31",
# "F31",
# "G31",
# "E32",
# "F32",
# "G32",
# "I32",
# "E36",
# "F36",
# "G36",
# "E37",
# "F37",
# "G37",
# "I37",
# "E38",
# "F38",
# "G38",
# "I38",
# "E39",
# "F39",
# "G39",
# "I39",
# "E44",
# "F44",
# "G44",
# "I44",
# "E45",
# "F45",
# "G45",
# "E47",
# "I47",
# "E50",
# "F50",
# "G50",
# "I50",
# "E51",
# "I51",
# "E52",
# "F52",
# "G52",
# "I52",
# "E53",
# "F53",
# "G53",
# "I53",
# "E54",
# "F54",
# "G54",
# "I54",
# "E55",
# "F55",
# "G55",
# "E56",
# "F56",
# "G56",
# "I56",
# "E57",
# "F57",
# "G57",
# "I57",
# "E58",
# "F58",
# "G58",
# "I58",
# "E59",
# "F59",
# "G59",
# "I59",
# "E60",
# "F60",
# "G60",
# "I60",
# "E61",
# "F61",
# "G61",
# "I61",
# "E62",
# "F62",
# "G62",
# "I62",
# "E66",
# "F66",
# "G66",
# "I66",
# "E67",
# "I67",
# "E68",
# "I68",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "F79",
# "G79",
# "I79",
# "E80",
# "F80",
# "G80",
# "I80",
# "E81",
# "F81",
# "G81",
# "I81",
# "E84",
# "E85",
# "F85",
# "G85",
# "I85",
# "E87",
# "F87",
# "G87",
# "I87",
# "E89",
# "F89",
# "G89",
# "I89",
# "J89",
# },
# "Education": {
# "E12",
# "F12",
# "G12",
# "L12",
# "M12",
# "N12",
# "O12",
# "P12",
# "Q12",
# "R12",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "L18",
# "M18",
# "N18",
# "O18",
# "P18",
# "Q18",
# "R18",
# "E19",
# "E20",
# "F20",
# "G20",
# "I20",
# "L20",
# "M20",
# "E21",
# "F21",
# "G21",
# "I21",
# "L21",
# "M21",
# "N21",
# "O21",
# "P21",
# "Q21",
# "S21",
# },
# "Public welfare": {
# "E67",
# "I67",
# "L67",
# "M67",
# "N67",
# "O67",
# "P67",
# "S67",
# "E68",
# "I68",
# "M68",
# "N68",
# "O68",
# "P68",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "F79",
# "G79",
# "I79",
# "L79",
# "M79",
# "N79",
# "O79",
# "P79",
# "R79",
# },
# "Hospitals": {
# "E36",
# "F36",
# "G36",
# "E37",
# "F37",
# "G37",
# "I37",
# "L37",
# "M37",
# "E39",
# "F39",
# "G39",
# "I39",
# "L39",
# "M39",
# "E38",
# "F38",
# "G38",
# "I38",
# "L38",
# "M38",
# "N38",
# "O38",
# "P38",
# "R38",
# },
# "Health": {"E32", "F32", "G32", "I32", "L32", "M32", "N32", "O32", "P32", "R32",},
# "Highways": {
# "E44",
# "F44",
# "G44",
# "I44",
# "L44",
# "M44",
# "N44",
# "O44",
# "P44",
# "R44",
# "E45",
# "F45",
# "G45",
# },
# "Police protection": {
# "E62",
# "F62",
# "G62",
# "I62",
# "L62",
# "M62",
# "N62",
# "O62",
# "P62",
# "R62",
# },
# "Correction": {
# "E04",
# "F04",
# "G04",
# "I04",
# "L04",
# "M04",
# "E05",
# "F05",
# "G05",
# "L05",
# "M05",
# "N05",
# "O05",
# "P05",
# "S05",
# },
# "Natural resources": {
# "E51",
# "I51",
# "L51",
# "M51",
# "E53",
# "F53",
# "G53",
# "I53",
# "L53",
# "M53",
# "E54",
# "F54",
# "G54",
# "I54",
# "L54",
# "M54",
# "N54",
# "O54",
# "P54",
# "R54",
# "E55",
# "F55",
# "G55",
# "M55",
# "N55",
# "O55",
# "P55",
# "R55",
# "E56",
# "F56",
# "G56",
# "I56",
# "L56",
# "M56",
# "N56",
# "O56",
# "P56",
# "R56",
# "E57",
# "F57",
# "G57",
# "I57",
# "L57",
# "M57",
# "E58",
# "F58",
# "G58",
# "I58",
# "L58",
# "M58",
# "E59",
# "F59",
# "G59",
# "I59",
# "L59",
# "M59",
# "N59",
# "O59",
# "P59",
# "R59",
# "S59",
# },
# "Parks and recreation": {
# "E61",
# "F61",
# "G61",
# "I61",
# "L61",
# "M61",
# "N61",
# "O61",
# "P61",
# "R61",
# },
# "Governmental administration": {
# "E23",
# "F23",
# "G23",
# "M23",
# "E25",
# "F25",
# "G25",
# "M25",
# "E26",
# "F26",
# "G26",
# "E29",
# "M29",
# "F29",
# "G29",
# "E31",
# "F31",
# "G31",
# },
# "Interest on general debt": {"I89", "I91", "I92", "I93", "I94"},
# # "Other and unallocable": {"A61", "B46", "E77", "G45", "T21", "T28", "U41"},
# "Other and unallocable": {
# "E01",
# "F01",
# "G01",
# "M01",
# "E03",
# "F03",
# "G03",
# "E22",
# "F22",
# "G22",
# "M30",
# "E50",
# "F50",
# "G50",
# "M50",
# "E52",
# "F52",
# "G52",
# "M52",
# "E66",
# "F66",
# "G66",
# "M66",
# "E80",
# "F80",
# "G80",
# "M80",
# "E81",
# "F81",
# "G81",
# "M81",
# "E85",
# "F85",
# "G85",
# "J85",
# "E87",
# "F87",
# "G87",
# "M87",
# "E89",
# "F89",
# "G89",
# "M89",
# "S89",
# "M91",
# "M92",
# "M93",
# "M94",
# },
# "Utility expenditure": {
# "E91",
# "F91",
# "G91",
# "I91",
# "E92",
# "F92",
# "G92",
# "I92",
# "E93",
# "F93",
# "G93",
# "I93",
# "E94",
# "F94",
# "G94",
# "I94",
# },
# "Liquor stores expenditure": {"E90", "F90", "G90"},
# "Insurance trust expenditure": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Debt at end of fiscal year": {
# "41A",
# "41B",
# "41C",
# "41D",
# "41E",
# "41F",
# "41G",
# "41H",
# "41J",
# "41K",
# "41M",
# "41N",
# "41P",
# "41S",
# "41X",
# "41V",
# "41Y",
# "42A",
# "42B",
# "42C",
# "42D",
# "42E",
# "42F",
# "42G",
# "42H",
# "42J",
# "42K",
# "42L",
# "42M",
# "42N",
# "42P",
# "42R",
# "42S",
# "42X",
# "43A",
# "43B",
# "43C",
# "43D",
# "43E",
# "43F",
# "43G",
# "43H",
# "43J",
# "43K",
# "43L",
# "43M",
# "43N",
# "43P",
# "43R",
# "43S",
# "43X",
# "44A",
# "44B",
# "44C",
# "44D",
# "44E",
# "44F",
# "44G",
# "44H",
# "44J",
# "44K",
# "44L",
# "44M",
# "44N",
# "44P",
# "44R",
# "44S",
# "44T",
# "44W",
# "44X",
# },
# "Cash and security holdings": {
# "W01",
# "W31",
# "W61",
# "W24",
# "W54",
# "W84",
# "W10",
# "W40",
# "W70",
# "W15",
# "W45",
# "W75",
# "W13",
# "W43",
# "W73",
# "Y44",
# "Y84",
# "Y61",
# "Y70",
# "Y73",
# "Y75",
# "Y07",
# "Y08",
# "Y21",
# "Y30",
# "Y33",
# "Y35",
# "X21",
# "X30",
# "X40",
# "X41",
# "X42",
# "X44",
# "X47",
# },
# }
#
# sums_methods_pdf = {
# "Total revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# "T01",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# "A90",
# "A91",
# "A92",
# "A93",
# "A94",
# "X01",
# "X02",
# "X05",
# "X08",
# "Y01",
# "Y02",
# "Y04",
# "Y10",
# "Y11",
# "Y12",
# "Y50",
# "Y51",
# "Y52",
# },
# "General revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D94",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T01",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# },
# "Intergovernmental revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# "S74",
# },
# "Taxes": {
# "T01",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# },
# "General sales": {"T09"},
# "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"},
# "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"},
# "Individual income tax": {"T40"},
# "Corporate income tax": {"T41"},
# "Other taxes": {"T01", "T50", "T51", "T53", "T99"},
# "Current charge": {
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# },
# "Miscellaneous general revenue": {
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# },
# "Utility revenue": {"A91", "A92", "A93", "A94"},
# "Liquor stores revenue": {"A90"},
# "Insurance trust revenue": {
# "X01",
# "X02",
# "X05",
# "X08",
# "Y01",
# "Y02",
# "Y04",
# "Y10",
# "Y11",
# "Y12",
# "Y50",
# "Y51",
# "Y52",
# },
# "Total expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# "I89",
# "I91",
# "I92",
# "I93",
# "I94",
# "J19",
# "J67",
# "J68",
# "J85",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y15",
# "Y14",
# "Y53",
# "Y54",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S74",
# "S89",
# },
# "Intergovernmental expenditure": {
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S68",
# "S89",
# },
# "Direct expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# "J19",
# "J67",
# "J68",
# "J85",
# "I89",
# "I91",
# "I92",
# "I93",
# "I94",
# },
# "Current operation": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# },
# "Capital outlay": {
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# },
# "Insurance benefits and repayments": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Assistance and subsidies": {"J19", "J67", "J68", "J85"},
# "Interest on debt": {"I89", "I91", "I92", "I93", "I94"},
# "Exhibit: Salaries and wages": {"Z00"},
# "General expenditure": {
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S89",
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "I89",
# "J19",
# "J67",
# "J68",
# "J85",
# },
# "Direct general expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "I89",
# "J19",
# "J67",
# "J68",
# "J85",
# },
# "Education": {
# "E12",
# "F12",
# "G12",
# "M12",
# "Q12",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "M18",
# "Q18",
# "J19",
# "E21",
# "F21",
# "G21",
# "M21",
# },
# "Public welfare": {
# "J67",
# "M67",
# "S67",
# "S74",
# "J68",
# "M68",
# "E73",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "M79",
# "F79",
# "G79",
# },
# "Hospitals": {"E36", "F36", "G36", "M36"},
# # "Health": {"E27", "E32", "F27", "F32", "G27", "G32", "M27", "M32"},
# "Health": {"E32", "F32", "G32", "M32"},
# "Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"},
# "Police protection": {"E62", "F62", "G62", "M62"},
# "Correction": {"E04", "M04", "F04", "G04", "E05", "F05", "G05", "M05"},
# "Natural resources": {
# "E54",
# "E55",
# "M54",
# "M55",
# "E56",
# "M56",
# "E59",
# "M59",
# "F54",
# "F55",
# "F56",
# "F59",
# "G54",
# "G55",
# "G56",
# "G59",
# },
# "Parks and recreation": {"E61", "F61", "G61", "M61"},
# "Governmental administration": {
# "E23",
# "F23",
# "G23",
# "M23",
# "E25",
# "F25",
# "G25",
# "M25",
# "E26",
# "F26",
# "G26",
# "E29",
# "M29",
# "F29",
# "G29",
# "E31",
# "F31",
# "G31",
# },
# "Interest on general debt": {"I89"},
# "Other and unallocable": {
# "E01",
# "F01",
# "G01",
# "M01",
# "E03",
# "F03",
# "G03",
# "E22",
# "F22",
# "G22",
# "M30",
# "E50",
# "F50",
# "G50",
# "M50",
# "E52",
# "F52",
# "G52",
# "M52",
# "E66",
# "F66",
# "G66",
# "M66",
# "E80",
# "F80",
# "G80",
# "M80",
# "E81",
# "F81",
# "G81",
# "M81",
# "E85",
# "F85",
# "G85",
# "J85",
# "E87",
# "F87",
# "G87",
# "M87",
# "E89",
# "F89",
# "G89",
# "M89",
# "S89",
# "M91",
# "M92",
# "M93",
# "M94",
# },
# "Utility expenditure": {
# "E91",
# "F91",
# "G91",
# "I91",
# "E92",
# "F92",
# "G92",
# "I92",
# "E93",
# "F93",
# "G93",
# "I93",
# "E94",
# "F94",
# "G94",
# "I94",
# },
# "Liquor stores expenditure": {"E90", "F90", "G90"},
# "Insurance trust expenditure": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Debt at end of fiscal year": {"64V", "44T", "49U"},
# "Cash and security holdings": {
# "W01",
# "W31",
# "W61",
# "X21",
# "X30",
# "Z77",
# "Z78",
# "X42",
# "X44",
# "X47",
# "Y07",
# "Y08",
# "Y21",
# "Y61",
# },
# }
#
# sums_2005_2011 = {
# "Total revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# "T01",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# "A90",
# "A91",
# "A92",
# "A93",
# "A94",
# "X01",
# "X02",
# "X05",
# "X08",
# "Y01",
# "Y02",
# "Y04",
# "Y10",
# "Y11",
# "Y12",
# "Y50",
# "Y51",
# "Y52",
# },
# "General revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D94",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T01",
# "T50",
# "T51",
# "T53",
# "T99",
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# },
# "Intergovernmental revenue": {
# "B01",
# "B21",
# "B22",
# "B30",
# "B42",
# "B43",
# "B46",
# "B50",
# "B54",
# "B59",
# "B79",
# "B80",
# "B89",
# "B91",
# "B92",
# "B93",
# "B94",
# "D21",
# "D30",
# "D42",
# "D46",
# "D50",
# "D79",
# "D80",
# "D89",
# "D91",
# "D92",
# "D93",
# "D94",
# "S74",
# },
# "Taxes": {
# "T01",
# "T09",
# "T10",
# "T11",
# "T12",
# "T13",
# "T14",
# "T15",
# "T16",
# "T19",
# "T20",
# "T21",
# "T22",
# "T23",
# "T24",
# "T25",
# "T27",
# "T28",
# "T29",
# "T40",
# "T41",
# "T50",
# "T51",
# "T53",
# "T99",
# },
# "General sales": {"T09"},
# "Selective sales": {"T10", "T11", "T12", "T13", "T14", "T15", "T16", "T19"},
# "License taxes": {"T20", "T21", "T22", "T23", "T24", "T25", "T27", "T28", "T29"},
# "Individual income tax": {"T40"},
# "Corporate income tax": {"T41"},
# "Other taxes": {"T01", "T50", "T51", "T53", "T99"},
# "Current charge": {
# "A01",
# "A03",
# "A09",
# "A10",
# "A12",
# "A16",
# "A18",
# "A21",
# "A36",
# "A44",
# "A45",
# "A50",
# "A54",
# "A56",
# "A59",
# "A60",
# "A61",
# "A80",
# "A81",
# "A87",
# "A89",
# },
# "Miscellaneous general revenue": {
# "U01",
# "U11",
# "U20",
# "U21",
# "U30",
# "U40",
# "U41",
# "U50",
# "U95",
# "U99",
# },
# "Utility revenue": {"A91", "A92", "A93", "A94"},
# "Liquor stores revenue": {"A90"},
# "Insurance trust revenue": {
# "X01",
# "X02",
# "X05",
# "X08",
# "Y01",
# "Y02",
# "Y04",
# "Y10",
# "Y11",
# "Y12",
# "Y50",
# "Y51",
# "Y52",
# },
# "Total expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# "I89",
# "I91",
# "I92",
# "I93",
# "I94",
# "J19",
# "J67",
# "J68",
# "J85",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y15",
# "Y14",
# "Y53",
# "Y54",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S74",
# "S89",
# },
# "Intergovernmental expenditure": {
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S68",
# "S89",
# },
# "Direct expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# "J19",
# "J67",
# "J68",
# "J85",
# "I89",
# "I91",
# "I92",
# "I93",
# "I94",
# },
# "Current operation": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "E90",
# "E91",
# "E92",
# "E93",
# "E94",
# },
# "Capital outlay": {
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "F90",
# "F91",
# "F92",
# "F93",
# "F94",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "G90",
# "G91",
# "G92",
# "G93",
# "G94",
# },
# "Insurance benefits and repayments": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Assistance and subsidies": {"J19", "J67", "J68", "J85"},
# "Interest on debt": {"I89", "I91", "I92", "I93", "I94"},
# "Exhibit: Salaries and wages": {"Z00"},
# "General expenditure": {
# "M01",
# "M04",
# "M05",
# "M12",
# "M18",
# "M21",
# "M23",
# "M25",
# "M27",
# "M29",
# "M30",
# "M32",
# "M36",
# "M44",
# "M50",
# "M52",
# "M54",
# "M55",
# "M56",
# "M59",
# "M60",
# "M61",
# "M62",
# "M66",
# "M67",
# "M68",
# "M79",
# "M80",
# "M81",
# "M87",
# "M89",
# "M91",
# "M92",
# "M93",
# "M94",
# "Q12",
# "Q18",
# "S67",
# "S89",
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G24",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "I89",
# "J19",
# "J67",
# "J68",
# "J85",
# },
# "Direct general expenditure": {
# "E01",
# "E03",
# "E04",
# "E05",
# "E12",
# "E16",
# "E18",
# "E21",
# "E22",
# "E23",
# "E25",
# "E26",
# "E27",
# "E29",
# "E31",
# "E32",
# "E36",
# "E44",
# "E45",
# "E50",
# "E52",
# "E54",
# "E55",
# "E56",
# "E59",
# "E60",
# "E61",
# "E62",
# "E66",
# "E73",
# "E74",
# "E75",
# "E77",
# "E79",
# "E80",
# "E81",
# "E85",
# "E87",
# "E89",
# "F01",
# "F03",
# "F04",
# "F05",
# "F12",
# "F16",
# "F18",
# "F21",
# "F22",
# "F23",
# "F25",
# "F26",
# "F27",
# "F29",
# "F31",
# "F32",
# "F36",
# "F44",
# "F45",
# "F50",
# "F52",
# "F54",
# "F55",
# "F56",
# "F59",
# "F60",
# "F61",
# "F62",
# "F66",
# "F77",
# "F79",
# "F80",
# "F81",
# "F85",
# "F87",
# "F89",
# "G01",
# "G03",
# "G04",
# "G05",
# "G12",
# "G16",
# "G18",
# "G21",
# "G22",
# "G23",
# "G25",
# "G26",
# "G27",
# "G29",
# "G31",
# "G32",
# "G36",
# "G44",
# "G45",
# "G50",
# "G52",
# "G54",
# "G55",
# "G56",
# "G59",
# "G60",
# "G61",
# "G62",
# "G66",
# "G77",
# "G79",
# "G80",
# "G81",
# "G85",
# "G87",
# "G89",
# "I89",
# "J19",
# "J67",
# "J68",
# "J85",
# },
# "Education": {
# "E12",
# "F12",
# "G12",
# "M12",
# "Q12",
# "E16",
# "F16",
# "G16",
# "E18",
# "F18",
# "G18",
# "M18",
# "Q18",
# "J19",
# "E21",
# "F21",
# "G21",
# "M21",
# },
# "Public welfare": {
# "J67",
# "M67",
# "S67",
# "S74",
# "J68",
# "M68",
# "E73",
# "E74",
# "E75",
# "E77",
# "F77",
# "G77",
# "E79",
# "M79",
# "F79",
# "G79",
# },
# "Hospitals": {"E36", "F36", "G36", "M36"},
# "Health": {"E27", "E32", "F27", "F32", "G27", "G32", "M27", "M32"},
# # "Health": {"E32", "F32", "G32", "M32"},
# "Highways": {"E44", "M44", "F44", "G44", "E45", "F45", "G45"},
# "Police protection": {"E62", "F62", "G62", "M62"},
# "Correction": {"E04", "M04", "F04", "G04", "E05", "F05", "G05", "M05"},
# "Natural resources": {
# "E54",
# "E55",
# "M54",
# "M55",
# "E56",
# "M56",
# "E59",
# "M59",
# "F54",
# "F55",
# "F56",
# "F59",
# "G54",
# "G55",
# "G56",
# "G59",
# },
# "Parks and recreation": {"E61", "F61", "G61", "M61"},
# "Governmental administration": {
# "E23",
# "F23",
# "G23",
# "M23",
# "E25",
# "F25",
# "G25",
# "M25",
# "E26",
# "F26",
# "G26",
# "E29",
# "M29",
# "F29",
# "G29",
# "E31",
# "F31",
# "G31",
# },
# "Interest on general debt": {"I89"},
# "Other and unallocable": {
# "E01",
# "F01",
# "G01",
# "M01",
# "E03",
# "F03",
# "G03",
# "E22",
# "F22",
# "G22",
# "M30",
# "E50",
# "F50",
# "G50",
# "M50",
# "E52",
# "F52",
# "G52",
# "M52",
# "E66",
# "F66",
# "G66",
# "M66",
# "E80",
# "F80",
# "G80",
# "M80",
# "E81",
# "F81",
# "G81",
# "M81",
# "E85",
# "F85",
# "G85",
# "J85",
# "E87",
# "F87",
# "G87",
# "M87",
# "E89",
# "F89",
# "G89",
# "M89",
# "S89",
# "M91",
# "M92",
# "M93",
# "M94",
# },
# "Utility expenditure": {
# "E91",
# "F91",
# "G91",
# "I91",
# "E92",
# "F92",
# "G92",
# "I92",
# "E93",
# "F93",
# "G93",
# "I93",
# "E94",
# "F94",
# "G94",
# "I94",
# },
# "Liquor stores expenditure": {"E90", "F90", "G90"},
# "Insurance trust expenditure": {
# "X11",
# "X12",
# "Y05",
# "Y06",
# "Y14",
# "Y15",
# "Y53",
# "Y54",
# },
# "Debt at end of fiscal year": {"64V", "44T", "49U"},
# "Cash and security holdings": {
# "W01",
# "W31",
# "W61",
# "X21",
# "X30",
# "Z77",
# "Z78",
# "X42",
# "X44",
# "X47",
# "Y07",
# "Y08",
# "Y21",
# "Y61",
# },
# }
| sums_new_methodology = {'Total revenue': {'A01', 'A03', 'A09', 'A10', 'A12', 'A16', 'A18', 'A21', 'A36', 'A44', 'A45', 'A50', 'A54', 'A56', 'A59', 'A60', 'A61', 'A80', 'A81', 'A87', 'A89', 'A90', 'A91', 'A92', 'A93', 'A94', 'B01', 'B21', 'B22', 'B30', 'B42', 'B43', 'B46', 'B50', 'B54', 'B59', 'B79', 'B80', 'B89', 'B91', 'B92', 'B93', 'B94', 'D21', 'D30', 'D42', 'D46', 'D50', 'D79', 'D80', 'D89', 'D91', 'D92', 'D93', 'D94', 'T01', 'T09', 'T10', 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T19', 'T20', 'T21', 'T22', 'T23', 'T24', 'T25', 'T27', 'T28', 'T29', 'T40', 'T41', 'T50', 'T51', 'T53', 'T99', 'U01', 'U11', 'U20', 'U21', 'U30', 'U40', 'U41', 'U50', 'U95', 'U99', 'X01', 'X02', 'X05', 'X08', 'Y01', 'Y02', 'Y04', 'Y11', 'Y12', 'Y51', 'Y52'}, 'General revenue': {'A01', 'A03', 'A09', 'A10', 'A12', 'A16', 'A18', 'A21', 'A36', 'A44', 'A45', 'A50', 'A54', 'A56', 'A59', 'A60', 'A61', 'A80', 'A81', 'A87', 'A89', 'B01', 'B21', 'B22', 'B30', 'B42', 'B43', 'B46', 'B50', 'B54', 'B59', 'B79', 'B80', 'B89', 'B91', 'B92', 'B93', 'B94', 'D21', 'D30', 'D42', 'D46', 'D50', 'D79', 'D80', 'D89', 'D91', 'D92', 'D93', 'D94', 'T01', 'T09', 'T10', 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T19', 'T20', 'T21', 'T22', 'T23', 'T24', 'T25', 'T27', 'T28', 'T29', 'T40', 'T41', 'T50', 'T51', 'T53', 'T99', 'U01', 'U11', 'U20', 'U21', 'U30', 'U40', 'U41', 'U50', 'U95', 'U99'}, 'Intergovernmental revenue': {'B01', 'B21', 'B22', 'B30', 'B42', 'B43', 'B46', 'B50', 'B54', 'B59', 'B79', 'B80', 'B89', 'B91', 'B92', 'B93', 'B94', 'D21', 'D30', 'D42', 'D46', 'D50', 'D79', 'D80', 'D89', 'D91', 'D92', 'D93', 'D94'}, 'Taxes': {'T01', 'T09', 'T10', 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T19', 'T20', 'T21', 'T22', 'T23', 'T24', 'T25', 'T27', 'T28', 'T29', 'T40', 'T41', 'T50', 'T51', 'T53', 'T99'}, 'General sales': {'T09'}, 'Selective sales': {'T10', 'T11', 'T12', 'T13', 'T14', 'T15', 'T16', 'T19'}, 'License taxes': {'T20', 'T21', 'T22', 'T23', 'T24', 'T25', 'T27', 'T28', 'T29'}, 'Individual income tax': {'T40'}, 'Corporate income tax': {'T41'}, 'Other taxes': {'T01', 'T50', 'T51', 'T53', 'T99'}, 'Current charge': {'A01', 'A03', 'A09', 'A10', 'A12', 'A16', 'A18', 'A21', 'A36', 'A44', 'A45', 'A50', 'A54', 'A56', 'A59', 'A60', 'A61', 'A80', 'A81', 'A87', 'A89'}, 'Miscellaneous general revenue': {'U01', 'U11', 'U20', 'U21', 'U30', 'U40', 'U41', 'U50', 'U95', 'U99'}, 'Utility revenue': {'A91', 'A92', 'A93', 'A94'}, 'Liquor stores revenue': {'A90'}, 'Insurance trust revenue': {'X01', 'X02', 'X05', 'X08', 'Y01', 'Y02', 'Y04', 'Y11', 'Y12', 'Y50', 'Y51', 'Y52'}, 'Total expenditure': {'E01', 'E03', 'E04', 'E05', 'E12', 'E16', 'E18', 'E21', 'E22', 'E23', 'E25', 'E26', 'E27', 'E29', 'E31', 'E32', 'E36', 'E44', 'E45', 'E50', 'E52', 'E54', 'E55', 'E56', 'E59', 'E60', 'E61', 'E62', 'E66', 'E74', 'E75', 'E77', 'E79', 'E80', 'E81', 'E85', 'E87', 'E89', 'E90', 'E91', 'E92', 'E93', 'E94', 'F01', 'F03', 'F04', 'F05', 'F12', 'F16', 'F18', 'F21', 'F22', 'F23', 'F25', 'F26', 'F27', 'F29', 'F31', 'F32', 'F36', 'F44', 'F45', 'F50', 'F52', 'F54', 'F55', 'F56', 'F59', 'F60', 'F61', 'F62', 'F66', 'F77', 'F79', 'F80', 'F81', 'F85', 'F87', 'F89', 'F90', 'F91', 'F92', 'F93', 'F94', 'G01', 'G03', 'G04', 'G05', 'G12', 'G16', 'G18', 'G21', 'G22', 'G23', 'G25', 'G26', 'G27', 'G29', 'G31', 'G32', 'G36', 'G44', 'G45', 'G50', 'G52', 'G54', 'G55', 'G56', 'G59', 'G60', 'G61', 'G62', 'G66', 'G77', 'G79', 'G80', 'G81', 'G85', 'G87', 'G89', 'G90', 'G91', 'G92', 'G93', 'G94', 'I89', 'I91', 'I92', 'I93', 'I94', 'J19', 'J67', 'J68', 'J85', 'M01', 'M04', 'M05', 'M12', 'M18', 'M21', 'M23', 'M25', 'M27', 'M29', 'M30', 'M32', 'M36', 'M44', 'M50', 'M52', 'M54', 'M55', 'M56', 'M59', 'M60', 'M61', 'M62', 'M66', 'M67', 'M68', 'M79', 'M80', 'M81', 'M87', 'M89', 'M91', 'M92', 'M93', 'M94', 'Q12', 'Q18', 'S67', 'S89', 'X11', 'X12', 'Y05', 'Y06', 'Y14', 'Y53'}, 'Intergovernmental expenditure': {'M01', 'M04', 'M05', 'M12', 'M18', 'M21', 'M23', 'M25', 'M27', 'M29', 'M30', 'M32', 'M36', 'M44', 'M50', 'M52', 'M54', 'M55', 'M56', 'M59', 'M60', 'M61', 'M62', 'M66', 'M67', 'M68', 'M79', 'M80', 'M81', 'M87', 'M89', 'M91', 'M92', 'M93', 'M94', 'Q12', 'Q18', 'S67', 'S89'}, 'Direct expenditure': {'E01', 'E03', 'E04', 'E05', 'E12', 'E16', 'E18', 'E21', 'E22', 'E23', 'E25', 'E26', 'E27', 'E29', 'E31', 'E32', 'E36', 'E44', 'E45', 'E50', 'E52', 'E54', 'E55', 'E56', 'E59', 'E60', 'E61', 'E62', 'E66', 'E74', 'E75', 'E77', 'E79', 'E80', 'E81', 'E85', 'E87', 'E89', 'E90', 'E91', 'E92', 'E93', 'E94', 'F01', 'F03', 'F04', 'F05', 'F12', 'F16', 'F18', 'F21', 'F22', 'F23', 'F25', 'F26', 'F27', 'F29', 'F31', 'F32', 'F36', 'F44', 'F45', 'F50', 'F52', 'F54', 'F55', 'F56', 'F59', 'F60', 'F61', 'F62', 'F66', 'F77', 'F79', 'F80', 'F81', 'F85', 'F87', 'F89', 'F90', 'F91', 'F92', 'F93', 'F94', 'G01', 'G03', 'G04', 'G05', 'G12', 'G16', 'G18', 'G21', 'G22', 'G23', 'G25', 'G26', 'G27', 'G29', 'G31', 'G32', 'G36', 'G44', 'G45', 'G50', 'G52', 'G54', 'G55', 'G56', 'G59', 'G60', 'G61', 'G62', 'G66', 'G77', 'G79', 'G80', 'G81', 'G85', 'G87', 'G89', 'G90', 'G91', 'G92', 'G93', 'G94', 'I89', 'I91', 'I92', 'I93', 'I94', 'J19', 'J67', 'J68', 'J85', 'X11', 'X12', 'Y05', 'Y06', 'Y14', 'Y53'}, 'Current operation': {'E01', 'E03', 'E04', 'E05', 'E12', 'E16', 'E18', 'E21', 'E22', 'E23', 'E25', 'E26', 'E27', 'E29', 'E31', 'E32', 'E36', 'E44', 'E45', 'E50', 'E52', 'E54', 'E55', 'E56', 'E59', 'E60', 'E61', 'E62', 'E66', 'E74', 'E75', 'E77', 'E79', 'E80', 'E81', 'E85', 'E87', 'E89', 'E90', 'E91', 'E92', 'E93', 'E94'}, 'Capital outlay': {'F01', 'F03', 'F04', 'F05', 'F12', 'F16', 'F18', 'F21', 'F22', 'F23', 'F25', 'F26', 'F27', 'F29', 'F31', 'F32', 'F36', 'F44', 'F45', 'F50', 'F52', 'F54', 'F55', 'F56', 'F59', 'F60', 'F61', 'F62', 'F66', 'F77', 'F79', 'F80', 'F81', 'F85', 'F87', 'F89', 'F90', 'F91', 'F92', 'F93', 'F94', 'G01', 'G03', 'G04', 'G05', 'G12', 'G16', 'G18', 'G21', 'G22', 'G23', 'G25', 'G26', 'G27', 'G29', 'G31', 'G32', 'G36', 'G44', 'G45', 'G50', 'G52', 'G54', 'G55', 'G56', 'G59', 'G60', 'G61', 'G62', 'G66', 'G77', 'G79', 'G80', 'G81', 'G85', 'G87', 'G89', 'G90', 'G91', 'G92', 'G93', 'G94'}, 'Insurance benefits and repayments': {'X11', 'X12', 'Y05', 'Y06', 'Y14', 'Y53'}, 'Assistance and subsidies': {'J19', 'J67', 'J68', 'J85'}, 'Interest on debt': {'I89', 'I91', 'I92', 'I93', 'I94'}, 'Exhibit: Salaries and wages': {'Z00'}, 'General expenditure': {'E01', 'E03', 'E04', 'E05', 'E12', 'E16', 'E18', 'E21', 'E22', 'E23', 'E25', 'E26', 'E27', 'E29', 'E31', 'E32', 'E36', 'E44', 'E45', 'E50', 'E52', 'E54', 'E55', 'E56', 'E59', 'E60', 'E61', 'E62', 'E66', 'E74', 'E75', 'E77', 'E79', 'E80', 'E81', 'E85', 'E87', 'E89', 'F01', 'F03', 'F04', 'F05', 'F12', 'F16', 'F18', 'F21', 'F22', 'F23', 'F25', 'F26', 'F27', 'F29', 'F31', 'F32', 'F36', 'F44', 'F45', 'F50', 'F52', 'F54', 'F55', 'F56', 'F59', 'F60', 'F61', 'F62', 'F66', 'F77', 'F79', 'F80', 'F81', 'F85', 'F87', 'F89', 'G01', 'G03', 'G04', 'G05', 'G12', 'G16', 'G18', 'G21', 'G22', 'G23', 'G25', 'G26', 'G27', 'G29', 'G31', 'G32', 'G36', 'G44', 'G45', 'G50', 'G52', 'G54', 'G55', 'G56', 'G59', 'G60', 'G61', 'G62', 'G66', 'G77', 'G79', 'G80', 'G81', 'G85', 'G87', 'G89', 'I89', 'J19', 'J67', 'J68', 'J85', 'M01', 'M04', 'M05', 'M12', 'M18', 'M21', 'M23', 'M25', 'M27', 'M29', 'M30', 'M32', 'M36', 'M44', 'M50', 'M52', 'M54', 'M55', 'M56', 'M59', 'M60', 'M61', 'M62', 'M66', 'M67', 'M68', 'M79', 'M80', 'M81', 'M87', 'M89', 'M91', 'M92', 'M93', 'M94', 'Q12', 'Q18', 'S67', 'S89'}, 'Direct general expenditure': {'E01', 'E03', 'E04', 'E05', 'E12', 'E16', 'E18', 'E21', 'E22', 'E23', 'E25', 'E26', 'E27', 'E29', 'E31', 'E32', 'E36', 'E44', 'E45', 'E50', 'E52', 'E54', 'E55', 'E56', 'E59', 'E60', 'E61', 'E62', 'E66', 'E74', 'E75', 'E77', 'E79', 'E80', 'E81', 'E85', 'E87', 'E89', 'F01', 'F03', 'F04', 'F05', 'F12', 'F16', 'F18', 'F21', 'F22', 'F23', 'F25', 'F26', 'F27', 'F29', 'F31', 'F32', 'F36', 'F44', 'F45', 'F50', 'F52', 'F54', 'F55', 'F56', 'F59', 'F60', 'F61', 'F62', 'F66', 'F77', 'F79', 'F80', 'F81', 'F85', 'F87', 'F89', 'G01', 'G03', 'G04', 'G05', 'G12', 'G16', 'G18', 'G21', 'G22', 'G23', 'G25', 'G26', 'G27', 'G29', 'G31', 'G32', 'G36', 'G44', 'G45', 'G50', 'G52', 'G54', 'G55', 'G56', 'G59', 'G60', 'G61', 'G62', 'G66', 'G77', 'G79', 'G80', 'G81', 'G85', 'G87', 'G89', 'I89', 'J19', 'J67', 'J68', 'J85'}, 'Education': {'E12', 'E16', 'E18', 'E21', 'F12', 'F16', 'F18', 'F21', 'G12', 'G16', 'G18', 'G21', 'J19', 'M12', 'M18', 'M21', 'Q12', 'Q18'}, 'Public welfare': {'E74', 'E75', 'E77', 'E79', 'F77', 'F79', 'G77', 'G79', 'J67', 'J68', 'M67', 'M68', 'M79', 'S67'}, 'Hospitals': {'E36', 'F36', 'G36', 'M36'}, 'Health': {'E32', 'F32', 'G32', 'M32'}, 'Highways': {'E44', 'M44', 'F44', 'G44', 'E45', 'F45', 'G45'}, 'Police protection': {'E62', 'F62', 'G62', 'M62'}, 'Correction': {'E04', 'E05', 'F04', 'F05', 'G04', 'G05', 'M04', 'M05'}, 'Natural resources': {'E54', 'E55', 'E56', 'E59', 'F54', 'F55', 'F56', 'F59', 'G54', 'G55', 'G56', 'G59', 'M54', 'M55', 'M56', 'M59'}, 'Parks and recreation': {'E61', 'F61', 'G61', 'M61'}, 'Governmental administration': {'E23', 'E25', 'E26', 'E29', 'E31', 'F23', 'F25', 'F26', 'F29', 'F31', 'G23', 'G25', 'G26', 'G29', 'G31', 'M23', 'M25', 'M29'}, 'Interest on general debt': {'I89'}, 'Other and unallocable': {'E01', 'E03', 'E22', 'E50', 'E52', 'E60', 'E66', 'E80', 'E81', 'E85', 'E87', 'E89', 'F01', 'F03', 'F22', 'F50', 'F52', 'F60', 'F66', 'F80', 'F81', 'F85', 'F87', 'F89', 'G01', 'G03', 'G22', 'G50', 'G52', 'G60', 'G66', 'G80', 'G81', 'G85', 'G87', 'G89', 'M01', 'M50', 'M52', 'M60', 'M66', 'M80', 'M81', 'M87', 'M89', 'S89'}, 'Utility expenditure': {'E91', 'E92', 'E93', 'E94', 'F91', 'F92', 'F93', 'F94', 'G91', 'G92', 'G93', 'G94', 'I91', 'I92', 'I93', 'I94', 'M91', 'M92', 'M93', 'M94'}, 'Liquor stores expenditure': {'E90', 'F90', 'G90'}, 'Insurance trust expenditure': {'X11', 'X12', 'Y05', 'Y06', 'Y14', 'Y53'}, 'Debt at end of fiscal year': {'64V', '44T', '49U'}, 'Cash and security holdings': {'W01', 'W31', 'W61', 'X21', 'X30', 'X42', 'X44', 'X47', 'Y07', 'Y08', 'Y21', 'Y61', 'Z77', 'Z78'}} |
class Solution:
def solve(self, nums, k):
nums = [0]+nums
for i in range(1,len(nums)):
nums[i] += nums[i-1]
sums = [[nums[i] - x for x in sorted(nums[:i])[:k]] for i in range(1,len(nums))]
return sorted(sum(sums,[]))[-k:]
| class Solution:
def solve(self, nums, k):
nums = [0] + nums
for i in range(1, len(nums)):
nums[i] += nums[i - 1]
sums = [[nums[i] - x for x in sorted(nums[:i])[:k]] for i in range(1, len(nums))]
return sorted(sum(sums, []))[-k:] |
class MyParser:
def __init__(self, text_1, text_2):
self.text_1 = text_1
self.text_2 = text_2
def parse_text(self, text):
stack = []
for char in text:
if char != '#':
stack.append(char)
else:
if len(stack) > 0:
stack.pop()
return ''.join(stack)
def check_if_equal(self):
return self.parse_text(self.text_1) == self.parse_text(self.text_2)
| class Myparser:
def __init__(self, text_1, text_2):
self.text_1 = text_1
self.text_2 = text_2
def parse_text(self, text):
stack = []
for char in text:
if char != '#':
stack.append(char)
elif len(stack) > 0:
stack.pop()
return ''.join(stack)
def check_if_equal(self):
return self.parse_text(self.text_1) == self.parse_text(self.text_2) |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Loads dependencies needed to compile Sandboxed API for 3rd-party consumers."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//sandboxed_api/bazel:repositories.bzl", "autotools_repository")
def sapi_deps():
"""Loads common dependencies needed to compile Sandboxed API."""
# Bazel Skylib, needed by newer Protobuf builds
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "154f4063d96a4e47b17a917108eaabdfeb4ef08383795cf936b3be6f8179c9fc", # 2020-04-15
strip_prefix = "bazel-skylib-560d7b2359aecb066d81041cb532b82d7354561b",
url = "https://github.com/bazelbuild/bazel-skylib/archive/560d7b2359aecb066d81041cb532b82d7354561b.zip",
)
# Abseil
maybe(
http_archive,
name = "com_google_absl",
sha256 = "e140988c4d3c22f829a3095f0d34a0783aa2f8829556283f10b8eb63a9428b19", # 2021-02-19
strip_prefix = "abseil-cpp-b315753c0b8b4aa4e3e1479375eddb518393bab6",
urls = ["https://github.com/abseil/abseil-cpp/archive/b315753c0b8b4aa4e3e1479375eddb518393bab6.zip"],
)
maybe(
http_archive,
name = "com_google_absl_py",
sha256 = "6ace3cd8921804aaabc37970590edce05c6664901cc98d30010d09f2811dc56f", # 2019-10-25
strip_prefix = "abseil-py-06edd9c20592cec39178b94240b5e86f32e19768",
urls = ["https://github.com/abseil/abseil-py/archive/06edd9c20592cec39178b94240b5e86f32e19768.zip"],
)
# Abseil-py dependency for Python 2/3 compatiblity
maybe(
http_archive,
name = "six_archive",
build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/six.BUILD",
sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73", # 2018-12-10
strip_prefix = "six-1.12.0",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz",
],
)
# gflags
# TODO(cblichmann): Use Abseil flags once logging is in Abseil
maybe(
http_archive,
name = "com_github_gflags_gflags",
sha256 = "97312c67e5e0ad7fe02446ee124629ca7890727469b00c9a4bf45da2f9b80d32", # 2019-11-13
strip_prefix = "gflags-addd749114fab4f24b7ea1e0f2f837584389e52c",
urls = ["https://github.com/gflags/gflags/archive/addd749114fab4f24b7ea1e0f2f837584389e52c.zip"],
)
# Google logging
# TODO(cblichmann): Remove dependency once logging is in Abseil
maybe(
http_archive,
name = "com_google_glog",
sha256 = "feca3c7e29a693cab7887409756d89d342d4a992d54d7c5599bebeae8f7b50be", # 2020-02-16
strip_prefix = "glog-3ba8976592274bc1f907c402ce22558011d6fc5e",
urls = ["https://github.com/google/glog/archive/3ba8976592274bc1f907c402ce22558011d6fc5e.zip"],
)
# Protobuf
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "bf0e5070b4b99240183b29df78155eee335885e53a8af8683964579c214ad301", # 2020-11-14
strip_prefix = "protobuf-3.14.0",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.14.0.zip"],
)
# libcap
http_archive(
name = "org_kernel_libcap",
build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libcap.BUILD",
sha256 = "260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8", # 2019-04-16
strip_prefix = "libcap-2.27",
urls = ["https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz"],
)
# libffi
autotools_repository(
name = "org_sourceware_libffi",
build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libffi.BUILD",
sha256 = "653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263", # 2019-11-02
strip_prefix = "libffi-3.3-rc2",
urls = ["https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz"],
)
# libunwind
autotools_repository(
name = "org_gnu_libunwind",
build_file = "@com_google_sandboxed_api//sandboxed_api:bazel/external/libunwind.BUILD",
configure_args = [
"--disable-documentation",
"--disable-minidebuginfo",
"--disable-shared",
"--enable-ptrace",
],
sha256 = "3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb", # 2017-06-15
strip_prefix = "libunwind-1.2.1",
urls = ["https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz"],
)
| """Loads dependencies needed to compile Sandboxed API for 3rd-party consumers."""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('//sandboxed_api/bazel:repositories.bzl', 'autotools_repository')
def sapi_deps():
"""Loads common dependencies needed to compile Sandboxed API."""
maybe(http_archive, name='bazel_skylib', sha256='154f4063d96a4e47b17a917108eaabdfeb4ef08383795cf936b3be6f8179c9fc', strip_prefix='bazel-skylib-560d7b2359aecb066d81041cb532b82d7354561b', url='https://github.com/bazelbuild/bazel-skylib/archive/560d7b2359aecb066d81041cb532b82d7354561b.zip')
maybe(http_archive, name='com_google_absl', sha256='e140988c4d3c22f829a3095f0d34a0783aa2f8829556283f10b8eb63a9428b19', strip_prefix='abseil-cpp-b315753c0b8b4aa4e3e1479375eddb518393bab6', urls=['https://github.com/abseil/abseil-cpp/archive/b315753c0b8b4aa4e3e1479375eddb518393bab6.zip'])
maybe(http_archive, name='com_google_absl_py', sha256='6ace3cd8921804aaabc37970590edce05c6664901cc98d30010d09f2811dc56f', strip_prefix='abseil-py-06edd9c20592cec39178b94240b5e86f32e19768', urls=['https://github.com/abseil/abseil-py/archive/06edd9c20592cec39178b94240b5e86f32e19768.zip'])
maybe(http_archive, name='six_archive', build_file='@com_google_sandboxed_api//sandboxed_api:bazel/external/six.BUILD', sha256='d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73', strip_prefix='six-1.12.0', urls=['https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz', 'https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz'])
maybe(http_archive, name='com_github_gflags_gflags', sha256='97312c67e5e0ad7fe02446ee124629ca7890727469b00c9a4bf45da2f9b80d32', strip_prefix='gflags-addd749114fab4f24b7ea1e0f2f837584389e52c', urls=['https://github.com/gflags/gflags/archive/addd749114fab4f24b7ea1e0f2f837584389e52c.zip'])
maybe(http_archive, name='com_google_glog', sha256='feca3c7e29a693cab7887409756d89d342d4a992d54d7c5599bebeae8f7b50be', strip_prefix='glog-3ba8976592274bc1f907c402ce22558011d6fc5e', urls=['https://github.com/google/glog/archive/3ba8976592274bc1f907c402ce22558011d6fc5e.zip'])
maybe(http_archive, name='com_google_protobuf', sha256='bf0e5070b4b99240183b29df78155eee335885e53a8af8683964579c214ad301', strip_prefix='protobuf-3.14.0', urls=['https://github.com/protocolbuffers/protobuf/archive/v3.14.0.zip'])
http_archive(name='org_kernel_libcap', build_file='@com_google_sandboxed_api//sandboxed_api:bazel/external/libcap.BUILD', sha256='260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8', strip_prefix='libcap-2.27', urls=['https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz'])
autotools_repository(name='org_sourceware_libffi', build_file='@com_google_sandboxed_api//sandboxed_api:bazel/external/libffi.BUILD', sha256='653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263', strip_prefix='libffi-3.3-rc2', urls=['https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz'])
autotools_repository(name='org_gnu_libunwind', build_file='@com_google_sandboxed_api//sandboxed_api:bazel/external/libunwind.BUILD', configure_args=['--disable-documentation', '--disable-minidebuginfo', '--disable-shared', '--enable-ptrace'], sha256='3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb', strip_prefix='libunwind-1.2.1', urls=['https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz']) |
class Solution:
# 1, 2, 3, 4, 5
# n = 5
# Rotate - k = 2 - Left - 4, 5, 1, 2, 3
# Rotate - k = 3 (n - 2) - Right - 4, 5, 1, 2, 3
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
n = len(nums)
if (n == 1 or k == 0 or n == k):
return
k = k % n
g_c_d = self.gcd(n, k)
for idx in range(g_c_d):
jdx = idx
prev = nums[jdx]
while True:
# kdx points to the element under consideration
kdx = (jdx + k) % n
# Swapping the previous element with the current element
prev, nums[kdx] = nums[kdx], prev
jdx = kdx
if jdx == idx:
break
def gcd(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
if (m % n == 0):
return n
else:
return self.gcd(n, m % n)
def rotate2(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
k = k % len(nums)
nums[:] = nums[-k:] + nums[:-k]
def rotate_like_gcd_but_better(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
n = len(nums)
k %= n
start = count = 0
while count < n:
current, prev = start, nums[start]
while True:
next_idx = (current + k) % n
nums[next_idx], prev = prev, nums[next_idx]
current = next_idx
count += 1
if start == current:
break
start += 1
nums = [1, 2, 3, 4, 5, 6, 7]
Solution().rotate(nums, 3)
print (nums) | class Solution:
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
n = len(nums)
if n == 1 or k == 0 or n == k:
return
k = k % n
g_c_d = self.gcd(n, k)
for idx in range(g_c_d):
jdx = idx
prev = nums[jdx]
while True:
kdx = (jdx + k) % n
(prev, nums[kdx]) = (nums[kdx], prev)
jdx = kdx
if jdx == idx:
break
def gcd(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
if m % n == 0:
return n
else:
return self.gcd(n, m % n)
def rotate2(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
k = k % len(nums)
nums[:] = nums[-k:] + nums[:-k]
def rotate_like_gcd_but_better(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void
"""
n = len(nums)
k %= n
start = count = 0
while count < n:
(current, prev) = (start, nums[start])
while True:
next_idx = (current + k) % n
(nums[next_idx], prev) = (prev, nums[next_idx])
current = next_idx
count += 1
if start == current:
break
start += 1
nums = [1, 2, 3, 4, 5, 6, 7]
solution().rotate(nums, 3)
print(nums) |
#!/usr/bin/python3
# Both the Minimax and the Alpha-beta algorithm represent the players
# as integers 0 and 1. The moves by the two players alternate 0, 1, 0, 1, ...,
# so in the recursive calls you can compute the next player as the subtraction
# 1-player.
# The minimizing player is always 0 and the maximizing 1.
# The number of recursive calls to the algorithms is kept track with
# the variable 'calls'. Let your implementation increase this variable
# by one in the beginning of each recursive call. This variable is
# also used as part of the evaluation of the implementations.
calls = 0
def minimax(player, state, depthLeft):
"""
Perform recursive min-max search of a game tree rooted in `state`.
Returns the best value in the min-max sense starting from `state` for `player`
using at most `depthLeft` recursive calls.
Gives value of state if depthLeft = 0 or the state has no further actions
(a leaf in the game-tree).
Parameters
----------
player : int in {0,1}
0 is the minimizing player, and 1 maximizing.
state : Object representing game state.
See `gameexamples.py` for examples.
depthLeft : int >= 0
Maximum number of recursive levels to perform, including this this call to
minmax.
Returns
-------
float
Best value.
"""
global calls
calls += 1
if depthLeft == 0:
return state.value()
actions = state.applicableActions(player)
if not actions:
return state.value()
player2 = 1 - player
best = float('inf') if player == 0 else - float('inf')
for action in actions:
state2 = state.successor(player, action)
v = minimax(player2, state2, depthLeft - 1)
if player == 0:
best = min(best, v)
else:
best = max(best, v)
return best
def alphabeta(player, state, depthLeft, alpha, beta):
"""
Perform recursive alpha/beta search of game tree rooted in `state`.
Returns the best value in the alpha/beta sense starting from `state` for `player`
using at most `depthLeft` recursive calls.
Gives value of state if depthLeft = 0 or the state has no further actions
(a leaf in the game-tree).
Parameters
----------
player : int in {0,1}
0 is the minimizing player, and 1 maximizing.
state : Object representing game state.
See `gameexamples.py` for examples.
depthLeft : int >= 0
Maximum number of recursive levels to perform, including this call to
alphabeta.
alpha : float
Current alpha cut value.
beta : float
Current beta cut value.
Returns
-------
float
Best value.
"""
global calls
calls += 1
if depthLeft == 0:
return state.value()
actions = state.applicableActions(player)
if not actions:
return state.value()
player2 = 1 - player
best = float('inf') if player == 0 else - float('inf')
for action in actions:
state2 = state.successor(player, action)
v = alphabeta(player2, state2, depthLeft - 1, alpha, beta)
if player == 0:
best = min(best, v)
beta = min(beta, v)
else:
best = max(best, v)
alpha = max(alpha, v)
if alpha >= beta:
break
return best
def gamevalue(startingstate, depth):
global calls
calls = 0
v = minimax(0, startingstate, depth)
print(str(v) + " value with " + str(calls) + " calls with minimax to depth " + str(depth))
calls = 0
v = alphabeta(0, startingstate, depth, 0 - float("inf"), float("inf"))
print(str(v) + " value with " + str(calls) + " calls with alphabeta to depth " + str(depth))
calls = 0
| calls = 0
def minimax(player, state, depthLeft):
"""
Perform recursive min-max search of a game tree rooted in `state`.
Returns the best value in the min-max sense starting from `state` for `player`
using at most `depthLeft` recursive calls.
Gives value of state if depthLeft = 0 or the state has no further actions
(a leaf in the game-tree).
Parameters
----------
player : int in {0,1}
0 is the minimizing player, and 1 maximizing.
state : Object representing game state.
See `gameexamples.py` for examples.
depthLeft : int >= 0
Maximum number of recursive levels to perform, including this this call to
minmax.
Returns
-------
float
Best value.
"""
global calls
calls += 1
if depthLeft == 0:
return state.value()
actions = state.applicableActions(player)
if not actions:
return state.value()
player2 = 1 - player
best = float('inf') if player == 0 else -float('inf')
for action in actions:
state2 = state.successor(player, action)
v = minimax(player2, state2, depthLeft - 1)
if player == 0:
best = min(best, v)
else:
best = max(best, v)
return best
def alphabeta(player, state, depthLeft, alpha, beta):
"""
Perform recursive alpha/beta search of game tree rooted in `state`.
Returns the best value in the alpha/beta sense starting from `state` for `player`
using at most `depthLeft` recursive calls.
Gives value of state if depthLeft = 0 or the state has no further actions
(a leaf in the game-tree).
Parameters
----------
player : int in {0,1}
0 is the minimizing player, and 1 maximizing.
state : Object representing game state.
See `gameexamples.py` for examples.
depthLeft : int >= 0
Maximum number of recursive levels to perform, including this call to
alphabeta.
alpha : float
Current alpha cut value.
beta : float
Current beta cut value.
Returns
-------
float
Best value.
"""
global calls
calls += 1
if depthLeft == 0:
return state.value()
actions = state.applicableActions(player)
if not actions:
return state.value()
player2 = 1 - player
best = float('inf') if player == 0 else -float('inf')
for action in actions:
state2 = state.successor(player, action)
v = alphabeta(player2, state2, depthLeft - 1, alpha, beta)
if player == 0:
best = min(best, v)
beta = min(beta, v)
else:
best = max(best, v)
alpha = max(alpha, v)
if alpha >= beta:
break
return best
def gamevalue(startingstate, depth):
global calls
calls = 0
v = minimax(0, startingstate, depth)
print(str(v) + ' value with ' + str(calls) + ' calls with minimax to depth ' + str(depth))
calls = 0
v = alphabeta(0, startingstate, depth, 0 - float('inf'), float('inf'))
print(str(v) + ' value with ' + str(calls) + ' calls with alphabeta to depth ' + str(depth))
calls = 0 |
if __name__ == '__main__':
n = int(input())
arr =list(map(int, input().split(" ")))
i = max(arr)
for i in range(0,n):
if max(arr) == i:
arr.remove(max(arr))
arr.sort(reverse=True)
print(arr[0])
| if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split(' ')))
i = max(arr)
for i in range(0, n):
if max(arr) == i:
arr.remove(max(arr))
arr.sort(reverse=True)
print(arr[0]) |
n=int(input())
p=[[int(i)for i in input().split()] for _ in range(n)]
p.sort(key=lambda x: x[2])
a,b,c=p[-1]
for y in range(101):
for x in range(101):
h=c+abs(a-x)+abs(b-y)
if all(k==max(h-abs(i-x)-abs(y-j),0) for i,j,k in p):
print(x,y,h)
exit() | n = int(input())
p = [[int(i) for i in input().split()] for _ in range(n)]
p.sort(key=lambda x: x[2])
(a, b, c) = p[-1]
for y in range(101):
for x in range(101):
h = c + abs(a - x) + abs(b - y)
if all((k == max(h - abs(i - x) - abs(y - j), 0) for (i, j, k) in p)):
print(x, y, h)
exit() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.