content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
'''
Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode).
For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one
that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first).
If there is no mode return -1. The array will not be empty.
'''
def SimpleMode(arr):
# dictionary that will store values from input array
counter = {}
# loop to count occurences of numbers in array
for i in range(len(arr)):
nr = arr[i]
if nr in counter:
counter[nr] += 1
else:
counter[nr] = 1
# dictionary that will store mode of input array
ans = {"number": '', "count": 1}
# loop through counter dictionary to find first mode of input array
for x in counter:
if (counter[x] > ans["count"]):
ans["count"] = counter[x]
ans["number"] = x
# if there are no duplicates return -1, else return first mode that appeard in input array
if ans["count"] == 1:
return -1
else:
return ans["number"]
test = [2,5,10,10,6,5]
print(SimpleMode(test)) | """
Have the function SimpleMode(arr) take the array of numbers stored in arr and return the number that appears most frequently (the mode).
For example: if arr contains [10, 4, 5, 2, 4] the output should be 4. If there is more than one mode return the one
that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first).
If there is no mode return -1. The array will not be empty.
"""
def simple_mode(arr):
counter = {}
for i in range(len(arr)):
nr = arr[i]
if nr in counter:
counter[nr] += 1
else:
counter[nr] = 1
ans = {'number': '', 'count': 1}
for x in counter:
if counter[x] > ans['count']:
ans['count'] = counter[x]
ans['number'] = x
if ans['count'] == 1:
return -1
else:
return ans['number']
test = [2, 5, 10, 10, 6, 5]
print(simple_mode(test)) |
class Solution:
"""
@param nums: A list of integers
@param k: An integer
@return: The median of the element inside the window at each moving
"""
def medianSlidingWindow(self, nums, k):
# write your code here
pass
| class Solution:
"""
@param nums: A list of integers
@param k: An integer
@return: The median of the element inside the window at each moving
"""
def median_sliding_window(self, nums, k):
pass |
class Pipe(object):
def __init__(self, *args):
self.functions = args
self.state = {'error': '', 'result': None}
def __call__(self, value):
if not value:
raise "Not any value for running"
self.state['result'] = self.data_pipe(value)
return self.state
def _bind(self, value, function):
try:
if value:
return function(value)
else:
return None
except Exception as e:
self.state['error'] = e
def data_pipe(self, value):
c_value = value
for function in self.functions:
c_value = self._bind(c_value, function)
return c_value
| class Pipe(object):
def __init__(self, *args):
self.functions = args
self.state = {'error': '', 'result': None}
def __call__(self, value):
if not value:
raise 'Not any value for running'
self.state['result'] = self.data_pipe(value)
return self.state
def _bind(self, value, function):
try:
if value:
return function(value)
else:
return None
except Exception as e:
self.state['error'] = e
def data_pipe(self, value):
c_value = value
for function in self.functions:
c_value = self._bind(c_value, function)
return c_value |
#code
class Node :
def __init__(self,data):
self.data = data
self.next = None
class LinkedList :
def __init__(self):
self.head = None
def Push(self,new_data):
if(self.head== None):
self.head = Node(new_data)
else:
new_node = Node(new_data)
new_node.next = None
temp = self.head
while temp.next:
temp = temp.next
temp.next = new_node
def PrintList(self):
temp = self.head
while temp:
print(temp.data,end=" ")
temp = temp.next
print('')
def DeleteLinkedList(self):
temp = self.head
while(temp):
next = temp.next
del temp.data
temp = next
print("Linked list deleted")
if __name__ == '__main__':
t = int(input())
for i in range(t):
list1 = LinkedList()
n = int(input()) #5
values = list(map(int, input().strip().split())) # 8 2 3 1 7
for i in values:
list1.Push(i)
k = int(input()) #any works for all
list1.PrintList()
list1.DeleteLinkedList()
| class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def push(self, new_data):
if self.head == None:
self.head = node(new_data)
else:
new_node = node(new_data)
new_node.next = None
temp = self.head
while temp.next:
temp = temp.next
temp.next = new_node
def print_list(self):
temp = self.head
while temp:
print(temp.data, end=' ')
temp = temp.next
print('')
def delete_linked_list(self):
temp = self.head
while temp:
next = temp.next
del temp.data
temp = next
print('Linked list deleted')
if __name__ == '__main__':
t = int(input())
for i in range(t):
list1 = linked_list()
n = int(input())
values = list(map(int, input().strip().split()))
for i in values:
list1.Push(i)
k = int(input())
list1.PrintList()
list1.DeleteLinkedList() |
NONE = 0
HALT = 1 << 0
FAULT = 1 << 1
BREAK = 1 << 2
| none = 0
halt = 1 << 0
fault = 1 << 1
break = 1 << 2 |
"""
check if 2 strings are anagrams
"""
def anagrams(string1, string2):
if sorted(string1) == sorted(string2):
return True
else:
return False
| """
check if 2 strings are anagrams
"""
def anagrams(string1, string2):
if sorted(string1) == sorted(string2):
return True
else:
return False |
# Pascal's Triangle
# @author unobatbayar
# Input website link and download to a directory
# @author unobatbayar just for comments not whole code this time
# @program 10
# date 27-10-2018
print("Welcome to Pascal's Triangle!" + "\n")
row = int(input('Please input a row number to which you want to see the triangle to' + '\n'))
a=[]
for i in range(row):
a.append([])
a[i].append(1) #append(object) - Updates the list by adding an object to the list. append(): It is basically used in Python to add one element. #basically the 1's surrounding the triangle
for j in range(1,i):
a[i].append(a[i-1][j-1]+a[i-1][j]) #add what's in the headspace
if(row!=0):
a[i].append(1) #add another value if row doesn't equal to 0
for i in range(row):
print(" "*(row-i),end=" ",sep=" ")
for j in range(0,i+1):
print('{0:6}'.format(a[i][j]),end=" ",sep=" ")
print()
## REFERENCE:
# Thanks to Sanfoundry for providing the main code, I initially tried to create it
# on my own, however, my code was bad and wasn't working quite right.
# link to the website: https://www.sanfoundry.com/python-program-print-pascal-triangle/
| print("Welcome to Pascal's Triangle!" + '\n')
row = int(input('Please input a row number to which you want to see the triangle to' + '\n'))
a = []
for i in range(row):
a.append([])
a[i].append(1)
for j in range(1, i):
a[i].append(a[i - 1][j - 1] + a[i - 1][j])
if row != 0:
a[i].append(1)
for i in range(row):
print(' ' * (row - i), end=' ', sep=' ')
for j in range(0, i + 1):
print('{0:6}'.format(a[i][j]), end=' ', sep=' ')
print() |
class StorageDriverError(Exception):
pass
class ObjectDoesNotExistError(StorageDriverError):
def __init__(self, driver, bucket, object_name):
super().__init__(
f"Bucket {bucket} does not contain {object_name} (driver={driver})"
)
class AssetsManagerError(Exception):
pass
class AssetAlreadyExistsError(AssetsManagerError):
def __init__(self, name):
super().__init__(f"Asset {name} already exists, you should update it.")
class AssetDoesNotExistError(AssetsManagerError):
def __init__(self, name):
super().__init__(
f"Asset {name} does not exist" "Use `push_new_asset` to create it."
)
class AssetMajorVersionDoesNotExistError(AssetsManagerError):
def __init__(self, name, major):
super().__init__(
f"Asset major version `{major}` for `{name}` does not exist."
"Use `push_new_asset` to push a new major version of an asset."
)
class InvalidAssetSpecError(AssetsManagerError):
def __init__(self, spec):
super().__init__(f"Invalid asset spec `{spec}`")
class InvalidVersionError(InvalidAssetSpecError):
def __init__(self, version):
super().__init__(f"Asset version `{version}` is not valid.")
class InvalidNameError(InvalidAssetSpecError):
def __init__(self, name):
super().__init__(f"Asset name `{name}` is not valid.")
class LocalAssetDoesNotExistError(AssetsManagerError):
def __init__(self, name, version, local_versions):
super().__init__(
f"Asset version `{version}` for `{name}` does not exist locally. "
f"Available asset versions: " + ", ".join(local_versions)
)
class UnknownAssetsVersioningSystemError(AssetsManagerError):
pass
| class Storagedrivererror(Exception):
pass
class Objectdoesnotexisterror(StorageDriverError):
def __init__(self, driver, bucket, object_name):
super().__init__(f'Bucket {bucket} does not contain {object_name} (driver={driver})')
class Assetsmanagererror(Exception):
pass
class Assetalreadyexistserror(AssetsManagerError):
def __init__(self, name):
super().__init__(f'Asset {name} already exists, you should update it.')
class Assetdoesnotexisterror(AssetsManagerError):
def __init__(self, name):
super().__init__(f'Asset {name} does not existUse `push_new_asset` to create it.')
class Assetmajorversiondoesnotexisterror(AssetsManagerError):
def __init__(self, name, major):
super().__init__(f'Asset major version `{major}` for `{name}` does not exist.Use `push_new_asset` to push a new major version of an asset.')
class Invalidassetspecerror(AssetsManagerError):
def __init__(self, spec):
super().__init__(f'Invalid asset spec `{spec}`')
class Invalidversionerror(InvalidAssetSpecError):
def __init__(self, version):
super().__init__(f'Asset version `{version}` is not valid.')
class Invalidnameerror(InvalidAssetSpecError):
def __init__(self, name):
super().__init__(f'Asset name `{name}` is not valid.')
class Localassetdoesnotexisterror(AssetsManagerError):
def __init__(self, name, version, local_versions):
super().__init__(f'Asset version `{version}` for `{name}` does not exist locally. Available asset versions: ' + ', '.join(local_versions))
class Unknownassetsversioningsystemerror(AssetsManagerError):
pass |
class Solution:
def maximizeSweetness(self, sweetness: List[int], K: int) -> int:
low, high = 1, sum(sweetness) // (K + 1)
while low < high:
mid = (low + high + 1) // 2
count = curr = 0
for s in sweetness:
curr += s
if curr >= mid:
count += 1
if count >= K + 1:
break
curr = 0
if count >= K + 1:
low = mid
else:
high = mid - 1
return low
| class Solution:
def maximize_sweetness(self, sweetness: List[int], K: int) -> int:
(low, high) = (1, sum(sweetness) // (K + 1))
while low < high:
mid = (low + high + 1) // 2
count = curr = 0
for s in sweetness:
curr += s
if curr >= mid:
count += 1
if count >= K + 1:
break
curr = 0
if count >= K + 1:
low = mid
else:
high = mid - 1
return low |
"""
good explanation from discussion
my solution is like this: using two pointers, one of them one step at a time.
Another pointer each take two steps. Suppose the first meet at step k,the length of the Cycle is r. so..2k-k=nr,k=nr
Now, the distance between the start node of list and the start node of cycle is s.
The distance between the start of list and the first meeting node is k(the pointer which wake one step at a time waked k steps).
Distance between the start node of cycle and the first meeting node is m, so...s=k-m,
s=nr-m=(n-1)r+(r-m),here we takes n = 1..so, using one pointer start from the start node of list,
another pointer start from the first meeting node, all of them wake one step at a time,
the first time they meeting each other is the start of the cycle.
"""
#
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def detectCycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
slow = fast = head
while fast:
slow = slow.next
fast = fast.next
if not fast:
return None
fast = fast.next
if slow == fast:
slow = head
while slow != fast:
slow = slow.next
fast = fast.next
return slow
return None
| """
good explanation from discussion
my solution is like this: using two pointers, one of them one step at a time.
Another pointer each take two steps. Suppose the first meet at step k,the length of the Cycle is r. so..2k-k=nr,k=nr
Now, the distance between the start node of list and the start node of cycle is s.
The distance between the start of list and the first meeting node is k(the pointer which wake one step at a time waked k steps).
Distance between the start node of cycle and the first meeting node is m, so...s=k-m,
s=nr-m=(n-1)r+(r-m),here we takes n = 1..so, using one pointer start from the start node of list,
another pointer start from the first meeting node, all of them wake one step at a time,
the first time they meeting each other is the start of the cycle.
"""
class Solution(object):
def detect_cycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
slow = fast = head
while fast:
slow = slow.next
fast = fast.next
if not fast:
return None
fast = fast.next
if slow == fast:
slow = head
while slow != fast:
slow = slow.next
fast = fast.next
return slow
return None |
taggable_resources = [
# API Gateway
"aws_api_gateway_stage",
# ACM
"aws_acm_certificate",
"aws_acmpca_certificate_authority",
# CloudFront
"aws_cloudfront_distribution",
# CloudTrail
"aws_cloudtrail",
# AppSync
"aws_appsync_graphql_api",
# Backup
"aws_backup_plan",
"aws_backup_vault",
# CloudFormation
"aws_cloudformation_stack",
"aws_cloudformation_stack_set",
# Batch Compute
"aws_batch_compute_environment",
# CloudWatch
"aws_cloudwatch_metric_alarm"
"aws_cloudwatch_event_rule",
"aws_cloudwatch_log_group",
# CodeBuild
"aws_codebuild_project",
# CloudHSM
"aws_cloudhsm_v2_cluster",
# Cognito
"aws_cognito_identity_pool",
"aws_cognito_user_pool",
# DirectoryServer
"aws_directory_service_directory",
# DirectConnect
"aws_dx_connection",
"aws_dx_lag",
# IAM
"aws_iam_user",
"aws_iam_role",
# AWS Config
"aws_config_config_rule",
# AWS Database Migration Service
"aws_dms_certificate",
"aws_dms_endpoint",
"aws_dms_replication_instance",
"aws_dms_replication_subnet_group",
"aws_dms_replication_task",
# DynamoDB
"aws_dynamodb_table",
# AWS Elastic Beanstalk
"aws_elastic_beanstalk_application",
"aws_elastic_beanstalk_application_version",
"aws_elastic_beanstalk_configuration_template",
"aws_elastic_beanstalk_environment"
# Amazon Elastic Compute Cloud (Amazon EC2)
"aws_ec2_capacity_reservation",
"aws_eip",
"aws_ami",
"aws_instance",
"aws_launch_template",
"aws_ebs_volume",
"aws_ebs_snapshot",
"aws_ebs_snapshot_copy",
"aws_ec2_client_vpn_endpoint",
"aws_ami_copy",
"aws_ec2_fleet",
"aws_ec2_transit_gateway",
"aws_ec2_transit_gateway_route_table",
"aws_ec2_transit_gateway_vpc_attachment",
"aws_ec2_transit_gateway_vpc_attachment_accepter",
"aws_spot_fleet_request",
"aws_spot_instance_request",
"aws_volume_attachment"
# Amazon Elastic Container Registry
"aws_ecr_repository",
# ECS
"aws_ecs_cluster",
"aws_ecs_service",
"aws_ecs_task_definition",
# EFS
"aws_efs_file_system",
# ElastiCache
"aws_elasticache_cluster",
"aws_elasticache_replication_group",
# EMR
"aws_emr_cluster",
# Elasticsearch
"aws_elasticsearch_domain",
# Glacier
"aws_glacier_vault",
# Glue
# Inspector
"aws_inspector_resource_group",
# IOT
# KMS
"aws_kms_external_key",
"aws_kms_key",
# Kinesis
"aws_kinesis_analytics_application",
"aws_kinesis_stream",
"aws_kinesis_firehose_delivery_stream",
# Lambda
"aws_lambda_function",
# Kafka
"aws_msk_cluster",
# MQ
"aws_mq_broker",
# Opsworks
"aws_opsworks_stack",
# Resource Access Manager (RAM)
"aws_ram_resource_share",
# RDS
"aws_db_event_subscription",
"aws_db_instance",
"aws_db_option_group",
"aws_db_parameter_group",
"db_security_group",
"aws_db_snapshot",
"aws_db_subnet_group",
"aws_rds_cluster",
"aws_rds_cluster_instance",
"aws_rds_cluster_parameter_group",
# Redshift
"aws_redshift_cluster",
"aws_redshift_event_subscription",
"aws_redshift_parameter_group",
"aws_redshift_snapshot_copy_grant",
"aws_redshift_subnet_group",
# Resource Groups
# RoboMaker
"aws_route53_health_check",
"aws_route53_zone",
"aws_route53_resolver_endpoint",
"aws_route53_resolver_rule",
# Load Balancing
"aws_elb",
"aws_lb",
"aws_lb_target_group",
# SageMaker
"aws_sagemaker_endpoint",
"aws_sagemaker_endpoint_configuration",
"aws_sagemaker_model",
"aws_sagemaker_notebook_instance",
# Service Catelog
"aws_servicecatalog_portfolio",
# S3
"aws_s3_bucket",
"aws_s3_bucket_metric",
"aws_s3_bucket_object",
# Neptune
"aws_neptune_parameter_group",
"aws_neptune_subnet_group",
"aws_neptune_cluster_parameter_group",
"aws_neptune_cluster",
"aws_neptune_cluster_instance",
"aws_neptune_event_subscription",
# Secrets Manager
"aws_secretsmanager_secret",
# VPC
"aws_customer_gateway",
"aws_default_network_acl",
"aws_default_route_table",
"aws_default_security_group",
"aws_default_subnet",
"aws_default_vpc",
"aws_default_vpc_dhcp_options",
"aws_vpc_endpoint",
"aws_vpc_endpoint_service",
"aws_vpc_peering_connection",
"aws_vpc_peering_connection_accepter",
"aws_vpn_connection",
"aws_vpn_gateway",
"aws_nat_gateway",
"aws_network_acl",
"aws_network_interface",
"aws_route_table",
"aws_security_group",
"aws_subnet",
"aws_vpc",
"aws_vpc_dhcp_options",
]
| taggable_resources = ['aws_api_gateway_stage', 'aws_acm_certificate', 'aws_acmpca_certificate_authority', 'aws_cloudfront_distribution', 'aws_cloudtrail', 'aws_appsync_graphql_api', 'aws_backup_plan', 'aws_backup_vault', 'aws_cloudformation_stack', 'aws_cloudformation_stack_set', 'aws_batch_compute_environment', 'aws_cloudwatch_metric_alarmaws_cloudwatch_event_rule', 'aws_cloudwatch_log_group', 'aws_codebuild_project', 'aws_cloudhsm_v2_cluster', 'aws_cognito_identity_pool', 'aws_cognito_user_pool', 'aws_directory_service_directory', 'aws_dx_connection', 'aws_dx_lag', 'aws_iam_user', 'aws_iam_role', 'aws_config_config_rule', 'aws_dms_certificate', 'aws_dms_endpoint', 'aws_dms_replication_instance', 'aws_dms_replication_subnet_group', 'aws_dms_replication_task', 'aws_dynamodb_table', 'aws_elastic_beanstalk_application', 'aws_elastic_beanstalk_application_version', 'aws_elastic_beanstalk_configuration_template', 'aws_elastic_beanstalk_environmentaws_ec2_capacity_reservation', 'aws_eip', 'aws_ami', 'aws_instance', 'aws_launch_template', 'aws_ebs_volume', 'aws_ebs_snapshot', 'aws_ebs_snapshot_copy', 'aws_ec2_client_vpn_endpoint', 'aws_ami_copy', 'aws_ec2_fleet', 'aws_ec2_transit_gateway', 'aws_ec2_transit_gateway_route_table', 'aws_ec2_transit_gateway_vpc_attachment', 'aws_ec2_transit_gateway_vpc_attachment_accepter', 'aws_spot_fleet_request', 'aws_spot_instance_request', 'aws_volume_attachmentaws_ecr_repository', 'aws_ecs_cluster', 'aws_ecs_service', 'aws_ecs_task_definition', 'aws_efs_file_system', 'aws_elasticache_cluster', 'aws_elasticache_replication_group', 'aws_emr_cluster', 'aws_elasticsearch_domain', 'aws_glacier_vault', 'aws_inspector_resource_group', 'aws_kms_external_key', 'aws_kms_key', 'aws_kinesis_analytics_application', 'aws_kinesis_stream', 'aws_kinesis_firehose_delivery_stream', 'aws_lambda_function', 'aws_msk_cluster', 'aws_mq_broker', 'aws_opsworks_stack', 'aws_ram_resource_share', 'aws_db_event_subscription', 'aws_db_instance', 'aws_db_option_group', 'aws_db_parameter_group', 'db_security_group', 'aws_db_snapshot', 'aws_db_subnet_group', 'aws_rds_cluster', 'aws_rds_cluster_instance', 'aws_rds_cluster_parameter_group', 'aws_redshift_cluster', 'aws_redshift_event_subscription', 'aws_redshift_parameter_group', 'aws_redshift_snapshot_copy_grant', 'aws_redshift_subnet_group', 'aws_route53_health_check', 'aws_route53_zone', 'aws_route53_resolver_endpoint', 'aws_route53_resolver_rule', 'aws_elb', 'aws_lb', 'aws_lb_target_group', 'aws_sagemaker_endpoint', 'aws_sagemaker_endpoint_configuration', 'aws_sagemaker_model', 'aws_sagemaker_notebook_instance', 'aws_servicecatalog_portfolio', 'aws_s3_bucket', 'aws_s3_bucket_metric', 'aws_s3_bucket_object', 'aws_neptune_parameter_group', 'aws_neptune_subnet_group', 'aws_neptune_cluster_parameter_group', 'aws_neptune_cluster', 'aws_neptune_cluster_instance', 'aws_neptune_event_subscription', 'aws_secretsmanager_secret', 'aws_customer_gateway', 'aws_default_network_acl', 'aws_default_route_table', 'aws_default_security_group', 'aws_default_subnet', 'aws_default_vpc', 'aws_default_vpc_dhcp_options', 'aws_vpc_endpoint', 'aws_vpc_endpoint_service', 'aws_vpc_peering_connection', 'aws_vpc_peering_connection_accepter', 'aws_vpn_connection', 'aws_vpn_gateway', 'aws_nat_gateway', 'aws_network_acl', 'aws_network_interface', 'aws_route_table', 'aws_security_group', 'aws_subnet', 'aws_vpc', 'aws_vpc_dhcp_options'] |
CREATE_VENV__CMD = b'UkVNIE5lY2Vzc2FyeSBGaWxlczoNClJFTSAtIHByZV9zZXR1cF9zY3JpcHRzLnR4dA0KUkVNIC0gcmVxdWlyZWRfcGVyc29uYWxfcGFja2FnZXMudHh0DQpSRU0gLSByZXF1aXJlZF9taXNjLnR4dA0KUkVNIC0gcmVxdWlyZWRfUXQudHh0DQpSRU0gLSByZXF1aXJlZF9mcm9tX2dpdGh1Yi50eHQNClJFTSAtIHJlcXVpcmVkX3Rlc3QudHh0DQpSRU0gLSByZXF1aXJlZF9kZXYudHh0DQpSRU0gLSBwb3N0X3NldHVwX3NjcmlwdHMudHh0DQpSRU0gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpARUNITyBPRkYNClNFVExPQ0FMIEVOQUJMRUVYVEVOU0lPTlMNCg0KDQoNCg0KU0VUIFBST0pFQ1RfTkFNRT0tUExFQVNFX1NFVF9USElTLQ0KDQpTRVQgT0xESE9NRV9GT0xERVI9JX5kcDANCg0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU0VUIF9kYXRlPSVEQVRFOi89LSUNClNFVCBfdGltZT0lVElNRTo6PSUNClNFVCBfdGltZT0lX3RpbWU6ID0wJQ0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0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_venv_extra_envvars.py': CREATE_VENV_EXTRA_ENVVARS__PY, }
venv_setup_settings_folder_data = {'post_setup_scripts.txt': POST_SETUP_SCRIPTS__TXT, 'pre_setup_scripts.txt': PRE_SETUP_SCRIPTS__TXT, 'required_dev.txt': REQUIRED_DEV__TXT, 'required_from_github.txt': REQUIRED_FROM_GITHUB__TXT,
'required_misc.txt': REQUIRED_MISC__TXT, 'required_personal_packages.txt': REQUIRED_PERSONAL_PACKAGES__TXT, 'required_qt.txt': REQUIRED_QT__TXT, 'required_test.txt': REQUIRED_TEST__TXT, }
| create_venv__cmd = b'UkVNIE5lY2Vzc2FyeSBGaWxlczoNClJFTSAtIHByZV9zZXR1cF9zY3JpcHRzLnR4dA0KUkVNIC0gcmVxdWlyZWRfcGVyc29uYWxfcGFja2FnZXMudHh0DQpSRU0gLSByZXF1aXJlZF9taXNjLnR4dA0KUkVNIC0gcmVxdWlyZWRfUXQudHh0DQpSRU0gLSByZXF1aXJlZF9mcm9tX2dpdGh1Yi50eHQNClJFTSAtIHJlcXVpcmVkX3Rlc3QudHh0DQpSRU0gLSByZXF1aXJlZF9kZXYudHh0DQpSRU0gLSBwb3N0X3NldHVwX3NjcmlwdHMudHh0DQpSRU0gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpARUNITyBPRkYNClNFVExPQ0FMIEVOQUJMRUVYVEVOU0lPTlMNCg0KDQoNCg0KU0VUIFBST0pFQ1RfTkFNRT0tUExFQVNFX1NFVF9USElTLQ0KDQpTRVQgT0xESE9NRV9GT0xERVI9JX5kcDANCg0KUkVNIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KU0VUIF9kYXRlPSVEQVRFOi89LSUNClNFVCBfdGltZ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ucmVhZCgpDQogICAgaWYgUkVQTEFDRU1FTlQgbm90IGluIF9jb250ZW50Og0KICAgICAgICBfbmV3X2NvbnRlbnQgPSBfY29udGVudC5yZXBsYWNlKHInQGVjaG8gb2ZmJywgUkVQTEFDRU1FTlQpDQogICAgICAgIHdpdGggb3BlbihSRUxfQUNUSVZBVEVfU0NSSVBUX1BBVEgsICd3JykgYXMgbmV3YmF0Og0KICAgICAgICAgICAgbmV3YmF0LndyaXRlKF9uZXdfY29udGVudCkNCg0KDQppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOg0KICAgIGNyZWF0ZV9wcm9qZWN0X21ldGFfZW52X2ZpbGUoKQ0KICAgIG1vZGlmeV9hY3RpdmF0ZV9iYXQoKQ0K'
post_setup_scripts__txt = b'Li5cLnZlbnZcU2NyaXB0c1xweXF0NXRvb2xzaW5zdGFsbHVpYy5leGUNCiVPTERIT01FX0ZPTERFUiVjcmVhdGVfdmVudl9leHRyYV9lbnZ2YXJzLnB5LCVPTERIT01FX0ZPTERFUiUgJVBST0pFQ1RfTkFNRSU='
pre_setup_scripts__txt = b'IkM6XFByb2dyYW0gRmlsZXMgKHg4NilcTWljcm9zb2Z0IFZpc3VhbCBTdHVkaW9cMjAxOVxDb21tdW5pdHlcVkNcQXV4aWxpYXJ5XEJ1aWxkXHZjdmFyc2FsbC5iYXQiLGFtZDY0DQpwc2tpbGw2NCxEcm9wYm94'
required_dev__txt = b'aHR0cHM6Ly9naXRodWIuY29tL3B5aW5zdGFsbGVyL3B5aW5zdGFsbGVyL3RhcmJhbGwvZGV2ZWxvcA0KcGVwNTE3DQpudWl0a2ENCm1lbW9yeS1wcm9maWxlcg0KbWF0cGxvdGxpYg0KaW1wb3J0LXByb2ZpbGVyDQpvYmplY3RncmFwaA0KcGlwcmVxcw0KcHlkZXBzDQpudW1weT09MS4xOS4z'
required_from_github__txt = b'aHR0cHM6Ly9naXRodWIuY29tL292ZXJmbDAvQXJtYWNsYXNzLmdpdA=='
required_misc__txt = b'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xveQ=='
required_test__txt = b'cHl0ZXN0DQpweXRlc3QtcXQ='
root_folder_data = {'create_venv.cmd': CREATE_VENV__CMD, 'create_venv_extra_envvars.py': CREATE_VENV_EXTRA_ENVVARS__PY}
venv_setup_settings_folder_data = {'post_setup_scripts.txt': POST_SETUP_SCRIPTS__TXT, 'pre_setup_scripts.txt': PRE_SETUP_SCRIPTS__TXT, 'required_dev.txt': REQUIRED_DEV__TXT, 'required_from_github.txt': REQUIRED_FROM_GITHUB__TXT, 'required_misc.txt': REQUIRED_MISC__TXT, 'required_personal_packages.txt': REQUIRED_PERSONAL_PACKAGES__TXT, 'required_qt.txt': REQUIRED_QT__TXT, 'required_test.txt': REQUIRED_TEST__TXT} |
"""
SOURCE: TODO; link github code snippet
"""
class meta:
length = 0
# def __init__(self):
# print self.process("schmidt")
def isSlavoGermanic(self, str):
for each in ["W", "K", "CZ", "WITZ"]:
if (each in str):
return 1;
return 0;
def isVowel(self, word, start):
return self.sub(word, start, 1, ['A', 'E', 'I', 'O', 'U', 'Y'])
def sub(self, word, start, count, arr):
if (start < 0 or start >= len(word)):
return 0
if (word[start:start + count] in arr):
return 1
return 0
def process(self, word):
primary, secondary = "", ""
word = word.upper()
self.length = len(word)
current, last = 0, self.length - 1
word += " "
if (word[0:2] in ['GN', 'KN', 'PN', 'WR', 'PS']):
current += 1
if (word[0] == 'X'):
primary += "S"
secondary += "S"
current += 1
while ((len(primary) < 4 or len(secondary) < 4) and current < self.length):
symbol = word[current]
if (symbol in ['A', 'E', 'I', 'O', 'U', 'Y']):
if (current == 0):
primary += "A"
secondary += "A"
current += 1
continue
elif (symbol == "B"):
primary += "P"
secondary += "P"
if (self.sub(word, current + 1, 1, ["B"])):
current += 2
else:
current += 1
continue
elif (symbol == 'C'):
if (current > 1 \
and not self.isVowel(word, current - 2) \
and self.sub(word, current - 1, 3, ["ACH"]) \
and (not self.sub(word, current + 2, 1, ['I']) \
and (not self.sub(word, current + 2, 1, ['E']) \
or self.sub(word, current - 2, 6, ['BACHER', 'MACHER'])))):
primary += 'K'
secondary += 'K'
current += 2
continue
# special case 'caesar'
elif (current == 0 and self.sub(word, current, 6, ["CAESAR"])):
primary += "S"
secondary += "S"
current += 2
continue
# italian 'chianti'
elif (self.sub(word, current, 4, ["CHIA"])):
primary += "K"
secondary += "K"
current += 2
continue
elif (self.sub(word, current, 2, ["CH"])):
# find 'michael'
if (current > 0 and self.sub(word, current, 4, ["CHAE"])):
primary += "K"
secondary += "X"
current += 2
continue
# greek roots e.g. 'chemistry', 'chorus'
if (current == 0 and \
(self.sub(word, current + 1, 5, ["HARAC", "HARIS"]) or \
self.sub(word, current + 1, 3, ["HOR", "HYM", "HIA", "HEM"]))
and not self.sub(word, 0, 5, ["CHORE"])):
primary += "K"
secondary += "K"
current += 2
continue
# germanic, greek, or otherwise 'ch' for 'kh' sound
# print self.sub(word,current-1,1,["A","O","U","E"])
# print self.sub(word,current+2,1,["L","R","N","M","B","H","F","V","W","$"])
# print "#"+word[current+2:current+3]+"#"
if ((self.sub(word, 0, 4, ["VAN ", "VON "]) or \
self.sub(word, 0, 3, ["SCH"])) \
or self.sub(word, current - 2, 6, ["ORCHES", "ARCHIT", "ORCHID"])
or self.sub(word, current + 2, 1, ["T", "S"]) \
or ((self.sub(word, current - 1, 1, ["A", "O", "U", "E"])
or current == 0) \
and self.sub(word, current + 2, 1,
["L", "R", "N", "M", "B", "H", "F", "V", "W", " "]))):
primary += "K"
secondary += "K"
else:
# print symbol
if (current > 0):
if (self.sub(word, 0, 2, ["MC"])):
primary += "K"
secondary += "K"
else:
primary += "X"
secondary += "K"
else:
primary += "X"
secondary += "X"
current += 2
continue
# e.g. 'czerny'
if (self.sub(word, current, 2, ["CZ"]) and \
not self.sub(word, current - 2, 4, ["WICZ"])):
primary += "S"
secondary += "X"
current += 2
continue
# e.g. 'focaccia'
if (self.sub(word, current + 1, 3, ["CIA"])):
primary += "X"
secondary += "X"
current += 3
continue
# double 'C', but not McClellan'
if (self.sub(word, current, 2, ["CC"]) \
and not (current == 1 \
and self.sub(word, 0, 1, ["M"]))):
if (self.sub(word, current + 2, 1, ["I", "E", "H"]) \
and not self.sub(word, current + 2, 2, ["HU"])):
if ((current == 1 and self.sub(word, current - 1, 1, ["A"])) \
or self.sub(word, current - 1, 5, ["UCCEE", "UCCES"])):
primary += "KS"
secondary += "KS"
else:
primary += "X"
secondary += "X"
current += 3
continue
else:
# Pierce's rule
primary += "K"
secondary += "K"
current += 2
continue
if (self.sub(word, current, 2, ["CK", "CG", "CQ"])):
primary += "K"
secondary += "K"
current += 2
continue
if (self.sub(word, current, 2, ["CI", "CE", "CY"])):
if (self.sub(word, current, 3, ["CIO", "CIE", "CIA"])):
primary += "S"
secondary += "X"
else:
primary += "S"
secondary += "S"
current += 2
continue
primary += "K"
secondary += "K"
if (self.sub(word, current + 1, 2, [" C", " Q", " G"])):
current += 3
else:
if (self.sub(word, current + 1, 1, ["C", "K", "Q"]) \
and not self.sub(word, current + 1, 2, ["CE", "CI"])):
current += 2
else:
current += 1
continue
elif (symbol == "D"):
if (self.sub(word, current, 2, ['DG'])):
if (self.sub(word, current + 2, 1, ['I', 'E', 'Y'])):
primary += 'J'
secondary += 'J'
current += 3
continue
else:
primary += "TK"
secondary += "TK"
current += 2
continue
elif (self.sub(word, current, 2, ['DT', 'DD'])):
primary += "T"
secondary += "T"
current += 2
continue
else:
primary += "T"
secondary += "T"
current += 1
continue
elif (symbol == "F"):
if (self.sub(word, current + 1, 1, ["F"])):
current += 2
else:
current += 1
primary += "F"
secondary += "F"
continue
elif (symbol == "G"):
if (self.sub(word, current + 1, 1, ['H'])):
if (current > 0 and not self.isVowel(word, current - 1)):
primary += "K"
secondary += "K"
current += 2
continue
elif (current < 3):
if (current == 0):
if (self.sub(word, current + 2, 1, ['I'])):
primary += "J"
secondary += "J"
else:
primary += "K"
secondary += "K"
current += 2
continue
if ((current > 1 and self.sub(word, current - 2, 1, ['B', 'H', 'D'])) \
or (current > 2 and self.sub(word, current - 3, 1, ['B', 'H', 'D'])) \
or (current > 3 and self.sub(word, current - 4, 1, ['B', 'H']))):
current += 2
continue
else:
if (current > 2 and self.sub(word, current - 1, 1, ['U']) \
and self.sub(word, current - 3, 1, ['C', 'G', 'L', 'R', 'T'])):
primary += "F"
secondary += "F"
elif (current > 0 and word[current - 1] != "I"):
primary += "K"
secondary += "K"
current += 2
continue
elif (self.sub(word, current + 1, 1, ['N'])):
if (current == 1 and self.isVowel(word, 0) \
and not self.isSlavoGermanic(word)):
primary += "KN"
secondary += "N"
else:
if (not self.sub(word, current + 2, 2, ['EY']) \
and not self.sub(word, current + 1, 1, ['Y']) \
and not self.isSlavoGermanic(word)):
primary += "N"
secondary += "KN"
else:
primary += "KN"
secondary += "KN"
current += 2
continue
elif (self.sub(word, current + 1, 2, ['LI']) and not self.isSlavoGermanic(word)):
primary += "KL"
secondary += "L"
current += 2
continue
elif (current == 0 \
and (self.sub(word, current + 1, 1, ['Y']) \
or self.sub(word, current + 1, 2,
["ES", "EP", "EB", "EL", "EY", "IB", "IL", "IN", "IE", "EI",
"ER"]))):
primary += "K"
secondary += "J"
current += 2
continue
elif ((self.sub(word, current + 1, 2, ["ER"]) \
or (self.sub(word, current + 1, 1, ["Y"]))) and \
not self.sub(word, 0, 6, ["DANGER", "RANGER", "MANGER"]) \
and not self.sub(word, current - 1, 1, ["E", "I"]) and \
not self.sub(word, current - 1, 3, ["RGY", "OGY"])):
primary += "K"
secondary += "J"
current += 2
continue
elif (self.sub(word, current + 1, 1, ["E", "I", "Y"]) \
or self.sub(word, current - 1, 4, ["AGGI", "OGGI"])):
if (self.sub(word, 0, 4, ["VAN", "VON"]) or \
self.sub(word, 0, 3, ["SCH"]) or \
self.sub(word, current + 1, 2, ["ET"])):
primary += "K"
secondary += "K"
else:
if (self.sub(word, current + 1, 4, ["IER "])):
primary += "J"
secondary += "J"
else:
primary += "J"
secondary += "K"
current += 2
continue
if (self.sub(word, current + 1, 1, ["G"])):
current += 2
else:
current += 1
primary += "K"
secondary += "K"
continue
elif (symbol == "H"):
if ((current == 0 or self.isVowel(word, current - 1)) \
and self.isVowel(word, current + 1)):
primary += "H"
secondary += "H"
current += 2
else:
current += 1
continue
elif (symbol == "J"):
if (self.sub(word, current, 4, ["JOSE"]) or \
self.sub(word, 0, 4, ["SAN "])):
if (current == 0 and self.sub(word, current + 4, 1, [' ']) or \
self.sub(word, 0, 4, ["SAN "])):
primary += "H"
secondary += "H"
else:
primary += "J"
secondary += "H"
current += 1
continue
if ((current == 0 and not self.sub(word, current, 4, ["JOSE"]))):
primary += "J"
secondary += "A"
else:
if (self.isVowel(word, current - 1) \
and not self.isSlavoGermanic(word) and \
(self.sub(word, current + 1, 1, ["A"]) or \
self.sub(word, current + 1, 1, ["O"]))):
primary += "J"
secondary += "H"
else:
if (current == last):
primary += "J"
else:
if (not self.sub(word, current + 1, 1, ["L", "T", "K", "S", "N", "M", "B", "Z"]) \
and not self.sub(word, current - 1, 1, ["S", "K", "L"])):
primary += "J"
secondary += "J"
if (self.sub(word, current + 1, 1, ["J"])):
current += 2
else:
current += 1
continue
elif (symbol == "K"):
if (self.sub(word, current + 1, 1, ["K"])):
current += 2
else:
current += 1
primary += "K"
secondary += "K"
continue
elif (symbol == "L"):
if (self.sub(word, current + 1, 1, ["L"])):
if ((current == self.length - 3 and self.sub(word, current - 1, 4, ["ILLO", "ILLA", "ALLE"])) \
or ((self.sub(word, last - 1, 2, ["AS", "OS"]) or self.sub(word, last, 1, ["A", "O"])) \
and self.sub(word, current - 1, 4, ["ALLE"]))):
primary += "L"
current += 2
continue;
else:
current += 2
else:
current += 1
primary += "L"
secondary += "L"
continue
elif (symbol == "M"):
if ((self.sub(word, current - 1, 3, ["UMB"]) and \
(current + 1 == last or self.sub(word, current + 2, 2, ["ER"]))) or \
self.sub(word, current + 1, 1, ["M"])):
current += 2
else:
current += 1
primary += "M"
secondary += "M"
continue
elif (symbol == "N"):
if (self.sub(word, current + 1, 1, ["N"])):
current += 2
else:
current += 1
primary += "N"
secondary += "N"
continue
elif (symbol == "P"):
if (self.sub(word, current + 1, 1, ["H"])):
current += 2
primary += "F"
secondary += "F"
continue
if (self.sub(word, current + 1, 1, ["P", "B"])):
current += 2
else:
current += 1
primary += "P"
secondary += "P"
continue
elif (symbol == "Q"):
if (self.sub(word, current + 1, 1, ["Q"])):
current += 2
else:
current += 1
primary += "K"
secondary += "K"
continue
elif (symbol == "R"):
if (current == last and not self.isSlavoGermanic(word) \
and self.sub(word, current - 2, 2, ["IE"]) and \
not self.sub(word, current - 4, 2, ["ME", "MA"])):
secondary += "R"
else:
primary += "R"
secondary += "R"
if (self.sub(word, current + 1, 1, ["R"])):
current += 2
else:
current += 1
continue
elif (symbol == "S"):
if (self.sub(word, current - 1, 3, ["ISL", "YSL"])):
current += 1
continue
if (current == 0 and self.sub(word, current, 5, ["SUGAR"])):
primary += "X"
secondary += "S"
current += 1
continue
if (self.sub(word, current, 2, ["SH"])):
if (self.sub(word, current + 1, 4, ["HEIM", "HOEK", "HOLM", "HOLZ"])):
primary += "S"
secondary += "S"
else:
primary += "X"
secondary += "X"
current += 2
continue
if (self.sub(word, current, 3, ["SIO", "SIA"]) \
or self.sub(word, current, 4, ["SIAN"])):
if (not self.isSlavoGermanic(word)):
primary += "S"
secondary += "X"
else:
primary += "S"
secondary += "S"
current += 3
continue
if ((current == 0 and self.sub(word, current + 1, 1, ["M", "N", "L", "W"])) \
or self.sub(word, current + 1, 1, ["Z"])):
primary += "S"
secondary += "X"
if (self.sub(word, current + 1, 1, ["Z"])):
current += 2
else:
current += 1
continue
if (self.sub(word, current, 2, ["SC"])):
if (self.sub(word, current + 2, 1, ["H"])):
if (self.sub(word, current + 3, 2, ["OO", "ER", "EN", "UY", "ED", "EM"])):
if (self.sub(word, current + 3, 2, ["ER", "EN"])):
primary += "X"
secondary += "SK"
else:
primary += "SK"
secondary += "SK"
current += 3
continue
else:
if (current == 0 and not (self.isVowel(word, 3)) \
and not self.sub(word, current + 3, 1, ["W"])):
primary += "X"
secondary += "S"
else:
primary += "X"
secondary += "X"
current += 3
continue
if (self.sub(word, current + 2, 1, ["I", "E", "Y"])):
primary += "S"
secondary += "S"
current += 3
continue
primary += "SK"
secondary += "SK"
current += 3
continue
if (current == last and self.sub(word, current - 2, 2, ["AI", "OI"])):
primary += ""
secondary += "S"
else:
primary += "S"
secondary += "S"
if (self.sub(word, current + 1, 1, ["S", "Z"])):
current += 2
else:
current += 1
continue
elif (symbol == "T"):
if (self.sub(word, current, 4, ["TION"])):
primary += "X"
secondary += "X"
current += 3
continue
if (self.sub(word, current, 3, ["TIA", "TCH"])):
primary += "X"
secondary += "X"
current += 3
continue
if (self.sub(word, current, 2, ["TH"]) or \
self.sub(word, current, 3, ["TTH"])):
if (self.sub(word, current + 2, 2, ["OM", "AM"]) or \
self.sub(word, 0, 4, ["VAN ", "VON "]) or \
self.sub(word, 0, 3, ["SCH"])):
primary += "T"
secondary += "T"
else:
primary += "0" # its a zero here represents TH
secondary += "T"
current += 2
continue
if (self.sub(word, current + 1, 1, ["T", "D"])):
current += 2
else:
current += 1
primary += "T"
secondary += "T"
continue
elif (symbol == "V"):
if (self.sub(word, current + 1, 1, ["V"])):
current += 2
else:
current += 1
primary += "F"
secondary += "F"
continue
elif (symbol == "W"):
if (self.sub(word, current, 2, ["WR"])):
primary += "R"
secondary += "R"
current += 2
continue
if (current == 0 and \
((self.isVowel(word, current + 1)) \
or self.sub(word, current, 2, ["WH"]))):
if (self.isVowel(word, current + 1)):
primary += "A"
secondary += "F"
else:
primary += "A"
secondary += "A"
if ((current == last and self.isVowel(word, current - 1)) or \
self.sub(word, current - 1, 5, ["EWSKI", "EWSKY", "OWSKI", "OWSKY"]) or \
self.sub(word, 0, 3, ["SCH"])):
secondary += "F"
current += 1
continue
if (self.sub(word, current, 4, ["WICZ", "WITZ"])):
primary += "TS"
secondary += "FX"
current += 4
continue
current += 1
continue
elif (symbol == "X"):
if (not (current == last and \
(self.sub(word, current - 3, 3, ["IAU", "EAU"]) or \
self.sub(word, current - 2, 2, ["AU", "OU"])))):
primary += "KS"
secondary += "KS"
else:
# do nothing
primary += ""
if (self.sub(word, current + 1, 1, ["C", "X"])):
current += 2
else:
current += 1
continue
elif (symbol == "Z"):
if (self.sub(word, current + 1, 1, ["H"])):
primary += "J"
secondary += "J"
current += 2
continue
elif (self.sub(word, current + 1, 2, ["ZO", "ZI", "ZA"]) or
(self.isSlavoGermanic(word) and \
(current > 0 and word[current - 1] != 'T'))):
primary += "S"
secondary += "TS"
else:
primary += "S"
secondary += "S"
if (self.sub(word, current + 1, 1, ['Z'])):
current += 2
else:
current += 1
continue
else:
current += 1
primary = primary[0:4]
secondary = secondary[0:4]
return primary, secondary
| """
SOURCE: TODO; link github code snippet
"""
class Meta:
length = 0
def is_slavo_germanic(self, str):
for each in ['W', 'K', 'CZ', 'WITZ']:
if each in str:
return 1
return 0
def is_vowel(self, word, start):
return self.sub(word, start, 1, ['A', 'E', 'I', 'O', 'U', 'Y'])
def sub(self, word, start, count, arr):
if start < 0 or start >= len(word):
return 0
if word[start:start + count] in arr:
return 1
return 0
def process(self, word):
(primary, secondary) = ('', '')
word = word.upper()
self.length = len(word)
(current, last) = (0, self.length - 1)
word += ' '
if word[0:2] in ['GN', 'KN', 'PN', 'WR', 'PS']:
current += 1
if word[0] == 'X':
primary += 'S'
secondary += 'S'
current += 1
while (len(primary) < 4 or len(secondary) < 4) and current < self.length:
symbol = word[current]
if symbol in ['A', 'E', 'I', 'O', 'U', 'Y']:
if current == 0:
primary += 'A'
secondary += 'A'
current += 1
continue
elif symbol == 'B':
primary += 'P'
secondary += 'P'
if self.sub(word, current + 1, 1, ['B']):
current += 2
else:
current += 1
continue
elif symbol == 'C':
if current > 1 and (not self.isVowel(word, current - 2)) and self.sub(word, current - 1, 3, ['ACH']) and (not self.sub(word, current + 2, 1, ['I']) and (not self.sub(word, current + 2, 1, ['E']) or self.sub(word, current - 2, 6, ['BACHER', 'MACHER']))):
primary += 'K'
secondary += 'K'
current += 2
continue
elif current == 0 and self.sub(word, current, 6, ['CAESAR']):
primary += 'S'
secondary += 'S'
current += 2
continue
elif self.sub(word, current, 4, ['CHIA']):
primary += 'K'
secondary += 'K'
current += 2
continue
elif self.sub(word, current, 2, ['CH']):
if current > 0 and self.sub(word, current, 4, ['CHAE']):
primary += 'K'
secondary += 'X'
current += 2
continue
if current == 0 and (self.sub(word, current + 1, 5, ['HARAC', 'HARIS']) or self.sub(word, current + 1, 3, ['HOR', 'HYM', 'HIA', 'HEM'])) and (not self.sub(word, 0, 5, ['CHORE'])):
primary += 'K'
secondary += 'K'
current += 2
continue
if (self.sub(word, 0, 4, ['VAN ', 'VON ']) or self.sub(word, 0, 3, ['SCH'])) or self.sub(word, current - 2, 6, ['ORCHES', 'ARCHIT', 'ORCHID']) or self.sub(word, current + 2, 1, ['T', 'S']) or ((self.sub(word, current - 1, 1, ['A', 'O', 'U', 'E']) or current == 0) and self.sub(word, current + 2, 1, ['L', 'R', 'N', 'M', 'B', 'H', 'F', 'V', 'W', ' '])):
primary += 'K'
secondary += 'K'
elif current > 0:
if self.sub(word, 0, 2, ['MC']):
primary += 'K'
secondary += 'K'
else:
primary += 'X'
secondary += 'K'
else:
primary += 'X'
secondary += 'X'
current += 2
continue
if self.sub(word, current, 2, ['CZ']) and (not self.sub(word, current - 2, 4, ['WICZ'])):
primary += 'S'
secondary += 'X'
current += 2
continue
if self.sub(word, current + 1, 3, ['CIA']):
primary += 'X'
secondary += 'X'
current += 3
continue
if self.sub(word, current, 2, ['CC']) and (not (current == 1 and self.sub(word, 0, 1, ['M']))):
if self.sub(word, current + 2, 1, ['I', 'E', 'H']) and (not self.sub(word, current + 2, 2, ['HU'])):
if current == 1 and self.sub(word, current - 1, 1, ['A']) or self.sub(word, current - 1, 5, ['UCCEE', 'UCCES']):
primary += 'KS'
secondary += 'KS'
else:
primary += 'X'
secondary += 'X'
current += 3
continue
else:
primary += 'K'
secondary += 'K'
current += 2
continue
if self.sub(word, current, 2, ['CK', 'CG', 'CQ']):
primary += 'K'
secondary += 'K'
current += 2
continue
if self.sub(word, current, 2, ['CI', 'CE', 'CY']):
if self.sub(word, current, 3, ['CIO', 'CIE', 'CIA']):
primary += 'S'
secondary += 'X'
else:
primary += 'S'
secondary += 'S'
current += 2
continue
primary += 'K'
secondary += 'K'
if self.sub(word, current + 1, 2, [' C', ' Q', ' G']):
current += 3
elif self.sub(word, current + 1, 1, ['C', 'K', 'Q']) and (not self.sub(word, current + 1, 2, ['CE', 'CI'])):
current += 2
else:
current += 1
continue
elif symbol == 'D':
if self.sub(word, current, 2, ['DG']):
if self.sub(word, current + 2, 1, ['I', 'E', 'Y']):
primary += 'J'
secondary += 'J'
current += 3
continue
else:
primary += 'TK'
secondary += 'TK'
current += 2
continue
elif self.sub(word, current, 2, ['DT', 'DD']):
primary += 'T'
secondary += 'T'
current += 2
continue
else:
primary += 'T'
secondary += 'T'
current += 1
continue
elif symbol == 'F':
if self.sub(word, current + 1, 1, ['F']):
current += 2
else:
current += 1
primary += 'F'
secondary += 'F'
continue
elif symbol == 'G':
if self.sub(word, current + 1, 1, ['H']):
if current > 0 and (not self.isVowel(word, current - 1)):
primary += 'K'
secondary += 'K'
current += 2
continue
elif current < 3:
if current == 0:
if self.sub(word, current + 2, 1, ['I']):
primary += 'J'
secondary += 'J'
else:
primary += 'K'
secondary += 'K'
current += 2
continue
if current > 1 and self.sub(word, current - 2, 1, ['B', 'H', 'D']) or (current > 2 and self.sub(word, current - 3, 1, ['B', 'H', 'D'])) or (current > 3 and self.sub(word, current - 4, 1, ['B', 'H'])):
current += 2
continue
else:
if current > 2 and self.sub(word, current - 1, 1, ['U']) and self.sub(word, current - 3, 1, ['C', 'G', 'L', 'R', 'T']):
primary += 'F'
secondary += 'F'
elif current > 0 and word[current - 1] != 'I':
primary += 'K'
secondary += 'K'
current += 2
continue
elif self.sub(word, current + 1, 1, ['N']):
if current == 1 and self.isVowel(word, 0) and (not self.isSlavoGermanic(word)):
primary += 'KN'
secondary += 'N'
elif not self.sub(word, current + 2, 2, ['EY']) and (not self.sub(word, current + 1, 1, ['Y'])) and (not self.isSlavoGermanic(word)):
primary += 'N'
secondary += 'KN'
else:
primary += 'KN'
secondary += 'KN'
current += 2
continue
elif self.sub(word, current + 1, 2, ['LI']) and (not self.isSlavoGermanic(word)):
primary += 'KL'
secondary += 'L'
current += 2
continue
elif current == 0 and (self.sub(word, current + 1, 1, ['Y']) or self.sub(word, current + 1, 2, ['ES', 'EP', 'EB', 'EL', 'EY', 'IB', 'IL', 'IN', 'IE', 'EI', 'ER'])):
primary += 'K'
secondary += 'J'
current += 2
continue
elif (self.sub(word, current + 1, 2, ['ER']) or self.sub(word, current + 1, 1, ['Y'])) and (not self.sub(word, 0, 6, ['DANGER', 'RANGER', 'MANGER'])) and (not self.sub(word, current - 1, 1, ['E', 'I'])) and (not self.sub(word, current - 1, 3, ['RGY', 'OGY'])):
primary += 'K'
secondary += 'J'
current += 2
continue
elif self.sub(word, current + 1, 1, ['E', 'I', 'Y']) or self.sub(word, current - 1, 4, ['AGGI', 'OGGI']):
if self.sub(word, 0, 4, ['VAN', 'VON']) or self.sub(word, 0, 3, ['SCH']) or self.sub(word, current + 1, 2, ['ET']):
primary += 'K'
secondary += 'K'
elif self.sub(word, current + 1, 4, ['IER ']):
primary += 'J'
secondary += 'J'
else:
primary += 'J'
secondary += 'K'
current += 2
continue
if self.sub(word, current + 1, 1, ['G']):
current += 2
else:
current += 1
primary += 'K'
secondary += 'K'
continue
elif symbol == 'H':
if (current == 0 or self.isVowel(word, current - 1)) and self.isVowel(word, current + 1):
primary += 'H'
secondary += 'H'
current += 2
else:
current += 1
continue
elif symbol == 'J':
if self.sub(word, current, 4, ['JOSE']) or self.sub(word, 0, 4, ['SAN ']):
if current == 0 and self.sub(word, current + 4, 1, [' ']) or self.sub(word, 0, 4, ['SAN ']):
primary += 'H'
secondary += 'H'
else:
primary += 'J'
secondary += 'H'
current += 1
continue
if current == 0 and (not self.sub(word, current, 4, ['JOSE'])):
primary += 'J'
secondary += 'A'
elif self.isVowel(word, current - 1) and (not self.isSlavoGermanic(word)) and (self.sub(word, current + 1, 1, ['A']) or self.sub(word, current + 1, 1, ['O'])):
primary += 'J'
secondary += 'H'
elif current == last:
primary += 'J'
elif not self.sub(word, current + 1, 1, ['L', 'T', 'K', 'S', 'N', 'M', 'B', 'Z']) and (not self.sub(word, current - 1, 1, ['S', 'K', 'L'])):
primary += 'J'
secondary += 'J'
if self.sub(word, current + 1, 1, ['J']):
current += 2
else:
current += 1
continue
elif symbol == 'K':
if self.sub(word, current + 1, 1, ['K']):
current += 2
else:
current += 1
primary += 'K'
secondary += 'K'
continue
elif symbol == 'L':
if self.sub(word, current + 1, 1, ['L']):
if current == self.length - 3 and self.sub(word, current - 1, 4, ['ILLO', 'ILLA', 'ALLE']) or ((self.sub(word, last - 1, 2, ['AS', 'OS']) or self.sub(word, last, 1, ['A', 'O'])) and self.sub(word, current - 1, 4, ['ALLE'])):
primary += 'L'
current += 2
continue
else:
current += 2
else:
current += 1
primary += 'L'
secondary += 'L'
continue
elif symbol == 'M':
if self.sub(word, current - 1, 3, ['UMB']) and (current + 1 == last or self.sub(word, current + 2, 2, ['ER'])) or self.sub(word, current + 1, 1, ['M']):
current += 2
else:
current += 1
primary += 'M'
secondary += 'M'
continue
elif symbol == 'N':
if self.sub(word, current + 1, 1, ['N']):
current += 2
else:
current += 1
primary += 'N'
secondary += 'N'
continue
elif symbol == 'P':
if self.sub(word, current + 1, 1, ['H']):
current += 2
primary += 'F'
secondary += 'F'
continue
if self.sub(word, current + 1, 1, ['P', 'B']):
current += 2
else:
current += 1
primary += 'P'
secondary += 'P'
continue
elif symbol == 'Q':
if self.sub(word, current + 1, 1, ['Q']):
current += 2
else:
current += 1
primary += 'K'
secondary += 'K'
continue
elif symbol == 'R':
if current == last and (not self.isSlavoGermanic(word)) and self.sub(word, current - 2, 2, ['IE']) and (not self.sub(word, current - 4, 2, ['ME', 'MA'])):
secondary += 'R'
else:
primary += 'R'
secondary += 'R'
if self.sub(word, current + 1, 1, ['R']):
current += 2
else:
current += 1
continue
elif symbol == 'S':
if self.sub(word, current - 1, 3, ['ISL', 'YSL']):
current += 1
continue
if current == 0 and self.sub(word, current, 5, ['SUGAR']):
primary += 'X'
secondary += 'S'
current += 1
continue
if self.sub(word, current, 2, ['SH']):
if self.sub(word, current + 1, 4, ['HEIM', 'HOEK', 'HOLM', 'HOLZ']):
primary += 'S'
secondary += 'S'
else:
primary += 'X'
secondary += 'X'
current += 2
continue
if self.sub(word, current, 3, ['SIO', 'SIA']) or self.sub(word, current, 4, ['SIAN']):
if not self.isSlavoGermanic(word):
primary += 'S'
secondary += 'X'
else:
primary += 'S'
secondary += 'S'
current += 3
continue
if current == 0 and self.sub(word, current + 1, 1, ['M', 'N', 'L', 'W']) or self.sub(word, current + 1, 1, ['Z']):
primary += 'S'
secondary += 'X'
if self.sub(word, current + 1, 1, ['Z']):
current += 2
else:
current += 1
continue
if self.sub(word, current, 2, ['SC']):
if self.sub(word, current + 2, 1, ['H']):
if self.sub(word, current + 3, 2, ['OO', 'ER', 'EN', 'UY', 'ED', 'EM']):
if self.sub(word, current + 3, 2, ['ER', 'EN']):
primary += 'X'
secondary += 'SK'
else:
primary += 'SK'
secondary += 'SK'
current += 3
continue
else:
if current == 0 and (not self.isVowel(word, 3)) and (not self.sub(word, current + 3, 1, ['W'])):
primary += 'X'
secondary += 'S'
else:
primary += 'X'
secondary += 'X'
current += 3
continue
if self.sub(word, current + 2, 1, ['I', 'E', 'Y']):
primary += 'S'
secondary += 'S'
current += 3
continue
primary += 'SK'
secondary += 'SK'
current += 3
continue
if current == last and self.sub(word, current - 2, 2, ['AI', 'OI']):
primary += ''
secondary += 'S'
else:
primary += 'S'
secondary += 'S'
if self.sub(word, current + 1, 1, ['S', 'Z']):
current += 2
else:
current += 1
continue
elif symbol == 'T':
if self.sub(word, current, 4, ['TION']):
primary += 'X'
secondary += 'X'
current += 3
continue
if self.sub(word, current, 3, ['TIA', 'TCH']):
primary += 'X'
secondary += 'X'
current += 3
continue
if self.sub(word, current, 2, ['TH']) or self.sub(word, current, 3, ['TTH']):
if self.sub(word, current + 2, 2, ['OM', 'AM']) or self.sub(word, 0, 4, ['VAN ', 'VON ']) or self.sub(word, 0, 3, ['SCH']):
primary += 'T'
secondary += 'T'
else:
primary += '0'
secondary += 'T'
current += 2
continue
if self.sub(word, current + 1, 1, ['T', 'D']):
current += 2
else:
current += 1
primary += 'T'
secondary += 'T'
continue
elif symbol == 'V':
if self.sub(word, current + 1, 1, ['V']):
current += 2
else:
current += 1
primary += 'F'
secondary += 'F'
continue
elif symbol == 'W':
if self.sub(word, current, 2, ['WR']):
primary += 'R'
secondary += 'R'
current += 2
continue
if current == 0 and (self.isVowel(word, current + 1) or self.sub(word, current, 2, ['WH'])):
if self.isVowel(word, current + 1):
primary += 'A'
secondary += 'F'
else:
primary += 'A'
secondary += 'A'
if current == last and self.isVowel(word, current - 1) or self.sub(word, current - 1, 5, ['EWSKI', 'EWSKY', 'OWSKI', 'OWSKY']) or self.sub(word, 0, 3, ['SCH']):
secondary += 'F'
current += 1
continue
if self.sub(word, current, 4, ['WICZ', 'WITZ']):
primary += 'TS'
secondary += 'FX'
current += 4
continue
current += 1
continue
elif symbol == 'X':
if not (current == last and (self.sub(word, current - 3, 3, ['IAU', 'EAU']) or self.sub(word, current - 2, 2, ['AU', 'OU']))):
primary += 'KS'
secondary += 'KS'
else:
primary += ''
if self.sub(word, current + 1, 1, ['C', 'X']):
current += 2
else:
current += 1
continue
elif symbol == 'Z':
if self.sub(word, current + 1, 1, ['H']):
primary += 'J'
secondary += 'J'
current += 2
continue
elif self.sub(word, current + 1, 2, ['ZO', 'ZI', 'ZA']) or (self.isSlavoGermanic(word) and (current > 0 and word[current - 1] != 'T')):
primary += 'S'
secondary += 'TS'
else:
primary += 'S'
secondary += 'S'
if self.sub(word, current + 1, 1, ['Z']):
current += 2
else:
current += 1
continue
else:
current += 1
primary = primary[0:4]
secondary = secondary[0:4]
return (primary, secondary) |
n = int(input())
def sum_input():
_sum = 0
for i in range(n):
_sum += int(input())
return _sum
left_sum = sum_input()
right_sum = sum_input()
if left_sum == right_sum:
print("Yes, sum =", left_sum)
else:
print("No, diff =", abs(left_sum - right_sum)) | n = int(input())
def sum_input():
_sum = 0
for i in range(n):
_sum += int(input())
return _sum
left_sum = sum_input()
right_sum = sum_input()
if left_sum == right_sum:
print('Yes, sum =', left_sum)
else:
print('No, diff =', abs(left_sum - right_sum)) |
a = int(input())
while(a):
counti = 0
counte = 0
b = input()
for i in b:
if(i=='1'):
counti+=1
elif(i=='2'):
counte+=1
elif(i=='0'):
counte+=1
counti+=1
if(counti>counte):
print("INDIA")
elif(counte>counti):
print("ENGLAND")
else:
print("DRAW")
a-=1
| a = int(input())
while a:
counti = 0
counte = 0
b = input()
for i in b:
if i == '1':
counti += 1
elif i == '2':
counte += 1
elif i == '0':
counte += 1
counti += 1
if counti > counte:
print('INDIA')
elif counte > counti:
print('ENGLAND')
else:
print('DRAW')
a -= 1 |
text = input('Enter the text:\n')
if ('make a lot of money' in text):
spam = True
elif ('buy now' in text):
spam = True
elif ('watch this' in text):
spam = True
elif ('click this' in text):
spam = True
elif ('subscribe this' in text):
spam = True
else:
spam = False
if (spam):
print ('This text is spam.')
else:
print ('This text is not spam.') | text = input('Enter the text:\n')
if 'make a lot of money' in text:
spam = True
elif 'buy now' in text:
spam = True
elif 'watch this' in text:
spam = True
elif 'click this' in text:
spam = True
elif 'subscribe this' in text:
spam = True
else:
spam = False
if spam:
print('This text is spam.')
else:
print('This text is not spam.') |
a=input()
b=int(len(a))
for i in range(b):
print(a[i])
| a = input()
b = int(len(a))
for i in range(b):
print(a[i]) |
"""
@author: karthikrao
Test the Polish Expression for its Balloting and Normalized properties.
"""
def test_ballot(exp, index):
"""
Parameters
----------
exp : list
Polish Expression to be tested for its balloting property.
index : int
End point of the Polish Expression to be tested for its balloting property.
Returns
-------
bool
True indicates the Polish Expression satisfies the balloting property.
"""
temp = exp[:index+1]
operators=0
for i in temp:
if i=='V' or i=='H':
operators+=1
if 2*operators<(index):
return True
return False
def test_normalized(exp):
"""
Parameters
----------
exp : list
Polish Expression to be tested for its normalized property.
Returns
-------
bool
True if the given Polish Expression is normalized.
"""
for i in range(len(exp)-1):
if exp[i]==exp[i+1]:
return False
return True | """
@author: karthikrao
Test the Polish Expression for its Balloting and Normalized properties.
"""
def test_ballot(exp, index):
"""
Parameters
----------
exp : list
Polish Expression to be tested for its balloting property.
index : int
End point of the Polish Expression to be tested for its balloting property.
Returns
-------
bool
True indicates the Polish Expression satisfies the balloting property.
"""
temp = exp[:index + 1]
operators = 0
for i in temp:
if i == 'V' or i == 'H':
operators += 1
if 2 * operators < index:
return True
return False
def test_normalized(exp):
"""
Parameters
----------
exp : list
Polish Expression to be tested for its normalized property.
Returns
-------
bool
True if the given Polish Expression is normalized.
"""
for i in range(len(exp) - 1):
if exp[i] == exp[i + 1]:
return False
return True |
def second_largest(mylist):
largest = None
second_largest = None
for num in mylist:
if largest is None:
largest = num
elif num > largest:
second_largest = largest
largest = num
elif second_largest is None:
second_largest = num
elif num > second_largest:
second_largest = num
return second_largest
print(second_largest([1,3,4,5,0,2]))
print(second_largest([-2,-1]))
print(second_largest([2]))
print(second_largest([]))
| def second_largest(mylist):
largest = None
second_largest = None
for num in mylist:
if largest is None:
largest = num
elif num > largest:
second_largest = largest
largest = num
elif second_largest is None:
second_largest = num
elif num > second_largest:
second_largest = num
return second_largest
print(second_largest([1, 3, 4, 5, 0, 2]))
print(second_largest([-2, -1]))
print(second_largest([2]))
print(second_largest([])) |
# ===========
# BoE
# ===========
class HP_IMDB_BOE:
batch_size = 64
learning_rate = 1e-3
learning_rate_dpsgd = 1e-3
patience = 5
tgt_class = 1
sequence_length = 512
class HP_DBPedia_BOE:
batch_size = 256
learning_rate = 1e-3
learning_rate_dpsgd = 1e-3
patience = 2
tgt_class = 1 # start from 0
sequence_length = 256
class HP_Trec50_BOE:
batch_size = 128
learning_rate = 5e-4
learning_rate_dpsgd = 5e-4
patience = 10
tgt_class = 32 # start from 0
sequence_length = 128
class HP_Trec6_BOE:
batch_size = 16
learning_rate = 1e-4
learning_rate_dpsgd = 1e-4
patience = 10
tgt_class = 1 # start from 0
sequence_length = 128
# ===========
# CNN
# ===========
class HP_IMDB_CNN:
batch_size = 64
learning_rate = 1e-3
learning_rate_dpsgd = 1e-3
patience = 5
tgt_class = 1
sequence_length = 512
class HP_DBPedia_CNN:
batch_size = 32
learning_rate = 1e-3
learning_rate_dpsgd = 1e-3
patience = 2
tgt_class = 1 # start from 0
sequence_length = 256
class HP_Trec50_CNN:
batch_size = 128
learning_rate = 5e-4
learning_rate_dpsgd = 5e-4
patience = 10
tgt_class = 32 # start from 0
sequence_length = 128
class HP_Trec6_CNN:
batch_size = 16
learning_rate = 1e-4
learning_rate_dpsgd = 1e-4
patience = 10
tgt_class = 1 # start from 0
sequence_length = 128
# ===========
# BERT
# ===========
class HP_IMDB_BERT:
batch_size = 32
learning_rate = 1e-4
learning_rate_dpsgd = 1e-4
patience = 2
tgt_class = 1
sequence_length = 512
class HP_DBPedia_BERT:
batch_size = 32
learning_rate = 1e-4
learning_rate_dpsgd = 1e-4
patience = 1
tgt_class = 1 # start from 0
sequence_length = 256
class HP_Trec50_BERT:
batch_size = 128
learning_rate = 5e-4
learning_rate_dpsgd = 5e-4
patience = 10
tgt_class = 32 # start from 0
sequence_length = 128
class HP_Trec6_BERT:
batch_size = 16
learning_rate = 1e-4
learning_rate_dpsgd = 1e-4
patience = 5
tgt_class = 1 # start from 0
sequence_length = 128
| class Hp_Imdb_Boe:
batch_size = 64
learning_rate = 0.001
learning_rate_dpsgd = 0.001
patience = 5
tgt_class = 1
sequence_length = 512
class Hp_Dbpedia_Boe:
batch_size = 256
learning_rate = 0.001
learning_rate_dpsgd = 0.001
patience = 2
tgt_class = 1
sequence_length = 256
class Hp_Trec50_Boe:
batch_size = 128
learning_rate = 0.0005
learning_rate_dpsgd = 0.0005
patience = 10
tgt_class = 32
sequence_length = 128
class Hp_Trec6_Boe:
batch_size = 16
learning_rate = 0.0001
learning_rate_dpsgd = 0.0001
patience = 10
tgt_class = 1
sequence_length = 128
class Hp_Imdb_Cnn:
batch_size = 64
learning_rate = 0.001
learning_rate_dpsgd = 0.001
patience = 5
tgt_class = 1
sequence_length = 512
class Hp_Dbpedia_Cnn:
batch_size = 32
learning_rate = 0.001
learning_rate_dpsgd = 0.001
patience = 2
tgt_class = 1
sequence_length = 256
class Hp_Trec50_Cnn:
batch_size = 128
learning_rate = 0.0005
learning_rate_dpsgd = 0.0005
patience = 10
tgt_class = 32
sequence_length = 128
class Hp_Trec6_Cnn:
batch_size = 16
learning_rate = 0.0001
learning_rate_dpsgd = 0.0001
patience = 10
tgt_class = 1
sequence_length = 128
class Hp_Imdb_Bert:
batch_size = 32
learning_rate = 0.0001
learning_rate_dpsgd = 0.0001
patience = 2
tgt_class = 1
sequence_length = 512
class Hp_Dbpedia_Bert:
batch_size = 32
learning_rate = 0.0001
learning_rate_dpsgd = 0.0001
patience = 1
tgt_class = 1
sequence_length = 256
class Hp_Trec50_Bert:
batch_size = 128
learning_rate = 0.0005
learning_rate_dpsgd = 0.0005
patience = 10
tgt_class = 32
sequence_length = 128
class Hp_Trec6_Bert:
batch_size = 16
learning_rate = 0.0001
learning_rate_dpsgd = 0.0001
patience = 5
tgt_class = 1
sequence_length = 128 |
def get_azure_config(provider_config):
config_dict = {}
azure_storage_type = provider_config.get("azure_cloud_storage", {}).get("azure.storage.type")
if azure_storage_type:
config_dict["AZURE_STORAGE_TYPE"] = azure_storage_type
azure_storage_account = provider_config.get("azure_cloud_storage", {}).get("azure.storage.account")
if azure_storage_account:
config_dict["AZURE_STORAGE_ACCOUNT"] = azure_storage_account
azure_container = provider_config.get("azure_cloud_storage", {}).get(
"azure.container")
if azure_container:
config_dict["AZURE_CONTAINER"] = azure_container
azure_account_key = provider_config.get("azure_cloud_storage", {}).get(
"azure.account.key")
if azure_account_key:
config_dict["AZURE_ACCOUNT_KEY"] = azure_account_key
return config_dict
def _get_node_info(node):
node_info = {"node_id": node["name"].split("-")[-1],
"instance_type": node["vm_size"],
"private_ip": node["internal_ip"],
"public_ip": node["external_ip"],
"instance_status": node["status"]}
node_info.update(node["tags"])
return node_info
| def get_azure_config(provider_config):
config_dict = {}
azure_storage_type = provider_config.get('azure_cloud_storage', {}).get('azure.storage.type')
if azure_storage_type:
config_dict['AZURE_STORAGE_TYPE'] = azure_storage_type
azure_storage_account = provider_config.get('azure_cloud_storage', {}).get('azure.storage.account')
if azure_storage_account:
config_dict['AZURE_STORAGE_ACCOUNT'] = azure_storage_account
azure_container = provider_config.get('azure_cloud_storage', {}).get('azure.container')
if azure_container:
config_dict['AZURE_CONTAINER'] = azure_container
azure_account_key = provider_config.get('azure_cloud_storage', {}).get('azure.account.key')
if azure_account_key:
config_dict['AZURE_ACCOUNT_KEY'] = azure_account_key
return config_dict
def _get_node_info(node):
node_info = {'node_id': node['name'].split('-')[-1], 'instance_type': node['vm_size'], 'private_ip': node['internal_ip'], 'public_ip': node['external_ip'], 'instance_status': node['status']}
node_info.update(node['tags'])
return node_info |
"""
Blog app for the CDH website.
Similar to the built-in grappelli blog, but allows multiple authors
(other than the current user) to be associated with a post.
"""
default_app_config = "cdhweb.blog.apps.BlogConfig"
| """
Blog app for the CDH website.
Similar to the built-in grappelli blog, but allows multiple authors
(other than the current user) to be associated with a post.
"""
default_app_config = 'cdhweb.blog.apps.BlogConfig' |
backslashes_test_text_001 = '''
string = 'string'
'''
backslashes_test_text_002 = '''
string = 'string_start \\
string end'
'''
backslashes_test_text_003 = '''
if arg_one is not None \\
and arg_two is None:
pass
'''
backslashes_test_text_004 = '''
string = \'\'\'
text \\\\
text
\'\'\'
'''
| backslashes_test_text_001 = "\nstring = 'string'\n"
backslashes_test_text_002 = "\nstring = 'string_start \\\n string end'\n"
backslashes_test_text_003 = '\nif arg_one is not None \\\n and arg_two is None:\n pass\n'
backslashes_test_text_004 = "\nstring = '''\n text \\\\\n text\n'''\n" |
# 1
def front_two_back_two(input_string):
return '' if len(input_string) < 2 else input_string[:2] + input_string[-2:]
# 2
def kelvin_to_celsius(k):
return k - 273.15
# 2
def kelvin_to_fahrenheit(k):
return kelvin_to_celsius(k) * 9.0 / 5.0 + 32.0
# 4
def min_max_sum(input_list):
return [min(input_list), max(input_list), sum(input_list)]
# 5
def print_square():
squares_map = {base: base * base for base in range(1, 16)}
print(squares_map)
| def front_two_back_two(input_string):
return '' if len(input_string) < 2 else input_string[:2] + input_string[-2:]
def kelvin_to_celsius(k):
return k - 273.15
def kelvin_to_fahrenheit(k):
return kelvin_to_celsius(k) * 9.0 / 5.0 + 32.0
def min_max_sum(input_list):
return [min(input_list), max(input_list), sum(input_list)]
def print_square():
squares_map = {base: base * base for base in range(1, 16)}
print(squares_map) |
class Data:
def __init__(self, dia, mes, ano):
self.dia = dia
self.mes = mes
self.ano = ano
print(self)
@classmethod
def de_string(cls, data_string):
dia, mes, ano = map(int, data_string.split('-'))
data = cls(dia, mes, ano)
return data
@staticmethod
def is_date_valid(data_string):
dia, mes, ano = map(int, data_string.split('-'))
return dia <= 31 and mes <= 12 and ano <= 2020
data = Data(31, 7, 1996)
data1 = Data.de_string('31-07-1996')
print(data1)
print(data1.is_date_valid('31-07-1996')) | class Data:
def __init__(self, dia, mes, ano):
self.dia = dia
self.mes = mes
self.ano = ano
print(self)
@classmethod
def de_string(cls, data_string):
(dia, mes, ano) = map(int, data_string.split('-'))
data = cls(dia, mes, ano)
return data
@staticmethod
def is_date_valid(data_string):
(dia, mes, ano) = map(int, data_string.split('-'))
return dia <= 31 and mes <= 12 and (ano <= 2020)
data = data(31, 7, 1996)
data1 = Data.de_string('31-07-1996')
print(data1)
print(data1.is_date_valid('31-07-1996')) |
# author: Fei Gao
#
# Evaluate Reverse Polish Notation
#
# Evaluate the value of an arithmetic expression in Reverse Polish Notation.
# Valid operators are +, -, *, /. Each operand may be an integer or another expression.
# Some examples:
# ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
# ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
class Solution:
# @param tokens, a list of string
# @return an integer
def evalRPN(self, tokens):
if not tokens:
return None
op = {'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y,
'/': lambda x, y: int(float(x) / y)}
# note that python handle div differently!
# py2, py3, and C/C++/Java may get all distinct results
queue = list()
for val in tokens:
if isinstance(val, list):
queue.append(self.evalRPN(val))
elif val in op:
o2 = queue.pop()
o1 = queue.pop()
queue.append(op[val](o1, o2))
else:
queue.append(int(val))
return queue[-1]
def main():
solver = Solution()
tests = [["2", "1", "+", "3", "*"],
["4", "13", "5", "/", "+"],
[["2", "1", "+", "3", "*"], "13", "5", "/", "+"],
["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"]] # 22
for test in tests:
print(test)
result = solver.evalRPN(test)
print(' ->')
print(result)
print('~' * 10)
pass
if __name__ == '__main__':
main()
pass
| class Solution:
def eval_rpn(self, tokens):
if not tokens:
return None
op = {'+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: int(float(x) / y)}
queue = list()
for val in tokens:
if isinstance(val, list):
queue.append(self.evalRPN(val))
elif val in op:
o2 = queue.pop()
o1 = queue.pop()
queue.append(op[val](o1, o2))
else:
queue.append(int(val))
return queue[-1]
def main():
solver = solution()
tests = [['2', '1', '+', '3', '*'], ['4', '13', '5', '/', '+'], [['2', '1', '+', '3', '*'], '13', '5', '/', '+'], ['10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+']]
for test in tests:
print(test)
result = solver.evalRPN(test)
print(' ->')
print(result)
print('~' * 10)
pass
if __name__ == '__main__':
main()
pass |
ROUTE_MIDDLEWARE = {
'test': 'app.http.middleware.MiddlewareTest.MiddlewareTest',
'middleware.test': [
'app.http.middleware.MiddlewareTest.MiddlewareTest',
'app.http.middleware.AddAttributeMiddleware.AddAttributeMiddleware'
]
}
| route_middleware = {'test': 'app.http.middleware.MiddlewareTest.MiddlewareTest', 'middleware.test': ['app.http.middleware.MiddlewareTest.MiddlewareTest', 'app.http.middleware.AddAttributeMiddleware.AddAttributeMiddleware']} |
"""
* how to use:
to be used you must declare how many parity bits (sizePari)
you want to include in the message.
it is desired (for test purposes) to select a bit to be set
as an error. This serves to check whether the code is working correctly.
Lastly, the variable of the message/word that must be desired to be
encoded (text).
* how this work:
declaration of variables (sizePari, be, text)
converts the message/word (text) to binary using the
text_to_bits function
encodes the message using the rules of hamming encoding
decodes the message using the rules of hamming encoding
print the original message, the encoded message and the
decoded message
forces an error in the coded text variable
decodes the message that was forced the error
print the original message, the encoded message, the bit changed
message and the decoded message.
* All
""" | """
* how to use:
to be used you must declare how many parity bits (sizePari)
you want to include in the message.
it is desired (for test purposes) to select a bit to be set
as an error. This serves to check whether the code is working correctly.
Lastly, the variable of the message/word that must be desired to be
encoded (text).
* how this work:
declaration of variables (sizePari, be, text)
converts the message/word (text) to binary using the
text_to_bits function
encodes the message using the rules of hamming encoding
decodes the message using the rules of hamming encoding
print the original message, the encoded message and the
decoded message
forces an error in the coded text variable
decodes the message that was forced the error
print the original message, the encoded message, the bit changed
message and the decoded message.
* All
""" |
# file creation
myfile1 = open("truncate.txt", "w")
# writing data to the file
myfile1.write("Python is a user-friendly language for beginners")
# file truncating to 30 bytes
myfile1.truncate(30)
# file is getting closed
myfile1.close()
# file reading and displaying the text
myfile2 = open("truncate.txt", "r")
print(myfile2.read())
# closing the file
myfile2.close()
| myfile1 = open('truncate.txt', 'w')
myfile1.write('Python is a user-friendly language for beginners')
myfile1.truncate(30)
myfile1.close()
myfile2 = open('truncate.txt', 'r')
print(myfile2.read())
myfile2.close() |
"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def protobuf_deps():
"""Loads common dependencies needed to compile the protobuf library."""
if not native.existing_rule("zlib"):
http_archive(
name = "zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
)
if not native.existing_rule("six"):
http_archive(
name = "six",
build_file = "@//:six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
urls = ["https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55"],
)
if not native.existing_rule("rules_cc"):
http_archive(
name = "rules_cc",
sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"],
)
if not native.existing_rule("rules_java"):
http_archive(
name = "rules_java",
sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
)
if not native.existing_rule("rules_proto"):
http_archive(
name = "rules_proto",
sha256 = "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d",
strip_prefix = "rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4",
urls = ["https://github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz"],
)
| """Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def protobuf_deps():
"""Loads common dependencies needed to compile the protobuf library."""
if not native.existing_rule('zlib'):
http_archive(name='zlib', build_file='@com_google_protobuf//:third_party/zlib.BUILD', sha256='c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1', strip_prefix='zlib-1.2.11', urls=['https://zlib.net/zlib-1.2.11.tar.gz'])
if not native.existing_rule('six'):
http_archive(name='six', build_file='@//:six.BUILD', sha256='105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a', urls=['https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55'])
if not native.existing_rule('rules_cc'):
http_archive(name='rules_cc', sha256='29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec', strip_prefix='rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e', urls=['https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz'])
if not native.existing_rule('rules_java'):
http_archive(name='rules_java', sha256='f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3', strip_prefix='rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd', urls=['https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz'])
if not native.existing_rule('rules_proto'):
http_archive(name='rules_proto', sha256='88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d', strip_prefix='rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4', urls=['https://github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz']) |
# Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class MistralError(Exception):
"""Mistral specific error.
Reserved for situations that can't automatically handled. When it occurs
it signals that there is a major environmental problem like invalid startup
configuration or implementation problem (e.g. some code doesn't take care
of certain corner cases). From architectural perspective it's pointless to
try to handle this type of problems except doing some finalization work
like transaction rollback, deleting temporary files etc.
"""
def __init__(self, message=None):
super(MistralError, self).__init__(message)
class MistralException(Exception):
"""Mistral specific exception.
Reserved for situations that are not critical for program continuation.
It is possible to recover from this type of problems automatically and
continue program execution. Such problems may be related with invalid user
input (such as invalid syntax) or temporary environmental problems.
In case if an instance of a certain exception type bubbles up to API layer
then this type of exception it must be associated with an http code so it's
clear how to represent it for a client.
To correctly use this class, inherit from it and define a 'message' and
'http_code' properties.
"""
message = "An unknown exception occurred"
http_code = 500
@property
def code(self):
"""This is here for webob to read.
https://github.com/Pylons/webob/blob/master/webob/exc.py
"""
return self.http_code
def __str__(self):
return self.message
def __init__(self, message=None):
if message is not None:
self.message = message
super(MistralException, self).__init__(
'%d: %s' % (self.http_code, self.message))
# Database exceptions.
class DBException(MistralException):
http_code = 400
class DBDuplicateEntryException(DBException):
http_code = 409
message = "Database object already exists"
class DBQueryEntryException(DBException):
http_code = 400
class DBEntityNotFoundException(DBException):
http_code = 404
message = "Object not found"
# DSL exceptions.
class DSLParsingException(MistralException):
http_code = 400
class YaqlGrammarException(DSLParsingException):
http_code = 400
message = "Invalid grammar of YAQL expression"
class InvalidModelException(DSLParsingException):
http_code = 400
message = "Wrong entity definition"
# Various common exceptions.
class YaqlEvaluationException(MistralException):
http_code = 400
message = "Can not evaluate YAQL expression"
class DataAccessException(MistralException):
http_code = 400
class ActionException(MistralException):
http_code = 400
class InvalidActionException(MistralException):
http_code = 400
class ActionRegistrationException(MistralException):
message = "Failed to register action"
class EngineException(MistralException):
http_code = 500
class WorkflowException(MistralException):
http_code = 400
class InputException(MistralException):
http_code = 400
class ApplicationContextNotFoundException(MistralException):
http_code = 400
message = "Application context not found"
class InvalidResultException(MistralException):
http_code = 400
message = "Unable to parse result"
class SizeLimitExceededException(MistralException):
http_code = 400
def __init__(self, field_name, size_kb, size_limit_kb):
super(SizeLimitExceededException, self).__init__(
"Size of '%s' is %dKB which exceeds the limit of %dKB"
% (field_name, size_kb, size_limit_kb))
class CoordinationException(MistralException):
http_code = 500
class NotAllowedException(MistralException):
http_code = 403
message = "Operation not allowed"
| class Mistralerror(Exception):
"""Mistral specific error.
Reserved for situations that can't automatically handled. When it occurs
it signals that there is a major environmental problem like invalid startup
configuration or implementation problem (e.g. some code doesn't take care
of certain corner cases). From architectural perspective it's pointless to
try to handle this type of problems except doing some finalization work
like transaction rollback, deleting temporary files etc.
"""
def __init__(self, message=None):
super(MistralError, self).__init__(message)
class Mistralexception(Exception):
"""Mistral specific exception.
Reserved for situations that are not critical for program continuation.
It is possible to recover from this type of problems automatically and
continue program execution. Such problems may be related with invalid user
input (such as invalid syntax) or temporary environmental problems.
In case if an instance of a certain exception type bubbles up to API layer
then this type of exception it must be associated with an http code so it's
clear how to represent it for a client.
To correctly use this class, inherit from it and define a 'message' and
'http_code' properties.
"""
message = 'An unknown exception occurred'
http_code = 500
@property
def code(self):
"""This is here for webob to read.
https://github.com/Pylons/webob/blob/master/webob/exc.py
"""
return self.http_code
def __str__(self):
return self.message
def __init__(self, message=None):
if message is not None:
self.message = message
super(MistralException, self).__init__('%d: %s' % (self.http_code, self.message))
class Dbexception(MistralException):
http_code = 400
class Dbduplicateentryexception(DBException):
http_code = 409
message = 'Database object already exists'
class Dbqueryentryexception(DBException):
http_code = 400
class Dbentitynotfoundexception(DBException):
http_code = 404
message = 'Object not found'
class Dslparsingexception(MistralException):
http_code = 400
class Yaqlgrammarexception(DSLParsingException):
http_code = 400
message = 'Invalid grammar of YAQL expression'
class Invalidmodelexception(DSLParsingException):
http_code = 400
message = 'Wrong entity definition'
class Yaqlevaluationexception(MistralException):
http_code = 400
message = 'Can not evaluate YAQL expression'
class Dataaccessexception(MistralException):
http_code = 400
class Actionexception(MistralException):
http_code = 400
class Invalidactionexception(MistralException):
http_code = 400
class Actionregistrationexception(MistralException):
message = 'Failed to register action'
class Engineexception(MistralException):
http_code = 500
class Workflowexception(MistralException):
http_code = 400
class Inputexception(MistralException):
http_code = 400
class Applicationcontextnotfoundexception(MistralException):
http_code = 400
message = 'Application context not found'
class Invalidresultexception(MistralException):
http_code = 400
message = 'Unable to parse result'
class Sizelimitexceededexception(MistralException):
http_code = 400
def __init__(self, field_name, size_kb, size_limit_kb):
super(SizeLimitExceededException, self).__init__("Size of '%s' is %dKB which exceeds the limit of %dKB" % (field_name, size_kb, size_limit_kb))
class Coordinationexception(MistralException):
http_code = 500
class Notallowedexception(MistralException):
http_code = 403
message = 'Operation not allowed' |
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0:
return []
ret = [[1]]
for i in range(1, numRows):
tmp = []
for j in range(i + 1):
if j == 0:
tmp.append(ret[i - 1][j])
elif j == i:
tmp.append(ret[i - 1][j - 1])
else:
tmp.append(ret[i - 1][j] + ret[i - 1][j - 1])
ret.append(tmp)
return ret | class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0:
return []
ret = [[1]]
for i in range(1, numRows):
tmp = []
for j in range(i + 1):
if j == 0:
tmp.append(ret[i - 1][j])
elif j == i:
tmp.append(ret[i - 1][j - 1])
else:
tmp.append(ret[i - 1][j] + ret[i - 1][j - 1])
ret.append(tmp)
return ret |
class NamingUtils(object):
'''
Utilities related to object naming
'''
@classmethod
def createUniqueMnemonic(cls, mnem, unitMap):
""" If mnemonic exists in dict appends a _x where x is an int """
result = mnem
if mnem in unitMap:
suffix = 1
while (mnem + "_" + str(suffix)) in unitMap:
suffix += 1
result = mnem + "_" + str(suffix)
return result | class Namingutils(object):
"""
Utilities related to object naming
"""
@classmethod
def create_unique_mnemonic(cls, mnem, unitMap):
""" If mnemonic exists in dict appends a _x where x is an int """
result = mnem
if mnem in unitMap:
suffix = 1
while mnem + '_' + str(suffix) in unitMap:
suffix += 1
result = mnem + '_' + str(suffix)
return result |
a = {'C', 'C++', 'Java'}
b = {'C++', 'Java', 'Python'}
c = {'java', 'Python', 'C', 'pascal'}
# who known all three subject
u = a.union(b).union(c)
print("Union", u)
# find subject known to A and not to B
i = a.intersection(b)
print("Intersection", i)
diff1 = a.difference(b)
print(a, b, "C-F", diff1)
#find a subject who only know only one student
studentswhoknowonlypascal=[]
if "pascal " in a:
studentswhoknowonlypascal.append("A")
if "pascal" in b:
studentswhoknowonlypascal.append("B")
if "pascal" in c:
studentswhoknowonlypascal.append("C")
print(studentswhoknowonlypascal)
# find a student who only know Python
studentswhoknowpython=[]
if "Python" in a:
studentswhoknowpython.append("A")
if "Python" in b:
studentswhoknowpython.append("B")
if "Python" in c:
studentswhoknowpython.append("C")
print(studentswhoknowpython)
#find subject who known all three
i = a.intersection(b).intersection(c)
diff1 = a.difference(b).difference(c)
print("C-F", diff1)
| a = {'C', 'C++', 'Java'}
b = {'C++', 'Java', 'Python'}
c = {'java', 'Python', 'C', 'pascal'}
u = a.union(b).union(c)
print('Union', u)
i = a.intersection(b)
print('Intersection', i)
diff1 = a.difference(b)
print(a, b, 'C-F', diff1)
studentswhoknowonlypascal = []
if 'pascal ' in a:
studentswhoknowonlypascal.append('A')
if 'pascal' in b:
studentswhoknowonlypascal.append('B')
if 'pascal' in c:
studentswhoknowonlypascal.append('C')
print(studentswhoknowonlypascal)
studentswhoknowpython = []
if 'Python' in a:
studentswhoknowpython.append('A')
if 'Python' in b:
studentswhoknowpython.append('B')
if 'Python' in c:
studentswhoknowpython.append('C')
print(studentswhoknowpython)
i = a.intersection(b).intersection(c)
diff1 = a.difference(b).difference(c)
print('C-F', diff1) |
nk = input().split()
n = int(nk[0])
k = int(nk[1])
r = int(input())
c = int(input())
o = []
z=0
for _ in range(k):
o.append(list(map(int, input().rstrip().split())))
l=[]
p=[]
a=[]
for i in range(n):
l=l+[0]
for i in range(n):
l[i]=[0]*n
l[r-1][c-1]=1
for i in range(len(o)):
l[o[i][0]-1][o[i][1]-1]=2
print(l)
for i in range(n):
for j in range(n):
if(l[i][j]==2):
a.append(abs(r-i))
p.append(abs(c-j))
print(a)
print(p)
for i in a:
if(i>1):
for j in range(i):
z=z+j
print(z)
for i in p:
if(i>1):
for j in range(i):
z=z+j
print(z)
print(z)
| nk = input().split()
n = int(nk[0])
k = int(nk[1])
r = int(input())
c = int(input())
o = []
z = 0
for _ in range(k):
o.append(list(map(int, input().rstrip().split())))
l = []
p = []
a = []
for i in range(n):
l = l + [0]
for i in range(n):
l[i] = [0] * n
l[r - 1][c - 1] = 1
for i in range(len(o)):
l[o[i][0] - 1][o[i][1] - 1] = 2
print(l)
for i in range(n):
for j in range(n):
if l[i][j] == 2:
a.append(abs(r - i))
p.append(abs(c - j))
print(a)
print(p)
for i in a:
if i > 1:
for j in range(i):
z = z + j
print(z)
for i in p:
if i > 1:
for j in range(i):
z = z + j
print(z)
print(z) |
name = "generators"
"""
The generators module
"""
| name = 'generators'
'\nThe generators module\n' |
def eig(a):
# TODO(beam2d): Implement it
raise NotImplementedError
def eigh(a, UPLO='L'):
# TODO(beam2d): Implement it
raise NotImplementedError
def eigvals(a):
# TODO(beam2d): Implement it
raise NotImplementedError
def eigvalsh(a, UPLO='L'):
# TODO(beam2d): Implement it
raise NotImplementedError
| def eig(a):
raise NotImplementedError
def eigh(a, UPLO='L'):
raise NotImplementedError
def eigvals(a):
raise NotImplementedError
def eigvalsh(a, UPLO='L'):
raise NotImplementedError |
# ex1116 Dividindo x por y
n = int(input())
for c in range(1, n + 1):
x, y = map(float, input().split())
if x > y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
elif x > y and y == 0:
print('divisao impossivel')
if x < y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
elif x == y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
if x < y and y == 0:
print('divisao impossivel')
| n = int(input())
for c in range(1, n + 1):
(x, y) = map(float, input().split())
if x > y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
elif x > y and y == 0:
print('divisao impossivel')
if x < y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
elif x == y and y != 0:
divisao = x / y
print('{:.1f}'.format(divisao))
if x < y and y == 0:
print('divisao impossivel') |
# https://leetcode.com/problems/valid-perfect-square
class Solution:
def isPerfectSquare(self, num):
if num == 1:
return True
l, r = 1, num
while l <= r:
mid = (l + r) // 2
if mid ** 2 == num:
return True
elif mid ** 2 < num:
l = mid + 1
else:
r = mid - 1
return False
| class Solution:
def is_perfect_square(self, num):
if num == 1:
return True
(l, r) = (1, num)
while l <= r:
mid = (l + r) // 2
if mid ** 2 == num:
return True
elif mid ** 2 < num:
l = mid + 1
else:
r = mid - 1
return False |
'''
Color Pallette
'''
# Generic Stuff
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
# Pane Colors
PANE1 = (236, 236, 236)
PANE2 = (255, 255, 255)
PANE3 = (236, 236, 236)
# Player Color
PLAYER_COLOR = BLACK
# Reds
RED_POMEGRANATE = (242, 38, 19)
RED_THUNDERBIRD = (217, 30, 24)
RED_FLAMINGO = (239, 72, 54)
RED_RAZZMATAZZ = (219, 10, 91)
RED_RADICALRED = (246, 36, 89)
RED_ECSTASY = (249, 105, 14)
RED_RYANRILEY = ( 15, 1, 12)
RED = [ RED_POMEGRANATE,
RED_THUNDERBIRD,
RED_FLAMINGO,
RED_RAZZMATAZZ,
RED_RADICALRED,
RED_ECSTASY,
RED_RYANRILEY
]
# Blues
BLUE_REBECCAPURPLE = (102, 51, 153)
BLUE_MEDIUMPURPLE = (191, 85, 236)
BLUE_STUDIO = (142, 68, 173)
BLUE_PICTONBLUE = ( 34, 167, 240)
BLUE_EBONYCLUE = ( 34, 49, 63)
BLUE_JELLYBEAN = ( 37, 116, 169)
BLUE_JORDYBLUE = (137, 196, 244)
BLUE_KELLYRIVERS = ( 0, 15, 112)
BLUE = [ BLUE_REBECCAPURPLE,
BLUE_MEDIUMPURPLE,
BLUE_STUDIO,
BLUE_PICTONBLUE,
BLUE_EBONYCLUE,
BLUE_JELLYBEAN,
BLUE_JORDYBLUE,
BLUE_KELLYRIVERS,
]
# Greens
GREEN_MALACHITE = ( 0, 230, 64)
GREEN_TURQUOISE = ( 78, 205, 196)
GREEN_EUCALYPTUS = ( 38, 166, 91)
GREEN_MOUNTAIN = ( 27, 188, 155)
GREEN_SHAMROCK = ( 46, 204, 113)
GREEN_SALEM = ( 30, 130, 76)
GREEN = [ GREEN_MALACHITE,
GREEN_TURQUOISE,
GREEN_EUCALYPTUS,
GREEN_MOUNTAIN,
GREEN_SHAMROCK,
GREEN_SALEM
]
COLORS = RED + BLUE + GREEN
| """
Color Pallette
"""
black = (0, 0, 0)
white = (255, 255, 255)
pane1 = (236, 236, 236)
pane2 = (255, 255, 255)
pane3 = (236, 236, 236)
player_color = BLACK
red_pomegranate = (242, 38, 19)
red_thunderbird = (217, 30, 24)
red_flamingo = (239, 72, 54)
red_razzmatazz = (219, 10, 91)
red_radicalred = (246, 36, 89)
red_ecstasy = (249, 105, 14)
red_ryanriley = (15, 1, 12)
red = [RED_POMEGRANATE, RED_THUNDERBIRD, RED_FLAMINGO, RED_RAZZMATAZZ, RED_RADICALRED, RED_ECSTASY, RED_RYANRILEY]
blue_rebeccapurple = (102, 51, 153)
blue_mediumpurple = (191, 85, 236)
blue_studio = (142, 68, 173)
blue_pictonblue = (34, 167, 240)
blue_ebonyclue = (34, 49, 63)
blue_jellybean = (37, 116, 169)
blue_jordyblue = (137, 196, 244)
blue_kellyrivers = (0, 15, 112)
blue = [BLUE_REBECCAPURPLE, BLUE_MEDIUMPURPLE, BLUE_STUDIO, BLUE_PICTONBLUE, BLUE_EBONYCLUE, BLUE_JELLYBEAN, BLUE_JORDYBLUE, BLUE_KELLYRIVERS]
green_malachite = (0, 230, 64)
green_turquoise = (78, 205, 196)
green_eucalyptus = (38, 166, 91)
green_mountain = (27, 188, 155)
green_shamrock = (46, 204, 113)
green_salem = (30, 130, 76)
green = [GREEN_MALACHITE, GREEN_TURQUOISE, GREEN_EUCALYPTUS, GREEN_MOUNTAIN, GREEN_SHAMROCK, GREEN_SALEM]
colors = RED + BLUE + GREEN |
lista = list()
vezesInput = 0
while vezesInput < 6:
valor = float(input())
if valor > 0:
lista.append(valor)
vezesInput += 1
print(f'{len(lista)} valores positivos') | lista = list()
vezes_input = 0
while vezesInput < 6:
valor = float(input())
if valor > 0:
lista.append(valor)
vezes_input += 1
print(f'{len(lista)} valores positivos') |
# -*- coding: utf-8 -*-
# This file is generated from NI Switch Executive API metadata version 19.1.0d1
enums = {
'ExpandAction': {
'values': [
{
'documentation': {
'description': 'Expand to routes'
},
'name': 'NISE_VAL_EXPAND_TO_ROUTES',
'value': 0
},
{
'documentation': {
'description': 'Expand to paths'
},
'name': 'NISE_VAL_EXPAND_TO_PATHS',
'value': 1
}
]
},
'MulticonnectMode': {
'values': [
{
'documentation': {
'description': 'Default'
},
'name': 'NISE_VAL_DEFAULT',
'value': -1
},
{
'documentation': {
'description': 'No multiconnect'
},
'name': 'NISE_VAL_NO_MULTICONNECT',
'value': 0
},
{
'documentation': {
'description': 'Multiconnect'
},
'name': 'NISE_VAL_MULTICONNECT',
'value': 1
}
]
},
'OperationOrder': {
'values': [
{
'documentation': {
'description': 'Break before make'
},
'name': 'NISE_VAL_BREAK_BEFORE_MAKE',
'value': 1
},
{
'documentation': {
'description': 'Break after make'
},
'name': 'NISE_VAL_BREAK_AFTER_MAKE',
'value': 2
}
]
},
'PathCapability': {
'values': [
{
'documentation': {
'description': 'Path needs hardwire'
},
'name': 'NISE_VAL_PATH_NEEDS_HARDWIRE',
'value': -2
},
{
'documentation': {
'description': 'Path needs config channel'
},
'name': 'NISE_VAL_PATH_NEEDS_CONFIG_CHANNEL',
'value': -1
},
{
'documentation': {
'description': 'Path available'
},
'name': 'NISE_VAL_PATH_AVAILABLE',
'value': 1
},
{
'documentation': {
'description': 'Path exists'
},
'name': 'NISE_VAL_PATH_EXISTS',
'value': 2
},
{
'documentation': {
'description': 'Path Unsupported'
},
'name': 'NISE_VAL_PATH_UNSUPPORTED',
'value': 3
},
{
'documentation': {
'description': 'Resource in use'
},
'name': 'NISE_VAL_RESOURCE_IN_USE',
'value': 4
},
{
'documentation': {
'description': 'Exclusion conflict'
},
'name': 'NISE_VAL_EXCLUSION_CONFLICT',
'value': 5
},
{
'documentation': {
'description': 'Channel not available'
},
'name': 'NISE_VAL_CHANNEL_NOT_AVAILABLE',
'value': 6
},
{
'documentation': {
'description': 'Channels hardwired'
},
'name': 'NISE_VAL_CHANNELS_HARDWIRED',
'value': 7
}
]
}
}
| enums = {'ExpandAction': {'values': [{'documentation': {'description': 'Expand to routes'}, 'name': 'NISE_VAL_EXPAND_TO_ROUTES', 'value': 0}, {'documentation': {'description': 'Expand to paths'}, 'name': 'NISE_VAL_EXPAND_TO_PATHS', 'value': 1}]}, 'MulticonnectMode': {'values': [{'documentation': {'description': 'Default'}, 'name': 'NISE_VAL_DEFAULT', 'value': -1}, {'documentation': {'description': 'No multiconnect'}, 'name': 'NISE_VAL_NO_MULTICONNECT', 'value': 0}, {'documentation': {'description': 'Multiconnect'}, 'name': 'NISE_VAL_MULTICONNECT', 'value': 1}]}, 'OperationOrder': {'values': [{'documentation': {'description': 'Break before make'}, 'name': 'NISE_VAL_BREAK_BEFORE_MAKE', 'value': 1}, {'documentation': {'description': 'Break after make'}, 'name': 'NISE_VAL_BREAK_AFTER_MAKE', 'value': 2}]}, 'PathCapability': {'values': [{'documentation': {'description': 'Path needs hardwire'}, 'name': 'NISE_VAL_PATH_NEEDS_HARDWIRE', 'value': -2}, {'documentation': {'description': 'Path needs config channel'}, 'name': 'NISE_VAL_PATH_NEEDS_CONFIG_CHANNEL', 'value': -1}, {'documentation': {'description': 'Path available'}, 'name': 'NISE_VAL_PATH_AVAILABLE', 'value': 1}, {'documentation': {'description': 'Path exists'}, 'name': 'NISE_VAL_PATH_EXISTS', 'value': 2}, {'documentation': {'description': 'Path Unsupported'}, 'name': 'NISE_VAL_PATH_UNSUPPORTED', 'value': 3}, {'documentation': {'description': 'Resource in use'}, 'name': 'NISE_VAL_RESOURCE_IN_USE', 'value': 4}, {'documentation': {'description': 'Exclusion conflict'}, 'name': 'NISE_VAL_EXCLUSION_CONFLICT', 'value': 5}, {'documentation': {'description': 'Channel not available'}, 'name': 'NISE_VAL_CHANNEL_NOT_AVAILABLE', 'value': 6}, {'documentation': {'description': 'Channels hardwired'}, 'name': 'NISE_VAL_CHANNELS_HARDWIRED', 'value': 7}]}} |
"""Utility functions."""
def generate_query_string(query_params):
"""Generate a query string given kwargs dictionary."""
query_frags = [
str(key) + "=" + str(value) for key, value in query_params.items()
]
query_str = "&".join(query_frags)
return query_str
| """Utility functions."""
def generate_query_string(query_params):
"""Generate a query string given kwargs dictionary."""
query_frags = [str(key) + '=' + str(value) for (key, value) in query_params.items()]
query_str = '&'.join(query_frags)
return query_str |
# Click trackpad of first controller by "C" key
alvr.buttons[0][alvr.Id("trackpad_click")] = keyboard.getKeyDown(Key.C)
alvr.buttons[0][alvr.Id("trackpad_touch")] = keyboard.getKeyDown(Key.C)
# Move trackpad position by arrow keys
if keyboard.getKeyDown(Key.LeftArrow):
alvr.trackpad[0][0] = -1.0
alvr.trackpad[0][1] = 0.0
elif keyboard.getKeyDown(Key.UpArrow):
alvr.trackpad[0][0] = 0.0
alvr.trackpad[0][1] = 1.0
elif keyboard.getKeyDown(Key.RightArrow):
alvr.trackpad[0][0] = 1.0
alvr.trackpad[0][1] = 0.0
elif keyboard.getKeyDown(Key.DownArrow):
alvr.trackpad[0][0] = 0.0
alvr.trackpad[0][1] = -1.0
| alvr.buttons[0][alvr.Id('trackpad_click')] = keyboard.getKeyDown(Key.C)
alvr.buttons[0][alvr.Id('trackpad_touch')] = keyboard.getKeyDown(Key.C)
if keyboard.getKeyDown(Key.LeftArrow):
alvr.trackpad[0][0] = -1.0
alvr.trackpad[0][1] = 0.0
elif keyboard.getKeyDown(Key.UpArrow):
alvr.trackpad[0][0] = 0.0
alvr.trackpad[0][1] = 1.0
elif keyboard.getKeyDown(Key.RightArrow):
alvr.trackpad[0][0] = 1.0
alvr.trackpad[0][1] = 0.0
elif keyboard.getKeyDown(Key.DownArrow):
alvr.trackpad[0][0] = 0.0
alvr.trackpad[0][1] = -1.0 |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def flatten(root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
if not root:
return
stack = [root]
pre = None
while stack:
node = stack.pop()
if pre:
pre.left = None
pre.right = node
if node.right:
stack.append(node.right)
if node.left:
stack.append(node.left)
pre = node
if __name__ == "__main__" :
root = TreeNode(1)
root.left = TreeNode(2)
root.right = TreeNode(5)
root.left.left = TreeNode(3)
root.left.right = TreeNode(4)
root.right.right = TreeNode(6)
flatten(root)
| class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def flatten(root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
if not root:
return
stack = [root]
pre = None
while stack:
node = stack.pop()
if pre:
pre.left = None
pre.right = node
if node.right:
stack.append(node.right)
if node.left:
stack.append(node.left)
pre = node
if __name__ == '__main__':
root = tree_node(1)
root.left = tree_node(2)
root.right = tree_node(5)
root.left.left = tree_node(3)
root.left.right = tree_node(4)
root.right.right = tree_node(6)
flatten(root) |
"""
In Python, there are three different numeric types. These are "int",
"float" and "complex".
Documentation - https://www.w3schools.com/python/python_numbers.asp
Below we will look at all three different types.
"""
"""
"int", or integer, is a whole number, positive or negative, without decimals
and has an unlimited length.
Below are a few examples of integers
"""
int_1 = 1
int_2 = 3248092309348023743
int_3 = -1232
print(type(int_1), type(int_2), type(int_3)) # This will log - <class 'int'> <class 'int'> <class 'int'>
"""
"float", or "floating point number" is a number, positive or negative, that
contains one or more decimals. A "float" can also be scientific numbers with an
"e" to indicate the power of 10
Below are a few examples of this.
"""
float_1 = 1.12342340
float_2 = 1.0
float_3 = -35.59
float_4 = 35e3 # 35000.0
float_5 = 12E4 # 120000.0
float_6 = -87.7e100 # -8.77e+101
# This will log - <class 'float'> <class 'float'> <class 'float'> <class 'float'> <class 'float'> <class 'float'>
print(type(float_1), type(float_2), type(float_3), type(float_4), type(float_5), type(float_6))
"""
"complex" numbers are written with a "j" as the imaginary part.
""" | """
In Python, there are three different numeric types. These are "int",
"float" and "complex".
Documentation - https://www.w3schools.com/python/python_numbers.asp
Below we will look at all three different types.
"""
'\n"int", or integer, is a whole number, positive or negative, without decimals\nand has an unlimited length.\n\nBelow are a few examples of integers\n'
int_1 = 1
int_2 = 3248092309348023743
int_3 = -1232
print(type(int_1), type(int_2), type(int_3))
'\n"float", or "floating point number" is a number, positive or negative, that\ncontains one or more decimals. A "float" can also be scientific numbers with an\n"e" to indicate the power of 10\n\nBelow are a few examples of this.\n'
float_1 = 1.1234234
float_2 = 1.0
float_3 = -35.59
float_4 = 35000.0
float_5 = 120000.0
float_6 = -8.77e+101
print(type(float_1), type(float_2), type(float_3), type(float_4), type(float_5), type(float_6))
'\n"complex" numbers are written with a "j" as the imaginary part.\n' |
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
'''
T: O(n2 * n1 log n1); can be reduced to O(n2 * n1) by using char counter
S: O(n1); can be reduced to O(26) = O(1) by using character counting array
'''
n1, n2 = len(s1), len(s2)
s1 = sorted(s1)
for i in range(n2 - n1 + 1):
if s1 == sorted(s2[i:i+n1]):
return True
return False
| class Solution:
def check_inclusion(self, s1: str, s2: str) -> bool:
"""
T: O(n2 * n1 log n1); can be reduced to O(n2 * n1) by using char counter
S: O(n1); can be reduced to O(26) = O(1) by using character counting array
"""
(n1, n2) = (len(s1), len(s2))
s1 = sorted(s1)
for i in range(n2 - n1 + 1):
if s1 == sorted(s2[i:i + n1]):
return True
return False |
#!/usr/bin/env python3
# MIT License
# Copyright (c) 2020 pixelbubble
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# based on https://github.com/pixelbubble/ProtOSINT/blob/main/protosint.py
def generate_accounts():
firstName = input("First name: ").lower()
lastName = input("Last name: ").lower()
yearOfBirth = input("Year of birth: ")
pseudo = input("Username (optional): ").lower()
zipCode = input("Zip code (optional): ")
results_list = []
results_list.append(firstName+lastName)
results_list.append(lastName+firstName)
results_list.append(firstName[0]+lastName)
results_list.append(lastName)
results_list.append(firstName+lastName+yearOfBirth)
results_list.append(firstName[0]+lastName+yearOfBirth)
results_list.append(lastName+firstName+yearOfBirth)
results_list.append(firstName+lastName+yearOfBirth[-2:])
results_list.append(firstName+lastName+yearOfBirth[-2:])
results_list.append(firstName[0]+lastName+yearOfBirth[-2:])
results_list.append(lastName+firstName+yearOfBirth[-2:])
results_list.append(firstName+lastName+zipCode)
results_list.append(firstName[0]+lastName+zipCode)
results_list.append(lastName+firstName+zipCode)
results_list.append(firstName+lastName+zipCode[:2])
results_list.append(firstName[0]+lastName+zipCode[:2])
results_list.append(lastName+firstName+zipCode[:2])
if pseudo:
results_list.append(pseudo)
results_list.append(pseudo+zipCode)
results_list.append(pseudo+zipCode[:2])
results_list.append(pseudo+yearOfBirth)
results_list.append(pseudo+yearOfBirth[-2:])
results_list = list(set(results_list))
return results_list
if __name__ == '__main__':
results = generate_accounts()
print('\n'.join(results)) | def generate_accounts():
first_name = input('First name: ').lower()
last_name = input('Last name: ').lower()
year_of_birth = input('Year of birth: ')
pseudo = input('Username (optional): ').lower()
zip_code = input('Zip code (optional): ')
results_list = []
results_list.append(firstName + lastName)
results_list.append(lastName + firstName)
results_list.append(firstName[0] + lastName)
results_list.append(lastName)
results_list.append(firstName + lastName + yearOfBirth)
results_list.append(firstName[0] + lastName + yearOfBirth)
results_list.append(lastName + firstName + yearOfBirth)
results_list.append(firstName + lastName + yearOfBirth[-2:])
results_list.append(firstName + lastName + yearOfBirth[-2:])
results_list.append(firstName[0] + lastName + yearOfBirth[-2:])
results_list.append(lastName + firstName + yearOfBirth[-2:])
results_list.append(firstName + lastName + zipCode)
results_list.append(firstName[0] + lastName + zipCode)
results_list.append(lastName + firstName + zipCode)
results_list.append(firstName + lastName + zipCode[:2])
results_list.append(firstName[0] + lastName + zipCode[:2])
results_list.append(lastName + firstName + zipCode[:2])
if pseudo:
results_list.append(pseudo)
results_list.append(pseudo + zipCode)
results_list.append(pseudo + zipCode[:2])
results_list.append(pseudo + yearOfBirth)
results_list.append(pseudo + yearOfBirth[-2:])
results_list = list(set(results_list))
return results_list
if __name__ == '__main__':
results = generate_accounts()
print('\n'.join(results)) |
# MYSQL_CONFIG = {
# 'host': '10.70.14.244',
# 'port': 33044,
# 'user': 'view',
# 'password': '!@View123',
# 'database': 'yjyg'
# }
MYSQL_CONFIG = {
'host': '127.0.0.1',
'port': 33004,
'user': 'root',
'password': 'q1w2e3r4',
'database': 'yjyg'
} | mysql_config = {'host': '127.0.0.1', 'port': 33004, 'user': 'root', 'password': 'q1w2e3r4', 'database': 'yjyg'} |
"""iCE entities."""
#
# Base entity class
#
class Entity(object):
"""Generic entity.
:type id: str
:type created: datetime.datetime
:type update: datetime.datetime
:type etag: str
"""
def __init__(self, **kwargs):
# MongoDB stuff
self.id = kwargs.get('_id', None)
self.created = kwargs.get('_created', None)
self.updated = kwargs.get('_updated', None)
# ETag
self.etag = kwargs.get('_etag', None)
def to_dict(self):
"""Converts the entity to dictionary.
:rtype: dict
:return: A Python dictionary with the attributes of the entity.
"""
_dict = {}
for key, value in self.__dict__.items():
if value is None:
continue
if key.startswith('_'):
continue
if key in ['id', 'created', 'updated', 'etag']: # TODO
continue
_dict[key] = value
return _dict
#
# Session class
#
class Session(Entity):
"""Represents an experimentation session.
:type client_ip_addr: str
"""
def __init__(self, **kwargs):
super(Session, self).__init__(**kwargs)
# Attributes
self.client_ip_addr = kwargs['client_ip_addr']
#
# Instance class
#
class Instance(Entity):
"""Represents a cloud instance.
:type session_id: str
:type networks: list
:type public_ip_addr: str
:type public_reverse_dns: str
:type ssh_username: str
:type ssh_port: int
:type ssh_authorized_fingerprint: str
:type tags: dict
"""
#
# Constructor
#
def __init__(self, **kwargs):
super(Instance, self).__init__(**kwargs)
# Session
self.session_id = kwargs['session_id']
# Networking
self.networks = []
for net in kwargs.get('networks', []):
my_net = {
'addr': net['addr']
}
if 'iface' in net:
my_net['iface'] = net['iface']
if 'bcast_addr' in net:
my_net['bcast_addr'] = net['bcast_addr']
self.networks.append(my_net)
# Public network
self.public_ip_addr = kwargs['public_ip_addr']
self.public_reverse_dns = kwargs.get('public_reverse_dns', '')
# SSH options
self.ssh_port = int(kwargs.get('ssh_port', 22))
self.ssh_username = kwargs.get('ssh_username', '')
self.ssh_authorized_fingerprint = kwargs.get(
'ssh_authorized_fingerprint', ''
)
# Tags
self.tags = kwargs.get('tags', {})
#
# Setters
#
def add_network(self, addr, iface=None, bcast_addr=None):
"""Adds network in the instance.
:param str addr: The address and mask of the network (e.g.:
192.168.1.112/24).
:param str iface: The interface of the network (e.g.: eth0).
:param str bcast_addr: The broadcast address of the network.
"""
my_net = {
'addr': addr
}
if iface is not None:
my_net['iface'] = iface
if bcast_addr is not None:
my_net['bcast_addr'] = bcast_addr
self.networks.append(my_net)
| """iCE entities."""
class Entity(object):
"""Generic entity.
:type id: str
:type created: datetime.datetime
:type update: datetime.datetime
:type etag: str
"""
def __init__(self, **kwargs):
self.id = kwargs.get('_id', None)
self.created = kwargs.get('_created', None)
self.updated = kwargs.get('_updated', None)
self.etag = kwargs.get('_etag', None)
def to_dict(self):
"""Converts the entity to dictionary.
:rtype: dict
:return: A Python dictionary with the attributes of the entity.
"""
_dict = {}
for (key, value) in self.__dict__.items():
if value is None:
continue
if key.startswith('_'):
continue
if key in ['id', 'created', 'updated', 'etag']:
continue
_dict[key] = value
return _dict
class Session(Entity):
"""Represents an experimentation session.
:type client_ip_addr: str
"""
def __init__(self, **kwargs):
super(Session, self).__init__(**kwargs)
self.client_ip_addr = kwargs['client_ip_addr']
class Instance(Entity):
"""Represents a cloud instance.
:type session_id: str
:type networks: list
:type public_ip_addr: str
:type public_reverse_dns: str
:type ssh_username: str
:type ssh_port: int
:type ssh_authorized_fingerprint: str
:type tags: dict
"""
def __init__(self, **kwargs):
super(Instance, self).__init__(**kwargs)
self.session_id = kwargs['session_id']
self.networks = []
for net in kwargs.get('networks', []):
my_net = {'addr': net['addr']}
if 'iface' in net:
my_net['iface'] = net['iface']
if 'bcast_addr' in net:
my_net['bcast_addr'] = net['bcast_addr']
self.networks.append(my_net)
self.public_ip_addr = kwargs['public_ip_addr']
self.public_reverse_dns = kwargs.get('public_reverse_dns', '')
self.ssh_port = int(kwargs.get('ssh_port', 22))
self.ssh_username = kwargs.get('ssh_username', '')
self.ssh_authorized_fingerprint = kwargs.get('ssh_authorized_fingerprint', '')
self.tags = kwargs.get('tags', {})
def add_network(self, addr, iface=None, bcast_addr=None):
"""Adds network in the instance.
:param str addr: The address and mask of the network (e.g.:
192.168.1.112/24).
:param str iface: The interface of the network (e.g.: eth0).
:param str bcast_addr: The broadcast address of the network.
"""
my_net = {'addr': addr}
if iface is not None:
my_net['iface'] = iface
if bcast_addr is not None:
my_net['bcast_addr'] = bcast_addr
self.networks.append(my_net) |
def cheapest_flour(input1,output1):
a=[]
b=[]
with open(input1,"r") as input_file:
number1=0
for i in input_file.readlines():
a.append(i.split())
b.append(int(a[number1][0])/int(a[number1][1]))
number1+=1
b=sorted(b,reverse=True)
with open(output1,"w") as output_file:
for i in b:
output_file.write(str(i)+"\n")
| def cheapest_flour(input1, output1):
a = []
b = []
with open(input1, 'r') as input_file:
number1 = 0
for i in input_file.readlines():
a.append(i.split())
b.append(int(a[number1][0]) / int(a[number1][1]))
number1 += 1
b = sorted(b, reverse=True)
with open(output1, 'w') as output_file:
for i in b:
output_file.write(str(i) + '\n') |
"""
Cross-validation sampling
-------------------------
This module contains the functions used to crete a a cross validation
division for the data.
TODO
----
Create a class structure to create samplings
Create a class which is able to create a cv object
"""
class Categorical_Sampler:
def __init__(self, points_cat, weights, precomputed=False,
repetition=False):
if precomputed:
len(points_cat) == len(weights)
self.points_cat = points_cat
self.weights = weights
self.repetition = repetition
def sample(self, n, fixed=True):
if self.repetition and fixed:
pass
elif self.repetition and not fixed:
pass
elif not self.repetition and fixed:
pass
elif not self.repetition and not fixed:
pass
def generate_cv_sampling(self):
pass
class Spatial_Sampler:
def __init__(self, points_com, com_stats):
self.points_com = points_com
self.com_stats = com_stats
self.n_com = len(self.com_stats)
def sample(self, n):
pass
def retrieve_icom(self, icom):
if type(self.points_com) == np.ndarray:
indices = np.where(self.points_com == icom)[0]
else:
indices = np.zeros(len(self.points_com)).astype(bool)
for i in xrange(len(self.points_com)):
indices[i] = icom in self.points_com[i]
indices = np.where(indices)[0]
return indices
def retrieve_non_icom(self, icom):
if type(self.points_com) == np.ndarray:
indices = np.where(self.points_com != icom)[0]
else:
indices = np.zeros(len(self.points_com)).astype(bool)
for i in xrange(len(self.points_com)):
indices[i] = icom not in self.points_com[i]
indices = np.where(indices)[0]
return indices
def generate_cv_sampling(self):
for icom in self.com_stats:
r_type = self.retrieve_icom(icom)
non_r_type = self.retrieve_non_icom(icom)
yield r_type, non_r_type
class CV_sampler:
"""Sampler for creating CV partitions."""
def __init__(self, f, m):
pass
def generate_cv(self):
pass
| """
Cross-validation sampling
-------------------------
This module contains the functions used to crete a a cross validation
division for the data.
TODO
----
Create a class structure to create samplings
Create a class which is able to create a cv object
"""
class Categorical_Sampler:
def __init__(self, points_cat, weights, precomputed=False, repetition=False):
if precomputed:
len(points_cat) == len(weights)
self.points_cat = points_cat
self.weights = weights
self.repetition = repetition
def sample(self, n, fixed=True):
if self.repetition and fixed:
pass
elif self.repetition and (not fixed):
pass
elif not self.repetition and fixed:
pass
elif not self.repetition and (not fixed):
pass
def generate_cv_sampling(self):
pass
class Spatial_Sampler:
def __init__(self, points_com, com_stats):
self.points_com = points_com
self.com_stats = com_stats
self.n_com = len(self.com_stats)
def sample(self, n):
pass
def retrieve_icom(self, icom):
if type(self.points_com) == np.ndarray:
indices = np.where(self.points_com == icom)[0]
else:
indices = np.zeros(len(self.points_com)).astype(bool)
for i in xrange(len(self.points_com)):
indices[i] = icom in self.points_com[i]
indices = np.where(indices)[0]
return indices
def retrieve_non_icom(self, icom):
if type(self.points_com) == np.ndarray:
indices = np.where(self.points_com != icom)[0]
else:
indices = np.zeros(len(self.points_com)).astype(bool)
for i in xrange(len(self.points_com)):
indices[i] = icom not in self.points_com[i]
indices = np.where(indices)[0]
return indices
def generate_cv_sampling(self):
for icom in self.com_stats:
r_type = self.retrieve_icom(icom)
non_r_type = self.retrieve_non_icom(icom)
yield (r_type, non_r_type)
class Cv_Sampler:
"""Sampler for creating CV partitions."""
def __init__(self, f, m):
pass
def generate_cv(self):
pass |
__author__ = "Dimi Balaouras"
__copyright__ = "Copyright 2016, Stek.io"
__license__ = "Apache License 2.0, see LICENSE for more details."
# Do not modify the following
__default_feature_name__ = "DO_NOT_MODIFY"
class AppContext(object):
"""
App Context based on Service Locator Pattern
"""
def __init__(self, allow_replace=False):
"""
:param allow_replace: Allow replace of the feature
"""
self.providers = {}
self.allow_replace = allow_replace
def register(self, feature, provider, *args, **kwargs):
if not self.allow_replace:
assert not self.providers.has_key(feature), "Duplicate feature: %r" % feature
if callable(provider):
def call():
return provider(*args, **kwargs)
else:
def call():
return provider
self.providers[feature] = call
def __getitem__(self, feature):
try:
provider = self.providers[feature]
except KeyError:
raise KeyError("Unknown feature named %r" % feature)
return provider()
def get(self, feature, default=__default_feature_name__):
"""
Wrapper of __getitem__ method
:param feature: The Feature registered within the WebHawk Context
:param default: Default return value
:return: The reference to the implementation of the requested feature; None otherwise
"""
feature_impl = default
if default == __default_feature_name__:
# Will raise an exception if feature is not implemented
feature_impl = self.__getitem__(feature)
else:
try:
feature_impl = self.__getitem__(feature)
except KeyError:
pass
return feature_impl
| __author__ = 'Dimi Balaouras'
__copyright__ = 'Copyright 2016, Stek.io'
__license__ = 'Apache License 2.0, see LICENSE for more details.'
__default_feature_name__ = 'DO_NOT_MODIFY'
class Appcontext(object):
"""
App Context based on Service Locator Pattern
"""
def __init__(self, allow_replace=False):
"""
:param allow_replace: Allow replace of the feature
"""
self.providers = {}
self.allow_replace = allow_replace
def register(self, feature, provider, *args, **kwargs):
if not self.allow_replace:
assert not self.providers.has_key(feature), 'Duplicate feature: %r' % feature
if callable(provider):
def call():
return provider(*args, **kwargs)
else:
def call():
return provider
self.providers[feature] = call
def __getitem__(self, feature):
try:
provider = self.providers[feature]
except KeyError:
raise key_error('Unknown feature named %r' % feature)
return provider()
def get(self, feature, default=__default_feature_name__):
"""
Wrapper of __getitem__ method
:param feature: The Feature registered within the WebHawk Context
:param default: Default return value
:return: The reference to the implementation of the requested feature; None otherwise
"""
feature_impl = default
if default == __default_feature_name__:
feature_impl = self.__getitem__(feature)
else:
try:
feature_impl = self.__getitem__(feature)
except KeyError:
pass
return feature_impl |
# config.py
SEED = 42
EXTENSION = ".png"
IMAGE_H = 28
IMAGE_W = 28
CHANNELS = 3
BATCH_SIZE = 30
EPOCHS = 400
LEARNING_RATE = 0.001
CIRCLES = "../input/shapes/circles/"
SQUARES = "../input/shapes/squares/"
TRIANGLES = "../input/shapes/triangles/"
INPUT_FOLD = "../input/"
OUTPUT_FOLD = "../output/"
TRAIN_DATA = "../input/train_dataset.csv"
VALID_DATA = "../input/valid_dataset.csv"
ACCURACIES = "../output/accuracies.csv"
LOSSES = "../output/losses.csv" | seed = 42
extension = '.png'
image_h = 28
image_w = 28
channels = 3
batch_size = 30
epochs = 400
learning_rate = 0.001
circles = '../input/shapes/circles/'
squares = '../input/shapes/squares/'
triangles = '../input/shapes/triangles/'
input_fold = '../input/'
output_fold = '../output/'
train_data = '../input/train_dataset.csv'
valid_data = '../input/valid_dataset.csv'
accuracies = '../output/accuracies.csv'
losses = '../output/losses.csv' |
# In one of the Chinese provinces, it was decided to build a series of machines to protect the
# population against the coronavirus. The province can be visualized as an array of values 1 and 0,
# which arr[i] = 1 means that in city [i] it is possible to build a machine and value 0 that it can't.
# There is also a number k, which means that if we put the machine in the city [i], then the cities with
# indices [j] such that that abs(i-j) < k are through it protected. Find the minimum number of machines
# are needed to provide security in each city, or -1 if that is impossible.
def machines_saving_people(T, k):
count = 0
distance = -1
protected = distance + k
while distance + k < len(T):
if protected > len(T) - 1:
protected = len(T) - 1
while T[protected] == 0 and protected >= distance + 1:
protected -= 1
if protected == distance:
return -1
else:
distance = protected
protected += 2 * k - 1
count += 1
return count
T = [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]
k = 4
print(machines_saving_people(T, k))
| def machines_saving_people(T, k):
count = 0
distance = -1
protected = distance + k
while distance + k < len(T):
if protected > len(T) - 1:
protected = len(T) - 1
while T[protected] == 0 and protected >= distance + 1:
protected -= 1
if protected == distance:
return -1
else:
distance = protected
protected += 2 * k - 1
count += 1
return count
t = [0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0]
k = 4
print(machines_saving_people(T, k)) |
m = 5
n = 0.000001
# rule-id: use-float-numbers
assert(1.0000 == 1.000000)
# rule-id: use-float-numbers
assert(1.0000 == m)
# rule-id: use-float-numbers
assert(m == 1.0000)
# rule-id: use-float-numbers
assert(m == n)
| m = 5
n = 1e-06
assert 1.0 == 1.0
assert 1.0 == m
assert m == 1.0
assert m == n |
while True:
password = input("Password")
print(password)
if password == "stop":
break
print("the while loop has stopped") | while True:
password = input('Password')
print(password)
if password == 'stop':
break
print('the while loop has stopped') |
# wczytanie slow i szyfrow
with open('../dane/sz.txt') as f:
cyphers = []
for word in f.readlines():
cyphers.append(word[:-1])
with open('../dane/klucze2.txt') as f:
keys = []
for word in f.readlines():
keys.append(word[:-1])
# zbior odszyfrowanych slow
words = []
# przejscie po slowach i kluczach
for cypher, key in zip(cyphers, keys):
# zaszyfrowane slowo
word = ''
for i, char in enumerate(cypher):
# odjecie ich kodow ascii plus 64 by uzyskac numer alfabetu klucza
# klucz zawijam na wypadek krotszego klucza od szyfrowanego slowa
currAscii = ord(char) - ord(key[i % len(key)]) + 64
# jezeli przekroczylo dolna granice, zawijam
if currAscii < 65:
currAscii += 26
word += chr(currAscii)
words.append(word)
# wyswietlenie odpowiedzi
nl = '\n'
answer = f'4 b) Odszyfrowane slowa: {nl}{nl.join(words)}'
print(answer)
| with open('../dane/sz.txt') as f:
cyphers = []
for word in f.readlines():
cyphers.append(word[:-1])
with open('../dane/klucze2.txt') as f:
keys = []
for word in f.readlines():
keys.append(word[:-1])
words = []
for (cypher, key) in zip(cyphers, keys):
word = ''
for (i, char) in enumerate(cypher):
curr_ascii = ord(char) - ord(key[i % len(key)]) + 64
if currAscii < 65:
curr_ascii += 26
word += chr(currAscii)
words.append(word)
nl = '\n'
answer = f'4 b) Odszyfrowane slowa: {nl}{nl.join(words)}'
print(answer) |
def graph_pred_vs_actual(actual,pred,data_type):
plt.scatter(actual,pred,alpha=.3)
plt.plot(np.linspace(int(min(pred)),int(max(pred)),int(max(pred))),
np.linspace(int(min(pred)),int(max(pred)),int(max(pred))))
plt.title('Actual vs Pred ({} Data)'.format(data_type))
plt.xlabel('Actual')
plt.ylabel('Pred')
plt.show()
def graph_residual(actual,residual,data_type):
plt.scatter(actual,residual,alpha=.3)
plt.plot(np.linspace(int(min(actual)),int(max(actual)),int(max(actual))),np.linspace(0,0,int(max(actual))))
plt.title('Actual vs Residual ({} Data)'.format(data_type))
plt.xlabel('Actual')
plt.ylabel('Residual')
plt.show()
def scrape_weather_url(url):
# weather data holder to be inserted to pandas dataframe
high_low, weather_desc, humidity_barometer, wind, date_time = [], [], [], [], []
# open url
driver.get(url)
soup = BeautifulSoup(driver.page_source, "lxml")
days_chain = [x.find_all('a') for x in soup.find_all(class_='weatherLinks')]
time.sleep(5)
# Load Entire Page by Scrolling to charts
driver.execute_script("window.scrollTo(0, document.body.scrollHeight/3.5);") # Scroll down to bottom
# First load of each month takes extra long time. Therefore 'counter' variable is used to run else block first
counter = 0
for ix,link in enumerate(days_chain[0]):
'''
Bottom section tries to solve loading issue by implementing wait feature
Refer : https://selenium-python.readthedocs.io/waits.html
'''
wait = WebDriverWait(driver, 10)
if counter!=0:
delay = 3 # seconds
try:
myElem = wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks')))
except TimeoutException:
print("Loading took too much time!" )
day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix+1))
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix+1))))
day_link.click()
else:
delay = 5 # seconds
try:
myElem = WebDriverWait(driver, delay).until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks')))
except TimeoutException:
print("Loading took too much time!" )
day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix+1))
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix+1))))
time.sleep(4)
day_link.click()
time.sleep(3)
counter+=1
# Wait a bit for the Javascript to fully load data to be scraped
time.sleep(2.5)
# Scrape weather data
high_low.insert(0,driver.find_elements_by_xpath("//div[@class='temp']")[-1].text) #notice elements, s at the end. This returns a list, and I can index it.
weather_desc.insert(0,driver.find_element_by_xpath("//div[@class='wdesc']").text)
humidity_barometer.insert(0,driver.find_element_by_xpath("//div[@class='mid__block']").text)
wind.insert(0,driver.find_element_by_xpath("//div[@class='right__block']").text)
date_time.insert(0,driver.find_elements_by_xpath("//div[@class='date']")[-1].text)
return high_low, weather_desc, humidity_barometer, wind, date_time
| def graph_pred_vs_actual(actual, pred, data_type):
plt.scatter(actual, pred, alpha=0.3)
plt.plot(np.linspace(int(min(pred)), int(max(pred)), int(max(pred))), np.linspace(int(min(pred)), int(max(pred)), int(max(pred))))
plt.title('Actual vs Pred ({} Data)'.format(data_type))
plt.xlabel('Actual')
plt.ylabel('Pred')
plt.show()
def graph_residual(actual, residual, data_type):
plt.scatter(actual, residual, alpha=0.3)
plt.plot(np.linspace(int(min(actual)), int(max(actual)), int(max(actual))), np.linspace(0, 0, int(max(actual))))
plt.title('Actual vs Residual ({} Data)'.format(data_type))
plt.xlabel('Actual')
plt.ylabel('Residual')
plt.show()
def scrape_weather_url(url):
(high_low, weather_desc, humidity_barometer, wind, date_time) = ([], [], [], [], [])
driver.get(url)
soup = beautiful_soup(driver.page_source, 'lxml')
days_chain = [x.find_all('a') for x in soup.find_all(class_='weatherLinks')]
time.sleep(5)
driver.execute_script('window.scrollTo(0, document.body.scrollHeight/3.5);')
counter = 0
for (ix, link) in enumerate(days_chain[0]):
'\n Bottom section tries to solve loading issue by implementing wait feature\n Refer : https://selenium-python.readthedocs.io/waits.html\n '
wait = web_driver_wait(driver, 10)
if counter != 0:
delay = 3
try:
my_elem = wait.until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks')))
except TimeoutException:
print('Loading took too much time!')
day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix + 1))
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix + 1))))
day_link.click()
else:
delay = 5
try:
my_elem = web_driver_wait(driver, delay).until(EC.presence_of_element_located((By.CLASS_NAME, 'weatherLinks')))
except TimeoutException:
print('Loading took too much time!')
day_link = driver.find_element_by_xpath("//div[@class='weatherLinks']/a[{}]".format(ix + 1))
wait.until(EC.element_to_be_clickable((By.XPATH, "//div[@class='weatherLinks']/a[{}]".format(ix + 1))))
time.sleep(4)
day_link.click()
time.sleep(3)
counter += 1
time.sleep(2.5)
high_low.insert(0, driver.find_elements_by_xpath("//div[@class='temp']")[-1].text)
weather_desc.insert(0, driver.find_element_by_xpath("//div[@class='wdesc']").text)
humidity_barometer.insert(0, driver.find_element_by_xpath("//div[@class='mid__block']").text)
wind.insert(0, driver.find_element_by_xpath("//div[@class='right__block']").text)
date_time.insert(0, driver.find_elements_by_xpath("//div[@class='date']")[-1].text)
return (high_low, weather_desc, humidity_barometer, wind, date_time) |
# https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list
# Python
"""
Insert Node at the end of a linked list
head pointer input could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
return back the head of the linked list in the below method
"""
def Insert(head, data):
if head is None:
return Node(data=data)
else:
current = head
while hasattr(current, 'next') and current.next is not None:
current = current.next
current.next = Node(data=data)
return head
| """
Insert Node at the end of a linked list
head pointer input could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
return back the head of the linked list in the below method
"""
def insert(head, data):
if head is None:
return node(data=data)
else:
current = head
while hasattr(current, 'next') and current.next is not None:
current = current.next
current.next = node(data=data)
return head |
#
# PySNMP MIB module DC-OPT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DC-OPT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:21:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter64, Counter32, ObjectIdentity, IpAddress, MibIdentifier, enterprises, Integer32, TimeTicks, NotificationType, ModuleIdentity, Gauge32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter64", "Counter32", "ObjectIdentity", "IpAddress", "MibIdentifier", "enterprises", "Integer32", "TimeTicks", "NotificationType", "ModuleIdentity", "Gauge32", "iso")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
codex = MibIdentifier((1, 3, 6, 1, 4, 1, 449))
cdxProductSpecific = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2))
cdx6500 = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1))
cdx6500Statistics = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3))
cdx6500StatOtherStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2))
cdx6500Controls = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4))
class DisplayString(OctetString):
pass
cdx6500DCStatTable = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10))
cdx6500DCGenStatTable = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1))
cdx6500DCGenStatTableEntry = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1))
cdx6500DCGenStatDSPStatus = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("down", 1), ("up", 2), ("missing", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatDSPStatus.setStatus('mandatory')
cdx6500DCGenStatHndlrSWRev = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatHndlrSWRev.setStatus('mandatory')
cdx6500DCGenStatFnctnSWRev = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatFnctnSWRev.setStatus('mandatory')
cdx6500DCGenStatMaxChannels = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatMaxChannels.setStatus('mandatory')
cdx6500DCGenStatChanInUse = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatChanInUse.setStatus('mandatory')
cdx6500DCGenStatMaxSmltChanUse = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatMaxSmltChanUse.setStatus('mandatory')
cdx6500DCGenStatRejectConn = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatRejectConn.setStatus('mandatory')
cdx6500DCGenStatAggCRatio = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatAggCRatio.setStatus('mandatory')
cdx6500DCGenStatCurrEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatCurrEncQDepth.setStatus('mandatory')
cdx6500DCGenStatMaxEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatMaxEncQDepth.setStatus('mandatory')
cdx6500DCGenStatTmOfMaxEncQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 11), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatTmOfMaxEncQDepth.setStatus('mandatory')
cdx6500DCGenStatCurrDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatCurrDecQDepth.setStatus('mandatory')
cdx6500DCGenStatMaxDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatMaxDecQDepth.setStatus('mandatory')
cdx6500DCGenStatTmOfMaxDecQDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCGenStatTmOfMaxDecQDepth.setStatus('mandatory')
cdx6500DCChanStatTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2), )
if mibBuilder.loadTexts: cdx6500DCChanStatTable.setStatus('mandatory')
cdx6500DCChanStatTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1), ).setIndexNames((0, "DC-OPT-MIB", "cdx6500DCChanStatChanNum"))
if mibBuilder.loadTexts: cdx6500DCChanStatTableEntry.setStatus('mandatory')
cdx6500DCChanStatChanNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatChanNum.setStatus('mandatory')
cdx6500DCChanStatTmOfLastStatRst = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatTmOfLastStatRst.setStatus('mandatory')
cdx6500DCChanStatChanState = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("dspDown", 1), ("idle", 2), ("negotiating", 3), ("dataPassing", 4), ("flushingData", 5), ("flushingDCRing", 6), ("apClearing", 7), ("npClearing", 8), ("clearingCall", 9), ("flushingOnClr", 10), ("clearing", 11)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatChanState.setStatus('mandatory')
cdx6500DCChanStatSourceChan = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatSourceChan.setStatus('mandatory')
cdx6500DCChanStatDestChan = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDestChan.setStatus('mandatory')
cdx6500DCChanStatXmitCRatio = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatXmitCRatio.setStatus('mandatory')
cdx6500DCChanStatNumOfEncFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfEncFrames.setStatus('mandatory')
cdx6500DCChanStatNumOfCharInToEnc = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharInToEnc.setStatus('mandatory')
cdx6500DCChanStatNumOfCharOutOfEnc = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharOutOfEnc.setStatus('mandatory')
cdx6500DCChanStatNumOfDecFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfDecFrames.setStatus('mandatory')
cdx6500DCChanStatNumOfCharInToDec = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharInToDec.setStatus('mandatory')
cdx6500DCChanStatNumOfCharOutOfDec = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatNumOfCharOutOfDec.setStatus('mandatory')
cdx6500DCChanStatEncAETrnstnCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatEncAETrnstnCnt.setStatus('mandatory')
cdx6500DCChanStatEncAEFrameCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatEncAEFrameCnt.setStatus('mandatory')
cdx6500DCChanStatEncAEModeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatEncAEModeStatus.setStatus('mandatory')
cdx6500DCChanStatDecAETrnstnCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDecAETrnstnCnt.setStatus('mandatory')
cdx6500DCChanStatDecAEFrameCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDecAEFrameCnt.setStatus('mandatory')
cdx6500DCChanStatDecAEModeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDecAEModeStatus.setStatus('mandatory')
cdx6500DCChanStatDSWithBadFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDSWithBadFrames.setStatus('mandatory')
cdx6500DCChanStatDSWithBadHeaders = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDSWithBadHeaders.setStatus('mandatory')
cdx6500DCChanStatDSDueToRstOrCng = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500DCChanStatDSDueToRstOrCng.setStatus('mandatory')
cdx6500ContDC = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9))
cdx6500ContResetAllDCStats = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: cdx6500ContResetAllDCStats.setStatus('mandatory')
cdx6500ContDCTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2), )
if mibBuilder.loadTexts: cdx6500ContDCTable.setStatus('mandatory')
cdx6500ContDCTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1), ).setIndexNames((0, "DC-OPT-MIB", "cdx6500ContDCChanNum"))
if mibBuilder.loadTexts: cdx6500ContDCTableEntry.setStatus('mandatory')
cdx6500ContDCChanNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdx6500ContDCChanNum.setStatus('mandatory')
cdx6500ContResetDCChanStats = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: cdx6500ContResetDCChanStats.setStatus('mandatory')
cdx6500ContResetDCChanVocab = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noreset", 2)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: cdx6500ContResetDCChanVocab.setStatus('mandatory')
mibBuilder.exportSymbols("DC-OPT-MIB", cdx6500DCGenStatCurrDecQDepth=cdx6500DCGenStatCurrDecQDepth, cdx6500DCChanStatDecAEFrameCnt=cdx6500DCChanStatDecAEFrameCnt, cdx6500DCGenStatMaxEncQDepth=cdx6500DCGenStatMaxEncQDepth, cdx6500DCGenStatMaxDecQDepth=cdx6500DCGenStatMaxDecQDepth, cdx6500DCChanStatNumOfCharOutOfEnc=cdx6500DCChanStatNumOfCharOutOfEnc, cdx6500DCChanStatTmOfLastStatRst=cdx6500DCChanStatTmOfLastStatRst, cdx6500DCGenStatDSPStatus=cdx6500DCGenStatDSPStatus, cdx6500DCGenStatFnctnSWRev=cdx6500DCGenStatFnctnSWRev, cdx6500DCGenStatTmOfMaxDecQDepth=cdx6500DCGenStatTmOfMaxDecQDepth, cdx6500DCChanStatDSWithBadHeaders=cdx6500DCChanStatDSWithBadHeaders, cdx6500ContResetDCChanStats=cdx6500ContResetDCChanStats, cdx6500DCGenStatTable=cdx6500DCGenStatTable, cdx6500DCChanStatEncAEModeStatus=cdx6500DCChanStatEncAEModeStatus, cdx6500DCGenStatMaxSmltChanUse=cdx6500DCGenStatMaxSmltChanUse, cdx6500DCChanStatNumOfCharOutOfDec=cdx6500DCChanStatNumOfCharOutOfDec, cdx6500DCChanStatNumOfCharInToEnc=cdx6500DCChanStatNumOfCharInToEnc, cdx6500DCGenStatHndlrSWRev=cdx6500DCGenStatHndlrSWRev, codex=codex, cdx6500DCStatTable=cdx6500DCStatTable, cdx6500DCChanStatNumOfDecFrames=cdx6500DCChanStatNumOfDecFrames, cdx6500ContDCTableEntry=cdx6500ContDCTableEntry, cdx6500DCChanStatDSDueToRstOrCng=cdx6500DCChanStatDSDueToRstOrCng, cdx6500DCGenStatTmOfMaxEncQDepth=cdx6500DCGenStatTmOfMaxEncQDepth, cdx6500DCChanStatDecAETrnstnCnt=cdx6500DCChanStatDecAETrnstnCnt, cdx6500DCChanStatNumOfCharInToDec=cdx6500DCChanStatNumOfCharInToDec, cdx6500DCChanStatXmitCRatio=cdx6500DCChanStatXmitCRatio, cdx6500DCChanStatDestChan=cdx6500DCChanStatDestChan, cdx6500DCChanStatDSWithBadFrames=cdx6500DCChanStatDSWithBadFrames, cdx6500DCChanStatChanState=cdx6500DCChanStatChanState, cdx6500DCGenStatTableEntry=cdx6500DCGenStatTableEntry, cdx6500DCGenStatAggCRatio=cdx6500DCGenStatAggCRatio, DisplayString=DisplayString, cdxProductSpecific=cdxProductSpecific, cdx6500DCGenStatCurrEncQDepth=cdx6500DCGenStatCurrEncQDepth, cdx6500DCChanStatNumOfEncFrames=cdx6500DCChanStatNumOfEncFrames, cdx6500DCChanStatEncAEFrameCnt=cdx6500DCChanStatEncAEFrameCnt, cdx6500DCGenStatRejectConn=cdx6500DCGenStatRejectConn, cdx6500Statistics=cdx6500Statistics, cdx6500DCGenStatMaxChannels=cdx6500DCGenStatMaxChannels, cdx6500DCChanStatDecAEModeStatus=cdx6500DCChanStatDecAEModeStatus, cdx6500Controls=cdx6500Controls, cdx6500ContDCTable=cdx6500ContDCTable, cdx6500=cdx6500, cdx6500DCChanStatChanNum=cdx6500DCChanStatChanNum, cdx6500DCChanStatEncAETrnstnCnt=cdx6500DCChanStatEncAETrnstnCnt, cdx6500ContDC=cdx6500ContDC, cdx6500DCChanStatTableEntry=cdx6500DCChanStatTableEntry, cdx6500DCGenStatChanInUse=cdx6500DCGenStatChanInUse, cdx6500ContResetAllDCStats=cdx6500ContResetAllDCStats, cdx6500ContDCChanNum=cdx6500ContDCChanNum, cdx6500ContResetDCChanVocab=cdx6500ContResetDCChanVocab, cdx6500DCChanStatSourceChan=cdx6500DCChanStatSourceChan, cdx6500DCChanStatTable=cdx6500DCChanStatTable, cdx6500StatOtherStatsGroup=cdx6500StatOtherStatsGroup)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, counter64, counter32, object_identity, ip_address, mib_identifier, enterprises, integer32, time_ticks, notification_type, module_identity, gauge32, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Counter64', 'Counter32', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'enterprises', 'Integer32', 'TimeTicks', 'NotificationType', 'ModuleIdentity', 'Gauge32', 'iso')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
codex = mib_identifier((1, 3, 6, 1, 4, 1, 449))
cdx_product_specific = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2))
cdx6500 = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1))
cdx6500_statistics = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3))
cdx6500_stat_other_stats_group = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2))
cdx6500_controls = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4))
class Displaystring(OctetString):
pass
cdx6500_dc_stat_table = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10))
cdx6500_dc_gen_stat_table = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1))
cdx6500_dc_gen_stat_table_entry = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1))
cdx6500_dc_gen_stat_dsp_status = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('down', 1), ('up', 2), ('missing', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatDSPStatus.setStatus('mandatory')
cdx6500_dc_gen_stat_hndlr_sw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatHndlrSWRev.setStatus('mandatory')
cdx6500_dc_gen_stat_fnctn_sw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatFnctnSWRev.setStatus('mandatory')
cdx6500_dc_gen_stat_max_channels = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatMaxChannels.setStatus('mandatory')
cdx6500_dc_gen_stat_chan_in_use = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatChanInUse.setStatus('mandatory')
cdx6500_dc_gen_stat_max_smlt_chan_use = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatMaxSmltChanUse.setStatus('mandatory')
cdx6500_dc_gen_stat_reject_conn = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatRejectConn.setStatus('mandatory')
cdx6500_dc_gen_stat_agg_c_ratio = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 8), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatAggCRatio.setStatus('mandatory')
cdx6500_dc_gen_stat_curr_enc_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatCurrEncQDepth.setStatus('mandatory')
cdx6500_dc_gen_stat_max_enc_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatMaxEncQDepth.setStatus('mandatory')
cdx6500_dc_gen_stat_tm_of_max_enc_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 11), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatTmOfMaxEncQDepth.setStatus('mandatory')
cdx6500_dc_gen_stat_curr_dec_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatCurrDecQDepth.setStatus('mandatory')
cdx6500_dc_gen_stat_max_dec_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 13), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatMaxDecQDepth.setStatus('mandatory')
cdx6500_dc_gen_stat_tm_of_max_dec_q_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 1, 1, 14), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCGenStatTmOfMaxDecQDepth.setStatus('mandatory')
cdx6500_dc_chan_stat_table = mib_table((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2))
if mibBuilder.loadTexts:
cdx6500DCChanStatTable.setStatus('mandatory')
cdx6500_dc_chan_stat_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1)).setIndexNames((0, 'DC-OPT-MIB', 'cdx6500DCChanStatChanNum'))
if mibBuilder.loadTexts:
cdx6500DCChanStatTableEntry.setStatus('mandatory')
cdx6500_dc_chan_stat_chan_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatChanNum.setStatus('mandatory')
cdx6500_dc_chan_stat_tm_of_last_stat_rst = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatTmOfLastStatRst.setStatus('mandatory')
cdx6500_dc_chan_stat_chan_state = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=named_values(('dspDown', 1), ('idle', 2), ('negotiating', 3), ('dataPassing', 4), ('flushingData', 5), ('flushingDCRing', 6), ('apClearing', 7), ('npClearing', 8), ('clearingCall', 9), ('flushingOnClr', 10), ('clearing', 11)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatChanState.setStatus('mandatory')
cdx6500_dc_chan_stat_source_chan = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatSourceChan.setStatus('mandatory')
cdx6500_dc_chan_stat_dest_chan = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDestChan.setStatus('mandatory')
cdx6500_dc_chan_stat_xmit_c_ratio = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 6), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatXmitCRatio.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_enc_frames = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfEncFrames.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_char_in_to_enc = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfCharInToEnc.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_char_out_of_enc = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfCharOutOfEnc.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_dec_frames = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfDecFrames.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_char_in_to_dec = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfCharInToDec.setStatus('mandatory')
cdx6500_dc_chan_stat_num_of_char_out_of_dec = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatNumOfCharOutOfDec.setStatus('mandatory')
cdx6500_dc_chan_stat_enc_ae_trnstn_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatEncAETrnstnCnt.setStatus('mandatory')
cdx6500_dc_chan_stat_enc_ae_frame_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatEncAEFrameCnt.setStatus('mandatory')
cdx6500_dc_chan_stat_enc_ae_mode_status = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('off', 1), ('on', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatEncAEModeStatus.setStatus('mandatory')
cdx6500_dc_chan_stat_dec_ae_trnstn_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 16), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDecAETrnstnCnt.setStatus('mandatory')
cdx6500_dc_chan_stat_dec_ae_frame_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 17), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDecAEFrameCnt.setStatus('mandatory')
cdx6500_dc_chan_stat_dec_ae_mode_status = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('off', 1), ('on', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDecAEModeStatus.setStatus('mandatory')
cdx6500_dc_chan_stat_ds_with_bad_frames = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 19), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDSWithBadFrames.setStatus('mandatory')
cdx6500_dc_chan_stat_ds_with_bad_headers = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDSWithBadHeaders.setStatus('mandatory')
cdx6500_dc_chan_stat_ds_due_to_rst_or_cng = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 10, 2, 1, 21), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500DCChanStatDSDueToRstOrCng.setStatus('mandatory')
cdx6500_cont_dc = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9))
cdx6500_cont_reset_all_dc_stats = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('reset', 1), ('noreset', 2)))).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
cdx6500ContResetAllDCStats.setStatus('mandatory')
cdx6500_cont_dc_table = mib_table((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2))
if mibBuilder.loadTexts:
cdx6500ContDCTable.setStatus('mandatory')
cdx6500_cont_dc_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1)).setIndexNames((0, 'DC-OPT-MIB', 'cdx6500ContDCChanNum'))
if mibBuilder.loadTexts:
cdx6500ContDCTableEntry.setStatus('mandatory')
cdx6500_cont_dc_chan_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cdx6500ContDCChanNum.setStatus('mandatory')
cdx6500_cont_reset_dc_chan_stats = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('reset', 1), ('noreset', 2)))).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
cdx6500ContResetDCChanStats.setStatus('mandatory')
cdx6500_cont_reset_dc_chan_vocab = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 9, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('reset', 1), ('noreset', 2)))).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
cdx6500ContResetDCChanVocab.setStatus('mandatory')
mibBuilder.exportSymbols('DC-OPT-MIB', cdx6500DCGenStatCurrDecQDepth=cdx6500DCGenStatCurrDecQDepth, cdx6500DCChanStatDecAEFrameCnt=cdx6500DCChanStatDecAEFrameCnt, cdx6500DCGenStatMaxEncQDepth=cdx6500DCGenStatMaxEncQDepth, cdx6500DCGenStatMaxDecQDepth=cdx6500DCGenStatMaxDecQDepth, cdx6500DCChanStatNumOfCharOutOfEnc=cdx6500DCChanStatNumOfCharOutOfEnc, cdx6500DCChanStatTmOfLastStatRst=cdx6500DCChanStatTmOfLastStatRst, cdx6500DCGenStatDSPStatus=cdx6500DCGenStatDSPStatus, cdx6500DCGenStatFnctnSWRev=cdx6500DCGenStatFnctnSWRev, cdx6500DCGenStatTmOfMaxDecQDepth=cdx6500DCGenStatTmOfMaxDecQDepth, cdx6500DCChanStatDSWithBadHeaders=cdx6500DCChanStatDSWithBadHeaders, cdx6500ContResetDCChanStats=cdx6500ContResetDCChanStats, cdx6500DCGenStatTable=cdx6500DCGenStatTable, cdx6500DCChanStatEncAEModeStatus=cdx6500DCChanStatEncAEModeStatus, cdx6500DCGenStatMaxSmltChanUse=cdx6500DCGenStatMaxSmltChanUse, cdx6500DCChanStatNumOfCharOutOfDec=cdx6500DCChanStatNumOfCharOutOfDec, cdx6500DCChanStatNumOfCharInToEnc=cdx6500DCChanStatNumOfCharInToEnc, cdx6500DCGenStatHndlrSWRev=cdx6500DCGenStatHndlrSWRev, codex=codex, cdx6500DCStatTable=cdx6500DCStatTable, cdx6500DCChanStatNumOfDecFrames=cdx6500DCChanStatNumOfDecFrames, cdx6500ContDCTableEntry=cdx6500ContDCTableEntry, cdx6500DCChanStatDSDueToRstOrCng=cdx6500DCChanStatDSDueToRstOrCng, cdx6500DCGenStatTmOfMaxEncQDepth=cdx6500DCGenStatTmOfMaxEncQDepth, cdx6500DCChanStatDecAETrnstnCnt=cdx6500DCChanStatDecAETrnstnCnt, cdx6500DCChanStatNumOfCharInToDec=cdx6500DCChanStatNumOfCharInToDec, cdx6500DCChanStatXmitCRatio=cdx6500DCChanStatXmitCRatio, cdx6500DCChanStatDestChan=cdx6500DCChanStatDestChan, cdx6500DCChanStatDSWithBadFrames=cdx6500DCChanStatDSWithBadFrames, cdx6500DCChanStatChanState=cdx6500DCChanStatChanState, cdx6500DCGenStatTableEntry=cdx6500DCGenStatTableEntry, cdx6500DCGenStatAggCRatio=cdx6500DCGenStatAggCRatio, DisplayString=DisplayString, cdxProductSpecific=cdxProductSpecific, cdx6500DCGenStatCurrEncQDepth=cdx6500DCGenStatCurrEncQDepth, cdx6500DCChanStatNumOfEncFrames=cdx6500DCChanStatNumOfEncFrames, cdx6500DCChanStatEncAEFrameCnt=cdx6500DCChanStatEncAEFrameCnt, cdx6500DCGenStatRejectConn=cdx6500DCGenStatRejectConn, cdx6500Statistics=cdx6500Statistics, cdx6500DCGenStatMaxChannels=cdx6500DCGenStatMaxChannels, cdx6500DCChanStatDecAEModeStatus=cdx6500DCChanStatDecAEModeStatus, cdx6500Controls=cdx6500Controls, cdx6500ContDCTable=cdx6500ContDCTable, cdx6500=cdx6500, cdx6500DCChanStatChanNum=cdx6500DCChanStatChanNum, cdx6500DCChanStatEncAETrnstnCnt=cdx6500DCChanStatEncAETrnstnCnt, cdx6500ContDC=cdx6500ContDC, cdx6500DCChanStatTableEntry=cdx6500DCChanStatTableEntry, cdx6500DCGenStatChanInUse=cdx6500DCGenStatChanInUse, cdx6500ContResetAllDCStats=cdx6500ContResetAllDCStats, cdx6500ContDCChanNum=cdx6500ContDCChanNum, cdx6500ContResetDCChanVocab=cdx6500ContResetDCChanVocab, cdx6500DCChanStatSourceChan=cdx6500DCChanStatSourceChan, cdx6500DCChanStatTable=cdx6500DCChanStatTable, cdx6500StatOtherStatsGroup=cdx6500StatOtherStatsGroup) |
#
# PySNMP MIB module DGS-6600-STP-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DGS-6600-STP-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:45:14 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")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
dgs6600_l2, = mibBuilder.importSymbols("DGS-6600-ID-MIB", "dgs6600-l2")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Gauge32, TimeTicks, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, iso, Counter64, NotificationType, MibIdentifier, Integer32, Unsigned32, IpAddress, ObjectIdentity, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "iso", "Counter64", "NotificationType", "MibIdentifier", "Integer32", "Unsigned32", "IpAddress", "ObjectIdentity", "Bits")
TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString")
dgs6600StpExtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2))
if mibBuilder.loadTexts: dgs6600StpExtMIB.setLastUpdated('0812190000Z')
if mibBuilder.loadTexts: dgs6600StpExtMIB.setOrganization('D-Link Corp.')
if mibBuilder.loadTexts: dgs6600StpExtMIB.setContactInfo('http://support.dlink.com')
if mibBuilder.loadTexts: dgs6600StpExtMIB.setDescription('The MIB module for managing MSTP.')
class BridgeId(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8)
fixedLength = 8
swMSTPGblMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1))
swMSTPCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2))
swMSTPStpAdminState = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpAdminState.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpAdminState.setDescription('This object indicates the spanning tree state of the bridge.')
swMSTPStpVersion = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("stp", 0), ("rstp", 1), ("mstp", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpVersion.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpVersion.setDescription('The version of Spanning Tree Protocol the bridge is currently running.')
swMSTPStpMaxAge = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(600, 4000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpMaxAge.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpMaxAge.setDescription('The value that all bridges use for MaxAge when this bridge is acting as the root. Note that the range for this parameter is related to the value of StpForwardDelay and PortAdminHelloTime. MaxAge <= 2(ForwardDelay - 1);MaxAge >= 2(HelloTime + 1) The granularity of this timer is specified by 802.1D-1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value that is not a whole number of seconds.')
swMSTPStpHelloTime = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpHelloTime.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpHelloTime.setDescription('The value is used for HelloTime when this bridge is acting in RSTP or STP mode, in units of hundredths of a second. You can only read/write this value in RSTP or STP mode.')
swMSTPStpForwardDelay = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(400, 3000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpForwardDelay.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpForwardDelay.setDescription('This value controls how long a port changes its spanning state from blocking to learning state and from learning to forwarding state. Note that the range for this parameter is related to MaxAge')
swMSTPStpMaxHops = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 40))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpMaxHops.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpMaxHops.setDescription('This value applies to all spanning trees within an MST Region for which the bridge is the Regional Root.')
swMSTPStpTxHoldCount = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpTxHoldCount.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpTxHoldCount.setDescription('The value used by the Port Transmit state machine to limit the maximum transmission rate.')
swMSTPStpForwardBPDU = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpForwardBPDU.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpForwardBPDU.setDescription('The enabled/disabled status is used to forward BPDU to a non STP port.')
swMSTPStpLBD = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpLBD.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpLBD.setDescription('The enabled/disabled status is used in Loop-back prevention.')
swMSTPStpLBDRecoverTime = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPStpLBDRecoverTime.setStatus('current')
if mibBuilder.loadTexts: swMSTPStpLBDRecoverTime.setDescription("The period of time (in seconds) in which the STP module keeps checking the BPDU loop status. The valid range is 60 to 1000000. If this value is set from 1 to 59, you will get a 'bad value' return code. The value of zero is a special value that means to disable the auto-recovery mechanism for the LBD feature.")
swMSTPNniBPDUAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dot1d", 1), ("dot1ad", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPNniBPDUAddress.setStatus('current')
if mibBuilder.loadTexts: swMSTPNniBPDUAddress.setDescription('Specifies the BPDU MAC address of the NNI port in Q-in-Q status.')
swMSTPName = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPName.setStatus('current')
if mibBuilder.loadTexts: swMSTPName.setDescription('The object indicates the name of the MST Configuration Identification.')
swMSTPRevisionLevel = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPRevisionLevel.setStatus('current')
if mibBuilder.loadTexts: swMSTPRevisionLevel.setDescription('The object indicates the revision level of the MST Configuration Identification.')
swMSTPInstanceCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3), )
if mibBuilder.loadTexts: swMSTPInstanceCtrlTable.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstanceCtrlTable.setDescription('A table that contains MSTP instance information.')
swMSTPInstanceCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPInstId"))
if mibBuilder.loadTexts: swMSTPInstanceCtrlEntry.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstanceCtrlEntry.setDescription('A list of MSTP instance information.')
swMSTPInstId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstId.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstId.setDescription('This object indicates the specific instance. An MSTP Instance ID (MSTID) of zero is used to identify the CIST.')
swMSTPInstVlanRangeList1to64 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList1to64.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList1to64.setDescription('This object indicates the VLAN range (1-512) that belongs to the instance.')
swMSTPInstVlanRangeList65to128 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList65to128.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList65to128.setDescription('This object indicates the VLAN range (513-1024) that belongs to the instance.')
swMSTPInstVlanRangeList129to192 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList129to192.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList129to192.setDescription('This object indicates the VLAN range (1025-1536) that belongs to the instance.')
swMSTPInstVlanRangeList193to256 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList193to256.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList193to256.setDescription('This object indicates the VLAN range(1537-2048) that belongs to the instance.')
swMSTPInstVlanRangeList257to320 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList257to320.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList257to320.setDescription('This object indicates the VLAN range (2049-2560) that belongs to the instance.')
swMSTPInstVlanRangeList321to384 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList321to384.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList321to384.setDescription('This object indicates the VLAN range (2561-3072) that belongs to the instance.')
swMSTPInstVlanRangeList385to448 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList385to448.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList385to448.setDescription('This object indicates the VLAN range (3073-3584) that belongs to the instance.')
swMSTPInstVlanRangeList449to512 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstVlanRangeList449to512.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstVlanRangeList449to512.setDescription('This object indicates the VLAN range (3585-4096) that belongs to the instance.')
swMSTPInstType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("cist", 0), ("msti", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstType.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstType.setDescription('This object indicates the type of instance.')
swMSTPInstStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstStatus.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstStatus.setDescription('The instance state that could be enabled/disabled.')
swMSTPInstPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 61440))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstPriority.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstPriority.setDescription('The priority of the instance. The priority must be divisible by 4096 ')
swMSTPInstDesignatedRootBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 13), BridgeId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstDesignatedRootBridge.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstDesignatedRootBridge.setDescription('The bridge identifier of the CIST. For MST instance, this object is unused.')
swMSTPInstExternalRootCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstExternalRootCost.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstExternalRootCost.setDescription('The path cost between MST Regions from the transmitting bridge to the CIST Root. For MST instance this object is unused.')
swMSTPInstRegionalRootBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 15), BridgeId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstRegionalRootBridge.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstRegionalRootBridge.setDescription('For CIST, Regional Root Identifier is the Bridge Identifier of the single bridge in a Region whose CIST Root Port is a Boundary Port, or the Bridge Identifier of the CIST Root if that is within the Region; For MSTI,MSTI Regional Root Identifier is the Bridge Identifier of the MSTI Regional Root for this particular MSTI in this MST Region; The Regional Root Bridge of this instance.')
swMSTPInstInternalRootCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstInternalRootCost.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstInternalRootCost.setDescription('For CIST, the internal path cost is the path cost to the CIST Regional Root; For MSTI, the internal path cost is the path cost to the MSTI Regional Root for this particular MSTI in this MST Region')
swMSTPInstDesignatedBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 17), BridgeId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstDesignatedBridge.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstDesignatedBridge.setDescription('The Bridge Identifier for the transmitting bridge for this CIST or MSTI')
swMSTPInstRootPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstRootPort.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstRootPort.setDescription('The port number of the port which offers the lowest cost path from this bridge to the CIST or MSTI root bridge.')
swMSTPInstMaxAge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 19), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstMaxAge.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstMaxAge.setDescription('The maximum age of Spanning Tree Protocol information learned from the network on any port before it is discarded, in units of hundredths of a second. This is the actual value that this bridge is currently using.')
swMSTPInstForwardDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 20), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstForwardDelay.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstForwardDelay.setDescription('This value, measured in units of hundredths of a second, controls how fast a port changes its spanning state when moving towards the forwarding state. The value determines how long the port stays in each of the listening and learning states, which precede the Forwarding state. This value is also used, when a topology change has been detected and is underway, to age all dynamic entries in the Forwarding Database.')
swMSTPInstLastTopologyChange = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 21), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstLastTopologyChange.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstLastTopologyChange.setDescription('The time (in hundredths of a second) since the last time a topology change was detected by the bridge entity.')
swMSTPInstTopChangesCount = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstTopChangesCount.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstTopChangesCount.setDescription('The total number of topology changes detected by this bridge since the management entity was last reset or initialized.')
swMSTPInstRemainHops = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 23), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPInstRemainHops.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstRemainHops.setDescription('The root bridge in the instance for MSTI always sends a BPDU with a maximum hop count. When a switch receives this BPDU, it decrements the received maximum hop count by one and propagates this value as the remaining hop count in the BPDUs it generates.')
swMSTPInstRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 24), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: swMSTPInstRowStatus.setStatus('current')
if mibBuilder.loadTexts: swMSTPInstRowStatus.setDescription('This object indicates the RowStatus of this entry.')
swMSTPPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4), )
if mibBuilder.loadTexts: swMSTPPortTable.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortTable.setDescription('A table that contains port-specific information for the Spanning Tree Protocol.')
swMSTPPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPPort"))
if mibBuilder.loadTexts: swMSTPPortEntry.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortEntry.setDescription('A list of information maintained by every port about the Spanning Tree Protocol state for that port.')
swMSTPPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPPort.setStatus('current')
if mibBuilder.loadTexts: swMSTPPort.setDescription('The port number of the port for this entry.')
swMSTPPortAdminHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortAdminHelloTime.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortAdminHelloTime.setDescription('The amount of time between the transmission of BPDU by this node on any port when it is the root of the spanning tree or trying to become so, in units of hundredths of a second.')
swMSTPPortOperHelloTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPPortOperHelloTime.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortOperHelloTime.setDescription('The actual value of the hello time.')
swMSTPSTPPortEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPSTPPortEnable.setStatus('current')
if mibBuilder.loadTexts: swMSTPSTPPortEnable.setDescription('The enabled/disabled status of the port.')
swMSTPPortExternalPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortExternalPathCost.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortExternalPathCost.setDescription('The contribution of this port to the path cost of paths towards the CIST root which include this port.')
swMSTPPortMigration = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 6), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortMigration.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortMigration.setDescription('When operating in MSTP mode or RSTP mode, writing TRUE(1) to this object forces this port to transmit MST BPDUs. Any other operation on this object has no effect and it always returns FALSE(2) when read.')
swMSTPPortAdminEdgePort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("true", 1), ("false", 2), ("auto", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortAdminEdgePort.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortAdminEdgePort.setDescription('The value of the Edge Port parameter. A value of TRUE indicates that this port should be assumed as an edge-port and a value of FALSE indicates that this port should be assumed as a non-edge-port')
swMSTPPortOperEdgePort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("true", 1), ("false", 2), ("auto", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPPortOperEdgePort.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortOperEdgePort.setDescription('It is the acutual value of the edge port status.')
swMSTPPortAdminP2P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("true", 0), ("false", 1), ("auto", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortAdminP2P.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortAdminP2P.setDescription('The point-to-point status of the LAN segment attached to this port.')
swMSTPPortOperP2P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("true", 0), ("false", 1), ("auto", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPPortOperP2P.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortOperP2P.setDescription('It is the actual value of the P2P status.')
swMSTPPortLBD = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortLBD.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortLBD.setDescription('The enabled/disabled status is used for Loop-back prevention attached to this port.')
swMSTPPortBPDUFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortBPDUFiltering.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortBPDUFiltering.setDescription('The enabled/disabled status is used for BPDU Filtering attached to this port.BPDU filtering allows the administrator to prevent the system from sending or even receiving BPDUs on specified ports.')
swMSTPPortRestrictedRole = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 13), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortRestrictedRole.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortRestrictedRole.setDescription('If TRUE, causes the port not to be selected as Root Port for the CIST or any MSTI, even it has the best spanning tree priority vector.')
swMSTPPortRestrictedTCN = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 14), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortRestrictedTCN.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortRestrictedTCN.setDescription('If TRUE, causes the port not to propagate received topology change notifications and topology changes to other Ports.')
swMSTPPortOperFilterBpdu = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("receiving", 1), ("filtering", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPPortOperFilterBpdu.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortOperFilterBpdu.setDescription('It is the actual value of the hardware filter BPDU status.')
swMSTPPortRecoverFilterBpdu = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 16), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPPortRecoverFilterBpdu.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortRecoverFilterBpdu.setDescription('When operating in BPDU filtering mode, writing TRUE(1) to this object sets this port to receive BPDUs to the hardware. Any other operation on this object has no effect and it will always return FALSE(2) when read.')
swMSTPMstPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5), )
if mibBuilder.loadTexts: swMSTPMstPortTable.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortTable.setDescription('A table that contains port-specific information for the MST Protocol.')
swMSTPMstPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1), ).setIndexNames((0, "DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), (0, "DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID"))
if mibBuilder.loadTexts: swMSTPMstPortEntry.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortEntry.setDescription('A list of information maintained by every port about the MST state for that port.')
swMSTPMstPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPMstPort.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPort.setDescription('The port number of the port for this entry.')
swMSTPMstPortInsID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPMstPortInsID.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortInsID.setDescription('This object indicates the MSTP Instance ID (MSTID).')
swMSTPMstPortDesignatedBridge = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 3), BridgeId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPMstPortDesignatedBridge.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortDesignatedBridge.setDescription("The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for this port's segment on the corresponding Spanning Tree instance.")
swMSTPMstPortInternalPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPMstPortInternalPathCost.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortInternalPathCost.setDescription('This is the value of this port to the path cost of paths towards the MSTI root.')
swMSTPMstPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 240))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: swMSTPMstPortPriority.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortPriority.setDescription('The value of the priority field which is contained in the first (in network byte order) octet of the (2 octet long) Port ID.')
swMSTPMstPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("disabled", 2), ("discarding", 3), ("learning", 4), ("forwarding", 5), ("broken", 6), ("no-stp-enabled", 7), ("err-disabled", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPMstPortStatus.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortStatus.setDescription("When the port Enable state is enabled, the port's current state as defined by application of the Spanning Tree Protocol. If the PortEnable is disabled, the port status will be no-stp-enabled (7). If the port is in error disabled status, the port status will be err-disable(8)")
swMSTPMstPortRole = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("disable", 0), ("alternate", 1), ("backup", 2), ("root", 3), ("designated", 4), ("master", 5), ("nonstp", 6), ("loopback", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: swMSTPMstPortRole.setStatus('current')
if mibBuilder.loadTexts: swMSTPMstPortRole.setDescription("When the port Enable state is enabled, the port's current port role as defined by application of the Spanning Tree Protocol. If the Port Enable state is disabled, the port role will be nonstp(5)")
swMSTPTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11))
swMSTPNotify = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1))
swMSTPNotifyPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0))
swMSTPPortLBDTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 1)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort"))
if mibBuilder.loadTexts: swMSTPPortLBDTrap.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortLBDTrap.setDescription('When STP port loopback detect is enabled, a trap will be generated.')
swMSTPPortBackupTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 2)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID"))
if mibBuilder.loadTexts: swMSTPPortBackupTrap.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortBackupTrap.setDescription('When the STP port role goes to backup (defined in the STP standard), a trap will be generated.')
swMSTPPortAlternateTrap = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 3)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPMstPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPMstPortInsID"))
if mibBuilder.loadTexts: swMSTPPortAlternateTrap.setStatus('current')
if mibBuilder.loadTexts: swMSTPPortAlternateTrap.setDescription('When the STP port role goes to alternate (defined in the STP standard), a trap will be generated.')
swMSTPHwFilterStatusChange = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 4)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPPortOperFilterBpdu"))
if mibBuilder.loadTexts: swMSTPHwFilterStatusChange.setStatus('current')
if mibBuilder.loadTexts: swMSTPHwFilterStatusChange.setDescription('This trap is sent when a BPDU hardware filter status port changes.')
swMSTPRootRestrictedChange = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 5)).setObjects(("DGS-6600-STP-EXT-MIB", "swMSTPPort"), ("DGS-6600-STP-EXT-MIB", "swMSTPPortRestrictedRole"))
if mibBuilder.loadTexts: swMSTPRootRestrictedChange.setStatus('current')
if mibBuilder.loadTexts: swMSTPRootRestrictedChange.setDescription('This trap is sent when a restricted role state port changes.')
mibBuilder.exportSymbols("DGS-6600-STP-EXT-MIB", swMSTPPortBackupTrap=swMSTPPortBackupTrap, dgs6600StpExtMIB=dgs6600StpExtMIB, swMSTPMstPortEntry=swMSTPMstPortEntry, swMSTPInstVlanRangeList193to256=swMSTPInstVlanRangeList193to256, swMSTPStpMaxAge=swMSTPStpMaxAge, swMSTPInstDesignatedBridge=swMSTPInstDesignatedBridge, swMSTPPortAdminP2P=swMSTPPortAdminP2P, swMSTPPortOperP2P=swMSTPPortOperP2P, swMSTPGblMgmt=swMSTPGblMgmt, swMSTPPortLBDTrap=swMSTPPortLBDTrap, swMSTPPortOperEdgePort=swMSTPPortOperEdgePort, swMSTPRootRestrictedChange=swMSTPRootRestrictedChange, swMSTPStpLBDRecoverTime=swMSTPStpLBDRecoverTime, swMSTPInstVlanRangeList65to128=swMSTPInstVlanRangeList65to128, swMSTPInstTopChangesCount=swMSTPInstTopChangesCount, swMSTPInstVlanRangeList1to64=swMSTPInstVlanRangeList1to64, swMSTPPortEntry=swMSTPPortEntry, swMSTPPortRestrictedRole=swMSTPPortRestrictedRole, swMSTPInstExternalRootCost=swMSTPInstExternalRootCost, swMSTPStpAdminState=swMSTPStpAdminState, swMSTPPortBPDUFiltering=swMSTPPortBPDUFiltering, swMSTPInstVlanRangeList385to448=swMSTPInstVlanRangeList385to448, swMSTPInstRootPort=swMSTPInstRootPort, swMSTPPortAdminHelloTime=swMSTPPortAdminHelloTime, swMSTPNniBPDUAddress=swMSTPNniBPDUAddress, swMSTPMstPortDesignatedBridge=swMSTPMstPortDesignatedBridge, swMSTPInstanceCtrlTable=swMSTPInstanceCtrlTable, swMSTPInstStatus=swMSTPInstStatus, swMSTPInstanceCtrlEntry=swMSTPInstanceCtrlEntry, swMSTPMstPortStatus=swMSTPMstPortStatus, swMSTPInstRowStatus=swMSTPInstRowStatus, swMSTPStpForwardDelay=swMSTPStpForwardDelay, swMSTPInstType=swMSTPInstType, swMSTPSTPPortEnable=swMSTPSTPPortEnable, swMSTPRevisionLevel=swMSTPRevisionLevel, BridgeId=BridgeId, swMSTPStpLBD=swMSTPStpLBD, swMSTPInstForwardDelay=swMSTPInstForwardDelay, swMSTPMstPort=swMSTPMstPort, swMSTPPortRecoverFilterBpdu=swMSTPPortRecoverFilterBpdu, swMSTPStpMaxHops=swMSTPStpMaxHops, swMSTPPortRestrictedTCN=swMSTPPortRestrictedTCN, swMSTPPortOperHelloTime=swMSTPPortOperHelloTime, swMSTPInstMaxAge=swMSTPInstMaxAge, swMSTPTraps=swMSTPTraps, swMSTPInstRemainHops=swMSTPInstRemainHops, swMSTPMstPortRole=swMSTPMstPortRole, swMSTPInstPriority=swMSTPInstPriority, swMSTPStpForwardBPDU=swMSTPStpForwardBPDU, swMSTPInstDesignatedRootBridge=swMSTPInstDesignatedRootBridge, swMSTPInstRegionalRootBridge=swMSTPInstRegionalRootBridge, swMSTPInstInternalRootCost=swMSTPInstInternalRootCost, swMSTPNotify=swMSTPNotify, swMSTPStpVersion=swMSTPStpVersion, swMSTPInstVlanRangeList321to384=swMSTPInstVlanRangeList321to384, swMSTPStpHelloTime=swMSTPStpHelloTime, swMSTPPort=swMSTPPort, swMSTPMstPortTable=swMSTPMstPortTable, swMSTPNotifyPrefix=swMSTPNotifyPrefix, swMSTPPortOperFilterBpdu=swMSTPPortOperFilterBpdu, PYSNMP_MODULE_ID=dgs6600StpExtMIB, swMSTPInstVlanRangeList449to512=swMSTPInstVlanRangeList449to512, swMSTPInstVlanRangeList129to192=swMSTPInstVlanRangeList129to192, swMSTPPortExternalPathCost=swMSTPPortExternalPathCost, swMSTPHwFilterStatusChange=swMSTPHwFilterStatusChange, swMSTPName=swMSTPName, swMSTPInstLastTopologyChange=swMSTPInstLastTopologyChange, swMSTPCtrl=swMSTPCtrl, swMSTPInstId=swMSTPInstId, swMSTPPortAlternateTrap=swMSTPPortAlternateTrap, swMSTPStpTxHoldCount=swMSTPStpTxHoldCount, swMSTPMstPortPriority=swMSTPMstPortPriority, swMSTPInstVlanRangeList257to320=swMSTPInstVlanRangeList257to320, swMSTPMstPortInternalPathCost=swMSTPMstPortInternalPathCost, swMSTPPortMigration=swMSTPPortMigration, swMSTPPortTable=swMSTPPortTable, swMSTPPortAdminEdgePort=swMSTPPortAdminEdgePort, swMSTPPortLBD=swMSTPPortLBD, swMSTPMstPortInsID=swMSTPMstPortInsID)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(dgs6600_l2,) = mibBuilder.importSymbols('DGS-6600-ID-MIB', 'dgs6600-l2')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(gauge32, time_ticks, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, iso, counter64, notification_type, mib_identifier, integer32, unsigned32, ip_address, object_identity, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'TimeTicks', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'iso', 'Counter64', 'NotificationType', 'MibIdentifier', 'Integer32', 'Unsigned32', 'IpAddress', 'ObjectIdentity', 'Bits')
(textual_convention, truth_value, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'RowStatus', 'DisplayString')
dgs6600_stp_ext_mib = module_identity((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2))
if mibBuilder.loadTexts:
dgs6600StpExtMIB.setLastUpdated('0812190000Z')
if mibBuilder.loadTexts:
dgs6600StpExtMIB.setOrganization('D-Link Corp.')
if mibBuilder.loadTexts:
dgs6600StpExtMIB.setContactInfo('http://support.dlink.com')
if mibBuilder.loadTexts:
dgs6600StpExtMIB.setDescription('The MIB module for managing MSTP.')
class Bridgeid(OctetString):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(8, 8)
fixed_length = 8
sw_mstp_gbl_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1))
sw_mstp_ctrl = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2))
sw_mstp_stp_admin_state = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpAdminState.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpAdminState.setDescription('This object indicates the spanning tree state of the bridge.')
sw_mstp_stp_version = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('stp', 0), ('rstp', 1), ('mstp', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpVersion.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpVersion.setDescription('The version of Spanning Tree Protocol the bridge is currently running.')
sw_mstp_stp_max_age = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(600, 4000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpMaxAge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpMaxAge.setDescription('The value that all bridges use for MaxAge when this bridge is acting as the root. Note that the range for this parameter is related to the value of StpForwardDelay and PortAdminHelloTime. MaxAge <= 2(ForwardDelay - 1);MaxAge >= 2(HelloTime + 1) The granularity of this timer is specified by 802.1D-1990 to be 1 second. An agent may return a badValue error if a set is attempted to a value that is not a whole number of seconds.')
sw_mstp_stp_hello_time = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpHelloTime.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpHelloTime.setDescription('The value is used for HelloTime when this bridge is acting in RSTP or STP mode, in units of hundredths of a second. You can only read/write this value in RSTP or STP mode.')
sw_mstp_stp_forward_delay = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(400, 3000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpForwardDelay.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpForwardDelay.setDescription('This value controls how long a port changes its spanning state from blocking to learning state and from learning to forwarding state. Note that the range for this parameter is related to MaxAge')
sw_mstp_stp_max_hops = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 40))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpMaxHops.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpMaxHops.setDescription('This value applies to all spanning trees within an MST Region for which the bridge is the Regional Root.')
sw_mstp_stp_tx_hold_count = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpTxHoldCount.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpTxHoldCount.setDescription('The value used by the Port Transmit state machine to limit the maximum transmission rate.')
sw_mstp_stp_forward_bpdu = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpForwardBPDU.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpForwardBPDU.setDescription('The enabled/disabled status is used to forward BPDU to a non STP port.')
sw_mstp_stp_lbd = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpLBD.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpLBD.setDescription('The enabled/disabled status is used in Loop-back prevention.')
sw_mstp_stp_lbd_recover_time = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 1000000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPStpLBDRecoverTime.setStatus('current')
if mibBuilder.loadTexts:
swMSTPStpLBDRecoverTime.setDescription("The period of time (in seconds) in which the STP module keeps checking the BPDU loop status. The valid range is 60 to 1000000. If this value is set from 1 to 59, you will get a 'bad value' return code. The value of zero is a special value that means to disable the auto-recovery mechanism for the LBD feature.")
sw_mstp_nni_bpdu_address = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('dot1d', 1), ('dot1ad', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPNniBPDUAddress.setStatus('current')
if mibBuilder.loadTexts:
swMSTPNniBPDUAddress.setDescription('Specifies the BPDU MAC address of the NNI port in Q-in-Q status.')
sw_mstp_name = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPName.setStatus('current')
if mibBuilder.loadTexts:
swMSTPName.setDescription('The object indicates the name of the MST Configuration Identification.')
sw_mstp_revision_level = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPRevisionLevel.setStatus('current')
if mibBuilder.loadTexts:
swMSTPRevisionLevel.setDescription('The object indicates the revision level of the MST Configuration Identification.')
sw_mstp_instance_ctrl_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3))
if mibBuilder.loadTexts:
swMSTPInstanceCtrlTable.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstanceCtrlTable.setDescription('A table that contains MSTP instance information.')
sw_mstp_instance_ctrl_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1)).setIndexNames((0, 'DGS-6600-STP-EXT-MIB', 'swMSTPInstId'))
if mibBuilder.loadTexts:
swMSTPInstanceCtrlEntry.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstanceCtrlEntry.setDescription('A list of MSTP instance information.')
sw_mstp_inst_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstId.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstId.setDescription('This object indicates the specific instance. An MSTP Instance ID (MSTID) of zero is used to identify the CIST.')
sw_mstp_inst_vlan_range_list1to64 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList1to64.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList1to64.setDescription('This object indicates the VLAN range (1-512) that belongs to the instance.')
sw_mstp_inst_vlan_range_list65to128 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList65to128.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList65to128.setDescription('This object indicates the VLAN range (513-1024) that belongs to the instance.')
sw_mstp_inst_vlan_range_list129to192 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList129to192.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList129to192.setDescription('This object indicates the VLAN range (1025-1536) that belongs to the instance.')
sw_mstp_inst_vlan_range_list193to256 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList193to256.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList193to256.setDescription('This object indicates the VLAN range(1537-2048) that belongs to the instance.')
sw_mstp_inst_vlan_range_list257to320 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList257to320.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList257to320.setDescription('This object indicates the VLAN range (2049-2560) that belongs to the instance.')
sw_mstp_inst_vlan_range_list321to384 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 7), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList321to384.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList321to384.setDescription('This object indicates the VLAN range (2561-3072) that belongs to the instance.')
sw_mstp_inst_vlan_range_list385to448 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 8), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList385to448.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList385to448.setDescription('This object indicates the VLAN range (3073-3584) that belongs to the instance.')
sw_mstp_inst_vlan_range_list449to512 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 9), octet_string().subtype(subtypeSpec=value_size_constraint(64, 64)).setFixedLength(64)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList449to512.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstVlanRangeList449to512.setDescription('This object indicates the VLAN range (3585-4096) that belongs to the instance.')
sw_mstp_inst_type = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('cist', 0), ('msti', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstType.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstType.setDescription('This object indicates the type of instance.')
sw_mstp_inst_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstStatus.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstStatus.setDescription('The instance state that could be enabled/disabled.')
sw_mstp_inst_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 61440))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstPriority.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstPriority.setDescription('The priority of the instance. The priority must be divisible by 4096 ')
sw_mstp_inst_designated_root_bridge = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 13), bridge_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstDesignatedRootBridge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstDesignatedRootBridge.setDescription('The bridge identifier of the CIST. For MST instance, this object is unused.')
sw_mstp_inst_external_root_cost = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstExternalRootCost.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstExternalRootCost.setDescription('The path cost between MST Regions from the transmitting bridge to the CIST Root. For MST instance this object is unused.')
sw_mstp_inst_regional_root_bridge = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 15), bridge_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstRegionalRootBridge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstRegionalRootBridge.setDescription('For CIST, Regional Root Identifier is the Bridge Identifier of the single bridge in a Region whose CIST Root Port is a Boundary Port, or the Bridge Identifier of the CIST Root if that is within the Region; For MSTI,MSTI Regional Root Identifier is the Bridge Identifier of the MSTI Regional Root for this particular MSTI in this MST Region; The Regional Root Bridge of this instance.')
sw_mstp_inst_internal_root_cost = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 16), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstInternalRootCost.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstInternalRootCost.setDescription('For CIST, the internal path cost is the path cost to the CIST Regional Root; For MSTI, the internal path cost is the path cost to the MSTI Regional Root for this particular MSTI in this MST Region')
sw_mstp_inst_designated_bridge = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 17), bridge_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstDesignatedBridge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstDesignatedBridge.setDescription('The Bridge Identifier for the transmitting bridge for this CIST or MSTI')
sw_mstp_inst_root_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 18), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstRootPort.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstRootPort.setDescription('The port number of the port which offers the lowest cost path from this bridge to the CIST or MSTI root bridge.')
sw_mstp_inst_max_age = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 19), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstMaxAge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstMaxAge.setDescription('The maximum age of Spanning Tree Protocol information learned from the network on any port before it is discarded, in units of hundredths of a second. This is the actual value that this bridge is currently using.')
sw_mstp_inst_forward_delay = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 20), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstForwardDelay.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstForwardDelay.setDescription('This value, measured in units of hundredths of a second, controls how fast a port changes its spanning state when moving towards the forwarding state. The value determines how long the port stays in each of the listening and learning states, which precede the Forwarding state. This value is also used, when a topology change has been detected and is underway, to age all dynamic entries in the Forwarding Database.')
sw_mstp_inst_last_topology_change = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 21), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstLastTopologyChange.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstLastTopologyChange.setDescription('The time (in hundredths of a second) since the last time a topology change was detected by the bridge entity.')
sw_mstp_inst_top_changes_count = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 22), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstTopChangesCount.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstTopChangesCount.setDescription('The total number of topology changes detected by this bridge since the management entity was last reset or initialized.')
sw_mstp_inst_remain_hops = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 23), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPInstRemainHops.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstRemainHops.setDescription('The root bridge in the instance for MSTI always sends a BPDU with a maximum hop count. When a switch receives this BPDU, it decrements the received maximum hop count by one and propagates this value as the remaining hop count in the BPDUs it generates.')
sw_mstp_inst_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 3, 1, 24), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
swMSTPInstRowStatus.setStatus('current')
if mibBuilder.loadTexts:
swMSTPInstRowStatus.setDescription('This object indicates the RowStatus of this entry.')
sw_mstp_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4))
if mibBuilder.loadTexts:
swMSTPPortTable.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortTable.setDescription('A table that contains port-specific information for the Spanning Tree Protocol.')
sw_mstp_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1)).setIndexNames((0, 'DGS-6600-STP-EXT-MIB', 'swMSTPPort'))
if mibBuilder.loadTexts:
swMSTPPortEntry.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortEntry.setDescription('A list of information maintained by every port about the Spanning Tree Protocol state for that port.')
sw_mstp_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPPort.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPort.setDescription('The port number of the port for this entry.')
sw_mstp_port_admin_hello_time = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortAdminHelloTime.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortAdminHelloTime.setDescription('The amount of time between the transmission of BPDU by this node on any port when it is the root of the spanning tree or trying to become so, in units of hundredths of a second.')
sw_mstp_port_oper_hello_time = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPPortOperHelloTime.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortOperHelloTime.setDescription('The actual value of the hello time.')
sw_mstpstp_port_enable = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPSTPPortEnable.setStatus('current')
if mibBuilder.loadTexts:
swMSTPSTPPortEnable.setDescription('The enabled/disabled status of the port.')
sw_mstp_port_external_path_cost = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 200000000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortExternalPathCost.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortExternalPathCost.setDescription('The contribution of this port to the path cost of paths towards the CIST root which include this port.')
sw_mstp_port_migration = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 6), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortMigration.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortMigration.setDescription('When operating in MSTP mode or RSTP mode, writing TRUE(1) to this object forces this port to transmit MST BPDUs. Any other operation on this object has no effect and it always returns FALSE(2) when read.')
sw_mstp_port_admin_edge_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('true', 1), ('false', 2), ('auto', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortAdminEdgePort.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortAdminEdgePort.setDescription('The value of the Edge Port parameter. A value of TRUE indicates that this port should be assumed as an edge-port and a value of FALSE indicates that this port should be assumed as a non-edge-port')
sw_mstp_port_oper_edge_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('true', 1), ('false', 2), ('auto', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPPortOperEdgePort.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortOperEdgePort.setDescription('It is the acutual value of the edge port status.')
sw_mstp_port_admin_p2_p = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('true', 0), ('false', 1), ('auto', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortAdminP2P.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortAdminP2P.setDescription('The point-to-point status of the LAN segment attached to this port.')
sw_mstp_port_oper_p2_p = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('true', 0), ('false', 1), ('auto', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPPortOperP2P.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortOperP2P.setDescription('It is the actual value of the P2P status.')
sw_mstp_port_lbd = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortLBD.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortLBD.setDescription('The enabled/disabled status is used for Loop-back prevention attached to this port.')
sw_mstp_port_bpdu_filtering = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortBPDUFiltering.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortBPDUFiltering.setDescription('The enabled/disabled status is used for BPDU Filtering attached to this port.BPDU filtering allows the administrator to prevent the system from sending or even receiving BPDUs on specified ports.')
sw_mstp_port_restricted_role = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 13), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortRestrictedRole.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortRestrictedRole.setDescription('If TRUE, causes the port not to be selected as Root Port for the CIST or any MSTI, even it has the best spanning tree priority vector.')
sw_mstp_port_restricted_tcn = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 14), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortRestrictedTCN.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortRestrictedTCN.setDescription('If TRUE, causes the port not to propagate received topology change notifications and topology changes to other Ports.')
sw_mstp_port_oper_filter_bpdu = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('receiving', 1), ('filtering', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPPortOperFilterBpdu.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortOperFilterBpdu.setDescription('It is the actual value of the hardware filter BPDU status.')
sw_mstp_port_recover_filter_bpdu = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 4, 1, 16), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPPortRecoverFilterBpdu.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortRecoverFilterBpdu.setDescription('When operating in BPDU filtering mode, writing TRUE(1) to this object sets this port to receive BPDUs to the hardware. Any other operation on this object has no effect and it will always return FALSE(2) when read.')
sw_mstp_mst_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5))
if mibBuilder.loadTexts:
swMSTPMstPortTable.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortTable.setDescription('A table that contains port-specific information for the MST Protocol.')
sw_mstp_mst_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1)).setIndexNames((0, 'DGS-6600-STP-EXT-MIB', 'swMSTPMstPort'), (0, 'DGS-6600-STP-EXT-MIB', 'swMSTPMstPortInsID'))
if mibBuilder.loadTexts:
swMSTPMstPortEntry.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortEntry.setDescription('A list of information maintained by every port about the MST state for that port.')
sw_mstp_mst_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPMstPort.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPort.setDescription('The port number of the port for this entry.')
sw_mstp_mst_port_ins_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPMstPortInsID.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortInsID.setDescription('This object indicates the MSTP Instance ID (MSTID).')
sw_mstp_mst_port_designated_bridge = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 3), bridge_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPMstPortDesignatedBridge.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortDesignatedBridge.setDescription("The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for this port's segment on the corresponding Spanning Tree instance.")
sw_mstp_mst_port_internal_path_cost = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 200000000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPMstPortInternalPathCost.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortInternalPathCost.setDescription('This is the value of this port to the path cost of paths towards the MSTI root.')
sw_mstp_mst_port_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 240))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
swMSTPMstPortPriority.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortPriority.setDescription('The value of the priority field which is contained in the first (in network byte order) octet of the (2 octet long) Port ID.')
sw_mstp_mst_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('other', 1), ('disabled', 2), ('discarding', 3), ('learning', 4), ('forwarding', 5), ('broken', 6), ('no-stp-enabled', 7), ('err-disabled', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPMstPortStatus.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortStatus.setDescription("When the port Enable state is enabled, the port's current state as defined by application of the Spanning Tree Protocol. If the PortEnable is disabled, the port status will be no-stp-enabled (7). If the port is in error disabled status, the port status will be err-disable(8)")
sw_mstp_mst_port_role = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 2, 5, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('disable', 0), ('alternate', 1), ('backup', 2), ('root', 3), ('designated', 4), ('master', 5), ('nonstp', 6), ('loopback', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
swMSTPMstPortRole.setStatus('current')
if mibBuilder.loadTexts:
swMSTPMstPortRole.setDescription("When the port Enable state is enabled, the port's current port role as defined by application of the Spanning Tree Protocol. If the Port Enable state is disabled, the port role will be nonstp(5)")
sw_mstp_traps = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11))
sw_mstp_notify = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1))
sw_mstp_notify_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0))
sw_mstp_port_lbd_trap = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 1)).setObjects(('DGS-6600-STP-EXT-MIB', 'swMSTPPort'))
if mibBuilder.loadTexts:
swMSTPPortLBDTrap.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortLBDTrap.setDescription('When STP port loopback detect is enabled, a trap will be generated.')
sw_mstp_port_backup_trap = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 2)).setObjects(('DGS-6600-STP-EXT-MIB', 'swMSTPMstPort'), ('DGS-6600-STP-EXT-MIB', 'swMSTPMstPortInsID'))
if mibBuilder.loadTexts:
swMSTPPortBackupTrap.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortBackupTrap.setDescription('When the STP port role goes to backup (defined in the STP standard), a trap will be generated.')
sw_mstp_port_alternate_trap = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 3)).setObjects(('DGS-6600-STP-EXT-MIB', 'swMSTPMstPort'), ('DGS-6600-STP-EXT-MIB', 'swMSTPMstPortInsID'))
if mibBuilder.loadTexts:
swMSTPPortAlternateTrap.setStatus('current')
if mibBuilder.loadTexts:
swMSTPPortAlternateTrap.setDescription('When the STP port role goes to alternate (defined in the STP standard), a trap will be generated.')
sw_mstp_hw_filter_status_change = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 4)).setObjects(('DGS-6600-STP-EXT-MIB', 'swMSTPPort'), ('DGS-6600-STP-EXT-MIB', 'swMSTPPortOperFilterBpdu'))
if mibBuilder.loadTexts:
swMSTPHwFilterStatusChange.setStatus('current')
if mibBuilder.loadTexts:
swMSTPHwFilterStatusChange.setDescription('This trap is sent when a BPDU hardware filter status port changes.')
sw_mstp_root_restricted_change = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 120, 100, 2, 2, 11, 1, 0, 5)).setObjects(('DGS-6600-STP-EXT-MIB', 'swMSTPPort'), ('DGS-6600-STP-EXT-MIB', 'swMSTPPortRestrictedRole'))
if mibBuilder.loadTexts:
swMSTPRootRestrictedChange.setStatus('current')
if mibBuilder.loadTexts:
swMSTPRootRestrictedChange.setDescription('This trap is sent when a restricted role state port changes.')
mibBuilder.exportSymbols('DGS-6600-STP-EXT-MIB', swMSTPPortBackupTrap=swMSTPPortBackupTrap, dgs6600StpExtMIB=dgs6600StpExtMIB, swMSTPMstPortEntry=swMSTPMstPortEntry, swMSTPInstVlanRangeList193to256=swMSTPInstVlanRangeList193to256, swMSTPStpMaxAge=swMSTPStpMaxAge, swMSTPInstDesignatedBridge=swMSTPInstDesignatedBridge, swMSTPPortAdminP2P=swMSTPPortAdminP2P, swMSTPPortOperP2P=swMSTPPortOperP2P, swMSTPGblMgmt=swMSTPGblMgmt, swMSTPPortLBDTrap=swMSTPPortLBDTrap, swMSTPPortOperEdgePort=swMSTPPortOperEdgePort, swMSTPRootRestrictedChange=swMSTPRootRestrictedChange, swMSTPStpLBDRecoverTime=swMSTPStpLBDRecoverTime, swMSTPInstVlanRangeList65to128=swMSTPInstVlanRangeList65to128, swMSTPInstTopChangesCount=swMSTPInstTopChangesCount, swMSTPInstVlanRangeList1to64=swMSTPInstVlanRangeList1to64, swMSTPPortEntry=swMSTPPortEntry, swMSTPPortRestrictedRole=swMSTPPortRestrictedRole, swMSTPInstExternalRootCost=swMSTPInstExternalRootCost, swMSTPStpAdminState=swMSTPStpAdminState, swMSTPPortBPDUFiltering=swMSTPPortBPDUFiltering, swMSTPInstVlanRangeList385to448=swMSTPInstVlanRangeList385to448, swMSTPInstRootPort=swMSTPInstRootPort, swMSTPPortAdminHelloTime=swMSTPPortAdminHelloTime, swMSTPNniBPDUAddress=swMSTPNniBPDUAddress, swMSTPMstPortDesignatedBridge=swMSTPMstPortDesignatedBridge, swMSTPInstanceCtrlTable=swMSTPInstanceCtrlTable, swMSTPInstStatus=swMSTPInstStatus, swMSTPInstanceCtrlEntry=swMSTPInstanceCtrlEntry, swMSTPMstPortStatus=swMSTPMstPortStatus, swMSTPInstRowStatus=swMSTPInstRowStatus, swMSTPStpForwardDelay=swMSTPStpForwardDelay, swMSTPInstType=swMSTPInstType, swMSTPSTPPortEnable=swMSTPSTPPortEnable, swMSTPRevisionLevel=swMSTPRevisionLevel, BridgeId=BridgeId, swMSTPStpLBD=swMSTPStpLBD, swMSTPInstForwardDelay=swMSTPInstForwardDelay, swMSTPMstPort=swMSTPMstPort, swMSTPPortRecoverFilterBpdu=swMSTPPortRecoverFilterBpdu, swMSTPStpMaxHops=swMSTPStpMaxHops, swMSTPPortRestrictedTCN=swMSTPPortRestrictedTCN, swMSTPPortOperHelloTime=swMSTPPortOperHelloTime, swMSTPInstMaxAge=swMSTPInstMaxAge, swMSTPTraps=swMSTPTraps, swMSTPInstRemainHops=swMSTPInstRemainHops, swMSTPMstPortRole=swMSTPMstPortRole, swMSTPInstPriority=swMSTPInstPriority, swMSTPStpForwardBPDU=swMSTPStpForwardBPDU, swMSTPInstDesignatedRootBridge=swMSTPInstDesignatedRootBridge, swMSTPInstRegionalRootBridge=swMSTPInstRegionalRootBridge, swMSTPInstInternalRootCost=swMSTPInstInternalRootCost, swMSTPNotify=swMSTPNotify, swMSTPStpVersion=swMSTPStpVersion, swMSTPInstVlanRangeList321to384=swMSTPInstVlanRangeList321to384, swMSTPStpHelloTime=swMSTPStpHelloTime, swMSTPPort=swMSTPPort, swMSTPMstPortTable=swMSTPMstPortTable, swMSTPNotifyPrefix=swMSTPNotifyPrefix, swMSTPPortOperFilterBpdu=swMSTPPortOperFilterBpdu, PYSNMP_MODULE_ID=dgs6600StpExtMIB, swMSTPInstVlanRangeList449to512=swMSTPInstVlanRangeList449to512, swMSTPInstVlanRangeList129to192=swMSTPInstVlanRangeList129to192, swMSTPPortExternalPathCost=swMSTPPortExternalPathCost, swMSTPHwFilterStatusChange=swMSTPHwFilterStatusChange, swMSTPName=swMSTPName, swMSTPInstLastTopologyChange=swMSTPInstLastTopologyChange, swMSTPCtrl=swMSTPCtrl, swMSTPInstId=swMSTPInstId, swMSTPPortAlternateTrap=swMSTPPortAlternateTrap, swMSTPStpTxHoldCount=swMSTPStpTxHoldCount, swMSTPMstPortPriority=swMSTPMstPortPriority, swMSTPInstVlanRangeList257to320=swMSTPInstVlanRangeList257to320, swMSTPMstPortInternalPathCost=swMSTPMstPortInternalPathCost, swMSTPPortMigration=swMSTPPortMigration, swMSTPPortTable=swMSTPPortTable, swMSTPPortAdminEdgePort=swMSTPPortAdminEdgePort, swMSTPPortLBD=swMSTPPortLBD, swMSTPMstPortInsID=swMSTPMstPortInsID) |
def arithmetic_arranger(problems,calc = False):
if 5 < len(problems):
return "Error: Too many problems."
sOperand1 = sOperand2 = sDashes = sResults = ""
separator = " "
for i in range(len(problems)):
words = problems[i].split()
if(not (words[1] == "+" or words[1] =="-")):
return "Error: Operator must be '+' or '-'."
if( not words[0].isnumeric() or not words[2].isnumeric()):
return "Error: Numbers must only contain digits."
if(4 < len(words[0] ) or 4 < len(words[2])):
return "Error: Numbers cannot be more than four digits."
lengthOp = max(len(words[0]),len(words[2]))
sOperand1 += words[0].rjust(lengthOp+2)
sOperand2 += words[1]+ " " + words[2].rjust(lengthOp)
sDashes += "-"*(lengthOp + 2)
if calc:
if words[1] == "+":
sResults += str(int(words[0])+int(words[2])).rjust(lengthOp+2)
else:
sResults += str(int(words[0])-int(words[2])).rjust(lengthOp+2)
if i < len(problems)-1:
sOperand1 += separator
sOperand2 += separator
sDashes += separator
sResults += separator
arranged_problems = sOperand1 + "\n" + sOperand2 + "\n" + sDashes
if calc:
arranged_problems += "\n" + sResults
return arranged_problems | def arithmetic_arranger(problems, calc=False):
if 5 < len(problems):
return 'Error: Too many problems.'
s_operand1 = s_operand2 = s_dashes = s_results = ''
separator = ' '
for i in range(len(problems)):
words = problems[i].split()
if not (words[1] == '+' or words[1] == '-'):
return "Error: Operator must be '+' or '-'."
if not words[0].isnumeric() or not words[2].isnumeric():
return 'Error: Numbers must only contain digits.'
if 4 < len(words[0]) or 4 < len(words[2]):
return 'Error: Numbers cannot be more than four digits.'
length_op = max(len(words[0]), len(words[2]))
s_operand1 += words[0].rjust(lengthOp + 2)
s_operand2 += words[1] + ' ' + words[2].rjust(lengthOp)
s_dashes += '-' * (lengthOp + 2)
if calc:
if words[1] == '+':
s_results += str(int(words[0]) + int(words[2])).rjust(lengthOp + 2)
else:
s_results += str(int(words[0]) - int(words[2])).rjust(lengthOp + 2)
if i < len(problems) - 1:
s_operand1 += separator
s_operand2 += separator
s_dashes += separator
s_results += separator
arranged_problems = sOperand1 + '\n' + sOperand2 + '\n' + sDashes
if calc:
arranged_problems += '\n' + sResults
return arranged_problems |
#
# PySNMP MIB module MITEL-ERN (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-ERN
# Produced by pysmi-0.3.4 at Wed May 1 14:13:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion")
mitelAppCallServer, = mibBuilder.importSymbols("MITEL-MIB", "mitelAppCallServer")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
sysName, = mibBuilder.importSymbols("SNMPv2-MIB", "sysName")
Bits, IpAddress, NotificationType, Counter32, Unsigned32, Gauge32, iso, MibIdentifier, NotificationType, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Counter64, Integer32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "NotificationType", "Counter32", "Unsigned32", "Gauge32", "iso", "MibIdentifier", "NotificationType", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Counter64", "Integer32", "TimeTicks")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
class Integer32(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(-2147483648, 2147483647)
class DateAndTime(OctetString):
subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(8, 8), ValueSizeConstraint(11, 11), )
mitelCsEmergencyResponse = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3))
mitelCsErSeqNumber = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 1), Integer32())
if mibBuilder.loadTexts: mitelCsErSeqNumber.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErSeqNumber.setDescription('Same number used in the Emergency Call logs.')
mitelCsErCallType = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 2), Integer32())
if mibBuilder.loadTexts: mitelCsErCallType.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErCallType.setDescription('Type of Emergency Call.')
mitelCsErDetectTime = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 3), DateAndTime())
if mibBuilder.loadTexts: mitelCsErDetectTime.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErDetectTime.setDescription('The time that the emergency call occurred on the Call Server.')
mitelCsErCallingDN = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 4), DisplayString())
if mibBuilder.loadTexts: mitelCsErCallingDN.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErCallingDN.setDescription('The directory number dialed for the emergency call.')
mitelCsErCallingPNI = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 5), DisplayString())
if mibBuilder.loadTexts: mitelCsErCallingPNI.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErCallingPNI.setDescription('The PNI dialed for the emergency call.')
mitelCsErCesidDigits = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 6), DisplayString())
if mibBuilder.loadTexts: mitelCsErCesidDigits.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErCesidDigits.setDescription('The CESID assigned to the Dialing Number. May also be the default system CESID value or empty if the CESID is unknown.')
mitelCsErDialledDigits = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 7), DisplayString())
if mibBuilder.loadTexts: mitelCsErDialledDigits.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErDialledDigits.setDescription('The number dialed for the emergency call.')
mitelCsErRegistrationDN = MibScalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 8), DisplayString())
if mibBuilder.loadTexts: mitelCsErRegistrationDN.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErRegistrationDN.setDescription('The directory number dialed for the emergency call. This could be empty, the directory number of the device making the call, an incoming caller ID or remote CESID.')
mitelCsErUnackTable = MibTable((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9), )
if mibBuilder.loadTexts: mitelCsErUnackTable.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErUnackTable.setDescription("A list of notifications sent from this agent that are expected to be acknowledged, but have not yet received the acknowledgement. One entry is created for each acknowledgeable notification transmitted from this agent. Managers are expected to delete the rows in this table to acknowledge receipt of the notification. To do so, the index is provided in the notification sent to the manager. Any unacknowledged notifications are removed at the agent's discretion. This table is kept in volatile memory.")
mitelCsErUnackTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1), ).setIndexNames((0, "MITEL-ERN", "mitelCsErUnackTableIndex"))
if mibBuilder.loadTexts: mitelCsErUnackTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErUnackTableEntry.setDescription('An entry containing unacknowledged notification information.')
mitelCsErUnackTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 1), Integer32())
if mibBuilder.loadTexts: mitelCsErUnackTableIndex.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErUnackTableIndex.setDescription('The index of the row for the Manager to acknowledge the notification. If no acknowledgement is required, this will be 0. For require acknowledgement this is a unique value, greater than zero, for each row. The values are assigned contiguously starting from 1, and are not re-used (to allow for duplicated Set Requests for destruction of the row).')
mitelCsErUnackTableToken = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 2), Integer32()).setMaxAccess("writeonly")
if mibBuilder.loadTexts: mitelCsErUnackTableToken.setStatus('mandatory')
if mibBuilder.loadTexts: mitelCsErUnackTableToken.setDescription('The status of this row. A status of active indicates that an acknowledgement is still expected. Write a destroy(6) here to acknowledge this notification. A status of notInService indicates that no acknowledgement is expected.')
mitelCsErNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 10))
mitelCsErNotification = NotificationType((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3) + (0,401)).setObjects(("SNMPv2-MIB", "sysName"), ("MITEL-ERN", "mitelCsErSeqNumber"), ("MITEL-ERN", "mitelCsErCallType"), ("MITEL-ERN", "mitelCsErDetectTime"), ("MITEL-ERN", "mitelCsErCallingDN"), ("MITEL-ERN", "mitelCsErCallingPNI"), ("MITEL-ERN", "mitelCsErCesidDigits"), ("MITEL-ERN", "mitelCsErDialledDigits"), ("MITEL-ERN", "mitelCsErRegistrationDN"), ("MITEL-ERN", "mitelCsErUnackTableIndex"), ("MITEL-ERN", "mitelCsErUnackTableToken"))
if mibBuilder.loadTexts: mitelCsErNotification.setDescription('This notification is generated whenever an emergency call condition is detected. The manager is expected to ....')
mibBuilder.exportSymbols("MITEL-ERN", mitelCsErCallingDN=mitelCsErCallingDN, mitelCsErRegistrationDN=mitelCsErRegistrationDN, Integer32=Integer32, DateAndTime=DateAndTime, mitelCsErUnackTableToken=mitelCsErUnackTableToken, mitelCsEmergencyResponse=mitelCsEmergencyResponse, mitelCsErDetectTime=mitelCsErDetectTime, mitelCsErCallingPNI=mitelCsErCallingPNI, mitelCsErNotification=mitelCsErNotification, mitelCsErCesidDigits=mitelCsErCesidDigits, mitelCsErDialledDigits=mitelCsErDialledDigits, mitelCsErUnackTableEntry=mitelCsErUnackTableEntry, mitelCsErUnackTable=mitelCsErUnackTable, mitelCsErCallType=mitelCsErCallType, mitelCsErUnackTableIndex=mitelCsErUnackTableIndex, mitelCsErSeqNumber=mitelCsErSeqNumber, mitelCsErNotifications=mitelCsErNotifications)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion')
(mitel_app_call_server,) = mibBuilder.importSymbols('MITEL-MIB', 'mitelAppCallServer')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(sys_name,) = mibBuilder.importSymbols('SNMPv2-MIB', 'sysName')
(bits, ip_address, notification_type, counter32, unsigned32, gauge32, iso, mib_identifier, notification_type, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, counter64, integer32, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'IpAddress', 'NotificationType', 'Counter32', 'Unsigned32', 'Gauge32', 'iso', 'MibIdentifier', 'NotificationType', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Counter64', 'Integer32', 'TimeTicks')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
class Integer32(Integer32):
subtype_spec = Integer32.subtypeSpec + value_range_constraint(-2147483648, 2147483647)
class Dateandtime(OctetString):
subtype_spec = OctetString.subtypeSpec + constraints_union(value_size_constraint(8, 8), value_size_constraint(11, 11))
mitel_cs_emergency_response = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3))
mitel_cs_er_seq_number = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 1), integer32())
if mibBuilder.loadTexts:
mitelCsErSeqNumber.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErSeqNumber.setDescription('Same number used in the Emergency Call logs.')
mitel_cs_er_call_type = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 2), integer32())
if mibBuilder.loadTexts:
mitelCsErCallType.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErCallType.setDescription('Type of Emergency Call.')
mitel_cs_er_detect_time = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 3), date_and_time())
if mibBuilder.loadTexts:
mitelCsErDetectTime.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErDetectTime.setDescription('The time that the emergency call occurred on the Call Server.')
mitel_cs_er_calling_dn = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 4), display_string())
if mibBuilder.loadTexts:
mitelCsErCallingDN.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErCallingDN.setDescription('The directory number dialed for the emergency call.')
mitel_cs_er_calling_pni = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 5), display_string())
if mibBuilder.loadTexts:
mitelCsErCallingPNI.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErCallingPNI.setDescription('The PNI dialed for the emergency call.')
mitel_cs_er_cesid_digits = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 6), display_string())
if mibBuilder.loadTexts:
mitelCsErCesidDigits.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErCesidDigits.setDescription('The CESID assigned to the Dialing Number. May also be the default system CESID value or empty if the CESID is unknown.')
mitel_cs_er_dialled_digits = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 7), display_string())
if mibBuilder.loadTexts:
mitelCsErDialledDigits.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErDialledDigits.setDescription('The number dialed for the emergency call.')
mitel_cs_er_registration_dn = mib_scalar((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 8), display_string())
if mibBuilder.loadTexts:
mitelCsErRegistrationDN.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErRegistrationDN.setDescription('The directory number dialed for the emergency call. This could be empty, the directory number of the device making the call, an incoming caller ID or remote CESID.')
mitel_cs_er_unack_table = mib_table((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9))
if mibBuilder.loadTexts:
mitelCsErUnackTable.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErUnackTable.setDescription("A list of notifications sent from this agent that are expected to be acknowledged, but have not yet received the acknowledgement. One entry is created for each acknowledgeable notification transmitted from this agent. Managers are expected to delete the rows in this table to acknowledge receipt of the notification. To do so, the index is provided in the notification sent to the manager. Any unacknowledged notifications are removed at the agent's discretion. This table is kept in volatile memory.")
mitel_cs_er_unack_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1)).setIndexNames((0, 'MITEL-ERN', 'mitelCsErUnackTableIndex'))
if mibBuilder.loadTexts:
mitelCsErUnackTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErUnackTableEntry.setDescription('An entry containing unacknowledged notification information.')
mitel_cs_er_unack_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 1), integer32())
if mibBuilder.loadTexts:
mitelCsErUnackTableIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErUnackTableIndex.setDescription('The index of the row for the Manager to acknowledge the notification. If no acknowledgement is required, this will be 0. For require acknowledgement this is a unique value, greater than zero, for each row. The values are assigned contiguously starting from 1, and are not re-used (to allow for duplicated Set Requests for destruction of the row).')
mitel_cs_er_unack_table_token = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 9, 1, 2), integer32()).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
mitelCsErUnackTableToken.setStatus('mandatory')
if mibBuilder.loadTexts:
mitelCsErUnackTableToken.setDescription('The status of this row. A status of active indicates that an acknowledgement is still expected. Write a destroy(6) here to acknowledge this notification. A status of notInService indicates that no acknowledgement is expected.')
mitel_cs_er_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3, 10))
mitel_cs_er_notification = notification_type((1, 3, 6, 1, 4, 1, 1027, 4, 1, 1, 3) + (0, 401)).setObjects(('SNMPv2-MIB', 'sysName'), ('MITEL-ERN', 'mitelCsErSeqNumber'), ('MITEL-ERN', 'mitelCsErCallType'), ('MITEL-ERN', 'mitelCsErDetectTime'), ('MITEL-ERN', 'mitelCsErCallingDN'), ('MITEL-ERN', 'mitelCsErCallingPNI'), ('MITEL-ERN', 'mitelCsErCesidDigits'), ('MITEL-ERN', 'mitelCsErDialledDigits'), ('MITEL-ERN', 'mitelCsErRegistrationDN'), ('MITEL-ERN', 'mitelCsErUnackTableIndex'), ('MITEL-ERN', 'mitelCsErUnackTableToken'))
if mibBuilder.loadTexts:
mitelCsErNotification.setDescription('This notification is generated whenever an emergency call condition is detected. The manager is expected to ....')
mibBuilder.exportSymbols('MITEL-ERN', mitelCsErCallingDN=mitelCsErCallingDN, mitelCsErRegistrationDN=mitelCsErRegistrationDN, Integer32=Integer32, DateAndTime=DateAndTime, mitelCsErUnackTableToken=mitelCsErUnackTableToken, mitelCsEmergencyResponse=mitelCsEmergencyResponse, mitelCsErDetectTime=mitelCsErDetectTime, mitelCsErCallingPNI=mitelCsErCallingPNI, mitelCsErNotification=mitelCsErNotification, mitelCsErCesidDigits=mitelCsErCesidDigits, mitelCsErDialledDigits=mitelCsErDialledDigits, mitelCsErUnackTableEntry=mitelCsErUnackTableEntry, mitelCsErUnackTable=mitelCsErUnackTable, mitelCsErCallType=mitelCsErCallType, mitelCsErUnackTableIndex=mitelCsErUnackTableIndex, mitelCsErSeqNumber=mitelCsErSeqNumber, mitelCsErNotifications=mitelCsErNotifications) |
def oneaway(x,y):
# INSERT
x = list(x)
y = list(y)
if (len(x)+1) == len(y):
for k in x:
if k in y:
continue
else:
return "1 FUCK"
# REMOVAL
if (len(x)-1) == len(y):
for k in y:
if k in x:
continue
else:
return "2 FUCK"
# REPLACE
count = 0
if len(x) == len(y):
x = list(dict.fromkeys(x))
y = list(dict.fromkeys(y))
for k in x:
if k in y:
count += 1
if len(x) != (count+1):
return "3 FUCK"
return "WE ARE LAUGHING"
###############################
print(oneaway("pale", "ple"))
print(oneaway("pales", "pale"))
print(oneaway("pale", "bale"))
print(oneaway("pale", "bake"))
| def oneaway(x, y):
x = list(x)
y = list(y)
if len(x) + 1 == len(y):
for k in x:
if k in y:
continue
else:
return '1 FUCK'
if len(x) - 1 == len(y):
for k in y:
if k in x:
continue
else:
return '2 FUCK'
count = 0
if len(x) == len(y):
x = list(dict.fromkeys(x))
y = list(dict.fromkeys(y))
for k in x:
if k in y:
count += 1
if len(x) != count + 1:
return '3 FUCK'
return 'WE ARE LAUGHING'
print(oneaway('pale', 'ple'))
print(oneaway('pales', 'pale'))
print(oneaway('pale', 'bale'))
print(oneaway('pale', 'bake')) |
"""
State machine data structure with one start state and one stop state.
Source: http://www.python-course.eu/finite_state_machine.php
"""
class InitializationError(ValueError): pass
class InputError(ValueError): pass
###############################################################################
class StateMachine:
def __init__(self):
self.handlers = {}
self.start = None # s
self.end = None # t
def add_state(self, name, callback=None, start_state=False, end_state=False):
name = name.upper()
if name in self.handlers:
raise InitializationError('unable to reassign state name "' + name + '"')
self.handlers[name] = callback
if end_state:
self.end = name
if start_state:
self.start = name
def set_start(self, name):
self.start = name.upper()
def set_end(self, name):
self.end = name.upper()
def run(self, cargo, start=None):
run_start = self.start
if start:
run_start = start.upper()
if None == run_start:
raise InitializationError("assign start state before .run()")
if not self.end:
raise InitializationError("assign end state(s) before .run()")
if not cargo or len(cargo) == 0:
raise InputError("invalid fsm transitions supplied")
try:
handler = self.handlers[run_start]
except:
raise InitializationError("assign start state before .run()")
#print(cargo)
while True:
(newState, cargo) = handler(cargo)
#print("Reached", newState)
if newState.upper() == self.end:
break
else:
handler = self.handlers[newState.upper()]
if not handler:
raise InputError("invalid fsm transitions supplied")
###############################################################################
if __name__ == '__main__':
example = StateMachine()
def parse_command(text, enclosures = '()'):
lparen = text.find(enclosures[0])
rparen = text.rfind(enclosures[1])
return text[:lparen], text[lparen + 1: rparen]
for lines in range(int(input().strip())):
command, value = parse_command(input().strip())
if command == 'add_state':
example.add_state(value)
elif command == 'set_start':
example.set_start(value)
elif command == 'set_end':
example.set_end(value)
elif command == 'print_state_machine':
for h in example.handlers:
print(str(h) + ' --> ' + str(example.handlers[h]))
print('Start =', example.start)
print('End =', example.end)
else:
print("Invalid command detected:", command)
| """
State machine data structure with one start state and one stop state.
Source: http://www.python-course.eu/finite_state_machine.php
"""
class Initializationerror(ValueError):
pass
class Inputerror(ValueError):
pass
class Statemachine:
def __init__(self):
self.handlers = {}
self.start = None
self.end = None
def add_state(self, name, callback=None, start_state=False, end_state=False):
name = name.upper()
if name in self.handlers:
raise initialization_error('unable to reassign state name "' + name + '"')
self.handlers[name] = callback
if end_state:
self.end = name
if start_state:
self.start = name
def set_start(self, name):
self.start = name.upper()
def set_end(self, name):
self.end = name.upper()
def run(self, cargo, start=None):
run_start = self.start
if start:
run_start = start.upper()
if None == run_start:
raise initialization_error('assign start state before .run()')
if not self.end:
raise initialization_error('assign end state(s) before .run()')
if not cargo or len(cargo) == 0:
raise input_error('invalid fsm transitions supplied')
try:
handler = self.handlers[run_start]
except:
raise initialization_error('assign start state before .run()')
while True:
(new_state, cargo) = handler(cargo)
if newState.upper() == self.end:
break
else:
handler = self.handlers[newState.upper()]
if not handler:
raise input_error('invalid fsm transitions supplied')
if __name__ == '__main__':
example = state_machine()
def parse_command(text, enclosures='()'):
lparen = text.find(enclosures[0])
rparen = text.rfind(enclosures[1])
return (text[:lparen], text[lparen + 1:rparen])
for lines in range(int(input().strip())):
(command, value) = parse_command(input().strip())
if command == 'add_state':
example.add_state(value)
elif command == 'set_start':
example.set_start(value)
elif command == 'set_end':
example.set_end(value)
elif command == 'print_state_machine':
for h in example.handlers:
print(str(h) + ' --> ' + str(example.handlers[h]))
print('Start =', example.start)
print('End =', example.end)
else:
print('Invalid command detected:', command) |
"""Find the smallest integer in the array, Kata in Codewars."""
def smallest(alist):
"""Return the smallest integer in the list.
input: a list of integers
output: a single integer
ex: [34, 15, 88, 2] should return 34
ex: [34, -345, -1, 100] should return -345
"""
res = [alist[0]]
for num in alist:
if res[0] > num:
res.pop()
res.append(num)
return res[0]
| """Find the smallest integer in the array, Kata in Codewars."""
def smallest(alist):
"""Return the smallest integer in the list.
input: a list of integers
output: a single integer
ex: [34, 15, 88, 2] should return 34
ex: [34, -345, -1, 100] should return -345
"""
res = [alist[0]]
for num in alist:
if res[0] > num:
res.pop()
res.append(num)
return res[0] |
# Python - 3.6.0
test.describe('Example Tests')
tests = (
('John', 'Hello, John!'),
('aLIce', 'Hello, Alice!'),
('', 'Hello, World!')
)
for inp, exp in tests:
test.assert_equals(hello(inp), exp)
test.assert_equals(hello(), 'Hello, World!')
| test.describe('Example Tests')
tests = (('John', 'Hello, John!'), ('aLIce', 'Hello, Alice!'), ('', 'Hello, World!'))
for (inp, exp) in tests:
test.assert_equals(hello(inp), exp)
test.assert_equals(hello(), 'Hello, World!') |
'''
Author: Ajay Mahar
Lang: python3
Github: https://www.github.com/ajaymahar
YT: https://www.youtube.com/ajaymaharyt
'''
class Node:
def __init__(self, data):
"""TODO: Docstring for __init__.
:returns: TODO
"""
self.data = data
self.next = None
class Stack:
def __init__(self):
"""TODO: Docstring for __init__.
:returns: TODO
"""
self.head = None
self.size = 0
def push(self, data):
"""TODO: Docstring for push.
:returns: TODO
"""
if self.head:
newNode = Node(data)
newNode.next = self.head
self.head = newNode
self.size += 1
else:
self.head = Node(data)
self.size += 1
def pop(self):
"""TODO: Docstring for pop.
:returns: TODO
"""
if self.size == 0:
return None
tmpHead = self.head
self.head = tmpHead.next
self.size -= 1
tmpHead.next = None
return tmpHead.data
def peek(self):
"""TODO: Docstring for peek.
:arg1: TODO
:returns: TODO
"""
if self.head:
return self.head.data
return None
def isEmpty(self):
"""TODO: Docstring for isEmpty.
:returns: TODO
"""
return self.size == 0
if __name__ == "__main__":
st = Stack()
st.push(10)
st.push(20)
st.push(30)
st.push(40)
st.push(50)
print(st.peek())
print(st.size)
print(st.isEmpty())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.isEmpty())
| """
Author: Ajay Mahar
Lang: python3
Github: https://www.github.com/ajaymahar
YT: https://www.youtube.com/ajaymaharyt
"""
class Node:
def __init__(self, data):
"""TODO: Docstring for __init__.
:returns: TODO
"""
self.data = data
self.next = None
class Stack:
def __init__(self):
"""TODO: Docstring for __init__.
:returns: TODO
"""
self.head = None
self.size = 0
def push(self, data):
"""TODO: Docstring for push.
:returns: TODO
"""
if self.head:
new_node = node(data)
newNode.next = self.head
self.head = newNode
self.size += 1
else:
self.head = node(data)
self.size += 1
def pop(self):
"""TODO: Docstring for pop.
:returns: TODO
"""
if self.size == 0:
return None
tmp_head = self.head
self.head = tmpHead.next
self.size -= 1
tmpHead.next = None
return tmpHead.data
def peek(self):
"""TODO: Docstring for peek.
:arg1: TODO
:returns: TODO
"""
if self.head:
return self.head.data
return None
def is_empty(self):
"""TODO: Docstring for isEmpty.
:returns: TODO
"""
return self.size == 0
if __name__ == '__main__':
st = stack()
st.push(10)
st.push(20)
st.push(30)
st.push(40)
st.push(50)
print(st.peek())
print(st.size)
print(st.isEmpty())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.pop())
print(st.isEmpty()) |
'''PROGRAM TO, FOR A GIVEN LIST OF TUPLES, WHERE EACH TUPLE TAKES PATTERN (NAME,MARKS) OF A STUDENT, DISPLAY ONLY NAMES.'''
#Given list
scores = [("akash", 85), ("arind", 80), ("asha",95), ('bhavana',90), ('bhavik',87)]
#Seperaing names and marks
sep = list(zip(*scores))
names = sep[0]
#Displaying names
print('\nNames of students:')
for x in names:
print(x.title())
print() | """PROGRAM TO, FOR A GIVEN LIST OF TUPLES, WHERE EACH TUPLE TAKES PATTERN (NAME,MARKS) OF A STUDENT, DISPLAY ONLY NAMES."""
scores = [('akash', 85), ('arind', 80), ('asha', 95), ('bhavana', 90), ('bhavik', 87)]
sep = list(zip(*scores))
names = sep[0]
print('\nNames of students:')
for x in names:
print(x.title())
print() |
"""Sorts GO IDs or user-provided sections containing GO IDs."""
__copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
class SorterNts(object):
"""Handles GO IDs in user-created sections.
* Get a 2-D list of sections:
sections = [
['Immune', [
"GO:HHHHHH0", "GO:UUUUU00", ... "GO:UUUUU0N", "GO:HHHHHH1", ...]],
['Neuro', [
"GO:HHHHHH2", "GO:UUUUU20", ... "GO:UUUUU2N", "GO:HHHHHH3", ...]],
]
Also contains function for various tasks on grouped GO IDs:
* Sort in various ways (sort by: p=value, depth, proximity to leaf-level, etc.):
* Header GO ID groups
* User GO IDs within a group
"""
def __init__(self, sortgos, section_sortby=None):
# User GO IDs grouped under header GO IDs are not sorted by the Grouper class.
# Sort both user GO IDs in a group and header GO IDs across groups with these:
# S: section_sortby (T=True, F=False, S=lambda sort function)
# H: hdrgo_sortby Sorts hdr GO IDs
# U: sortby Sorts user GO IDs
# P: hdrgo_prt If True, Removes GO IDs used as GO group headers; Leaves list in
# sorted order, but removes header GO IDs which are not user GO IDs.
#
# rm_h hdr_sort usr_sort S H U P
# --- ------------ ------------ _ _ _ -
# NO hdrgo_sortby usrgo_sortby T H U T
# YES hdrgo_sortby usrgo_sortby T H U F
# NO section_order usrgo_sortby F - U T
# YES section_order usrgo_sortby F - U F
# YES |<----section_sortby---->| S - - -
# print("SSSS SorterNts(sortgos, section_sortby={})".format(section_sortby))
self.sortgos = sortgos # SorterGoIds
# section_sortby: True, False or None, or a sort_fnc
self.section_sortby = section_sortby
self.sections = self.sortgos.grprobj.hdrobj.sections
# print('IIIIIIIIIIII SorterNts section_sortby', section_sortby)
def get_sorted_nts_keep_section(self, hdrgo_prt):
"""Get 2-D list: 1st level is sections and 2nd level is grouped and sorted namedtuples."""
section_nts = []
# print("SSSS SorterNts:get_sorted_nts_keep_section(hdrgo_prt={})".format(hdrgo_prt))
hdrgos_actual = self.sortgos.grprobj.get_hdrgos()
hdrgos_secs = set()
hdrgo_sort = False if self.section_sortby is False else True
secname_dflt = self.sortgos.grprobj.hdrobj.secdflt
for section_name, section_hdrgos_all in self.sections:
#section_hdrgos_act = set(section_hdrgos_all).intersection(hdrgos_actual)
section_hdrgos_act = [h for h in section_hdrgos_all if h in hdrgos_actual]
hdrgos_secs |= set(section_hdrgos_act)
nts_section = self.sortgos.get_nts_sorted(hdrgo_prt, section_hdrgos_act, hdrgo_sort)
if nts_section:
nts_section = self._get_sorted_section(nts_section)
section_nts.append((section_name, nts_section))
remaining_hdrgos = hdrgos_actual.difference(hdrgos_secs)
# Add GO group headers not yet used under new section, Misc.
if remaining_hdrgos:
nts_section = self.sortgos.get_nts_sorted(hdrgo_prt, remaining_hdrgos, hdrgo_sort)
if nts_section:
nts_section = self._get_sorted_section(nts_section)
section_nts.append((secname_dflt, nts_section))
return section_nts
def get_sorted_nts_omit_section(self, hdrgo_prt, hdrgo_sort):
"""Return a flat list of sections (wo/section names) with GO terms grouped and sorted."""
nts_flat = []
# print("SSSS SorterNts:get_sorted_nts_omit_section(hdrgo_prt={}, hdrgo_sort={})".format(
# hdrgo_prt, hdrgo_sort))
hdrgos_seen = set()
hdrgos_actual = self.sortgos.grprobj.get_hdrgos()
for _, section_hdrgos_all in self.sections:
#section_hdrgos_act = set(section_hdrgos_all).intersection(hdrgos_actual)
section_hdrgos_act = [h for h in section_hdrgos_all if h in hdrgos_actual]
hdrgos_seen |= set(section_hdrgos_act)
self.sortgos.get_sorted_hdrgo2usrgos(
section_hdrgos_act, nts_flat, hdrgo_prt, hdrgo_sort)
remaining_hdrgos = set(self.sortgos.grprobj.get_hdrgos()).difference(hdrgos_seen)
self.sortgos.get_sorted_hdrgo2usrgos(remaining_hdrgos, nts_flat, hdrgo_prt, hdrgo_sort)
return nts_flat
def _get_sorted_section(self, nts_section):
"""Sort GO IDs in each section, if requested by user."""
#pylint: disable=unnecessary-lambda
if self.section_sortby is True:
return sorted(nts_section, key=lambda nt: self.sortgos.usrgo_sortby(nt))
if self.section_sortby is False or self.section_sortby is None:
return nts_section
# print('SORT GO IDS IN A SECTION')
return sorted(nts_section, key=lambda nt: self.section_sortby(nt))
# Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved.
| """Sorts GO IDs or user-provided sections containing GO IDs."""
__copyright__ = 'Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved.'
__author__ = 'DV Klopfenstein'
class Sorternts(object):
"""Handles GO IDs in user-created sections.
* Get a 2-D list of sections:
sections = [
['Immune', [
"GO:HHHHHH0", "GO:UUUUU00", ... "GO:UUUUU0N", "GO:HHHHHH1", ...]],
['Neuro', [
"GO:HHHHHH2", "GO:UUUUU20", ... "GO:UUUUU2N", "GO:HHHHHH3", ...]],
]
Also contains function for various tasks on grouped GO IDs:
* Sort in various ways (sort by: p=value, depth, proximity to leaf-level, etc.):
* Header GO ID groups
* User GO IDs within a group
"""
def __init__(self, sortgos, section_sortby=None):
self.sortgos = sortgos
self.section_sortby = section_sortby
self.sections = self.sortgos.grprobj.hdrobj.sections
def get_sorted_nts_keep_section(self, hdrgo_prt):
"""Get 2-D list: 1st level is sections and 2nd level is grouped and sorted namedtuples."""
section_nts = []
hdrgos_actual = self.sortgos.grprobj.get_hdrgos()
hdrgos_secs = set()
hdrgo_sort = False if self.section_sortby is False else True
secname_dflt = self.sortgos.grprobj.hdrobj.secdflt
for (section_name, section_hdrgos_all) in self.sections:
section_hdrgos_act = [h for h in section_hdrgos_all if h in hdrgos_actual]
hdrgos_secs |= set(section_hdrgos_act)
nts_section = self.sortgos.get_nts_sorted(hdrgo_prt, section_hdrgos_act, hdrgo_sort)
if nts_section:
nts_section = self._get_sorted_section(nts_section)
section_nts.append((section_name, nts_section))
remaining_hdrgos = hdrgos_actual.difference(hdrgos_secs)
if remaining_hdrgos:
nts_section = self.sortgos.get_nts_sorted(hdrgo_prt, remaining_hdrgos, hdrgo_sort)
if nts_section:
nts_section = self._get_sorted_section(nts_section)
section_nts.append((secname_dflt, nts_section))
return section_nts
def get_sorted_nts_omit_section(self, hdrgo_prt, hdrgo_sort):
"""Return a flat list of sections (wo/section names) with GO terms grouped and sorted."""
nts_flat = []
hdrgos_seen = set()
hdrgos_actual = self.sortgos.grprobj.get_hdrgos()
for (_, section_hdrgos_all) in self.sections:
section_hdrgos_act = [h for h in section_hdrgos_all if h in hdrgos_actual]
hdrgos_seen |= set(section_hdrgos_act)
self.sortgos.get_sorted_hdrgo2usrgos(section_hdrgos_act, nts_flat, hdrgo_prt, hdrgo_sort)
remaining_hdrgos = set(self.sortgos.grprobj.get_hdrgos()).difference(hdrgos_seen)
self.sortgos.get_sorted_hdrgo2usrgos(remaining_hdrgos, nts_flat, hdrgo_prt, hdrgo_sort)
return nts_flat
def _get_sorted_section(self, nts_section):
"""Sort GO IDs in each section, if requested by user."""
if self.section_sortby is True:
return sorted(nts_section, key=lambda nt: self.sortgos.usrgo_sortby(nt))
if self.section_sortby is False or self.section_sortby is None:
return nts_section
return sorted(nts_section, key=lambda nt: self.section_sortby(nt)) |
# https://binarysearch.com/problems/Largest-Anagram-Group
class Solution:
def solve(self, words):
anagrams = {}
for i in range(len(words)):
words[i] = "".join(sorted(list(words[i])))
if words[i] in anagrams:
anagrams[words[i]]+=1
else:
anagrams[words[i]]=1
return max(anagrams.values())
| class Solution:
def solve(self, words):
anagrams = {}
for i in range(len(words)):
words[i] = ''.join(sorted(list(words[i])))
if words[i] in anagrams:
anagrams[words[i]] += 1
else:
anagrams[words[i]] = 1
return max(anagrams.values()) |
class Solution:
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
paraList = re.split('\W', paragraph.lower())
paraListAlpha = []
for item in paraList:
item = ''.join([i for i in item if i.isalpha()])
paraListAlpha.append(item)
countParaList = Counter(paraListAlpha)
countParaListSort = sorted(countParaList.items(), key = lambda x:x[1], reverse=True)
print(countParaListSort)
for item in countParaListSort:
if item[0] in banned or item[0] == '':
continue
return item[0]
| class Solution:
def most_common_word(self, paragraph: str, banned: List[str]) -> str:
para_list = re.split('\\W', paragraph.lower())
para_list_alpha = []
for item in paraList:
item = ''.join([i for i in item if i.isalpha()])
paraListAlpha.append(item)
count_para_list = counter(paraListAlpha)
count_para_list_sort = sorted(countParaList.items(), key=lambda x: x[1], reverse=True)
print(countParaListSort)
for item in countParaListSort:
if item[0] in banned or item[0] == '':
continue
return item[0] |
with open("a.txt",'r') as ifile:
with open("b.txt","w") as ofile:
char = ifile.read(1)
while char:
if char==".":
ofile.write(char)
ofile.write("\n")
char = ifile.read(1)
else:
ofile.write(char)
char = ifile.read(1) | with open('a.txt', 'r') as ifile:
with open('b.txt', 'w') as ofile:
char = ifile.read(1)
while char:
if char == '.':
ofile.write(char)
ofile.write('\n')
char = ifile.read(1)
else:
ofile.write(char)
char = ifile.read(1) |
L, R = map(int, input().split())
ll = list(map(int, input().split()))
rl = list(map(int, input().split()))
lsize = [0]*41
rsize = [0]*41
for l in ll:
lsize[l] += 1
for r in rl:
rsize[r] += 1
ans = 0
for i in range(10, 41):
ans += min(lsize[i], rsize[i])
print(ans)
| (l, r) = map(int, input().split())
ll = list(map(int, input().split()))
rl = list(map(int, input().split()))
lsize = [0] * 41
rsize = [0] * 41
for l in ll:
lsize[l] += 1
for r in rl:
rsize[r] += 1
ans = 0
for i in range(10, 41):
ans += min(lsize[i], rsize[i])
print(ans) |
SIZE = 32
class Tile():
def __init__(self, collision=False, image=None, action_index=None):
self.collision = collision
self.image = image
self.action_index = action_index | size = 32
class Tile:
def __init__(self, collision=False, image=None, action_index=None):
self.collision = collision
self.image = image
self.action_index = action_index |
A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
B = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
C = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
intercalada = []
contador = 0
for i in range(10):
intercalada.append(A[contador])
intercalada.append(B[contador])
intercalada.append(C[contador])
contador += 1
print(intercalada)
| a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
c = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
intercalada = []
contador = 0
for i in range(10):
intercalada.append(A[contador])
intercalada.append(B[contador])
intercalada.append(C[contador])
contador += 1
print(intercalada) |
# Python program to demonstrate working of
# Set in Python
# Creating two sets
set1 = set()
set2 = set()
# Adding elements to set1
for i in range(1, 6):
set1.add(i)
# Adding elements to set2
for i in range(3, 8):
set2.add(i)
set1.add(1)
print("Set1 = ", set1)
print("Set2 = ", set2)
print("\n")
# Difference between discard() and remove()
# initialize my_set
my_set = {1, 3, 4, 5, 6}
print(my_set)
# discard an element
# Output: {1, 3, 5, 6}
my_set.discard(4)
print(my_set)
# remove an element
# Output: {1, 3, 5}
my_set.remove(6)
print(my_set)
# discard an element
# not present in my_set
# Output: {1, 3, 5}
my_set.discard(2)
print(my_set)
# remove an element
# not present in my_set
# you will get an error.
# Output: KeyError
#my_set.remove(2)
# initialize my_set
# Output: set of unique elements
my_set = set("HelloWorld")
print(my_set)
# pop an element
# Output: random element
print(my_set.pop())
# pop another element
my_set.pop()
print(my_set)
# clear my_set
# Output: set()
my_set.clear()
print(my_set)
print(my_set)
# Set union method
# initialize A and B
A = {1, 2, 3, 4, 5}
B = {4, 5, 6, 7, 8}
# use | operator
# Output: {1, 2, 3, 4, 5, 6, 7, 8}
print(A | B)
print(A.union(B))
# Intersection of sets
# initialize A and B
A = {1, 2, 3, 4, 5}
B = {4, 5, 6, 7, 8}
# use & operator
# Output: {4, 5}
print(A & B)
# A.intersection(B)
# Difference of two sets
# initialize A and B
A = {1, 2, 3, 4, 5}
B = {4, 5, 6, 7, 8}
# use - operator on A
# Output: {1, 2, 3}
print(A - B)
#A.difference(B)
# in keyword in a set
# initialize my_set
my_set = set("apple")
# check if 'a' is present
# Output: True
print('a' in my_set)
# check if 'p' is present
# Output: False
print('p' not in my_set)
for letter in set("apple"):
print(letter)
| set1 = set()
set2 = set()
for i in range(1, 6):
set1.add(i)
for i in range(3, 8):
set2.add(i)
set1.add(1)
print('Set1 = ', set1)
print('Set2 = ', set2)
print('\n')
my_set = {1, 3, 4, 5, 6}
print(my_set)
my_set.discard(4)
print(my_set)
my_set.remove(6)
print(my_set)
my_set.discard(2)
print(my_set)
my_set = set('HelloWorld')
print(my_set)
print(my_set.pop())
my_set.pop()
print(my_set)
my_set.clear()
print(my_set)
print(my_set)
a = {1, 2, 3, 4, 5}
b = {4, 5, 6, 7, 8}
print(A | B)
print(A.union(B))
a = {1, 2, 3, 4, 5}
b = {4, 5, 6, 7, 8}
print(A & B)
a = {1, 2, 3, 4, 5}
b = {4, 5, 6, 7, 8}
print(A - B)
my_set = set('apple')
print('a' in my_set)
print('p' not in my_set)
for letter in set('apple'):
print(letter) |
'''
Copyright 2011 Acknack Ltd
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.
'''
'''
Set of friendly error codes that can be displayed to the user on a webpage
'''
CANNOT_CONNECT_TO_WAVE_ERR = "e0000"
BOT_NOT_PARTICIPANT_ERR = "e0001"
PERMISSION_DENIED_ERR = "e0002"
REQUEST_DEADLINE_ERR = "e0003"
UNKNOWN_ERR = "e0004"
USER_DELETED_ERR = "e0005"
INADEQUATE_PERMISSION_ERR = "e0006" | """
Copyright 2011 Acknack Ltd
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.
"""
'\nSet of friendly error codes that can be displayed to the user on a webpage\n'
cannot_connect_to_wave_err = 'e0000'
bot_not_participant_err = 'e0001'
permission_denied_err = 'e0002'
request_deadline_err = 'e0003'
unknown_err = 'e0004'
user_deleted_err = 'e0005'
inadequate_permission_err = 'e0006' |
# This is your Application's Configuration File.
# Make sure not to upload this file!
# Flask App Secret. Used for "session".
flaskSecret = "<generateKey>"
# Register your V1 app at https://portal.azure.com.
# Sign-On URL as <domain>/customer/login/authorized i.e. http://localhost:5000/customer/login/authorized
# Make the Application Multi-Tenant
# Add access to Windows Azure Service Management API
# Create an App Key
clientId = "<GUID>"
clientSecret = "<SECRET>"
# The various resource endpoints. You may need to update this for different cloud environments.
aad_endpoint = "https://login.microsoftonline.com/"
resource_arm = "https://management.azure.com/"
resource_graph = "https://graph.windows.net/"
api_version_graph = "1.6"
| flask_secret = '<generateKey>'
client_id = '<GUID>'
client_secret = '<SECRET>'
aad_endpoint = 'https://login.microsoftonline.com/'
resource_arm = 'https://management.azure.com/'
resource_graph = 'https://graph.windows.net/'
api_version_graph = '1.6' |
"""
This package contains definitions for the geometric primitives in use in
``phantomas``.
"""
__all__ = ['fiber', 'models', 'utils', 'rois']
| """
This package contains definitions for the geometric primitives in use in
``phantomas``.
"""
__all__ = ['fiber', 'models', 'utils', 'rois'] |
def min4(*args):
min_ = args[0]
for item in args:
if item < min_:
min_ = item
return min_
a, b, c, d = int(input()), int(input()), int(input()), int(input())
print(min4(a, b, c, d))
| def min4(*args):
min_ = args[0]
for item in args:
if item < min_:
min_ = item
return min_
(a, b, c, d) = (int(input()), int(input()), int(input()), int(input()))
print(min4(a, b, c, d)) |
class Contender:
def __init__(self, names, values):
self.names = names
self.values = values
def __repr__(self):
strings = tuple(str(v.id()) for v in self.values)
return str(strings) + " contender"
def __lt__(self, other):
return self.values < other.values
def __getitem__(self, item):
idx = self.index_of(item)
return self.values[idx]
def index_of(self, varname):
return self.names.index(varname)
def id(self):
return tuple(v.id() for v in self.values)
def set_executor(self, executor):
self.executor = executor
def run(self, options, invocation):
return self.executor.run_with(options, invocation)
| class Contender:
def __init__(self, names, values):
self.names = names
self.values = values
def __repr__(self):
strings = tuple((str(v.id()) for v in self.values))
return str(strings) + ' contender'
def __lt__(self, other):
return self.values < other.values
def __getitem__(self, item):
idx = self.index_of(item)
return self.values[idx]
def index_of(self, varname):
return self.names.index(varname)
def id(self):
return tuple((v.id() for v in self.values))
def set_executor(self, executor):
self.executor = executor
def run(self, options, invocation):
return self.executor.run_with(options, invocation) |
def non_repeat(line):
ls = [line[i:j] for i in range(len(line))
for j in range(i+1, len(line)+1)
if len(set(line[i:j])) == j - i]
return max(ls, key=len, default='') | def non_repeat(line):
ls = [line[i:j] for i in range(len(line)) for j in range(i + 1, len(line) + 1) if len(set(line[i:j])) == j - i]
return max(ls, key=len, default='') |
first_number = int(input("Enter the first number(divisor): "))
second_number = int(input("Enter the second number(boundary): "))
for number in range(second_number, 0, -1):
if number % first_number == 0:
print(number)
break
| first_number = int(input('Enter the first number(divisor): '))
second_number = int(input('Enter the second number(boundary): '))
for number in range(second_number, 0, -1):
if number % first_number == 0:
print(number)
break |
n = int(input())
last = 1
lastlast = 0
print('0 1 ', end="")
for i in range(n-2):
now = last+lastlast
if i == n-3:
print('{}'.format(now))
else:
print('{} '.format(now), end="")
lastlast = last
last = now | n = int(input())
last = 1
lastlast = 0
print('0 1 ', end='')
for i in range(n - 2):
now = last + lastlast
if i == n - 3:
print('{}'.format(now))
else:
print('{} '.format(now), end='')
lastlast = last
last = now |
# -*- coding: utf-8 -*-
def main():
n = int(input())
dishes = list()
ans = 0
# See:
# https://poporix.hatenablog.com/entry/2019/01/28/222905
# https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
for i in range(n):
ai, bi = map(int, input().split())
dishes.append((ai, bi))
for index, dish in enumerate(sorted(dishes, key=lambda x: x[0] + x[1], reverse=True)):
if index % 2 == 0:
ans += dish[0]
else:
ans -= dish[1]
print(ans)
if __name__ == '__main__':
main()
| def main():
n = int(input())
dishes = list()
ans = 0
for i in range(n):
(ai, bi) = map(int, input().split())
dishes.append((ai, bi))
for (index, dish) in enumerate(sorted(dishes, key=lambda x: x[0] + x[1], reverse=True)):
if index % 2 == 0:
ans += dish[0]
else:
ans -= dish[1]
print(ans)
if __name__ == '__main__':
main() |
class Cell:
def __init__(self, x, y, entity = None, agent = None, dirty = False):
self.x = x
self.y = y
self.entity = entity
self.agent = agent
self.dirty = dirty
def set_entity(self, entity):
self.entity = entity
self.entity.x = self.x
self.entity.y = self.y
def set_agent(self, agent):
self.agent = agent
self.agent.x = self.x
self.agent.y = self.y
def free_entity(self):
self.entity = None
def free_agent(self):
self.agent = None
@property
def is_dirty(self):
return self.dirty
@property
def is_empty(self):
return self.entity == None and self.agent == None and not self.dirty
def __str__(self):
if self.agent:
return str(self.agent)
elif self.entity:
return str(self.entity)
elif self.dirty:
return "X"
else:
return "-" | class Cell:
def __init__(self, x, y, entity=None, agent=None, dirty=False):
self.x = x
self.y = y
self.entity = entity
self.agent = agent
self.dirty = dirty
def set_entity(self, entity):
self.entity = entity
self.entity.x = self.x
self.entity.y = self.y
def set_agent(self, agent):
self.agent = agent
self.agent.x = self.x
self.agent.y = self.y
def free_entity(self):
self.entity = None
def free_agent(self):
self.agent = None
@property
def is_dirty(self):
return self.dirty
@property
def is_empty(self):
return self.entity == None and self.agent == None and (not self.dirty)
def __str__(self):
if self.agent:
return str(self.agent)
elif self.entity:
return str(self.entity)
elif self.dirty:
return 'X'
else:
return '-' |
# Ann watched a TV program about health and learned that it is
# recommended to sleep at least A hours per day, but
# oversleeping is also not healthy, and you should not sleep more
# than B hours. Now Ann sleeps H hours per day. If Ann's sleep
# schedule complies with the requirements of that TV program -
# print "Normal". If Ann sleeps less than A hours, output
# "Deficiency", and if she sleeps more than B hours, output
# "Excess".
# Input to this program are the three strings with variables in the
# following order: A, B, H. A is always less than or equal to B.
# Please note the letter's cases: the output should exactly
# correspendond to what required in the program, i.e. if the program
# must output "Excess", output such as "excess", "EXCESS", or
# "ExCess" will not be graded as correct.
# You should carefully think about all the conditions, which you
# need to use. Special attention should be paid to the strictness
# of used conditional operators: distinguish between < and <=;
# > and >=. In order to understand which ones to use, please
# carefully read the problem statement.
(a, b, h) = (int(input()), int(input()), int(input()))
if h < a:
print("Deficiency")
elif h > b:
print("Excess")
else:
print("Normal")
| (a, b, h) = (int(input()), int(input()), int(input()))
if h < a:
print('Deficiency')
elif h > b:
print('Excess')
else:
print('Normal') |
def menu():
simulation_name = "listWithOptionsOptimized"
use_existing = True
save_results = False
print("This project is made to train agents to fight each other\nThere is three types of agents\n-dummy : don't do anything\n-runner : just moving\n-killer : move and shoot\nWe are only using dummies and runners for the three first basic levels\n\nYou will now choose the parameters of the game\n")
skipParam = input("skip and use default setup ? (best and latest trained agents) Y/N\n")
if skipParam == "Y" or skipParam == "y":
pass
elif skipParam == "N" or skipParam == "n":
answer = input("Select the number corresponding to the simulation you want to make:\n1: killer vs dummy (only killer is an agent, 2D)\n2: killer vs runner (only killer is an agent, 2D)\n3: killer vs runner (both are agents, 2D)\n4: killer vs killer (2D)\n5: three killers (2D)\n6: with Options (create your own in 2D)\n7: Optimized version (memory optimized version of 6:)\n")
if answer=='1':
simulation_name = "killerVsDummy"
elif answer=='2':
simulation_name = "killerVsRunner"
elif answer=='3':
simulation_name = "listKillerVsRunner"
elif answer=='4':
simulation_name = "listKillerVsKiller"
elif answer=='5':
simulation_name = "listThreeKillers"
elif answer=='6':
simulation_name = "listWithOptions"
elif answer=="7":
simulation_name = "listWithOptionsOptimized"
else:
print("wrong value selected")
answer = input("Do you want to use the already trained agents ? Y/N\n")
if answer == "Y" or answer == "y":
#use_existing = True
pass
elif answer == "N" or answer == "n":
use_existing = False
save = input("Do you want to save results after the training ? Y/N\n")
if save == "Y" or save == "y":
save_results = True
elif save == "N" or save == "n":
pass
else:
print("wrong value selected")
else:
print("wrong value selected")
else:
print("wrong value selected")
print("\nYou have selected : "+str(simulation_name)+", using trained agents:"+str(use_existing)+", saving results:"+str(save_results))
return use_existing, save_results, simulation_name
| def menu():
simulation_name = 'listWithOptionsOptimized'
use_existing = True
save_results = False
print("This project is made to train agents to fight each other\nThere is three types of agents\n-dummy : don't do anything\n-runner : just moving\n-killer : move and shoot\nWe are only using dummies and runners for the three first basic levels\n\nYou will now choose the parameters of the game\n")
skip_param = input('skip and use default setup ? (best and latest trained agents) Y/N\n')
if skipParam == 'Y' or skipParam == 'y':
pass
elif skipParam == 'N' or skipParam == 'n':
answer = input('Select the number corresponding to the simulation you want to make:\n1: killer vs dummy (only killer is an agent, 2D)\n2: killer vs runner (only killer is an agent, 2D)\n3: killer vs runner (both are agents, 2D)\n4: killer vs killer (2D)\n5: three killers (2D)\n6: with Options (create your own in 2D)\n7: Optimized version (memory optimized version of 6:)\n')
if answer == '1':
simulation_name = 'killerVsDummy'
elif answer == '2':
simulation_name = 'killerVsRunner'
elif answer == '3':
simulation_name = 'listKillerVsRunner'
elif answer == '4':
simulation_name = 'listKillerVsKiller'
elif answer == '5':
simulation_name = 'listThreeKillers'
elif answer == '6':
simulation_name = 'listWithOptions'
elif answer == '7':
simulation_name = 'listWithOptionsOptimized'
else:
print('wrong value selected')
answer = input('Do you want to use the already trained agents ? Y/N\n')
if answer == 'Y' or answer == 'y':
pass
elif answer == 'N' or answer == 'n':
use_existing = False
save = input('Do you want to save results after the training ? Y/N\n')
if save == 'Y' or save == 'y':
save_results = True
elif save == 'N' or save == 'n':
pass
else:
print('wrong value selected')
else:
print('wrong value selected')
else:
print('wrong value selected')
print('\nYou have selected : ' + str(simulation_name) + ', using trained agents:' + str(use_existing) + ', saving results:' + str(save_results))
return (use_existing, save_results, simulation_name) |
my_set = {4, 2, 8, 5, 10, 11, 10} # seturile sunt neordonate
my_set2 = {9, 5, 77, 22, 98, 11, 10}
print(my_set)
# print(my_set[0:]) #nu se poate
lst = (11, 12, 12, 14, 15, 13, 14)
print(set(lst)) #eliminam duplicatele din lista prin transformarea in set
print(my_set.difference(my_set2))
print(my_set.intersection(my_set2)) | my_set = {4, 2, 8, 5, 10, 11, 10}
my_set2 = {9, 5, 77, 22, 98, 11, 10}
print(my_set)
lst = (11, 12, 12, 14, 15, 13, 14)
print(set(lst))
print(my_set.difference(my_set2))
print(my_set.intersection(my_set2)) |
def make_weights_for_balanced_classes(images, nclasses):
count = [0] * nclasses
for item in images:
count[item[1]] += 1
weight_per_class = [0.] * nclasses
N = float(sum(count))
for i in range(nclasses):
weight_per_class[i] = N/float(count[i])
weight = [0] * len(images)
for idx, val in enumerate(images):
weight[idx] = weight_per_class[val[1]]
return weight
def train(net,train_loader,criterion,optimizer,epoch_num,device):
print('\nEpoch: %d' % epoch_num)
net.train()
train_loss = 0
correct = 0
total = 0
with tqdm(total=math.ceil(len(train_loader)), desc="Training") as pbar:
for batch_idx, (inputs, targets) in enumerate(train_loader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
optimizer.zero_grad()
loss.backward()
optimizer.step()
train_loss += criterion(outputs, targets).item()
_, predicted = torch.max(outputs.data, 1)
total += targets.size(0)
correct += predicted.eq(targets.data).sum()
pbar.set_postfix({'loss': '{0:1.5f}'.format(loss), 'accuracy': '{:.2%}'.format(correct.item() / total)})
pbar.update(1)
pbar.close()
return net
def evaluate(net,test_loader,criterion,best_val_acc,save_name,device):
with torch.no_grad():
test_loss = 0
correct = 0
total = 0
with tqdm(total=math.ceil(len(test_loader)), desc="Testing") as pbar:
for batch_idx, (inputs, targets) in enumerate(test_loader):
inputs, targets = inputs.to(device), targets.to(device)
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
_, predicted = torch.max(outputs.data, 1)
total += targets.size(0)
correct += predicted.eq(targets.data).sum()
pbar.set_postfix({'loss': '{0:1.5f}'.format(loss), 'accuracy': '{:.2%}'.format(correct.item() / total)})
pbar.update(1)
pbar.close()
acc = 100 * int(correct) / int(total)
if acc > best_val_acc:
torch.save(net.state_dict(),save_name)
best_val_acc = acc
return test_loss / (batch_idx + 1), best_val_acc | def make_weights_for_balanced_classes(images, nclasses):
count = [0] * nclasses
for item in images:
count[item[1]] += 1
weight_per_class = [0.0] * nclasses
n = float(sum(count))
for i in range(nclasses):
weight_per_class[i] = N / float(count[i])
weight = [0] * len(images)
for (idx, val) in enumerate(images):
weight[idx] = weight_per_class[val[1]]
return weight
def train(net, train_loader, criterion, optimizer, epoch_num, device):
print('\nEpoch: %d' % epoch_num)
net.train()
train_loss = 0
correct = 0
total = 0
with tqdm(total=math.ceil(len(train_loader)), desc='Training') as pbar:
for (batch_idx, (inputs, targets)) in enumerate(train_loader):
(inputs, targets) = (inputs.to(device), targets.to(device))
outputs = net(inputs)
loss = criterion(outputs, targets)
optimizer.zero_grad()
loss.backward()
optimizer.step()
train_loss += criterion(outputs, targets).item()
(_, predicted) = torch.max(outputs.data, 1)
total += targets.size(0)
correct += predicted.eq(targets.data).sum()
pbar.set_postfix({'loss': '{0:1.5f}'.format(loss), 'accuracy': '{:.2%}'.format(correct.item() / total)})
pbar.update(1)
pbar.close()
return net
def evaluate(net, test_loader, criterion, best_val_acc, save_name, device):
with torch.no_grad():
test_loss = 0
correct = 0
total = 0
with tqdm(total=math.ceil(len(test_loader)), desc='Testing') as pbar:
for (batch_idx, (inputs, targets)) in enumerate(test_loader):
(inputs, targets) = (inputs.to(device), targets.to(device))
outputs = net(inputs)
loss = criterion(outputs, targets)
test_loss += loss.item()
(_, predicted) = torch.max(outputs.data, 1)
total += targets.size(0)
correct += predicted.eq(targets.data).sum()
pbar.set_postfix({'loss': '{0:1.5f}'.format(loss), 'accuracy': '{:.2%}'.format(correct.item() / total)})
pbar.update(1)
pbar.close()
acc = 100 * int(correct) / int(total)
if acc > best_val_acc:
torch.save(net.state_dict(), save_name)
best_val_acc = acc
return (test_loss / (batch_idx + 1), best_val_acc) |
'''
You own a Goal Parser that can interpret a string command.
The command consists of an alphabet of "G", "()" and/or
"(al)" in some order. The Goal Parser will interpret "G"
as the string "G", "()" as the string "o", and "(al)" as
the string "al". The interpreted strings are then
concatenated in the original order.
Given the string command, return the Goal Parser's
interpretation of command.
Example:
Input: command = "G()(al)"
Output: "Goal"
Explanation: The Goal Parser interprets the command as
follows:
G -> G
() -> o
(al) -> al
The final concatenated result is "Goal".
Example:
Input: command = "G()()()()(al)"
Output: "Gooooal"
Example:
Input: command = "(al)G(al)()()G"
Output: "alGalooG"
Constraints:
- 1 <= command.length <= 100
- command consists of "G", "()", and/or "(al)" in some
order.
'''
#Difficulty:Easy
#105 / 105 test cases passed.
#Runtime: 32 ms
#Memory Usage: 14.1 MB
#Runtime: 32 ms, faster than 77.40% of Python3 online submissions for Goal Parser Interpretation.
#Memory Usage: 14.1 MB, less than 90.67% of Python3 online submissions for Goal Parser Interpretation.
class Solution:
def interpret(self, command: str) -> str:
command = list(command)
l = False
for i, char in enumerate(command):
if char == 'l':
l = True
elif char == '(':
command[i] = ''
elif char == ')':
command[i] = '' if l else 'o'
l = False
return ''.join(command)
| """
You own a Goal Parser that can interpret a string command.
The command consists of an alphabet of "G", "()" and/or
"(al)" in some order. The Goal Parser will interpret "G"
as the string "G", "()" as the string "o", and "(al)" as
the string "al". The interpreted strings are then
concatenated in the original order.
Given the string command, return the Goal Parser's
interpretation of command.
Example:
Input: command = "G()(al)"
Output: "Goal"
Explanation: The Goal Parser interprets the command as
follows:
G -> G
() -> o
(al) -> al
The final concatenated result is "Goal".
Example:
Input: command = "G()()()()(al)"
Output: "Gooooal"
Example:
Input: command = "(al)G(al)()()G"
Output: "alGalooG"
Constraints:
- 1 <= command.length <= 100
- command consists of "G", "()", and/or "(al)" in some
order.
"""
class Solution:
def interpret(self, command: str) -> str:
command = list(command)
l = False
for (i, char) in enumerate(command):
if char == 'l':
l = True
elif char == '(':
command[i] = ''
elif char == ')':
command[i] = '' if l else 'o'
l = False
return ''.join(command) |
def sequencia():
i = 0
j = 1
while i <= 2:
for aux in range(3):
if int(i) == i:
print(f'I={int(i)} J={int(j)}')
else:
print(f'I={i:.1f} J={j:.1f}')
j += 1
j = round(j - 3 + 0.2, 1)
i = round(i + 0.2, 1)
sequencia()
| def sequencia():
i = 0
j = 1
while i <= 2:
for aux in range(3):
if int(i) == i:
print(f'I={int(i)} J={int(j)}')
else:
print(f'I={i:.1f} J={j:.1f}')
j += 1
j = round(j - 3 + 0.2, 1)
i = round(i + 0.2, 1)
sequencia() |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
longest = 0
"""
@param root: the root of binary tree
@return: the length of the longest consecutive sequence path
"""
def longestConsecutive(self, root):
self.longest = 0
self.dfs(root, 0, [])
return self.longest
def dfs(self, node, length, combination):
if node is None:
return
if length != 0 and node.val != combination[-1] + 1:
length = 0
combination = []
length += 1
combination.append(node.val)
if length > self.longest:
self.longest = length
if node.left:
self.dfs(node.left, length, combination)
if node.right:
self.dfs(node.right, length, combination)
combination.pop() | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
longest = 0
'\n @param root: the root of binary tree\n @return: the length of the longest consecutive sequence path\n '
def longest_consecutive(self, root):
self.longest = 0
self.dfs(root, 0, [])
return self.longest
def dfs(self, node, length, combination):
if node is None:
return
if length != 0 and node.val != combination[-1] + 1:
length = 0
combination = []
length += 1
combination.append(node.val)
if length > self.longest:
self.longest = length
if node.left:
self.dfs(node.left, length, combination)
if node.right:
self.dfs(node.right, length, combination)
combination.pop() |
def twoSum( nums, target: int):
#Vaule = {}.fromkeys
for i in range(len(nums)):
a = target - nums[i]
for j in range(i+1,len(nums),1):
if a == nums[j]:
return [i,j]
findSum = twoSum(nums = [1,2,3,4,5,6,8],target=14)
print(findSum)
| def two_sum(nums, target: int):
for i in range(len(nums)):
a = target - nums[i]
for j in range(i + 1, len(nums), 1):
if a == nums[j]:
return [i, j]
find_sum = two_sum(nums=[1, 2, 3, 4, 5, 6, 8], target=14)
print(findSum) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2013-2016 Frantisek Uhrecky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
class UserModel:
"""
Holds User data.
"""
def __init__(self, u_id = None, name = None, passwd = None, salt = None, master = None):
"""
Initialize UserModel.
@param u_id: user id
@param name: user name
@param passwd: user passwd hash
@param salt: password salt
@param master: master password, plain text
"""
self._id = u_id
self._name = name
self._passwd = passwd
self._salt = salt
self._master = master | """
MIT License
Copyright (c) 2013-2016 Frantisek Uhrecky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
class Usermodel:
"""
Holds User data.
"""
def __init__(self, u_id=None, name=None, passwd=None, salt=None, master=None):
"""
Initialize UserModel.
@param u_id: user id
@param name: user name
@param passwd: user passwd hash
@param salt: password salt
@param master: master password, plain text
"""
self._id = u_id
self._name = name
self._passwd = passwd
self._salt = salt
self._master = master |
# Events for actors to send
__all__ = [
"NodeEvent",
"AuthPingEvent",
"TagEvent",
"UntagEvent",
"DetagEvent",
"RawMsgEvent",
"PingEvent",
"GoodNodeEvent",
"RecoverEvent",
"SetupEvent",
]
class NodeEvent:
pass
class AuthPingEvent(NodeEvent):
"""
Superclass for tag and ping: must arrive within :meth:`cycle_time_max` seconds of each other.
Non-abstract subclasses of this must have ``name`` and ``value`` attributes.
(TODO: enforce this)
"""
pass
class TagEvent(AuthPingEvent):
"""
This event says that for the moment, you're "it".
Arguments:
node(str): this node name.
value (any): the value attached to me.
"""
def __init__(self, node, value):
self.node = node
self.value = value
def __repr__(self):
return "<Tag %s %r>" % (self.node, self.value)
class UntagEvent(NodeEvent):
"""
Your tag cycle time has passed. You're no longer "it".
"""
def __repr__(self):
return "<UnTag>"
class DetagEvent(UntagEvent):
"""
A ping from another node has arrived while you're "it".
Unfortunately, it is "better" than ours.
Arguments:
node (str): The node that superseded us.
"""
def __init__(self, node):
self.node = node
def __repr__(self):
return "<DeTag %s>" % (self.node,)
class RawMsgEvent(NodeEvent):
"""
A message shows up. Not filtered. You must set "send_raw" when you
create the actor.
Arguments:
msg (dict): The raw data
"""
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return "<RawMsg %r>" % (self.msg,)
class PingEvent(AuthPingEvent):
"""
A ping from another node shows up: the node ``.node`` is "it".
Arguments:
msg (Message): The ping message sent by the currently-active actor.
"""
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return "<Ping %r>" % (self.msg,)
@property
def node(self):
"""
Name of the node. Shortcut to ``msg['node']``.
"""
try:
return self.msg.node
except AttributeError:
return None
@property
def value(self):
"""
Name of the node. Shortcut to ``msg['node']``.
"""
try:
return self.msg.value
except AttributeError:
return None
class GoodNodeEvent(NodeEvent):
"""
A known-good node has been seen. We might want to get data from it.
Arguments:
nodes (list(str)): Nodes known to have a non-``None`` value.
This event is seen while starting up, when our value is ``None``.
"""
def __init__(self, nodes):
self.nodes = nodes
def __repr__(self):
return "<Good %s>" % (self.nodes,)
class RecoverEvent(NodeEvent):
"""
We need to recover from a network split.
Arguments:
prio: Our recovery priority. Zero is highest.
replace: Flag whether the other side has superseded ours.
local_nodes: A list of recent actors on our side.
remote_nodes: A list of recent actors on the other side.
"""
def __init__(self, prio, replace, local_nodes, remote_nodes):
self.prio = prio
self.replace = replace
self.local_nodes = local_nodes
self.remote_nodes = remote_nodes
def __repr__(self):
return "<Recover %d %s %r %r>" % (
self.prio,
self.replace,
self.local_nodes,
self.remote_nodes,
)
class SetupEvent(NodeEvent):
"""
Parameters have been updated, most likely by the network.
"""
version = None
def __init__(self, msg):
for k in "version cycle gap nodes splits n_hosts".split():
try:
setattr(self, k, getattr(msg, k))
except AttributeError:
pass
def __repr__(self):
return "<Setup v:%s>" % (self.version,)
| __all__ = ['NodeEvent', 'AuthPingEvent', 'TagEvent', 'UntagEvent', 'DetagEvent', 'RawMsgEvent', 'PingEvent', 'GoodNodeEvent', 'RecoverEvent', 'SetupEvent']
class Nodeevent:
pass
class Authpingevent(NodeEvent):
"""
Superclass for tag and ping: must arrive within :meth:`cycle_time_max` seconds of each other.
Non-abstract subclasses of this must have ``name`` and ``value`` attributes.
(TODO: enforce this)
"""
pass
class Tagevent(AuthPingEvent):
"""
This event says that for the moment, you're "it".
Arguments:
node(str): this node name.
value (any): the value attached to me.
"""
def __init__(self, node, value):
self.node = node
self.value = value
def __repr__(self):
return '<Tag %s %r>' % (self.node, self.value)
class Untagevent(NodeEvent):
"""
Your tag cycle time has passed. You're no longer "it".
"""
def __repr__(self):
return '<UnTag>'
class Detagevent(UntagEvent):
"""
A ping from another node has arrived while you're "it".
Unfortunately, it is "better" than ours.
Arguments:
node (str): The node that superseded us.
"""
def __init__(self, node):
self.node = node
def __repr__(self):
return '<DeTag %s>' % (self.node,)
class Rawmsgevent(NodeEvent):
"""
A message shows up. Not filtered. You must set "send_raw" when you
create the actor.
Arguments:
msg (dict): The raw data
"""
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return '<RawMsg %r>' % (self.msg,)
class Pingevent(AuthPingEvent):
"""
A ping from another node shows up: the node ``.node`` is "it".
Arguments:
msg (Message): The ping message sent by the currently-active actor.
"""
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return '<Ping %r>' % (self.msg,)
@property
def node(self):
"""
Name of the node. Shortcut to ``msg['node']``.
"""
try:
return self.msg.node
except AttributeError:
return None
@property
def value(self):
"""
Name of the node. Shortcut to ``msg['node']``.
"""
try:
return self.msg.value
except AttributeError:
return None
class Goodnodeevent(NodeEvent):
"""
A known-good node has been seen. We might want to get data from it.
Arguments:
nodes (list(str)): Nodes known to have a non-``None`` value.
This event is seen while starting up, when our value is ``None``.
"""
def __init__(self, nodes):
self.nodes = nodes
def __repr__(self):
return '<Good %s>' % (self.nodes,)
class Recoverevent(NodeEvent):
"""
We need to recover from a network split.
Arguments:
prio: Our recovery priority. Zero is highest.
replace: Flag whether the other side has superseded ours.
local_nodes: A list of recent actors on our side.
remote_nodes: A list of recent actors on the other side.
"""
def __init__(self, prio, replace, local_nodes, remote_nodes):
self.prio = prio
self.replace = replace
self.local_nodes = local_nodes
self.remote_nodes = remote_nodes
def __repr__(self):
return '<Recover %d %s %r %r>' % (self.prio, self.replace, self.local_nodes, self.remote_nodes)
class Setupevent(NodeEvent):
"""
Parameters have been updated, most likely by the network.
"""
version = None
def __init__(self, msg):
for k in 'version cycle gap nodes splits n_hosts'.split():
try:
setattr(self, k, getattr(msg, k))
except AttributeError:
pass
def __repr__(self):
return '<Setup v:%s>' % (self.version,) |
# Tot's reward lv 50
sm.completeQuest(5522)
# Lv. 50 Equipment box
sm.giveItem(2430450, 1)
sm.dispose()
| sm.completeQuest(5522)
sm.giveItem(2430450, 1)
sm.dispose() |
"""
Inner module for card utilities.
"""
def is_location(card):
"""
Return true if `card` is a location card, false otherwise.
"""
return card.kind is not None and card.color is not None
def is_door(card):
"""
Return true if `card` is a door card, false otherwise.
"""
return card.kind is None and card.color is not None
def is_nightmare(card):
"""
Return true if `card` is a nightmare card, false otherwise.
"""
return card.kind is None and card.color is None
| """
Inner module for card utilities.
"""
def is_location(card):
"""
Return true if `card` is a location card, false otherwise.
"""
return card.kind is not None and card.color is not None
def is_door(card):
"""
Return true if `card` is a door card, false otherwise.
"""
return card.kind is None and card.color is not None
def is_nightmare(card):
"""
Return true if `card` is a nightmare card, false otherwise.
"""
return card.kind is None and card.color is None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.