content
stringlengths 7
1.05M
|
|---|
pallet_color = [
(231, 234, 238), # 010 White
(252, 166, 0), # 020Golden yellow
(232, 167, 0), # 019 Signal yellow
(254, 198, 0), # 021 Yellow
(242, 203, 0), # 022 Light yellow
(241, 225, 14), # 025 Brimstone yellow
(116, 2, 16), # 312 Burgundy
(145, 8, 20), # 030 Dark red
(175, 0, 11), # 031 Red
(199, 12, 0), # 032 Light red
(211, 48, 0), # 047 Orange red
(221, 68, 0), # 034 Orange
(236, 102, 0), # 036 Light orange
(255, 109, 0), # 035 Pastel orange
(65, 40, 114), # 404 Purple
(93, 43, 104), # 040 Violet
(120, 95, 162), # 043 Lavender
(186, 148, 188), # 042 Lilac
(195, 40, 106), # 041 Pink
(239, 135, 184), # 045 Soft pink
(19, 29, 57), # 562 Deep sea blue
(15, 17, 58), # 518 Steel blue
(28, 47, 94), # 050 Dark blue
(13, 31, 106), # 065 Cobalt blue
(23, 43, 121), # 049 King blue
(27, 47, 170), # 086 Brilliant blue
(0, 58, 120), # 057 Blue
(0, 65, 142), # 057 Traffic blue
(0, 69, 131), # 051 Gentian blue
(0, 79, 159), # 098 Gentian
(0, 94, 173), # 052 Azure blue
(0, 116, 187), # 084 Sky blue
(0, 136, 195), # 053 Light blue
(67, 162, 211), # 056 Ice blue
(0, 131, 142), # 066 Turquoise blue
(0, 155, 151), # 054 Turquoise
(95, 206, 183), # 055 Mint
(0, 60, 36), # 060 Dark green
(0, 82, 54), # 613 Forest green
(0, 122, 77), # 061 Green
(0, 120, 63), # 068 Grass green
(0, 137, 58), # 062 Light green
(35, 155, 17), # 064 Yellow green
(106, 167, 47), # 063 Lime-tree green
(85, 51, 28), # 080 Brown
(175, 89, 30), # 083 Nut brown
(168, 135, 90), # 081 Light brown
(205, 192, 158), # 082 Beige
(231, 210, 147), # 023 Cream
(6, 6, 7), # 070 Black
(75, 76, 76), # 073 Dark grey
(117, 125, 124), # 071 Grey
(128, 133, 136), # 076 Telegrey
(138, 143, 140), # 074 Middle grey
(192, 195, 195), # 072 Light grey
(111, 114, 116), # 090 Silver grey
(121, 101, 50), # 091 Gold
(105, 64, 30), # 092 Copper
]
pallet_color_name = [
"010 White",
"020Golden yellow",
"019 Signal yellow",
"021 Yellow",
"022 Light yellow",
"025 Brimstone yellow",
"312 Burgundy",
"030 Dark red",
"031 Red",
"032 Light red",
"047 Orange red",
"034 Orange",
"036 Light orange",
"035 Pastel orange",
"404 Purple",
"040 Violet",
"043 Lavender",
"042 Lilac",
"041 Pink",
"045 Soft pink",
"562 Deep sea blue",
"518 Steel blue",
"050 Dark blue",
"065 Cobalt blue",
"049 King blue",
"086 Brilliant blue",
"057 Blue",
"057 Traffic blue",
"051 Gentian blue",
"098 Gentian",
"052 Azure blue",
"084 Sky blue",
"053 Light blue",
"056 Ice blue",
"066 Turquoise blue",
"054 Turquoise",
"055 Mint",
"060 Dark green",
"613 Forest green",
"061 Green",
"068 Grass green",
"062 Light green",
"064 Yellow green",
"063 Lime-tree green",
"080 Brown",
"083 Nut brown",
"081 Light brown",
"082 Beige",
"023 Cream",
"070 Black",
"073 Dark grey",
"071 Grey",
"076 Telegrey",
"074 Middle grey",
"072 Light grey",
"090 Silver grey",
"091 Gold",
"092 Copper",
]
|
# All metrics are treated as gauge as the counter instrument don't provide a set
# method and for performance, it's always good to avoid calculation when ever it's possible.
# Using the inc() method require the diff to be calculated!
metrics = [
## Custom metrics
("up", "the status of the node (1=running, 0=down, -1=connection issue, -2=node error)"),
("peers_count", "how many peers the node is seeing"),
("sigs_count", "how many nodes are currently validating"),
("header_nextValidators_count", "how many nodes are in the validators set for the next epoch"),
("header_nextValidators_is_included", "if the node is included in the next validators set"),
("header_nextValidators_stake_min", "the smallest amount of total stake in the validators set for the next epoch"),
("header_nextValidators_stake_max", "the biggest amount of total stake in the validators set for the next epoch"),
## /node/validator
# ("validator_address", "validator_address"),
("validator_stakes_count", "the number of delegators currently staking on the node"),
# ("validator_name", "validator_name"),
("validator_registered", "if the node is registered as validaator node"),
("validator_totalStake", "the total amount staked on the node"),
# ("validator_url", "validator_url"),
## /system/peers
#peers
## /system/epochproof
# ("opaque", "opaque"),
# ("sigs", "sigs"),
# ("header_view", "header_view"),
# ("header_nextValidators", "header_nextValidators"),
# ("header_epoch", "header_epoch"),
# ("header_accumulator", "header_accumulator"),
# ("header_version", "header_version"),
# ("header_timestamp", "header_timestamp"),
## /system/info
# ("transports_0_metadata_port", "transports_0_metadata_port"),
# ("transports_0_metadata_host", "transports_0_metadata_host"),
# ("transports_0_sz", "transports_0_sz"),
# ("transports_0_name", "transports_0_name"),
# ("agent_protocol", "agent_protocol"),
# ("agent_name", "agent_name"),
# ("agent_version", "agent_version"),
# ("hid", "hid"),
# ("sz", "sz"),
# ("nid", "nid"),
# ("key", "key"),
# ("info_counters_ledger_state_version", "info_counters_ledger_state_version"),
("info_counters_ledger_bft_commands_processed", "info_counters_ledger_bft_commands_processed"),
("info_counters_ledger_sync_commands_processed", "info_counters_ledger_sync_commands_processed"),
("info_counters_pacemaker_view", "info_counters_pacemaker_view"),
("info_counters_mempool_maxcount", "info_counters_mempool_maxcount"),
("info_counters_mempool_relayer_sent_count", "info_counters_mempool_relayer_sent_count"),
("info_counters_mempool_count", "info_counters_mempool_count"),
("info_counters_mempool_add_success", "info_counters_mempool_add_success"),
("info_counters_mempool_errors_other", "info_counters_mempool_errors_other"),
("info_counters_mempool_errors_hook", "info_counters_mempool_errors_hook"),
("info_counters_mempool_errors_conflict", "info_counters_mempool_errors_conflict"),
("info_counters_mempool_proposed_transaction", "info_counters_mempool_proposed_transaction"),
("info_counters_radix_engine_invalid_proposed_commands", "info_counters_radix_engine_invalid_proposed_commands"),
("info_counters_radix_engine_system_transactions", "info_counters_radix_engine_system_transactions"),
("info_counters_radix_engine_user_transactions", "info_counters_radix_engine_user_transactions"),
("info_counters_count_bdb_ledger_contains_tx", "info_counters_count_bdb_ledger_contains_tx"),
("info_counters_count_bdb_ledger_deletes", "info_counters_count_bdb_ledger_deletes"),
("info_counters_count_bdb_ledger_commit", "info_counters_count_bdb_ledger_commit"),
("info_counters_count_bdb_ledger_save", "info_counters_count_bdb_ledger_save"),
("info_counters_count_bdb_ledger_last_vertex", "info_counters_count_bdb_ledger_last_vertex"),
("info_counters_count_bdb_ledger_store", "info_counters_count_bdb_ledger_store"),
("info_counters_count_bdb_ledger_create_tx", "info_counters_count_bdb_ledger_create_tx"),
("info_counters_count_bdb_ledger_contains", "info_counters_count_bdb_ledger_contains"),
("info_counters_count_bdb_ledger_entries", "info_counters_count_bdb_ledger_entries"),
("info_counters_count_bdb_ledger_get_last", "info_counters_count_bdb_ledger_get_last"),
("info_counters_count_bdb_ledger_get_next", "info_counters_count_bdb_ledger_get_next"),
("info_counters_count_bdb_ledger_search", "info_counters_count_bdb_ledger_search"),
("info_counters_count_bdb_ledger_total", "info_counters_count_bdb_ledger_total"),
("info_counters_count_bdb_ledger_get_prev", "info_counters_count_bdb_ledger_get_prev"),
("info_counters_count_bdb_ledger_bytes_read", "info_counters_count_bdb_ledger_bytes_read"),
("info_counters_count_bdb_ledger_bytes_write", "info_counters_count_bdb_ledger_bytes_write"),
("info_counters_count_bdb_ledger_proofs_removed", "info_counters_count_bdb_ledger_proofs_removed"),
("info_counters_count_bdb_ledger_proofs_added", "info_counters_count_bdb_ledger_proofs_added"),
("info_counters_count_bdb_ledger_get", "info_counters_count_bdb_ledger_get"),
("info_counters_count_bdb_ledger_last_committed", "info_counters_count_bdb_ledger_last_committed"),
("info_counters_count_bdb_ledger_get_first", "info_counters_count_bdb_ledger_get_first"),
("info_counters_count_bdb_header_bytes_write", "info_counters_count_bdb_header_bytes_write"),
("info_counters_count_bdb_address_book_deletes", "info_counters_count_bdb_address_book_deletes"),
("info_counters_count_bdb_address_book_total", "info_counters_count_bdb_address_book_total"),
("info_counters_count_bdb_address_book_bytes_read", "info_counters_count_bdb_address_book_bytes_read"),
("info_counters_count_bdb_address_book_bytes_write", "info_counters_count_bdb_address_book_bytes_write"),
("info_counters_count_bdb_safety_state_total", "info_counters_count_bdb_safety_state_total"),
("info_counters_count_bdb_safety_state_bytes_read", "info_counters_count_bdb_safety_state_bytes_read"),
("info_counters_count_bdb_safety_state_bytes_write", "info_counters_count_bdb_safety_state_bytes_write"),
("info_counters_count_apidb_balance_total", "info_counters_count_apidb_balance_total"),
("info_counters_count_apidb_balance_read", "info_counters_count_apidb_balance_read"),
("info_counters_count_apidb_balance_bytes_read", "info_counters_count_apidb_balance_bytes_read"),
("info_counters_count_apidb_balance_bytes_write", "info_counters_count_apidb_balance_bytes_write"),
("info_counters_count_apidb_balance_write", "info_counters_count_apidb_balance_write"),
("info_counters_count_apidb_flush_count", "info_counters_count_apidb_flush_count"),
("info_counters_count_apidb_queue_size", "info_counters_count_apidb_queue_size"),
("info_counters_count_apidb_transaction_total", "info_counters_count_apidb_transaction_total"),
("info_counters_count_apidb_transaction_read", "info_counters_count_apidb_transaction_read"),
("info_counters_count_apidb_transaction_bytes_read", "info_counters_count_apidb_transaction_bytes_read"),
("info_counters_count_apidb_transaction_bytes_write", "info_counters_count_apidb_transaction_bytes_write"),
("info_counters_count_apidb_transaction_write", "info_counters_count_apidb_transaction_write"),
("info_counters_count_apidb_token_total", "info_counters_count_apidb_token_total"),
("info_counters_count_apidb_token_read", "info_counters_count_apidb_token_read"),
("info_counters_count_apidb_token_bytes_read", "info_counters_count_apidb_token_bytes_read"),
("info_counters_count_apidb_token_bytes_write", "info_counters_count_apidb_token_bytes_write"),
("info_counters_count_apidb_token_write", "info_counters_count_apidb_token_write"),
("info_counters_epoch_manager_queued_consensus_events", "info_counters_epoch_manager_queued_consensus_events"),
("info_counters_hashed_bytes", "info_counters_hashed_bytes"),
("info_counters_networking_received_bytes", "info_counters_networking_received_bytes"),
("info_counters_networking_tcp_out_opened", "info_counters_networking_tcp_out_opened"),
("info_counters_networking_tcp_dropped_messages", "info_counters_networking_tcp_dropped_messages"),
("info_counters_networking_tcp_in_opened", "info_counters_networking_tcp_in_opened"),
("info_counters_networking_tcp_closed", "info_counters_networking_tcp_closed"),
("info_counters_networking_udp_dropped_messages", "info_counters_networking_udp_dropped_messages"),
("info_counters_networking_sent_bytes", "info_counters_networking_sent_bytes"),
("info_counters_sync_processed", "info_counters_sync_processed"),
("info_counters_sync_target_state_version", "info_counters_sync_target_state_version"),
("info_counters_sync_remote_requests_processed", "info_counters_sync_remote_requests_processed"),
("info_counters_sync_invalid_commands_received", "info_counters_sync_invalid_commands_received"),
("info_counters_sync_last_read_millis", "info_counters_sync_last_read_millis"),
("info_counters_sync_target_current_diff", "info_counters_sync_target_current_diff"),
("info_counters_signatures_verified", "info_counters_signatures_verified"),
("info_counters_signatures_signed", "info_counters_signatures_signed"),
("info_counters_elapsed_bdb_ledger_contains_tx", "info_counters_elapsed_bdb_ledger_contains_tx"),
("info_counters_elapsed_bdb_ledger_commit", "info_counters_elapsed_bdb_ledger_commit"),
("info_counters_elapsed_bdb_ledger_save", "info_counters_elapsed_bdb_ledger_save"),
("info_counters_elapsed_bdb_ledger_last_vertex", "info_counters_elapsed_bdb_ledger_last_vertex"),
("info_counters_elapsed_bdb_ledger_store", "info_counters_elapsed_bdb_ledger_store"),
("info_counters_elapsed_bdb_ledger_create_tx", "info_counters_elapsed_bdb_ledger_create_tx"),
("info_counters_elapsed_bdb_ledger_contains", "info_counters_elapsed_bdb_ledger_contains"),
("info_counters_elapsed_bdb_ledger_entries", "info_counters_elapsed_bdb_ledger_entries"),
("info_counters_elapsed_bdb_ledger_get_last", "info_counters_elapsed_bdb_ledger_get_last"),
("info_counters_elapsed_bdb_ledger_search", "info_counters_elapsed_bdb_ledger_search"),
("info_counters_elapsed_bdb_ledger_total", "info_counters_elapsed_bdb_ledger_total"),
("info_counters_elapsed_bdb_ledger_get", "info_counters_elapsed_bdb_ledger_get"),
("info_counters_elapsed_bdb_ledger_last_committed", "info_counters_elapsed_bdb_ledger_last_committed"),
("info_counters_elapsed_bdb_ledger_get_first", "info_counters_elapsed_bdb_ledger_get_first"),
("info_counters_elapsed_bdb_address_book", "info_counters_elapsed_bdb_address_book"),
("info_counters_elapsed_bdb_safety_state", "info_counters_elapsed_bdb_safety_state"),
("info_counters_elapsed_apidb_balance_read", "info_counters_elapsed_apidb_balance_read"),
("info_counters_elapsed_apidb_balance_write", "info_counters_elapsed_apidb_balance_write"),
("info_counters_elapsed_apidb_flush_time", "info_counters_elapsed_apidb_flush_time"),
("info_counters_elapsed_apidb_transaction_read", "info_counters_elapsed_apidb_transaction_read"),
("info_counters_elapsed_apidb_transaction_write", "info_counters_elapsed_apidb_transaction_write"),
("info_counters_elapsed_apidb_token_read", "info_counters_elapsed_apidb_token_read"),
("info_counters_elapsed_apidb_token_write", "info_counters_elapsed_apidb_token_write"),
("info_counters_bft_state_version", "info_counters_bft_state_version"),
("info_counters_bft_vote_quorums", "info_counters_bft_vote_quorums"),
("info_counters_bft_rejected", "info_counters_bft_rejected"),
("info_counters_bft_vertex_store_rebuilds", "info_counters_bft_vertex_store_rebuilds"),
("info_counters_bft_vertex_store_forks", "info_counters_bft_vertex_store_forks"),
("info_counters_bft_sync_request_timeouts", "info_counters_bft_sync_request_timeouts"),
("info_counters_bft_sync_requests_sent", "info_counters_bft_sync_requests_sent"),
("info_counters_bft_timeout", "info_counters_bft_timeout"),
("info_counters_bft_vertex_store_size", "info_counters_bft_vertex_store_size"),
("info_counters_bft_processed", "info_counters_bft_processed"),
("info_counters_bft_consensus_events", "info_counters_bft_consensus_events"),
("info_counters_bft_indirect_parent", "info_counters_bft_indirect_parent"),
("info_counters_bft_proposals_made", "info_counters_bft_proposals_made"),
("info_counters_bft_timed_out_views", "info_counters_bft_timed_out_views"),
("info_counters_bft_timeout_quorums", "info_counters_bft_timeout_quorums"),
("info_counters_startup_time_ms", "info_counters_startup_time_ms"),
("info_counters_messages_inbound_processed", "info_counters_messages_inbound_processed"),
("info_counters_messages_inbound_discarded", "info_counters_messages_inbound_discarded"),
("info_counters_messages_inbound_badsignature", "info_counters_messages_inbound_badsignature"),
("info_counters_messages_inbound_received", "info_counters_messages_inbound_received"),
("info_counters_messages_outbound_processed", "info_counters_messages_outbound_processed"),
("info_counters_messages_outbound_aborted", "info_counters_messages_outbound_aborted"),
("info_counters_messages_outbound_pending", "info_counters_messages_outbound_pending"),
("info_counters_messages_outbound_sent", "info_counters_messages_outbound_sent"),
("info_counters_persistence_safety_store_saves", "info_counters_persistence_safety_store_saves"),
("info_counters_persistence_vertex_store_saves", "info_counters_persistence_vertex_store_saves"),
("info_counters_persistence_atom_log_write_bytes", "info_counters_persistence_atom_log_write_bytes"),
("info_counters_persistence_atom_log_write_compressed", "info_counters_persistence_atom_log_write_compressed"),
("info_counters_time_duration", "info_counters_time_duration"),
# ("info_counters_time_since", "info_counters_time_since"),
("info_configuration_pacemakerRate", "info_configuration_pacemakerRate"),
("info_configuration_pacemakerTimeout", "info_configuration_pacemakerTimeout"),
("info_configuration_pacemakerMaxExponent", "info_configuration_pacemakerMaxExponent"),
("info_system_version_system_version_agent_version", "info_system_version_system_version_agent_version"),
("info_system_version_system_version_protocol_version", "info_system_version_system_version_protocol_version"),
# ("info_system_version_system_version_display", "info_system_version_system_version_display"),
# ("info_system_version_system_version_commit", "info_system_version_system_version_commit"),
# ("info_system_version_system_version_branch", "info_system_version_system_version_branch"),
("info_epochManager_currentView_view", "info_epochManager_currentView_view"),
("info_epochManager_currentView_epoch", "info_epochManager_currentView_epoch"),
]
|
a = int(input('Digite o primeiro número: '))
b = int(input('Digite o segundo número: '))
c = int(input('Digite o terceiro número: '))
menor = a
if b<a and b<c:
menor = b
if c<a and c<b:
menor = c
maior = a
if b>a and b>c:
maior = b
if c>a and c>b:
maior = c
print(f'O maior valor é {maior}.')
print(f'O menor valor é {menor}')
|
"""
Reference: https://leetcode.com/problems/strange-printer/discuss/106810/Java-O(n3)-DP-Solution-with-Explanation-and-Simple-Optimization
"""
class Solution:
def strangePrinter(self, s: str) -> int:
str_size = len(s)
if str_size == 0:
return 0
# init with the value 'n', size of the square
dp = [[str_size]*str_size for i in range(str_size)]
for i in range(str_size):
# reset the diagnoal values
dp[i][i] = 1
# complexity O(N^3)
for end in range(0, str_size):
for start in range(end, -1, -1):
for mid in range(start, end):
default_print_num = dp[start][mid] + dp[mid+1][end]
if s[mid] == s[end]:
default_print_num -= 1
dp[start][end] = min(dp[start][end], default_print_num)
return dp[0][str_size-1]
|
def test_slash_request_forbidden(client):
assert client.get("/").status_code == 404
def test_api_root_request_forbidden(client):
assert client.get("/api").status_code == 404
assert client.get("/api/").status_code == 404
def test_auth_root_request_forbidden(client):
assert client.get("/auth").status_code == 404
assert client.get("/auth/").status_code == 404
|
def search_staff():
query = """
query ($id: Int, $search: String, $type: MediaType) {
Media(search: $search, id: $id, type: $type) {
id
idMal
type
title {
romaji
english
}
staff {
edges {
node {
primaryOccupations
siteUrl
image {
large
}
name {
full
}
}
}
}
}
}
"""
return query
|
# 2. Реализовать функцию, принимающую несколько параметров,
# описывающих данные пользователя: имя, фамилия, год рождения, город проживания, email, телефон.
# Функция должна принимать параметры как именованные аргументы.
# Реализовать вывод данных о пользователе одной строкой.
def statistic(name, surname, year, country, email, phone):
return print(f"name: {name}, surname: {surname}, year: {year}, country: {country}, email: {email}, phone: {phone}")
nameUser = input("Enter name: ")
surnameUser = input("Enter surname: ")
yearUser = input("Enter year: ")
countryUser = input("Enter country: ")
emailUser = input("Enter email: ")
phoneUser = input("Enter phone: ")
statistic(name=nameUser, surname=surnameUser, year=yearUser, country=countryUser, email=emailUser, phone=phoneUser)
|
a, b, c = map(int, input().split())
if (a == b and a != c) or (a ==c and a != b) or (b == c and b != a):
print("Yes")
else:
print("No")
|
def count():
fs = []
for i in range(1, 4):
def f():
print(i)
return i * i
fs.append(f)
return fs # fs = [function f1, function f2, function f3]
f = count()
print(f)
f1, f2, f3 = count() # 返回的函数引用了变量i,等到3个函数都返回时,i变成了3,再调用f函数结果为9
# 执行f(): i = 3
print(f1, f1()) # <function count.<locals>.f at 0x7f8e29b71950> 9
def count1():
def f(j):
def g():
return j * j;
return g
fs = []
for i in range(1, 4):
fs.append(f(i)) # f(i)立即被执行,因此i的当前值被传入f()
return fs
f1, f2, f3 = count1() # 执行f(j): f(1), f(2), f(3)
print(f1, f1()) # <function count1.<locals>.f.<locals>.g at 0x7f8e29b71bf8> 1
# 利用闭包返回一个计数器函数,每次调用它返回递增整数
def createCounter():
n = 0
def counter():
nonlocal n
n += 1
return n
return counter
counterA = createCounter()
print(counterA(), counterA())
def createCounter():
def _next():
i = 1
while True:
yield i
i += 1
g = _next()
def counter():
return next(g)
return counter
counterA = createCounter()
print(counterA(), counterA())
|
#Check for the existence of file
no_of_items=0
try:
f=open("./TODO (CLI-VER)/todolist.txt")
p=0
for i in f.readlines():#Counting the number of items if the file exists already
p+=1
no_of_items=p-2
except:
f=open("./TODO (CLI-VER)/todolist.txt",'w')
f.write("_________TODO LIST__________\n")
f.write(" TIME WORK")
finally:
f.close()
#Todo list
print("Press 1: Add Item \nPress 2: Delete Item \nPress 3: Update item \nPress 4: Display Items\nPress 5: Exit")
n=int(input())
while n==1 or n==2 or n==3 or n==4:
if n==1:
todo=[]
print("Enter the time in HH:MM format(24 hours format)")
time=input()
print("Enter your Work")
work=input()
no_of_items+=1
with open('./TODO (CLI-VER)/todolist.txt','a') as f:
f.write("\n"+str(no_of_items)+" "+time+" "+work)
elif n==2:
if(no_of_items<=0):
print("There is no item in the list kindly add some items")
else:
print("____________________________________________________________")
print("Your Current List: ")
todo=[]
with open('./TODO (CLI-VER)/todolist.txt') as f:
for i in f.readlines():
print(i)
todo.append(i)
print("____________________________________________________________")
print("Enter the position of the item you want to delete : ")
pos=int(input())
if(pos<=0):
print("Please enter a valid position")
elif (pos>(no_of_items)):
print("Please enter the position <= {}".format(no_of_items))
else:
todo.pop(pos+1)
no_of_items-=1
if(no_of_items<=0):
print("Congratulations your todo list is empty!")
with open('./TODO (CLI-VER)/todolist.txt','w') as f:
for i in range(len(todo)):
if i>=(pos+1):
f.write(str(pos)+todo[i][1:])
pos+=1
else:
f.write(todo[i])
elif n==3:
print("____________________________________________________________")
print("Your Current List: ")
todo=[]
with open('./TODO (CLI-VER)/todolist.txt') as f:
for i in f.readlines():
print(i)
todo.append(i)
print("____________________________________________________________")
print("Enter the position of the items you want to update : ")
pos=int(input())
if(pos<=0):
print("Please enter a valid position")
elif (pos>(no_of_items)):
print("Please enter the position <= {}".format(no_of_items))
else:
print("What you want to update : ")
print("Press 1: Time\nPress 2: Work")
choice=int(input())
if choice==1:
print("Enter your updated time :")
time=input()
p=todo[pos+1].index(":")
y=0
with open('./TODO (CLI-VER)/todolist.txt','w') as f:
for i in range(len(todo)):
if i==pos+1:
f.write(str(pos)+" "+time+""+''.join(todo[pos+1][p+3:]))
else:
f.write(todo[i])
elif choice==2:
print("Enter your updated work :")
work=input()
p=todo[pos+1].index(":")
y=0
with open('./TODO (CLI-VER)/todolist.txt','w') as f:
for i in range(len(todo)):
if i==pos+1:
f.write(str(pos)+" "+''.join(todo[pos+1][p-2:p+3])+" "+work)
else:
f.write(todo[i])
elif n==4:
print("Your Current List: ")
todo=[]
print("____________________________________________________________")
with open('./TODO (CLI-VER)/todolist.txt') as f:
for i in f.readlines():
print(i)
todo.append(i)
print("____________________________________________________________")
print("Press 1: Add Item \nPress 2: Delete the Item\nPress 3: Update item\nPress 4:Display Items\nPress 5:Exit")
n=int(input())
print("Thank you for using our application")
|
#exercicío que cria uma espécie de Menu em um restaurante tecnológico
lanche = ['Hamburguer R$ 9,50', 'Hot-Dog R$ 7,00', 'Bauru R$ 25,00', 'Pizza R$ 22,00'];
bebida = ['Refrigerante R$ 5,00', 'Suco R$ 6,00', 'MilkShake R$ 8,00']
print ("COMITECH\n")
for i in lanche:
print (i)
print ("\n\nBEBITECH\n")
for i in bebida:
print(i)
|
class Solution:
def minFlips(self, target: str) -> int:
nflips = 0
for ison in map(lambda x : x == '1', target):
if ((not ison) and nflips % 2 == 1) or (ison and nflips % 2 == 0):
nflips += 1
return nflips
|
"""
Leetcode #464
"""
class Solution:
def canIWin(self, maxChoosableInteger: int, desiredTotal: int) -> bool:
seen = {}
def helper(choices, total):
if choices[-1] >= total:
return True
# check if subproblem is already solved
key = tuple(choices)
if key in seen:
return seen[key]
for i in range(len(choices)):
# if second player can win for ith round
if not helper(choices[:i] + choices[i+1:], total - choices[i]):
# we won
seen[i] = True
return True
# if we reach here then it means, second player won in loop above
# so set it false
seen[key] = False
return False
choices = list(range(1, maxChoosableInteger + 1))
# sum of consecutive integers
_sum = (maxChoosableInteger * (maxChoosableInteger + 1)) // 2
if _sum < desiredTotal:
return False
# if len is odd, means first player's turn
if _sum == desiredTotal and len(choices) % 2:
return True
return helper(choices, desiredTotal)
if __name__ == "__main__":
solution = Solution()
assert solution.canIWin(10, 11) == False
|
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
for i in matrix:
for j in i:
if j==target:return True
return False
|
class FermiDataGetter(object):
def __init__(self) -> None:
raise NotImplementedError()
|
# -*- coding: utf-8 -*-
'''
>>> from pycm import *
>>> import os
>>> import json
>>> y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
>>> y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
>>> cm = ConfusionMatrix(y_actu, y_pred)
>>> cm
pycm.ConfusionMatrix(classes: [0, 1, 2])
>>> len(cm)
3
>>> print(cm)
Predict 0 1 2
Actual
0 3 0 0
<BLANKLINE>
1 0 1 2
<BLANKLINE>
2 2 1 3
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.30439,0.86228)
AUNP 0.66667
AUNU 0.69444
Bennett S 0.375
CBA 0.47778
Chi-Squared 6.6
Chi-Squared DF 4
Conditional Entropy 0.95915
Cramer V 0.5244
Cross Entropy 1.59352
Gwet AC1 0.38931
Hamming Loss 0.41667
Joint Entropy 2.45915
KL Divergence 0.09352
Kappa 0.35484
Kappa 95% CI (-0.07708,0.78675)
Kappa No Prevalence 0.16667
Kappa Standard Error 0.22036
Kappa Unbiased 0.34426
Lambda A 0.16667
Lambda B 0.42857
Mutual Information 0.52421
NIR 0.5
Overall ACC 0.58333
Overall CEN 0.46381
Overall J (1.225,0.40833)
Overall MCC 0.36667
Overall MCEN 0.51894
Overall RACC 0.35417
Overall RACCU 0.36458
P-Value 0.38721
PPV Macro 0.56667
PPV Micro 0.58333
Phi-Squared 0.55
RCI 0.34947
RR 4.0
Reference Entropy 1.5
Response Entropy 1.48336
SOA1(Landis & Koch) Fair
SOA2(Fleiss) Poor
SOA3(Altman) Fair
SOA4(Cicchetti) Poor
Scott PI 0.34426
Standard Error 0.14232
TPR Macro 0.61111
TPR Micro 0.58333
Zero-one Loss 5
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 0 1 2
ACC(Accuracy) 0.83333 0.75 0.58333
AUC(Area under the roc curve) 0.88889 0.61111 0.58333
AUCI(Auc value interpretation) Very Good Fair Poor
BM(Informedness or bookmaker informedness) 0.77778 0.22222 0.16667
CEN(Confusion entropy) 0.25 0.49658 0.60442
DOR(Diagnostic odds ratio) None 4.0 2.0
DP(Discriminant power) None 0.33193 0.16597
DPI(Discriminant power interpretation) None Poor Poor
ERR(Error rate) 0.16667 0.25 0.41667
F0.5(F0.5 score) 0.65217 0.45455 0.57692
F1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.4 0.54545
F2(F2 score) 0.88235 0.35714 0.51724
FDR(False discovery rate) 0.4 0.5 0.4
FN(False negative/miss/type 2 error) 0 2 3
FNR(Miss rate or false negative rate) 0.0 0.66667 0.5
FOR(False omission rate) 0.0 0.2 0.42857
FP(False positive/type 1 error/false alarm) 2 1 2
FPR(Fall-out or false positive rate) 0.22222 0.11111 0.33333
G(G-measure geometric mean of precision and sensitivity) 0.7746 0.40825 0.54772
GI(Gini index) 0.77778 0.22222 0.16667
IS(Information score) 1.26303 1.0 0.26303
J(Jaccard index) 0.6 0.25 0.375
LS(Lift score) 2.4 2.0 1.2
MCC(Matthews correlation coefficient) 0.68313 0.2582 0.16903
MCEN(Modified confusion entropy) 0.26439 0.5 0.6875
MK(Markedness) 0.6 0.3 0.17143
N(Condition negative) 9 9 6
NLR(Negative likelihood ratio) 0.0 0.75 0.75
NPV(Negative predictive value) 1.0 0.8 0.57143
P(Condition positive or support) 3 3 6
PLR(Positive likelihood ratio) 4.5 3.0 1.5
PLRI(Positive likelihood ratio interpretation) Poor Poor Poor
POP(Population) 12 12 12
PPV(Precision or positive predictive value) 0.6 0.5 0.6
PRE(Prevalence) 0.25 0.25 0.5
RACC(Random accuracy) 0.10417 0.04167 0.20833
RACCU(Random accuracy unbiased) 0.11111 0.0434 0.21007
TN(True negative/correct rejection) 7 8 4
TNR(Specificity or true negative rate) 0.77778 0.88889 0.66667
TON(Test outcome negative) 7 10 7
TOP(Test outcome positive) 5 2 5
TP(True positive/hit) 3 1 3
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5
Y(Youden index) 0.77778 0.22222 0.16667
dInd(Distance index) 0.22222 0.67586 0.60093
sInd(Similarity index) 0.84287 0.52209 0.57508
<BLANKLINE>
>>> cm.relabel({0:"L1",1:"L2",2:"L3"})
>>> print(cm)
Predict L1 L2 L3
Actual
L1 3 0 0
<BLANKLINE>
L2 0 1 2
<BLANKLINE>
L3 2 1 3
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.30439,0.86228)
AUNP 0.66667
AUNU 0.69444
Bennett S 0.375
CBA 0.47778
Chi-Squared 6.6
Chi-Squared DF 4
Conditional Entropy 0.95915
Cramer V 0.5244
Cross Entropy 1.59352
Gwet AC1 0.38931
Hamming Loss 0.41667
Joint Entropy 2.45915
KL Divergence 0.09352
Kappa 0.35484
Kappa 95% CI (-0.07708,0.78675)
Kappa No Prevalence 0.16667
Kappa Standard Error 0.22036
Kappa Unbiased 0.34426
Lambda A 0.16667
Lambda B 0.42857
Mutual Information 0.52421
NIR 0.5
Overall ACC 0.58333
Overall CEN 0.46381
Overall J (1.225,0.40833)
Overall MCC 0.36667
Overall MCEN 0.51894
Overall RACC 0.35417
Overall RACCU 0.36458
P-Value 0.38721
PPV Macro 0.56667
PPV Micro 0.58333
Phi-Squared 0.55
RCI 0.34947
RR 4.0
Reference Entropy 1.5
Response Entropy 1.48336
SOA1(Landis & Koch) Fair
SOA2(Fleiss) Poor
SOA3(Altman) Fair
SOA4(Cicchetti) Poor
Scott PI 0.34426
Standard Error 0.14232
TPR Macro 0.61111
TPR Micro 0.58333
Zero-one Loss 5
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes L1 L2 L3
ACC(Accuracy) 0.83333 0.75 0.58333
AUC(Area under the roc curve) 0.88889 0.61111 0.58333
AUCI(Auc value interpretation) Very Good Fair Poor
BM(Informedness or bookmaker informedness) 0.77778 0.22222 0.16667
CEN(Confusion entropy) 0.25 0.49658 0.60442
DOR(Diagnostic odds ratio) None 4.0 2.0
DP(Discriminant power) None 0.33193 0.16597
DPI(Discriminant power interpretation) None Poor Poor
ERR(Error rate) 0.16667 0.25 0.41667
F0.5(F0.5 score) 0.65217 0.45455 0.57692
F1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.4 0.54545
F2(F2 score) 0.88235 0.35714 0.51724
FDR(False discovery rate) 0.4 0.5 0.4
FN(False negative/miss/type 2 error) 0 2 3
FNR(Miss rate or false negative rate) 0.0 0.66667 0.5
FOR(False omission rate) 0.0 0.2 0.42857
FP(False positive/type 1 error/false alarm) 2 1 2
FPR(Fall-out or false positive rate) 0.22222 0.11111 0.33333
G(G-measure geometric mean of precision and sensitivity) 0.7746 0.40825 0.54772
GI(Gini index) 0.77778 0.22222 0.16667
IS(Information score) 1.26303 1.0 0.26303
J(Jaccard index) 0.6 0.25 0.375
LS(Lift score) 2.4 2.0 1.2
MCC(Matthews correlation coefficient) 0.68313 0.2582 0.16903
MCEN(Modified confusion entropy) 0.26439 0.5 0.6875
MK(Markedness) 0.6 0.3 0.17143
N(Condition negative) 9 9 6
NLR(Negative likelihood ratio) 0.0 0.75 0.75
NPV(Negative predictive value) 1.0 0.8 0.57143
P(Condition positive or support) 3 3 6
PLR(Positive likelihood ratio) 4.5 3.0 1.5
PLRI(Positive likelihood ratio interpretation) Poor Poor Poor
POP(Population) 12 12 12
PPV(Precision or positive predictive value) 0.6 0.5 0.6
PRE(Prevalence) 0.25 0.25 0.5
RACC(Random accuracy) 0.10417 0.04167 0.20833
RACCU(Random accuracy unbiased) 0.11111 0.0434 0.21007
TN(True negative/correct rejection) 7 8 4
TNR(Specificity or true negative rate) 0.77778 0.88889 0.66667
TON(Test outcome negative) 7 10 7
TOP(Test outcome positive) 5 2 5
TP(True positive/hit) 3 1 3
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5
Y(Youden index) 0.77778 0.22222 0.16667
dInd(Distance index) 0.22222 0.67586 0.60093
sInd(Similarity index) 0.84287 0.52209 0.57508
<BLANKLINE>
>>> cm.Y["L2"]
0.2222222222222221
>>> cm_2 = ConfusionMatrix(y_actu, 2)
Traceback (most recent call last):
...
pycm.pycm_obj.pycmVectorError: The type of input vectors is assumed to be a list or a NumPy array
>>> cm_3 = ConfusionMatrix(y_actu, [1,2])
Traceback (most recent call last):
...
pycm.pycm_obj.pycmVectorError: Input vectors must have same length
>>> cm_4 = ConfusionMatrix([], [])
Traceback (most recent call last):
...
pycm.pycm_obj.pycmVectorError: Input vectors are empty
>>> cm_5 = ConfusionMatrix([1,1,1,], [1,1,1,1])
Traceback (most recent call last):
...
pycm.pycm_obj.pycmVectorError: Input vectors must have same length
>>> pycm_help()
<BLANKLINE>
PyCM is a multi-class confusion matrix library written in Python that
supports both input data vectors and direct matrix, and a proper tool for
post-classification model evaluation that supports most classes and overall
statistics parameters.
PyCM is the swiss-army knife of confusion matrices, targeted mainly at
data scientists that need a broad array of metrics for predictive models
and an accurate evaluation of large variety of classifiers.
<BLANKLINE>
Repo : https://github.com/sepandhaghighi/pycm
Webpage : http://www.pycm.ir
<BLANKLINE>
<BLANKLINE>
>>> RCI_calc(24,0)
'None'
>>> CBA_calc([1,2], {1:{1:0,2:0},2:{1:0,2:0}}, {1:0,2:0}, {1:0,2:0})
'None'
>>> RR_calc([], {1:0,2:0})
'None'
>>> overall_MCC_calc([1,2], {1:{1:0,2:0},2:{1:0,2:0}}, {1:0,2:0}, {1:0,2:0})
'None'
>>> CEN_misclassification_calc({1:{1:0,2:0},2:{1:0,2:0}},{1:0,2:0},{1:0,2:0},1,1,2)
'None'
>>> vector_check([1,2,3,0.4])
False
>>> vector_check([1,2,3,-2])
False
>>> matrix_check({1:{1:0.5,2:0},2:{1:0,2:0}})
False
>>> matrix_check([])
False
>>> TTPN_calc(0,0)
'None'
>>> TTPN_calc(1,4)
0.2
>>> FXR_calc(None)
'None'
>>> FXR_calc(0.2)
0.8
>>> ACC_calc(0,0,0,0)
'None'
>>> ACC_calc(1,1,3,4)
0.2222222222222222
>>> MCC_calc(0,2,0,2)
'None'
>>> MCC_calc(1,2,3,4)
-0.408248290463863
>>> LR_calc(1,2)
0.5
>>> LR_calc(1,0)
'None'
>>> MK_BM_calc(2,"None")
'None'
>>> MK_BM_calc(1,2)
2
>>> PRE_calc(None,2)
'None'
>>> PRE_calc(1,5)
0.2
>>> PRE_calc(1,0)
'None'
>>> G_calc(None,2)
'None'
>>> G_calc(1,2)
1.4142135623730951
>>> RACC_calc(2,3,4)
0.375
>>> reliability_calc(1,None)
'None'
>>> reliability_calc(2,0.3)
1.7
>>> micro_calc({1:2,2:3},{1:1,2:4})
0.5
>>> micro_calc({1:2,2:3},None)
'None'
>>> macro_calc(None)
'None'
>>> macro_calc({1:2,2:3})
2.5
>>> F_calc(TP=0,FP=0,FN=0,Beta=1)
'None'
>>> F_calc(TP=3,FP=2,FN=1,Beta=5)
0.7428571428571429
>>> save_stat=cm.save_stat("test",address=False)
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_stat("test_filtered",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_stat("test_filtered2",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=["L1","L2"])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_stat("test_filtered3",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=[])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_stat("/asdasd,qweqwe.eo/",address=True)
>>> save_stat=={'Status': False, 'Message': "[Errno 2] No such file or directory: '/asdasd,qweqwe.eo/.pycm'"}
True
>>> ERR_calc(None)
'None'
>>> ERR_calc(0.1)
0.9
>>> cm.F_beta(4)["L1"]
0.9622641509433962
>>> cm.F_beta(4)["L2"]
0.34
>>> cm.F_beta(4)["L3"]
0.504950495049505
>>> import numpy as np
>>> y_test = np.array([600, 200, 200, 200, 200, 200, 200, 200, 500, 500, 500, 200, 200, 200, 200, 200, 200, 200, 200, 200])
>>> y_pred = np.array([100, 200, 200, 100, 100, 200, 200, 200, 100, 200, 500, 100, 100, 100, 100, 100, 100, 100, 500, 200])
>>> cm=ConfusionMatrix(y_test, y_pred)
>>> print(cm)
Predict 100 200 500 600
Actual
100 0 0 0 0
<BLANKLINE>
200 9 6 1 0
<BLANKLINE>
500 1 1 1 0
<BLANKLINE>
600 1 0 0 0
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.14096,0.55904)
AUNP None
AUNU None
Bennett S 0.13333
CBA 0.17708
Chi-Squared None
Chi-Squared DF 9
Conditional Entropy 1.23579
Cramer V None
Cross Entropy 1.70995
Gwet AC1 0.19505
Hamming Loss 0.65
Joint Entropy 2.11997
KL Divergence None
Kappa 0.07801
Kappa 95% CI (-0.2185,0.37453)
Kappa No Prevalence -0.3
Kappa Standard Error 0.15128
Kappa Unbiased -0.12554
Lambda A 0.0
Lambda B 0.0
Mutual Information 0.10088
NIR 0.8
Overall ACC 0.35
Overall CEN 0.3648
Overall J (0.60294,0.15074)
Overall MCC 0.12642
Overall MCEN 0.37463
Overall RACC 0.295
Overall RACCU 0.4225
P-Value 1.0
PPV Macro None
PPV Micro 0.35
Phi-Squared None
RCI 0.11409
RR 5.0
Reference Entropy 0.88418
Response Entropy 1.33667
SOA1(Landis & Koch) Slight
SOA2(Fleiss) Poor
SOA3(Altman) Poor
SOA4(Cicchetti) Poor
Scott PI -0.12554
Standard Error 0.10665
TPR Macro None
TPR Micro 0.35
Zero-one Loss 13
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100 200 500 600
ACC(Accuracy) 0.45 0.45 0.85 0.95
AUC(Area under the roc curve) None 0.5625 0.63725 0.5
AUCI(Auc value interpretation) None Poor Fair Poor
BM(Informedness or bookmaker informedness) None 0.125 0.27451 0.0
CEN(Confusion entropy) 0.33496 0.35708 0.53895 0.0
DOR(Diagnostic odds ratio) None 1.8 8.0 None
DP(Discriminant power) None 0.14074 0.4979 None
DPI(Discriminant power interpretation) None Poor Poor None
ERR(Error rate) 0.55 0.55 0.15 0.05
F0.5(F0.5 score) 0.0 0.68182 0.45455 0.0
F1(F1 score - harmonic mean of precision and sensitivity) 0.0 0.52174 0.4 0.0
F2(F2 score) 0.0 0.42254 0.35714 0.0
FDR(False discovery rate) 1.0 0.14286 0.5 None
FN(False negative/miss/type 2 error) 0 10 2 1
FNR(Miss rate or false negative rate) None 0.625 0.66667 1.0
FOR(False omission rate) 0.0 0.76923 0.11111 0.05
FP(False positive/type 1 error/false alarm) 11 1 1 0
FPR(Fall-out or false positive rate) 0.55 0.25 0.05882 0.0
G(G-measure geometric mean of precision and sensitivity) None 0.56695 0.40825 None
GI(Gini index) None 0.125 0.27451 0.0
IS(Information score) None 0.09954 1.73697 None
J(Jaccard index) 0.0 0.35294 0.25 0.0
LS(Lift score) None 1.07143 3.33333 None
MCC(Matthews correlation coefficient) None 0.10483 0.32673 None
MCEN(Modified confusion entropy) 0.33496 0.37394 0.58028 0.0
MK(Markedness) 0.0 0.08791 0.38889 None
N(Condition negative) 20 4 17 19
NLR(Negative likelihood ratio) None 0.83333 0.70833 1.0
NPV(Negative predictive value) 1.0 0.23077 0.88889 0.95
P(Condition positive or support) 0 16 3 1
PLR(Positive likelihood ratio) None 1.5 5.66667 None
PLRI(Positive likelihood ratio interpretation) None Poor Fair None
POP(Population) 20 20 20 20
PPV(Precision or positive predictive value) 0.0 0.85714 0.5 None
PRE(Prevalence) 0.0 0.8 0.15 0.05
RACC(Random accuracy) 0.0 0.28 0.015 0.0
RACCU(Random accuracy unbiased) 0.07563 0.33062 0.01562 0.00063
TN(True negative/correct rejection) 9 3 16 19
TNR(Specificity or true negative rate) 0.45 0.75 0.94118 1.0
TON(Test outcome negative) 9 13 18 20
TOP(Test outcome positive) 11 7 2 0
TP(True positive/hit) 0 6 1 0
TPR(Sensitivity, recall, hit rate, or true positive rate) None 0.375 0.33333 0.0
Y(Youden index) None 0.125 0.27451 0.0
dInd(Distance index) None 0.67315 0.66926 1.0
sInd(Similarity index) None 0.52401 0.52676 0.29289
<BLANKLINE>
>>> cm.stat()
Overall Statistics :
<BLANKLINE>
95% CI (0.14096,0.55904)
AUNP None
AUNU None
Bennett S 0.13333
CBA 0.17708
Chi-Squared None
Chi-Squared DF 9
Conditional Entropy 1.23579
Cramer V None
Cross Entropy 1.70995
Gwet AC1 0.19505
Hamming Loss 0.65
Joint Entropy 2.11997
KL Divergence None
Kappa 0.07801
Kappa 95% CI (-0.2185,0.37453)
Kappa No Prevalence -0.3
Kappa Standard Error 0.15128
Kappa Unbiased -0.12554
Lambda A 0.0
Lambda B 0.0
Mutual Information 0.10088
NIR 0.8
Overall ACC 0.35
Overall CEN 0.3648
Overall J (0.60294,0.15074)
Overall MCC 0.12642
Overall MCEN 0.37463
Overall RACC 0.295
Overall RACCU 0.4225
P-Value 1.0
PPV Macro None
PPV Micro 0.35
Phi-Squared None
RCI 0.11409
RR 5.0
Reference Entropy 0.88418
Response Entropy 1.33667
SOA1(Landis & Koch) Slight
SOA2(Fleiss) Poor
SOA3(Altman) Poor
SOA4(Cicchetti) Poor
Scott PI -0.12554
Standard Error 0.10665
TPR Macro None
TPR Micro 0.35
Zero-one Loss 13
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100 200 500 600
ACC(Accuracy) 0.45 0.45 0.85 0.95
AUC(Area under the roc curve) None 0.5625 0.63725 0.5
AUCI(Auc value interpretation) None Poor Fair Poor
BM(Informedness or bookmaker informedness) None 0.125 0.27451 0.0
CEN(Confusion entropy) 0.33496 0.35708 0.53895 0.0
DOR(Diagnostic odds ratio) None 1.8 8.0 None
DP(Discriminant power) None 0.14074 0.4979 None
DPI(Discriminant power interpretation) None Poor Poor None
ERR(Error rate) 0.55 0.55 0.15 0.05
F0.5(F0.5 score) 0.0 0.68182 0.45455 0.0
F1(F1 score - harmonic mean of precision and sensitivity) 0.0 0.52174 0.4 0.0
F2(F2 score) 0.0 0.42254 0.35714 0.0
FDR(False discovery rate) 1.0 0.14286 0.5 None
FN(False negative/miss/type 2 error) 0 10 2 1
FNR(Miss rate or false negative rate) None 0.625 0.66667 1.0
FOR(False omission rate) 0.0 0.76923 0.11111 0.05
FP(False positive/type 1 error/false alarm) 11 1 1 0
FPR(Fall-out or false positive rate) 0.55 0.25 0.05882 0.0
G(G-measure geometric mean of precision and sensitivity) None 0.56695 0.40825 None
GI(Gini index) None 0.125 0.27451 0.0
IS(Information score) None 0.09954 1.73697 None
J(Jaccard index) 0.0 0.35294 0.25 0.0
LS(Lift score) None 1.07143 3.33333 None
MCC(Matthews correlation coefficient) None 0.10483 0.32673 None
MCEN(Modified confusion entropy) 0.33496 0.37394 0.58028 0.0
MK(Markedness) 0.0 0.08791 0.38889 None
N(Condition negative) 20 4 17 19
NLR(Negative likelihood ratio) None 0.83333 0.70833 1.0
NPV(Negative predictive value) 1.0 0.23077 0.88889 0.95
P(Condition positive or support) 0 16 3 1
PLR(Positive likelihood ratio) None 1.5 5.66667 None
PLRI(Positive likelihood ratio interpretation) None Poor Fair None
POP(Population) 20 20 20 20
PPV(Precision or positive predictive value) 0.0 0.85714 0.5 None
PRE(Prevalence) 0.0 0.8 0.15 0.05
RACC(Random accuracy) 0.0 0.28 0.015 0.0
RACCU(Random accuracy unbiased) 0.07563 0.33062 0.01562 0.00063
TN(True negative/correct rejection) 9 3 16 19
TNR(Specificity or true negative rate) 0.45 0.75 0.94118 1.0
TON(Test outcome negative) 9 13 18 20
TOP(Test outcome positive) 11 7 2 0
TP(True positive/hit) 0 6 1 0
TPR(Sensitivity, recall, hit rate, or true positive rate) None 0.375 0.33333 0.0
Y(Youden index) None 0.125 0.27451 0.0
dInd(Distance index) None 0.67315 0.66926 1.0
sInd(Similarity index) None 0.52401 0.52676 0.29289
<BLANKLINE>
>>> cm.stat(overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"])
Overall Statistics :
<BLANKLINE>
Kappa 0.07801
Scott PI -0.12554
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100 200 500 600
ACC(Accuracy) 0.45 0.45 0.85 0.95
AUC(Area under the roc curve) None 0.5625 0.63725 0.5
TNR(Specificity or true negative rate) 0.45 0.75 0.94118 1.0
TPR(Sensitivity, recall, hit rate, or true positive rate) None 0.375 0.33333 0.0
<BLANKLINE>
>>> cm.stat(overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=[100])
Overall Statistics :
<BLANKLINE>
Kappa 0.07801
Scott PI -0.12554
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100
ACC(Accuracy) 0.45
AUC(Area under the roc curve) None
TNR(Specificity or true negative rate) 0.45
TPR(Sensitivity, recall, hit rate, or true positive rate) None
<BLANKLINE>
>>> cm.stat(overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=[])
Overall Statistics :
<BLANKLINE>
Kappa 0.07801
Scott PI -0.12554
<BLANKLINE>
>>> cm.stat(overall_param=["Kappa","Scott PI"],class_param=[],class_name=[100])
Overall Statistics :
<BLANKLINE>
Kappa 0.07801
Scott PI -0.12554
<BLANKLINE>
>>> cm.stat(overall_param=["Kappa","Scott PI"],class_param=["TPR"],class_name=[100])
Overall Statistics :
<BLANKLINE>
Kappa 0.07801
Scott PI -0.12554
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100
TPR(Sensitivity, recall, hit rate, or true positive rate) None
<BLANKLINE>
>>> cm.stat(overall_param=[],class_param=["TPR"],class_name=[100])
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100
TPR(Sensitivity, recall, hit rate, or true positive rate) None
<BLANKLINE>
>>> cm.print_normalized_matrix()
Predict 100 200 500 600
Actual
100 0.0 0.0 0.0 0.0
200 0.5625 0.375 0.0625 0.0
500 0.33333 0.33333 0.33333 0.0
600 1.0 0.0 0.0 0.0
<BLANKLINE>
>>> cm.print_matrix()
Predict 100 200 500 600
Actual
100 0 0 0 0
200 9 6 1 0
500 1 1 1 0
600 1 0 0 0
<BLANKLINE>
>>> cm.print_matrix(one_vs_all=True,class_name=200)
Predict 200 ~
Actual
200 6 10
~ 1 3
<BLANKLINE>
>>> cm.print_normalized_matrix(one_vs_all=True,class_name=200)
Predict 200 ~
Actual
200 0.375 0.625
~ 0.25 0.75
<BLANKLINE>
>>> kappa_analysis_koch(-0.1)
'Poor'
>>> kappa_analysis_koch(0)
'Slight'
>>> kappa_analysis_koch(0.2)
'Fair'
>>> kappa_analysis_koch(0.4)
'Moderate'
>>> kappa_analysis_koch(0.6)
'Substantial'
>>> kappa_analysis_koch(0.8)
'Almost Perfect'
>>> kappa_analysis_koch(1.2)
'None'
>>> kappa_analysis_fleiss(0.4)
'Intermediate to Good'
>>> kappa_analysis_fleiss(0.75)
'Excellent'
>>> kappa_analysis_fleiss(1.2)
'Excellent'
>>> kappa_analysis_altman(-0.2)
'Poor'
>>> kappa_analysis_altman(0.2)
'Fair'
>>> kappa_analysis_altman(0.4)
'Moderate'
>>> kappa_analysis_altman(0.6)
'Good'
>>> kappa_analysis_altman(0.8)
'Very Good'
>>> kappa_analysis_altman(1.2)
'None'
>>> kappa_analysis_fleiss(0.2)
'Poor'
>>> kappa_analysis_cicchetti(0.3)
'Poor'
>>> kappa_analysis_cicchetti(0.5)
'Fair'
>>> kappa_analysis_cicchetti(0.65)
'Good'
>>> kappa_analysis_cicchetti(0.8)
'Excellent'
>>> PLR_analysis(1)
'Negligible'
>>> PLR_analysis(3)
'Poor'
>>> PLR_analysis(7)
'Fair'
>>> PLR_analysis(11)
'Good'
>>> DP_analysis(0.2)
'Poor'
>>> DP_analysis(1.5)
'Limited'
>>> DP_analysis(2.5)
'Fair'
>>> DP_analysis(10)
'Good'
>>> AUC_analysis(0.5)
'Poor'
>>> AUC_analysis(0.65)
'Fair'
>>> AUC_analysis(0.75)
'Good'
>>> AUC_analysis(0.86)
'Very Good'
>>> AUC_analysis(0.97)
'Excellent'
>>> AUC_analysis(1.0)
'Excellent'
>>> PC_PI_calc(1,1,1)
'None'
>>> PC_PI_calc({1:12},{1:6},{1:45})
0.04000000000000001
>>> PC_AC1_calc(1,1,1)
'None'
>>> PC_AC1_calc({1:123,2:2},{1:120,2:5},{1:125,2:125})
0.05443200000000002
>>> y_act=[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2]
>>> y_pre=[0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,1,1,2,0,1,2,2,2,2]
>>> cm2=ConfusionMatrix(y_act,y_pre)
>>> chi_squared=chi_square_calc(cm2.classes,cm2.table,cm2.TOP,cm2.P,cm2.POP)
>>> chi_squared
15.525641025641026
>>> population = list(cm2.POP.values())[0]
>>> phi_squared=phi_square_calc(chi_squared,population)
>>> phi_squared
0.5750237416904084
>>> V=cramers_V_calc(phi_squared,cm2.classes)
>>> V
0.5362013342441477
>>> DF=DF_calc(cm2.classes)
>>> DF
4
>>> SE=se_calc(cm2.Overall_ACC,population)
>>> SE
0.09072184232530289
>>> CI=CI_calc(cm2.Overall_ACC,SE)
>>> CI
(0.48885185570907297, 0.8444814776242603)
>>> response_entropy=entropy_calc(cm2.TOP,cm2.POP)
>>> response_entropy
1.486565953154142
>>> reference_entropy=entropy_calc(cm2.P,cm2.POP)
>>> reference_entropy
1.5304930567574824
>>> cross_entropy = cross_entropy_calc(cm2.TOP,cm2.P,cm2.POP)
>>> cross_entropy
1.5376219392005763
>>> join_entropy = joint_entropy_calc(cm2.classes,cm2.table,cm2.POP)
>>> join_entropy
2.619748965432189
>>> conditional_entropy = conditional_entropy_calc(cm2.classes,cm2.table,cm2.P,cm2.POP)
>>> conditional_entropy
1.089255908674706
>>> kl_divergence=kl_divergence_calc(cm2.P,cm2.TOP,cm2.POP)
>>> kl_divergence
0.007128882443093773
>>> lambda_B=lambda_B_calc(cm2.classes,cm2.table,cm2.TOP,population)
>>> lambda_B
0.35714285714285715
>>> lambda_A=lambda_A_calc(cm2.classes,cm2.table,cm2.P,population)
>>> lambda_A
0.4
>>> IS_calc(13,0,0,38)
1.5474877953024933
>>> kappa_no_prevalence_calc(cm2.Overall_ACC)
0.33333333333333326
>>> reliability_calc(cm2.Overall_RACC,cm2.Overall_ACC)
0.4740259740259741
>>> mutual_information_calc(cm2.ResponseEntropy,cm2.ConditionalEntropy)
0.39731004447943596
>>> cm3=ConfusionMatrix(matrix=cm2.table)
>>> cm3
pycm.ConfusionMatrix(classes: [0, 1, 2])
>>> cm3.CI
(0.48885185570907297, 0.8444814776242603)
>>> cm3.Chi_Squared
15.525641025641026
>>> cm3.Phi_Squared
0.5750237416904084
>>> cm3.V
0.5362013342441477
>>> cm3.DF
4
>>> cm3.ResponseEntropy
1.486565953154142
>>> cm3.ReferenceEntropy
1.5304930567574824
>>> cm3.CrossEntropy
1.5376219392005763
>>> cm3.JointEntropy
2.619748965432189
>>> cm3.ConditionalEntropy
1.089255908674706
>>> cm3.KL
0.007128882443093773
>>> cm3.LambdaA
0.4
>>> cm3.LambdaB
0.35714285714285715
>>> cm3=ConfusionMatrix(matrix={})
Traceback (most recent call last):
...
pycm.pycm_obj.pycmMatrixError: Input confusion matrix format error
>>> cm_4=ConfusionMatrix(matrix={1:{1:2,"1":2},"1":{1:2,"1":3}})
Traceback (most recent call last):
...
pycm.pycm_obj.pycmMatrixError: Type of the input matrix classes is assumed be the same
>>> cm_5=ConfusionMatrix(matrix={1:{1:2}})
Traceback (most recent call last):
...
pycm.pycm_obj.pycmVectorError: Number of the classes is lower than 2
>>> save_stat=cm.save_html("test",address=False)
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_filtered",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_filtered2",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=[100])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_filtered3",address=False,overall_param=["Kappa","Scott PI"],class_param=["TPR","TNR","ACC","AUC"],class_name=[])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_filtered4",address=False,overall_param=["Kappa","Scott PI"],class_param=[],class_name=[100])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_filtered5",address=False,overall_param=[],class_param=["TPR","TNR","ACC","AUC"],class_name=[100])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("test_colored",address=False,color=(130,100,200))
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_csv("test",address=False)
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_csv("test_filtered",address=False,class_param=["TPR","TNR","ACC","AUC"])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_csv("test_filtered2",address=False,class_param=["TPR","TNR","ACC","AUC"],class_name=[100])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_csv("test_filtered3",address=False,class_param=["TPR","TNR","ACC","AUC"],class_name=[])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_csv("test_filtered4",address=False,class_param=[],class_name=[100])
>>> save_stat=={'Status': True, 'Message': None}
True
>>> save_stat=cm.save_html("/asdasd,qweqwe.eo/",address=True)
>>> save_stat=={'Status': False, 'Message': "[Errno 2] No such file or directory: '/asdasd,qweqwe.eo/.html'"}
True
>>> save_stat=cm.save_csv("/asdasd,qweqwe.eo/",address=True)
>>> save_stat=={'Status': False, 'Message': "[Errno 2] No such file or directory: '/asdasd,qweqwe.eo/.csv'"}
True
>>> def activation(i):
... if i<0.7:
... return 1
... else:
... return 0
>>> cm_6 = ConfusionMatrix([0,0,1,0],[0.87,0.34,0.9,0.12],threshold=activation)
>>> cm_6.print_matrix()
Predict 0 1
Actual
0 1 2
1 1 0
>>> save_obj=cm.save_obj("test",address=False)
>>> save_obj=={'Status': True, 'Message': None}
True
>>> cm_file=ConfusionMatrix(file=open("test.obj","r"))
>>> print(cm_file)
Predict 100 200 500 600
Actual
100 0 0 0 0
<BLANKLINE>
200 9 6 1 0
<BLANKLINE>
500 1 1 1 0
<BLANKLINE>
600 1 0 0 0
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.14096,0.55904)
AUNP None
AUNU None
Bennett S 0.13333
CBA 0.17708
Chi-Squared None
Chi-Squared DF 9
Conditional Entropy 1.23579
Cramer V None
Cross Entropy 1.70995
Gwet AC1 0.19505
Hamming Loss 0.65
Joint Entropy 2.11997
KL Divergence None
Kappa 0.07801
Kappa 95% CI (-0.2185,0.37453)
Kappa No Prevalence -0.3
Kappa Standard Error 0.15128
Kappa Unbiased -0.12554
Lambda A 0.0
Lambda B 0.0
Mutual Information 0.10088
NIR 0.8
Overall ACC 0.35
Overall CEN 0.3648
Overall J (0.60294,0.15074)
Overall MCC 0.12642
Overall MCEN 0.37463
Overall RACC 0.295
Overall RACCU 0.4225
P-Value 1.0
PPV Macro None
PPV Micro 0.35
Phi-Squared None
RCI 0.11409
RR 5.0
Reference Entropy 0.88418
Response Entropy 1.33667
SOA1(Landis & Koch) Slight
SOA2(Fleiss) Poor
SOA3(Altman) Poor
SOA4(Cicchetti) Poor
Scott PI -0.12554
Standard Error 0.10665
TPR Macro None
TPR Micro 0.35
Zero-one Loss 13
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 100 200 500 600
ACC(Accuracy) 0.45 0.45 0.85 0.95
AUC(Area under the roc curve) None 0.5625 0.63725 0.5
AUCI(Auc value interpretation) None Poor Fair Poor
BM(Informedness or bookmaker informedness) None 0.125 0.27451 0.0
CEN(Confusion entropy) 0.33496 0.35708 0.53895 0.0
DOR(Diagnostic odds ratio) None 1.8 8.0 None
DP(Discriminant power) None 0.14074 0.4979 None
DPI(Discriminant power interpretation) None Poor Poor None
ERR(Error rate) 0.55 0.55 0.15 0.05
F0.5(F0.5 score) 0.0 0.68182 0.45455 0.0
F1(F1 score - harmonic mean of precision and sensitivity) 0.0 0.52174 0.4 0.0
F2(F2 score) 0.0 0.42254 0.35714 0.0
FDR(False discovery rate) 1.0 0.14286 0.5 None
FN(False negative/miss/type 2 error) 0 10 2 1
FNR(Miss rate or false negative rate) None 0.625 0.66667 1.0
FOR(False omission rate) 0.0 0.76923 0.11111 0.05
FP(False positive/type 1 error/false alarm) 11 1 1 0
FPR(Fall-out or false positive rate) 0.55 0.25 0.05882 0.0
G(G-measure geometric mean of precision and sensitivity) None 0.56695 0.40825 None
GI(Gini index) None 0.125 0.27451 0.0
IS(Information score) None 0.09954 1.73697 None
J(Jaccard index) 0.0 0.35294 0.25 0.0
LS(Lift score) None 1.07143 3.33333 None
MCC(Matthews correlation coefficient) None 0.10483 0.32673 None
MCEN(Modified confusion entropy) 0.33496 0.37394 0.58028 0.0
MK(Markedness) 0.0 0.08791 0.38889 None
N(Condition negative) 20 4 17 19
NLR(Negative likelihood ratio) None 0.83333 0.70833 1.0
NPV(Negative predictive value) 1.0 0.23077 0.88889 0.95
P(Condition positive or support) 0 16 3 1
PLR(Positive likelihood ratio) None 1.5 5.66667 None
PLRI(Positive likelihood ratio interpretation) None Poor Fair None
POP(Population) 20 20 20 20
PPV(Precision or positive predictive value) 0.0 0.85714 0.5 None
PRE(Prevalence) 0.0 0.8 0.15 0.05
RACC(Random accuracy) 0.0 0.28 0.015 0.0
RACCU(Random accuracy unbiased) 0.07563 0.33062 0.01562 0.00063
TN(True negative/correct rejection) 9 3 16 19
TNR(Specificity or true negative rate) 0.45 0.75 0.94118 1.0
TON(Test outcome negative) 9 13 18 20
TOP(Test outcome positive) 11 7 2 0
TP(True positive/hit) 0 6 1 0
TPR(Sensitivity, recall, hit rate, or true positive rate) None 0.375 0.33333 0.0
Y(Youden index) None 0.125 0.27451 0.0
dInd(Distance index) None 0.67315 0.66926 1.0
sInd(Similarity index) None 0.52401 0.52676 0.29289
<BLANKLINE>
>>> save_obj=cm_6.save_obj("test2",address=False)
>>> save_obj=={'Status': True, 'Message': None}
True
>>> cm_file_2=ConfusionMatrix(file=open("test2.obj","r"))
>>> cm_file_2.print_matrix()
Predict 0 1
Actual
0 1 2
1 1 0
>>> cm = ConfusionMatrix(matrix={"Class1":{"Class1":9,"Class2":3,"Class3":0},"Class2":{"Class1":3,"Class2":5,"Class3":1},"Class3":{"Class1":1,"Class2":1,"Class3":4}})
>>> print(cm)
Predict Class1 Class2 Class3
Actual
Class1 9 3 0
<BLANKLINE>
Class2 3 5 1
<BLANKLINE>
Class3 1 1 4
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.48885,0.84448)
AUNP 0.73175
AUNU 0.73929
Bennett S 0.5
CBA 0.63818
Chi-Squared 15.52564
Chi-Squared DF 4
Conditional Entropy 1.08926
Cramer V 0.5362
Cross Entropy 1.53762
Gwet AC1 0.51229
Hamming Loss 0.33333
Joint Entropy 2.61975
KL Divergence 0.00713
Kappa 0.47403
Kappa 95% CI (0.19345,0.7546)
Kappa No Prevalence 0.33333
Kappa Standard Error 0.14315
Kappa Unbiased 0.47346
Lambda A 0.4
Lambda B 0.35714
Mutual Information 0.39731
NIR 0.44444
Overall ACC 0.66667
Overall CEN 0.52986
Overall J (1.51854,0.50618)
Overall MCC 0.47511
Overall MCEN 0.65286
Overall RACC 0.36626
Overall RACCU 0.36694
P-Value 0.01667
PPV Macro 0.68262
PPV Micro 0.66667
Phi-Squared 0.57502
RCI 0.2596
RR 9.0
Reference Entropy 1.53049
Response Entropy 1.48657
SOA1(Landis & Koch) Moderate
SOA2(Fleiss) Intermediate to Good
SOA3(Altman) Moderate
SOA4(Cicchetti) Fair
Scott PI 0.47346
Standard Error 0.09072
TPR Macro 0.65741
TPR Micro 0.66667
Zero-one Loss 9
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes Class1 Class2 Class3
ACC(Accuracy) 0.74074 0.7037 0.88889
AUC(Area under the roc curve) 0.74167 0.66667 0.80952
AUCI(Auc value interpretation) Good Fair Very Good
BM(Informedness or bookmaker informedness) 0.48333 0.33333 0.61905
CEN(Confusion entropy) 0.45994 0.66249 0.47174
DOR(Diagnostic odds ratio) 8.25 4.375 40.0
DP(Discriminant power) 0.50527 0.35339 0.88326
DPI(Discriminant power interpretation) Poor Poor Poor
ERR(Error rate) 0.25926 0.2963 0.11111
F0.5(F0.5 score) 0.70312 0.55556 0.76923
F1(F1 score - harmonic mean of precision and sensitivity) 0.72 0.55556 0.72727
F2(F2 score) 0.7377 0.55556 0.68966
FDR(False discovery rate) 0.30769 0.44444 0.2
FN(False negative/miss/type 2 error) 3 4 2
FNR(Miss rate or false negative rate) 0.25 0.44444 0.33333
FOR(False omission rate) 0.21429 0.22222 0.09091
FP(False positive/type 1 error/false alarm) 4 4 1
FPR(Fall-out or false positive rate) 0.26667 0.22222 0.04762
G(G-measure geometric mean of precision and sensitivity) 0.72058 0.55556 0.7303
GI(Gini index) 0.48333 0.33333 0.61905
IS(Information score) 0.63941 0.73697 1.848
J(Jaccard index) 0.5625 0.38462 0.57143
LS(Lift score) 1.55769 1.66667 3.6
MCC(Matthews correlation coefficient) 0.48067 0.33333 0.66254
MCEN(Modified confusion entropy) 0.57782 0.77284 0.60158
MK(Markedness) 0.47802 0.33333 0.70909
N(Condition negative) 15 18 21
NLR(Negative likelihood ratio) 0.34091 0.57143 0.35
NPV(Negative predictive value) 0.78571 0.77778 0.90909
P(Condition positive or support) 12 9 6
PLR(Positive likelihood ratio) 2.8125 2.5 14.0
PLRI(Positive likelihood ratio interpretation) Poor Poor Good
POP(Population) 27 27 27
PPV(Precision or positive predictive value) 0.69231 0.55556 0.8
PRE(Prevalence) 0.44444 0.33333 0.22222
RACC(Random accuracy) 0.21399 0.11111 0.04115
RACCU(Random accuracy unbiased) 0.21433 0.11111 0.0415
TN(True negative/correct rejection) 11 14 20
TNR(Specificity or true negative rate) 0.73333 0.77778 0.95238
TON(Test outcome negative) 14 18 22
TOP(Test outcome positive) 13 9 5
TP(True positive/hit) 9 5 4
TPR(Sensitivity, recall, hit rate, or true positive rate) 0.75 0.55556 0.66667
Y(Youden index) 0.48333 0.33333 0.61905
dInd(Distance index) 0.36553 0.4969 0.33672
sInd(Similarity index) 0.74153 0.64864 0.7619
<BLANKLINE>
>>> cm = ConfusionMatrix(matrix={"Class1":{"Class1":9,"Class2":3,"Class3":1},"Class2":{"Class1":3,"Class2":5,"Class3":1},"Class3":{"Class1":0,"Class2":1,"Class3":4}},transpose=True)
>>> print(cm)
Predict Class1 Class2 Class3
Actual
Class1 9 3 0
<BLANKLINE>
Class2 3 5 1
<BLANKLINE>
Class3 1 1 4
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.48885,0.84448)
AUNP 0.73175
AUNU 0.73929
Bennett S 0.5
CBA 0.63818
Chi-Squared 15.52564
Chi-Squared DF 4
Conditional Entropy 1.08926
Cramer V 0.5362
Cross Entropy 1.53762
Gwet AC1 0.51229
Hamming Loss 0.33333
Joint Entropy 2.61975
KL Divergence 0.00713
Kappa 0.47403
Kappa 95% CI (0.19345,0.7546)
Kappa No Prevalence 0.33333
Kappa Standard Error 0.14315
Kappa Unbiased 0.47346
Lambda A 0.4
Lambda B 0.35714
Mutual Information 0.39731
NIR 0.44444
Overall ACC 0.66667
Overall CEN 0.52986
Overall J (1.51854,0.50618)
Overall MCC 0.47511
Overall MCEN 0.65286
Overall RACC 0.36626
Overall RACCU 0.36694
P-Value 0.01667
PPV Macro 0.68262
PPV Micro 0.66667
Phi-Squared 0.57502
RCI 0.2596
RR 9.0
Reference Entropy 1.53049
Response Entropy 1.48657
SOA1(Landis & Koch) Moderate
SOA2(Fleiss) Intermediate to Good
SOA3(Altman) Moderate
SOA4(Cicchetti) Fair
Scott PI 0.47346
Standard Error 0.09072
TPR Macro 0.65741
TPR Micro 0.66667
Zero-one Loss 9
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes Class1 Class2 Class3
ACC(Accuracy) 0.74074 0.7037 0.88889
AUC(Area under the roc curve) 0.74167 0.66667 0.80952
AUCI(Auc value interpretation) Good Fair Very Good
BM(Informedness or bookmaker informedness) 0.48333 0.33333 0.61905
CEN(Confusion entropy) 0.45994 0.66249 0.47174
DOR(Diagnostic odds ratio) 8.25 4.375 40.0
DP(Discriminant power) 0.50527 0.35339 0.88326
DPI(Discriminant power interpretation) Poor Poor Poor
ERR(Error rate) 0.25926 0.2963 0.11111
F0.5(F0.5 score) 0.70312 0.55556 0.76923
F1(F1 score - harmonic mean of precision and sensitivity) 0.72 0.55556 0.72727
F2(F2 score) 0.7377 0.55556 0.68966
FDR(False discovery rate) 0.30769 0.44444 0.2
FN(False negative/miss/type 2 error) 3 4 2
FNR(Miss rate or false negative rate) 0.25 0.44444 0.33333
FOR(False omission rate) 0.21429 0.22222 0.09091
FP(False positive/type 1 error/false alarm) 4 4 1
FPR(Fall-out or false positive rate) 0.26667 0.22222 0.04762
G(G-measure geometric mean of precision and sensitivity) 0.72058 0.55556 0.7303
GI(Gini index) 0.48333 0.33333 0.61905
IS(Information score) 0.63941 0.73697 1.848
J(Jaccard index) 0.5625 0.38462 0.57143
LS(Lift score) 1.55769 1.66667 3.6
MCC(Matthews correlation coefficient) 0.48067 0.33333 0.66254
MCEN(Modified confusion entropy) 0.57782 0.77284 0.60158
MK(Markedness) 0.47802 0.33333 0.70909
N(Condition negative) 15 18 21
NLR(Negative likelihood ratio) 0.34091 0.57143 0.35
NPV(Negative predictive value) 0.78571 0.77778 0.90909
P(Condition positive or support) 12 9 6
PLR(Positive likelihood ratio) 2.8125 2.5 14.0
PLRI(Positive likelihood ratio interpretation) Poor Poor Good
POP(Population) 27 27 27
PPV(Precision or positive predictive value) 0.69231 0.55556 0.8
PRE(Prevalence) 0.44444 0.33333 0.22222
RACC(Random accuracy) 0.21399 0.11111 0.04115
RACCU(Random accuracy unbiased) 0.21433 0.11111 0.0415
TN(True negative/correct rejection) 11 14 20
TNR(Specificity or true negative rate) 0.73333 0.77778 0.95238
TON(Test outcome negative) 14 18 22
TOP(Test outcome positive) 13 9 5
TP(True positive/hit) 9 5 4
TPR(Sensitivity, recall, hit rate, or true positive rate) 0.75 0.55556 0.66667
Y(Youden index) 0.48333 0.33333 0.61905
dInd(Distance index) 0.36553 0.4969 0.33672
sInd(Similarity index) 0.74153 0.64864 0.7619
<BLANKLINE>
>>> online_help(param=None)
Please choose one parameter :
<BLANKLINE>
Example : online_help("J") or online_help(2)
<BLANKLINE>
1-95% CI
2-ACC
3-AUC
4-AUCI
5-AUNP
6-AUNU
7-BM
8-Bennett S
9-CBA
10-CEN
11-Chi-Squared
12-Chi-Squared DF
13-Conditional Entropy
14-Cramer V
15-Cross Entropy
16-DOR
17-DP
18-DPI
19-ERR
20-F0.5
21-F1
22-F2
23-FDR
24-FN
25-FNR
26-FOR
27-FP
28-FPR
29-G
30-GI
31-Gwet AC1
32-Hamming Loss
33-IS
34-J
35-Joint Entropy
36-KL Divergence
37-Kappa
38-Kappa 95% CI
39-Kappa No Prevalence
40-Kappa Standard Error
41-Kappa Unbiased
42-LS
43-Lambda A
44-Lambda B
45-MCC
46-MCEN
47-MK
48-Mutual Information
49-N
50-NIR
51-NLR
52-NPV
53-Overall ACC
54-Overall CEN
55-Overall J
56-Overall MCC
57-Overall MCEN
58-Overall RACC
59-Overall RACCU
60-P
61-P-Value
62-PLR
63-PLRI
64-POP
65-PPV
66-PPV Macro
67-PPV Micro
68-PRE
69-Phi-Squared
70-RACC
71-RACCU
72-RCI
73-RR
74-Reference Entropy
75-Response Entropy
76-SOA1(Landis & Koch)
77-SOA2(Fleiss)
78-SOA3(Altman)
79-SOA4(Cicchetti)
80-Scott PI
81-Standard Error
82-TN
83-TNR
84-TON
85-TOP
86-TP
87-TPR
88-TPR Macro
89-TPR Micro
90-Y
91-Zero-one Loss
92-dInd
93-sInd
>>> online_help("J")
...
>>> online_help(4)
...
>>> y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
>>> y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
>>> cm = ConfusionMatrix(y_actu, y_pred, sample_weight=[2, 2, 2, 2, 3, 1, 1, 2, 2, 1, 1, 2])
>>> print(cm)
Predict 0 1 2
Actual
0 6 0 0
<BLANKLINE>
1 0 1 2
<BLANKLINE>
2 4 2 6
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
<BLANKLINE>
Overall Statistics :
<BLANKLINE>
95% CI (0.41134,0.82675)
AUNP 0.7
AUNU 0.70556
Bennett S 0.42857
CBA 0.47778
Chi-Squared 10.44167
Chi-Squared DF 4
Conditional Entropy 0.96498
Cramer V 0.49861
Cross Entropy 1.50249
Gwet AC1 0.45277
Hamming Loss 0.38095
Joint Entropy 2.34377
KL Divergence 0.1237
Kappa 0.3913
Kappa 95% CI (0.05943,0.72318)
Kappa No Prevalence 0.2381
Kappa Standard Error 0.16932
Kappa Unbiased 0.37313
Lambda A 0.22222
Lambda B 0.36364
Mutual Information 0.47618
NIR 0.57143
Overall ACC 0.61905
Overall CEN 0.43947
Overall J (1.22857,0.40952)
Overall MCC 0.41558
Overall MCEN 0.50059
Overall RACC 0.37415
Overall RACCU 0.39229
P-Value 0.41709
PPV Macro 0.56111
PPV Micro 0.61905
Phi-Squared 0.49722
RCI 0.34536
RR 7.0
Reference Entropy 1.37878
Response Entropy 1.44117
SOA1(Landis & Koch) Fair
SOA2(Fleiss) Poor
SOA3(Altman) Fair
SOA4(Cicchetti) Poor
Scott PI 0.37313
Standard Error 0.10597
TPR Macro 0.61111
TPR Micro 0.61905
Zero-one Loss 8
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 0 1 2
ACC(Accuracy) 0.80952 0.80952 0.61905
AUC(Area under the roc curve) 0.86667 0.61111 0.63889
AUCI(Auc value interpretation) Very Good Fair Fair
BM(Informedness or bookmaker informedness) 0.73333 0.22222 0.27778
CEN(Confusion entropy) 0.25 0.52832 0.56439
DOR(Diagnostic odds ratio) None 4.0 3.5
DP(Discriminant power) None 0.33193 0.29996
DPI(Discriminant power interpretation) None Poor Poor
ERR(Error rate) 0.19048 0.19048 0.38095
F0.5(F0.5 score) 0.65217 0.33333 0.68182
F1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.33333 0.6
F2(F2 score) 0.88235 0.33333 0.53571
FDR(False discovery rate) 0.4 0.66667 0.25
FN(False negative/miss/type 2 error) 0 2 6
FNR(Miss rate or false negative rate) 0.0 0.66667 0.5
FOR(False omission rate) 0.0 0.11111 0.46154
FP(False positive/type 1 error/false alarm) 4 2 2
FPR(Fall-out or false positive rate) 0.26667 0.11111 0.22222
G(G-measure geometric mean of precision and sensitivity) 0.7746 0.33333 0.61237
GI(Gini index) 0.73333 0.22222 0.27778
IS(Information score) 1.07039 1.22239 0.39232
J(Jaccard index) 0.6 0.2 0.42857
LS(Lift score) 2.1 2.33333 1.3125
MCC(Matthews correlation coefficient) 0.66332 0.22222 0.28307
MCEN(Modified confusion entropy) 0.26439 0.52877 0.65924
MK(Markedness) 0.6 0.22222 0.28846
N(Condition negative) 15 18 9
NLR(Negative likelihood ratio) 0.0 0.75 0.64286
NPV(Negative predictive value) 1.0 0.88889 0.53846
P(Condition positive or support) 6 3 12
PLR(Positive likelihood ratio) 3.75 3.0 2.25
PLRI(Positive likelihood ratio interpretation) Poor Poor Poor
POP(Population) 21 21 21
PPV(Precision or positive predictive value) 0.6 0.33333 0.75
PRE(Prevalence) 0.28571 0.14286 0.57143
RACC(Random accuracy) 0.13605 0.02041 0.21769
RACCU(Random accuracy unbiased) 0.14512 0.02041 0.22676
TN(True negative/correct rejection) 11 16 7
TNR(Specificity or true negative rate) 0.73333 0.88889 0.77778
TON(Test outcome negative) 11 18 13
TOP(Test outcome positive) 10 3 8
TP(True positive/hit) 6 1 6
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5
Y(Youden index) 0.73333 0.22222 0.27778
dInd(Distance index) 0.26667 0.67586 0.54716
sInd(Similarity index) 0.81144 0.52209 0.6131
<BLANKLINE>
>>> save_obj=cm.save_obj("test3",address=False)
>>> save_obj=={'Status': True, 'Message': None}
True
>>> cm_file_3=ConfusionMatrix(file=open("test3.obj","r"))
>>> cm_file_3.print_matrix()
Predict 0 1 2
Actual
0 6 0 0
1 0 1 2
2 4 2 6
<BLANKLINE>
>>> cm_file_3.stat()
Overall Statistics :
<BLANKLINE>
95% CI (0.41134,0.82675)
AUNP 0.7
AUNU 0.70556
Bennett S 0.42857
CBA 0.47778
Chi-Squared 10.44167
Chi-Squared DF 4
Conditional Entropy 0.96498
Cramer V 0.49861
Cross Entropy 1.50249
Gwet AC1 0.45277
Hamming Loss 0.38095
Joint Entropy 2.34377
KL Divergence 0.1237
Kappa 0.3913
Kappa 95% CI (0.05943,0.72318)
Kappa No Prevalence 0.2381
Kappa Standard Error 0.16932
Kappa Unbiased 0.37313
Lambda A 0.22222
Lambda B 0.36364
Mutual Information 0.47618
NIR 0.57143
Overall ACC 0.61905
Overall CEN 0.43947
Overall J (1.22857,0.40952)
Overall MCC 0.41558
Overall MCEN 0.50059
Overall RACC 0.37415
Overall RACCU 0.39229
P-Value 0.41709
PPV Macro 0.56111
PPV Micro 0.61905
Phi-Squared 0.49722
RCI 0.34536
RR 7.0
Reference Entropy 1.37878
Response Entropy 1.44117
SOA1(Landis & Koch) Fair
SOA2(Fleiss) Poor
SOA3(Altman) Fair
SOA4(Cicchetti) Poor
Scott PI 0.37313
Standard Error 0.10597
TPR Macro 0.61111
TPR Micro 0.61905
Zero-one Loss 8
<BLANKLINE>
Class Statistics :
<BLANKLINE>
Classes 0 1 2
ACC(Accuracy) 0.80952 0.80952 0.61905
AUC(Area under the roc curve) 0.86667 0.61111 0.63889
AUCI(Auc value interpretation) Very Good Fair Fair
BM(Informedness or bookmaker informedness) 0.73333 0.22222 0.27778
CEN(Confusion entropy) 0.25 0.52832 0.56439
DOR(Diagnostic odds ratio) None 4.0 3.5
DP(Discriminant power) None 0.33193 0.29996
DPI(Discriminant power interpretation) None Poor Poor
ERR(Error rate) 0.19048 0.19048 0.38095
F0.5(F0.5 score) 0.65217 0.33333 0.68182
F1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.33333 0.6
F2(F2 score) 0.88235 0.33333 0.53571
FDR(False discovery rate) 0.4 0.66667 0.25
FN(False negative/miss/type 2 error) 0 2 6
FNR(Miss rate or false negative rate) 0.0 0.66667 0.5
FOR(False omission rate) 0.0 0.11111 0.46154
FP(False positive/type 1 error/false alarm) 4 2 2
FPR(Fall-out or false positive rate) 0.26667 0.11111 0.22222
G(G-measure geometric mean of precision and sensitivity) 0.7746 0.33333 0.61237
GI(Gini index) 0.73333 0.22222 0.27778
IS(Information score) 1.07039 1.22239 0.39232
J(Jaccard index) 0.6 0.2 0.42857
LS(Lift score) 2.1 2.33333 1.3125
MCC(Matthews correlation coefficient) 0.66332 0.22222 0.28307
MCEN(Modified confusion entropy) 0.26439 0.52877 0.65924
MK(Markedness) 0.6 0.22222 0.28846
N(Condition negative) 15 18 9
NLR(Negative likelihood ratio) 0.0 0.75 0.64286
NPV(Negative predictive value) 1.0 0.88889 0.53846
P(Condition positive or support) 6 3 12
PLR(Positive likelihood ratio) 3.75 3.0 2.25
PLRI(Positive likelihood ratio interpretation) Poor Poor Poor
POP(Population) 21 21 21
PPV(Precision or positive predictive value) 0.6 0.33333 0.75
PRE(Prevalence) 0.28571 0.14286 0.57143
RACC(Random accuracy) 0.13605 0.02041 0.21769
RACCU(Random accuracy unbiased) 0.14512 0.02041 0.22676
TN(True negative/correct rejection) 11 16 7
TNR(Specificity or true negative rate) 0.73333 0.88889 0.77778
TON(Test outcome negative) 11 18 13
TOP(Test outcome positive) 10 3 8
TP(True positive/hit) 6 1 6
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5
Y(Youden index) 0.73333 0.22222 0.27778
dInd(Distance index) 0.26667 0.67586 0.54716
sInd(Similarity index) 0.81144 0.52209 0.6131
>>> NIR_calc({'Class2': 804, 'Class1': 196},1000) # Verified Case
0.804
>>> cm = ConfusionMatrix(matrix={0:{0:3,1:1},1:{0:4,1:2}}) # Verified Case
>>> cm.LS[1]
1.1111111111111112
>>> cm.LS[0]
1.0714285714285714
>>> cm = ConfusionMatrix(matrix={"Class1":{"Class1":183,"Class2":13},"Class2":{"Class1":141,"Class2":663}}) # Verified Case
>>> cm.PValue
0.000342386296143693
>>> cm = ConfusionMatrix(matrix={"Class1":{"Class1":4,"Class2":2},"Class2":{"Class1":2,"Class2":4}}) # Verified Case
>>> cm.Overall_CEN
0.861654166907052
>>> cm.Overall_MCEN
0.6666666666666666
>>> cm.IS["Class1"]
0.4150374992788437
>>> cm.IS["Class2"]
0.4150374992788437
>>> cm = ConfusionMatrix(matrix={1:{1:5,2:0,3:0},2:{1:0,2:10,3:0},3:{1:0,2:300,3:0}}) # Verified Case
>>> cm.Overall_CEN
0.022168905807495587
>>> cm.Overall_MCC
0.3012440235352457
>>> cm.CBA
0.3440860215053763
>>> cm = ConfusionMatrix(matrix={1:{1:1,2:3,3:0,4:0},2:{1:9,2:1,3:0,4:0},3:{1:0,2:0,3:100,4:0},4:{1:0,2:0,3:0,4:200}}) # Verified Case
>>> cm.RCI
0.9785616782831341
>>> cm = ConfusionMatrix(matrix={1:{1:1,2:0,3:3},2:{1:0,2:100,3:0},3:{1:0,2:0,3:200}}) # Verified Case
>>> cm.RCI
0.9264007150415143
>>> cm = ConfusionMatrix(matrix={1:{1:5,2:0,3:0},2:{1:0,2:10,3:0},3:{1:0,2:300,3:0}})
>>> cm.RCI
0.3675708571923818
>>> cm = ConfusionMatrix(matrix={1:{1:12806,2:26332},2:{1:5484,2:299777}},transpose=True) # Verified Case
>>> cm.AUC[1]
0.8097090079101759
>>> cm.GI[1]
0.6194180158203517
>>> cm.Overall_ACC
0.9076187793808925
>>> cm.DP[1]
0.7854399677022138
>>> cm.Y[1]
0.6194180158203517
>>> cm.BM[1]
0.6194180158203517
>>> cm = ConfusionMatrix(matrix={1:{1:13182,2:30516},2:{1:5108,2:295593}},transpose=True) # Verified Case
>>> cm.AUC[1]
0.8135728157964055
>>> cm.GI[1]
0.627145631592811
>>> cm.Overall_ACC
0.896561836706843
>>> cm.DP[1]
0.770700985610517
>>> cm.Y[1]
0.627145631592811
>>> cm.BM[1]
0.627145631592811
>>> save_obj = cm.save_obj("test4",address=False)
>>> save_obj=={'Status': True, 'Message': None}
True
>>> cm_file=ConfusionMatrix(file=open("test4.obj","r"))
>>> cm_file.DP[1]
0.770700985610517
>>> cm_file.Y[1]
0.627145631592811
>>> cm_file.BM[1]
0.627145631592811
>>> cm_file.transpose
True
>>> json.dump({"Actual-Vector": None, "Digit": 5, "Predict-Vector": None, "Matrix": {"0": {"0": 3, "1": 0, "2": 2}, "1": {"0": 0, "1": 1, "2": 1}, "2": {"0": 0, "1": 2, "2": 3}}, "Transpose": True,"Sample-Weight": None},open("test5.obj","w"))
>>> cm_file=ConfusionMatrix(file=open("test5.obj","r"))
>>> cm_file.transpose
True
>>> cm_file.matrix == {"0": {"0": 3, "1": 0, "2": 2}, "1": {"0": 0, "1": 1, "2": 1}, "2": {"0": 0, "1": 2, "2": 3}}
True
>>> cm = ConfusionMatrix([1,2,3,4],[1,2,3,"4"])
>>> cm
pycm.ConfusionMatrix(classes: ['1', '2', '3', '4'])
>>> os.remove("test.csv")
>>> os.remove("test.obj")
>>> os.remove("test.html")
>>> os.remove("test_filtered.html")
>>> os.remove("test_filtered.csv")
>>> os.remove("test_filtered.pycm")
>>> os.remove("test_filtered2.html")
>>> os.remove("test_filtered3.html")
>>> os.remove("test_filtered4.html")
>>> os.remove("test_filtered5.html")
>>> os.remove("test_colored.html")
>>> os.remove("test_filtered2.csv")
>>> os.remove("test_filtered3.csv")
>>> os.remove("test_filtered4.csv")
>>> os.remove("test_filtered2.pycm")
>>> os.remove("test_filtered3.pycm")
>>> os.remove("test2.obj")
>>> os.remove("test3.obj")
>>> os.remove("test4.obj")
>>> os.remove("test5.obj")
>>> os.remove("test.pycm")
'''
|
#encoding:utf-8
subreddit = 'talesfromtechsupport'
t_channel = '@r_talesfromtechsupport'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
def factors(n):
factorlist=[]
for i in range(1,n+1):
if n%i==0:
factorlist=factorlist+[i]
return(factorlist)
def isprime(n):
return(factors(n)==[1,n])
def sumprimes(l):
sum=0
for i in range(0,len(l)):
if isprime(l[i]):
sum=sum+l[i]
return(sum)
|
"""
复习 MVC
class XXModel:
# 封装数据
def __init__(self,参数1,参数2,参数3):
self.数据1 = 参数1
self.数据2 = 参数2
self.数据3 = 参数3
class XXView:
def __init__(self):
self.controller = XXController()
# 界面逻辑:输入、输出、页面跳转
def 输入信息方法(self):
数据 = XXModel(输入的各种信息)
self.controller.存储信息方法(数据)
class XXController:
# 业务逻辑:对数据的核心操作
def 存储信息方法():
...
view = XXView()
view.输入信息方法()
导入模块
方式一:"我过去" --- 本质:通过变量关联模块
import 模块名
模块名.成员
方式二:"你过来" --- 本质:将模块的成员导入到当前作用域中
from 模块名 import 成员
成员
小心:命名冲突
"""
print("你猜我的模块名:",__name__)
def func01():
print("func01")
|
def for_A():
"""We are creating user defined function for alphabetical pattern of capital A with "*" symbol"""
row=7
col=5
for i in range(row):
for j in range(col):
if ((j==0 or j==4)and i>0)or ((i==0 or i==4)and j>0 and j<4):
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_A():
i=0
while i<7:
j=0
while j<5:
if ((j==0 or j==4)and i>0)or ((i==0 or i==4)and j>0 and j<4):
print("*",end=" ")
else:
print(" ",end=" ")
j+=1
i+=1
print()
|
# A python method for an optimized Bubble Sort Algorithm
def bubble_sort(arr):
n = len(arr)
# Traverse through all array elements
for i in range(n):
swapped = False
# Last i elements are already in place
for j in range(0, n-i-1):
# Traverse the array from - to n-i-1
# Swap if the element found is greater
# than the next element
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
swapped = True
# If no two elements were swapped by inner loop, then break
if swapped == False:
break
return arr
# Testing the sort
""" arr = [62, 22, 25, 11, 21, 11, 85]
bubble_sort(arr)
print("Sorted array:")
for i in range(len(arr)):
print("%d" % arr[i], end=" ")
"""
|
def swap(array,i,j): #this simply swaps the values
array[i],array[j]=array[j],array[i]
'''HeapifyMax function, our root node is at index i. We will first assume that
the value at index 'i' is the largest. Then we will find index of left and right child.
Then we will check if left and right child exist or not.Now, we will compare our value
at index i with left and right child. If either of two children have greater value
then "largest" will store the index of greater value and will swap
the values. if the largest is equal to index i then no swapping. This will be a recursive
funtion so that value gets to its correct position. MAKES PARENT MAX THAN CHILD'''
def HeapifyMax(items,length,index):
largest=index
leftchild=(index*2)+1 #finding index of leftchild
rightchild=(index*2)+2 #finding index of right child
if leftchild<length and items[index]<items[leftchild]: #checking left chid exist and comparing with parent node
largest=leftchild
if rightchild<length and items[largest]<items[rightchild]: #checking right chid exist and comparing with parent node
largest=rightchild
if largest!=index: #swaping
items[index],items[largest] = items[largest],items[index]
HeapifyMax(items,length,largest) #recurssion
'''HeapifyMin function, our root node is at index i. We will first assume that
the value at index 'i' is the smallest. Then we will find index of left and right child.
Then we will check if left and right child exist or not.Now, we will compare our value
at index i with left and right child. If either of two children have smaller value
then "smallest" will store the index of greater value and will swap
the values. if the smallest is equal to index i then no swapping. This will be a recursive
funtion so that value gets to its correct position. MAKES PARENT MIN THAN CHILD'''
def HeapifyMin(items,length,index):
smallest=index
leftchild=(index*2)+1 #finding index of leftchild
rightchild=(index*2)+2 #finding index of right child
if leftchild<length and items[index]>items[leftchild]: #checking left chid exist and comparing with parent node
smallest=leftchild
if rightchild<length and items[smallest]>items[rightchild]: #checking right chid exist and comparing with parent node
smallest=rightchild
if smallest!=index: #swaping
items[index],items[smallest] = items[smallest],items[index]
HeapifyMin(items,length,smallest)
'''HeapSortDes function will sort descending order.'''
def HeapSortDes(items):
length=len(items)
MinHeap(items)
for i in range(length-1, 0, -1): #extracting values one by one.
items[i], items[0] = items[0], items[i] # swaping
HeapifyMin(items, i, 0)
return items
'''HeapSortAsc function will sort descending order'''
def HeapSortAsc(items):
length=len(items)
MaxHeap(items)
for i in range(length-1, 0, -1): #extracting values one by one.
items[i], items[0] = items[0], items[i] # swaping
HeapifyMax(items, i, 0)
return items
'''Now, we are creating our Max Heap function which will use Heapifymax function to place
values at their correct position.'''
def MaxHeap(items):
length=len(items)
for i in range(length // 2 - 1, -1, -1): #last parent node
HeapifyMax(items,length,i)
return items
'''Now, we are creating our Min Heap function which will use HeapifyMin function to place
values at their correct position.'''
def MinHeap(items):
length=len(items)
for i in range(length // 2 - 1, -1, -1): #last parent node
HeapifyMin(items,length,i)
return items
''' We will define our enqueue function which will recieve data
We will add it to the end of the heap and then move it to its
correct position.'''
def enqueue(items,data):
items.append(data)
return items
'''Let's define our DequeueMax function which will delete the highest priority element.
There are 3 possibilities for the function.
First possibility that there are 2 or 3 values in the heap
in which we will move move max value to the end of the heap before popping it out
then we want to move the value that we swapped to the top position
The second possibility is that there is only one value in the heap.
In this case we can simply pop the top value from the heap then we will have
empty heap after that.
The third possibility is that there is no element in the heap. In this case we
will just return "NO ELEMENT".'''
def DequeueMax(items):
if len(items)>1: #first case
swap(items,0,len(items)-1)
maximum=items.pop()
HeapifyMax(items,len(items),0)
return maximum
elif len(items)==1: #second case
maximum=items.pop()
return maximum
else: #third case
return "NO ELEMENT IN THE QUEUE "
'''Let's define our DequeueMin function which will dequeue the highest priority element.
There are 3 possibilities for the function.
First possibility that there are 2 or 3 values in the heap
in which we will move move min value to the end of the heap before popping it out
then we want to move the value that we swapped to the top position
The second possibility is that there is only one value in the heap.
In this case we can simply pop the top value from the heap then we will have
empty heap after that.
The third possibility is that there is no element in the heap. In this case we
will just return "NO ELEMENT".'''
def DequeueMin(items):
if len(items)>1: #first case
swap(items,0,len(items)-1)
minimum=items.pop()
HeapifyMin(items,len(items),0)
return minimum
elif len(items)==1: #second case
minimum=items.pop()
return minimum
else: #third case
return "NO ELEMENT IN THE QUEUE "
'''We will define Highestpriority function which will give the highest priority element.
Highestpriority function simply checks to see if we have atleast one value on the heap.
If we do have then it will return the first value on a heap list. If we don't
have any value then it will simply returns "NO ELEMENT" i.e. heap is empty'''
def Highestpriority(items):
if len(items)!=0:
return items[0]
else:
return "NO ELEMENT IN THE QUEUE"
'''This is the python program in which we create the user input queue first then
the choices will be asked to user. this runs in an infinite loop till the user
choose to exit.'''
print("Python program to implement Priority Queue using Heap")
print("CREATE YOUR QUEUE")
'''User input queue'''
myqueue=[]
n=int(input("Enter no. of elements you want in your queue:"))
for j in range(0,n):
element=int(input("Enter element:"))
myqueue.append(element)
print("Your Queue Is:",myqueue)
print("1.Create Your Max Priority Queue")
print("2.Create Your Min Priority Queue")
choice=int(input("Enter Your Choice:"))
if choice==1:
print("Your Max Priority Queue Is:",HeapSortDes(myqueue)) #prints priority queue usin MaxHeap function
while True:
print("a. Enqueue in Priority Queue")
print("b. Dequeue Highest Priority Element ")
print("c. Highest Priority Element ")
print("d. Exit ")
option=input("Enter Your Choice:")
if option=='a' or option=='A':
value=int(input("Enter the value you want to insert in your priority queue:"))
enqueue(myqueue,value)
print("You New Priority Queue is:",HeapSortDes(myqueue))
elif option=='b' or option=='B':
k=DequeueMax(myqueue)
print("Dequeued Highest priority elemnet is:", k)
print("Your New Priority Queue is:", HeapSortDes(myqueue))
elif option=='c' or option=='C':
m=Highestpriority(myqueue)
print("Highest priority element is:",m)
elif option=='d' or option=='D':
break
else:
print("INVALID CHOICE")
elif choice==2:
print("Your Min Priority Queue Is:",HeapSortAsc(myqueue)) #prints priority queue usin MaxHeap function
while True:
print("a. Enqueue in Min Priority Queue")
print("b. Dequeue Highest Priority Element ")
print("c. Highest Priority Element ")
print("d. Exit ")
options=input("Enter Your Choice:")
if options=='a' or options=='A' :
value=int(input("Enter the value you want to insert in your priority queue:"))
enqueue(myqueue,value)
print("You New Priority Queue is:",HeapSortAsc(myqueue))
elif options=='b' or options=='B':
y=DequeueMin(myqueue)
print("Dequeued Highest priority elemnet is:", y)
print("Your New Priority Queue is:", HeapSortAsc(myqueue))
elif options=='c' or options=='C':
h=Highestpriority(myqueue)
print("Highest priority element is:",h)
elif options=='d' or options=='D':
break
else:
print("INVALID CHOICE")
else:
print("INVALID CHOICE")
|
print('Введите меню (через пробелы)')
menu = input().split(' ')
string = 'test0'
for string in menu:
if(string[0].isupper() == True):
print(string)
|
# Time: O(n)
# Space: O(1)
class Solution(object):
def maxSumDivThree(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
dp = [0, 0, 0]
for num in nums:
for i in [num+x for x in dp]:
dp[i%3] = max(dp[i%3], i)
return dp[0]
|
# https://app.codesignal.com/arcade/intro/level-5/g6dc9KJyxmFjB98dL
def areEquallyStrong(your_left, your_right, friends_left, friends_right):
# Two arms are equally strong if the heaviest weights they each are
# able to lift are equal. Two people are equally strong if their
# strongest arms are equally strong and so are their weakest arms.
my_max = max(your_left, your_right)
my_min = min(your_left, your_right)
fr_max = max(friends_left, friends_right)
fr_min = min(friends_left, friends_right)
# Check if me and my friend are equally strong!
return my_max == fr_max and my_min == fr_min
|
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 12 10:03:50 2019
@author: Caio
"""
# Livro Assaf - Mercado Financeiro
#Capítulo 7.6.1 - Desmembramento da taxa básica de juros
i_pura = float(input('Insira a taxa livre de risco da economia'))
i_risco = float(input('Insira a taxa de risco mínimo da economia'))
i_real = float
i_real = (1+i_pura) * (1+i_risco)-1
print = (' A taxa real de juros para esta operação é:', i_real)
INF = float(input('Insira a taxa de inflação do período'))
SELIC = float
SELIC = (1 + i_real) * (1 + INF) - 1
print(SELIC)
|
# Source : https://leetcode.com/problems/4sum/
# Author : YipingPan
# Date : 2020-08-16
#####################################################################################################
#
# Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums
# such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of
# target.
#
# Note:
#
# The solution set must not contain duplicate quadruplets.
#
# Example:
#
# Given array nums = [1, 0, -1, 0, -2, 2], and target = 0.
#
# A solution set is:
# [
# [-1, 0, 0, 1],
# [-2, -1, 1, 2],
# [-2, 0, 0, 2]
# ]
#
#####################################################################################################
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
# dic {sum1:[[i,j],[i,j]], sum2:[[i,j],[i,j]], ...} # O(n^2)
# for x in dic: if dic[target-x] ...
dic = collections.defaultdict(list)
for i in range(len(nums)):
for j in range(len(nums)):
if i<j:
dic[nums[i]+nums[j]].append([i,j])
res = set()
for x in dic:
if target-x in dic: ### be careful here. Don't use " if dic[target-x] " because it will change the size of dic.
for pair1 in dic[x]:
for pair2 in dic[target-x]:
a,b,c,d = pair1[0],pair1[1],pair2[0],pair2[1]
if len(set([a,b,c,d]))==4:
res.add(tuple(sorted([nums[a],nums[b],nums[c],nums[d]])))
return list(res)
|
dict_rhythms = {
"E(2,3)" : "A common Afro-Cuban drum pattern when started on the second onset as in [101]. For example, it is the conga rhythm of the (6/8)-time Swing Tumbao. It is common in Latin American music, as for example in the Cueca, and the coros de clave. It is common in Arabic music, as for example in the Al Taer rhythm of Nubia. It is also a rhythmic pattern of the Drum Dance of the Slavey Indians of Northern Canada",
"E(2,5)" : "A rhythm found in Greece, Namibia, Rwanda and Central Africa. It is also a 13th century Persian rhythm called Khafif-e-ramal, as well as the rhythm of the dance Makedonka from the FYROM. Tchaikovsky used it as the metric pattern in the second movement of his Symphony No. 6. Started on the second onset as in [10010] it is a rhythm found in Central Africa, Bulgaria, Turkey, Turkestan and Norway. It is also the metric pattern of Dave Brubeck's Take Five, as well as Mars from The Planets by Gustav Holst. Rotated as in [10010100100], it is a Serbian rhythmic pattern. When it is started on the fourth (last) onset it is the Daasa al kbiri rhythmic pattern of Yemen.",
"E(3,4)" : "It is the archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad. It is also a thirteenth century Persian rhythm called Khalif-e-saghil, as well as the trochoid choreic rhythmic pattern of ancient Greece.",
"E(3,5)" : "When started on the second onset, it is a thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.",
"E(3,7)" : "It is the Ruchenitza rhythm used in a Bulgarian folk-dance. It is also the metric pattern of Pink Floyd's Money.",
"E(3,8)" : "It is none other than one of the most famous rythms on the planet. In Cuba it goes by the name of the tresillo and in the USA is often called the Habanera rhythm used in hundreds of rockabilly songs during the 1950s. It can often be heard in early rock-and-roll hits in the left-hand patterns of the piano, or played on the string bass or saxophone. A good example is the bass rhythm in Elvis Presley's Hound Dog. The tresillo pattern is also found widely in West African traditional music. For example, it is played on the atoke bell in the Sohu, an Ewe dance from Ghana. The tresillo can also be recognized as the first bar of the ubiquitous two-bar clave Son given by [1001001000101000].",
"E(4,7)" : "It is a Ruchenitza Bulgarian folk-dance rhythm.",
"E(4,9)" : "It is the Aksak rhythm of Turkey. It is also the metric pattern used by Dave Brubeck in his piece Rondo a la Turk.",
"E(4,11)" : "It is the metric pattern used by Frank Zappa in his piece titled Outside Now.",
"E(4,12)" : "It is periodic with four repetitions of E(1,3) = [100]. It is the (12/8)-time Fandago clapping pattern in the Flamenco music of southern Spain, where 1 denotes a loud clap and 0 soft clap.",
"E(4,15)" : "It is the metric pattern of the pancam savari tal of North Indian music.",
"E(5,6)" : "It yields the York-Samai pattern, a popular Arabic rhythm. It is also a handclapping rhythm used in the Al Medemi songs of Oman.",
"E(5,7)" : "It is the Nawakhat pattern, a popular Arabic rhythm. In Nubia it is called the Al Noht rhythm.",
"E(5,8)" : "It is the Cuban cinquillo pattern, the Malfuf rhythmic pattern of Egypt, as well as the Korean Nong Pyon drum pattern. Started on the second onset, it is a popular Middle Eastern rhythm, as well as the Timini rhythm of Senegal, the Adzogbo dance rhythm of Benin, the Spanish Tango, the Maksum of Egypt, and a 13th century Persian rhythm, the Al-saghil-alsani. When it is started on the third onset it is the Musemmen rhythm of Turkey. When it is started on the fourth onset it is the Kromanti rhythm of Surinam.",
"E(5,9)" : "It is a popular Arabic rhythm called Agsag-Samai. Started on the second onset, it is a drum pattern used by the Venda in South Africa, as well as a Rumanian folk-dance rhythm. It is also the rhythmic pattern of the Sigaktistos rhythm of Greece, and the Samai aktsak rhythm of Turkey. Started on the third onset, it is the rhythmic pattern of the Nawahiid rhythm of Turkey.",
"E(5,11)" : "It is the metric pattern of the Savari tala used in the Hindustani music of India. It is also a rhythmic pattern used in Bulgaria and Serbia. In Bulgaria is is used in the Kopanitsa. This metric pattern has been used by Moussorgsky in Pictures at an Exhibition. Started on the third onset, it is the rhythm of the dance Kalajdzijsko Oro from the FYROM, and it appears in Bulgarian music as well.",
"E(5,12)" : "It is a common rhythm played in the Central African Republic by the Aka Pygmies. It is also the Venda clapping pattern of a South African children's song, and a rhythm pattern used in the FYROM. Started on the second onset, it is the Columbia bell pattern popular in Cuba and West Africa, as well as a drumming pattern used in the Chakacha dance of Kenya, and also used in the FYROM . Started on the third onset, it is the Bemba bell pattern used in Northern Zimbabwe, and the rhythm of the dance from the FYROM Ibraim Odza Oro. Started on the fourth onset, it is the Fume Fume bell pattern popular in West Africa, and is a rhythm used in the former Yugoslavia. Finally, when started on the fifth onset it is the Salve bell pattern used in the Dominican Republic in a rhythm called Canto de Vela in honor of the Virgin Mary, as well as the drum rhythmic pattern of the Moroccan Al Kudam.",
"E(5,13)" : "It is a rhythm from the FYROM which is also played by starting it on the fourth onset as follows: [1010010010100].",
"E(5,16)" : "It is the Bossa-Nova rhythm necklace of Brazil. The actual Bossa-Nova rhythm usually starts on the third onset as follows: [1001001000100100]. However, other starting places are also documented in world music practices, such as [1001001001000100].",
"E(6,7)" : "It is the Pontakos rhythm of Greece when started on the sixth (last) onset.",
"E(6,13)" : "It is the rhythm of the dance Mama Cone pita from the FYROM. Started on the third onset, it is the rhythm of the dance Postupano Oro from the FYROM, as well as the Krivo Plovdivsko Horo of Bulgaria.",
"E(7,8)" : "When started on the seventh (last) onset, is a typical rhythm played on the Bendir (frame drum), and used in the accompaniment of songs of the Tuareg people of Libya.",
"E(7,9)" : "It is the Bazaragana rhythmic pattern of Greece.",
"E(7,10)" : "It is the Lenk fahhte rhythmic pattern of Turkey.",
"E(7,12)" : "It is a common West African bell pattern. For example, it is used in the Mpre rhythm of the Ashanti people of Ghana. Started on the seventh (last) onset, it is a Yoruba bell pattern of Nigeria, a Babenzele pattern of Central Africa, and a Mende pattern of Sierra Leone.",
"E(7,15)" : "It is a Bulgarian rhythm when started on the third onset.",
"E(7,16)" : "It is a Samba rhythm necklace from Brazil. The actual Samba rhythm is [1010010101001010] obtained by starting E(7, 16) on the last onset, and it coincides with a rhythm from the FYROM. When E(7, 16) is started on the fifth onset it is a clapping pattern from Ghana. When it is started on the second onset it is a rhythmic pattern found in the former Yugoslavia.",
"E(7,17)" : "It is a rhythm from the FYROM when started on the second onset.",
"E(7,18)" : "It is a Bulgarian rhythmic pattern.",
"E(8,17)" : "It is a Bulgarian rhythmic pattern which is also started on the fifth onset.",
"E(8,19)" : "It is a Bulgarian rhythmic pattern when started on the second onset.",
"E(9,14)" : "When started on the second onset, it is the rhythmic pattern of the Tsofyan rhythm of Algeria.",
"E(9,16)" : "It is a rhythm necklace used in the Central African Republic. When it is started on the second onset it is a bell pattern of the Luba people of Congo. When it is started on the fourth onset it is a rhythm played in West and Central Africa, as well as a cow-bell pattern in the Brazilian samba. When it is started on the penultimate onset it is the bell pattern of the Ngbaka-Maibo rhythms of the Central African Republic.",
"E(9,22)" : "It is a Bulgarian rhythmic pattern when started on the second onset.",
"E(9,23)" : "It is a Bulgarian rhythm.",
"E(11,12)" : "When started on the second onset, is thedrum pattern of the Rahmani (a cylindrical double-headed drum) used in the Sot silam dance from Mirbat in the South of Oman.",
"E(11,24)" : "It is a rhythm necklace of the Aka Pygmies of Central Africa. It is usually started on the seventh onset. Started on the second onset, it is a Bulgarian rhythm.",
"E(13,24)" : "It is another rhythm necklace of the Aka Pygmies of the upper Sangha. Started on the penultimate onset, it is the Bobangi metal-blade pattern used by the Aka Pygmies.",
"E(15,34)" : "It is a Bulgarian rhythmic pattern when started on the penultimate onset."
}
|
def fun(a, b):
return 1
fun(1, 2)
|
# Create a program to check if an integer is a perfect square.
# 4, 9, 25 any ideas? Use Square Root
# input
num = int(input('Enter a value: '))
# processing & output
if (num ** 0.5) % 1 != 0:
print(num, 'is not a perfect square.')
else:
print(num, 'is a perfect square.')
|
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
# Copyright 2018 The AnPyLar Team. All Rights Reserved.
# Use of this source code is governed by an MIT-style license that
# can be found in the LICENSE file at http://anpylar.com/mit-license
###############################################################################
styles_css = '''
/* Master Styles */
h1 {
color: #369;
font-family: Arial, Helvetica, sans-serif;
font-size: 250%;
}
h2, h3 {
color: #444;
font-family: Arial, Helvetica, sans-serif;
font-weight: lighter;
}
body {
margin: 2em;
}
body, input[text], button {
color: #888;
font-family: Cambria, Georgia;
}
a {
cursor: pointer;
cursor: hand;
}
button {
font-family: Arial;
background-color: #eee;
border: none;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
cursor: hand;
}
button:hover {
background-color: #cfd8dc;
}
button:disabled {
background-color: #eee;
color: #aaa;
cursor: auto;
}
/* Navigation link styles */
nav a {
padding: 5px 10px;
text-decoration: none;
margin-right: 10px;
margin-top: 10px;
display: inline-block;
background-color: #eee;
border-radius: 4px;
}
nav a:visited, a:link {
color: #607D8B;
}
nav a:hover {
color: #039be5;
background-color: #CFD8DC;
}
nav a.active {
color: #039be5;
}
/* everywhere else */
* {
font-family: Arial, Helvetica, sans-serif;
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
'''
|
def Insertion_Sort(lst):
l = len(lst)
for i in range(1,l):
temp = lst[i]
j = i-1
while j>=0:
if temp[0]<lst[j][0]:
lst[j+1] = lst[j]
lst[j] = temp
j = j-1
return lst
lst = []
lst = ['Tininha', 'Dudinha','Carlinhos','Marquinhos','Joaozinho','Bruninha','Fernandinha','Rafinha','Pedrinho','Aninha','Tamirinha','Gaguinho','Zezinho','Luquinhas','Julhinha']
print(Insertion_Sort(lst))
lst_1 = ['Tininha', 'Dudinha','Carlinhos','Marquinhos','Joaozinho','Bruninha','Fernandinha','Rafinha','Pedrinho','Aninha','Tamirinha','Gaguinho','Zezinho','Luquinhas','Julhinha']
lst_1.sort() # sort() will sort it in alphabetic order
print(lst_1)
lst_1.sort(reverse = True) # sort() will sort it in alphabetic DSC order
print(lst_1)
lst_1.sort(key = len) # sort() will sort it according to length
print(lst_1)
|
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = 'D\xccZ\x0b=\xf2\xd6\x89\x1e\xeb\xa3n\xa2z\xd6n'
_lr_action_items = {'PEEK':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[244,244,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'TRANS':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[8,8,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,8,-18,-16,-81,-20,8,-19,-21,-13,-8,-15,-12,-9,-11,]),'STAR':([5,11,20,22,61,81,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,174,185,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,227,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,33,-62,-61,-60,128,-139,-138,-115,-107,-104,-137,-106,-110,-142,147,-140,-109,147,147,147,-105,-133,-130,147,241,128,147,-111,-134,-141,147,147,-116,147,147,147,147,147,147,147,147,-117,147,147,33,147,-135,-113,-136,-108,147,-137,147,147,147,-112,-102,-114,147,-103,147,]),'SLASH':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,157,-140,-109,157,157,157,-105,-133,-130,157,157,-111,-134,-141,157,157,-116,157,157,157,157,157,157,157,157,-117,157,157,157,-135,-113,-136,-108,157,-137,157,157,157,-112,-102,-114,157,-103,157,]),'FLOATNUMBER':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,-98,-82,83,83,83,83,-81,83,-88,83,-97,83,-95,-89,-94,-99,83,-90,-92,-100,-101,-93,-91,-96,]),'VOID':([0,1,2,5,7,15,45,56,62,73,120,149,161,172,178,220,229,230,233,235,237,238,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[3,3,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,3,-10,-33,-17,3,-26,3,-27,-28,-14,-82,-41,-36,-38,-40,-35,-37,3,-18,-16,-81,-20,3,-19,-21,-13,-8,-15,-12,-9,-11,]),'GLOBAL':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[4,4,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,4,-18,-16,-81,-20,4,-19,-21,-13,-8,-15,-12,-9,-11,]),'NUMBER':([54,88,89,91,98,103,105,123,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,188,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[84,84,84,84,84,84,84,182,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,260,84,84,-98,-82,84,84,84,84,-81,84,-88,84,-97,84,-95,-89,-94,-99,84,-90,-92,-100,-101,-93,-91,-96,]),',':([5,20,22,32,44,45,46,48,49,55,58,59,60,61,63,64,65,68,75,77,78,81,83,84,87,93,94,96,97,99,100,102,116,120,121,126,127,130,132,135,136,140,142,160,163,164,171,180,181,182,189,191,194,197,199,200,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,243,259,260,261,264,266,269,271,275,282,284,288,306,309,324,328,329,332,333,335,336,341,357,359,362,363,],[-70,-62,-61,51,51,-65,67,71,51,51,51,51,51,-60,51,51,114,119,-80,124,125,129,-139,-138,-115,-107,-104,-137,-106,-110,-142,-140,174,-64,177,51,-51,51,-109,-132,-131,-105,-133,-130,51,51,232,-78,-77,-79,-52,129,-142,265,-111,268,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,51,-56,-54,-55,-135,-113,-136,-108,51,51,318,51,-53,334,345,348,349,352,-112,-102,-114,51,51,367,370,-103,]),'GT':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,155,-140,-109,155,155,155,-105,-133,-130,155,155,-111,-134,-141,155,-129,-116,155,155,-122,-123,-119,-120,-121,-118,-117,-128,155,155,-135,-113,-136,-108,155,-137,155,155,155,-112,-102,-114,155,-103,155,]),'NEW':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,-98,-82,86,86,86,86,-81,86,-88,86,-97,86,-95,-89,-94,-99,86,-90,-92,-100,-101,-93,-91,-96,]),'RIGHTSHIFT':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,158,-140,-109,158,158,158,-105,-133,-130,158,158,-111,-134,-141,158,-129,-116,158,158,158,158,-119,158,158,-118,-117,-128,158,158,-135,-113,-136,-108,158,-137,158,158,158,-112,-102,-114,158,-103,158,]),'CHECK_NEXT_CYCLE':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[247,247,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'DOT':([5,20,22,61,83,84,87,93,94,96,97,99,100,102,132,140,199,201,205,264,266,269,271,309,333,335,336,363,],[-70,-62,-61,-60,-139,-138,134,-107,-104,-137,-106,-110,-142,-140,-109,-105,-111,-134,-141,-135,-113,-136,-108,-137,-112,-102,-114,-103,]),'LEFTSHIFT':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,146,-140,-109,146,146,146,-105,-133,-130,146,146,-111,-134,-141,146,-129,-116,146,146,146,146,-119,146,146,-118,-117,-128,146,146,-135,-113,-136,-108,146,-137,146,146,146,-112,-102,-114,146,-103,146,]),'INCR':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,-98,-82,89,89,89,89,-81,89,-88,89,-97,89,-95,-89,-94,-99,89,-90,-92,-100,-101,-93,-91,-96,]),'LE':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,151,-140,-109,151,151,151,-105,-133,-130,151,151,-111,-134,-141,151,-129,-116,151,151,-122,-123,-119,-120,-121,-118,-117,-128,151,151,-135,-113,-136,-108,151,-137,151,151,151,-112,-102,-114,151,-103,151,]),'SEMI':([5,20,22,32,34,40,50,52,55,61,68,75,76,77,83,84,87,93,94,96,97,99,100,101,102,104,126,130,132,135,136,140,142,160,162,163,164,168,180,181,182,183,187,193,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,254,264,266,269,271,275,282,295,312,323,326,331,333,335,336,341,347,355,363,368,380,],[-70,-62,-61,-2,56,62,73,-74,-2,-60,117,-80,-73,-76,-139,-138,-115,-107,-104,-137,-106,-110,-142,149,-140,161,-2,-2,-109,-132,-131,-105,-133,-130,220,-2,-2,229,-78,-77,-79,-75,258,263,-111,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,273,274,303,-135,-113,-136,-108,-2,-2,325,337,344,346,351,-112,-102,-114,-2,358,364,-103,374,382,]),'STATIC_CAST':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,-98,-82,90,90,90,90,-81,90,-88,90,-97,90,-95,-89,-94,-99,90,-90,-92,-100,-101,-93,-91,-96,]),')':([5,20,22,44,45,49,52,53,57,58,59,60,61,63,64,66,72,75,76,77,78,79,80,81,82,83,84,87,93,94,96,97,99,100,102,106,107,108,109,111,112,113,116,120,125,127,129,132,135,136,138,140,142,143,160,180,181,182,183,184,186,189,190,191,192,194,195,196,197,199,201,202,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,240,241,242,243,259,260,261,264,265,266,267,269,270,271,288,293,297,306,307,308,309,310,311,321,327,330,333,335,336,353,357,359,360,363,365,373,377,],[-70,-62,-61,-2,-65,-2,-74,-2,-2,-2,110,-2,-60,-2,-2,115,122,-80,-73,-76,-49,126,-50,-58,130,-139,-138,-115,-107,-104,-137,-106,-110,-142,-140,163,164,165,166,168,169,170,173,-64,-2,-51,-2,-109,-132,-131,201,-105,-133,-2,-130,-78,-77,-79,-75,-48,-50,-52,-57,-58,-59,-142,264,-87,-86,-111,-134,269,271,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,-71,-72,292,-2,-56,-54,-55,-135,-2,-113,-2,-136,-2,-108,-2,323,326,-53,-85,333,-137,335,336,342,347,350,-112,-102,-114,363,-2,366,368,-103,371,379,380,]),'(':([4,5,8,9,10,17,18,19,23,24,26,32,35,54,85,88,89,90,91,92,98,100,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,199,203,244,245,247,248,249,250,251,252,253,255,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[28,-70,29,30,31,36,37,38,41,42,43,53,57,91,131,91,91,137,91,139,91,143,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,267,270,294,91,297,298,299,91,-98,301,302,305,-82,91,91,91,91,-81,91,-88,91,-97,91,-95,-89,-94,-99,91,-90,-92,-100,-101,-93,-91,-96,]),'IS_INVALID':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,-98,-82,92,92,92,92,-81,92,-88,92,-97,92,-95,-89,-94,-99,92,-90,-92,-100,-101,-93,-91,-96,]),'NE':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,148,-140,-109,148,148,148,-105,-133,-130,148,148,-111,-134,-141,148,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,148,148,-135,-113,-136,-108,148,-137,148,148,148,-112,-102,-114,148,-103,148,]),'OUT_PORT':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[9,9,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,9,-18,-16,-81,-20,9,-19,-21,-13,-8,-15,-12,-9,-11,]),'ENQUEUE':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[249,249,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'LT':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,154,-140,-109,154,154,154,-105,-133,-130,154,154,-111,-134,-141,154,-129,-116,154,154,-122,-123,-119,-120,-121,-118,-117,-128,154,154,-135,-113,-136,-108,154,-137,154,154,154,-112,-102,-114,154,-103,154,]),'DOUBLE_COLON':([5,20,22,61,95,100,],[-70,39,-61,-60,141,-61,]),'PLUS':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,156,-140,-109,156,156,156,-105,-133,-130,156,156,-111,-134,-141,156,156,-116,156,156,156,156,-119,156,156,-118,-117,156,156,156,-135,-113,-136,-108,156,-137,156,156,156,-112,-102,-114,156,-103,156,]),'DECR':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,-98,-82,88,88,88,88,-81,88,-88,88,-97,88,-95,-89,-94,-99,88,-90,-92,-100,-101,-93,-91,-96,]),'ACTION':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[10,10,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,10,-18,-16,-81,-20,10,-19,-21,-13,-8,-15,-12,-9,-11,]),':':([5,100,110,166,340,],[-70,144,167,224,144,]),'=':([5,74,],[-70,123,]),'ASSIGN':([5,20,22,32,55,61,83,84,87,93,94,96,97,99,100,102,127,132,135,136,140,142,160,189,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,282,333,335,336,363,],[-70,-62,-61,54,105,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,-140,188,-109,-132,-131,-105,-133,-130,262,-111,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,304,-135,-113,-136,-108,54,-112,-102,-114,-103,]),'$end':([0,1,2,5,6,7,12,13,15,25,27,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,289,291,296,313,317,319,322,339,343,344,354,356,],[-2,-2,-29,-70,0,-34,-5,-3,-39,-1,-4,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,-18,-16,-81,-20,-19,-21,-13,-8,-15,-12,-9,-11,]),'IDENT':([0,1,2,3,5,7,11,15,16,20,22,28,29,30,31,33,36,37,38,39,41,42,43,45,47,51,53,54,56,57,61,62,67,68,71,73,81,86,88,89,91,95,98,100,103,105,114,117,119,120,123,124,125,128,129,131,133,134,137,139,141,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,161,167,172,173,174,177,178,179,185,220,223,224,225,227,229,230,231,232,233,235,237,238,239,245,250,251,256,257,258,263,265,267,268,270,272,273,274,277,281,286,289,291,292,294,296,298,299,301,302,303,304,305,313,315,317,318,319,322,325,334,337,339,343,344,345,346,348,349,351,354,356,358,361,364,367,372,374,375,376,378,381,382,],[5,5,-29,-63,-70,-34,5,-39,5,-62,-61,5,5,5,5,5,5,5,5,5,5,5,5,-65,5,5,5,5,-6,5,-60,-7,5,5,5,-30,5,5,5,5,5,5,5,-61,5,5,5,5,5,-64,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,-32,5,5,5,5,5,5,5,5,5,5,-31,5,5,5,5,5,-10,5,5,-33,5,5,5,5,-17,5,5,5,-26,5,-27,-28,5,5,5,-98,-82,-41,-36,-38,5,5,5,5,-40,-35,-37,5,5,5,-18,-16,5,5,-81,5,5,5,5,-88,5,5,-20,5,-19,5,-21,5,-97,5,-44,-8,-15,-12,5,-95,5,5,-89,-9,-11,-94,-99,-47,5,-90,-92,-100,-101,-93,-91,-96,]),'PROTOCOL':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[14,14,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,14,-18,-16,-81,-20,14,-19,-21,-13,-8,-15,-12,-9,-11,]),'STRING':([14,21,51,54,88,89,91,98,103,105,123,124,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,188,245,250,251,256,262,265,267,268,270,296,302,303,304,325,334,346,351,352,358,361,367,370,372,374,375,376,378,381,382,],[34,40,75,96,96,96,96,96,96,96,181,75,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,259,96,96,-98,-82,306,96,96,309,96,-81,96,-88,96,-97,96,-95,-89,362,-94,-99,96,377,-90,-92,-100,-101,-93,-91,-96,]),'STALL_AND_WAIT':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[252,252,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'OOD':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,-98,-82,99,99,99,99,-81,99,-88,99,-97,99,-95,-89,-94,-99,99,-90,-92,-100,-101,-93,-91,-96,]),'ENUM':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[17,17,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,17,-18,-16,-81,-20,17,-19,-21,-13,-8,-15,-12,-9,-11,]),'ELSE':([256,296,361,],[-82,-81,369,]),'MACHINE':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[18,18,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,18,-18,-16,-81,-20,18,-19,-21,-13,-8,-15,-12,-9,-11,]),'GE':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,152,-140,-109,152,152,152,-105,-133,-130,152,152,-111,-134,-141,152,-129,-116,152,152,-122,-123,-119,-120,-121,-118,-117,-128,152,152,-135,-113,-136,-108,152,-137,152,152,152,-112,-102,-114,152,-103,152,]),'EXTERN_TYPE':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[19,19,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,19,-18,-16,-81,-20,19,-19,-21,-13,-8,-15,-12,-9,-11,]),'[':([5,20,22,61,83,84,87,93,94,96,97,99,100,102,132,140,199,201,205,264,266,269,271,309,333,335,336,363,],[-70,-62,-61,-60,-139,-138,133,-107,-104,-137,-106,-110,-142,-140,-109,-105,-111,-134,-141,-135,-113,-136,-108,-137,-112,-102,-114,-103,]),'INCLUDE':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[21,21,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,21,-18,-16,-81,-20,21,-19,-21,-13,-8,-15,-12,-9,-11,]),']':([5,20,22,61,83,84,87,93,94,96,97,99,100,102,132,133,135,136,140,142,160,196,197,198,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,264,265,266,269,271,307,333,335,336,363,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,-140,-109,-2,-132,-131,-105,-133,-130,-87,-86,266,-111,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,-135,-2,-113,-136,-108,-85,-112,-102,-114,-103,]),'IF':([179,250,251,256,296,303,325,346,351,358,361,369,372,374,375,376,378,381,382,],[253,253,-98,-82,-81,-88,-97,-95,-89,-94,-99,253,-90,-92,-100,-101,-93,-91,-96,]),'AND':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,145,-140,-109,145,145,145,-105,-133,-130,145,145,-111,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,145,-135,-113,-136,-108,145,-137,145,145,145,-112,-102,-114,145,-103,145,]),'DASH':([5,20,22,54,61,83,84,87,88,89,91,93,94,96,97,98,99,100,101,102,103,105,132,133,135,136,138,140,142,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,160,162,179,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,245,250,251,254,256,264,265,266,267,268,269,270,271,295,296,302,303,304,309,310,325,330,331,333,334,335,336,346,351,353,358,361,363,367,372,373,374,375,376,378,381,382,],[-70,-62,-61,98,-60,-139,-138,-115,98,98,98,-107,-104,-137,-106,98,-110,-142,153,-140,98,98,-109,98,153,153,153,-105,-133,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,-130,153,98,153,-111,-134,-141,153,153,-116,153,153,153,153,-119,153,153,-118,-117,153,153,98,98,-98,153,-82,-135,98,-113,98,98,-136,98,-108,153,-81,98,-88,98,-137,153,-97,153,153,-112,98,-102,-114,-95,-89,153,-94,-99,-103,98,-90,153,-92,-100,-101,-93,-91,-96,]),'RETURN':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[245,245,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'EQ':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,150,-140,-109,150,150,150,-105,-133,-130,150,150,-111,-134,-141,150,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,150,150,-135,-113,-136,-108,150,-137,150,150,150,-112,-102,-114,150,-103,150,]),'STRUCT':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[23,23,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,23,-18,-16,-81,-20,23,-19,-21,-13,-8,-15,-12,-9,-11,]),'CHECK_STOP_SLOTS':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[255,255,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'STATE_DECL':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[24,24,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,24,-18,-16,-81,-20,24,-19,-21,-13,-8,-15,-12,-9,-11,]),'CHECK_ALLOCATE':([179,250,251,256,296,303,325,346,351,358,361,372,374,375,376,378,381,382,],[248,248,-98,-82,-81,-88,-97,-95,-89,-94,-99,-90,-92,-100,-101,-93,-91,-96,]),'LIT_BOOL':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,188,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,261,102,102,-98,-82,102,102,102,102,-81,102,-88,102,-97,102,-95,-89,-94,-99,102,-90,-92,-100,-101,-93,-91,-96,]),'IS_VALID':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,-98,-82,85,85,85,85,-81,85,-88,85,-97,85,-95,-89,-94,-99,85,-90,-92,-100,-101,-93,-91,-96,]),'NOT':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,251,256,265,267,268,270,296,302,303,304,325,334,346,351,358,361,367,372,374,375,376,378,381,382,],[103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,-98,-82,103,103,103,103,-81,103,-88,103,-97,103,-95,-89,-94,-99,103,-90,-92,-100,-101,-93,-91,-96,]),'{':([5,29,37,45,52,67,73,75,76,77,115,120,122,126,149,161,163,165,167,169,170,173,180,181,182,183,187,220,221,224,225,226,228,239,279,280,292,322,342,350,366,369,371,379,],[-70,47,47,-65,-74,47,-30,-80,-73,-76,172,-64,179,-2,-32,-31,-2,223,-2,230,231,47,-78,-77,-79,-75,179,-33,179,-2,-2,281,-23,47,315,-22,47,47,179,179,179,179,179,179,]),'}':([1,2,5,7,12,13,15,27,45,47,56,62,68,69,70,73,117,118,119,120,149,161,172,175,176,178,179,220,223,229,230,231,233,234,235,236,237,238,239,246,250,251,256,257,258,263,272,273,274,276,277,278,281,283,285,286,287,289,290,291,296,300,303,313,314,315,316,317,319,320,322,325,337,338,339,343,344,346,351,354,356,358,361,364,372,374,375,376,378,381,382,],[-2,-29,-70,-34,-5,-3,-39,-4,-65,-2,-6,-7,-2,120,-69,-30,-2,-68,-2,-64,-32,-31,-2,-66,-67,-10,256,-33,-2,-17,-2,-2,-26,289,-2,-25,-27,-28,-14,296,-84,-98,-82,-41,-36,-38,-40,-35,-37,313,-2,-43,-2,317,319,-2,-46,-18,-24,-16,-81,-83,-88,-20,-42,-2,339,-19,-21,-45,-13,-97,-44,354,-8,-15,-12,-95,-89,-9,-11,-94,-99,-47,-90,-92,-100,-101,-93,-91,-96,]),'OR':([5,20,22,61,83,84,87,93,94,96,97,99,100,101,102,132,135,136,138,140,142,160,162,197,199,201,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,264,266,269,271,295,309,310,330,331,333,335,336,353,363,373,],[-70,-62,-61,-60,-139,-138,-115,-107,-104,-137,-106,-110,-142,159,-140,-109,159,159,159,-105,-133,-130,159,159,-111,-134,-141,-126,-129,-116,-125,-124,-122,-123,-119,-120,-121,-118,-117,-128,-127,159,-135,-113,-136,-108,159,-137,159,159,159,-112,-102,-114,159,-103,159,]),'IN_PORT':([0,1,2,5,7,15,45,56,62,73,120,149,161,178,220,229,239,256,257,258,263,272,273,274,281,289,291,296,313,315,317,319,322,339,343,344,354,356,],[26,26,-29,-70,-34,-39,-65,-6,-7,-30,-64,-32,-31,-10,-33,-17,-14,-82,-41,-36,-38,-40,-35,-37,26,-18,-16,-81,-20,26,-19,-21,-13,-8,-15,-12,-9,-11,]),}
_lr_action = { }
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = { }
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'decl':([0,1,281,315,],[1,1,1,1,]),'obj_decl':([0,1,167,172,224,225,230,235,281,315,],[2,2,225,233,225,225,233,233,2,2,]),'statements':([122,187,221,342,350,366,369,371,379,],[178,257,272,356,361,372,375,378,381,]),'type_enums':([223,277,],[276,314,]),'pairsx':([51,124,],[76,183,]),'type_members':([172,230,235,],[234,283,290,]),'ident_or_star':([174,],[242,]),'statements_inner':([179,250,],[246,300,]),'enumeration':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,265,267,268,270,302,304,318,334,367,],[93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,341,93,93,]),'file':([0,],[6,]),'type_state':([231,286,],[286,286,]),'type_member':([172,230,235,],[235,235,235,]),'aexpr':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,265,267,268,270,302,304,334,367,],[87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,]),'param':([53,57,125,],[78,78,78,]),'literal':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,265,267,268,270,302,304,334,367,],[97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,]),'params':([53,57,125,],[79,106,184,]),'statement':([179,250,],[250,250,]),'var':([54,88,89,91,98,103,105,131,133,139,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,177,179,232,245,250,265,267,268,270,294,298,299,301,302,304,305,334,349,367,],[94,94,94,94,94,94,94,195,94,202,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,243,94,288,94,94,94,94,94,94,324,327,328,329,94,94,332,94,360,94,]),'if_statement':([179,250,369,],[251,251,376,]),'type':([0,1,28,36,38,41,42,53,54,57,71,86,88,89,91,98,103,105,114,125,129,133,137,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,167,172,179,224,225,230,235,245,250,265,267,268,270,281,302,304,315,334,345,348,367,],[11,11,44,58,60,63,64,81,95,81,121,132,95,95,95,95,95,95,171,185,191,95,200,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,227,11,95,227,227,11,11,95,95,95,95,95,95,11,95,95,11,95,357,359,95,]),'empty':([0,1,32,44,47,49,53,55,57,58,59,60,63,64,68,117,119,125,126,129,130,133,143,163,164,167,172,223,224,225,230,231,235,243,265,267,270,275,277,281,282,286,288,315,341,357,],[12,12,52,52,70,52,80,52,80,52,52,52,52,52,70,70,70,186,52,192,52,196,196,52,52,228,236,278,228,228,236,287,236,52,196,196,196,52,278,12,52,287,52,12,52,52,]),'declsx':([0,1,281,315,],[13,27,13,13,]),'func_decl':([0,1,172,230,235,281,315,],[7,7,237,237,237,7,7,]),'func_def':([0,1,172,230,235,281,315,],[15,15,238,238,238,15,15,]),'idents':([29,37,67,173,239,292,322,],[46,59,116,239,291,322,343,]),'void':([0,1,172,230,235,281,315,],[16,16,16,16,16,16,16,]),'identx':([47,68,117,119,],[69,118,175,176,]),'type_states':([231,286,],[285,320,]),'pair':([51,124,],[77,77,]),'type_enum':([223,277,],[277,277,]),'typestr':([0,1,28,36,38,41,42,53,54,57,71,86,88,89,91,98,103,105,114,125,129,133,137,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,167,172,179,224,225,230,235,245,250,265,267,268,270,281,302,304,315,334,345,348,367,],[20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,]),'types':([53,57,129,],[82,107,190,]),'pairs':([32,44,49,55,58,59,60,63,64,126,130,163,164,243,275,282,288,341,357,],[50,66,72,104,108,109,111,112,113,187,193,221,222,293,312,50,321,355,365,]),'ident':([0,1,11,16,28,29,30,31,33,36,37,38,39,41,42,43,47,51,53,54,57,67,68,71,81,86,88,89,91,95,98,103,105,114,117,119,123,124,125,128,129,131,133,134,137,139,141,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,167,172,173,174,177,179,185,223,224,225,227,230,231,232,235,239,245,250,265,267,268,270,277,281,286,292,294,298,299,301,302,304,305,315,318,322,334,345,348,349,367,],[22,22,32,35,22,45,48,49,55,22,45,22,61,22,22,65,68,74,22,100,22,45,68,22,127,22,100,100,100,140,100,100,100,22,68,68,180,74,22,189,22,194,100,199,22,194,203,100,205,100,100,100,100,100,100,100,100,100,100,100,100,100,100,22,22,45,240,194,100,127,275,22,22,282,22,284,194,22,45,100,100,100,100,100,100,275,22,284,45,194,194,194,194,100,100,194,22,340,45,100,22,22,194,100,]),'obj_decls':([167,224,225,],[226,279,280,]),'expr':([54,88,89,91,98,103,105,133,143,145,146,147,148,150,151,152,153,154,155,156,157,158,159,179,245,250,265,267,268,270,302,304,334,367,],[101,135,136,138,142,160,162,197,197,206,207,208,209,210,211,212,213,214,215,216,217,218,219,254,295,254,197,197,310,197,330,331,353,373,]),'exprs':([133,143,265,267,270,],[198,204,307,308,311,]),'decls':([0,281,315,],[25,316,338,]),}
_lr_goto = { }
for _k, _v in _lr_goto_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_goto: _lr_goto[_x] = { }
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> file","S'",1,None,None,None),
('file -> decls','file',1,'p_file','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',219),
('empty -> <empty>','empty',0,'p_empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',223),
('decls -> declsx','decls',1,'p_decls','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',226),
('declsx -> decl declsx','declsx',2,'p_declsx__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',230),
('declsx -> empty','declsx',1,'p_declsx__none','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',240),
('decl -> PROTOCOL STRING SEMI','decl',3,'p_decl__protocol','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',244),
('decl -> INCLUDE STRING SEMI','decl',3,'p_decl__include','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',253),
('decl -> MACHINE ( idents ) : obj_decls { decls }','decl',9,'p_decl__machine0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',262),
('decl -> MACHINE ( idents pairs ) : obj_decls { decls }','decl',10,'p_decl__machine1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',266),
('decl -> ACTION ( ident pairs ) statements','decl',6,'p_decl__action','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',270),
('decl -> IN_PORT ( ident , type , var pairs ) statements','decl',10,'p_decl__in_port','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',274),
('decl -> OUT_PORT ( ident , type , var pairs ) SEMI','decl',10,'p_decl__out_port','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',278),
('decl -> TRANS ( idents , idents , ident_or_star ) idents','decl',9,'p_decl__trans0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',282),
('decl -> TRANS ( idents , idents ) idents','decl',7,'p_decl__trans1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',286),
('decl -> TRANS ( idents , idents , ident_or_star ) idents idents','decl',10,'p_decl__trans2','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',290),
('decl -> TRANS ( idents , idents ) idents idents','decl',8,'p_decl__trans3','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',294),
('decl -> EXTERN_TYPE ( type pairs ) SEMI','decl',6,'p_decl__extern0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',298),
('decl -> GLOBAL ( type pairs ) { type_members }','decl',8,'p_decl__global','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',303),
('decl -> STRUCT ( type pairs ) { type_members }','decl',8,'p_decl__struct','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',308),
('decl -> ENUM ( type pairs ) { type_enums }','decl',8,'p_decl__enum','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',312),
('decl -> STATE_DECL ( type pairs ) { type_states }','decl',8,'p_decl__state_decl','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',317),
('obj_decls -> obj_decl obj_decls','obj_decls',2,'p_obj_decls__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',324),
('obj_decls -> empty','obj_decls',1,'p_obj_decls__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',328),
('type_members -> type_member type_members','type_members',2,'p_type_members__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',332),
('type_members -> empty','type_members',1,'p_type_members__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',336),
('type_member -> obj_decl','type_member',1,'p_type_member__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',340),
('type_member -> func_decl','type_member',1,'p_type_member__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',341),
('type_member -> func_def','type_member',1,'p_type_member__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',342),
('decl -> obj_decl','decl',1,'p_decl__obj_decl','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',347),
('obj_decl -> type ident pairs SEMI','obj_decl',4,'p_obj_decl__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',351),
('obj_decl -> type STAR ident pairs SEMI','obj_decl',5,'p_obj_decl__1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',355),
('obj_decl -> type ident ASSIGN expr SEMI','obj_decl',5,'p_obj_decl__2','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',359),
('obj_decl -> type STAR ident ASSIGN expr SEMI','obj_decl',6,'p_obj_decl__3','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',364),
('decl -> func_decl','decl',1,'p_decl__func_decl','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',370),
('func_decl -> void ident ( params ) pairs SEMI','func_decl',7,'p_func_decl__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',374),
('func_decl -> type ident ( params ) pairs SEMI','func_decl',7,'p_func_decl__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',375),
('func_decl -> void ident ( types ) pairs SEMI','func_decl',7,'p_func_decl__1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',379),
('func_decl -> type ident ( types ) pairs SEMI','func_decl',7,'p_func_decl__1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',380),
('decl -> func_def','decl',1,'p_decl__func_def','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',384),
('func_def -> void ident ( params ) pairs statements','func_def',7,'p_func_def__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',388),
('func_def -> type ident ( params ) pairs statements','func_def',7,'p_func_def__0','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',389),
('type_enums -> type_enum type_enums','type_enums',2,'p_type_enums__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',394),
('type_enums -> empty','type_enums',1,'p_type_enums__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',398),
('type_enum -> ident pairs SEMI','type_enum',3,'p_type_enum','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',402),
('type_states -> type_state type_states','type_states',2,'p_type_states__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',407),
('type_states -> empty','type_states',1,'p_type_states__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',411),
('type_state -> ident , enumeration pairs SEMI','type_state',5,'p_type_state','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',415),
('params -> param , params','params',3,'p_params__many','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',420),
('params -> param','params',1,'p_params__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',424),
('params -> empty','params',1,'p_params__none','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',428),
('param -> type ident','param',2,'p_param','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',432),
('param -> type STAR ident','param',3,'p_param__pointer','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',436),
('param -> type STAR ident ASSIGN STRING','param',5,'p_param__pointer_default','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',440),
('param -> type ident ASSIGN NUMBER','param',4,'p_param__default_number','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',444),
('param -> type ident ASSIGN LIT_BOOL','param',4,'p_param__default_bool','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',448),
('param -> type ident ASSIGN STRING','param',4,'p_param__default_string','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',452),
('types -> type , types','types',3,'p_types__multiple','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',457),
('types -> type','types',1,'p_types__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',461),
('types -> empty','types',1,'p_types__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',465),
('typestr -> typestr DOUBLE_COLON ident','typestr',3,'p_typestr__multi','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',469),
('typestr -> ident','typestr',1,'p_typestr__single','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',473),
('type -> typestr','type',1,'p_type__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',477),
('void -> VOID','void',1,'p_void','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',481),
('idents -> { identx }','idents',3,'p_idents__braced','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',486),
('idents -> ident','idents',1,'p_idents__bare','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',490),
('identx -> ident SEMI identx','identx',3,'p_identx__multiple_1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',494),
('identx -> ident , identx','identx',3,'p_identx__multiple_1','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',495),
('identx -> ident identx','identx',2,'p_identx__multiple_2','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',499),
('identx -> empty','identx',1,'p_identx__single','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',503),
('ident -> IDENT','ident',1,'p_ident','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',507),
('ident_or_star -> ident','ident_or_star',1,'p_ident_or_star','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',511),
('ident_or_star -> STAR','ident_or_star',1,'p_ident_or_star','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',512),
('pairs -> , pairsx','pairs',2,'p_pairs__list','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',517),
('pairs -> empty','pairs',1,'p_pairs__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',521),
('pairsx -> pair , pairsx','pairsx',3,'p_pairsx__many','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',525),
('pairsx -> pair','pairsx',1,'p_pairsx__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',530),
('pair -> ident = STRING','pair',3,'p_pair__assign','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',535),
('pair -> ident = ident','pair',3,'p_pair__assign','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',536),
('pair -> ident = NUMBER','pair',3,'p_pair__assign','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',537),
('pair -> STRING','pair',1,'p_pair__literal','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',541),
('statements -> { statements_inner }','statements',3,'p_statements__inner','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',546),
('statements -> { }','statements',2,'p_statements__none','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',550),
('statements_inner -> statement statements_inner','statements_inner',2,'p_statements_inner__many','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',554),
('statements_inner -> statement','statements_inner',1,'p_statements_inner__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',558),
('exprs -> expr , exprs','exprs',3,'p_exprs__multiple','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',562),
('exprs -> expr','exprs',1,'p_exprs__one','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',566),
('exprs -> empty','exprs',1,'p_exprs__empty','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',570),
('statement -> expr SEMI','statement',2,'p_statement__expression','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',574),
('statement -> expr ASSIGN expr SEMI','statement',4,'p_statement__assign','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',578),
('statement -> ENQUEUE ( var , type ) statements','statement',7,'p_statement__enqueue','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',582),
('statement -> ENQUEUE ( var , type , expr ) statements','statement',9,'p_statement__enqueue_latency','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',586),
('statement -> STALL_AND_WAIT ( var , var ) SEMI','statement',7,'p_statement__stall_and_wait','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',590),
('statement -> PEEK ( var , type pairs ) statements','statement',8,'p_statement__peek','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',594),
('statement -> CHECK_ALLOCATE ( var ) SEMI','statement',5,'p_statement__check_allocate','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',598),
('statement -> CHECK_NEXT_CYCLE ( ) SEMI','statement',4,'p_statement__check_next_cycle','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',602),
('statement -> CHECK_STOP_SLOTS ( var , STRING , STRING ) SEMI','statement',9,'p_statement__check_stop','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',606),
('statement -> RETURN expr SEMI','statement',3,'p_statement__return','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',610),
('statement -> if_statement','statement',1,'p_statement__if','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',614),
('if_statement -> IF ( expr ) statements','if_statement',5,'p_if_statement__if','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',618),
('if_statement -> IF ( expr ) statements ELSE statements','if_statement',7,'p_if_statement__if_else','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',622),
('if_statement -> IF ( expr ) statements ELSE if_statement','if_statement',7,'p_statement__if_else_if','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',626),
('aexpr -> STATIC_CAST ( type , expr )','aexpr',6,'p_expr__static_cast','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',631),
('aexpr -> STATIC_CAST ( type , STRING , expr )','aexpr',8,'p_expr__static_cast_ptr','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',635),
('aexpr -> var','aexpr',1,'p_expr__var','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',639),
('aexpr -> type ident','aexpr',2,'p_expr__localvar','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',643),
('aexpr -> literal','aexpr',1,'p_expr__literal','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',647),
('aexpr -> enumeration','aexpr',1,'p_expr__enumeration','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',651),
('aexpr -> ident ( exprs )','aexpr',4,'p_expr__func_call','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',655),
('aexpr -> NEW type','aexpr',2,'p_expr__new','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',659),
('aexpr -> OOD','aexpr',1,'p_expr__null','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',663),
('aexpr -> aexpr DOT ident','aexpr',3,'p_expr__member','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',667),
('aexpr -> aexpr DOT ident ( exprs )','aexpr',6,'p_expr__member_method_call','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',671),
('aexpr -> aexpr [ exprs ]','aexpr',4,'p_expr__member_method_call_lookup','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',675),
('aexpr -> type DOUBLE_COLON ident ( exprs )','aexpr',6,'p_expr__class_method_call','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',679),
('expr -> aexpr','expr',1,'p_expr__aexpr','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',683),
('expr -> expr STAR expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',687),
('expr -> expr SLASH expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',688),
('expr -> expr PLUS expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',689),
('expr -> expr DASH expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',690),
('expr -> expr LT expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',691),
('expr -> expr GT expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',692),
('expr -> expr LE expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',693),
('expr -> expr GE expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',694),
('expr -> expr EQ expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',695),
('expr -> expr NE expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',696),
('expr -> expr AND expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',697),
('expr -> expr OR expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',698),
('expr -> expr RIGHTSHIFT expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',699),
('expr -> expr LEFTSHIFT expr','expr',3,'p_expr__binary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',700),
('expr -> NOT expr','expr',2,'p_expr__unary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',705),
('expr -> INCR expr','expr',2,'p_expr__unary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',706),
('expr -> DECR expr','expr',2,'p_expr__unary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',707),
('expr -> DASH expr','expr',2,'p_expr__unary_op','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',708),
('aexpr -> ( expr )','aexpr',3,'p_expr__parens','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',712),
('aexpr -> IS_VALID ( var )','aexpr',4,'p_expr__is_valid_ptr','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',716),
('aexpr -> IS_INVALID ( var )','aexpr',4,'p_expr__is_invalid_ptr','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',720),
('literal -> STRING','literal',1,'p_literal__string','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',724),
('literal -> NUMBER','literal',1,'p_literal__number','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',728),
('literal -> FLOATNUMBER','literal',1,'p_literal__float','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',732),
('literal -> LIT_BOOL','literal',1,'p_literal__bool','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',736),
('enumeration -> ident : ident','enumeration',3,'p_enumeration','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',740),
('var -> ident','var',1,'p_var','/users/alian/simulators/pdgem5/src/mem/slicc/parser.py',744),
]
|
def hoopCount(n):
if n > 9:
return "Great, now move on to tricks"
else:
return "Keep at it until you get it"
|
#
# PySNMP MIB module Dell-LAN-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Dell-LAN-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:56:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
dellLan, dellLanCommon = mibBuilder.importSymbols("Dell-Vendor-MIB", "dellLan", "dellLanCommon")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ObjectIdentity, Gauge32, Unsigned32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, MibIdentifier, Bits, Counter32, Counter64, NotificationType, Integer32, iso, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Gauge32", "Unsigned32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "MibIdentifier", "Bits", "Counter32", "Counter64", "NotificationType", "Integer32", "iso", "ModuleIdentity")
DisplayString, DateAndTime, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "DateAndTime", "TextualConvention")
dellAlarmGroup = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1))
if mibBuilder.loadTexts: dellAlarmGroup.setLastUpdated('200504260000Z')
if mibBuilder.loadTexts: dellAlarmGroup.setOrganization('Dell.')
if mibBuilder.loadTexts: dellAlarmGroup.setContactInfo(' ')
if mibBuilder.loadTexts: dellAlarmGroup.setDescription(' ')
dellTrapInfo = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellTrapInfo.setStatus('current')
if mibBuilder.loadTexts: dellTrapInfo.setDescription('This text string may be used to provide additional information regarding the trap being sent. Any specific formatting information is given in the trap definition.')
dellTrapSeverity = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("clear", 0), ("info", 1), ("minor", 2), ("major", 3), ("critical", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellTrapSeverity.setStatus('current')
if mibBuilder.loadTexts: dellTrapSeverity.setDescription('The severity type of the enterprise-specific trap sent to the Network Management Station by the Dell managed device. The Severity level are defined as follows: Critical - service affecting event. Major - a major error which is not service affecting but does require immediate user attention to prevent further degredation of the system, which may lead to a critical error. For example, if a redundant port failure would be considered a major event whereas the failure of an unprotected port is a critical event. Minor - a minor event which is not service affecting and is unlikely to lead to a major or critical event. The user does not need to take immediate actions but some action is required to clear the event. Info - a notification to the user of some event that does not require any user action. For example, a security notification is useful information but does not require the user to take any specific immediate action. This event is not cleared. Clear - this special trap is sent to clear some previously sent trap. Note that if the sequence number sent with the clear event is 0 then the clear event is used to indicate that all outstanding event of this particular type on a given source (dellTrapSource) has been cleared. If the event sequence number (dellTrapSeqNum) is sent with a non-zero value, then the clear event is sent to clear only the specific trap instance designated by the sequence number in question.')
dellTrapSource = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellTrapSource.setStatus('current')
if mibBuilder.loadTexts: dellTrapSource.setDescription("The trap source is a string identifying the component of the device generating the trap. The source identifies the component associated with the fault. This may for example, identify the unit, slot, port, and possibly logical ports (VLAN, LAG) from which the fault occurs. The format of the source string is: 'TYPE=#:TYPE=#:...' where the TYPE may be one of 'unit' or 'slot' or 'port' or 'VLAN' or 'LAG'. For example: 'unit=3:slot=1:port=2' - indicates the trap comes from port 2 in slot 1 of the switch #3 in the stack. 'unit=2:VLAN=10' - indicates the trap comes from VLAN=10 in unit 2. 'unit=1' - indicates the trap comes from unit 1.")
dellTrapSeqNum = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellTrapSeqNum.setStatus('current')
if mibBuilder.loadTexts: dellTrapSeqNum.setDescription('Since SNMP traps are transported using UDP, there is a possibility for the trap to be lost in transit. To allow the NMS the ability to detect this possibility, all traps will include a trap sequence number as part of its variable binding list. The trap sequence number may be reset each time the system reboots and will increment for each trap sent from the device. When a missing trap sequence number is detected the NMS may be able to refresh its state of the switch to determine what event it may have missed.')
dellTrapTimeStamp = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 1, 1, 5), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dellTrapTimeStamp.setStatus('current')
if mibBuilder.loadTexts: dellTrapTimeStamp.setDescription('The trap header includes the system up time which mark when the trap was generated, but often it is important to know the absolute time when the trap was generated. This time stamp is based on GMT (universal time) time zone. This will allow the timestamps to be correlated consistently across a large network.')
hwResourceOverflow = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 500)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: hwResourceOverflow.setStatus('current')
if mibBuilder.loadTexts: hwResourceOverflow.setDescription('Indicates that a switch hardware resource overflowed. The dellTrapSource should indicate the unit number whereas dellTrapInfo should identify the resource that overflowed.')
swResourceOverflow = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 510)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: swResourceOverflow.setStatus('current')
if mibBuilder.loadTexts: swResourceOverflow.setDescription('Indicates that a switch software resource overflowed. The dellTrapSource should indicate the unit number whereas dellTrapInfo should identify the resource that overflowed (e.g. maximum VLAN/LAG/MACs/IPs exceeded).')
configChanged = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 520)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: configChanged.setStatus('current')
if mibBuilder.loadTexts: configChanged.setDescription('Indicates that the switch configuration has changed. The dellTrapSource should indicate the source of the change such as the unit, slot, port, VLAN, LAG, etc. The dellTrapInfo may indicate additional information regarding the change.')
resetRequired = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 530)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: resetRequired.setStatus('current')
if mibBuilder.loadTexts: resetRequired.setDescription('This trap indicates that in order to perform the last SET request, a reset operation of the router/bridge is required. This may occur for any number of reasons such as if the change affects the routing protocols to be switched from SPF to STP. This trap warns the user to manually reset the switch using either physical or software reset.')
endTftp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 540)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: endTftp.setStatus('current')
if mibBuilder.loadTexts: endTftp.setDescription('This trap indicates that the device finished a TFTP transaction with the management station. The dellTrapInfo field will provide TFTP exit code and name/type of the file being transferred.')
abortTftp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 550)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: abortTftp.setStatus('current')
if mibBuilder.loadTexts: abortTftp.setDescription('This trap indicates that in the device aborted a TFTP session with the management station. The dellTrapInfo field will provide TFTP exit code and name/type of the file being transferred.')
startTftp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 560)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: startTftp.setStatus('current')
if mibBuilder.loadTexts: startTftp.setDescription('Informational trap indicating that the device has intiated a TFTP session. dellTrapInfo will contain the name/type of the file being transferred.')
linkFailure = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 570)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: linkFailure.setStatus('current')
if mibBuilder.loadTexts: linkFailure.setDescription('Link failure detected, no backup available. The dellTrapSource should indicate the fail link.')
linkFailureSwitchBackUp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 580)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: linkFailureSwitchBackUp.setStatus('current')
if mibBuilder.loadTexts: linkFailureSwitchBackUp.setDescription('Automantic switchover to backup link because of main link fault. The dellTrapSource indicates the backup link coming on, and the dellTrapInfo indicates the failed link.')
mainLinkUp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 590)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: mainLinkUp.setStatus('current')
if mibBuilder.loadTexts: mainLinkUp.setDescription('Communication returned to main link. The dellTrapSource indicates the main link coming up, and the dellTrapInfo indicates the backup link.')
errorsDuringInit = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 600)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: errorsDuringInit.setStatus('current')
if mibBuilder.loadTexts: errorsDuringInit.setDescription('This trap indicates that the an error occured during initialization phase of the switch. Additional information is provided in the dellTrapInfo field.')
vlanDynPortAdded = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 610)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanDynPortAdded.setStatus('current')
if mibBuilder.loadTexts: vlanDynPortAdded.setDescription('Indicates that a port was dynamically added to the VLAN. The dellTrapSource will indicate the VLAN, and the dellTrapInfo will indicate the port being added.')
vlanDynPortRemoved = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 620)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanDynPortRemoved.setStatus('current')
if mibBuilder.loadTexts: vlanDynPortRemoved.setDescription('Indicates that a port was dynamically removed from a VLAN. The dellTrapSource will indicate the VLAN, and the dellTrapInfo will indicate the port being removed.')
ipZhrReqStaticConnNotAccepted = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 630)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: ipZhrReqStaticConnNotAccepted.setStatus('current')
if mibBuilder.loadTexts: ipZhrReqStaticConnNotAccepted.setDescription('The requested static connection was not accepted because there is no available IP virtual address to allocate to it.')
ipZhrVirtualIpAsSource = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 640)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: ipZhrVirtualIpAsSource.setStatus('current')
if mibBuilder.loadTexts: ipZhrVirtualIpAsSource.setDescription('The virtual IP address appeared as a source IP. All the connections using it will be deleted and it will not be further allocated to new connections.')
ipZhrNotAllocVirtualIp = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 650)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: ipZhrNotAllocVirtualIp.setStatus('current')
if mibBuilder.loadTexts: ipZhrNotAllocVirtualIp.setDescription('The source IP address sent an ARP specifying a virtual IP which was not allocated for this source. This virtual IP will not be allocated to connections of this specific source IP.')
stackMasterFailed = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 660)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackMasterFailed.setStatus('current')
if mibBuilder.loadTexts: stackMasterFailed.setDescription('Indicates that the stack master unit has failed. This trap is generated by the new master when it takes over the stack. The dellTrapSource should be the new master unit #, and the dellTrapInfo should identify the old master unit #.')
stackNewMasterElected = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 670)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackNewMasterElected.setStatus('current')
if mibBuilder.loadTexts: stackNewMasterElected.setDescription('Indicates when a new master has been elected. This is different from a stack failure in that the master has not failed but for some reason a new master has been elected (e.g. the user requested a new master. The trap should be generated by the new master. the dellTrapSource should identify the new master, and the dellTrapInfo should identify the old master.')
stackMemberUnitFailed = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 680)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackMemberUnitFailed.setStatus('current')
if mibBuilder.loadTexts: stackMemberUnitFailed.setDescription('Indicates that a member of the stack has failed. This condition is detected by the master unit so the dellTrapSource should indicate the master unit ID and the dellTrapInfo should indicate the member unit that failed.')
stackNewMemberUnitAdded = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 690)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackNewMemberUnitAdded.setStatus('current')
if mibBuilder.loadTexts: stackNewMemberUnitAdded.setDescription('Indicates that a new member unit has been added to the stack. This trap is generated by the master unit so the dellTrapSource should indicate the master unit ID, and the dellTrapInfo should identify the new unit ID.')
stackMemberUnitRemoved = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 700)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackMemberUnitRemoved.setStatus('current')
if mibBuilder.loadTexts: stackMemberUnitRemoved.setDescription('Indicates that a member unit has been removed from the stack. The dellTrapSource indicates the master unit ID and the dellTrapInfo indicates the unit ID being removed.')
stackSplitMasterReport = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 710)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackSplitMasterReport.setStatus('current')
if mibBuilder.loadTexts: stackSplitMasterReport.setDescription('Indicates that the stack has split into two distinct stacks which means that each stack may end up with its own master temporarily until the stack is rejoined. This is possibly different from the stackMemberUnitFailed trap, which indicates only a single unit failure. This trap indicates that the master has lost track of part of the stack membership so that the other units may elect their own master. The dellTrapSource should indicate the master unit ID and the dellTrapInfo should identify the units that are split from the main stack.')
stackSplitNewMasterReport = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 720)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackSplitNewMasterReport.setStatus('current')
if mibBuilder.loadTexts: stackSplitNewMasterReport.setDescription('Indicates that the stack has split into two distinct stacks which means that each stack may end up with its own master temporarily until the stack is rejoined. This trap is generated by the new master unit elected in the split sub-stack. The dellTrapSource should identify the new master unit ID, and the dellTrapInfo should identify the old master unit ID before the split occured.')
stackRejoined = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 730)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackRejoined.setStatus('current')
if mibBuilder.loadTexts: stackRejoined.setDescription('Indicates that previously split stack has rejoined. The rejoined stack will elect a master and this trap should be generated by the elected master. The dellTrapSource should indicate the master unit ID and the dellTrapInfo should list the unit IDs of the members.')
stackLinkFailed = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 740)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stackLinkFailed.setStatus('current')
if mibBuilder.loadTexts: stackLinkFailed.setDescription('Indicates a failure in one of the stacking link. If this stack was connected in a ring, then the failure of a stacking link results in a chain stack instead of a ring. Another failure in the chain topology would result in a split stack. If the stack is connected in a meshed or star topology then multiple link failure may be tolerated. This trap may be generated by any unit within the stack and must indicate the source of the failure. The dellTrapSource should identify one end of the link where the failure is detected. The dellTrapInfo may provide additional information about the failure.')
dhcpAllocationFailure = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 750)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: dhcpAllocationFailure.setStatus('current')
if mibBuilder.loadTexts: dhcpAllocationFailure.setDescription('DHCP failed to allocate an IP address to a requesting host because of memory shortage or inadequate configuration of available IP addresses.')
dot1dStpPortStateForwarding = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 760)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: dot1dStpPortStateForwarding.setStatus('current')
if mibBuilder.loadTexts: dot1dStpPortStateForwarding.setDescription('The trap is sent by a bridge when any of its configured ports transitions from the Learning state to the Forwarding state.')
dot1dStpPortStateNotForwarding = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 770)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: dot1dStpPortStateNotForwarding.setStatus('current')
if mibBuilder.loadTexts: dot1dStpPortStateNotForwarding.setDescription('The trap is sent by a bridge when any of its configured ports transitions from the Forwarding state to the Blocking state.')
policyDropPacketTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 780)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: policyDropPacketTrap.setStatus('current')
if mibBuilder.loadTexts: policyDropPacketTrap.setDescription('Indicates that the packet drop due to the policy. This trap may result in a huge number of trap packets and should be used only for debugging purposes. The number of traps sent per time period is user configurable and the user may enable/disable generation of this trap.')
policyForwardPacketTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 790)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: policyForwardPacketTrap.setStatus('current')
if mibBuilder.loadTexts: policyForwardPacketTrap.setDescription('Indicates that the packet has forward based on policy. The number of traps sent per time period is user configurable and the user may enable/disable generation of this trap.')
igmpV1MsgReceived = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 800)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: igmpV1MsgReceived.setStatus('current')
if mibBuilder.loadTexts: igmpV1MsgReceived.setDescription('An IGMP Message of v1 received on a given interface. The dellTrapSource should indicate the interface.')
vrrpEntriesDeleted = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 810)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vrrpEntriesDeleted.setStatus('current')
if mibBuilder.loadTexts: vrrpEntriesDeleted.setDescription('One or more VRRP entries deleted due to IP interface deletion or transition. ')
trunkPortAddedTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 820)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: trunkPortAddedTrap.setStatus('current')
if mibBuilder.loadTexts: trunkPortAddedTrap.setDescription('Informational trap indicating that a port is added to a trunk. The dellTrapSource should indicate the trunk to which the port is added. The dellTrapInfo should indicate the port being added.')
trunkPortRemovedTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 830)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: trunkPortRemovedTrap.setStatus('current')
if mibBuilder.loadTexts: trunkPortRemovedTrap.setDescription('This warning is generated when a port removed from a trunk. The dellTrapSource should indicate the trunk from which the port is removed. The dellTrapInfo should indicate the port being removed.')
lockPortTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 840)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: lockPortTrap.setStatus('current')
if mibBuilder.loadTexts: lockPortTrap.setDescription('Informational trap indicating that a port that is blocked from MAC learning has receive a frame with new source Mac Address. The dellTrapSource should identify the port and the dellTrapInfo should specify the new MAC address received.')
vlanDynVlanAdded = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 850)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanDynVlanAdded.setStatus('current')
if mibBuilder.loadTexts: vlanDynVlanAdded.setDescription('Indicates that a dynamic VLAN has been added via GVRP. The dellTrapSource should identify the VLAN being added.')
vlanDynVlanRemoved = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 860)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanDynVlanRemoved.setStatus('current')
if mibBuilder.loadTexts: vlanDynVlanRemoved.setDescription('Indicates that a dynamic VLAN has been removed via GVRP. The dellTrapSource should identify the VLAN being removed.')
vlanDynamicToStatic = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 870)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanDynamicToStatic.setStatus('current')
if mibBuilder.loadTexts: vlanDynamicToStatic.setDescription('Indicates that a dynamic VLAN has been made static. The dellTrapSource should identify the VLAN.')
vlanStaticToDynamic = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 880)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: vlanStaticToDynamic.setStatus('current')
if mibBuilder.loadTexts: vlanStaticToDynamic.setDescription('Indicates that a static VLAN has been made dynamic. The dellTrapSource should identify the VLAN.')
envMonFanStateChange = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 890)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: envMonFanStateChange.setStatus('current')
if mibBuilder.loadTexts: envMonFanStateChange.setDescription('Trap indicating the fan state. The dellTrapSource should identify the exact fan index if there are multiple fans. The dellTrapInfo may provide additional info relating to the fan new state.')
envMonPowerSupplyStateChange = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 900)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: envMonPowerSupplyStateChange.setStatus('current')
if mibBuilder.loadTexts: envMonPowerSupplyStateChange.setDescription('Trap indicating the power supply state. The dellTrapSource should identify the exact power supply. The dellTrapInfo may provide additional info regarding the power state.')
envMonTemperatureRisingAlarm = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 910)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: envMonTemperatureRisingAlarm.setStatus('current')
if mibBuilder.loadTexts: envMonTemperatureRisingAlarm.setDescription('Trap indicating that the temperature in the device has exceeded the device specific safe temperature threshold.')
copyFinished = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 920)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: copyFinished.setStatus('current')
if mibBuilder.loadTexts: copyFinished.setDescription('Informational trap indicating that the device has finished a copy operation successfully.')
copyFailed = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 930)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: copyFailed.setStatus('current')
if mibBuilder.loadTexts: copyFailed.setDescription('Informational trap indicating that the copy operation has failed.')
dot1xPortStatusAuthorizedTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 940)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: dot1xPortStatusAuthorizedTrap.setStatus('current')
if mibBuilder.loadTexts: dot1xPortStatusAuthorizedTrap.setDescription('Informational trap indicating that port 802.1x status is authorized.')
dot1xPortStatusUnauthorizedTrap = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 950)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: dot1xPortStatusUnauthorizedTrap.setStatus('current')
if mibBuilder.loadTexts: dot1xPortStatusUnauthorizedTrap.setDescription('Warning trap is indicating that port 802.1x status is unAuthorized.')
broadcastStormDetected = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 960)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: broadcastStormDetected.setStatus('current')
if mibBuilder.loadTexts: broadcastStormDetected.setDescription('Indicates that a broadcast storm has been detected. The dellTrapSource should indicate the port on which the broadcast storm is detected.')
stpElectedAsRoot = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 970)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stpElectedAsRoot.setStatus('current')
if mibBuilder.loadTexts: stpElectedAsRoot.setDescription('Indicates that the switch has been elected as the new STP root.')
stpNewRootElected = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 980)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: stpNewRootElected.setStatus('current')
if mibBuilder.loadTexts: stpNewRootElected.setDescription('Indicates that a new root has been elected. The dellTrapSource should indicate the member unit number and the dellTrapInfo should provide information on the new root.')
igmpElectedAsQuerier = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 990)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: igmpElectedAsQuerier.setStatus('current')
if mibBuilder.loadTexts: igmpElectedAsQuerier.setDescription('Indicates that this switch has been elected as the new IGMP snooping querier.')
invalidUserLoginAttempted = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1000)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: invalidUserLoginAttempted.setStatus('current')
if mibBuilder.loadTexts: invalidUserLoginAttempted.setDescription('Indicates that an invalid user tries to login to the CLI or Web. The dellTrapSource should indicate the unit member ID and the dellTrapInfo should indicate whether the login attempt is on the CLI or Web and the IP address from which the attempt was made.')
managementACLViolation = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1010)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: managementACLViolation.setStatus('current')
if mibBuilder.loadTexts: managementACLViolation.setDescription('Indicates that an SNMP request or CLI/Web access request was received but does not meet the management ACL rules. For example, if the request comes from an invalid IP address or has the wrong SNMP community string (for V1/2c) or is not authenticated for SNMPv3, etc. The dellTrapSource should indicate the unit # and the dellTrapInfo should indicate which interface (web, cli, snmp) is violated and the source IP address of the request.')
sfpInserted = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1020)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: sfpInserted.setStatus('current')
if mibBuilder.loadTexts: sfpInserted.setDescription('Indicates that an SFP was inserted into the system. The dellTrapSource should indicate the unit # and the dellTrapInfo should indicate on which interface was the SFP inserted.')
sfpRemoved = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1030)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: sfpRemoved.setStatus('current')
if mibBuilder.loadTexts: sfpRemoved.setDescription('Indicates that an SFP was removed from the system. The dellTrapSource should indicate the unit # and the dellTrapInfo should indicate from which interface was the SFP removed.')
xfpInserted = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1040)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: xfpInserted.setStatus('current')
if mibBuilder.loadTexts: xfpInserted.setDescription('Indicates that an XFP was inserted into the system. The dellTrapSource should indicate the unit # and the dellTrapInfo should indicate on which interface was the XFP inserted.')
xfpRemoved = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 1050)).setObjects(("Dell-LAN-TRAP-MIB", "dellTrapTimeStamp"), ("Dell-LAN-TRAP-MIB", "dellTrapSeqNum"), ("Dell-LAN-TRAP-MIB", "dellTrapSource"), ("Dell-LAN-TRAP-MIB", "dellTrapSeverity"), ("Dell-LAN-TRAP-MIB", "dellTrapInfo"))
if mibBuilder.loadTexts: xfpRemoved.setStatus('current')
if mibBuilder.loadTexts: xfpRemoved.setDescription('Indicates that an XFP was removed from the system. The dellTrapSource should indicate the unit # and the dellTrapInfo should indicate from which interface was the XFP removed.')
mibBuilder.exportSymbols("Dell-LAN-TRAP-MIB", dellAlarmGroup=dellAlarmGroup, PYSNMP_MODULE_ID=dellAlarmGroup, mainLinkUp=mainLinkUp, vlanDynPortRemoved=vlanDynPortRemoved, abortTftp=abortTftp, lockPortTrap=lockPortTrap, broadcastStormDetected=broadcastStormDetected, dellTrapSeverity=dellTrapSeverity, dellTrapSeqNum=dellTrapSeqNum, stackMemberUnitRemoved=stackMemberUnitRemoved, dot1xPortStatusUnauthorizedTrap=dot1xPortStatusUnauthorizedTrap, stackSplitNewMasterReport=stackSplitNewMasterReport, sfpInserted=sfpInserted, hwResourceOverflow=hwResourceOverflow, endTftp=endTftp, policyDropPacketTrap=policyDropPacketTrap, igmpV1MsgReceived=igmpV1MsgReceived, invalidUserLoginAttempted=invalidUserLoginAttempted, envMonTemperatureRisingAlarm=envMonTemperatureRisingAlarm, swResourceOverflow=swResourceOverflow, stackNewMemberUnitAdded=stackNewMemberUnitAdded, vlanDynVlanAdded=vlanDynVlanAdded, stackNewMasterElected=stackNewMasterElected, managementACLViolation=managementACLViolation, stpElectedAsRoot=stpElectedAsRoot, policyForwardPacketTrap=policyForwardPacketTrap, dellTrapInfo=dellTrapInfo, configChanged=configChanged, vlanDynPortAdded=vlanDynPortAdded, vrrpEntriesDeleted=vrrpEntriesDeleted, ipZhrVirtualIpAsSource=ipZhrVirtualIpAsSource, dellTrapTimeStamp=dellTrapTimeStamp, startTftp=startTftp, linkFailureSwitchBackUp=linkFailureSwitchBackUp, dot1dStpPortStateNotForwarding=dot1dStpPortStateNotForwarding, resetRequired=resetRequired, ipZhrReqStaticConnNotAccepted=ipZhrReqStaticConnNotAccepted, trunkPortAddedTrap=trunkPortAddedTrap, trunkPortRemovedTrap=trunkPortRemovedTrap, stackLinkFailed=stackLinkFailed, vlanDynamicToStatic=vlanDynamicToStatic, vlanStaticToDynamic=vlanStaticToDynamic, envMonPowerSupplyStateChange=envMonPowerSupplyStateChange, dot1xPortStatusAuthorizedTrap=dot1xPortStatusAuthorizedTrap, dellTrapSource=dellTrapSource, stpNewRootElected=stpNewRootElected, igmpElectedAsQuerier=igmpElectedAsQuerier, xfpRemoved=xfpRemoved, copyFailed=copyFailed, xfpInserted=xfpInserted, envMonFanStateChange=envMonFanStateChange, dot1dStpPortStateForwarding=dot1dStpPortStateForwarding, linkFailure=linkFailure, stackMasterFailed=stackMasterFailed, ipZhrNotAllocVirtualIp=ipZhrNotAllocVirtualIp, stackSplitMasterReport=stackSplitMasterReport, dhcpAllocationFailure=dhcpAllocationFailure, vlanDynVlanRemoved=vlanDynVlanRemoved, sfpRemoved=sfpRemoved, stackRejoined=stackRejoined, stackMemberUnitFailed=stackMemberUnitFailed, copyFinished=copyFinished, errorsDuringInit=errorsDuringInit)
|
class DummyClass:
dummy_var = 'original'
def __init__(self, init_param=0):
pass
def __call__(self, call_param=0):
return 'not_mocked_call'
def some_method(self):
# def some_method(self, some_method_param):
return 'not_mocked_some_method'
def some_other_method(self, some_other_method_param):
return 'not_mocked_some_other_method'
|
def for_p():
"""printing small 'p' using for loop"""
for row in range(7):
for col in range(4):
if col==0 or col==3 and row in(2,3) or row==1 and col in(1,2) or row==4 and col in(1,2):
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_p():
"""printing small 'p' using while loop"""
i=0
while i<7:
j=0
while j<4:
if j==0 or j==1 and i in(1,3) or j==2 and i==2:
print("*",end=" ")
else:
print(" ",end=" ")
j+=1
i+=1
print()
|
H, W, A, B = map(int, input().split())
board = [[0] * W for _ in range(H)]
for i in range(B):
for j in range(A):
board[i][j] = 1
for i in range(B, H):
for j in range(A, W):
board[i][j] = 1
assert all(sum(row) in [A, W-A] for row in board)
assert all(sum(board[i][j] for i in range(H)) in [B, H-B] for j in range(W))
for row in board:
print("".join(map(str, row)))
|
def genSubsets(L):
'''
L: list
Returns: all subsets of L
'''
# base case
if len(L) == 0:
return [[]]
# recursive block
# all the subsets of smaller + all the subsets of smaller combined with extra = all subsets of L
extra = L[0:1]
smaller = genSubsets(L[1:])
combine = []
for i in smaller:
combine.append(extra + i)
return smaller + combine
|
class Solution(object):
def isUgly(self, num):
if not num:
return False
for factor in (2, 3, 5):
while num % factor == 0:
num /= factor
return num == 1
|
# Please change this appropriately
TRAIN_DATA = "../input/train.csv"
TEST_DATA = "../input/test.csv"
HTML_DATA = "../input/html_data.csv"
CLEAN_TRAIN_DATA = "../input2/train_v2.csv"
CLEAN_TEST_DATA = "../input2/test_v2.csv"
TRAIN_TEXT_MODEL_PATH = "../input2/train_text_preds.csv"
TEST_TEXT_MODEL_PATH = "../input2/test_text_preds.csv"
SUBMISSION_PATH = "../input2/submission.csv"
# Preferably keep them as is
LABEL_COLS = ["others", "news", "publication", "profile",
"conferences", "forum", "clinicalTrials",
"thesis", "guidelines"]
TAG_DICT = {"others":0, "news": 1, "publication":2, "profile": 3,
"conferences": 4, "forum": 5, "clinicalTrials": 6,
"thesis": 7, "guidelines": 8}
|
class Solution(object):
def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: int
"""
stack = [root]
BST_vals = []
while stack:
curr = stack.pop()
BST_vals.append(curr.val)
if curr.left != None:
stack.append(curr.left)
if curr.right != None:
stack.append(curr.right)
BST_vals.sort()
return BST_vals[k-1]
|
"""
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
"""
class Solution:
def copyRandomList(self, head: 'Optional[Node]') -> 'Optional[Node]':
oldToCopy = {None: None}
curr = head
while curr:
oldToCopy[curr] = Node(curr.val)
curr = curr.next
curr = head
while curr:
copy = oldToCopy[curr]
copy.next = oldToCopy[curr.next]
copy.random = oldToCopy[curr.random]
curr = curr.next
return oldToCopy[head]
|
_day_bands = ['n2_lbh'
, 'n2_vk'
, 'n2_1pg'
, 'n2_2pg'
, 'n2p_1ng'
, 'n2p_mnl'
, 'no_bands'
]
_night_bands = ['o2_nglow','o2_atm']
_bands = _day_bands + _night_bands
_band_cmd = {'n2_lbh':'syn_lbh'
, 'n2_vk':'syn_vk'
, 'n2_1pg':'syn_1pg'
, 'n2_2pg':'syn_2pg'
, 'n2p_1ng':'syn_1ng'
, 'n2p_mnl':'syn_mnl'
, 'no_bands':'syn_no'
, 'o2_atm':'syn_atm'
, 'o2_nglow':'syn_o2'
}
def band_command(band_name):
return _band_cmd[band_name]
|
class BaseGordonException(Exception):
code = 1
hint = u"Something went't wrong"
def get_hint(self):
return self.hint.format(*self.args)
class ResourceSettingRequiredError(BaseGordonException):
code = 2
hint = u"Resource {} requires you to define '{}' in it's settings."
class InvalidStreamStartingPositionError(BaseGordonException):
code = 3
hint = u"Resource {} starting position '{}' is invalid."
class InvalidLambdaRoleError(BaseGordonException):
hint = u"Resource {} role is invalid '{}'."
code = 4
class InvalidLambdaCodeExtensionError(BaseGordonException):
hint = u"{} extension is invalid."
code = 5
class PropertyRequiredError(BaseGordonException):
hint = u"Action {} requires you to define '{}' property."
code = 6
class InvalidAppFormatError(BaseGordonException):
hint = u"Invalid app format {}."
code = 7
class DuplicateResourceNameError(BaseGordonException):
hint = u"Duplicate resource error {} {}"
code = 8
class ProjectNotBuildError(BaseGordonException):
hint = u"It looks you have not build your project yet! Run $ gordon build"
code = 9
class AbnormalCloudFormationStatusError(BaseGordonException):
hint = u"""
Oh Oh!! You stack status is {1}... which is bad, quite bad.
The stack cannot return to a good state. In other words, a dependent
resource cannot return to its original state, which causes a failure.
What can you do now? Well... you need to delete the stack and run this
command again. Before doing that, it would be good if you check what
failed... because it is quite possible this will happend again if you
don't solve the root issue.
You can either use the AWS Console, or use gordon's delete action.
Keep in mind that deleting the stack will remove all resources deployed
by Gordon (Lambdas, EventSourceMapping, APIGateways, etc...) which will
generate disruption in your service (for obvious reasons).
Because the nature of Gordon, all templates should be idempotent, so,
if you apply your gordon project again after deleting your stack, the
final result should be the same.
It is going to be fine.
Stack: {0}
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html#d0e114571
"""
code = 10
class ProjectDirectoryAlreadyExistsError(BaseGordonException):
hint = u"A directory with name '{}' already exists."
code = 11
class AppDirectoryAlreadyExistsError(BaseGordonException):
hint = u"A directory with name '{}' already exists."
code = 12
class UnknownProtocolError(BaseGordonException):
hint = u"Unknown protocol {} with value {}."
code = 13
class CloudFormationStackInProgressError(BaseGordonException):
hint = u"CloudFormation stack {} is in progress ({})."
code = 14
class ResourceValidationError(BaseGordonException):
code = 15
def get_hint(self):
return self.args[0]
class BaseProtocolError(BaseGordonException):
def get_hint(self):
return self.args[0]
class ProtocolNotFoundlError(BaseProtocolError):
code = 16
class ProtocolMultipleMatcheslError(BaseProtocolError):
code = 17
class DuplicateAppNameError(BaseGordonException):
hint = u"An application with name {} is already installed."
code = 18
class AppNotFoundError(BaseGordonException):
hint = u"Application with name {} and path {} can't be found."
code = 19
class ResourceNotFoundError(BaseGordonException):
code = 20
def get_hint(self):
hint = u"Resource {} Not Found. Available {}".format(*self.args)
try:
resource = self.args[0].split(':')
if resource[1].startswith('contrib_'):
hint += (u"\n\nIt looks like {} is missing in your settings.yml "
u"file apps list").format(resource[1].replace('_', '.'))
except IndexError:
pass
return hint
class LambdaBuildProcessError(BaseGordonException):
code = 21
def get_hint(self):
return (
u"Error building lambda '{}'!\n"
u"cmd: {}\n\n"
u"{}\n"
).format(
self.args[1].name,
self.args[0].cmd,
self.args[0].output,
)
class InvalidApigatewayIntegrationTypeError(BaseGordonException):
hint = u"Invalid Apigateway integration type: {}"
code = 22
class LambdaNotFound(BaseGordonException):
hint = u"Lambda with name {} can't be found."
code = 23
class ValidationError(BaseGordonException):
hint = u" Validation Error: {}"
code = 24
|
print('-=-=- Aluguel de carros -=-=-')
dias = int(input('Quantos dias usou o veículo? '))
kms = int(input('Quantos Kms rodou? '))
print(f'O valor a ser pago é de --> R${(60*dias) + (0.15*kms)}')
|
#!/usr/bin/env python
# coding: utf-8
# # Conjuntos
#
# - Conjuntos são coleções de elementos únicos
# - Principais características:
# - Os elementos não são armazenados em uma ordem específica
# - Conjuntos não contém elementos repetidos
# - Conjuntos não suportam indexação como as listas e tuplas
#
# O que veremos nessa aula:
#
# 1. Como criar conjuntos
# 2. Como acessas elementos de um conjunto
# 3. Como modificar elementos de um conjunto
# 4. Principais métodos de um objeto conjunto
# 5. Funções aplicáveis a um conjunto
# 6. Curiosidade (conversão de uma lista em conjunto)
# ### 1. Como criar conjuntos
# In[3]:
# Criando conjuntos vazios
conj_vazio1 = set() # Essa é a única forma de se criar um conjunto vazio
conj_vazio2 = {} # As chaves são utilizadas para construir um dicionário vazio
# In[5]:
type(conj_vazio1)
# In[6]:
type(conj_vazio2)
# In[2]:
# Criando conjuntos com elementos
conj1 = {1, 2, 3, 4, 5}
conj2 = {"A", "B", "C", "D"}
conj3 = {"ABC", 123, 3.14}
# In[8]:
# Conjuntos não podem conter outras estruturas aninhadas
conj3 = {1, "ABC", [1, 2, 3]} # Provoca um erro por causa da lista
# ### 2. Como acessar elementos de um conjunto
# In[9]:
# Conjuntos não suportam indexação. Então, vamos precisar do comando for para acessar os elementos de um conjunto
for elem in conj1:
print(elem)
# In[10]:
# Tentar acessar uma posição em um conjunto provoca um erro
conj1[0]
# ### 3. Como modificar elementos de um conjunto
# In[11]:
# Não existe uma maneira de modificar elementos em um conjunto.
# O que pode ser realizado é a exclusão de um elemento, seguida de uma inserção do elemento alvo.
# ### 4. Principais métodos de um objeto conjunto
# Método | Descrição | Exemplo
# :----- | :-------- | :------
# add | Adiciona um elemento ao conjunto | conj1.add(5)
# clear | Apaga todos os elementos de um conjunto | conj1.clear()
# copy | Retorna uma cópia dos elementos de um conjunto | conj_copia = conj1.copy()
# difference | Retorna o conjunto de elementos de conj1 que não pertencem a conj2 | conj1.difference(conj2)
# intersection | Retorna o conjunto de elementos presentes tanto em conj1 quanto em conj2 | con1.intersection(conj2)
# isdisjoint | Retorna True se conj1 e conj2 forem disjntos (ou seja, não possuem elementos em comum) | conj1.isdisjoint(conj2)
# issubset | Retorna True se conj1 for um subconjunto de conj2 (conj1 está contido em conj2) | conj1.issubset(conj2)
# isuperset | Retorna True se conj1 for um superconjunto de conj2 (conj1 contém conj2) | conj1.issuperset(conj2)
# remove and discard | Removem um elemento do conjunto | conj1.remove(5) ou conj1.discard(5)
# symmetric_difference| Retorna o conjunto de elementos que não são comuns aos dois conjuntos (o contrário da intersecção) | conj1.symmetric_difference(conj2)
# union | Retorna a união entre 2 conjuntos | conj1.union(conj2)
# ### 4.1 - add()
# In[3]:
# Visualizando os elementos de conj1
conj1
# In[4]:
# Adicionando o elemento 6
conj1.add(6)
conj1
# ### 4.2 - clear()
# In[5]:
# Visualizando os elementos de conj3
conj3
# conj3.clear()
# conj3
# ### 4.3 - copy()
# In[7]:
conj3 = conj1.copy()
conj3
# ### 4.4 - difference()
# In[8]:
# Criando os conjuntos s1 e s2
s1 = {1, 2, 3, 4, 5}
s2 = {4, 5, 6, 7}
# In[9]:
# Atribui a s3 a diferença do conjunto s1 em relação a s2
s3 = s1.difference(s2)
s3
# ### 4.5 - intersection()
# In[11]:
s4 = s1.intersection(s2)
s4
# ### 4.6 - isdisjint()
# In[12]:
# Verificando se s1 e s2 são disjuntos
s1.isdisjoint(s2)
# In[13]:
# Verificando se s3 e s4 são disjuntos
s3.isdisjoint(s4)
# ### 4.7 - issubset()
# In[14]:
# Verificando se s1 é um subconjunto de s2
s1.issubset(s2)
# In[15]:
# Verificando se s3 é um subconjunto de s1
s3.issubset(s1)
# ### 4.8 - issuperset()
# In[16]:
# Verificando se s1 é um superconjunto de s2
s1.issuperset(s2)
# In[17]:
# Verificando se s1 é um superconjunto de s3
s1.issuperset(s3)
# ### 4.9 - remove() and discard()
# In[18]:
# Visualizando os elementos de conj1
conj1
# In[19]:
# Removendo o 3 de conj1 usando o remove()
conj1.remove(3)
# In[20]:
# Visualizando os elementos de conj1 após remove(3)
conj1
# In[21]:
# Tentar remover um elemento inexistente com remove provoca um erro
conj1.remove(7)
# In[23]:
# Removendo o 6 de conj1 após discard(6)
conj1.discard(6)
# In[24]:
# Visualizando os elementos de conj1 após discard(6)
conj1
# In[25]:
# Tentar remover um elemento inexistente com discard NÃO provoca um erro
conj1.discard(7)
# ### 4.10 - symmetric_difference()
# In[26]:
# Na seção 4.5 foi realizada a intersecção de s1 e s2. Agora vamos calcular a diferença simétrica.
s5 = s1.symmetric_difference(s2)
s5
# In[27]:
### 4.11 - union()
# Calculando o conjunto união. Veja que elementos repetidos só aparecem uma única vez no conjunto resultante
s6 = s1.union(s2)
s6
# ### 5. Funções aplicáveis a um conjunto
# In[28]:
len(s1)
# In[29]:
max(s1)
# In[30]:
min(s1)
# In[31]:
sum(s1)
# ### 6. Curiosidade (conversão de uma lista em um conjunto)
# In[33]:
# O que acontece se convertermos uma lista que contém elementos repetidos em um conjunto?
lista = [1, 2, 4, 3, 2, 1, 5, 2, 3, 1, 6, 3, 4, 2]
# In[34]:
# Convertendo a lista em um conjunto
conj_lista = set(lista)
# In[35]:
# Ao visualizar o conjunto obtido através da conversão da lista, vemos que não existem mais elementos repetidos
conj_lista
# In[ ]:
|
# Aaron Donnelly
# This program will count the number of re-occurences of the letter 'e' in a txt file selected by the user.
f= open(input("Insert a .txt filename "), "r")
x= f.read().count('e')
print("There are",x, "e's in this text")
|
#
# PySNMP MIB module WWP-COMMUNITY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-COMMUNITY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:30:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Gauge32, Counter64, ObjectIdentity, ModuleIdentity, Integer32, Bits, TimeTicks, Unsigned32, NotificationType, iso, MibIdentifier, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Gauge32", "Counter64", "ObjectIdentity", "ModuleIdentity", "Integer32", "Bits", "TimeTicks", "Unsigned32", "NotificationType", "iso", "MibIdentifier", "Counter32")
RowStatus, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "DisplayString")
wwpModules, = mibBuilder.importSymbols("WWP-SMI", "wwpModules")
wwpCommunityMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6141, 2, 32))
wwpCommunityMIB.setRevisions(('2001-04-03 17:00',))
if mibBuilder.loadTexts: wwpCommunityMIB.setLastUpdated('200104031700Z')
if mibBuilder.loadTexts: wwpCommunityMIB.setOrganization('World Wide Packets, Inc')
wwpCommunityMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1))
wwpCommunity = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1))
wwpCommunityMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 2))
wwpCommunityMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 2, 0))
wwpCommunityMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 3))
wwpCommunityMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 3, 1))
wwpCommunityMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 32, 3, 2))
wwpCommunityTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1), )
if mibBuilder.loadTexts: wwpCommunityTable.setStatus('current')
wwpCommunityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1, 1), ).setIndexNames((0, "WWP-COMMUNITY-MIB", "wwpCommunityName"), (0, "WWP-COMMUNITY-MIB", "wwpCommunityIpAddress"))
if mibBuilder.loadTexts: wwpCommunityEntry.setStatus('current')
wwpCommunityName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpCommunityName.setStatus('current')
wwpCommunityIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpCommunityIpAddress.setStatus('current')
wwpCommunityRights = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("readOnly", 1), ("readWrite", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpCommunityRights.setStatus('current')
wwpCommunityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 1, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpCommunityStatus.setStatus('current')
wwpNotifCommunityTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 2), )
if mibBuilder.loadTexts: wwpNotifCommunityTable.setStatus('current')
wwpNotifCommunityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 2, 1), ).setIndexNames((0, "WWP-COMMUNITY-MIB", "wwpNotifCommunityName"), (0, "WWP-COMMUNITY-MIB", "wwpNotifCommunityDestAddr"))
if mibBuilder.loadTexts: wwpNotifCommunityEntry.setStatus('current')
wwpNotifCommunityName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 2, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpNotifCommunityName.setStatus('current')
wwpNotifCommunityDestAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 2, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpNotifCommunityDestAddr.setStatus('current')
wwpNotifCommunityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 2, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpNotifCommunityStatus.setStatus('current')
wwpCommunityPersist = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 32, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("persist", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpCommunityPersist.setStatus('current')
mibBuilder.exportSymbols("WWP-COMMUNITY-MIB", wwpCommunityMIBCompliances=wwpCommunityMIBCompliances, wwpCommunityIpAddress=wwpCommunityIpAddress, wwpCommunity=wwpCommunity, wwpCommunityTable=wwpCommunityTable, wwpCommunityMIBConformance=wwpCommunityMIBConformance, wwpCommunityStatus=wwpCommunityStatus, wwpNotifCommunityName=wwpNotifCommunityName, wwpCommunityMIBNotificationPrefix=wwpCommunityMIBNotificationPrefix, wwpNotifCommunityTable=wwpNotifCommunityTable, wwpNotifCommunityEntry=wwpNotifCommunityEntry, wwpCommunityMIBGroups=wwpCommunityMIBGroups, PYSNMP_MODULE_ID=wwpCommunityMIB, wwpNotifCommunityDestAddr=wwpNotifCommunityDestAddr, wwpCommunityEntry=wwpCommunityEntry, wwpCommunityMIB=wwpCommunityMIB, wwpCommunityName=wwpCommunityName, wwpCommunityMIBObjects=wwpCommunityMIBObjects, wwpNotifCommunityStatus=wwpNotifCommunityStatus, wwpCommunityPersist=wwpCommunityPersist, wwpCommunityMIBNotifications=wwpCommunityMIBNotifications, wwpCommunityRights=wwpCommunityRights)
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
class ChessPiece(object):
""" This is a super class for chess pieces """
def __init__(self, letter, value, x, y):
self.letter = letter
self.color = self.getColor()
self.value = value
self.x = x
self.y = y
def __str__(self):
return self.letter
def __repr__(self):
pythonRepresentation = ("Piece:\t%s\n" % self.letter)
pythonRepresentation += ("Value:\t%i\n" % self.value)
pythonRepresentation += ("Position:\t(%i|%i)\n" % (self.x, self.y))
return pythonRepresentation
#return self.letter
def getColor(self):
if self.letter.isupper():
color = 'white'
else:
color = 'black'
self.color = color
def standardMoves(self):
""" Get a list of vectors for the standard moves. """
return []
def captureMoves(self):
""" Get a list of vectors for the caputure moves. """
return []
class Pawn(ChessPiece):
""" This is a pawn class """
def __init__(self, letter, x, y):
ChessPiece.__init__(self, letter, 1, x, y)
def standardMoves(self):
if self.color == 'white':
return [(0,1)]
else:
return [(0,-1)]
def captureMoves(self):
if self.color == 'white':
return [(1,1), (-1,1)]
else:
return [(1,-1), (-1,-1)]
class King(ChessPiece):
""" This is a king class """
def __init__(self, letter, x, y):
ChessPiece.__init__(self, letter, 1, x, y)
self.moves = [(0,1),(1,0),(0,-1),(-1,0),(1,1),(-1,1),(1,-1),(-1,-1)]
def standardMoves(self):
return self.moves
def captureMoves(self):
return self.moves
class Knight(ChessPiece):
""" This is a king class """
def __init__(self, letter, x, y):
ChessPiece.__init__(self, letter, 1, x, y)
self.moves = [(1,2),(-1,2),(1,-2),(-1,-2),(2,1),(-2,1),(2,-1),(-2,-1)]
def standardMoves(self):
return self.moves
def captureMoves(self):
return self.moves
|
"""
File: hailstone.py
Name: Jade Yeh
-----------------------
This program should implement a console program that simulates
the execution of the Hailstone sequence, as defined by Douglas
Hofstadter. Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
# This constant controls when to stop
EXIT = 1
def main():
"""
User give a real number and the coder will follow below rule continuously until reach 1.
Rule: (1) If a given number(n) is odd, coder will multiple x by 3 and then plus 1: n -> 3n + 1
(2) if a given number(n) is even, coder will divide x by 2: n -> n/2
"""
print('This program computes Hailstone sequences.')
print('')
# num = User's input
num = int(input('Enter a number: '))
n = num
# t = number of steps to reach 1
t = 0
# check if User's input equals 1
if n == EXIT:
print('It took ' + str(t) + ' steps to reach 1.')
else:
# compute continuously while User's input does not equal 1
while n != EXIT:
# check whether a number is odd or even before adopting rule (1) or (2)
if n % 2 == 1:
# n is odd
n1 = int(3 * n + 1)
print(str(n) + ' is odd, so I make 3n+1: ' + str(n1))
# return calculated value(n1) -> n
n = n1
else:
# n is even
n1 = int(n / 2)
print(str(n) + ' is even, so I take half: ' + str(n1))
# return calculated value(n1) -> n
n = n1
# count steps
t += 1
# print result after a given number reach 1
print('It took ' + str(t) + ' steps to reach 1.')
###### DO NOT EDIT CODE BELOW THIS LINE ######
if __name__ == "__main__":
main()
|
# coding:utf-8
class IAgent(object):
'''
负责调用Model和env,控制训练流程
'''
def save(self):
raise NotImplementedError()
def load(self):
raise NotImplementedError()
|
#!/usr/bin/env python
""" Assignment 2, Exercise 2, INF1340, Fall, 2015. DNA Sequencing
This module converts performs substring matching for DNA sequencing
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__ = "MIT License"
def find(input_string, substring, start, end):
"""
Describe your function
:param :
:return:
:raises:
"""
return -1
def multi_find(input_string, substring, start, end):
"""
Describe your function
:param :
:return:
:raises:
"""
result = ""
return result
|
# -*- coding: utf-8 -*-
def repeat_print(n):
'''
重复打印 str, n 次, str 是匿名参数
:param n: 重复次数
:return:
'''
return lambda str: str * n
def main():
pow_x_y = lambda x, y: pow(x, y)
print("2^3 = ", pow_x_y(2, 3))
repeat_print_2 = repeat_print(2)
print(repeat_print_2("hi~ "))
if __name__ == '__main__':
main()
|
# -*- coding: utf-8 -*-
'''
File name: code\rigid_graphs\sol_434.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #434 :: Rigid graphs
#
# For more information see:
# https://projecteuler.net/problem=434
# Problem Statement
'''
Recall that a graph is a collection of vertices and edges connecting the vertices, and that two vertices connected by an edge are called adjacent.
Graphs can be embedded in Euclidean space by associating each vertex with a point in the Euclidean space.
A flexible graph is an embedding of a graph where it is possible to move one or more vertices continuously so that the distance between at least two nonadjacent vertices is altered while the distances between each pair of adjacent vertices is kept constant.
A rigid graph is an embedding of a graph which is not flexible.
Informally, a graph is rigid if by replacing the vertices with fully rotating hinges and the edges with rods that are unbending and inelastic, no parts of the graph can be moved independently from the rest of the graph.
The grid graphs embedded in the Euclidean plane are not rigid, as the following animation demonstrates:
However, one can make them rigid by adding diagonal edges to the cells. For example, for the 2x3 grid graph, there are 19 ways to make the graph rigid:
Note that for the purposes of this problem, we do not consider changing the orientation of a diagonal edge or adding both diagonal edges to a cell as a different way of making a grid graph rigid.
Let R(m,n) be the number of ways to make the m × n grid graph rigid.
E.g. R(2,3) = 19 and R(5,5) = 23679901
Define S(N) as ∑R(i,j) for 1 ≤ i, j ≤ N.
E.g. S(5) = 25021721.
Find S(100), give your answer modulo 1000000033
'''
# Solution
# Solution Approach
'''
'''
|
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
return [[n] + sub for i, n in enumerate(nums) for sub in self.XXX(nums[:i] + nums[i+1:])] or [nums]
|
# A RouteTrie will store our routes and their associated handlers
class RouteTrie:
def __init__(self):
# Initialize the trie with an root node and a handler, this is the root path or home page node
self.root = RouteTrieNode()
def insert(self, path):
paths = split_path(path)
# Similar to our previous example you will want to recursively add nodes
# Make sure you assign the handler to only the leaf (deepest) node of this path
c_node = self.root
for p in paths:
if p not in c_node.items:
c_node.insert(p)
c_node = c_node.items[p]
def find(self, path):
# Starting at the root, navigate the Trie to find a match for this path
# Return the handler for a match, or None for no match
paths = split_path(path)
c_node = self.root
for p in paths:
if p not in c_node.items:
return None
c_node = c_node.items[p]
return c_node.utility
# A RouteTrieNode will be similar to our autocomplete TrieNode... with one additional element, a handler.
class RouteTrieNode:
def __init__(self):
# Initialize the node with children as before, plus a handler
self.utility = None
self.items = {}
def insert(self, p):
# Insert the node as before
self.items[p] = RouteTrieNode()
"""
Next we need to implement the actual Router. The router will initialize itself with a RouteTrie for holding routes and associated handlers. It should also support adding a handler by path and looking up a handler by path. All of these operations will be delegated to the RouteTrie.
Hint: the RouteTrie stores handlers under path parts, so remember to split your path around the '/' character
Bonus Points: Add a not found handler to your Router which is returned whenever a path is not found in the Trie.
More Bonus Points: Handle trailing slashes! A request for '/about' or '/about/' are probably looking for the same page. Requests for '' or '/' are probably looking for the root handler. Handle these edge cases in your Router.
"""
# The Router class will wrap the Trie and handle
class Router:
def __init__(self, root_utility, not_found_utility):
# Create a new RouteTrie for holding our routes
# You could also add a handler for 404 page not found responses as well!
self.root = RouteTrieNode()
self.utility = root_utility
self.not_found_utility = not_found_utility
def add_handler(self, path, data):
# Add a handler for a path
# You will need to split the path and pass the pass parts
# as a list to the RouteTrie
paths = self.split_path(path)
c_node = self.root
for p in paths:
if p not in c_node.items:
c_node.insert(p)
c_node = c_node.items[p]
# Set the data
c_node.utility = data
def lookup(self, path):
# lookup path (by parts) and return the associated handler
# you can return None if it's not found or
# return the "not found" handler if you added one
# bonus points if a path works with and without a trailing slash
# e.g. /about and /about/ both return the /about handler
# Check for path
if path == "/":
return "root_handler"
paths = self.split_path(path)
c_node = self.root
for p in paths:
# Check if p exists otherwise throw a 404 exception
try:
if c_node.items[p]:
c_node = c_node.items[p]
except:
return "404 page not found"
if not c_node.utility:
return "404 not found"
return c_node.utility
def split_path(self, path):
# you need to split the path into parts for
# both the add_handler and loopup functions,
# so it should be placed in a function here
if path[0] == "/":
path = path[1:]
if path[-1] == "/":
path = path[:-1]
paths = path.split("/")
# Return all the paths
return paths
# Test Cases
# Here are some test cases and expected outputs you can use to test your implementation
# create the router and add a route
router = Router("root handler", "not found handler") # remove the 'not found handler' if you did not implement this
router.add_handler("/home/about", "about handler") # add a route
# some lookups with the expected output
print(router.lookup("/")) # should print 'root handler'
print(router.lookup("/home")) # should print 'not found handler' or None if you did not implement one
print(router.lookup("/home/about")) # should print 'about handler'
print(router.lookup("/home/about/")) # should print 'about handler' or None if you did not handle trailing slashes
print(router.lookup("/home/about/me")) # should print 'not found handler' or None if you did not implement one
|
# -*- coding: utf-8 -*-
#--------------------------CLASSE GRAFO--------------------------
class Grafo:
"""
Classe destinada para armazenar lista de adjacencia de representação do grafo
"""
def __init__(self, vertices=0, arestas=0):
"""
Construtor de Lista. Inicializa uma lista vazia do
tamanho do numero de vertices
`param` vertices: numero de vertices do grafo
`param` arestas: numero de arestas do grafo
"""
self.num_vertices = vertices
self.num_arestas = arestas
self.vertices = []
# Preenche lista de vertices, sendo cada vertice composto
# de uma lista de vertices destino e se este já foi visitado
for vertice in range(self.num_vertices):
vertice_formato = {
"destino": [],
"visitado": False
}
self.vertices.append(vertice_formato)
def adiciona_aresta(self, origem, destino):
"""
Adiciona aresta para lista.
`param` origem: valor do vertice origem
`param` destino: valor do vertice destino
"""
# Cria a aresta de origin->destino e destino->origem
self.vertices[origem]["destino"].append(destino)
self.vertices[destino]["destino"].append(origem)
def set_visitado(self, index):
"""
Modifica o status de modificado para True
`param` index: indice do vertice na lista de vertices
"""
self.vertices[index]["visitado"] = True
def visitado(self, index):
"""
Retorna o status de visitado do vertice
`param` index: indice do vertice no grafo
"""
return self.vertices[index]["visitado"]
def len_destino(self, index):
"""
Retorna a quantidade de vértices ligadas ao vértice desejado
`param` index: indice do vertice no grafo
"""
return len(self.vertices[index]["destino"])
def destino(self, index):
"""
Retorna a lista de vértices ligados ao vértice desejado
`param` index: indice do vertice no grafo
"""
return self.vertices[index]["destino"]
#--------------------------CONSTANTE--------------------------
# Define valor asc referente a letra a
valor_A = ord("a")
#--------------------------FUNCOES--------------------------
def pathR(grafo, index, componente_conexa):
"""
Realiza a busca em profundidade e acha uma componente conexa
`param` grafo: grafo em que será feita a busca
`param` index: indice do vertice no grafo
`param` componente_conexa: lista vazia que será preenchida com a componente conexa
"""
# Verifica primeiro se o vertice daquele indice foi visitado
if not grafo.visitado(index):
# Adiciona a letra (vertice) para a lista da componente conexa
componente_conexa.append(chr(valor_A + index))
grafo.set_visitado(index)
# Chama recursivamente a função para todos os vértices ligados a este
for i in grafo.destino(index):
componente_conexa = pathR(grafo, i, componente_conexa)
return componente_conexa
#--------------------------MAIN--------------------------
if __name__ == "__main__":
# Leitura da entrada e insercao dos vertices nos grafos
testes = int(input())
for i in range(testes):
num_vertice, num_arestas = list(map(int,input().split()))
grafo = Grafo(num_vertice, num_arestas)
# Le todas as arestas e preenche o grafo
for _ in range(num_arestas):
origem, destino = list(map(ord,input().split()))
id_origem, id_destino = origem - valor_A, destino - valor_A
grafo.adiciona_aresta(id_origem, id_destino)
print(f"Case #{i+1}:")
contador = 0
# Chama a função pathR para cada vértice do grafo
for i in range(num_vertice):
componente_conexa = pathR(grafo, i, [])
# Caso a componente conexa não esteja vazia, ordena e imprime a lista
if len(componente_conexa):
contador += 1
componente_conexa.sort()
print(*componente_conexa, "", sep=",")
print(f"{contador} connected components", end="\n\n")
|
'''
Created on Nov 6, 2013
@author: agreen
This module is used by the cubing_tests module as a data store.
'''
enabled = True
class DAR:
xfibre_pos = False
yfibre_pos = False
|
class Field(object):
def __init__(self, name=None, default=None, data_type=None):
self.name = name
self.default = default
self.required = self.default is None
self.type = data_type
def build(self):
result = {key: value for key, value in self.__dict__.items() if value is not None}
if self.name is not None:
del result["name"]
result = {self.name: result}
return result
class MultiField(object):
def __init__(self, fields, name=None):
self.fields = fields
self.name = name
def build(self):
result = {}
for i in self.fields:
result.update(i.build())
if self.name is None:
return result
else:
return {self.name: result}
class TypeField(Field):
data_type = None
def __init__(self, name=None, default=None):
super().__init__(name=name, default=default, data_type=self.data_type)
class IntegerField(TypeField):
data_type = "integer"
class FloatField(TypeField):
data_type = "float"
class StringField(TypeField):
data_type = "string"
class BooleanField(TypeField):
data_type = "boolean"
class ListField(object):
def __init__(self, name, field=None):
self.name = name
if field is None:
self.field = StringField()
else:
self.field = field
def build(self):
return {self.name: [self.field.build()]}
|
COLORS = dict([
('CLEANUP', '\033[94m'),
('CREATE', '\033[92m'),
('INSTALL', '\033[92m'),
('SKIP', '\033[93m'),
('FAIL', '\033[31m'),
('DEFAULT', '\033[39m'),
('UNDEFINED', '\033[37m'),
('STATUS', '\033[36m')
])
def typed_message(message, message_type=None):
color = COLORS.setdefault(message_type, COLORS['UNDEFINED'])
tagged_type = "%s[%s] ..." % (color, message_type)
print("%26s %s %s" % (tagged_type, COLORS['DEFAULT'], message))
|
#
# MIT License
#
# Copyright (c) 2018-2020 Franck Nijhof
# Copyright (c) 2020 Andrey "Limych" Khrolenok
#
# 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.
"""
Community Hass.io Add-ons Repository Updater.
Reads remote add-on repositories, determines versions and generates
changelogs to update the add-on repository fully automated.
Mainly used by the Community Home Assistant Add-ons project.
Please note, this program cannot be used with the general documented
Home Assistant add-on repository approach.
"""
__version__ = "0.5.2"
APP_NAME = "hassio-repo-updater"
APP_FULL_NAME = "Community Hass.io Add-ons Repository Updater"
APP_VERSION = __version__
APP_DESCRIPTION = __doc__
__author__ = "Andrey Khrolenok"
__email__ = "andrey@khrolenok.ru"
__copyright__ = "Copyright 2020, Andrey Khrolenok; 2018-2020, Franck Nijhof"
__license__ = "MIT"
__url__ = "https://github.com/Limych/repository-updater"
__download__ = (
"https://github.com/Limych/repository-updater/archive/" + __version__ + ".tar.gz"
)
__keywords__ = [
"hassio",
"hass.io",
"addons",
"repository",
"home assistant",
"home-assistant",
"add-ons",
"limych",
]
|
# Принимает параметр U, например, [1,2,3,4,5,6,7,8,9,10,11]
# Принимает параметр A, например, [1,3,4,7]
# Возвращает сгенерированную маску A: [1,0,1,1,0,0,1,0,0,0,0]
def generateMask(U, A):
maskA = []
for i in range(len(U)):
maskA.append(0)
for i in range(len(U)):
for j in range(len(A)):
if U[i] == A[j]:
maskA[i] = 1
return maskA
|
class Solution:
def reverse(self, x: int) -> int:
rev = 0
y = abs(x)
while y:
rev = rev*10 + y % 10
y //= 10
sign = -1 if x < 0 else 1
if(rev > 0x7fffffff):
return 0
return sign * rev
|
greater = 0
less = 0
for c in range (1,6):
weight = float (input (f'Insert the weight of {c} º person '))
if c == 1:
greater = weight
less = weight
else:
if weight > greater:
greater = weight
if weight < less:
less = weight
print (f'The biggest weight was {greater} kg ')
print (f'The smallest weight was {less} kg ')
|
# {}
d = dict()
# {'a': 1, 'test': 'Monday', 'abc': 3}
d1 = dict(a=1, test='Monday', abc=3)
print(d)
print(d1)
# {'one': 1, 'two': 2, 'three': 3} 可迭代对象方式来构造字典
d3 = dict([('one', 1), ('two', 2), ('three', 3)])
print(d3)
# {'one': 1, 'two': 2, 'three': 3, 4: 4} 映射函数方式来构造字典
d4 = dict(zip(['one', 'two', 'three', 4], [1, 2, 3, 4, 5555]))
print(d4)
|
"""Unit tests configuration."""
pytest_plugins = [
"tests.fixtures.aws",
"tests.fixtures.click"
]
|
# device present global variables
DS3231_Present = False
BMP280_Present = False
AM2315_Present = False
ADS1015_Present = False
ADS1115_Present = False
|
__title__ = 'xmind2testcase2021'
__description__ = 'xmind2testcase2021基于Python实现,提供了一个高效测试用例设计的解决方案!'
__keywords__ = 'xmind2testcase2021, testcase, test, testing, xmind, 思维导图, XMind思维导图',
__url__ = 'https://pypi.org/project/xmind2testcase2021/1.0.3/'
__author__ = 'Devin'
__author_email__ = 'lovpuss@163.com'
__version__ = '1.0.3'
__license__ = 'MIT'
__cake__ = u'\u2728 \U0001f370 \u2728'
|
ObjectId = int
class Object:
def __init__(self, id_):
self.id: ObjectId = id_
self.count = 1
self.neighbors = {self}
@property
def neighbor_count(self):
return sum([neighbor.count for neighbor in self.neighbors])
def __repr__(self):
return f'{self.id}_'
|
# Linear search algorithm
# @ra1ski
def linear_search(item, _list):
index = None
for idx, val in enumerate(_list):
if val == item:
index = idx
break
return index
if __name__ == '__main__':
_list = ['chrome', 'firefox', 'opera', 'ie', 'netscape']
item = input('Type browser name:')
foundIndex = linear_search(item, _list)
if foundIndex is not None:
print('Item is in the list. Index: %d. Iterations: %d' % (foundIndex, foundIndex))
else:
_list.append(item)
print('Item is not in the list, but we appened it for you', _list)
|
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 16:33:43 2019
@author: Steve Bremer
"""
STATE = 0
HISTORY = 1
SCORE = 2
class ConvolutionalCode():
def __init__(self, gen_poly):
if len(gen_poly) > 0:
poly_len = len(gen_poly[0])
else:
# Raise an error?
poly_len = 0
for poly in gen_poly:
if poly_len != len(poly):
# Raise an error; generator polys not of same length
return
self.n = len(gen_poly)
self.constraint = poly_len - 1
self.state = '0'*self.constraint
self.generators = gen_poly
def poly_mult(self, a, b):
if len(a) != len(b):
#raise an error
return
result = 0
for i, bit in enumerate(a):
bit = int(bit)*int(b[i])
result = (result + bit)%2
return str(result)
def shift_state(self, bit):
self.state = bit + self.state[:-1]
def encode(self, bitstream):
self.state = '0'*self.constraint #reset init state
output = ''
for bit in bitstream:
stream = bit + self.state
for generator in self.generators:
output += (self.poly_mult(stream, generator))
self.shift_state(bit)
return output
def encode_from_state(self, state, bit):
stream = bit + state
output = ''
for generator in self.generators:
output += (self.poly_mult(stream, generator))
return output
def decode(self, bitstream):
rate = self.n
prev_state = []
score = []
# states (state, history, score)
states =[('0'*self.constraint,'',0)]
for i in range(0, len(bitstream), rate):
rx_symbol = bitstream[i:i+rate]
next_step = []
for prev_state in states:
# next bit 0
next_state = '0' + prev_state[STATE][:-1]
symbol = self.encode_from_state(prev_state[STATE], '0')
history = prev_state[HISTORY] + '0'
score = prev_state[SCORE] + self.__hamming_dist__(symbol, rx_symbol)
next_step.append((next_state, history, score))
# next bit 1
next_state = '1' + prev_state[STATE][:-1]
symbol = self.encode_from_state(prev_state[STATE], '1')
history = prev_state[HISTORY] + '1'
score = prev_state[SCORE] + self.__hamming_dist__(symbol, rx_symbol)
next_step.append((next_state, history, score))
states = next_step[:]
# Prune the trellis; remove worst score path for each state
states = self.__prune_trellis__(states)
# Find the best scoring path
score = states[0][SCORE]
best = states[0][HISTORY]
for item in states:
if item[SCORE] < score:
score = item[SCORE]
best = item[HISTORY]
return best
def __prune_trellis__(self, trellis):
# trellis -> (state, history, score)
new_trellis = []
considered_states = []
for i, item in enumerate(trellis):
compared = 0
if item[STATE] not in considered_states:
considered_states.append(item[STATE])
else:
continue
for j in range(i+1, len(trellis)):
comp_item = trellis[j]
if item[STATE] == comp_item[STATE]:
compared = 1
if item[SCORE] < comp_item[SCORE]:
new_trellis.append(item)
# we don't consider case where the two paths are equal
# currently choose the latter path
else:
new_trellis.append(comp_item)
if compared == 0:
new_trellis.append(item)
return(new_trellis)
def __hamming_dist__(self, a, b):
count = 0
for i, bita in enumerate(a):
if bita != b[i]:
count += 1
return count
|
city = input("Enter the name of the city: ")
sales = float(input("Enter the percentage of sales: "))
commission = 0
if 0 <= sales <= 500:
if city == "Sofia":
commission = 0.05
elif city == "Varna":
commission == 0.045
elif city == "Plovdiv":
commission == 0.055
elif 500 < sales <= 1000:
if city == "Sofia":
commission = 0.07
elif city == "Varna":
commission == 0.075
elif city == "Plovdiv":
commission == 0.08
elif 1000 < sales <= 10000:
if city == "Sofia":
commission = 0.08
elif city == "Varna":
commission == 0.1
elif city == "Plovdiv":
commission == 0.12
elif sales > 10000:
if city == "Sofia":
commission = 0.12
elif city == "Varna":
commission == 0.13
elif city == "Plovdiv":
commission == 0.145
if commission == 0:
print("error")
else:
total_sum = sales * commission
print(f"{total_sum:.2f}")
|
def get_dotted_mask_split(ip_address_mask_cidr):
p = int(ip_address_mask_cidr)
ip_address_mask_dotted_split = []
for i in range(4):
if p >= 0:
if p - 8 >= 0:
ip_address_mask_dotted_split.append('255')
p -= 8
else:
byte = 256 - pow(2, 8 - p)
byte_str = str(byte)
ip_address_mask_dotted_split.append(byte_str)
p -= 8
else:
ip_address_mask_dotted_split.append('0')
return ip_address_mask_dotted_split
|
#!/usr/bin/python
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
class Tree:
def __init__(self):
self.root = None
@property
def root_node(self):
return self.root
def add(self, value):
if self.root is None:
self.root = Node(value)
else:
self._add(value, self.root)
def _add(self, value, node):
if value < node.value:
if node.left is not None:
self._add(value, node.left)
else:
node.left = Node(value)
else:
if node.right is not None:
self._add(value, node.right)
else:
node.right = Node(value)
def find(self, value):
if self.root is not None:
return self._find(value, self.root)
else:
return None
def _find(self, value, node):
if value == node.value:
return node
elif value < node.value and node.left is not None:
self._find(value, node.left)
elif value > node.value and node.right is not None:
self._find(value, node.right)
def rebalance_tree(self):
if self.root is None:
return
tree_list = self.get_tree_values()
new_tree = Tree()
self._rebalance_tree(tree_list, new_tree)
self.root = new_tree.root
def _rebalance_tree(self, tree_list, new_tree):
# find the middle.
if len(tree_list) == 0:
return
tree_middle = int(len(tree_list) / 2)
print("Tree list : {}, Tree middle: {}".format(tree_list, tree_middle))
new_tree.add(tree_list[tree_middle - 1])
new_tree.add(tree_list[tree_middle])
new_tree.print_tree()
# make 2 lists, one for left and right.
if len(tree_list) <= 2:
return
tree_list_left = tree_list[0:tree_middle - 1]
tree_list_right = tree_list[tree_middle:len(tree_list) + 1]
self._rebalance_tree(tree_list_left, new_tree)
self._rebalance_tree(tree_list_right, new_tree)
def compare_tree(self, tree_to_compare):
if self.root is None and tree_to_compare.root is None:
return True
return self._compare_tree(self.root, tree_to_compare.root)
def _compare_tree(self, node1, node2):
if self._compare_node(node1, node2) is False:
return False
if node1.right:
if self._compare_tree(node1.right, node2.right) is False:
return False
if node1.left:
if self._compare_tree(node1.left, node2.left) is False:
return False
return True
@staticmethod
def _compare_node(node1, node2):
if node1 is None and node2 is None:
return True
if node1 is None or node2 is None:
return False
if node1.value != node2.value:
return False
if (node1.right is None) != (node2.right is None):
return False
if (node1.left is None) != (node2.left is None):
return False
return True
def delete_tree(self):
# garbage collector will do this for us.
self.root = None
def print_tree(self):
if self.root is not None:
tree_values = self.get_tree_values()
print("Tree: {}".format(tree_values))
else:
print("Tree is empty")
def get_tree_values(self):
tree_list = []
if self.root is not None:
self._get_tree_values(self.root, tree_list)
return tree_list
def _get_tree_values(self, node, tree_list):
if node is not None:
self._get_tree_values(node.left, tree_list)
tree_list.append(node.value)
self._get_tree_values(node.right, tree_list)
|
#Conor O'Riordan
# Write a program that asks the user to input any positive integer and outputs the successive values of the following calculation.
# At each step calculate the next value by taking the current value and
# if it is even, divide it by two, but if it is odd, multiply it by three and add one.
# Have the program end if the current value is one.
#Version includes print text to describe number input
#Version includes print text to describe number output
#Enter positive number
pos_int = int(input("Please enter a positive integer:"))
#While Loop
#If Statement to calculate based on Odd or Even Number
while pos_int > 1:
if pos_int % 2 == 0:
print(round(pos_int),"is even so divide by two. This gives:",round(pos_int/2))
pos_int = pos_int/2
else:
print(round(pos_int),"is odd so multiply by three and add one. This gives:",round((pos_int*3)+1))
pos_int = (pos_int*3)+1
#Prints when program completes
print("We have now reached",round(pos_int),"!!!! Programme completed")
#Version with print text
|
IMPORTED_METERINGPOINT_DATA = """
{
"result": [
{
"meteringPointId": "571313180400240049",
"typeOfMP": "E18",
"accessFrom": "02/05/2016 00:00:00",
"accessTo": "04/23/2023 00:00:00",
"streetCode": "6595",
"streetName": "Lærkevej",
"buildingNumber": "2",
"floorId": "",
"roomId": "",
"postcode": "7000",
"cityName": "Fredericia",
"citySubDivisionName": "",
"municipalityCode": "607",
"locationDescription": "",
"settlementMethod": "",
"meterReadingOccurrence": "PT15M",
"firstConsumerPartyName": "Mikkel Ræv d. 4.",
"secondConsumerPartyName": "",
"consumerCVR": "",
"dataAccessCVR": "",
"meterNumber": "",
"consumerStartDate": "12/31/2018 23:00:00",
"childMeteringPoints": [
{
"meteringPointId": "571313180400240056",
"parentMeteringPointId": "571313180400240049",
"typeOfMP": "D06",
"meterReadingOccurrence": "PT15M",
"meterNumber": "00120429"
},
{
"meteringPointId": "571313180400240063",
"parentMeteringPointId": "571313180400240049",
"typeOfMP": "D06",
"meterReadingOccurrence": "PT15M",
"meterNumber": "00120429"
}
]
},
{
"meteringPointId": "571313180400240612",
"typeOfMP": "E17",
"accessFrom": "01/07/2016 00:00:00",
"accessTo": "04/23/2023 00:00:00",
"streetCode": "6595",
"streetName": "Lærkevej",
"buildingNumber": "24",
"floorId": "",
"roomId": "",
"postcode": "7000",
"cityName": "Fredericia",
"citySubDivisionName": "",
"municipalityCode": "607",
"locationDescription": "",
"settlementMethod": "D01",
"meterReadingOccurrence": "PT1H",
"firstConsumerPartyName": "Anders And d. 36.",
"secondConsumerPartyName": "",
"consumerCVR": "27071400",
"dataAccessCVR": "27071400",
"meterNumber": "00110048",
"consumerStartDate": "12/31/2018 23:00:00",
"childMeteringPoints": [
{
"meteringPointId": "578040000000000033",
"parentMeteringPointId": "571313180400240612",
"typeOfMP": "D04",
"meterReadingOccurrence": "PT1H",
"meterNumber": "123456789"
}
]
}
]
}
"""
|
#!/usr/bin/python3
# https://practice.geeksforgeeks.org/problems/odd-even-level-difference/1
def getLevelDiff(root):
h = {0: 0, 1: 0}
level = 0
populateDiff(root, level, h)
return h[0]-h[1]
def populateDiff(root, level, h):
if root == None:
return
l = level%2
h[l] += root.data
populateDiff(root.left, level+1, h)
populateDiff(root.right, level+1, h)
|
def BenchmarkNan(df):
"""Replace NaN by Benchmark."""
# Compute the inverse of the distance
distance_inv_df = (1. / df.filter(regex='^distance*', axis=1)).values
# Extract the value at the nearest station
values_df = df.filter(regex='value_*', axis=1)
# Compute the benchmark
numer_df = (distance_inv_df * values_df).sum(axis=1)
denom_df = (distance_inv_df * (values_df != 0)).sum(axis=1)
# Compute the benchmark
benchmark_df = numer_df / denom_df
# Replace Nan value by benchmark
df.fillna(benchmark_df, inplace=True)
return df
|
#
# PySNMP MIB module Vsm-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Vsm-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:35:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint")
dv2, = mibBuilder.importSymbols("DV2-MIB", "dv2")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
iso, NotificationType, Unsigned32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, Gauge32, TimeTicks, ObjectIdentity, Bits, IpAddress, Counter64, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "Unsigned32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "Gauge32", "TimeTicks", "ObjectIdentity", "Bits", "IpAddress", "Counter64", "Counter32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
dv2Vsm = MibIdentifier((1, 3, 6, 1, 4, 1, 251, 1, 1, 47))
class VciInteger(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535)
class VpiInteger(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 255)
class VsmBundle(Integer32):
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 127)
vsmCardCfgTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 1), )
if mibBuilder.loadTexts: vsmCardCfgTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardCfgTable.setDescription('The VSM card configuration table.')
vsmCardCfgTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 1, 1), ).setIndexNames((0, "Vsm-MIB", "vsmCardCfgIndex"))
if mibBuilder.loadTexts: vsmCardCfgTableEntry.setStatus('mandatory')
vsmCardCfgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 0))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardCfgIndex.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardCfgIndex.setDescription('Index for VSM Card Cfg Table')
vsmCardCfgBndlTslotStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardCfgBndlTslotStatus.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardCfgBndlTslotStatus.setDescription('Enables the collection of Bundle and Timeslot status')
vsmLinkTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2), )
if mibBuilder.loadTexts: vsmLinkTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmLinkTable.setDescription('Table for VSM Link configuration')
vsmLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2, 1), ).setIndexNames((0, "Vsm-MIB", "vsmLinkLink"))
if mibBuilder.loadTexts: vsmLinkEntry.setStatus('mandatory')
vsmLinkLink = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmLinkLink.setStatus('mandatory')
if mibBuilder.loadTexts: vsmLinkLink.setDescription('Link Number for Table Entry')
vsmLinkEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 1))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmLinkEnable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmLinkEnable.setDescription("Enable/Disable Link <DETAIL_DESCRIPTION> The user has the ability to enable or disable each of the LIM's links individually.")
vsmLinkEnableStat = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 1), ("wait-for-valid-lim", 3), ("link-not-used", 4), ("error", 5), ("wait-signaling-lim", 6), ("wait-lim-framing", 7), ("wait-frame-bit", 8))).clone('disabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmLinkEnableStat.setStatus('mandatory')
if mibBuilder.loadTexts: vsmLinkEnableStat.setDescription('Link Enable Status <DETAIL_DESCRIPTION> The current status of link depends on a valid lim type, the availability of a link on the LIM and LIM Configuration.')
vsmLinkSigType = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("cas", 2), ("none", 1))).clone('cas')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmLinkSigType.setStatus('mandatory')
if mibBuilder.loadTexts: vsmLinkSigType.setDescription("Enable/Disable Signalling <DETAIL_DESCRIPTION> The user has the ability to enable or disable signalling for each of the LIM's links individually.")
vsmTsCfgTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3), )
if mibBuilder.loadTexts: vsmTsCfgTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgTable.setDescription('The timeslot configuration table.')
vsmTsCfgTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1), ).setIndexNames((0, "Vsm-MIB", "vsmTsCfgLinkNo"), (0, "Vsm-MIB", "vsmTsCfgTsNo"))
if mibBuilder.loadTexts: vsmTsCfgTableEntry.setStatus('mandatory')
vsmTsCfgLinkNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgLinkNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgLinkNo.setDescription('The link number.')
vsmTsCfgTsNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgTsNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgTsNo.setDescription('The timeslot number of the link.')
vsmTsCfgBundleNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 3), VsmBundle().clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgBundleNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgBundleNo.setDescription('The Bundle mapped to this timeslot.')
vsmTsCfgAALTyp = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("aal2", 2), ("aal1", 1))).clone('aal2')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgAALTyp.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgAALTyp.setDescription('AAL type used for timeslot. This must match the AAL type used by the bundle to which this timeslot is assigned.')
vsmTsCfgChanID = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(8, 255)).clone(8)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgChanID.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgChanID.setDescription('The Channel ID (CID) this TS is mapped to. The CID must be unique across AAL2 VCs of an end-to-end connection. AAL2 only. ')
vsmTsCfgCmprssionTyp = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("adpcmG726-32k", 2), ("none", 1))).clone('adpcmG726-32k')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgCmprssionTyp.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgCmprssionTyp.setDescription('The voice compression algorithm being used for the timeslot. AAL2 only.')
vsmTsCfgFaxMdmHndlng = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("auto-disable", 2), ("always-compress", 1))).clone('auto-disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgFaxMdmHndlng.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgFaxMdmHndlng.setDescription('The option to handle Fax/Modem signal. AAL2 only. pass-through: make no change when tone is detected, if compressing then keep compressing.bypass: If compressing and tone detected, attempt to switch to uncompressed')
vsmTsCfgEchoCancel = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(3, 1, 2))).clone(namedValues=NamedValues(("auto-disable", 3), ("enable", 1), ("disable", 2))).clone('auto-disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgEchoCancel.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgEchoCancel.setDescription('Indicate whether echo cancellation is enabled.')
vsmTsCfgSilenceRmvl = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(3, 1, 2))).clone(namedValues=NamedValues(("auto-disable", 3), ("enable", 1), ("disable", 2))).clone('auto-disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgSilenceRmvl.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgSilenceRmvl.setDescription('Allows for the configuration of silence removal. Auto will disable silence removal when a FAX/modem tone is detected. AAL2 only.')
vsmTsCfgIdleDetect = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgIdleDetect.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgIdleDetect.setDescription('Indicate whether idle channel detection is enabled. If disabled this timeslot will always send cells, even when on hook. AAL2 only.')
vsmTsCfgRmtLaw = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(3, 1, 2))).clone(namedValues=NamedValues(("auto", 3), ("u-law", 1), ("a-law", 2))).clone('auto')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgRmtLaw.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgRmtLaw.setDescription("Indicates the remote VSM's companding type. u-law for T1, a-law for E1. Auto means use the same type as the local link.")
vsmTsCfgSignalTyp = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(6, 2, 3, 4, 5, 7, 8, 1))).clone(namedValues=NamedValues(("e-and-m", 6), ("gs-fxo-fxs", 2), ("gs-fxs-fxo", 3), ("ls-fxo-fxs", 4), ("ls-fxs-fxo", 5), ("ssr2", 7), ("plar", 8), ("none", 1))).clone('e-and-m')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgSignalTyp.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgSignalTyp.setDescription('This object specifies the signal type of the timeslot. None is used to turn off signaling to allow for data transport.')
vsmTsCfgSigCndTypNB = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 5, 6, 7))).clone(namedValues=NamedValues(("onhook-A0B0", 1), ("onhook-A0B1", 2), ("offhook-A01B01", 3), ("failure-A1B1", 5), ("failure-A10B1", 6), ("failure-A1B1C1D1", 7))).clone('onhook-A0B0')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgSigCndTypNB.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgSigCndTypNB.setDescription('The object specifies the type of signaling conditioning to narrowband.')
vsmTsCfgSigCndTypATM = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 5, 6, 7))).clone(namedValues=NamedValues(("onhook-A0B0", 1), ("onhook-A0B1", 2), ("offhook-A01B01", 3), ("failure-A1B1", 5), ("failure-A10B1", 6), ("failure-A1B1C1D1", 7))).clone('onhook-A0B0')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgSigCndTypATM.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgSigCndTypATM.setDescription('The object specifies the type of signaling conditioning to ATM.')
vsmTsCfgDataCndTypNB = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 4, 5, 6, 7, 8, 9, 10, 1))).clone(namedValues=NamedValues(("muLaw-0V-7F", 2), ("muLaw-0V-FF", 3), ("aLaw-0V-D5", 4), ("aLaw-0V-54", 5), ("dacs-trbl-E4", 6), ("ctrl-mode-FE", 7), ("cir-oos-36", 8), ("mux-oos-1A", 9), ("user-data-FF", 10), ("none", 1))).clone('muLaw-0V-7F')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgDataCndTypNB.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgDataCndTypNB.setDescription('The object specifies the type of data conditioning to narrowband.')
vsmTsCfgDataCndTypATM = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 4, 5, 6, 7, 8, 9, 10, 1))).clone(namedValues=NamedValues(("muLaw-0V-7F", 2), ("muLaw-0V-FF", 3), ("aLaw-0V-D5", 4), ("aLaw-0V-54", 5), ("dacs-trbl-E4", 6), ("ctrl-mode-FE", 7), ("cir-oos-36", 8), ("mux-oos-1A", 9), ("user-data-FF", 10), ("none", 1))).clone('muLaw-0V-7F')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgDataCndTypATM.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgDataCndTypATM.setDescription('The object specifies the type of data conditioning to ATM.')
vsmTsCfgMulticast = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 1))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgMulticast.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgMulticast.setDescription('Multicast state: disabled = no multicast')
vsmTsCfgOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17))).clone(namedValues=NamedValues(("down", 2), ("up", 1), ("configured", 3), ("inv-cfg", 4), ("aal-mismatch", 5), ("no-more-DSPs", 6), ("inv-CID", 7), ("inv-Lk-no", 9), ("inv-Sil-Det", 10), ("inv-CmpTyp", 11), ("unknown-Lim", 12), ("inv-MCast", 13), ("inv-maxtslot", 14), ("aal1-max-TS", 15), ("inv-MCast-BN", 16), ("non-CAS-link", 17))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsCfgOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgOperStatus.setDescription('The operating status of the timeslot.')
vsmTsCfgAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1, 3))).clone(namedValues=NamedValues(("down", 2), ("up", 1), ("reconfig", 3))).clone('down')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgAdminStatus.setDescription('The administrative status of the timeslot.')
vsmTsCfgValidity = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 3, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("valid", 1), ("invalid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsCfgValidity.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsCfgValidity.setDescription('Set to invalid(2) to delete this row.')
vsmBundleCfgTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4), )
if mibBuilder.loadTexts: vsmBundleCfgTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgTable.setDescription('The configuration table for a Bundle. <DETAIL_DESCRIPTION> A VSM Bundle specifies the service requirements of a virtual channel connection, including AAL type, connection type (pvc,svc), bandwidth and QoS.')
vsmBundleCfgTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1), ).setIndexNames((0, "Vsm-MIB", "vsmBundleCfgNo"))
if mibBuilder.loadTexts: vsmBundleCfgTableEntry.setStatus('mandatory')
vsmBundleCfgNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 1), VsmBundle()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgNo.setDescription('The Bundle number.')
vsmBundleCfgVcVpi = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 2), VpiInteger().clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgVcVpi.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgVcVpi.setDescription('The VPI of the VCC.')
vsmBundleCfgVcVci = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 3), VciInteger().clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleCfgVcVci.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgVcVci.setDescription('The VCI of the VCC. This is the same as the Bundle no. for VSM.')
vsmBundleCfgVcAALTyp = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("aal2", 2), ("aal1", 1))).clone('aal2')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgVcAALTyp.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgVcAALTyp.setDescription('The AAL type used for the Bundle. This must match the AAL type used by the timeslot that is assigned to this bundle.')
vsmBundleCfgMaxTslot = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 120)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgMaxTslot.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgMaxTslot.setDescription('Specify the maximum number of timeslots that will be configured for the bundle. AAL2 only')
vsmBundleCfgVcCDV = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 128)).clone(8)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgVcCDV.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgVcCDV.setDescription('ATM cell delay variation between VSMs (in 125 microsecond intervals) <DETAIL_DESCRIPTION> ATM cell delay variation between VSMs (in 125 microsecond intervals). The maximum programmable value for cell delay variation is 16 milliseconds. Therefore, the greatest number which may be entered in this field is 128 (128 * 125 microsecond units). The default value is 8 (1 millisecond).')
vsmBundleCfgTimerCU = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 20)).clone(4)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgTimerCU.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgTimerCU.setDescription('Maximum amount of time (msec) to hold ATM cell before padding and sending. 0 results in an infinite wait. AAL2 only.')
vsmBundleCfgCESPartialFill = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 47)).clone(47)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgCESPartialFill.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgCESPartialFill.setDescription('Specify the no. of user octets per cell for partial cell fill. AAL1 only.')
vsmBundleCfgVcTyp = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("pvc", 1), ("spvc", 2), ("svc", 3))).clone('pvc')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgVcTyp.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgVcTyp.setDescription('The option to setup VCC.')
vsmBundleCfgTrapCfg = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no-trap", 1), ("state-change", 2))).clone('no-trap')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgTrapCfg.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgTrapCfg.setDescription('State change results in traps sent to the management station.')
vsmBundleCfgOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1, 3, 4, 5, 7, 9, 10, 11))).clone(namedValues=NamedValues(("down", 2), ("up", 1), ("configured", 3), ("inv-cfg", 4), ("aal-mismatch", 5), ("inv-VPI", 7), ("bndl-novc", 9), ("inv-maxtslot", 10), ("inv-VPI-15", 11))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleCfgOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgOperStatus.setDescription('The operating status of the bundle.')
vsmBundleCfgAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1, 3))).clone(namedValues=NamedValues(("down", 2), ("up", 1), ("reconfig", 3))).clone('down')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgAdminStatus.setDescription('The administration status of the bundle.')
vsmBundleCfgValidity = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 4, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("valid", 1), ("invalid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleCfgValidity.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleCfgValidity.setDescription('Set to invalid(2) to delete this row.')
vsmCardStatTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5), )
if mibBuilder.loadTexts: vsmCardStatTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatTable.setDescription('The VSM card status table.')
vsmCardStatTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1), ).setIndexNames((0, "Vsm-MIB", "vsmCardStatIndex"))
if mibBuilder.loadTexts: vsmCardStatTableEntry.setStatus('mandatory')
vsmCardStatIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 0))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatIndex.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatIndex.setDescription('Index for VSM Card Status Table')
vsmCardStatBdType = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 40))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatBdType.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatBdType.setDescription('VSM Hardware type')
vsmCardStatHWSWCompatibility = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 40))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatHWSWCompatibility.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatHWSWCompatibility.setDescription('Hardware Software Compatibility between bin, Basecard & DOC')
vsmCardStatBinPres = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("bin-not-present", 1), ("present", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatBinPres.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatBinPres.setDescription('Indicates presence of vsm.bin file')
vsmCardStatBinRev = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatBinRev.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatBinRev.setDescription('The vsm.bin revision number')
vsmCardStatBdRev = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatBdRev.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatBdRev.setDescription('The Card Hardware Feature Revision')
vsmCardStatDoc1Type = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown-doc-type", 1), ("type-48-channel", 2), ("type-60-channel", 3), ("doc-not-present", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatDoc1Type.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatDoc1Type.setDescription('DOC 1 type supports 48 or 60 channels')
vsmCardStatDoc1TypeRev = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatDoc1TypeRev.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatDoc1TypeRev.setDescription('DOC 1 Hardware Revision')
vsmCardStatDoc2Type = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown-doc-type", 1), ("type-48-channel", 2), ("type-60-channel", 3), ("doc-not-present", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatDoc2Type.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatDoc2Type.setDescription('DOC 2 type supports 48 or 60 channels')
vsmCardStatDoc2TypeRev = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatDoc2TypeRev.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatDoc2TypeRev.setDescription('DOC 2 Hardware Revision')
vsmCardStatLimType = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 5, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("invalid-or-no-lim", 1), ("ds1-dual-signaling-lim", 2), ("ds1-quad-signaling-lim", 3), ("e1-dual-signaling-lim", 4), ("e1-quad-signaling-lim", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmCardStatLimType.setStatus('mandatory')
if mibBuilder.loadTexts: vsmCardStatLimType.setDescription('LIM detected for the VSM card.')
vsmTsStatTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6), )
if mibBuilder.loadTexts: vsmTsStatTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatTable.setDescription('The VSM Timeslot status table.')
vsmTsStatTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1), ).setIndexNames((0, "Vsm-MIB", "vsmTsStatLinkNo"), (0, "Vsm-MIB", "vsmTsStatTSNo"))
if mibBuilder.loadTexts: vsmTsStatTableEntry.setStatus('mandatory')
vsmTsStatLinkNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatLinkNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatLinkNo.setDescription('The Link Number')
vsmTsStatTSNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatTSNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatTSNo.setDescription('The timeslot number of the link.')
vsmTsStatBundleNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 3), VsmBundle()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatBundleNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatBundleNo.setDescription('The Bundle number.')
vsmTsStatXmitBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatXmitBytes.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatXmitBytes.setDescription('Number of bytes which have been transmitted <DETAIL_DESCRIPTION> Only applies to AAL2 operating mode. This object provides the user with a count of the number of bytes which have been transmitted to the service interface.')
vsmTsStatRecvBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatRecvBytes.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatRecvBytes.setDescription('Number of packets which have been reassembled <DETAIL_DESCRIPTION> Only applies to AAL2 operating mode. This object provides the user with a count of the number of AAL2 packets which have been reassembled or played out to the service interface. It excludes packets that were discarded for any reason, including packets that were not used due to being declared misinserted or discarded while the reassembler was waiting to achieve synchronization')
vsmTsStatUnderflows = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatUnderflows.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatUnderflows.setDescription('Number of underflow indications <DETAIL_DESCRIPTION> Only applies to AAL2 operating mode. This object provides the user with a count of the number of underflow indications reported by the DSP to the Maker device (in 2 ms intervals).')
vsmTsStatLostPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatLostPackets.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatLostPackets.setDescription('Number of lost packets <DETAIL_DESCRIPTION> Only applies to AAL2 operating mode. This object provides the user with a count of the number of AAL2 packets which have been detected as lost in the network prior to the destination CES IWF layer processing. The cause of a lost packet is an invalid sequence number.')
vsmTsStatAALType = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("aal2", 2), ("aal1", 1))).clone('aal2')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatAALType.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatAALType.setDescription('AAL type used for timeslot.')
vsmTsStatVCID = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatVCID.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatVCID.setDescription('The number of the CID on which this BC is transmitting')
vsmTsStatCID = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatCID.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatCID.setDescription('The number of the CID assigned to this BC')
vsmTsStatActive = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatActive.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatActive.setDescription('State of Time Slot (Bearer Channel): yes = active; no = not active <DETAIL_DESCRIPTION> Provides the user with the activity mode of each Time Slot individually. A Time Slot is considered active if it is being processed into ATM cells. Examples of active Time Slots: 1) an off-hook voice channel 2) any data channel Example of inactive Time Slot: 1) an on-hook voice channel ')
vsmTsStatDataLnk = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dsp", 1), ("bypass", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatDataLnk.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatDataLnk.setDescription('Indicates whether bearer channel is using DSP or Bypass')
vsmTsStatBlocked = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatBlocked.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatBlocked.setDescription('Indicates whether bearer channel is in blocked mode')
vsmTsStatIdleIdle = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatIdleIdle.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatIdleIdle.setDescription('Indicates whether bearer channel is on-hook or off-hook')
vsmTsStatHold = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatHold.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatHold.setDescription('Indicates whether bearer channel is in hold mode')
vsmTsStatRemoteCompressed = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatRemoteCompressed.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatRemoteCompressed.setDescription('Indicates use of compression algorithm on remote channel <DETAIL_DESCRIPTION> A yes indicates that a compression algorithm is being used on the remote channel data. No indicates that no compression algorithm is being used on remote channel.')
vsmTsStatRemoteSilent = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatRemoteSilent.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatRemoteSilent.setDescription('Indicates whether remote channel is in silent mode or non silent mode <DETAIL_DESCRIPTION> ')
vsmTsStatCompressed = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatCompressed.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatCompressed.setDescription('Indicates use of compression algorithm on local channel <DETAIL_DESCRIPTION> A yes indicates that a compression algorithm is being used on the local channel data. No indicates that no compression algorithm is being used on the local channel.')
vsmTsStatSilent = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatSilent.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatSilent.setDescription('Time Slot Silence Status <DETAIL_DESCRIPTION> Indicates whether local channel is in silent mode (yes) or non silent mode (no)')
vsmTsStatConditioning = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatConditioning.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatConditioning.setDescription('Conditioning status: yes = conditioning; no = not conditioning <DETAIL_DESCRIPTION> Data conditioning is initiated upon the detection of a variety of error situations including, but not limited to, LOS, LOF and AIS.')
vsmTsStatRemoteConditioning = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatRemoteConditioning.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatRemoteConditioning.setDescription('Conditioning status: yes = conditioning; no = not conditioning <DETAIL_DESCRIPTION> Data conditioning is initiated upon the detection of a variety of error situations including, but not limited to, LOS, LOF and AIS.This indicates the remote side is conditioning.')
vsmTsStatRIWF = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatRIWF.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatRIWF.setDescription('Remote interworking function alarm active <DETAIL_DESCRIPTION> ')
vsmTsStatLossofRefresh = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatLossofRefresh.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatLossofRefresh.setDescription("CAS Refresh status: yes = loss of refresh; no = no alarm <DETAIL_DESCRIPTION> This only applies when signalling is configured for the timeslot. When no signalling is configured this defaults to 'no'. When signalling is configured and it is detected that there is no response to the refresh packet, this bit is set to 'yes'. This will result in ATM signalling and data conditioning.")
vsmTsStatCasValuesPDH = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))).clone(namedValues=NamedValues(("a0-b0-c0-d0", 1), ("a0-b0-c0-d1", 2), ("a0-b0-c1-d0", 3), ("a0-b0-c1-d1", 4), ("a0-b1-c0-d0", 5), ("a0-b1-c0-d1", 6), ("a0-b1-c1-d0", 7), ("a0-b1-c1-d1", 8), ("a1-b0-c0-d0", 9), ("a1-b0-c0-d1", 10), ("a1-b0-c1-d0", 11), ("a1-b0-c1-d1", 12), ("a1-b1-c0-d0", 13), ("a1-b1-c0-d1", 14), ("a1-b1-c1-d0", 15), ("a1-b1-c1-d1", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatCasValuesPDH.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatCasValuesPDH.setDescription('Value of A B C D bits being sent from VSM physical interface (PDH side) <DETAIL_DESCRIPTION> Provides a snapshot of the current state of the A B C D signalling bits on the PDH side of the network')
vsmTsStatCasValuesATM = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))).clone(namedValues=NamedValues(("a0-b0-c0-d0", 1), ("a0-b0-c0-d1", 2), ("a0-b0-c1-d0", 3), ("a0-b0-c1-d1", 4), ("a0-b1-c0-d0", 5), ("a0-b1-c0-d1", 6), ("a0-b1-c1-d0", 7), ("a0-b1-c1-d1", 8), ("a1-b0-c0-d0", 9), ("a1-b0-c0-d1", 10), ("a1-b0-c1-d0", 11), ("a1-b0-c1-d1", 12), ("a1-b1-c0-d0", 13), ("a1-b1-c0-d1", 14), ("a1-b1-c1-d0", 15), ("a1-b1-c1-d1", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmTsStatCasValuesATM.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatCasValuesATM.setDescription('Value of A B C D bits being sent from the ATM network <DETAIL_DESCRIPTION> Provides a snapshot of the current state of the A B C D signalling bits on the ATM side of the network')
vsmTsStatReset = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 6, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmTsStatReset.setStatus('mandatory')
if mibBuilder.loadTexts: vsmTsStatReset.setDescription('Set to yes(1) to reset all counters in the Time Slot status table.')
vsmBundleStatTable = MibTable((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7), )
if mibBuilder.loadTexts: vsmBundleStatTable.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatTable.setDescription('The VSM Bundle status table.')
vsmBundleStatTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1), ).setIndexNames((0, "Vsm-MIB", "vsmBundleStatBundleNo"))
if mibBuilder.loadTexts: vsmBundleStatTableEntry.setStatus('mandatory')
vsmBundleStatBundleNo = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 1), VsmBundle()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatBundleNo.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatBundleNo.setDescription('The Bundle number.')
vsmBundleStatXmitCells = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatXmitCells.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatXmitCells.setDescription('The count of the number of AAL2 cells transmitted')
vsmBundleStatRecvCells = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatRecvCells.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatRecvCells.setDescription('The count of cells that have been played out to the PDH link.')
vsmBundleStatPvcActive = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("not-active", 2), ("active", 1))).clone('not-active')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatPvcActive.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatPvcActive.setDescription('Is the PVC on this Bundle active.')
vsmBundleStatAALType = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("aal2", 2), ("aal1", 1))).clone('aal2')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatAALType.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatAALType.setDescription('The AAL type used for the Bundle.')
vsmBundleStatBufUndrflws = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatBufUndrflws.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatBufUndrflws.setDescription('The number of buffer underflows (AAL1 only).')
vsmBundleStatBufOverflows = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatBufOverflows.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatBufOverflows.setDescription('The number of buffer overflows (AAL1 only).')
vsmBundleStatPtrReframes = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatPtrReframes.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatPtrReframes.setDescription('The count of the number of events in which SDT pointer is not where it is expected (AAL1 only). <DETAIL_DESCRIPTION> The count of the number of events in which SDT pointer is not where it is expected (AAL1 only). This counter is 0 for unstructured CES mode')
vsmBundleStatLostCells = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatLostCells.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatLostCells.setDescription('The number of AAL1 cells detected as lost prior to the destination')
vsmBundleStatHdrErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatHdrErrors.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatHdrErrors.setDescription('The count of all AAL1 and AAL2 header errors <DETAIL_DESCRIPTION> The Header Error count represents a sum of start pointer, sequence number and parity errors.')
vsmBundleStatBadCID = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatBadCID.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatBadCID.setDescription('The count of the number of AAL2 cells having a bad CID')
vsmBundleStatAAL2LostCells = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatAAL2LostCells.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatAAL2LostCells.setDescription('The count of the number of lost AAL2 cells <DETAIL_DESCRIPTION> When operating in AAL2 mode, a non-zero count of lost cells is an indication that invalid sequence numbers exist')
vsmBundleStatReset = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vsmBundleStatReset.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatReset.setDescription('Set to yes(1) to reset all counters in the Bundle status table.')
vsmBundleStatConditioning = MibTableColumn((1, 3, 6, 1, 4, 1, 251, 1, 1, 47, 7, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("no", 2), ("yes", 1))).clone('no')).setMaxAccess("readonly")
if mibBuilder.loadTexts: vsmBundleStatConditioning.setStatus('mandatory')
if mibBuilder.loadTexts: vsmBundleStatConditioning.setDescription('Conditioning status: yes = conditioning; no = not conditioning <DETAIL_DESCRIPTION> Data conditioning is initiated upon the detection of any or all of a variety of errors including: no received cell flow, header errors, buffer underflow, buffer overflow, pointer reframes or lost cells.')
mibBuilder.exportSymbols("Vsm-MIB", vsmTsStatUnderflows=vsmTsStatUnderflows, vsmTsStatLossofRefresh=vsmTsStatLossofRefresh, vsmCardStatBdType=vsmCardStatBdType, vsmTsCfgOperStatus=vsmTsCfgOperStatus, vsmCardStatDoc2Type=vsmCardStatDoc2Type, vsmTsCfgDataCndTypNB=vsmTsCfgDataCndTypNB, vsmCardStatHWSWCompatibility=vsmCardStatHWSWCompatibility, vsmCardStatTable=vsmCardStatTable, vsmBundleCfgNo=vsmBundleCfgNo, vsmBundleStatRecvCells=vsmBundleStatRecvCells, VsmBundle=VsmBundle, vsmBundleStatPvcActive=vsmBundleStatPvcActive, vsmTsStatAALType=vsmTsStatAALType, vsmTsStatConditioning=vsmTsStatConditioning, vsmTsStatActive=vsmTsStatActive, vsmBundleCfgTableEntry=vsmBundleCfgTableEntry, vsmLinkSigType=vsmLinkSigType, vsmBundleStatAAL2LostCells=vsmBundleStatAAL2LostCells, vsmCardStatDoc1Type=vsmCardStatDoc1Type, vsmTsStatTableEntry=vsmTsStatTableEntry, vsmBundleStatTable=vsmBundleStatTable, vsmTsCfgIdleDetect=vsmTsCfgIdleDetect, vsmBundleStatHdrErrors=vsmBundleStatHdrErrors, vsmTsStatCasValuesPDH=vsmTsStatCasValuesPDH, vsmTsCfgSilenceRmvl=vsmTsCfgSilenceRmvl, vsmTsCfgTsNo=vsmTsCfgTsNo, vsmBundleCfgMaxTslot=vsmBundleCfgMaxTslot, vsmBundleStatConditioning=vsmBundleStatConditioning, vsmTsStatCID=vsmTsStatCID, vsmTsStatDataLnk=vsmTsStatDataLnk, vsmTsStatBundleNo=vsmTsStatBundleNo, vsmTsCfgSigCndTypNB=vsmTsCfgSigCndTypNB, vsmCardCfgTable=vsmCardCfgTable, vsmBundleCfgVcCDV=vsmBundleCfgVcCDV, vsmTsStatLostPackets=vsmTsStatLostPackets, vsmTsStatIdleIdle=vsmTsStatIdleIdle, vsmCardCfgTableEntry=vsmCardCfgTableEntry, vsmTsCfgAALTyp=vsmTsCfgAALTyp, vsmLinkEnable=vsmLinkEnable, vsmTsStatRIWF=vsmTsStatRIWF, vsmLinkEnableStat=vsmLinkEnableStat, vsmTsStatXmitBytes=vsmTsStatXmitBytes, vsmTsStatRecvBytes=vsmTsStatRecvBytes, vsmLinkTable=vsmLinkTable, vsmBundleStatBadCID=vsmBundleStatBadCID, vsmBundleCfgAdminStatus=vsmBundleCfgAdminStatus, vsmCardCfgBndlTslotStatus=vsmCardCfgBndlTslotStatus, vsmBundleCfgVcVci=vsmBundleCfgVcVci, vsmBundleCfgTimerCU=vsmBundleCfgTimerCU, vsmBundleCfgVcTyp=vsmBundleCfgVcTyp, vsmCardStatBdRev=vsmCardStatBdRev, vsmBundleStatBundleNo=vsmBundleStatBundleNo, vsmBundleCfgVcVpi=vsmBundleCfgVcVpi, vsmBundleStatPtrReframes=vsmBundleStatPtrReframes, vsmBundleCfgOperStatus=vsmBundleCfgOperStatus, vsmTsCfgValidity=vsmTsCfgValidity, vsmCardCfgIndex=vsmCardCfgIndex, vsmTsCfgTableEntry=vsmTsCfgTableEntry, vsmTsStatTSNo=vsmTsStatTSNo, vsmBundleCfgValidity=vsmBundleCfgValidity, vsmCardStatLimType=vsmCardStatLimType, vsmTsStatReset=vsmTsStatReset, vsmTsCfgSignalTyp=vsmTsCfgSignalTyp, vsmBundleStatBufUndrflws=vsmBundleStatBufUndrflws, dv2Vsm=dv2Vsm, vsmTsCfgEchoCancel=vsmTsCfgEchoCancel, vsmTsCfgCmprssionTyp=vsmTsCfgCmprssionTyp, vsmCardStatIndex=vsmCardStatIndex, vsmTsStatBlocked=vsmTsStatBlocked, vsmTsCfgRmtLaw=vsmTsCfgRmtLaw, vsmBundleStatAALType=vsmBundleStatAALType, vsmTsCfgFaxMdmHndlng=vsmTsCfgFaxMdmHndlng, vsmCardStatTableEntry=vsmCardStatTableEntry, VpiInteger=VpiInteger, vsmBundleStatTableEntry=vsmBundleStatTableEntry, vsmTsCfgTable=vsmTsCfgTable, vsmBundleCfgVcAALTyp=vsmBundleCfgVcAALTyp, vsmTsCfgBundleNo=vsmTsCfgBundleNo, vsmTsCfgDataCndTypATM=vsmTsCfgDataCndTypATM, vsmBundleCfgCESPartialFill=vsmBundleCfgCESPartialFill, vsmTsStatVCID=vsmTsStatVCID, vsmBundleCfgTable=vsmBundleCfgTable, vsmBundleStatXmitCells=vsmBundleStatXmitCells, vsmLinkLink=vsmLinkLink, vsmTsStatRemoteCompressed=vsmTsStatRemoteCompressed, vsmCardStatDoc2TypeRev=vsmCardStatDoc2TypeRev, vsmCardStatDoc1TypeRev=vsmCardStatDoc1TypeRev, vsmTsCfgLinkNo=vsmTsCfgLinkNo, vsmTsCfgSigCndTypATM=vsmTsCfgSigCndTypATM, vsmBundleStatLostCells=vsmBundleStatLostCells, vsmBundleStatReset=vsmBundleStatReset, vsmBundleStatBufOverflows=vsmBundleStatBufOverflows, vsmTsCfgAdminStatus=vsmTsCfgAdminStatus, vsmTsStatTable=vsmTsStatTable, vsmTsStatHold=vsmTsStatHold, vsmTsStatRemoteSilent=vsmTsStatRemoteSilent, vsmBundleCfgTrapCfg=vsmBundleCfgTrapCfg, vsmCardStatBinRev=vsmCardStatBinRev, vsmTsStatCompressed=vsmTsStatCompressed, vsmLinkEntry=vsmLinkEntry, VciInteger=VciInteger, vsmTsCfgChanID=vsmTsCfgChanID, vsmTsStatSilent=vsmTsStatSilent, vsmTsStatCasValuesATM=vsmTsStatCasValuesATM, vsmTsCfgMulticast=vsmTsCfgMulticast, vsmTsStatRemoteConditioning=vsmTsStatRemoteConditioning, vsmCardStatBinPres=vsmCardStatBinPres, vsmTsStatLinkNo=vsmTsStatLinkNo)
|
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 8 15:20:24 2018
@author: Charles Yang
"""
|
class Conta:
def __init__(self, numero, titular, saldo, limite):
self._numero = numero
self._titular = titular
self._saldo = saldo
self._limite = limite
def deposita(self, valor):
self._saldo += valor
if valor <= 0:
return 'Não foi possível depositar'
def saca(self, valor):
if self._saldo < valor:
return False
else:
self._saldo -= valor
if valor <= 0:
return 'Não foi possível sacar'
def extrato(self):
print(f'numero: {self._numero} \nsaldo: {self._saldo} ')
def transfere_para(self, destino, valor):
retirou = self.saca(valor)
if retirou is False:
return False
else:
destino.deposita(valor)
def atualiza(self, taxa):
self._saldo += self._saldo * taxa
def __self__(self):
return(
f'Dados da Conta: \nNumero: {self._numero}'
f'\nTitular: {self._titular} \nSaldo: {self._saldo}'
f'\nLimite: {self._limite}'
)
class ContaCorrente(Conta):
def __init__(self, numero, titular, saldo, limite):
super().__init__(numero, titular, saldo, limite)
def atualiza(self, taxa):
self._saldo += self._saldo * taxa * 2
class ContaPoupanca(Conta):
def __init__(self, numero, titular, saldo, limite):
super().__init__(numero, titular, saldo, limite)
def atualiza(self, taxa):
self._saldo += self._saldo * taxa * 3
def deposita(self, valor):
self._saldo += valor - 0.10
"""
if __name__ == '__main__':
conta = Conta('123-4', 'João', 1200.0, 1000.0)
conta2 = Conta('123-5', 'Ian', 250.0, 700.0)
print(conta._titular)
conta.saca(100)
print(conta.__dict__)
conta.deposita(120)
print(conta.__dict__)
conta.transfere_para(conta2, 200)
conta.extrato()
conta2.extrato()
"""
if __name__ == '__main__':
conta1 = Conta('123-4', 'Joao', 1000.0, 5000.0)
conta_corrente1 = ContaCorrente('123-5', 'Jose', 1000.0, 5000.0)
conta_poupanca1 = ContaPoupanca('123-6', 'Maria', 1000.0, 5000.0)
conta1.atualiza(0.01)
conta_poupanca1.atualiza(0.01)
conta_corrente1.atualiza(0.01)
print(conta_corrente1._saldo)
print(conta_poupanca1._saldo)
print(conta1._saldo)
print(conta1)
|
"""
A module with with two list functions.
These functions have been fully implemented.
Author: Walker M. White
Date: April 15, 2019
"""
def sum(lst):
"""
Returns: the sum of all elements in the list
Example: sum([1,2,3]) returns 6
sum([5]) returns 5
Parameter lst: the list to sum
Precondition: lst is a nonempty list of numbers
(either floats or ints)
"""
result = 0 # Accumulator
for x in lst:
result = result+x
return result
def num_ints(lst):
"""
Returns: the number of ints in the list
Example: num_ints([1,2.0,True]) returns 1
Parameter lst: the list to count
Precondition: lst is a list of any mix of types
"""
result = 0 # Accumulator
for x in lst:
if type(x) == int:
result = result+1
return result
|
def camelcase(sentence):
""" Convert sentence to camelCase, for example,
"Display all books"
is converted to "displayAllBooks" """
title_case = sentence.title() # Uppercase first letter of each word
upper_camel_cased = title_case.replace(' ', '') # remove spaces
# Lowercase first letter, join with rest of string
# Slices don't produce index out of bounds errors.
# So this still works on empty strings, strings of length 1
return upper_camel_cased[0:1].lower() + upper_camel_cased[1:]
def display_banner():
""" Display program name in banner """
msg = 'AWSOME camelCaseGenerator PROGRAM'
stars = '*' * len(msg)
print(f'\n {stars} \n {msg} \n {stars}\n')
def instructions():
inst=input('Enter a sentence to convert to camelCase: ')
return inst
def main():
display_banner()
sentence = instructions()
output = camelcase(sentence)
print(output)
if __name__ == '__main__':
main()
|
'''1. Write a Python program to compute the greatest common divisor (GCD) of two positive integers.'''
def lcm(x, y):
if x > y:
z = x
else:
z = y
while(True):
if((z % x == 0) and (z % y == 0)):
lcm = z
break
z += 1
return lcm
print(lcm(4, 6))
print(lcm(15, 17))
#Reference: w3resource
|
for t in range(int(input())):
n = int(input())
L = list(map(int,input().split()))
L.sort()
d = dict()
for i in L:
d[i] = 1
cnt = 0
for i in range(n):
for j in range(i+1,n):
try:
if d[L[i] - (L[j]-L[i])] == 1:
cnt+=1
except:
""
try:
if d[L[j] + (L[j]-L[i])] == 1:
cnt+=1
except:
""
print(cnt // 2)
|
'''
Remove Smallest
'''
t = int(input())
for ll in range(t):
n = int(input())
integers = set(map(int, input().split(' ')))
integers = list(integers)
integers.sort()
for i in range(1,len(integers)):
if abs(integers[i]-integers[i-1]) > 1:
print('NO')
break
else:
print('YES')
|
{
"targets": [
{
"target_name": "test_constructor",
"sources": [ "test_constructor.c" ]
},
{
"target_name": "test_constructor_name",
"sources": [ "test_constructor_name.c" ]
}
]
}
|
"""
True and True -> True otro caso -> False
Con or minimo un True da true
Negacion not(True) -> False
not (False) -> True
1. Not
2. And
3. Or
"""
a = 10
b = 15
c = 20
resultado = ((a > b) and (b < c))
print(resultado)
resultado = ((a > b) or (b < c))
print(resultado)
print(not resultado)
|
#__________________ Script Python - versão 3.8 _____________________#
# Autor |> Abraão A.da Silva
# Data |> 05 de Março de 2021
# Paradigma |> Procedural
# Objetivo |> Calculando média
#___________________________________________________________________#
def recebendo_numeros(arm):
"A função colherá as notas e armazenará em uma lista."
for nota in range(1, 5):
nota = float(input(f'{nota}º Nota: '))
arm.append(nota)
def calculando_media(arm):
"A função calculará a média, interando nota por nota."
soma = 0.0
for nota in arm:
soma += nota
media = (soma / len(arm))
return media
def main():
"Função principal da aplicação"
notas_atuais = []
try:
recebendo_numeros(notas_atuais)
media = calculando_media(notas_atuais)
print('A média do aluno é {}'.format(media))
except Exception:
print('Por gentileza, somente valores numericos!!.')
main()
|
class Logger:
def __init__(self, filepath):
self.filepath = filepath
def write(self, msg):
with open(self.filepath, "a") as logfile:
logfile.write("{}\n".format(msg))
|
'''
contains functions that convenient math stuff, usually involving operations that are not
defined in normal mathematics but could be useful
@author: Klint
'''
# matrix stuff, collapse matrix in interesting ways
def collapse_matrix_cols(matrix: [list])-> list:
'''flatten a matrix by m by n into a array of size m by adding columns together
ie
| a_00 a_10 ... a_m0 |
| a_01 ............. |
| ................. | = [a_00 + a_01 + .. + a_0n, a_10 + a_11 + ... + a_1n, a_m0 + a_m1 + ... + a_mn]
| a_0n ........ a_mn |
'''
to_return = []
size = len(matrix[0])
for j in range(size):
to_append = 0
for i in range(len(matrix)):
assert(len(matrix[i]) == size)
to_append += matrix[i][j]
to_return.append(to_append)
return to_return
def collapse_matrix_rows(matrix: [list])-> list:
'''flatten a matrix by adding rows
'''
to_return = []
for row in matrix:
to_return = sum(row)
return to_return
#
|
def write (name, stream):
stream.write("#include <unico.h>\n")
stream.write("#include <stddef.h>\n")
stream.write("extern int %s (size_t, size_t, unicos*);\n" % name)
|
#! /usr/bin/env python3
# coding: utf-8
# Thanks to imbadatreading, should have through about LCM
def add_step_size(buses):
buses_with_step = list()
for num in range(len(buses)):
if buses[num] != 'x':
buses_with_step.append((int(buses[num]), num))
return buses_with_step
def find_awesome_timestamp(buses):
current_time = 0
lcm = 1
for order_bus in range(len(buses) - 1):
bus = int(buses[order_bus + 1][0])
step = int(buses[order_bus + 1][1])
lcm = lcm * buses[order_bus][0]
print("bus={}/step={}/lcm={}".format(bus, step, lcm))
while ((current_time + step) % bus) != 0:
current_time += lcm
return current_time
def main():
input_file = open('input', 'r')
lines = input_file.readlines()
clean_lines = map(lambda x: x.rstrip("\n"), lines)
print(clean_lines)
buses = add_step_size(list(clean_lines[1].split(',')))
print(buses)
result = find_awesome_timestamp(buses)
print(result)
print("Result: {}".format(result))
if __name__ == '__main__':
main()
|
#!/usr/bin/env python3
f = open("input.txt", "r").read().splitlines()
REGISTERS_MAP = {"w": 0, "x": 1, "y": 2, "z": 3}
def checker(number):
num_str = str(number)
if "0" in num_str:
return False
if len(num_str) != 14:
return False
# Registers are in form [w,x,y,z]
counter = 0
registers = [0] * 4
for line in f:
instr_arr = line.split()
instr = instr_arr[0]
first = instr_arr[1]
if "inp" in instr:
registers[REGISTERS_MAP[first]] = int(num_str[counter])
counter += 1
continue
second = instr_arr[2]
if second in REGISTERS_MAP:
second_val = registers[REGISTERS_MAP[second]]
else:
second_val = int(second)
if "add" in instr:
registers[REGISTERS_MAP[first]] += second_val
elif "mul" in instr:
registers[REGISTERS_MAP[first]] *= second_val
elif "div" in instr:
registers[REGISTERS_MAP[first]] //= second_val
elif "mod" in instr:
registers[REGISTERS_MAP[first]] %= second_val
else:
registers[REGISTERS_MAP[first]] = (
1 if registers[REGISTERS_MAP[first]] == second_val else 0
)
# check valid of z == 0
if registers[REGISTERS_MAP["z"]] == 0:
return True
return False
|
# Crie um programa onde o usuário possa digitar cinco valores numéricos e cadastre-os em uma lista, já na posição correta de inserção (sem usar o sort()). No final, mostre a lista ordenada na tela.
numeros = []
for x in range(0,5):
valor = int(input('Digite valor: '))
# verifica se a lista esta vazia ou se o valor maior que o ultimo elemento
if x == 0 or valor > numeros[-1]:
numeros.append(valor)
print('Valor inserido ao final da lista...')
else:
# Varre a lista, enquanto o valor maior, se valor menor igual acrescentar na posição de aux
aux = 0
while aux < len(numeros):
if valor <= numeros[aux]:
numeros.insert(aux, valor)
print(f'Valor inserido na posição {aux} da lista...')
break
aux += 1
print('='*30)
print(f'Os valores ordenados são {numeros}')
'''for x in range(0,5):
for y in range(x+1,5):
if numeros[x] > numeros[y]:
aux = numeros[x]
numeros[x] = numeros[y]
numeros[y] = aux'''
|
"""This module loads the monkeypatch from gevent and applies it.
Nothing fancy, but it's useful and more readable to put this in a separate
module and give and explicit name to it.
"""
# Re-add sslwrap to Python 2.7.9
# import socket
# __getaddrinfo = socket.getaddrinfo
#
# # kudos to http://stackoverflow.com/a/13214222/597097
# def getaddrinfo(*args):
# return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
#
# socket.getaddrinfo = getaddrinfo
|
# bunch of color constants
class Color:
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
BLUE = (0, 128, 255)
GREEN = (0, 153, 0)
YELLOW = (255, 255, 0)
BROWN = (204, 102, 0)
PINK = (255, 102, 178)
PURPLE = (153, 51, 255)
GREY = (128, 128, 128)
colors = {
1: WHITE,
2: YELLOW,
3: RED,
4: BLUE,
5: GREEN,
6: BLACK,
7: BROWN,
8: PINK,
9: PURPLE,
10: GREY
}
|
VERSION = "0.2"
if __name__ == '__main__':
print(VERSION)
|
class NumMatrix:
def __init__(self, matrix: List[List[int]]):
if not matrix:
return
self.presum = [[0] * (1 + len(matrix[0])) for _ in range(1 + len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
self.presum[i + 1][j + 1] = self.presum[i][j + 1] + self.presum[i + 1][j] - self.presum[i][j] + matrix[i][j]
def sumRegion(self, row1: int, col1: int, row2: int, col2: int) -> int:
return self.presum[row2 + 1][col2 + 1] - self.presum[row1][col2 + 1] - self.presum[row2 + 1][col1] + self.presum[row1][col1]
# Your NumMatrix object will be instantiated and called as such:
# obj = NumMatrix(matrix)
# param_1 = obj.sumRegion(row1,col1,row2,col2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.