content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
|---|---|
# by Kami Bigdely
# Replace magic numbers with named constanst
def calculation(charge1, charge2, distance):
constant = 8.9875517923*1e9
return constant * charge1 * charge2 / (distance**2)
# First Section
# Given two point charges, calcualte the electric force exerted on them.
q1 = int(input('Enter a value of charge q1: '))
q2 = int(input('Enter a value of charge q2: '))
distance = int(input("Enter the distance be10tween two charges: "))
print("Electric Force between q1 and q2 is: ",calculation(q1, q2, distance), "Newton")
# Second Section
num = int(input('Enter an integer number: '))
if num % 2 == 0:
print(num, "is an even number.")
else:
print(num, "is an odd number.")
|
def calculation(charge1, charge2, distance):
constant = 8.9875517923 * 1000000000.0
return constant * charge1 * charge2 / distance ** 2
q1 = int(input('Enter a value of charge q1: '))
q2 = int(input('Enter a value of charge q2: '))
distance = int(input('Enter the distance be10tween two charges: '))
print('Electric Force between q1 and q2 is: ', calculation(q1, q2, distance), 'Newton')
num = int(input('Enter an integer number: '))
if num % 2 == 0:
print(num, 'is an even number.')
else:
print(num, 'is an odd number.')
|
class IDataset(object):
def __init__(self):
pass
def train(self):
raise RuntimeError("No implementation found!")
def val(self):
raise RuntimeError("No implementation found!")
def test(self):
raise RuntimeError("No implementation found!")
|
class Idataset(object):
def __init__(self):
pass
def train(self):
raise runtime_error('No implementation found!')
def val(self):
raise runtime_error('No implementation found!')
def test(self):
raise runtime_error('No implementation found!')
|
class A:
def z(self):
return self
def y(self, t):
return len(t)
#Funcion que abriremos desde el archivo main.py
def main_puzzle():
a = A
y = a.z
print(y(a)) #Muestra por pantalla <class '__main__.A'> ya que la funcion z devuelve self
aa = a()
print(aa is a()) #Imprime False ya que esta condicion no es cierta
z = aa.y
print(z(())) #Devuelve 0 ya que no hemos introducido valores dentro de len ---> len()
print(a().y((a,))) #Devuelve len(a,), es decir, 1
print(A.y(aa, (a,z))) #Devuelve len(a,z), que es igual a 2 ya que (a,z) tiene 2 elementos
print(aa.y((z,1,'z'))) #Devuelve len(z,1,'z'), que es 3 ya que tiene 3 elementos
|
class A:
def z(self):
return self
def y(self, t):
return len(t)
def main_puzzle():
a = A
y = a.z
print(y(a))
aa = a()
print(aa is a())
z = aa.y
print(z(()))
print(a().y((a,)))
print(A.y(aa, (a, z)))
print(aa.y((z, 1, 'z')))
|
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
class solution:
def maxProfit(prices:list[int])->int:
pricesSize = len(prices)
dp_sell_out = []
dp_sell_with = []
dp_buy = []
#current action is not selling, next step could be buying
dp_sell_out.append(0)
# current action is selling, next step must be cooldown
dp_sell_with.append(0)
# make sure last action is buying
dp_buy.append(-prices[0])
for i in range(1,pricesSize):
dp_sell_out.append(max(dp_sell_out[i-1],dp_sell_with[i-1]))
dp_sell_with.append(dp_buy[i-1]+prices[i])
dp_buy.append(max(dp_buy[i-1],dp_sell_out[i-1]-prices[i]))
return max(dp_sell_out[pricesSize-1],dp_sell_with[pricesSize-1])
|
class Solution:
def max_profit(prices: list[int]) -> int:
prices_size = len(prices)
dp_sell_out = []
dp_sell_with = []
dp_buy = []
dp_sell_out.append(0)
dp_sell_with.append(0)
dp_buy.append(-prices[0])
for i in range(1, pricesSize):
dp_sell_out.append(max(dp_sell_out[i - 1], dp_sell_with[i - 1]))
dp_sell_with.append(dp_buy[i - 1] + prices[i])
dp_buy.append(max(dp_buy[i - 1], dp_sell_out[i - 1] - prices[i]))
return max(dp_sell_out[pricesSize - 1], dp_sell_with[pricesSize - 1])
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
curr_node = head
curr_new = new_head = ListNode(0)
prev = None
while curr_node:
if curr_node.val >= x:
if prev:
prev.next = curr_node.next
curr_new.next = curr_node
curr_node = curr_node.next
curr_new = curr_new.next
curr_new.next = None
else:
curr_new.next = temp = curr_node
head = curr_node = curr_node.next
temp.next = None
curr_new = curr_new.next
elif curr_node.val < x:
prev = curr_node
curr_node = curr_node.next
if prev:
prev.next = new_head.next
else:
return new_head.next
return head
|
class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def partition(self, head: ListNode, x: int) -> ListNode:
curr_node = head
curr_new = new_head = list_node(0)
prev = None
while curr_node:
if curr_node.val >= x:
if prev:
prev.next = curr_node.next
curr_new.next = curr_node
curr_node = curr_node.next
curr_new = curr_new.next
curr_new.next = None
else:
curr_new.next = temp = curr_node
head = curr_node = curr_node.next
temp.next = None
curr_new = curr_new.next
elif curr_node.val < x:
prev = curr_node
curr_node = curr_node.next
if prev:
prev.next = new_head.next
else:
return new_head.next
return head
|
# This program subtracts one number from another
# Author: Isabella Doyle
first = int(input("Enter the first number:")) # requests input of integer from user
second = int(input("Enter the second number:")) # requests input of integer from user
# prints sum below
print(first - second)
|
first = int(input('Enter the first number:'))
second = int(input('Enter the second number:'))
print(first - second)
|
def test_get_uptimez(client):
response = client.get("/uptimez/")
assert response.status_code == 200
def test_get_healthz(client):
response = client.get("/healthz/")
assert response.status_code == 200
|
def test_get_uptimez(client):
response = client.get('/uptimez/')
assert response.status_code == 200
def test_get_healthz(client):
response = client.get('/healthz/')
assert response.status_code == 200
|
print("Hello world")
print("Adios")
def suma(a,b):
return a+b
print(suma(2,3))
print("Esto es una feature")
|
print('Hello world')
print('Adios')
def suma(a, b):
return a + b
print(suma(2, 3))
print('Esto es una feature')
|
t = int(input())
for _ in range(t) :
n, k = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if(k > arr[0]) :
print(abs(k-arr[0]))
else :
print(0)
|
t = int(input())
for _ in range(t):
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
if k > arr[0]:
print(abs(k - arr[0]))
else:
print(0)
|
# -*- coding: utf-8 -*-
"""
stocks_correlation.providers.quandl
This module define the normalized columns
of the DataFrame the providers return
"""
DATAFRAME_COLUMNS = ['date', 'open', 'high', 'low', 'close']
CORREL_COMPUTE_COLUMNS = DATAFRAME_COLUMNS[1:]
def filter_dates(df, start_date, end_date):
"""Filters the DataFrame so that all ticks are
between start_date and end_date"""
return df[(df['date'] >= start_date) & (df['date'] <= end_date)]
|
"""
stocks_correlation.providers.quandl
This module define the normalized columns
of the DataFrame the providers return
"""
dataframe_columns = ['date', 'open', 'high', 'low', 'close']
correl_compute_columns = DATAFRAME_COLUMNS[1:]
def filter_dates(df, start_date, end_date):
"""Filters the DataFrame so that all ticks are
between start_date and end_date"""
return df[(df['date'] >= start_date) & (df['date'] <= end_date)]
|
a = int(input("Enter the First Number: "))# Inputing the first number
b = int(input("Enter the seconf Number: "))#inputing the second number
if(a>=b):#cheking if the first
print(a, "is greater")
else:
print(b, "is greater")
|
a = int(input('Enter the First Number: '))
b = int(input('Enter the seconf Number: '))
if a >= b:
print(a, 'is greater')
else:
print(b, 'is greater')
|
__name__ = "pairwisedist"
__author__ = """Guy Teichman"""
__email__ = "guyteichman@gmail.com"
__version__ = "1.1.0"
__license__ = "Apache"
|
__name__ = 'pairwisedist'
__author__ = 'Guy Teichman'
__email__ = 'guyteichman@gmail.com'
__version__ = '1.1.0'
__license__ = 'Apache'
|
"""
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words,
find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers
as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
"""
def solution(integers):
"""Sorting the sequence in place and search the minimal positive integer required."""
integers.sort()
min = integers[0]
for integer in integers:
if min > 0 and integer > min + 1:
return min + 1
else:
min = integer
return min + 1
|
"""
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words,
find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers
as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
"""
def solution(integers):
"""Sorting the sequence in place and search the minimal positive integer required."""
integers.sort()
min = integers[0]
for integer in integers:
if min > 0 and integer > min + 1:
return min + 1
else:
min = integer
return min + 1
|
MAJOR = 1
MINOR = 11
RELEASE = 10
VERSION = '%d.%d.%d' % (MAJOR, MINOR, RELEASE)
def num(versionstring=VERSION):
"""Convert the version string of the form 'X.Y.Z' to an integer 100000*X + 100*Y + Z for version comparison"""
(major, minor, release) = versionstring.split('.')
return 100*100*int(major) + 100*int(minor) + int(release)
def split(versionstring):
"""Split the version string 'X.Y.Z' and return tuple (int(X), int(Y), int(Z))"""
assert versionstring.count('.') == 2, "Version string must be of the form str('X.Y.Z')"
return tuple([int(x) for x in versionstring.split('.')])
def major(versionstring=VERSION):
"""Return the major version number int(X) for versionstring 'X.Y.Z'"""
return split(versionstring)[0]
def minor(versionstring=VERSION):
"""Return the minor version number int(Y) for versionstring 'X.Y.Z'"""
return split(versionstring)[1]
def release(versionstring=VERSION):
"""Return the release version number int(Z) for versionstring 'X.Y.Z'"""
return split(versionstring)[2]
def at_least_version(versionstring):
"""Is versionstring='X.Y.Z' at least the current version?"""
return num(VERSION) >= num(versionstring)
def is_at_least(versionstring):
"""Synonym for at_least_version"""
return num(VERSION) >= num(versionstring)
def is_exactly(versionstring):
"""Is the versionstring = 'X,Y.Z' exactly equal to vipy.__version__"""
return versionstring == VERSION
def at_least_major_version(major):
"""is the major version (e.g. X, for version X.Y.Z) greater than or equal to the major version integer supplied?"""
return MAJOR >= int(major)
|
major = 1
minor = 11
release = 10
version = '%d.%d.%d' % (MAJOR, MINOR, RELEASE)
def num(versionstring=VERSION):
"""Convert the version string of the form 'X.Y.Z' to an integer 100000*X + 100*Y + Z for version comparison"""
(major, minor, release) = versionstring.split('.')
return 100 * 100 * int(major) + 100 * int(minor) + int(release)
def split(versionstring):
"""Split the version string 'X.Y.Z' and return tuple (int(X), int(Y), int(Z))"""
assert versionstring.count('.') == 2, "Version string must be of the form str('X.Y.Z')"
return tuple([int(x) for x in versionstring.split('.')])
def major(versionstring=VERSION):
"""Return the major version number int(X) for versionstring 'X.Y.Z'"""
return split(versionstring)[0]
def minor(versionstring=VERSION):
"""Return the minor version number int(Y) for versionstring 'X.Y.Z'"""
return split(versionstring)[1]
def release(versionstring=VERSION):
"""Return the release version number int(Z) for versionstring 'X.Y.Z'"""
return split(versionstring)[2]
def at_least_version(versionstring):
"""Is versionstring='X.Y.Z' at least the current version?"""
return num(VERSION) >= num(versionstring)
def is_at_least(versionstring):
"""Synonym for at_least_version"""
return num(VERSION) >= num(versionstring)
def is_exactly(versionstring):
"""Is the versionstring = 'X,Y.Z' exactly equal to vipy.__version__"""
return versionstring == VERSION
def at_least_major_version(major):
"""is the major version (e.g. X, for version X.Y.Z) greater than or equal to the major version integer supplied?"""
return MAJOR >= int(major)
|
"""
Standardize Mobile Number Using Decorators
https://www.hackerrank.com/challenges/standardize-mobile-number-using-decorators/problem
"""
def wrapper(f):
def fun(l):
# complete the function
for i, n in enumerate(l):
if len(n) == 10: n= "+91" + n
elif len(n) == 11 and n.startswith("0"): n = "+91" + n[1:]
elif len(n) == 12 and n.startswith("91"): n = "+" + n
elif len(n) == 13 and n.startswith("+91"): pass
else: continue
n = n[0:3] + " " + n[3:8] + " " + n[8:]
l[i] = n
return f(l)
return fun
@wrapper
def sort_phone(l):
print(*sorted(l), sep='\n')
if __name__ == '__main__':
l = [input() for _ in range(int(input()))]
sort_phone(l)
|
"""
Standardize Mobile Number Using Decorators
https://www.hackerrank.com/challenges/standardize-mobile-number-using-decorators/problem
"""
def wrapper(f):
def fun(l):
for (i, n) in enumerate(l):
if len(n) == 10:
n = '+91' + n
elif len(n) == 11 and n.startswith('0'):
n = '+91' + n[1:]
elif len(n) == 12 and n.startswith('91'):
n = '+' + n
elif len(n) == 13 and n.startswith('+91'):
pass
else:
continue
n = n[0:3] + ' ' + n[3:8] + ' ' + n[8:]
l[i] = n
return f(l)
return fun
@wrapper
def sort_phone(l):
print(*sorted(l), sep='\n')
if __name__ == '__main__':
l = [input() for _ in range(int(input()))]
sort_phone(l)
|
#returns the set of reachable vertices assuming G is represented via adjacency lists.
# Assumes that the graph is a dictionary and each adjacency list is a set.
def reachable(G,v):
rset = set()
def dfs(w):
rset.add(w)
for ngh in G[w]:
if not (ngh in rset):
dfs(ngh)
return
dfs(v)
return(rset)
G = {}
G[0] = {1,2,3}
G[1] = {0,3}
G[2] = {}
G[3] = {1,4,2}
G[4] = {5,6}
G[5] = {4}
G[7] = {5,6}
G[6] = {5,7}
print(reachable(G,0))
print(reachable(G,1))
print(reachable(G,2))
print(reachable(G,3))
print(reachable(G,4))
print(reachable(G,5))
print(reachable(G,6))
print(reachable(G,7))
|
def reachable(G, v):
rset = set()
def dfs(w):
rset.add(w)
for ngh in G[w]:
if not ngh in rset:
dfs(ngh)
return
dfs(v)
return rset
g = {}
G[0] = {1, 2, 3}
G[1] = {0, 3}
G[2] = {}
G[3] = {1, 4, 2}
G[4] = {5, 6}
G[5] = {4}
G[7] = {5, 6}
G[6] = {5, 7}
print(reachable(G, 0))
print(reachable(G, 1))
print(reachable(G, 2))
print(reachable(G, 3))
print(reachable(G, 4))
print(reachable(G, 5))
print(reachable(G, 6))
print(reachable(G, 7))
|
#
# PySNMP MIB module ADSL-LINE-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADSL-LINE-EXT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:58:27 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)
#
adslAtucPerfDataEntry, adslAturIntervalEntry, adslAtucIntervalEntry, adslLineAlarmConfProfileEntry, adslLineEntry, adslLineConfProfileEntry, adslAturPerfDataEntry, adslMIB = mibBuilder.importSymbols("ADSL-LINE-MIB", "adslAtucPerfDataEntry", "adslAturIntervalEntry", "adslAtucIntervalEntry", "adslLineAlarmConfProfileEntry", "adslLineEntry", "adslLineConfProfileEntry", "adslAturPerfDataEntry", "adslMIB")
AdslPerfPrevDayCount, AdslPerfCurrDayCount = mibBuilder.importSymbols("ADSL-TC-MIB", "AdslPerfPrevDayCount", "AdslPerfCurrDayCount")
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
PerfCurrentCount, PerfIntervalCount = mibBuilder.importSymbols("PerfHist-TC-MIB", "PerfCurrentCount", "PerfIntervalCount")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Gauge32, Integer32, IpAddress, Bits, Counter32, ObjectIdentity, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks, ModuleIdentity, MibIdentifier, Counter64, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "Integer32", "IpAddress", "Bits", "Counter32", "ObjectIdentity", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks", "ModuleIdentity", "MibIdentifier", "Counter64", "iso")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
adslExtMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 10, 94, 3))
adslExtMIB.setRevisions(('2002-12-10 00:00',))
if mibBuilder.loadTexts: adslExtMIB.setLastUpdated('200212100000Z')
if mibBuilder.loadTexts: adslExtMIB.setOrganization('IETF ADSL MIB Working Group')
adslExtMibObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1))
class AdslTransmissionModeType(TextualConvention, Bits):
status = 'current'
namedValues = NamedValues(("ansit1413", 0), ("etsi", 1), ("q9921PotsNonOverlapped", 2), ("q9921PotsOverlapped", 3), ("q9921IsdnNonOverlapped", 4), ("q9921isdnOverlapped", 5), ("q9921tcmIsdnNonOverlapped", 6), ("q9921tcmIsdnOverlapped", 7), ("q9922potsNonOverlapeed", 8), ("q9922potsOverlapped", 9), ("q9922tcmIsdnNonOverlapped", 10), ("q9922tcmIsdnOverlapped", 11), ("q9921tcmIsdnSymmetric", 12))
adslLineExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17), )
if mibBuilder.loadTexts: adslLineExtTable.setStatus('current')
adslLineExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1), )
adslLineEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslLineExtEntry"))
adslLineExtEntry.setIndexNames(*adslLineEntry.getIndexNames())
if mibBuilder.loadTexts: adslLineExtEntry.setStatus('current')
adslLineTransAtucCap = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 1), AdslTransmissionModeType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: adslLineTransAtucCap.setStatus('current')
adslLineTransAtucConfig = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 2), AdslTransmissionModeType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: adslLineTransAtucConfig.setStatus('current')
adslLineTransAtucActual = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 3), AdslTransmissionModeType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: adslLineTransAtucActual.setStatus('current')
adslLineGlitePowerState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("l0", 2), ("l1", 3), ("l3", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: adslLineGlitePowerState.setStatus('current')
adslLineConfProfileDualLite = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 5), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: adslLineConfProfileDualLite.setStatus('current')
adslAtucPerfDataExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18), )
if mibBuilder.loadTexts: adslAtucPerfDataExtTable.setStatus('current')
adslAtucPerfDataExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1), )
adslAtucPerfDataEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslAtucPerfDataExtEntry"))
adslAtucPerfDataExtEntry.setIndexNames(*adslAtucPerfDataEntry.getIndexNames())
if mibBuilder.loadTexts: adslAtucPerfDataExtEntry.setStatus('current')
adslAtucPerfStatFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 1), Counter32()).setUnits('line retrains').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfStatFastR.setStatus('current')
adslAtucPerfStatFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 2), Counter32()).setUnits('line retrains').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfStatFailedFastR.setStatus('current')
adslAtucPerfStatSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 3), Counter32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfStatSesL.setStatus('current')
adslAtucPerfStatUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 4), Counter32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfStatUasL.setStatus('current')
adslAtucPerfCurr15MinFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 5), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr15MinFastR.setStatus('current')
adslAtucPerfCurr15MinFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 6), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr15MinFailedFastR.setStatus('current')
adslAtucPerfCurr15MinSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 7), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr15MinSesL.setStatus('current')
adslAtucPerfCurr15MinUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 8), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr15MinUasL.setStatus('current')
adslAtucPerfCurr1DayFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 9), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr1DayFastR.setStatus('current')
adslAtucPerfCurr1DayFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 10), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr1DayFailedFastR.setStatus('current')
adslAtucPerfCurr1DaySesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 11), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr1DaySesL.setStatus('current')
adslAtucPerfCurr1DayUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 12), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfCurr1DayUasL.setStatus('current')
adslAtucPerfPrev1DayFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 13), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfPrev1DayFastR.setStatus('current')
adslAtucPerfPrev1DayFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 14), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfPrev1DayFailedFastR.setStatus('current')
adslAtucPerfPrev1DaySesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 15), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfPrev1DaySesL.setStatus('current')
adslAtucPerfPrev1DayUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 16), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucPerfPrev1DayUasL.setStatus('current')
adslAtucIntervalExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19), )
if mibBuilder.loadTexts: adslAtucIntervalExtTable.setStatus('current')
adslAtucIntervalExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1), )
adslAtucIntervalEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslAtucIntervalExtEntry"))
adslAtucIntervalExtEntry.setIndexNames(*adslAtucIntervalEntry.getIndexNames())
if mibBuilder.loadTexts: adslAtucIntervalExtEntry.setStatus('current')
adslAtucIntervalFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 1), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucIntervalFastR.setStatus('current')
adslAtucIntervalFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 2), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucIntervalFailedFastR.setStatus('current')
adslAtucIntervalSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 3), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucIntervalSesL.setStatus('current')
adslAtucIntervalUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 4), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAtucIntervalUasL.setStatus('current')
adslAturPerfDataExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20), )
if mibBuilder.loadTexts: adslAturPerfDataExtTable.setStatus('current')
adslAturPerfDataExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1), )
adslAturPerfDataEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslAturPerfDataExtEntry"))
adslAturPerfDataExtEntry.setIndexNames(*adslAturPerfDataEntry.getIndexNames())
if mibBuilder.loadTexts: adslAturPerfDataExtEntry.setStatus('current')
adslAturPerfStatSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 1), Counter32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfStatSesL.setStatus('current')
adslAturPerfStatUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 2), Counter32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfStatUasL.setStatus('current')
adslAturPerfCurr15MinSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 3), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfCurr15MinSesL.setStatus('current')
adslAturPerfCurr15MinUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 4), PerfCurrentCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfCurr15MinUasL.setStatus('current')
adslAturPerfCurr1DaySesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 5), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfCurr1DaySesL.setStatus('current')
adslAturPerfCurr1DayUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 6), AdslPerfCurrDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfCurr1DayUasL.setStatus('current')
adslAturPerfPrev1DaySesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 7), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfPrev1DaySesL.setStatus('current')
adslAturPerfPrev1DayUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 8), AdslPerfPrevDayCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturPerfPrev1DayUasL.setStatus('current')
adslAturIntervalExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21), )
if mibBuilder.loadTexts: adslAturIntervalExtTable.setStatus('current')
adslAturIntervalExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1), )
adslAturIntervalEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslAturIntervalExtEntry"))
adslAturIntervalExtEntry.setIndexNames(*adslAturIntervalEntry.getIndexNames())
if mibBuilder.loadTexts: adslAturIntervalExtEntry.setStatus('current')
adslAturIntervalSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1, 1), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturIntervalSesL.setStatus('current')
adslAturIntervalUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1, 2), PerfIntervalCount()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: adslAturIntervalUasL.setStatus('current')
adslConfProfileExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22), )
if mibBuilder.loadTexts: adslConfProfileExtTable.setStatus('current')
adslConfProfileExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22, 1), )
adslLineConfProfileEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslConfProfileExtEntry"))
adslConfProfileExtEntry.setIndexNames(*adslLineConfProfileEntry.getIndexNames())
if mibBuilder.loadTexts: adslConfProfileExtEntry.setStatus('current')
adslConfProfileLineType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("noChannel", 1), ("fastOnly", 2), ("interleavedOnly", 3), ("fastOrInterleaved", 4), ("fastAndInterleaved", 5))).clone('fastOnly')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslConfProfileLineType.setStatus('current')
adslAlarmConfProfileExtTable = MibTable((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23), )
if mibBuilder.loadTexts: adslAlarmConfProfileExtTable.setStatus('current')
adslAlarmConfProfileExtEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1), )
adslLineAlarmConfProfileEntry.registerAugmentions(("ADSL-LINE-EXT-MIB", "adslAlarmConfProfileExtEntry"))
adslAlarmConfProfileExtEntry.setIndexNames(*adslLineAlarmConfProfileEntry.getIndexNames())
if mibBuilder.loadTexts: adslAlarmConfProfileExtEntry.setStatus('current')
adslAtucThreshold15MinFailedFastR = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslAtucThreshold15MinFailedFastR.setStatus('current')
adslAtucThreshold15MinSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslAtucThreshold15MinSesL.setStatus('current')
adslAtucThreshold15MinUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslAtucThreshold15MinUasL.setStatus('current')
adslAturThreshold15MinSesL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslAturThreshold15MinSesL.setStatus('current')
adslAturThreshold15MinUasL = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: adslAturThreshold15MinUasL.setStatus('current')
adslExtTraps = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24))
adslExtAtucTraps = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1))
adslExtAtucTrapsPrefix = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0))
adslAtucFailedFastRThreshTrap = NotificationType((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 1)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinFailedFastR"))
if mibBuilder.loadTexts: adslAtucFailedFastRThreshTrap.setStatus('current')
adslAtucSesLThreshTrap = NotificationType((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 2)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinSesL"))
if mibBuilder.loadTexts: adslAtucSesLThreshTrap.setStatus('current')
adslAtucUasLThreshTrap = NotificationType((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 3)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinUasL"))
if mibBuilder.loadTexts: adslAtucUasLThreshTrap.setStatus('current')
adslExtAturTraps = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2))
adslExtAturTrapsPrefix = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0))
adslAturSesLThreshTrap = NotificationType((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0, 1)).setObjects(("ADSL-LINE-EXT-MIB", "adslAturPerfCurr15MinSesL"))
if mibBuilder.loadTexts: adslAturSesLThreshTrap.setStatus('current')
adslAturUasLThreshTrap = NotificationType((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0, 2)).setObjects(("ADSL-LINE-EXT-MIB", "adslAturPerfCurr15MinUasL"))
if mibBuilder.loadTexts: adslAturUasLThreshTrap.setStatus('current')
adslExtConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2))
adslExtGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1))
adslExtCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 2))
adslExtLineMibAtucCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 2, 1)).setObjects(("ADSL-LINE-EXT-MIB", "adslExtLineGroup"), ("ADSL-LINE-EXT-MIB", "adslExtLineConfProfileControlGroup"), ("ADSL-LINE-EXT-MIB", "adslExtLineAlarmConfProfileGroup"), ("ADSL-LINE-EXT-MIB", "adslExtAtucPhysPerfCounterGroup"), ("ADSL-LINE-EXT-MIB", "adslExtAturPhysPerfCounterGroup"), ("ADSL-LINE-EXT-MIB", "adslExtNotificationsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtLineMibAtucCompliance = adslExtLineMibAtucCompliance.setStatus('current')
adslExtLineGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 1)).setObjects(("ADSL-LINE-EXT-MIB", "adslLineConfProfileDualLite"), ("ADSL-LINE-EXT-MIB", "adslLineTransAtucCap"), ("ADSL-LINE-EXT-MIB", "adslLineTransAtucConfig"), ("ADSL-LINE-EXT-MIB", "adslLineTransAtucActual"), ("ADSL-LINE-EXT-MIB", "adslLineGlitePowerState"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtLineGroup = adslExtLineGroup.setStatus('current')
adslExtAtucPhysPerfCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 2)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucPerfStatFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfStatFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr1DayFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr1DayFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfPrev1DayFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfPrev1DayFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfStatSesL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfStatUasL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinSesL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr15MinUasL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr1DaySesL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfCurr1DayUasL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfPrev1DaySesL"), ("ADSL-LINE-EXT-MIB", "adslAtucPerfPrev1DayUasL"), ("ADSL-LINE-EXT-MIB", "adslAtucIntervalFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucIntervalFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucIntervalSesL"), ("ADSL-LINE-EXT-MIB", "adslAtucIntervalUasL"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtAtucPhysPerfCounterGroup = adslExtAtucPhysPerfCounterGroup.setStatus('current')
adslExtAturPhysPerfCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 3)).setObjects(("ADSL-LINE-EXT-MIB", "adslAturPerfStatSesL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfStatUasL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfCurr15MinSesL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfCurr15MinUasL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfCurr1DaySesL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfCurr1DayUasL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfPrev1DaySesL"), ("ADSL-LINE-EXT-MIB", "adslAturPerfPrev1DayUasL"), ("ADSL-LINE-EXT-MIB", "adslAturIntervalSesL"), ("ADSL-LINE-EXT-MIB", "adslAturIntervalUasL"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtAturPhysPerfCounterGroup = adslExtAturPhysPerfCounterGroup.setStatus('current')
adslExtLineConfProfileControlGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 4)).setObjects(("ADSL-LINE-EXT-MIB", "adslConfProfileLineType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtLineConfProfileControlGroup = adslExtLineConfProfileControlGroup.setStatus('current')
adslExtLineAlarmConfProfileGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 5)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucThreshold15MinFailedFastR"), ("ADSL-LINE-EXT-MIB", "adslAtucThreshold15MinSesL"), ("ADSL-LINE-EXT-MIB", "adslAtucThreshold15MinUasL"), ("ADSL-LINE-EXT-MIB", "adslAturThreshold15MinSesL"), ("ADSL-LINE-EXT-MIB", "adslAturThreshold15MinUasL"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtLineAlarmConfProfileGroup = adslExtLineAlarmConfProfileGroup.setStatus('current')
adslExtNotificationsGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 6)).setObjects(("ADSL-LINE-EXT-MIB", "adslAtucFailedFastRThreshTrap"), ("ADSL-LINE-EXT-MIB", "adslAtucSesLThreshTrap"), ("ADSL-LINE-EXT-MIB", "adslAtucUasLThreshTrap"), ("ADSL-LINE-EXT-MIB", "adslAturSesLThreshTrap"), ("ADSL-LINE-EXT-MIB", "adslAturUasLThreshTrap"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adslExtNotificationsGroup = adslExtNotificationsGroup.setStatus('current')
mibBuilder.exportSymbols("ADSL-LINE-EXT-MIB", adslAtucPerfPrev1DayFastR=adslAtucPerfPrev1DayFastR, adslAturPerfDataExtEntry=adslAturPerfDataExtEntry, adslConfProfileExtTable=adslConfProfileExtTable, adslExtAturTrapsPrefix=adslExtAturTrapsPrefix, adslAturPerfDataExtTable=adslAturPerfDataExtTable, adslAlarmConfProfileExtTable=adslAlarmConfProfileExtTable, adslExtAtucTraps=adslExtAtucTraps, adslAturIntervalUasL=adslAturIntervalUasL, adslExtAturTraps=adslExtAturTraps, adslAtucPerfCurr15MinFastR=adslAtucPerfCurr15MinFastR, adslAtucIntervalFastR=adslAtucIntervalFastR, adslAturPerfStatUasL=adslAturPerfStatUasL, adslAturPerfPrev1DaySesL=adslAturPerfPrev1DaySesL, adslExtLineConfProfileControlGroup=adslExtLineConfProfileControlGroup, adslAturIntervalSesL=adslAturIntervalSesL, adslAtucPerfCurr15MinFailedFastR=adslAtucPerfCurr15MinFailedFastR, adslAturUasLThreshTrap=adslAturUasLThreshTrap, adslAtucIntervalExtTable=adslAtucIntervalExtTable, adslAtucSesLThreshTrap=adslAtucSesLThreshTrap, adslExtAturPhysPerfCounterGroup=adslExtAturPhysPerfCounterGroup, PYSNMP_MODULE_ID=adslExtMIB, AdslTransmissionModeType=AdslTransmissionModeType, adslExtGroups=adslExtGroups, adslAtucPerfCurr1DayFastR=adslAtucPerfCurr1DayFastR, adslAtucIntervalFailedFastR=adslAtucIntervalFailedFastR, adslAtucPerfDataExtEntry=adslAtucPerfDataExtEntry, adslAtucIntervalSesL=adslAtucIntervalSesL, adslAtucThreshold15MinFailedFastR=adslAtucThreshold15MinFailedFastR, adslAtucPerfCurr15MinUasL=adslAtucPerfCurr15MinUasL, adslLineTransAtucConfig=adslLineTransAtucConfig, adslAtucPerfCurr1DaySesL=adslAtucPerfCurr1DaySesL, adslAturIntervalExtEntry=adslAturIntervalExtEntry, adslAturPerfCurr1DayUasL=adslAturPerfCurr1DayUasL, adslAtucPerfStatFastR=adslAtucPerfStatFastR, adslAtucPerfPrev1DayUasL=adslAtucPerfPrev1DayUasL, adslAtucUasLThreshTrap=adslAtucUasLThreshTrap, adslConfProfileExtEntry=adslConfProfileExtEntry, adslAtucPerfCurr15MinSesL=adslAtucPerfCurr15MinSesL, adslAturPerfStatSesL=adslAturPerfStatSesL, adslExtMIB=adslExtMIB, adslAlarmConfProfileExtEntry=adslAlarmConfProfileExtEntry, adslAturPerfCurr15MinSesL=adslAturPerfCurr15MinSesL, adslLineGlitePowerState=adslLineGlitePowerState, adslAtucPerfPrev1DaySesL=adslAtucPerfPrev1DaySesL, adslAtucIntervalExtEntry=adslAtucIntervalExtEntry, adslAtucPerfDataExtTable=adslAtucPerfDataExtTable, adslAtucPerfCurr1DayUasL=adslAtucPerfCurr1DayUasL, adslAturThreshold15MinUasL=adslAturThreshold15MinUasL, adslAturPerfCurr1DaySesL=adslAturPerfCurr1DaySesL, adslExtAtucPhysPerfCounterGroup=adslExtAtucPhysPerfCounterGroup, adslAturThreshold15MinSesL=adslAturThreshold15MinSesL, adslExtConformance=adslExtConformance, adslExtAtucTrapsPrefix=adslExtAtucTrapsPrefix, adslAtucIntervalUasL=adslAtucIntervalUasL, adslAtucFailedFastRThreshTrap=adslAtucFailedFastRThreshTrap, adslAtucThreshold15MinUasL=adslAtucThreshold15MinUasL, adslAtucPerfPrev1DayFailedFastR=adslAtucPerfPrev1DayFailedFastR, adslExtTraps=adslExtTraps, adslConfProfileLineType=adslConfProfileLineType, adslExtMibObjects=adslExtMibObjects, adslAtucThreshold15MinSesL=adslAtucThreshold15MinSesL, adslLineConfProfileDualLite=adslLineConfProfileDualLite, adslExtCompliances=adslExtCompliances, adslExtLineAlarmConfProfileGroup=adslExtLineAlarmConfProfileGroup, adslLineTransAtucActual=adslLineTransAtucActual, adslLineExtEntry=adslLineExtEntry, adslExtNotificationsGroup=adslExtNotificationsGroup, adslAtucPerfStatUasL=adslAtucPerfStatUasL, adslAtucPerfCurr1DayFailedFastR=adslAtucPerfCurr1DayFailedFastR, adslAturPerfPrev1DayUasL=adslAturPerfPrev1DayUasL, adslLineTransAtucCap=adslLineTransAtucCap, adslAtucPerfStatFailedFastR=adslAtucPerfStatFailedFastR, adslAturIntervalExtTable=adslAturIntervalExtTable, adslAturSesLThreshTrap=adslAturSesLThreshTrap, adslAturPerfCurr15MinUasL=adslAturPerfCurr15MinUasL, adslExtLineGroup=adslExtLineGroup, adslLineExtTable=adslLineExtTable, adslAtucPerfStatSesL=adslAtucPerfStatSesL, adslExtLineMibAtucCompliance=adslExtLineMibAtucCompliance)
|
(adsl_atuc_perf_data_entry, adsl_atur_interval_entry, adsl_atuc_interval_entry, adsl_line_alarm_conf_profile_entry, adsl_line_entry, adsl_line_conf_profile_entry, adsl_atur_perf_data_entry, adsl_mib) = mibBuilder.importSymbols('ADSL-LINE-MIB', 'adslAtucPerfDataEntry', 'adslAturIntervalEntry', 'adslAtucIntervalEntry', 'adslLineAlarmConfProfileEntry', 'adslLineEntry', 'adslLineConfProfileEntry', 'adslAturPerfDataEntry', 'adslMIB')
(adsl_perf_prev_day_count, adsl_perf_curr_day_count) = mibBuilder.importSymbols('ADSL-TC-MIB', 'AdslPerfPrevDayCount', 'AdslPerfCurrDayCount')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint')
(perf_current_count, perf_interval_count) = mibBuilder.importSymbols('PerfHist-TC-MIB', 'PerfCurrentCount', 'PerfIntervalCount')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(gauge32, integer32, ip_address, bits, counter32, object_identity, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, time_ticks, module_identity, mib_identifier, counter64, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'Integer32', 'IpAddress', 'Bits', 'Counter32', 'ObjectIdentity', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'TimeTicks', 'ModuleIdentity', 'MibIdentifier', 'Counter64', 'iso')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
adsl_ext_mib = module_identity((1, 3, 6, 1, 2, 1, 10, 94, 3))
adslExtMIB.setRevisions(('2002-12-10 00:00',))
if mibBuilder.loadTexts:
adslExtMIB.setLastUpdated('200212100000Z')
if mibBuilder.loadTexts:
adslExtMIB.setOrganization('IETF ADSL MIB Working Group')
adsl_ext_mib_objects = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1))
class Adsltransmissionmodetype(TextualConvention, Bits):
status = 'current'
named_values = named_values(('ansit1413', 0), ('etsi', 1), ('q9921PotsNonOverlapped', 2), ('q9921PotsOverlapped', 3), ('q9921IsdnNonOverlapped', 4), ('q9921isdnOverlapped', 5), ('q9921tcmIsdnNonOverlapped', 6), ('q9921tcmIsdnOverlapped', 7), ('q9922potsNonOverlapeed', 8), ('q9922potsOverlapped', 9), ('q9922tcmIsdnNonOverlapped', 10), ('q9922tcmIsdnOverlapped', 11), ('q9921tcmIsdnSymmetric', 12))
adsl_line_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17))
if mibBuilder.loadTexts:
adslLineExtTable.setStatus('current')
adsl_line_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1))
adslLineEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslLineExtEntry'))
adslLineExtEntry.setIndexNames(*adslLineEntry.getIndexNames())
if mibBuilder.loadTexts:
adslLineExtEntry.setStatus('current')
adsl_line_trans_atuc_cap = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 1), adsl_transmission_mode_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslLineTransAtucCap.setStatus('current')
adsl_line_trans_atuc_config = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 2), adsl_transmission_mode_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
adslLineTransAtucConfig.setStatus('current')
adsl_line_trans_atuc_actual = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 3), adsl_transmission_mode_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslLineTransAtucActual.setStatus('current')
adsl_line_glite_power_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('l0', 2), ('l1', 3), ('l3', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslLineGlitePowerState.setStatus('current')
adsl_line_conf_profile_dual_lite = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 17, 1, 5), snmp_admin_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
adslLineConfProfileDualLite.setStatus('current')
adsl_atuc_perf_data_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18))
if mibBuilder.loadTexts:
adslAtucPerfDataExtTable.setStatus('current')
adsl_atuc_perf_data_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1))
adslAtucPerfDataEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslAtucPerfDataExtEntry'))
adslAtucPerfDataExtEntry.setIndexNames(*adslAtucPerfDataEntry.getIndexNames())
if mibBuilder.loadTexts:
adslAtucPerfDataExtEntry.setStatus('current')
adsl_atuc_perf_stat_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 1), counter32()).setUnits('line retrains').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfStatFastR.setStatus('current')
adsl_atuc_perf_stat_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 2), counter32()).setUnits('line retrains').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfStatFailedFastR.setStatus('current')
adsl_atuc_perf_stat_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 3), counter32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfStatSesL.setStatus('current')
adsl_atuc_perf_stat_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 4), counter32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfStatUasL.setStatus('current')
adsl_atuc_perf_curr15_min_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 5), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr15MinFastR.setStatus('current')
adsl_atuc_perf_curr15_min_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 6), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr15MinFailedFastR.setStatus('current')
adsl_atuc_perf_curr15_min_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 7), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr15MinSesL.setStatus('current')
adsl_atuc_perf_curr15_min_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 8), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr15MinUasL.setStatus('current')
adsl_atuc_perf_curr1_day_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 9), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr1DayFastR.setStatus('current')
adsl_atuc_perf_curr1_day_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 10), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr1DayFailedFastR.setStatus('current')
adsl_atuc_perf_curr1_day_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 11), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr1DaySesL.setStatus('current')
adsl_atuc_perf_curr1_day_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 12), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfCurr1DayUasL.setStatus('current')
adsl_atuc_perf_prev1_day_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 13), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfPrev1DayFastR.setStatus('current')
adsl_atuc_perf_prev1_day_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 14), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfPrev1DayFailedFastR.setStatus('current')
adsl_atuc_perf_prev1_day_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 15), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfPrev1DaySesL.setStatus('current')
adsl_atuc_perf_prev1_day_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 18, 1, 16), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucPerfPrev1DayUasL.setStatus('current')
adsl_atuc_interval_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19))
if mibBuilder.loadTexts:
adslAtucIntervalExtTable.setStatus('current')
adsl_atuc_interval_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1))
adslAtucIntervalEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslAtucIntervalExtEntry'))
adslAtucIntervalExtEntry.setIndexNames(*adslAtucIntervalEntry.getIndexNames())
if mibBuilder.loadTexts:
adslAtucIntervalExtEntry.setStatus('current')
adsl_atuc_interval_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 1), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucIntervalFastR.setStatus('current')
adsl_atuc_interval_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 2), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucIntervalFailedFastR.setStatus('current')
adsl_atuc_interval_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 3), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucIntervalSesL.setStatus('current')
adsl_atuc_interval_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 19, 1, 4), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAtucIntervalUasL.setStatus('current')
adsl_atur_perf_data_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20))
if mibBuilder.loadTexts:
adslAturPerfDataExtTable.setStatus('current')
adsl_atur_perf_data_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1))
adslAturPerfDataEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslAturPerfDataExtEntry'))
adslAturPerfDataExtEntry.setIndexNames(*adslAturPerfDataEntry.getIndexNames())
if mibBuilder.loadTexts:
adslAturPerfDataExtEntry.setStatus('current')
adsl_atur_perf_stat_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 1), counter32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfStatSesL.setStatus('current')
adsl_atur_perf_stat_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 2), counter32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfStatUasL.setStatus('current')
adsl_atur_perf_curr15_min_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 3), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfCurr15MinSesL.setStatus('current')
adsl_atur_perf_curr15_min_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 4), perf_current_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfCurr15MinUasL.setStatus('current')
adsl_atur_perf_curr1_day_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 5), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfCurr1DaySesL.setStatus('current')
adsl_atur_perf_curr1_day_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 6), adsl_perf_curr_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfCurr1DayUasL.setStatus('current')
adsl_atur_perf_prev1_day_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 7), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfPrev1DaySesL.setStatus('current')
adsl_atur_perf_prev1_day_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 20, 1, 8), adsl_perf_prev_day_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturPerfPrev1DayUasL.setStatus('current')
adsl_atur_interval_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21))
if mibBuilder.loadTexts:
adslAturIntervalExtTable.setStatus('current')
adsl_atur_interval_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1))
adslAturIntervalEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslAturIntervalExtEntry'))
adslAturIntervalExtEntry.setIndexNames(*adslAturIntervalEntry.getIndexNames())
if mibBuilder.loadTexts:
adslAturIntervalExtEntry.setStatus('current')
adsl_atur_interval_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1, 1), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturIntervalSesL.setStatus('current')
adsl_atur_interval_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 21, 1, 2), perf_interval_count()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
adslAturIntervalUasL.setStatus('current')
adsl_conf_profile_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22))
if mibBuilder.loadTexts:
adslConfProfileExtTable.setStatus('current')
adsl_conf_profile_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22, 1))
adslLineConfProfileEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslConfProfileExtEntry'))
adslConfProfileExtEntry.setIndexNames(*adslLineConfProfileEntry.getIndexNames())
if mibBuilder.loadTexts:
adslConfProfileExtEntry.setStatus('current')
adsl_conf_profile_line_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 22, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('noChannel', 1), ('fastOnly', 2), ('interleavedOnly', 3), ('fastOrInterleaved', 4), ('fastAndInterleaved', 5))).clone('fastOnly')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslConfProfileLineType.setStatus('current')
adsl_alarm_conf_profile_ext_table = mib_table((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23))
if mibBuilder.loadTexts:
adslAlarmConfProfileExtTable.setStatus('current')
adsl_alarm_conf_profile_ext_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1))
adslLineAlarmConfProfileEntry.registerAugmentions(('ADSL-LINE-EXT-MIB', 'adslAlarmConfProfileExtEntry'))
adslAlarmConfProfileExtEntry.setIndexNames(*adslLineAlarmConfProfileEntry.getIndexNames())
if mibBuilder.loadTexts:
adslAlarmConfProfileExtEntry.setStatus('current')
adsl_atuc_threshold15_min_failed_fast_r = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslAtucThreshold15MinFailedFastR.setStatus('current')
adsl_atuc_threshold15_min_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslAtucThreshold15MinSesL.setStatus('current')
adsl_atuc_threshold15_min_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslAtucThreshold15MinUasL.setStatus('current')
adsl_atur_threshold15_min_ses_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslAturThreshold15MinSesL.setStatus('current')
adsl_atur_threshold15_min_uas_l = mib_table_column((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 23, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
adslAturThreshold15MinUasL.setStatus('current')
adsl_ext_traps = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24))
adsl_ext_atuc_traps = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1))
adsl_ext_atuc_traps_prefix = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0))
adsl_atuc_failed_fast_r_thresh_trap = notification_type((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 1)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinFailedFastR'))
if mibBuilder.loadTexts:
adslAtucFailedFastRThreshTrap.setStatus('current')
adsl_atuc_ses_l_thresh_trap = notification_type((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 2)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinSesL'))
if mibBuilder.loadTexts:
adslAtucSesLThreshTrap.setStatus('current')
adsl_atuc_uas_l_thresh_trap = notification_type((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 1, 0, 3)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinUasL'))
if mibBuilder.loadTexts:
adslAtucUasLThreshTrap.setStatus('current')
adsl_ext_atur_traps = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2))
adsl_ext_atur_traps_prefix = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0))
adsl_atur_ses_l_thresh_trap = notification_type((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0, 1)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr15MinSesL'))
if mibBuilder.loadTexts:
adslAturSesLThreshTrap.setStatus('current')
adsl_atur_uas_l_thresh_trap = notification_type((1, 3, 6, 1, 2, 1, 10, 94, 3, 1, 24, 2, 0, 2)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr15MinUasL'))
if mibBuilder.loadTexts:
adslAturUasLThreshTrap.setStatus('current')
adsl_ext_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2))
adsl_ext_groups = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1))
adsl_ext_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 2))
adsl_ext_line_mib_atuc_compliance = module_compliance((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 2, 1)).setObjects(('ADSL-LINE-EXT-MIB', 'adslExtLineGroup'), ('ADSL-LINE-EXT-MIB', 'adslExtLineConfProfileControlGroup'), ('ADSL-LINE-EXT-MIB', 'adslExtLineAlarmConfProfileGroup'), ('ADSL-LINE-EXT-MIB', 'adslExtAtucPhysPerfCounterGroup'), ('ADSL-LINE-EXT-MIB', 'adslExtAturPhysPerfCounterGroup'), ('ADSL-LINE-EXT-MIB', 'adslExtNotificationsGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_line_mib_atuc_compliance = adslExtLineMibAtucCompliance.setStatus('current')
adsl_ext_line_group = object_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 1)).setObjects(('ADSL-LINE-EXT-MIB', 'adslLineConfProfileDualLite'), ('ADSL-LINE-EXT-MIB', 'adslLineTransAtucCap'), ('ADSL-LINE-EXT-MIB', 'adslLineTransAtucConfig'), ('ADSL-LINE-EXT-MIB', 'adslLineTransAtucActual'), ('ADSL-LINE-EXT-MIB', 'adslLineGlitePowerState'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_line_group = adslExtLineGroup.setStatus('current')
adsl_ext_atuc_phys_perf_counter_group = object_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 2)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucPerfStatFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfStatFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr1DayFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr1DayFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfPrev1DayFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfPrev1DayFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfStatSesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfStatUasL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinSesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr15MinUasL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr1DaySesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfCurr1DayUasL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfPrev1DaySesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucPerfPrev1DayUasL'), ('ADSL-LINE-EXT-MIB', 'adslAtucIntervalFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucIntervalFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucIntervalSesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucIntervalUasL'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_atuc_phys_perf_counter_group = adslExtAtucPhysPerfCounterGroup.setStatus('current')
adsl_ext_atur_phys_perf_counter_group = object_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 3)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAturPerfStatSesL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfStatUasL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr15MinSesL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr15MinUasL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr1DaySesL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfCurr1DayUasL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfPrev1DaySesL'), ('ADSL-LINE-EXT-MIB', 'adslAturPerfPrev1DayUasL'), ('ADSL-LINE-EXT-MIB', 'adslAturIntervalSesL'), ('ADSL-LINE-EXT-MIB', 'adslAturIntervalUasL'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_atur_phys_perf_counter_group = adslExtAturPhysPerfCounterGroup.setStatus('current')
adsl_ext_line_conf_profile_control_group = object_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 4)).setObjects(('ADSL-LINE-EXT-MIB', 'adslConfProfileLineType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_line_conf_profile_control_group = adslExtLineConfProfileControlGroup.setStatus('current')
adsl_ext_line_alarm_conf_profile_group = object_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 5)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucThreshold15MinFailedFastR'), ('ADSL-LINE-EXT-MIB', 'adslAtucThreshold15MinSesL'), ('ADSL-LINE-EXT-MIB', 'adslAtucThreshold15MinUasL'), ('ADSL-LINE-EXT-MIB', 'adslAturThreshold15MinSesL'), ('ADSL-LINE-EXT-MIB', 'adslAturThreshold15MinUasL'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_line_alarm_conf_profile_group = adslExtLineAlarmConfProfileGroup.setStatus('current')
adsl_ext_notifications_group = notification_group((1, 3, 6, 1, 2, 1, 10, 94, 3, 2, 1, 6)).setObjects(('ADSL-LINE-EXT-MIB', 'adslAtucFailedFastRThreshTrap'), ('ADSL-LINE-EXT-MIB', 'adslAtucSesLThreshTrap'), ('ADSL-LINE-EXT-MIB', 'adslAtucUasLThreshTrap'), ('ADSL-LINE-EXT-MIB', 'adslAturSesLThreshTrap'), ('ADSL-LINE-EXT-MIB', 'adslAturUasLThreshTrap'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
adsl_ext_notifications_group = adslExtNotificationsGroup.setStatus('current')
mibBuilder.exportSymbols('ADSL-LINE-EXT-MIB', adslAtucPerfPrev1DayFastR=adslAtucPerfPrev1DayFastR, adslAturPerfDataExtEntry=adslAturPerfDataExtEntry, adslConfProfileExtTable=adslConfProfileExtTable, adslExtAturTrapsPrefix=adslExtAturTrapsPrefix, adslAturPerfDataExtTable=adslAturPerfDataExtTable, adslAlarmConfProfileExtTable=adslAlarmConfProfileExtTable, adslExtAtucTraps=adslExtAtucTraps, adslAturIntervalUasL=adslAturIntervalUasL, adslExtAturTraps=adslExtAturTraps, adslAtucPerfCurr15MinFastR=adslAtucPerfCurr15MinFastR, adslAtucIntervalFastR=adslAtucIntervalFastR, adslAturPerfStatUasL=adslAturPerfStatUasL, adslAturPerfPrev1DaySesL=adslAturPerfPrev1DaySesL, adslExtLineConfProfileControlGroup=adslExtLineConfProfileControlGroup, adslAturIntervalSesL=adslAturIntervalSesL, adslAtucPerfCurr15MinFailedFastR=adslAtucPerfCurr15MinFailedFastR, adslAturUasLThreshTrap=adslAturUasLThreshTrap, adslAtucIntervalExtTable=adslAtucIntervalExtTable, adslAtucSesLThreshTrap=adslAtucSesLThreshTrap, adslExtAturPhysPerfCounterGroup=adslExtAturPhysPerfCounterGroup, PYSNMP_MODULE_ID=adslExtMIB, AdslTransmissionModeType=AdslTransmissionModeType, adslExtGroups=adslExtGroups, adslAtucPerfCurr1DayFastR=adslAtucPerfCurr1DayFastR, adslAtucIntervalFailedFastR=adslAtucIntervalFailedFastR, adslAtucPerfDataExtEntry=adslAtucPerfDataExtEntry, adslAtucIntervalSesL=adslAtucIntervalSesL, adslAtucThreshold15MinFailedFastR=adslAtucThreshold15MinFailedFastR, adslAtucPerfCurr15MinUasL=adslAtucPerfCurr15MinUasL, adslLineTransAtucConfig=adslLineTransAtucConfig, adslAtucPerfCurr1DaySesL=adslAtucPerfCurr1DaySesL, adslAturIntervalExtEntry=adslAturIntervalExtEntry, adslAturPerfCurr1DayUasL=adslAturPerfCurr1DayUasL, adslAtucPerfStatFastR=adslAtucPerfStatFastR, adslAtucPerfPrev1DayUasL=adslAtucPerfPrev1DayUasL, adslAtucUasLThreshTrap=adslAtucUasLThreshTrap, adslConfProfileExtEntry=adslConfProfileExtEntry, adslAtucPerfCurr15MinSesL=adslAtucPerfCurr15MinSesL, adslAturPerfStatSesL=adslAturPerfStatSesL, adslExtMIB=adslExtMIB, adslAlarmConfProfileExtEntry=adslAlarmConfProfileExtEntry, adslAturPerfCurr15MinSesL=adslAturPerfCurr15MinSesL, adslLineGlitePowerState=adslLineGlitePowerState, adslAtucPerfPrev1DaySesL=adslAtucPerfPrev1DaySesL, adslAtucIntervalExtEntry=adslAtucIntervalExtEntry, adslAtucPerfDataExtTable=adslAtucPerfDataExtTable, adslAtucPerfCurr1DayUasL=adslAtucPerfCurr1DayUasL, adslAturThreshold15MinUasL=adslAturThreshold15MinUasL, adslAturPerfCurr1DaySesL=adslAturPerfCurr1DaySesL, adslExtAtucPhysPerfCounterGroup=adslExtAtucPhysPerfCounterGroup, adslAturThreshold15MinSesL=adslAturThreshold15MinSesL, adslExtConformance=adslExtConformance, adslExtAtucTrapsPrefix=adslExtAtucTrapsPrefix, adslAtucIntervalUasL=adslAtucIntervalUasL, adslAtucFailedFastRThreshTrap=adslAtucFailedFastRThreshTrap, adslAtucThreshold15MinUasL=adslAtucThreshold15MinUasL, adslAtucPerfPrev1DayFailedFastR=adslAtucPerfPrev1DayFailedFastR, adslExtTraps=adslExtTraps, adslConfProfileLineType=adslConfProfileLineType, adslExtMibObjects=adslExtMibObjects, adslAtucThreshold15MinSesL=adslAtucThreshold15MinSesL, adslLineConfProfileDualLite=adslLineConfProfileDualLite, adslExtCompliances=adslExtCompliances, adslExtLineAlarmConfProfileGroup=adslExtLineAlarmConfProfileGroup, adslLineTransAtucActual=adslLineTransAtucActual, adslLineExtEntry=adslLineExtEntry, adslExtNotificationsGroup=adslExtNotificationsGroup, adslAtucPerfStatUasL=adslAtucPerfStatUasL, adslAtucPerfCurr1DayFailedFastR=adslAtucPerfCurr1DayFailedFastR, adslAturPerfPrev1DayUasL=adslAturPerfPrev1DayUasL, adslLineTransAtucCap=adslLineTransAtucCap, adslAtucPerfStatFailedFastR=adslAtucPerfStatFailedFastR, adslAturIntervalExtTable=adslAturIntervalExtTable, adslAturSesLThreshTrap=adslAturSesLThreshTrap, adslAturPerfCurr15MinUasL=adslAturPerfCurr15MinUasL, adslExtLineGroup=adslExtLineGroup, adslLineExtTable=adslLineExtTable, adslAtucPerfStatSesL=adslAtucPerfStatSesL, adslExtLineMibAtucCompliance=adslExtLineMibAtucCompliance)
|
def fahrenheit_to_celsius(F):
C = 0
# Your code goes here: calculate the temperature in Celsius,
# store in a variable (we called it C), and return it.
return C
|
def fahrenheit_to_celsius(F):
c = 0
return C
|
base_datapath = '/Work19/2020/lijunjie/LRS3/AV_model_database/'
with open(base_datapath+'pretrain_dataset.txt', 'r') as tr:
lines = tr.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath+'AVdataset_pretrain.txt', 'a') as f:
f.write(new_line)
with open(base_datapath+'trainval_dataset.txt', 'r') as val:
lines = val.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath+'AVdataset_trainval.txt','a') as f:
f.write(new_line)
with open(base_datapath+'test_dataset.txt', 'r') as val:
lines = val.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath+'AVdataset_test.txt','a') as f:
f.write(new_line)
|
base_datapath = '/Work19/2020/lijunjie/LRS3/AV_model_database/'
with open(base_datapath + 'pretrain_dataset.txt', 'r') as tr:
lines = tr.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath + 'AVdataset_pretrain.txt', 'a') as f:
f.write(new_line)
with open(base_datapath + 'trainval_dataset.txt', 'r') as val:
lines = val.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath + 'AVdataset_trainval.txt', 'a') as f:
f.write(new_line)
with open(base_datapath + 'test_dataset.txt', 'r') as val:
lines = val.readlines()
for line in lines:
info = line.strip().split('.')
num1 = info[0].strip().split('-')[1]
num2 = info[0].strip().split('-')[2]
new_line = line.strip() + ' ' + num1 + '_faceemb.npy' + ' ' + num2 + '_faceemb.npy\n'
with open(base_datapath + 'AVdataset_test.txt', 'a') as f:
f.write(new_line)
|
"""Our first program in Python"""
#print is the function to show to the user all we want
print('Welcome to Python')
#input is the functions that we use to recive data from the user
name = input('Give me your name')
#We can print the data we recive
print('Hello ', name)
|
"""Our first program in Python"""
print('Welcome to Python')
name = input('Give me your name')
print('Hello ', name)
|
# Copyright (c) 2021 by Don Deel. All rights reserved.
"""
Shared data for fishem and its modules.
All Redfish and Swordfish objects are shared as JSON objects in a
dictionary named "fish". Redfish resource path names are used as
keys to access objects in this dictionary, and these objects can
contain nested elements. Examples are shown here:
Key (path) Value (object)
-------------------------------- --------------------------------
/redfish Protocol version object
/redfish/v1 ServiceRoot
/redfish/v1/<R> Resource Collection
/redfish/v1/<R>/<Id1> Resource Singleton Id1
/redfish/v1/<R>/<Id1>/<SR> SubResource Collection
/redfish/v1/<R>/<Id1>/<SR>/<Id2> SubResource Singleton Id2
/redfish/v1/odata OData Service Document
/redfish/v1/$metadata Metadata Document
<R> = Resource
<SR> = SubResource
<Id1> = Identifier
<Id2> = Identifier
Note: The keys for objects in this dictionary, including
the ServiceRoot key, do NOT have trailing slashes.
fishem configuration setup information is shared in a dictionary
named "fishem_config".
"""
# fish data dictionary
fish = {}
# fishem configuration dictionary (set by fishem.py)
fishem_config = {}
|
"""
Shared data for fishem and its modules.
All Redfish and Swordfish objects are shared as JSON objects in a
dictionary named "fish". Redfish resource path names are used as
keys to access objects in this dictionary, and these objects can
contain nested elements. Examples are shown here:
Key (path) Value (object)
-------------------------------- --------------------------------
/redfish Protocol version object
/redfish/v1 ServiceRoot
/redfish/v1/<R> Resource Collection
/redfish/v1/<R>/<Id1> Resource Singleton Id1
/redfish/v1/<R>/<Id1>/<SR> SubResource Collection
/redfish/v1/<R>/<Id1>/<SR>/<Id2> SubResource Singleton Id2
/redfish/v1/odata OData Service Document
/redfish/v1/$metadata Metadata Document
<R> = Resource
<SR> = SubResource
<Id1> = Identifier
<Id2> = Identifier
Note: The keys for objects in this dictionary, including
the ServiceRoot key, do NOT have trailing slashes.
fishem configuration setup information is shared in a dictionary
named "fishem_config".
"""
fish = {}
fishem_config = {}
|
def entry(**kwargs):
return '\n'.join([
"Welcome to SAMi",
"What would you like? REPLY",
"1 = Resources",
"2 = Talk to a friend",
"3 = Charge your phone",
])
def resources_1(**kwargs):
return '\n'.join([
"Welcome to resources: TEXT",
"1 = Food",
"2 = Shelters",
"3 = Bathroom/Showers",
])
def resources_shelters_1(**kwargs):
return '\n'.join([
"Here are some shelters near you:",
""
"Angels Flight (Youth)",
"357 S Westlake Ave",
"Los Angeles, California 90057",
"0.17 miles / 0.27 kilometers",
"(800) 833-2499",
"5600 Rickenbacker Road",
""
"Bell, California 90201",
"(323) 263-1206",
"0.11 miles / 0.17 kilometers",
])
def resources_bathrooms_1(**kwargs):
return '\n'.join([
"Here are some public restrooms near you:",
"The Box La",
"805 Traction Avenue, The Box Gallery, Los Angeles, California",
"0.0 miles / 0.0 kilometers",
"",
"Staples Center",
"1111 S Figueroa St, Los Angeles, CA Los Angeles, CA",
"0.11 miles / 0.17 kilometers",
"",
"Snowya",
"123 Astronaut E S Onizuka St, Los Angeles, California",
"0.17 miles / 0.27 kilometers",
])
|
def entry(**kwargs):
return '\n'.join(['Welcome to SAMi', 'What would you like? REPLY', '1 = Resources', '2 = Talk to a friend', '3 = Charge your phone'])
def resources_1(**kwargs):
return '\n'.join(['Welcome to resources: TEXT', '1 = Food', '2 = Shelters', '3 = Bathroom/Showers'])
def resources_shelters_1(**kwargs):
return '\n'.join(['Here are some shelters near you:', 'Angels Flight (Youth)', '357 S Westlake Ave', 'Los Angeles, California 90057', '0.17 miles / 0.27 kilometers', '(800) 833-2499', '5600 Rickenbacker Road', 'Bell, California 90201', '(323) 263-1206', '0.11 miles / 0.17 kilometers'])
def resources_bathrooms_1(**kwargs):
return '\n'.join(['Here are some public restrooms near you:', 'The Box La', '805 Traction Avenue, The Box Gallery, Los Angeles, California', '0.0 miles / 0.0 kilometers', '', 'Staples Center', '1111 S Figueroa St, Los Angeles, CA Los Angeles, CA', '0.11 miles / 0.17 kilometers', '', 'Snowya', '123 Astronaut E S Onizuka St, Los Angeles, California', '0.17 miles / 0.27 kilometers'])
|
def aumentar(preco=0, taxa=0, formatado=False):
res = preco + (preco * taxa / 100)
return res if formatado is False else moeda(res)
def diminuir(preco=0, taxa=0, formatado=False):
res = preco - (preco * taxa / 100)
return res if formatado is False else moeda(res)
def dobro(preco=0, formatado=False):
res = preco * 2
return res if formatado is False else moeda(res)
def metade(preco=0, formatado=False):
res = preco / 2
return res if formatado is False else moeda(res)
def moeda(preco=0, moeda="MTs"):
return f"{preco:.2f}{moeda}".replace(".", ",")
def resumo(p=0, taxaa=10, taxar=5):
print("-" * 30)
print("RESUMO DO VALOR".center(30))
print("-" * 30)
print("Preco analisado: \t\t{}".format(moeda(p)))
print("Dobro do preco: \t\t{}".format(dobro(p, True)))
print("Metade do preco: \t\t{}".format(metade(p, True)))
print("Com {}% de aumento: \t{}".format(taxaa, aumentar(p, taxaa, True)))
print("Com {}% de reducao: \t{}".format(taxar, diminuir(p, taxar, True)))
print("-" * 30)
|
def aumentar(preco=0, taxa=0, formatado=False):
res = preco + preco * taxa / 100
return res if formatado is False else moeda(res)
def diminuir(preco=0, taxa=0, formatado=False):
res = preco - preco * taxa / 100
return res if formatado is False else moeda(res)
def dobro(preco=0, formatado=False):
res = preco * 2
return res if formatado is False else moeda(res)
def metade(preco=0, formatado=False):
res = preco / 2
return res if formatado is False else moeda(res)
def moeda(preco=0, moeda='MTs'):
return f'{preco:.2f}{moeda}'.replace('.', ',')
def resumo(p=0, taxaa=10, taxar=5):
print('-' * 30)
print('RESUMO DO VALOR'.center(30))
print('-' * 30)
print('Preco analisado: \t\t{}'.format(moeda(p)))
print('Dobro do preco: \t\t{}'.format(dobro(p, True)))
print('Metade do preco: \t\t{}'.format(metade(p, True)))
print('Com {}% de aumento: \t{}'.format(taxaa, aumentar(p, taxaa, True)))
print('Com {}% de reducao: \t{}'.format(taxar, diminuir(p, taxar, True)))
print('-' * 30)
|
class Queue:
def __init__(self, initial_size = 10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0;
self.front_index = -1;
self.queue_size = 0;
def enqueue(self, value):
if(self.queue_size) == len(self.arr):
self.handle_queue_capacity_full();
self.arr[self.next_index] = value;
self.queue_size += 1;
self.next_index = (self.next_index + 1) % len(self.arr);
if self.front_index == -1:
self.front_index = 0;
def dequeue(self):
if self.is_empty():
self.front_index = -1;
self.next_index = 0;
return None;
value = self.arr[self.front_index];
self.front_index = self.front_index + 1 % len(self.arr)
self.queue_size -= 1;
return value;
def handle_queue_capacity_full(self):
old_arr = self.arr;
self.arr = [0 for _ in range(2 * len(old_arr))];
index = 0;
for i in range(self.front_index, len(old_arr)):
self.arr[index] = old_arr[i]
index += 1;
for i in range(0, self.front_index):
self.arr[index] = old_arr[i];
index += 1;
self.front_index = 0;
self.next_index = index;
def size(self):
return self.queue_size;
def is_empty(self):
return self.size() == 0
def front(self):
if self.front_index is -1:
return None;
else:
return self.front_index;
q = Queue()
# print(q.arr)
print("Pass" if q.arr == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] else "Fail");
print(q.arr)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(20)
q.enqueue(30)
q.enqueue(20)
q.enqueue(30)
print(q.arr);
val = q.dequeue();
print(val)
print(q.size())
# print(print(q.size()))
# print(print(q.is_empty()))
# print(print(q.front()))
|
class Queue:
def __init__(self, initial_size=10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0
self.front_index = -1
self.queue_size = 0
def enqueue(self, value):
if self.queue_size == len(self.arr):
self.handle_queue_capacity_full()
self.arr[self.next_index] = value
self.queue_size += 1
self.next_index = (self.next_index + 1) % len(self.arr)
if self.front_index == -1:
self.front_index = 0
def dequeue(self):
if self.is_empty():
self.front_index = -1
self.next_index = 0
return None
value = self.arr[self.front_index]
self.front_index = self.front_index + 1 % len(self.arr)
self.queue_size -= 1
return value
def handle_queue_capacity_full(self):
old_arr = self.arr
self.arr = [0 for _ in range(2 * len(old_arr))]
index = 0
for i in range(self.front_index, len(old_arr)):
self.arr[index] = old_arr[i]
index += 1
for i in range(0, self.front_index):
self.arr[index] = old_arr[i]
index += 1
self.front_index = 0
self.next_index = index
def size(self):
return self.queue_size
def is_empty(self):
return self.size() == 0
def front(self):
if self.front_index is -1:
return None
else:
return self.front_index
q = queue()
print('Pass' if q.arr == [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] else 'Fail')
print(q.arr)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(10)
q.enqueue(20)
q.enqueue(30)
q.enqueue(20)
q.enqueue(30)
q.enqueue(20)
q.enqueue(30)
print(q.arr)
val = q.dequeue()
print(val)
print(q.size())
|
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
node = self
output = ""
while node != None:
output += str(node.val)
output += " "
node = node.next
return output
|
class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
node = self
output = ''
while node != None:
output += str(node.val)
output += ' '
node = node.next
return output
|
#Unicode characters and strings
#1960s/1970s ---> we assumed one byte is one character and went it with
# a byte and character were assumed to be the same thing
#ASCII goes up to 127
print(ord('H'))
print(ord('e'))
print(ord('\n'))
print(ord('G'))
#UTF-16 - fixed length, two byes
#UTF-32 - fixed length, four byes
#UTF-8 - 1-4 bytes
# upwards compat with ASCII
# auto detection between ASCII & UTF-8
# UTF-8 rec best pracetice for encoding/data exchange between systems
# in python3, all strings are unicode
# data in from external resource
# must be decoded based on its character set so it's properly represented in py3 as a string
# when talking to external network resource that sends bytes,
# you need to encode the py3 strings into a given char encoding
|
print(ord('H'))
print(ord('e'))
print(ord('\n'))
print(ord('G'))
|
"""
Various constants used
Unit abreviations are appended to the name, but powers are not
specified. For instance, the gravitational constant has units "Mpc^3
msun^-1 s^-2", but is called "G_const_Mpc_Msun_s".
Most of these numbers are from google calculator.
SHOULD MOVE TO ASTROPY.UNITS AT SOME POINTS!!!!!
"""
# If you add a constant, make sure to add a description too.
# Physical contants
# Planck constant (in J.s)
H_planck = 6.6262e-34
# speed of ight in vacuum (in m/s)
c_light_m_s = 2.9979e8
# Boltzman constant in (J/K)
K_boltzman = 1.3807e-23
# charge of the electron (in C)
e_elec = 1.60217646e-19
# mass of a proton (in kg)
m_p = 1.67262158e-27
# mass of an electron (in kg)
m_e = 9.11e-31
# mass of the sun (in kg)
m_sun = 1.98892e30
# h*c
h_c = H_planck * c_light_m_s
# Zero Celcius (K)
zero_celsius = 273.15
# Black body constants
BBT = H_planck / K_boltzman
BBO = 2. * H_planck / c_light_m_s**2.
# Zero point magnitude
# Jy mag=0
m0Jy_band_U = 1810
m0Jy_band_B = 4260
m0Jy_band_V = 3640
m0Jy_band_R = 3080
m0Jy_band_I = 2550
m0Jy_band_J = 1600
m0Jy_band_H = 1080
m0Jy_band_K = 670
# --- extinction laws
EXTINCTION_LAW_MW = 1
EXTINCTION_LAW_LMC = 2
EXTINCTION_LAW_SMC = 3
EXTINCTION_LAW_LINEAR = 4
EXTINCTION_LAW_CALZETTI = 5
EXTINCTION_LAW_GRB1 = 6
EXTINCTION_LAW_GRB2 = 7
# Others
# Parsec in cm
pc_cm = 3.085677e18
# Megaparsec in cm
Mpc_cm = pc_cm * 1e6
# Megaparsec in km
Mpc_km = Mpc_cm * 1e-5
# Angstrom in cm
angstrom_cm = 1e-8
# a year in s
yr_s = 365. * 24. * 60. * 60.
# Megayear in s
Myr_s = 1.e6 * yr_s
# Gigayear in s
Gyr_s = 1.e9 * yr_s
# atomic mass unit in g
amu_g = 1.66053886e-24
# mass of a proton in g
m_p_g = m_p * 1e-6
# mass of a hydrogen atom in g
m_H_g = 1.00794 * amu_g
# mass of a helium atom in g
m_He_g = 4.002602 * amu_g
# Solar mass in grams
M_sun_g = 1.98892e33
# Speed of light in m/s
c_light_km_s = c_light_m_s * 1e-3
# Speed of light in cm/s
c_light_cm_s = c_light_m_s * 1e2
# Speed of light in Mpc/s
c_light_Mpc_s = c_light_cm_s / Mpc_cm
# Speed of light in Mpc/Gyr
c_light_Mpc_Gyr = Gyr_s * c_light_cm_s / Mpc_cm
# km/s/Mpc
H100_km_s_Mpc = 100.
# 100 km s^-1 Mpc^-1 in s^-1
H100_s = 100. / Mpc_km
# Gravitational constant in Mpc^3 msun^-1 s^-2
G_const_Mpc_Msun_s = M_sun_g * (6.673e-8) / Mpc_cm**3.
# Central wavelength of H Lyman-alpha in Angstroms
lambda_Lya_0 = 1215.67
# Central wavelength of an NV doublet in Angstroms
lambda_NV_0 = 1240.81
# hydrogen recombination coefficient at T=10^4 K
alpha_B_cm_s_1e4 = 2.59e-13
# Thomson cross section in cm^2
sigma_T_cm = 6.6524586e-25
# Thomson cross section in Mpc^2
sigma_T_Mpc = sigma_T_cm / (Mpc_cm ** 2.)
|
"""
Various constants used
Unit abreviations are appended to the name, but powers are not
specified. For instance, the gravitational constant has units "Mpc^3
msun^-1 s^-2", but is called "G_const_Mpc_Msun_s".
Most of these numbers are from google calculator.
SHOULD MOVE TO ASTROPY.UNITS AT SOME POINTS!!!!!
"""
h_planck = 6.6262e-34
c_light_m_s = 299790000.0
k_boltzman = 1.3807e-23
e_elec = 1.60217646e-19
m_p = 1.67262158e-27
m_e = 9.11e-31
m_sun = 1.98892e+30
h_c = H_planck * c_light_m_s
zero_celsius = 273.15
bbt = H_planck / K_boltzman
bbo = 2.0 * H_planck / c_light_m_s ** 2.0
m0_jy_band_u = 1810
m0_jy_band_b = 4260
m0_jy_band_v = 3640
m0_jy_band_r = 3080
m0_jy_band_i = 2550
m0_jy_band_j = 1600
m0_jy_band_h = 1080
m0_jy_band_k = 670
extinction_law_mw = 1
extinction_law_lmc = 2
extinction_law_smc = 3
extinction_law_linear = 4
extinction_law_calzetti = 5
extinction_law_grb1 = 6
extinction_law_grb2 = 7
pc_cm = 3.085677e+18
mpc_cm = pc_cm * 1000000.0
mpc_km = Mpc_cm * 1e-05
angstrom_cm = 1e-08
yr_s = 365.0 * 24.0 * 60.0 * 60.0
myr_s = 1000000.0 * yr_s
gyr_s = 1000000000.0 * yr_s
amu_g = 1.66053886e-24
m_p_g = m_p * 1e-06
m_h_g = 1.00794 * amu_g
m__he_g = 4.002602 * amu_g
m_sun_g = 1.98892e+33
c_light_km_s = c_light_m_s * 0.001
c_light_cm_s = c_light_m_s * 100.0
c_light__mpc_s = c_light_cm_s / Mpc_cm
c_light__mpc__gyr = Gyr_s * c_light_cm_s / Mpc_cm
h100_km_s__mpc = 100.0
h100_s = 100.0 / Mpc_km
g_const__mpc__msun_s = M_sun_g * 6.673e-08 / Mpc_cm ** 3.0
lambda__lya_0 = 1215.67
lambda_nv_0 = 1240.81
alpha_b_cm_s_1e4 = 2.59e-13
sigma_t_cm = 6.6524586e-25
sigma_t__mpc = sigma_T_cm / Mpc_cm ** 2.0
|
description = 'MIRA2 monochromator'
group = 'lowlevel'
includes = ['base', 'mslit2', 'sample', 'alias_mono']
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(
co_m2tt = device('nicos.devices.entangle.Sensor',
visibility = (),
tangodevice = tango_base + 'mono2/m2tt_enc',
unit = 'deg',
),
mo_m2tt = device('nicos.devices.entangle.Motor',
visibility = (),
tangodevice = tango_base + 'mono2/m2tt_mot',
unit = 'deg',
precision = 1, # due to backlash
),
m2tt = device('nicos_mlz.mira.devices.axis.HoveringAxis',
description = 'monochromator two-theta angle',
precision = 0.04,
backlash = 1,
motor = 'mo_m2tt',
coder = 'co_m2tt',
startdelay = 1,
stopdelay = 4,
speed = 0.25,
switch = 'air_mono',
switchvalues = (0, 1),
fmtstr = '%.3f',
),
co_m2th = device('nicos.devices.entangle.Sensor',
visibility = (),
tangodevice = tango_base + 'mono2/m2th_enc',
unit = 'deg',
),
mo_m2th = device('nicos.devices.entangle.Motor',
visibility = (),
tangodevice = tango_base + 'mono2/m2th_mot',
unit = 'deg',
precision = 0.002,
),
m2th = device('nicos.devices.generic.Axis',
description = 'monochromator theta angle',
motor = 'mo_m2th',
coder = 'co_m2th',
fmtstr = '%.3f',
precision = 0.002,
),
mono = device('nicos.devices.tas.Monochromator',
description = 'monochromator unit to move incoming wavevector',
unit = 'A-1',
theta = 'm2th',
twotheta = 'm2tt',
focush = None,
focusv = 'm2fv',
abslimits = (0.1, 10),
# calibration 1/2013, valid from 1.2 to 1.4 ki
vfocuspars = [220.528, -40.485, 2.789],
scatteringsense = -1,
crystalside = -1,
dvalue = 3.355,
),
co_m2tx = device('nicos.devices.entangle.Sensor',
visibility = (),
tangodevice = tango_base + 'mono2/m2tx_enc',
unit = 'mm',
),
mo_m2tx = device('nicos.devices.entangle.Motor',
visibility = (),
tangodevice = tango_base + 'mono2/m2tx_mot',
unit = 'mm',
precision = 0.1,
),
m2tx = device('nicos.devices.generic.Axis',
description = 'monochromator translation parallel to the blades',
motor = 'mo_m2tx',
coder = 'co_m2tx',
fmtstr = '%.2f',
precision = 0.1,
),
co_m2ty = device('nicos.devices.entangle.Sensor',
visibility = (),
tangodevice = tango_base + 'mono2/m2ty_enc',
unit = 'mm',
),
mo_m2ty = device('nicos.devices.entangle.Motor',
visibility = (),
tangodevice = tango_base + 'mono2/m2ty_mot',
unit = 'mm',
precision = 0.1,
),
m2ty = device('nicos.devices.generic.Axis',
description = 'monochromator translation perpendicular to the blades',
motor = 'mo_m2ty',
coder = 'co_m2ty',
fmtstr = '%.2f',
precision = 0.1,
),
co_m2gx = device('nicos.devices.entangle.Sensor',
visibility = (),
tangodevice = tango_base + 'mono2/m2gx_enc',
unit = 'deg',
),
mo_m2gx = device('nicos.devices.entangle.Motor',
visibility = (),
tangodevice = tango_base + 'mono2/m2gx_mot',
unit = 'deg',
precision = 0.05,
),
m2gx = device('nicos.devices.generic.Axis',
description = 'monochromator tilt',
motor = 'mo_m2gx',
coder = 'co_m2gx',
fmtstr = '%.2f',
precision = 0.05,
),
m2fv = device('nicos.devices.entangle.Motor',
description = 'monochromator vertical focus',
tangodevice = tango_base + 'mono2/m2fv_mot',
unit = 'deg',
precision = 0.5,
fmtstr = '%.1f',
),
PBe = device('nicos_mlz.mira.devices.center.CrappySensor',
description = 'Be filter pressure',
tangodevice = tango_base + 'leybold/sensor2',
warnlimits = (1e-8, 0.00051),
fmtstr = '%.2g',
),
Pccr = device('nicos_mlz.mira.devices.center.CrappySensor',
description = 'CCR isolation vacuum pressure',
tangodevice = tango_base + 'leybold/sensor1',
warnlimits = (1e-9, 1e-5),
fmtstr = '%.2g',
),
TBe = device('nicos.devices.entangle.Sensor',
description = 'LakeShore sensor: Be filter temperature',
tangodevice = tango_base + 'ls/t_be',
warnlimits = (0, 65),
pollinterval = 3,
maxage = 5,
fmtstr = '%.1f',
),
)
startupcode = '''
mth.alias = m2th
mtt.alias = m2tt
mtx.alias = m2tx
mty.alias = m2ty
mgx.alias = m2gx
mfv.alias = m2fv
'''
|
description = 'MIRA2 monochromator'
group = 'lowlevel'
includes = ['base', 'mslit2', 'sample', 'alias_mono']
tango_base = 'tango://miractrl.mira.frm2:10000/mira/'
devices = dict(co_m2tt=device('nicos.devices.entangle.Sensor', visibility=(), tangodevice=tango_base + 'mono2/m2tt_enc', unit='deg'), mo_m2tt=device('nicos.devices.entangle.Motor', visibility=(), tangodevice=tango_base + 'mono2/m2tt_mot', unit='deg', precision=1), m2tt=device('nicos_mlz.mira.devices.axis.HoveringAxis', description='monochromator two-theta angle', precision=0.04, backlash=1, motor='mo_m2tt', coder='co_m2tt', startdelay=1, stopdelay=4, speed=0.25, switch='air_mono', switchvalues=(0, 1), fmtstr='%.3f'), co_m2th=device('nicos.devices.entangle.Sensor', visibility=(), tangodevice=tango_base + 'mono2/m2th_enc', unit='deg'), mo_m2th=device('nicos.devices.entangle.Motor', visibility=(), tangodevice=tango_base + 'mono2/m2th_mot', unit='deg', precision=0.002), m2th=device('nicos.devices.generic.Axis', description='monochromator theta angle', motor='mo_m2th', coder='co_m2th', fmtstr='%.3f', precision=0.002), mono=device('nicos.devices.tas.Monochromator', description='monochromator unit to move incoming wavevector', unit='A-1', theta='m2th', twotheta='m2tt', focush=None, focusv='m2fv', abslimits=(0.1, 10), vfocuspars=[220.528, -40.485, 2.789], scatteringsense=-1, crystalside=-1, dvalue=3.355), co_m2tx=device('nicos.devices.entangle.Sensor', visibility=(), tangodevice=tango_base + 'mono2/m2tx_enc', unit='mm'), mo_m2tx=device('nicos.devices.entangle.Motor', visibility=(), tangodevice=tango_base + 'mono2/m2tx_mot', unit='mm', precision=0.1), m2tx=device('nicos.devices.generic.Axis', description='monochromator translation parallel to the blades', motor='mo_m2tx', coder='co_m2tx', fmtstr='%.2f', precision=0.1), co_m2ty=device('nicos.devices.entangle.Sensor', visibility=(), tangodevice=tango_base + 'mono2/m2ty_enc', unit='mm'), mo_m2ty=device('nicos.devices.entangle.Motor', visibility=(), tangodevice=tango_base + 'mono2/m2ty_mot', unit='mm', precision=0.1), m2ty=device('nicos.devices.generic.Axis', description='monochromator translation perpendicular to the blades', motor='mo_m2ty', coder='co_m2ty', fmtstr='%.2f', precision=0.1), co_m2gx=device('nicos.devices.entangle.Sensor', visibility=(), tangodevice=tango_base + 'mono2/m2gx_enc', unit='deg'), mo_m2gx=device('nicos.devices.entangle.Motor', visibility=(), tangodevice=tango_base + 'mono2/m2gx_mot', unit='deg', precision=0.05), m2gx=device('nicos.devices.generic.Axis', description='monochromator tilt', motor='mo_m2gx', coder='co_m2gx', fmtstr='%.2f', precision=0.05), m2fv=device('nicos.devices.entangle.Motor', description='monochromator vertical focus', tangodevice=tango_base + 'mono2/m2fv_mot', unit='deg', precision=0.5, fmtstr='%.1f'), PBe=device('nicos_mlz.mira.devices.center.CrappySensor', description='Be filter pressure', tangodevice=tango_base + 'leybold/sensor2', warnlimits=(1e-08, 0.00051), fmtstr='%.2g'), Pccr=device('nicos_mlz.mira.devices.center.CrappySensor', description='CCR isolation vacuum pressure', tangodevice=tango_base + 'leybold/sensor1', warnlimits=(1e-09, 1e-05), fmtstr='%.2g'), TBe=device('nicos.devices.entangle.Sensor', description='LakeShore sensor: Be filter temperature', tangodevice=tango_base + 'ls/t_be', warnlimits=(0, 65), pollinterval=3, maxage=5, fmtstr='%.1f'))
startupcode = '\nmth.alias = m2th\nmtt.alias = m2tt\nmtx.alias = m2tx\nmty.alias = m2ty\nmgx.alias = m2gx\nmfv.alias = m2fv\n'
|
# Divided OF two number
while True:
a = int(input("Enter The Dividend Number : "))
b = int(input("Enter The Divisor Number : "))
if a > b:
quotient = int(a / b)
print("Quotirnt Number Of :", quotient)
else:
Quotient = int(b / a)
print("Quotirnt Number Of : 0.", Quotient)
|
while True:
a = int(input('Enter The Dividend Number : '))
b = int(input('Enter The Divisor Number : '))
if a > b:
quotient = int(a / b)
print('Quotirnt Number Of :', quotient)
else:
quotient = int(b / a)
print('Quotirnt Number Of : 0.', Quotient)
|
IMPAR = []
PAR = []
for i in range(15):
X = int(input())
if X % 2 == 0:
PAR.append(X)
elif X % 2 != 0:
IMPAR.append(X)
if len(PAR) == 5:
Y = 0
for j in PAR:
print('par[{}] = {}'.format(Y,j))
Y += 1
PAR = []
if len(IMPAR) == 5:
Y = 0
for j in IMPAR:
print('impar[{}] = {}'.format(Y,j))
Y += 1
IMPAR = []
if len(IMPAR) > 0:
Y = 0
for j in IMPAR:
print('impar[{}] = {}'.format(Y,j))
Y += 1
if len(PAR) > 0:
Y = 0
for j in PAR:
print('par[{}] = {}'.format(Y,j))
Y += 1
|
impar = []
par = []
for i in range(15):
x = int(input())
if X % 2 == 0:
PAR.append(X)
elif X % 2 != 0:
IMPAR.append(X)
if len(PAR) == 5:
y = 0
for j in PAR:
print('par[{}] = {}'.format(Y, j))
y += 1
par = []
if len(IMPAR) == 5:
y = 0
for j in IMPAR:
print('impar[{}] = {}'.format(Y, j))
y += 1
impar = []
if len(IMPAR) > 0:
y = 0
for j in IMPAR:
print('impar[{}] = {}'.format(Y, j))
y += 1
if len(PAR) > 0:
y = 0
for j in PAR:
print('par[{}] = {}'.format(Y, j))
y += 1
|
# The MIT License
# Copyright (c) 2015 Tom Pollard
# 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.
def compute_oasis(pd_dataframe):
"""
Takes Pandas DataFrame as an argument and computes Oxford Acute
Severity of Illness Score (OASIS) (http://oasisicu.com/)
The DataFrame should include only measurements taken over the first 24h
from admission. pd_dataframe should contain the following columns:
'prelos' => Pre-ICU length of stay, hours
'age' => Age of patient, years
'GCS_total' => Total Glasgow Coma Scale for patient
'hrate' => All heart rate measurements
'MAP' => All mean arterial blood pressure measurements
'resp_rate' => All respiratory rate measurements
'temp_c' => All temperature measurements, C
'urine' => Total urine output over 24 h (note, not consecutive measurements)
'ventilated' => Is patient ventilated? (y,n)
'admission_type' => Type of admission (elective, urgent, emergency)
Reference:
Johnson AE, Kramer AA, Clifford GD. A new severity of illness scale
using a subset of Acute Physiology And Chronic Health Evaluation
data elements shows comparable predictive accuracy.
Crit Care Med. 2013 Jul;41(7):1711-8. doi: 10.1097/CCM.0b013e31828a24fe
http://www.ncbi.nlm.nih.gov/pubmed/23660729
"""
# 10 variables
oasis_score, oasis_prelos, oasis_age, oasis_gcs, oasis_hr, oasis_map, oasis_resp, \
oasis_temp, oasis_urine, oasis_vent, oasis_surg = 0,0,0,0,0,0,0,0,0,0,0
# Pre-ICU length of stay, hours
for val in pd_dataframe['prelos']:
if val >= 4.95 and val <= 24.0:
oasis_prelos = np.nanmax([0,oasis_prelos])
elif val > 311.8:
oasis_prelos = np.nanmax([1,oasis_prelos])
elif val > 24.0 and val <= 311.8:
oasis_prelos = np.nanmax([2,oasis_prelos])
elif val >= 0.17 and val < 4.95:
oasis_prelos = np.nanmax([3,oasis_prelos])
elif val < 0.17:
oasis_prelos = np.nanmax([5,oasis_prelos])
else:
oasis_prelos = np.nanmax([np.nan,oasis_prelos])
if pd_dataframe['prelos'].isnull().all():
oasis_prelos = np.nan
# Age, years
for val in pd_dataframe['age']:
if val < 24:
oasis_age = np.nanmax([0,oasis_age])
elif val >= 24 and val <= 53:
oasis_age = np.nanmax([3,oasis_age])
elif val > 53 and val <= 77:
oasis_age = np.nanmax([6,oasis_age])
elif val > 77 and val <= 89:
oasis_age = np.nanmax([9,oasis_age])
elif val > 89:
oasis_age = np.nanmax([7,oasis_age])
else:
oasis_age = np.nanmax([np.nan,oasis_age])
if pd_dataframe['age'].isnull().all():
oasis_age = np.nan
# Glasgow Coma Scale
for val in pd_dataframe['GCS_total']:
if val == 15:
oasis_gcs = np.nanmax([0,oasis_gcs])
elif val == 14:
oasis_gcs = np.nanmax([3,oasis_gcs])
elif val >= 8 and val <= 13:
oasis_gcs = np.nanmax([4,oasis_gcs])
elif val >= 3 and val <= 7:
oasis_gcs = np.nanmax([10,oasis_gcs])
else:
oasis_gcs = np.nanmax([np.nan,oasis_gcs])
if pd_dataframe['GCS_total'].isnull().all():
oasis_gcs = np.nan
# Heart rate
for val in pd_dataframe['hrate']:
if val >= 33 and val <= 88:
oasis_hr = np.nanmax([0,oasis_hr])
elif val > 88 and val <= 106:
oasis_hr = np.nanmax([1,oasis_hr])
elif val > 106 and val <= 125:
oasis_hr = np.nanmax([3,oasis_hr])
elif val < 33:
oasis_hr = np.nanmax([4,oasis_hr])
elif val > 125:
oasis_hr = np.nanmax([6,oasis_hr])
else:
oasis_hr = np.nanmax([np.nan,oasis_hr])
if pd_dataframe['hrate'].isnull().all():
oasis_hr = np.nan
# Mean arterial pressure
for val in pd_dataframe['MAP']:
if val >=61.33 and val <= 143.44:
oasis_map = np.nanmax([0,oasis_map])
elif val >= 51.0 and val < 61.33:
oasis_map = np.nanmax([2,oasis_map])
elif (val >= 20.65 and val < 51.0) or (val > 143.44):
oasis_map = np.nanmax([3,oasis_map])
elif val < 20.65:
oasis_map = np.nanmax([4,oasis_map])
else:
oasis_map = np.nanmax([np.nan,oasis_map])
if pd_dataframe['MAP'].isnull().all():
oasis_map = np.nan
# Respiratory Rate
for val in pd_dataframe['resp_rate']:
if val >=13 and val <= 22:
oasis_resp = np.nanmax([0,oasis_resp])
elif (val >= 6 and val <= 12) or (val >= 23 and val <= 30):
oasis_resp = np.nanmax([1,oasis_resp])
elif val > 30 and val <= 44:
oasis_resp = np.nanmax([6,oasis_resp])
elif val > 44:
oasis_resp = np.nanmax([9,oasis_resp])
elif val < 6:
oasis_resp = np.nanmax([10,oasis_resp])
else:
oasis_resp = np.nanmax([np.nan,oasis_resp])
if pd_dataframe['resp_rate'].isnull().all():
oasis_resp = np.nan
# Temperature, C
for val in pd_dataframe['temp_c']:
if val >= 36.40 and val <= 36.88:
oasis_temp = np.nanmax([0,oasis_temp])
elif (val >= 35.94 and val < 36.40) or (val > 36.88 and val <= 39.88):
oasis_temp = np.nanmax([2,oasis_temp])
elif val < 33.22:
oasis_temp = np.nanmax([3,oasis_temp])
elif val >= 33.22 and val < 35.94:
oasis_temp = np.nanmax([4,oasis_temp])
elif val > 39.88:
oasis_temp = np.nanmax([6,oasis_temp])
else:
oasis_temp = np.nanmax([np.nan,oasis_temp])
if pd_dataframe['temp_c'].isnull().all():
oasis_temp = np.nan
# Urine output, cc/day (total over 24h)
val = np.max(pd_dataframe['urine'])
if val >=2544.0 and val <= 6896.0:
oasis_urine = np.nanmax([0,oasis_urine])
elif val >= 1427.0 and val < 2544.0:
oasis_urine = np.nanmax([1,oasis_urine])
elif val >= 671.0 and val < 1427.0:
oasis_urine = np.nanmax([5,oasis_urine])
elif val > 6896.0:
oasis_urine = np.nanmax([8,oasis_urine])
elif val < 671:
oasis_urine = np.nanmax([10,oasis_urine])
else:
oasis_urine = np.nanmax([np.nan,oasis_urine])
if pd_dataframe['urine'].isnull().all():
oasis_urine = np.nan
# Ventilated y/n
for val in pd_dataframe['ventilated']:
if val == 'n':
oasis_vent = np.nanmax([0,oasis_vent])
elif val == 'y':
oasis_vent = np.nanmax([9,oasis_vent])
else:
oasis_vent = np.nanmax([np.nan,oasis_vent])
if pd_dataframe['ventilated'].isnull().all():
oasis_vent = np.nan
# Elective surgery y/n
for val in pd_dataframe['admission_type']:
if val == 'elective':
oasis_surg = np.nanmax([0,oasis_surg])
elif val in ['urgent','emergency']:
oasis_surg = np.nanmax([6,oasis_surg])
else:
oasis_surg = np.nanmax([np.nan,oasis_surg])
if pd_dataframe['admission_type'].isnull().all():
oasis_surg = np.nan
# Return sum
oasis_score = sum([oasis_prelos, oasis_age, oasis_gcs, oasis_hr, oasis_map, oasis_resp, \
oasis_temp, oasis_urine, oasis_vent, oasis_surg])
return oasis_score
|
def compute_oasis(pd_dataframe):
"""
Takes Pandas DataFrame as an argument and computes Oxford Acute
Severity of Illness Score (OASIS) (http://oasisicu.com/)
The DataFrame should include only measurements taken over the first 24h
from admission. pd_dataframe should contain the following columns:
'prelos' => Pre-ICU length of stay, hours
'age' => Age of patient, years
'GCS_total' => Total Glasgow Coma Scale for patient
'hrate' => All heart rate measurements
'MAP' => All mean arterial blood pressure measurements
'resp_rate' => All respiratory rate measurements
'temp_c' => All temperature measurements, C
'urine' => Total urine output over 24 h (note, not consecutive measurements)
'ventilated' => Is patient ventilated? (y,n)
'admission_type' => Type of admission (elective, urgent, emergency)
Reference:
Johnson AE, Kramer AA, Clifford GD. A new severity of illness scale
using a subset of Acute Physiology And Chronic Health Evaluation
data elements shows comparable predictive accuracy.
Crit Care Med. 2013 Jul;41(7):1711-8. doi: 10.1097/CCM.0b013e31828a24fe
http://www.ncbi.nlm.nih.gov/pubmed/23660729
"""
(oasis_score, oasis_prelos, oasis_age, oasis_gcs, oasis_hr, oasis_map, oasis_resp, oasis_temp, oasis_urine, oasis_vent, oasis_surg) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
for val in pd_dataframe['prelos']:
if val >= 4.95 and val <= 24.0:
oasis_prelos = np.nanmax([0, oasis_prelos])
elif val > 311.8:
oasis_prelos = np.nanmax([1, oasis_prelos])
elif val > 24.0 and val <= 311.8:
oasis_prelos = np.nanmax([2, oasis_prelos])
elif val >= 0.17 and val < 4.95:
oasis_prelos = np.nanmax([3, oasis_prelos])
elif val < 0.17:
oasis_prelos = np.nanmax([5, oasis_prelos])
else:
oasis_prelos = np.nanmax([np.nan, oasis_prelos])
if pd_dataframe['prelos'].isnull().all():
oasis_prelos = np.nan
for val in pd_dataframe['age']:
if val < 24:
oasis_age = np.nanmax([0, oasis_age])
elif val >= 24 and val <= 53:
oasis_age = np.nanmax([3, oasis_age])
elif val > 53 and val <= 77:
oasis_age = np.nanmax([6, oasis_age])
elif val > 77 and val <= 89:
oasis_age = np.nanmax([9, oasis_age])
elif val > 89:
oasis_age = np.nanmax([7, oasis_age])
else:
oasis_age = np.nanmax([np.nan, oasis_age])
if pd_dataframe['age'].isnull().all():
oasis_age = np.nan
for val in pd_dataframe['GCS_total']:
if val == 15:
oasis_gcs = np.nanmax([0, oasis_gcs])
elif val == 14:
oasis_gcs = np.nanmax([3, oasis_gcs])
elif val >= 8 and val <= 13:
oasis_gcs = np.nanmax([4, oasis_gcs])
elif val >= 3 and val <= 7:
oasis_gcs = np.nanmax([10, oasis_gcs])
else:
oasis_gcs = np.nanmax([np.nan, oasis_gcs])
if pd_dataframe['GCS_total'].isnull().all():
oasis_gcs = np.nan
for val in pd_dataframe['hrate']:
if val >= 33 and val <= 88:
oasis_hr = np.nanmax([0, oasis_hr])
elif val > 88 and val <= 106:
oasis_hr = np.nanmax([1, oasis_hr])
elif val > 106 and val <= 125:
oasis_hr = np.nanmax([3, oasis_hr])
elif val < 33:
oasis_hr = np.nanmax([4, oasis_hr])
elif val > 125:
oasis_hr = np.nanmax([6, oasis_hr])
else:
oasis_hr = np.nanmax([np.nan, oasis_hr])
if pd_dataframe['hrate'].isnull().all():
oasis_hr = np.nan
for val in pd_dataframe['MAP']:
if val >= 61.33 and val <= 143.44:
oasis_map = np.nanmax([0, oasis_map])
elif val >= 51.0 and val < 61.33:
oasis_map = np.nanmax([2, oasis_map])
elif val >= 20.65 and val < 51.0 or val > 143.44:
oasis_map = np.nanmax([3, oasis_map])
elif val < 20.65:
oasis_map = np.nanmax([4, oasis_map])
else:
oasis_map = np.nanmax([np.nan, oasis_map])
if pd_dataframe['MAP'].isnull().all():
oasis_map = np.nan
for val in pd_dataframe['resp_rate']:
if val >= 13 and val <= 22:
oasis_resp = np.nanmax([0, oasis_resp])
elif val >= 6 and val <= 12 or (val >= 23 and val <= 30):
oasis_resp = np.nanmax([1, oasis_resp])
elif val > 30 and val <= 44:
oasis_resp = np.nanmax([6, oasis_resp])
elif val > 44:
oasis_resp = np.nanmax([9, oasis_resp])
elif val < 6:
oasis_resp = np.nanmax([10, oasis_resp])
else:
oasis_resp = np.nanmax([np.nan, oasis_resp])
if pd_dataframe['resp_rate'].isnull().all():
oasis_resp = np.nan
for val in pd_dataframe['temp_c']:
if val >= 36.4 and val <= 36.88:
oasis_temp = np.nanmax([0, oasis_temp])
elif val >= 35.94 and val < 36.4 or (val > 36.88 and val <= 39.88):
oasis_temp = np.nanmax([2, oasis_temp])
elif val < 33.22:
oasis_temp = np.nanmax([3, oasis_temp])
elif val >= 33.22 and val < 35.94:
oasis_temp = np.nanmax([4, oasis_temp])
elif val > 39.88:
oasis_temp = np.nanmax([6, oasis_temp])
else:
oasis_temp = np.nanmax([np.nan, oasis_temp])
if pd_dataframe['temp_c'].isnull().all():
oasis_temp = np.nan
val = np.max(pd_dataframe['urine'])
if val >= 2544.0 and val <= 6896.0:
oasis_urine = np.nanmax([0, oasis_urine])
elif val >= 1427.0 and val < 2544.0:
oasis_urine = np.nanmax([1, oasis_urine])
elif val >= 671.0 and val < 1427.0:
oasis_urine = np.nanmax([5, oasis_urine])
elif val > 6896.0:
oasis_urine = np.nanmax([8, oasis_urine])
elif val < 671:
oasis_urine = np.nanmax([10, oasis_urine])
else:
oasis_urine = np.nanmax([np.nan, oasis_urine])
if pd_dataframe['urine'].isnull().all():
oasis_urine = np.nan
for val in pd_dataframe['ventilated']:
if val == 'n':
oasis_vent = np.nanmax([0, oasis_vent])
elif val == 'y':
oasis_vent = np.nanmax([9, oasis_vent])
else:
oasis_vent = np.nanmax([np.nan, oasis_vent])
if pd_dataframe['ventilated'].isnull().all():
oasis_vent = np.nan
for val in pd_dataframe['admission_type']:
if val == 'elective':
oasis_surg = np.nanmax([0, oasis_surg])
elif val in ['urgent', 'emergency']:
oasis_surg = np.nanmax([6, oasis_surg])
else:
oasis_surg = np.nanmax([np.nan, oasis_surg])
if pd_dataframe['admission_type'].isnull().all():
oasis_surg = np.nan
oasis_score = sum([oasis_prelos, oasis_age, oasis_gcs, oasis_hr, oasis_map, oasis_resp, oasis_temp, oasis_urine, oasis_vent, oasis_surg])
return oasis_score
|
class UserRepositoryDependencyMarker: # pragma: no cover
pass
class ProductRepositoryDependencyMarker: # pragma: no cover
pass
|
class Userrepositorydependencymarker:
pass
class Productrepositorydependencymarker:
pass
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Option:
def __init__(self, name, number, y):
self.name=name
self.number=number
self.y=y
|
class Option:
def __init__(self, name, number, y):
self.name = name
self.number = number
self.y = y
|
# $Id: module_index.py 2790 2008-02-29 08:33:14Z cpbotha $
class emp_test:
kits = ['vtk_kit']
cats = ['Tests']
keywords = ['test', 'tests', 'testing']
help = \
"""Module to test DeVIDE extra-module-paths functionality.
"""
|
class Emp_Test:
kits = ['vtk_kit']
cats = ['Tests']
keywords = ['test', 'tests', 'testing']
help = 'Module to test DeVIDE extra-module-paths functionality.\n '
|
'''
N = int(input())
notas100 = N//100
notas50 = (N-(notas100*100))//50
notas20 = (N-(notas100*100+notas50*50))//20
notas10 = (N-(notas100*100+notas50*50+notas20*20))//10
notas5 = (N-(notas100*100+notas50*50+notas20*20+notas10*10))//5
notas2 = (N-(notas100*100+notas50*50+notas20*20+notas10*10+notas5*5))//2
notas1 = (N-(notas100*100+notas50*50+notas20*20+notas10*10+notas5*5+notas2*2))
print(notas100, ' nota(s) de R$ 100,00')
print(notas50, ' nota(s) de R$ 50,00')
print(notas20, ' nota(s) de R$ 20,00')
print(notas10, ' nota(s) de R$ 10,00')
print(notas5, ' nota(s) de R$ 5,00')
print(notas2, ' nota(s) de R$ 2,00')
print(notas1, ' nota(s) de R$ 1,00')
'''
N = int(input())
n100 = N//100
N = N - n100*100
n50 = N//50
N = N - n50*50
n20 = N//20
N = N - n20*20
n10 = N//10
N = N - n10*10
n5 = N//5
N = N - n5*5
n2 = N//2
N = N - n2*2
n1 = N
print(n100, ' nota(s) de R$ 100,00')
print(n50, ' nota(s) de R$ 50,00')
print(n20, ' nota(s) de R$ 20,00')
print(n10, ' nota(s) de R$ 10,00')
print(n5, ' nota(s) de R$ 5,00')
print(n2, ' nota(s) de R$ 2,00')
print(n1, ' nota(s) de R$ 1,00')
|
"""
N = int(input())
notas100 = N//100
notas50 = (N-(notas100*100))//50
notas20 = (N-(notas100*100+notas50*50))//20
notas10 = (N-(notas100*100+notas50*50+notas20*20))//10
notas5 = (N-(notas100*100+notas50*50+notas20*20+notas10*10))//5
notas2 = (N-(notas100*100+notas50*50+notas20*20+notas10*10+notas5*5))//2
notas1 = (N-(notas100*100+notas50*50+notas20*20+notas10*10+notas5*5+notas2*2))
print(notas100, ' nota(s) de R$ 100,00')
print(notas50, ' nota(s) de R$ 50,00')
print(notas20, ' nota(s) de R$ 20,00')
print(notas10, ' nota(s) de R$ 10,00')
print(notas5, ' nota(s) de R$ 5,00')
print(notas2, ' nota(s) de R$ 2,00')
print(notas1, ' nota(s) de R$ 1,00')
"""
n = int(input())
n100 = N // 100
n = N - n100 * 100
n50 = N // 50
n = N - n50 * 50
n20 = N // 20
n = N - n20 * 20
n10 = N // 10
n = N - n10 * 10
n5 = N // 5
n = N - n5 * 5
n2 = N // 2
n = N - n2 * 2
n1 = N
print(n100, ' nota(s) de R$ 100,00')
print(n50, ' nota(s) de R$ 50,00')
print(n20, ' nota(s) de R$ 20,00')
print(n10, ' nota(s) de R$ 10,00')
print(n5, ' nota(s) de R$ 5,00')
print(n2, ' nota(s) de R$ 2,00')
print(n1, ' nota(s) de R$ 1,00')
|
# https://binarysearch.com/problems/Longest-Anagram-Subsequence
class Solution:
def solve(self, a, b):
letters = set(list(a)).intersection(set(list(b)))
length = 0
for i in letters:
length += min(a.count(i),b.count(i))
return length
|
class Solution:
def solve(self, a, b):
letters = set(list(a)).intersection(set(list(b)))
length = 0
for i in letters:
length += min(a.count(i), b.count(i))
return length
|
t = int(input())
while t > 0:
t -= 1
n,m,s = map(int, input().strip().split(' '))
k = (s+m-1)%n
if(k==0):
print (n)
else:
print (k)
|
t = int(input())
while t > 0:
t -= 1
(n, m, s) = map(int, input().strip().split(' '))
k = (s + m - 1) % n
if k == 0:
print(n)
else:
print(k)
|
'''
Description : Input In Function By .format Method
Function Date : 14 Feb 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
'''
# defination of function, use of .format method
def Addition(no1, no2):
ans = no1 + no2
return ans
def main():
print("enter first number")
value1 = int(input())
print("enter second number")
value2 = int(input())
ret = Addition(value1, value2)
print("Addition of {} and {} is {} ".format(value1, value2, ret))
if __name__ == "__main__":
main()
|
"""
Description : Input In Function By .format Method
Function Date : 14 Feb 2021
Function Author : Prasad Dangare
Input : Int
Output : Int
"""
def addition(no1, no2):
ans = no1 + no2
return ans
def main():
print('enter first number')
value1 = int(input())
print('enter second number')
value2 = int(input())
ret = addition(value1, value2)
print('Addition of {} and {} is {} '.format(value1, value2, ret))
if __name__ == '__main__':
main()
|
#cameraCoords syntax: [x1 (oben links),y1,x2 (unten rechts),y2,zoomLevel]
def moveCamera(cameraCoords, move,worldSize):
if cameraCoords[0]+move[0] <= 1 and move[0] < 0:
cameraCoords[0] -= cameraCoords[0]%1
cameraCoords[2] -= cameraCoords[2]%1
while cameraCoords[0] > 1:
cameraCoords[0] -= 1 #Wenn Kamera x-Koordinaten unter 0 gesetzt werden, werden die Koordinaten proportional angeglichen
cameraCoords[2] -= 1
elif cameraCoords[2]+move[0]+1 >= worldSize[0]:
return cameraCoords
else:
cameraCoords[0] += move[0]
cameraCoords[2] += move[0]#Bewegen (x)
if cameraCoords[1]+move[1] <= 1 and move[1] < 0:
cameraCoords[1] -= cameraCoords[1]%1
cameraCoords[3] -= cameraCoords[3]%1
while cameraCoords[1] > 1:
cameraCoords[1] -= 1#Wenn Kamera y-Koordinaten unter 0 gesetzt werden, werden die Koordinaten proportional angeglichen
cameraCoords[3] -= 1
elif cameraCoords[3]+move[1]+1 >= worldSize[1]:
return cameraCoords
else:
cameraCoords[1] += move[1]
cameraCoords[3] += move[1]#Bewegen (y)
return cameraCoords
|
def move_camera(cameraCoords, move, worldSize):
if cameraCoords[0] + move[0] <= 1 and move[0] < 0:
cameraCoords[0] -= cameraCoords[0] % 1
cameraCoords[2] -= cameraCoords[2] % 1
while cameraCoords[0] > 1:
cameraCoords[0] -= 1
cameraCoords[2] -= 1
elif cameraCoords[2] + move[0] + 1 >= worldSize[0]:
return cameraCoords
else:
cameraCoords[0] += move[0]
cameraCoords[2] += move[0]
if cameraCoords[1] + move[1] <= 1 and move[1] < 0:
cameraCoords[1] -= cameraCoords[1] % 1
cameraCoords[3] -= cameraCoords[3] % 1
while cameraCoords[1] > 1:
cameraCoords[1] -= 1
cameraCoords[3] -= 1
elif cameraCoords[3] + move[1] + 1 >= worldSize[1]:
return cameraCoords
else:
cameraCoords[1] += move[1]
cameraCoords[3] += move[1]
return cameraCoords
|
def display_board( state ):
print("-------------")
print("| %i | %i | %i |" % (state[0], state[1], state[2]))
print("-------------")
print("| %i | %i | %i |" % (state[3], state[4], state[5]))
print("-------------")
print("| %i | %i | %i |" % (state[6], state[7], state[8]))
print("-------------")
def move_up(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [0, 1, 2]:
new_state[idx - 3], new_state[idx] = new_state[idx], new_state[idx - 3]
return new_state
else:
return None
def move_down(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [6, 7, 8]:
new_state[idx + 3], new_state[idx] = new_state[idx], new_state[idx + 3]
return new_state
else:
return None
def move_left(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [0, 3, 6]:
new_state[idx - 1], new_state[idx] = new_state[idx], new_state[idx - 1]
return new_state
else:
return None
def move_right(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [2, 5, 8]:
new_state[idx + 1], new_state[idx] = new_state[idx], new_state[idx + 1]
return new_state
else:
return None
def expand_children_nodes(node, known_states):
expanded_nodes = []
expanded_nodes.append(Node(move_down(node.state), node, "d", node.depth + 1))
expanded_nodes.append(Node(move_up(node.state), node, "u", node.depth + 1))
expanded_nodes.append(Node(move_right(node.state), node, "r", node.depth + 1))
expanded_nodes.append(Node(move_left(node.state), node, "l", node.depth + 1))
expanded_nodes = [node for node in expanded_nodes if node.state != None and node.state not in [list(state) for state in known_states]]
return expanded_nodes
"""Performs a breadth first search from the start state to the goal"""
def bfs(start_state, goal_state):
nodes = []
known_states = set()
iterations = 0
nodes.append(Node(start_state, None, None, 0))
while True:
if len( nodes ) == 0: return None
iterations += 1
node = nodes.pop(0)
known_states.add(tuple(node.state))
if node.state == goal_state:
moves = []
temp = node
print('\nFINISHED')
display_board(node.state)
while True:
moves.insert(0, temp.operator)
if temp.depth == 1: break
temp = temp.parent
display_board(temp.state)
print('Initial state')
display_board(temp.parent.state)
print('Iterations: '+str(iterations))
return moves
nodes.extend(expand_children_nodes(node, known_states))
"""Performs a depth first search from the start state to the goal"""
def dfs(start_state, goal_state, depth=5):
depth_limit = depth
nodes = []
known_states = set()
iterations = 0
nodes.append(Node(start_state, None, None, 0))
while True:
if len(nodes) == 0: return None
node = nodes.pop(0)
known_states.add(tuple(node.state))
iterations += 1
if node.state == goal_state:
moves = []
temp = node
display_board(node.state)
while True:
moves.insert(0, temp.operator)
if temp.depth <= 1: break
temp = temp.parent
display_board(temp.state)
print('Initial state')
display_board(temp.parent.state)
print('Iterations: '+str(iterations))
return moves
if node.depth < depth_limit:
expanded_nodes = expand_children_nodes(node, known_states)
expanded_nodes.extend(nodes)
print([i.depth for i in expanded_nodes])
nodes = expanded_nodes
'''Node data structure'''
class Node:
def __init__(self, state, parent, operator, depth):
self.state = state
self.parent = parent
self.operator = operator
self.depth = depth
'''Main method'''
def main():
goal_state = [1, 2, 3, 4, 5, 6, 7, 8, 0]
'''Input Unit Test'''
# start_state = [1, 2, 3, 4, 5, 6, 7, 0, 8]
# start_state = [1, 2, 3, 0, 4, 5, 7, 8, 6]
start_state = [0, 2, 3, 1, 4, 5, 7, 8, 6]
# start_state = [0, 8, 7, 6, 5, 4, 3, 2, 1] # UNSOLVABLE (24 steps)
result = bfs(start_state, goal_state)
if result == None:
print("No solution found")
elif result == [None]:
print("Start node was the goal!")
else:
print(result)
print(len(result), " moves")
if __name__ == "__main__":
main()
|
def display_board(state):
print('-------------')
print('| %i | %i | %i |' % (state[0], state[1], state[2]))
print('-------------')
print('| %i | %i | %i |' % (state[3], state[4], state[5]))
print('-------------')
print('| %i | %i | %i |' % (state[6], state[7], state[8]))
print('-------------')
def move_up(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [0, 1, 2]:
(new_state[idx - 3], new_state[idx]) = (new_state[idx], new_state[idx - 3])
return new_state
else:
return None
def move_down(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [6, 7, 8]:
(new_state[idx + 3], new_state[idx]) = (new_state[idx], new_state[idx + 3])
return new_state
else:
return None
def move_left(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [0, 3, 6]:
(new_state[idx - 1], new_state[idx]) = (new_state[idx], new_state[idx - 1])
return new_state
else:
return None
def move_right(state):
new_state = state[:]
idx = new_state.index(0)
if idx not in [2, 5, 8]:
(new_state[idx + 1], new_state[idx]) = (new_state[idx], new_state[idx + 1])
return new_state
else:
return None
def expand_children_nodes(node, known_states):
expanded_nodes = []
expanded_nodes.append(node(move_down(node.state), node, 'd', node.depth + 1))
expanded_nodes.append(node(move_up(node.state), node, 'u', node.depth + 1))
expanded_nodes.append(node(move_right(node.state), node, 'r', node.depth + 1))
expanded_nodes.append(node(move_left(node.state), node, 'l', node.depth + 1))
expanded_nodes = [node for node in expanded_nodes if node.state != None and node.state not in [list(state) for state in known_states]]
return expanded_nodes
'Performs a breadth first search from the start state to the goal'
def bfs(start_state, goal_state):
nodes = []
known_states = set()
iterations = 0
nodes.append(node(start_state, None, None, 0))
while True:
if len(nodes) == 0:
return None
iterations += 1
node = nodes.pop(0)
known_states.add(tuple(node.state))
if node.state == goal_state:
moves = []
temp = node
print('\nFINISHED')
display_board(node.state)
while True:
moves.insert(0, temp.operator)
if temp.depth == 1:
break
temp = temp.parent
display_board(temp.state)
print('Initial state')
display_board(temp.parent.state)
print('Iterations: ' + str(iterations))
return moves
nodes.extend(expand_children_nodes(node, known_states))
'Performs a depth first search from the start state to the goal'
def dfs(start_state, goal_state, depth=5):
depth_limit = depth
nodes = []
known_states = set()
iterations = 0
nodes.append(node(start_state, None, None, 0))
while True:
if len(nodes) == 0:
return None
node = nodes.pop(0)
known_states.add(tuple(node.state))
iterations += 1
if node.state == goal_state:
moves = []
temp = node
display_board(node.state)
while True:
moves.insert(0, temp.operator)
if temp.depth <= 1:
break
temp = temp.parent
display_board(temp.state)
print('Initial state')
display_board(temp.parent.state)
print('Iterations: ' + str(iterations))
return moves
if node.depth < depth_limit:
expanded_nodes = expand_children_nodes(node, known_states)
expanded_nodes.extend(nodes)
print([i.depth for i in expanded_nodes])
nodes = expanded_nodes
'Node data structure'
class Node:
def __init__(self, state, parent, operator, depth):
self.state = state
self.parent = parent
self.operator = operator
self.depth = depth
'Main method'
def main():
goal_state = [1, 2, 3, 4, 5, 6, 7, 8, 0]
'Input Unit Test'
start_state = [0, 2, 3, 1, 4, 5, 7, 8, 6]
result = bfs(start_state, goal_state)
if result == None:
print('No solution found')
elif result == [None]:
print('Start node was the goal!')
else:
print(result)
print(len(result), ' moves')
if __name__ == '__main__':
main()
|
a = input ("Digite algo")
print(a.isalpha())
print(a.isalnum())
print(a.isascii())
print(a.isdecimal())
print(a.isdigit())
print(a.isidentifier())
print(a.islower())
|
a = input('Digite algo')
print(a.isalpha())
print(a.isalnum())
print(a.isascii())
print(a.isdecimal())
print(a.isdigit())
print(a.isidentifier())
print(a.islower())
|
class Node:
def __init__(self, val=0):
self.value = val
self.next = None
class LinkList:
c = 10
def __init__(self, *args):
self.val = (*args,)
self.head = self.__constructLinklist()
#self.printLinklist(self.head)
# self.pre = self.revserlinklist()
# self.printLinklist(self.pre)
def printLinklist(self, head):
while head is not None:
print(head.val)
head = head.next
def __constructLinklist(self):
dummyNode = Node()
head = Node(self.val[0])
dummyNode.next = head
for i in range(1, len(self.val)):
next = Node(self.val[i])
head.next = next
head = next
return dummyNode.next
def revserlinklist(self):
pre = None
while self.head is not None:
next = self.head.next
self.head.next = pre
pre = self.head
self.head = next
return pre
def revserFromM2N(self, m, n):
#if m<0 or n<0 or n>self.linklength():return None
head2=self.head
head3=self.head
head2.next.next.next=None
self.printLinklist(self.head)
def linklength(self):
length = 0
while self.head is not None:
self.head = self.head.next
length += 1
return length
a = LinkList(1, 2, 3, 4, 5)
a.revserFromM2N(2,3)
|
class Node:
def __init__(self, val=0):
self.value = val
self.next = None
class Linklist:
c = 10
def __init__(self, *args):
self.val = (*args,)
self.head = self.__constructLinklist()
def print_linklist(self, head):
while head is not None:
print(head.val)
head = head.next
def __construct_linklist(self):
dummy_node = node()
head = node(self.val[0])
dummyNode.next = head
for i in range(1, len(self.val)):
next = node(self.val[i])
head.next = next
head = next
return dummyNode.next
def revserlinklist(self):
pre = None
while self.head is not None:
next = self.head.next
self.head.next = pre
pre = self.head
self.head = next
return pre
def revser_from_m2_n(self, m, n):
head2 = self.head
head3 = self.head
head2.next.next.next = None
self.printLinklist(self.head)
def linklength(self):
length = 0
while self.head is not None:
self.head = self.head.next
length += 1
return length
a = link_list(1, 2, 3, 4, 5)
a.revserFromM2N(2, 3)
|
"""
Question 59 :
Print a unicode string "hello world".
Hints : Use u'string format to define unicode string
"""
# Solution :
unicode_string = u"hello world!"
print(unicode_string)
"""
Output :
hello world
"""
|
"""
Question 59 :
Print a unicode string "hello world".
Hints : Use u'string format to define unicode string
"""
unicode_string = u'hello world!'
print(unicode_string)
'\nOutput : \n hello world\n'
|
"""
PASSENGERS
"""
numPassengers = 4084
passenger_arriving = (
(4, 8, 15, 6, 6, 0, 9, 7, 7, 4, 1, 0), # 0
(4, 11, 5, 5, 2, 0, 7, 10, 6, 8, 2, 0), # 1
(11, 10, 4, 1, 1, 0, 5, 9, 13, 5, 1, 0), # 2
(5, 5, 9, 5, 1, 0, 6, 8, 7, 3, 2, 0), # 3
(5, 10, 8, 7, 1, 0, 8, 16, 10, 3, 3, 0), # 4
(6, 12, 7, 1, 4, 0, 10, 6, 6, 5, 4, 0), # 5
(9, 12, 6, 2, 5, 0, 13, 17, 5, 3, 1, 0), # 6
(5, 5, 8, 2, 2, 0, 11, 17, 7, 8, 5, 0), # 7
(7, 9, 5, 4, 3, 0, 9, 15, 6, 6, 1, 0), # 8
(1, 8, 9, 6, 4, 0, 6, 14, 4, 5, 2, 0), # 9
(5, 2, 13, 10, 4, 0, 15, 9, 3, 9, 2, 0), # 10
(6, 16, 7, 6, 2, 0, 12, 12, 8, 7, 1, 0), # 11
(5, 12, 7, 4, 3, 0, 13, 11, 7, 3, 3, 0), # 12
(4, 17, 13, 6, 4, 0, 10, 8, 8, 5, 3, 0), # 13
(1, 15, 9, 5, 0, 0, 5, 9, 7, 6, 1, 0), # 14
(5, 11, 6, 3, 1, 0, 5, 10, 5, 5, 3, 0), # 15
(2, 5, 12, 7, 4, 0, 9, 17, 10, 10, 0, 0), # 16
(6, 5, 7, 7, 0, 0, 11, 9, 5, 5, 2, 0), # 17
(6, 11, 11, 5, 2, 0, 13, 8, 7, 5, 7, 0), # 18
(6, 12, 10, 7, 4, 0, 11, 12, 6, 3, 2, 0), # 19
(4, 12, 11, 3, 5, 0, 8, 15, 14, 10, 5, 0), # 20
(3, 4, 13, 4, 3, 0, 6, 7, 8, 7, 7, 0), # 21
(11, 13, 11, 5, 2, 0, 5, 14, 8, 2, 7, 0), # 22
(8, 10, 11, 6, 3, 0, 4, 7, 5, 7, 1, 0), # 23
(6, 12, 9, 3, 3, 0, 7, 12, 13, 5, 2, 0), # 24
(4, 10, 9, 5, 0, 0, 12, 11, 9, 6, 2, 0), # 25
(5, 9, 12, 0, 5, 0, 13, 14, 4, 8, 5, 0), # 26
(8, 8, 11, 0, 6, 0, 6, 9, 5, 6, 2, 0), # 27
(5, 15, 6, 3, 3, 0, 9, 2, 11, 3, 4, 0), # 28
(5, 14, 9, 5, 4, 0, 6, 10, 7, 1, 2, 0), # 29
(5, 14, 7, 2, 6, 0, 13, 6, 6, 7, 1, 0), # 30
(4, 10, 10, 2, 0, 0, 8, 12, 6, 3, 3, 0), # 31
(3, 12, 12, 4, 5, 0, 9, 16, 2, 9, 2, 0), # 32
(7, 13, 9, 3, 4, 0, 3, 11, 8, 5, 2, 0), # 33
(7, 10, 10, 5, 3, 0, 5, 13, 11, 7, 5, 0), # 34
(10, 18, 7, 7, 7, 0, 6, 9, 4, 3, 2, 0), # 35
(7, 7, 3, 6, 6, 0, 12, 13, 8, 3, 4, 0), # 36
(7, 19, 12, 3, 2, 0, 8, 8, 4, 4, 3, 0), # 37
(7, 13, 8, 1, 2, 0, 13, 11, 5, 4, 3, 0), # 38
(7, 11, 10, 7, 1, 0, 11, 10, 4, 9, 2, 0), # 39
(6, 14, 8, 4, 4, 0, 7, 16, 7, 7, 3, 0), # 40
(2, 24, 12, 4, 5, 0, 9, 17, 6, 8, 2, 0), # 41
(6, 11, 2, 3, 1, 0, 3, 11, 8, 6, 3, 0), # 42
(9, 10, 11, 4, 3, 0, 6, 11, 6, 6, 2, 0), # 43
(6, 14, 16, 3, 2, 0, 7, 5, 6, 3, 2, 0), # 44
(5, 11, 9, 7, 1, 0, 12, 16, 11, 9, 4, 0), # 45
(6, 11, 12, 6, 3, 0, 6, 21, 4, 10, 4, 0), # 46
(5, 10, 10, 6, 0, 0, 10, 12, 6, 8, 2, 0), # 47
(4, 11, 10, 3, 4, 0, 13, 9, 4, 7, 4, 0), # 48
(6, 16, 10, 5, 4, 0, 8, 7, 12, 3, 6, 0), # 49
(4, 10, 4, 7, 5, 0, 5, 14, 3, 3, 7, 0), # 50
(6, 14, 12, 1, 4, 0, 5, 13, 8, 3, 6, 0), # 51
(6, 18, 12, 5, 2, 0, 8, 11, 7, 8, 1, 0), # 52
(8, 9, 7, 5, 5, 0, 4, 11, 10, 6, 2, 0), # 53
(10, 12, 7, 3, 1, 0, 10, 14, 6, 9, 4, 0), # 54
(3, 16, 13, 7, 4, 0, 6, 11, 7, 6, 4, 0), # 55
(8, 18, 5, 3, 3, 0, 5, 13, 6, 4, 1, 0), # 56
(8, 10, 8, 3, 3, 0, 5, 18, 11, 9, 2, 0), # 57
(3, 16, 7, 7, 1, 0, 4, 14, 5, 8, 5, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(4.769372805092186, 12.233629261363635, 14.389624839331619, 11.405298913043477, 12.857451923076923, 8.562228260869567), # 0
(4.81413961808604, 12.369674877683082, 14.46734796754499, 11.46881589673913, 12.953819711538461, 8.559309850543478), # 1
(4.8583952589991215, 12.503702525252525, 14.54322622107969, 11.530934782608696, 13.048153846153847, 8.556302173913043), # 2
(4.902102161984196, 12.635567578125, 14.617204169344474, 11.591602581521737, 13.14036778846154, 8.553205638586958), # 3
(4.94522276119403, 12.765125410353535, 14.689226381748071, 11.650766304347826, 13.230375, 8.550020652173911), # 4
(4.987719490781387, 12.892231395991162, 14.759237427699228, 11.708372961956522, 13.318088942307691, 8.546747622282608), # 5
(5.029554784899035, 13.01674090909091, 14.827181876606687, 11.764369565217393, 13.403423076923078, 8.54338695652174), # 6
(5.0706910776997365, 13.138509323705808, 14.893004297879177, 11.818703125, 13.486290865384618, 8.5399390625), # 7
(5.1110908033362605, 13.257392013888888, 14.956649260925452, 11.871320652173912, 13.56660576923077, 8.536404347826087), # 8
(5.1507163959613695, 13.373244353693181, 15.018061335154243, 11.922169157608696, 13.644281249999999, 8.532783220108696), # 9
(5.1895302897278315, 13.485921717171717, 15.077185089974291, 11.971195652173915, 13.719230769230771, 8.529076086956522), # 10
(5.227494918788412, 13.595279478377526, 15.133965094794343, 12.018347146739131, 13.791367788461539, 8.525283355978262), # 11
(5.2645727172958745, 13.701173011363636, 15.188345919023137, 12.063570652173912, 13.860605769230768, 8.521405434782608), # 12
(5.3007261194029835, 13.803457690183082, 15.240272132069407, 12.106813179347826, 13.926858173076925, 8.51744273097826), # 13
(5.335917559262511, 13.90198888888889, 15.289688303341899, 12.148021739130433, 13.99003846153846, 8.513395652173912), # 14
(5.370109471027217, 13.996621981534089, 15.336539002249355, 12.187143342391304, 14.050060096153846, 8.509264605978261), # 15
(5.403264288849868, 14.087212342171718, 15.380768798200515, 12.224124999999999, 14.10683653846154, 8.50505), # 16
(5.4353444468832315, 14.173615344854797, 15.422322260604112, 12.258913722826087, 14.16028125, 8.500752241847827), # 17
(5.46631237928007, 14.255686363636363, 15.461143958868895, 12.291456521739132, 14.210307692307696, 8.496371739130435), # 18
(5.496130520193152, 14.333280772569443, 15.4971784624036, 12.321700407608695, 14.256829326923079, 8.491908899456522), # 19
(5.524761303775241, 14.40625394570707, 15.530370340616965, 12.349592391304348, 14.299759615384616, 8.487364130434782), # 20
(5.552167164179106, 14.47446125710227, 15.56066416291774, 12.375079483695652, 14.339012019230768, 8.482737839673913), # 21
(5.578310535557506, 14.537758080808082, 15.588004498714653, 12.398108695652175, 14.374499999999998, 8.47803043478261), # 22
(5.603153852063214, 14.595999790877526, 15.612335917416454, 12.418627038043478, 14.40613701923077, 8.473242323369567), # 23
(5.62665954784899, 14.649041761363636, 15.633602988431875, 12.43658152173913, 14.433836538461538, 8.468373913043479), # 24
(5.648790057067603, 14.696739366319445, 15.651750281169667, 12.451919157608696, 14.457512019230768, 8.463425611413044), # 25
(5.669507813871817, 14.738947979797977, 15.66672236503856, 12.464586956521739, 14.477076923076922, 8.458397826086957), # 26
(5.688775252414398, 14.77552297585227, 15.6784638094473, 12.474531929347828, 14.492444711538463, 8.453290964673915), # 27
(5.7065548068481124, 14.806319728535353, 15.68691918380463, 12.481701086956523, 14.503528846153845, 8.448105434782608), # 28
(5.722808911325724, 14.831193611900254, 15.69203305751928, 12.486041440217392, 14.510242788461538, 8.44284164402174), # 29
(5.7375, 14.85, 15.69375, 12.4875, 14.512500000000001, 8.4375), # 30
(5.751246651214834, 14.865621839488634, 15.692462907608693, 12.487236580882353, 14.511678590425532, 8.430077267616193), # 31
(5.7646965153452685, 14.881037215909092, 15.68863804347826, 12.486451470588234, 14.509231914893617, 8.418644565217393), # 32
(5.777855634590792, 14.896244211647728, 15.682330027173915, 12.485152389705883, 14.50518630319149, 8.403313830584706), # 33
(5.790730051150895, 14.91124090909091, 15.67359347826087, 12.483347058823531, 14.499568085106382, 8.38419700149925), # 34
(5.803325807225064, 14.926025390624996, 15.662483016304348, 12.481043198529411, 14.492403590425532, 8.361406015742128), # 35
(5.815648945012788, 14.940595738636366, 15.649053260869564, 12.478248529411767, 14.48371914893617, 8.335052811094453), # 36
(5.8277055067135555, 14.954950035511365, 15.63335883152174, 12.474970772058823, 14.47354109042553, 8.305249325337332), # 37
(5.839501534526853, 14.969086363636364, 15.615454347826088, 12.471217647058824, 14.461895744680852, 8.272107496251873), # 38
(5.851043070652174, 14.983002805397728, 15.595394429347825, 12.466996875000001, 14.44880944148936, 8.23573926161919), # 39
(5.862336157289003, 14.99669744318182, 15.573233695652176, 12.462316176470589, 14.434308510638296, 8.196256559220389), # 40
(5.873386836636828, 15.010168359374997, 15.549026766304348, 12.457183272058824, 14.418419281914893, 8.153771326836583), # 41
(5.88420115089514, 15.023413636363639, 15.522828260869566, 12.451605882352942, 14.401168085106384, 8.108395502248875), # 42
(5.894785142263428, 15.03643135653409, 15.494692798913043, 12.445591727941178, 14.38258125, 8.060241023238381), # 43
(5.905144852941176, 15.049219602272727, 15.464675, 12.439148529411764, 14.36268510638298, 8.009419827586207), # 44
(5.915286325127877, 15.061776455965909, 15.432829483695656, 12.43228400735294, 14.341505984042554, 7.956043853073464), # 45
(5.925215601023019, 15.074100000000003, 15.39921086956522, 12.425005882352941, 14.319070212765958, 7.90022503748126), # 46
(5.934938722826087, 15.086188316761364, 15.363873777173913, 12.417321874999999, 14.295404122340427, 7.842075318590705), # 47
(5.944461732736574, 15.098039488636365, 15.326872826086957, 12.409239705882353, 14.27053404255319, 7.7817066341829095), # 48
(5.953790672953963, 15.10965159801136, 15.288262635869566, 12.400767095588236, 14.24448630319149, 7.71923092203898), # 49
(5.96293158567775, 15.121022727272724, 15.248097826086958, 12.391911764705883, 14.217287234042553, 7.65476011994003), # 50
(5.971890513107417, 15.132150958806818, 15.206433016304347, 12.38268143382353, 14.188963164893616, 7.588406165667167), # 51
(5.980673497442456, 15.143034375, 15.163322826086954, 12.373083823529411, 14.159540425531915, 7.5202809970015), # 52
(5.989286580882353, 15.153671058238638, 15.118821875, 12.363126654411765, 14.129045345744682, 7.450496551724138), # 53
(5.9977358056266, 15.164059090909088, 15.072984782608694, 12.352817647058824, 14.09750425531915, 7.379164767616192), # 54
(6.00602721387468, 15.174196555397728, 15.02586616847826, 12.342164522058825, 14.064943484042553, 7.306397582458771), # 55
(6.014166847826087, 15.184081534090907, 14.977520652173913, 12.331175, 14.031389361702129, 7.232306934032984), # 56
(6.022160749680308, 15.193712109375003, 14.92800285326087, 12.319856801470587, 13.996868218085105, 7.15700476011994), # 57
(6.030014961636829, 15.203086363636363, 14.877367391304347, 12.308217647058825, 13.961406382978723, 7.0806029985007495), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(4, 8, 15, 6, 6, 0, 9, 7, 7, 4, 1, 0), # 0
(8, 19, 20, 11, 8, 0, 16, 17, 13, 12, 3, 0), # 1
(19, 29, 24, 12, 9, 0, 21, 26, 26, 17, 4, 0), # 2
(24, 34, 33, 17, 10, 0, 27, 34, 33, 20, 6, 0), # 3
(29, 44, 41, 24, 11, 0, 35, 50, 43, 23, 9, 0), # 4
(35, 56, 48, 25, 15, 0, 45, 56, 49, 28, 13, 0), # 5
(44, 68, 54, 27, 20, 0, 58, 73, 54, 31, 14, 0), # 6
(49, 73, 62, 29, 22, 0, 69, 90, 61, 39, 19, 0), # 7
(56, 82, 67, 33, 25, 0, 78, 105, 67, 45, 20, 0), # 8
(57, 90, 76, 39, 29, 0, 84, 119, 71, 50, 22, 0), # 9
(62, 92, 89, 49, 33, 0, 99, 128, 74, 59, 24, 0), # 10
(68, 108, 96, 55, 35, 0, 111, 140, 82, 66, 25, 0), # 11
(73, 120, 103, 59, 38, 0, 124, 151, 89, 69, 28, 0), # 12
(77, 137, 116, 65, 42, 0, 134, 159, 97, 74, 31, 0), # 13
(78, 152, 125, 70, 42, 0, 139, 168, 104, 80, 32, 0), # 14
(83, 163, 131, 73, 43, 0, 144, 178, 109, 85, 35, 0), # 15
(85, 168, 143, 80, 47, 0, 153, 195, 119, 95, 35, 0), # 16
(91, 173, 150, 87, 47, 0, 164, 204, 124, 100, 37, 0), # 17
(97, 184, 161, 92, 49, 0, 177, 212, 131, 105, 44, 0), # 18
(103, 196, 171, 99, 53, 0, 188, 224, 137, 108, 46, 0), # 19
(107, 208, 182, 102, 58, 0, 196, 239, 151, 118, 51, 0), # 20
(110, 212, 195, 106, 61, 0, 202, 246, 159, 125, 58, 0), # 21
(121, 225, 206, 111, 63, 0, 207, 260, 167, 127, 65, 0), # 22
(129, 235, 217, 117, 66, 0, 211, 267, 172, 134, 66, 0), # 23
(135, 247, 226, 120, 69, 0, 218, 279, 185, 139, 68, 0), # 24
(139, 257, 235, 125, 69, 0, 230, 290, 194, 145, 70, 0), # 25
(144, 266, 247, 125, 74, 0, 243, 304, 198, 153, 75, 0), # 26
(152, 274, 258, 125, 80, 0, 249, 313, 203, 159, 77, 0), # 27
(157, 289, 264, 128, 83, 0, 258, 315, 214, 162, 81, 0), # 28
(162, 303, 273, 133, 87, 0, 264, 325, 221, 163, 83, 0), # 29
(167, 317, 280, 135, 93, 0, 277, 331, 227, 170, 84, 0), # 30
(171, 327, 290, 137, 93, 0, 285, 343, 233, 173, 87, 0), # 31
(174, 339, 302, 141, 98, 0, 294, 359, 235, 182, 89, 0), # 32
(181, 352, 311, 144, 102, 0, 297, 370, 243, 187, 91, 0), # 33
(188, 362, 321, 149, 105, 0, 302, 383, 254, 194, 96, 0), # 34
(198, 380, 328, 156, 112, 0, 308, 392, 258, 197, 98, 0), # 35
(205, 387, 331, 162, 118, 0, 320, 405, 266, 200, 102, 0), # 36
(212, 406, 343, 165, 120, 0, 328, 413, 270, 204, 105, 0), # 37
(219, 419, 351, 166, 122, 0, 341, 424, 275, 208, 108, 0), # 38
(226, 430, 361, 173, 123, 0, 352, 434, 279, 217, 110, 0), # 39
(232, 444, 369, 177, 127, 0, 359, 450, 286, 224, 113, 0), # 40
(234, 468, 381, 181, 132, 0, 368, 467, 292, 232, 115, 0), # 41
(240, 479, 383, 184, 133, 0, 371, 478, 300, 238, 118, 0), # 42
(249, 489, 394, 188, 136, 0, 377, 489, 306, 244, 120, 0), # 43
(255, 503, 410, 191, 138, 0, 384, 494, 312, 247, 122, 0), # 44
(260, 514, 419, 198, 139, 0, 396, 510, 323, 256, 126, 0), # 45
(266, 525, 431, 204, 142, 0, 402, 531, 327, 266, 130, 0), # 46
(271, 535, 441, 210, 142, 0, 412, 543, 333, 274, 132, 0), # 47
(275, 546, 451, 213, 146, 0, 425, 552, 337, 281, 136, 0), # 48
(281, 562, 461, 218, 150, 0, 433, 559, 349, 284, 142, 0), # 49
(285, 572, 465, 225, 155, 0, 438, 573, 352, 287, 149, 0), # 50
(291, 586, 477, 226, 159, 0, 443, 586, 360, 290, 155, 0), # 51
(297, 604, 489, 231, 161, 0, 451, 597, 367, 298, 156, 0), # 52
(305, 613, 496, 236, 166, 0, 455, 608, 377, 304, 158, 0), # 53
(315, 625, 503, 239, 167, 0, 465, 622, 383, 313, 162, 0), # 54
(318, 641, 516, 246, 171, 0, 471, 633, 390, 319, 166, 0), # 55
(326, 659, 521, 249, 174, 0, 476, 646, 396, 323, 167, 0), # 56
(334, 669, 529, 252, 177, 0, 481, 664, 407, 332, 169, 0), # 57
(337, 685, 536, 259, 178, 0, 485, 678, 412, 340, 174, 0), # 58
(337, 685, 536, 259, 178, 0, 485, 678, 412, 340, 174, 0), # 59
)
passenger_arriving_rate = (
(4.769372805092186, 9.786903409090908, 8.63377490359897, 4.56211956521739, 2.5714903846153843, 0.0, 8.562228260869567, 10.285961538461537, 6.843179347826086, 5.755849935732647, 2.446725852272727, 0.0), # 0
(4.81413961808604, 9.895739902146465, 8.680408780526994, 4.587526358695651, 2.5907639423076922, 0.0, 8.559309850543478, 10.363055769230769, 6.881289538043478, 5.786939187017995, 2.4739349755366162, 0.0), # 1
(4.8583952589991215, 10.00296202020202, 8.725935732647814, 4.612373913043478, 2.609630769230769, 0.0, 8.556302173913043, 10.438523076923076, 6.918560869565217, 5.817290488431875, 2.500740505050505, 0.0), # 2
(4.902102161984196, 10.1084540625, 8.770322501606683, 4.636641032608694, 2.628073557692308, 0.0, 8.553205638586958, 10.512294230769232, 6.954961548913042, 5.846881667737789, 2.527113515625, 0.0), # 3
(4.94522276119403, 10.212100328282828, 8.813535829048842, 4.66030652173913, 2.6460749999999997, 0.0, 8.550020652173911, 10.584299999999999, 6.990459782608696, 5.875690552699228, 2.553025082070707, 0.0), # 4
(4.987719490781387, 10.313785116792928, 8.855542456619537, 4.6833491847826085, 2.663617788461538, 0.0, 8.546747622282608, 10.654471153846153, 7.025023777173913, 5.90369497107969, 2.578446279198232, 0.0), # 5
(5.029554784899035, 10.413392727272727, 8.896309125964011, 4.705747826086957, 2.680684615384615, 0.0, 8.54338695652174, 10.72273846153846, 7.058621739130436, 5.930872750642674, 2.603348181818182, 0.0), # 6
(5.0706910776997365, 10.510807458964646, 8.935802578727506, 4.72748125, 2.697258173076923, 0.0, 8.5399390625, 10.789032692307693, 7.0912218750000005, 5.95720171915167, 2.6277018647411614, 0.0), # 7
(5.1110908033362605, 10.60591361111111, 8.97398955655527, 4.7485282608695645, 2.7133211538461537, 0.0, 8.536404347826087, 10.853284615384615, 7.122792391304347, 5.982659704370181, 2.6514784027777774, 0.0), # 8
(5.1507163959613695, 10.698595482954543, 9.010836801092546, 4.768867663043478, 2.7288562499999993, 0.0, 8.532783220108696, 10.915424999999997, 7.153301494565217, 6.007224534061697, 2.6746488707386358, 0.0), # 9
(5.1895302897278315, 10.788737373737373, 9.046311053984574, 4.7884782608695655, 2.743846153846154, 0.0, 8.529076086956522, 10.975384615384616, 7.182717391304348, 6.030874035989716, 2.697184343434343, 0.0), # 10
(5.227494918788412, 10.87622358270202, 9.080379056876605, 4.807338858695652, 2.7582735576923074, 0.0, 8.525283355978262, 11.03309423076923, 7.2110082880434785, 6.053586037917737, 2.719055895675505, 0.0), # 11
(5.2645727172958745, 10.960938409090907, 9.113007551413881, 4.825428260869565, 2.7721211538461534, 0.0, 8.521405434782608, 11.088484615384614, 7.238142391304347, 6.0753383676092545, 2.740234602272727, 0.0), # 12
(5.3007261194029835, 11.042766152146465, 9.144163279241644, 4.8427252717391305, 2.7853716346153847, 0.0, 8.51744273097826, 11.141486538461539, 7.264087907608696, 6.096108852827762, 2.760691538036616, 0.0), # 13
(5.335917559262511, 11.121591111111112, 9.173812982005138, 4.859208695652173, 2.7980076923076918, 0.0, 8.513395652173912, 11.192030769230767, 7.288813043478259, 6.115875321336759, 2.780397777777778, 0.0), # 14
(5.370109471027217, 11.19729758522727, 9.201923401349612, 4.874857336956521, 2.810012019230769, 0.0, 8.509264605978261, 11.240048076923076, 7.312286005434782, 6.134615600899742, 2.7993243963068175, 0.0), # 15
(5.403264288849868, 11.269769873737372, 9.228461278920308, 4.88965, 2.8213673076923076, 0.0, 8.50505, 11.28546923076923, 7.334474999999999, 6.152307519280206, 2.817442468434343, 0.0), # 16
(5.4353444468832315, 11.338892275883836, 9.253393356362468, 4.903565489130434, 2.83205625, 0.0, 8.500752241847827, 11.328225, 7.3553482336956515, 6.168928904241644, 2.834723068970959, 0.0), # 17
(5.46631237928007, 11.40454909090909, 9.276686375321336, 4.916582608695652, 2.842061538461539, 0.0, 8.496371739130435, 11.368246153846156, 7.374873913043479, 6.184457583547558, 2.8511372727272724, 0.0), # 18
(5.496130520193152, 11.466624618055553, 9.298307077442159, 4.928680163043477, 2.8513658653846155, 0.0, 8.491908899456522, 11.405463461538462, 7.393020244565217, 6.198871384961439, 2.866656154513888, 0.0), # 19
(5.524761303775241, 11.525003156565655, 9.318222204370178, 4.939836956521739, 2.859951923076923, 0.0, 8.487364130434782, 11.439807692307692, 7.409755434782609, 6.212148136246785, 2.8812507891414136, 0.0), # 20
(5.552167164179106, 11.579569005681815, 9.336398497750643, 4.95003179347826, 2.8678024038461536, 0.0, 8.482737839673913, 11.471209615384614, 7.425047690217391, 6.224265665167096, 2.894892251420454, 0.0), # 21
(5.578310535557506, 11.630206464646465, 9.352802699228791, 4.95924347826087, 2.8748999999999993, 0.0, 8.47803043478261, 11.499599999999997, 7.438865217391305, 6.235201799485861, 2.907551616161616, 0.0), # 22
(5.603153852063214, 11.67679983270202, 9.367401550449872, 4.967450815217391, 2.8812274038461534, 0.0, 8.473242323369567, 11.524909615384614, 7.451176222826087, 6.244934366966581, 2.919199958175505, 0.0), # 23
(5.62665954784899, 11.719233409090908, 9.380161793059125, 4.974632608695652, 2.8867673076923075, 0.0, 8.468373913043479, 11.54706923076923, 7.461948913043478, 6.25344119537275, 2.929808352272727, 0.0), # 24
(5.648790057067603, 11.757391493055556, 9.391050168701799, 4.980767663043478, 2.8915024038461534, 0.0, 8.463425611413044, 11.566009615384614, 7.471151494565217, 6.260700112467866, 2.939347873263889, 0.0), # 25
(5.669507813871817, 11.79115838383838, 9.400033419023135, 4.985834782608695, 2.8954153846153843, 0.0, 8.458397826086957, 11.581661538461537, 7.478752173913043, 6.266688946015424, 2.947789595959595, 0.0), # 26
(5.688775252414398, 11.820418380681815, 9.40707828566838, 4.989812771739131, 2.8984889423076923, 0.0, 8.453290964673915, 11.593955769230769, 7.484719157608696, 6.271385523778919, 2.9551045951704538, 0.0), # 27
(5.7065548068481124, 11.84505578282828, 9.412151510282778, 4.992680434782609, 2.9007057692307687, 0.0, 8.448105434782608, 11.602823076923075, 7.489020652173913, 6.274767673521851, 2.96126394570707, 0.0), # 28
(5.722808911325724, 11.864954889520202, 9.415219834511568, 4.994416576086956, 2.902048557692307, 0.0, 8.44284164402174, 11.608194230769229, 7.491624864130435, 6.276813223007712, 2.9662387223800506, 0.0), # 29
(5.7375, 11.879999999999999, 9.41625, 4.995, 2.9025, 0.0, 8.4375, 11.61, 7.4925, 6.277499999999999, 2.9699999999999998, 0.0), # 30
(5.751246651214834, 11.892497471590906, 9.415477744565216, 4.994894632352941, 2.9023357180851064, 0.0, 8.430077267616193, 11.609342872340426, 7.492341948529411, 6.276985163043476, 2.9731243678977264, 0.0), # 31
(5.7646965153452685, 11.904829772727274, 9.413182826086956, 4.994580588235293, 2.901846382978723, 0.0, 8.418644565217393, 11.607385531914892, 7.49187088235294, 6.275455217391303, 2.9762074431818184, 0.0), # 32
(5.777855634590792, 11.916995369318181, 9.40939801630435, 4.994060955882353, 2.9010372606382977, 0.0, 8.403313830584706, 11.60414904255319, 7.491091433823529, 6.272932010869566, 2.9792488423295453, 0.0), # 33
(5.790730051150895, 11.928992727272727, 9.40415608695652, 4.993338823529412, 2.899913617021276, 0.0, 8.38419700149925, 11.599654468085104, 7.490008235294118, 6.269437391304347, 2.9822481818181816, 0.0), # 34
(5.803325807225064, 11.940820312499996, 9.39748980978261, 4.9924172794117645, 2.898480718085106, 0.0, 8.361406015742128, 11.593922872340425, 7.488625919117647, 6.264993206521739, 2.985205078124999, 0.0), # 35
(5.815648945012788, 11.952476590909091, 9.389431956521738, 4.9912994117647065, 2.896743829787234, 0.0, 8.335052811094453, 11.586975319148936, 7.486949117647059, 6.259621304347825, 2.988119147727273, 0.0), # 36
(5.8277055067135555, 11.96396002840909, 9.380015298913044, 4.989988308823529, 2.8947082180851056, 0.0, 8.305249325337332, 11.578832872340422, 7.484982463235293, 6.253343532608695, 2.9909900071022726, 0.0), # 37
(5.839501534526853, 11.97526909090909, 9.369272608695653, 4.988487058823529, 2.89237914893617, 0.0, 8.272107496251873, 11.56951659574468, 7.4827305882352935, 6.246181739130434, 2.9938172727272727, 0.0), # 38
(5.851043070652174, 11.986402244318182, 9.357236657608695, 4.98679875, 2.8897618882978717, 0.0, 8.23573926161919, 11.559047553191487, 7.480198125, 6.23815777173913, 2.9966005610795454, 0.0), # 39
(5.862336157289003, 11.997357954545455, 9.343940217391305, 4.984926470588235, 2.886861702127659, 0.0, 8.196256559220389, 11.547446808510635, 7.477389705882353, 6.22929347826087, 2.999339488636364, 0.0), # 40
(5.873386836636828, 12.008134687499997, 9.329416059782607, 4.982873308823529, 2.8836838563829783, 0.0, 8.153771326836583, 11.534735425531913, 7.474309963235294, 6.219610706521738, 3.002033671874999, 0.0), # 41
(5.88420115089514, 12.01873090909091, 9.31369695652174, 4.980642352941176, 2.880233617021277, 0.0, 8.108395502248875, 11.520934468085107, 7.4709635294117644, 6.209131304347826, 3.0046827272727277, 0.0), # 42
(5.894785142263428, 12.02914508522727, 9.296815679347825, 4.978236691176471, 2.8765162499999994, 0.0, 8.060241023238381, 11.506064999999998, 7.467355036764706, 6.1978771195652165, 3.0072862713068176, 0.0), # 43
(5.905144852941176, 12.03937568181818, 9.278805, 4.975659411764705, 2.8725370212765955, 0.0, 8.009419827586207, 11.490148085106382, 7.4634891176470575, 6.1858699999999995, 3.009843920454545, 0.0), # 44
(5.915286325127877, 12.049421164772726, 9.259697690217394, 4.972913602941176, 2.8683011968085106, 0.0, 7.956043853073464, 11.473204787234042, 7.459370404411764, 6.1731317934782615, 3.0123552911931815, 0.0), # 45
(5.925215601023019, 12.059280000000001, 9.239526521739132, 4.970002352941176, 2.8638140425531913, 0.0, 7.90022503748126, 11.455256170212765, 7.455003529411765, 6.159684347826087, 3.0148200000000003, 0.0), # 46
(5.934938722826087, 12.06895065340909, 9.218324266304347, 4.966928749999999, 2.859080824468085, 0.0, 7.842075318590705, 11.43632329787234, 7.450393124999999, 6.145549510869564, 3.0172376633522724, 0.0), # 47
(5.944461732736574, 12.07843159090909, 9.196123695652174, 4.9636958823529405, 2.854106808510638, 0.0, 7.7817066341829095, 11.416427234042551, 7.445543823529412, 6.130749130434782, 3.0196078977272727, 0.0), # 48
(5.953790672953963, 12.087721278409088, 9.17295758152174, 4.960306838235294, 2.8488972606382976, 0.0, 7.71923092203898, 11.39558904255319, 7.4404602573529415, 6.115305054347826, 3.021930319602272, 0.0), # 49
(5.96293158567775, 12.096818181818177, 9.148858695652175, 4.956764705882353, 2.8434574468085105, 0.0, 7.65476011994003, 11.373829787234042, 7.43514705882353, 6.099239130434783, 3.0242045454545443, 0.0), # 50
(5.971890513107417, 12.105720767045453, 9.123859809782608, 4.953072573529411, 2.837792632978723, 0.0, 7.588406165667167, 11.351170531914892, 7.429608860294118, 6.082573206521738, 3.026430191761363, 0.0), # 51
(5.980673497442456, 12.114427499999998, 9.097993695652173, 4.949233529411764, 2.8319080851063827, 0.0, 7.5202809970015, 11.32763234042553, 7.4238502941176465, 6.065329130434781, 3.0286068749999995, 0.0), # 52
(5.989286580882353, 12.122936846590909, 9.071293125, 4.945250661764706, 2.8258090691489364, 0.0, 7.450496551724138, 11.303236276595745, 7.417875992647058, 6.04752875, 3.030734211647727, 0.0), # 53
(5.9977358056266, 12.13124727272727, 9.043790869565216, 4.941127058823529, 2.8195008510638297, 0.0, 7.379164767616192, 11.278003404255319, 7.411690588235294, 6.0291939130434775, 3.0328118181818176, 0.0), # 54
(6.00602721387468, 12.139357244318182, 9.015519701086955, 4.93686580882353, 2.8129886968085103, 0.0, 7.306397582458771, 11.251954787234041, 7.405298713235295, 6.010346467391304, 3.0348393110795455, 0.0), # 55
(6.014166847826087, 12.147265227272724, 8.986512391304348, 4.9324699999999995, 2.8062778723404254, 0.0, 7.232306934032984, 11.225111489361701, 7.398705, 5.991008260869565, 3.036816306818181, 0.0), # 56
(6.022160749680308, 12.154969687500001, 8.95680171195652, 4.927942720588234, 2.7993736436170207, 0.0, 7.15700476011994, 11.197494574468083, 7.391914080882352, 5.9712011413043475, 3.0387424218750003, 0.0), # 57
(6.030014961636829, 12.16246909090909, 8.926420434782608, 4.923287058823529, 2.792281276595744, 0.0, 7.0806029985007495, 11.169125106382976, 7.384930588235295, 5.950946956521738, 3.0406172727272724, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
77, # 1
)
|
"""
PASSENGERS
"""
num_passengers = 4084
passenger_arriving = ((4, 8, 15, 6, 6, 0, 9, 7, 7, 4, 1, 0), (4, 11, 5, 5, 2, 0, 7, 10, 6, 8, 2, 0), (11, 10, 4, 1, 1, 0, 5, 9, 13, 5, 1, 0), (5, 5, 9, 5, 1, 0, 6, 8, 7, 3, 2, 0), (5, 10, 8, 7, 1, 0, 8, 16, 10, 3, 3, 0), (6, 12, 7, 1, 4, 0, 10, 6, 6, 5, 4, 0), (9, 12, 6, 2, 5, 0, 13, 17, 5, 3, 1, 0), (5, 5, 8, 2, 2, 0, 11, 17, 7, 8, 5, 0), (7, 9, 5, 4, 3, 0, 9, 15, 6, 6, 1, 0), (1, 8, 9, 6, 4, 0, 6, 14, 4, 5, 2, 0), (5, 2, 13, 10, 4, 0, 15, 9, 3, 9, 2, 0), (6, 16, 7, 6, 2, 0, 12, 12, 8, 7, 1, 0), (5, 12, 7, 4, 3, 0, 13, 11, 7, 3, 3, 0), (4, 17, 13, 6, 4, 0, 10, 8, 8, 5, 3, 0), (1, 15, 9, 5, 0, 0, 5, 9, 7, 6, 1, 0), (5, 11, 6, 3, 1, 0, 5, 10, 5, 5, 3, 0), (2, 5, 12, 7, 4, 0, 9, 17, 10, 10, 0, 0), (6, 5, 7, 7, 0, 0, 11, 9, 5, 5, 2, 0), (6, 11, 11, 5, 2, 0, 13, 8, 7, 5, 7, 0), (6, 12, 10, 7, 4, 0, 11, 12, 6, 3, 2, 0), (4, 12, 11, 3, 5, 0, 8, 15, 14, 10, 5, 0), (3, 4, 13, 4, 3, 0, 6, 7, 8, 7, 7, 0), (11, 13, 11, 5, 2, 0, 5, 14, 8, 2, 7, 0), (8, 10, 11, 6, 3, 0, 4, 7, 5, 7, 1, 0), (6, 12, 9, 3, 3, 0, 7, 12, 13, 5, 2, 0), (4, 10, 9, 5, 0, 0, 12, 11, 9, 6, 2, 0), (5, 9, 12, 0, 5, 0, 13, 14, 4, 8, 5, 0), (8, 8, 11, 0, 6, 0, 6, 9, 5, 6, 2, 0), (5, 15, 6, 3, 3, 0, 9, 2, 11, 3, 4, 0), (5, 14, 9, 5, 4, 0, 6, 10, 7, 1, 2, 0), (5, 14, 7, 2, 6, 0, 13, 6, 6, 7, 1, 0), (4, 10, 10, 2, 0, 0, 8, 12, 6, 3, 3, 0), (3, 12, 12, 4, 5, 0, 9, 16, 2, 9, 2, 0), (7, 13, 9, 3, 4, 0, 3, 11, 8, 5, 2, 0), (7, 10, 10, 5, 3, 0, 5, 13, 11, 7, 5, 0), (10, 18, 7, 7, 7, 0, 6, 9, 4, 3, 2, 0), (7, 7, 3, 6, 6, 0, 12, 13, 8, 3, 4, 0), (7, 19, 12, 3, 2, 0, 8, 8, 4, 4, 3, 0), (7, 13, 8, 1, 2, 0, 13, 11, 5, 4, 3, 0), (7, 11, 10, 7, 1, 0, 11, 10, 4, 9, 2, 0), (6, 14, 8, 4, 4, 0, 7, 16, 7, 7, 3, 0), (2, 24, 12, 4, 5, 0, 9, 17, 6, 8, 2, 0), (6, 11, 2, 3, 1, 0, 3, 11, 8, 6, 3, 0), (9, 10, 11, 4, 3, 0, 6, 11, 6, 6, 2, 0), (6, 14, 16, 3, 2, 0, 7, 5, 6, 3, 2, 0), (5, 11, 9, 7, 1, 0, 12, 16, 11, 9, 4, 0), (6, 11, 12, 6, 3, 0, 6, 21, 4, 10, 4, 0), (5, 10, 10, 6, 0, 0, 10, 12, 6, 8, 2, 0), (4, 11, 10, 3, 4, 0, 13, 9, 4, 7, 4, 0), (6, 16, 10, 5, 4, 0, 8, 7, 12, 3, 6, 0), (4, 10, 4, 7, 5, 0, 5, 14, 3, 3, 7, 0), (6, 14, 12, 1, 4, 0, 5, 13, 8, 3, 6, 0), (6, 18, 12, 5, 2, 0, 8, 11, 7, 8, 1, 0), (8, 9, 7, 5, 5, 0, 4, 11, 10, 6, 2, 0), (10, 12, 7, 3, 1, 0, 10, 14, 6, 9, 4, 0), (3, 16, 13, 7, 4, 0, 6, 11, 7, 6, 4, 0), (8, 18, 5, 3, 3, 0, 5, 13, 6, 4, 1, 0), (8, 10, 8, 3, 3, 0, 5, 18, 11, 9, 2, 0), (3, 16, 7, 7, 1, 0, 4, 14, 5, 8, 5, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
station_arriving_intensity = ((4.769372805092186, 12.233629261363635, 14.389624839331619, 11.405298913043477, 12.857451923076923, 8.562228260869567), (4.81413961808604, 12.369674877683082, 14.46734796754499, 11.46881589673913, 12.953819711538461, 8.559309850543478), (4.8583952589991215, 12.503702525252525, 14.54322622107969, 11.530934782608696, 13.048153846153847, 8.556302173913043), (4.902102161984196, 12.635567578125, 14.617204169344474, 11.591602581521737, 13.14036778846154, 8.553205638586958), (4.94522276119403, 12.765125410353535, 14.689226381748071, 11.650766304347826, 13.230375, 8.550020652173911), (4.987719490781387, 12.892231395991162, 14.759237427699228, 11.708372961956522, 13.318088942307691, 8.546747622282608), (5.029554784899035, 13.01674090909091, 14.827181876606687, 11.764369565217393, 13.403423076923078, 8.54338695652174), (5.0706910776997365, 13.138509323705808, 14.893004297879177, 11.818703125, 13.486290865384618, 8.5399390625), (5.1110908033362605, 13.257392013888888, 14.956649260925452, 11.871320652173912, 13.56660576923077, 8.536404347826087), (5.1507163959613695, 13.373244353693181, 15.018061335154243, 11.922169157608696, 13.644281249999999, 8.532783220108696), (5.1895302897278315, 13.485921717171717, 15.077185089974291, 11.971195652173915, 13.719230769230771, 8.529076086956522), (5.227494918788412, 13.595279478377526, 15.133965094794343, 12.018347146739131, 13.791367788461539, 8.525283355978262), (5.2645727172958745, 13.701173011363636, 15.188345919023137, 12.063570652173912, 13.860605769230768, 8.521405434782608), (5.3007261194029835, 13.803457690183082, 15.240272132069407, 12.106813179347826, 13.926858173076925, 8.51744273097826), (5.335917559262511, 13.90198888888889, 15.289688303341899, 12.148021739130433, 13.99003846153846, 8.513395652173912), (5.370109471027217, 13.996621981534089, 15.336539002249355, 12.187143342391304, 14.050060096153846, 8.509264605978261), (5.403264288849868, 14.087212342171718, 15.380768798200515, 12.224124999999999, 14.10683653846154, 8.50505), (5.4353444468832315, 14.173615344854797, 15.422322260604112, 12.258913722826087, 14.16028125, 8.500752241847827), (5.46631237928007, 14.255686363636363, 15.461143958868895, 12.291456521739132, 14.210307692307696, 8.496371739130435), (5.496130520193152, 14.333280772569443, 15.4971784624036, 12.321700407608695, 14.256829326923079, 8.491908899456522), (5.524761303775241, 14.40625394570707, 15.530370340616965, 12.349592391304348, 14.299759615384616, 8.487364130434782), (5.552167164179106, 14.47446125710227, 15.56066416291774, 12.375079483695652, 14.339012019230768, 8.482737839673913), (5.578310535557506, 14.537758080808082, 15.588004498714653, 12.398108695652175, 14.374499999999998, 8.47803043478261), (5.603153852063214, 14.595999790877526, 15.612335917416454, 12.418627038043478, 14.40613701923077, 8.473242323369567), (5.62665954784899, 14.649041761363636, 15.633602988431875, 12.43658152173913, 14.433836538461538, 8.468373913043479), (5.648790057067603, 14.696739366319445, 15.651750281169667, 12.451919157608696, 14.457512019230768, 8.463425611413044), (5.669507813871817, 14.738947979797977, 15.66672236503856, 12.464586956521739, 14.477076923076922, 8.458397826086957), (5.688775252414398, 14.77552297585227, 15.6784638094473, 12.474531929347828, 14.492444711538463, 8.453290964673915), (5.7065548068481124, 14.806319728535353, 15.68691918380463, 12.481701086956523, 14.503528846153845, 8.448105434782608), (5.722808911325724, 14.831193611900254, 15.69203305751928, 12.486041440217392, 14.510242788461538, 8.44284164402174), (5.7375, 14.85, 15.69375, 12.4875, 14.512500000000001, 8.4375), (5.751246651214834, 14.865621839488634, 15.692462907608693, 12.487236580882353, 14.511678590425532, 8.430077267616193), (5.7646965153452685, 14.881037215909092, 15.68863804347826, 12.486451470588234, 14.509231914893617, 8.418644565217393), (5.777855634590792, 14.896244211647728, 15.682330027173915, 12.485152389705883, 14.50518630319149, 8.403313830584706), (5.790730051150895, 14.91124090909091, 15.67359347826087, 12.483347058823531, 14.499568085106382, 8.38419700149925), (5.803325807225064, 14.926025390624996, 15.662483016304348, 12.481043198529411, 14.492403590425532, 8.361406015742128), (5.815648945012788, 14.940595738636366, 15.649053260869564, 12.478248529411767, 14.48371914893617, 8.335052811094453), (5.8277055067135555, 14.954950035511365, 15.63335883152174, 12.474970772058823, 14.47354109042553, 8.305249325337332), (5.839501534526853, 14.969086363636364, 15.615454347826088, 12.471217647058824, 14.461895744680852, 8.272107496251873), (5.851043070652174, 14.983002805397728, 15.595394429347825, 12.466996875000001, 14.44880944148936, 8.23573926161919), (5.862336157289003, 14.99669744318182, 15.573233695652176, 12.462316176470589, 14.434308510638296, 8.196256559220389), (5.873386836636828, 15.010168359374997, 15.549026766304348, 12.457183272058824, 14.418419281914893, 8.153771326836583), (5.88420115089514, 15.023413636363639, 15.522828260869566, 12.451605882352942, 14.401168085106384, 8.108395502248875), (5.894785142263428, 15.03643135653409, 15.494692798913043, 12.445591727941178, 14.38258125, 8.060241023238381), (5.905144852941176, 15.049219602272727, 15.464675, 12.439148529411764, 14.36268510638298, 8.009419827586207), (5.915286325127877, 15.061776455965909, 15.432829483695656, 12.43228400735294, 14.341505984042554, 7.956043853073464), (5.925215601023019, 15.074100000000003, 15.39921086956522, 12.425005882352941, 14.319070212765958, 7.90022503748126), (5.934938722826087, 15.086188316761364, 15.363873777173913, 12.417321874999999, 14.295404122340427, 7.842075318590705), (5.944461732736574, 15.098039488636365, 15.326872826086957, 12.409239705882353, 14.27053404255319, 7.7817066341829095), (5.953790672953963, 15.10965159801136, 15.288262635869566, 12.400767095588236, 14.24448630319149, 7.71923092203898), (5.96293158567775, 15.121022727272724, 15.248097826086958, 12.391911764705883, 14.217287234042553, 7.65476011994003), (5.971890513107417, 15.132150958806818, 15.206433016304347, 12.38268143382353, 14.188963164893616, 7.588406165667167), (5.980673497442456, 15.143034375, 15.163322826086954, 12.373083823529411, 14.159540425531915, 7.5202809970015), (5.989286580882353, 15.153671058238638, 15.118821875, 12.363126654411765, 14.129045345744682, 7.450496551724138), (5.9977358056266, 15.164059090909088, 15.072984782608694, 12.352817647058824, 14.09750425531915, 7.379164767616192), (6.00602721387468, 15.174196555397728, 15.02586616847826, 12.342164522058825, 14.064943484042553, 7.306397582458771), (6.014166847826087, 15.184081534090907, 14.977520652173913, 12.331175, 14.031389361702129, 7.232306934032984), (6.022160749680308, 15.193712109375003, 14.92800285326087, 12.319856801470587, 13.996868218085105, 7.15700476011994), (6.030014961636829, 15.203086363636363, 14.877367391304347, 12.308217647058825, 13.961406382978723, 7.0806029985007495), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_arriving_acc = ((4, 8, 15, 6, 6, 0, 9, 7, 7, 4, 1, 0), (8, 19, 20, 11, 8, 0, 16, 17, 13, 12, 3, 0), (19, 29, 24, 12, 9, 0, 21, 26, 26, 17, 4, 0), (24, 34, 33, 17, 10, 0, 27, 34, 33, 20, 6, 0), (29, 44, 41, 24, 11, 0, 35, 50, 43, 23, 9, 0), (35, 56, 48, 25, 15, 0, 45, 56, 49, 28, 13, 0), (44, 68, 54, 27, 20, 0, 58, 73, 54, 31, 14, 0), (49, 73, 62, 29, 22, 0, 69, 90, 61, 39, 19, 0), (56, 82, 67, 33, 25, 0, 78, 105, 67, 45, 20, 0), (57, 90, 76, 39, 29, 0, 84, 119, 71, 50, 22, 0), (62, 92, 89, 49, 33, 0, 99, 128, 74, 59, 24, 0), (68, 108, 96, 55, 35, 0, 111, 140, 82, 66, 25, 0), (73, 120, 103, 59, 38, 0, 124, 151, 89, 69, 28, 0), (77, 137, 116, 65, 42, 0, 134, 159, 97, 74, 31, 0), (78, 152, 125, 70, 42, 0, 139, 168, 104, 80, 32, 0), (83, 163, 131, 73, 43, 0, 144, 178, 109, 85, 35, 0), (85, 168, 143, 80, 47, 0, 153, 195, 119, 95, 35, 0), (91, 173, 150, 87, 47, 0, 164, 204, 124, 100, 37, 0), (97, 184, 161, 92, 49, 0, 177, 212, 131, 105, 44, 0), (103, 196, 171, 99, 53, 0, 188, 224, 137, 108, 46, 0), (107, 208, 182, 102, 58, 0, 196, 239, 151, 118, 51, 0), (110, 212, 195, 106, 61, 0, 202, 246, 159, 125, 58, 0), (121, 225, 206, 111, 63, 0, 207, 260, 167, 127, 65, 0), (129, 235, 217, 117, 66, 0, 211, 267, 172, 134, 66, 0), (135, 247, 226, 120, 69, 0, 218, 279, 185, 139, 68, 0), (139, 257, 235, 125, 69, 0, 230, 290, 194, 145, 70, 0), (144, 266, 247, 125, 74, 0, 243, 304, 198, 153, 75, 0), (152, 274, 258, 125, 80, 0, 249, 313, 203, 159, 77, 0), (157, 289, 264, 128, 83, 0, 258, 315, 214, 162, 81, 0), (162, 303, 273, 133, 87, 0, 264, 325, 221, 163, 83, 0), (167, 317, 280, 135, 93, 0, 277, 331, 227, 170, 84, 0), (171, 327, 290, 137, 93, 0, 285, 343, 233, 173, 87, 0), (174, 339, 302, 141, 98, 0, 294, 359, 235, 182, 89, 0), (181, 352, 311, 144, 102, 0, 297, 370, 243, 187, 91, 0), (188, 362, 321, 149, 105, 0, 302, 383, 254, 194, 96, 0), (198, 380, 328, 156, 112, 0, 308, 392, 258, 197, 98, 0), (205, 387, 331, 162, 118, 0, 320, 405, 266, 200, 102, 0), (212, 406, 343, 165, 120, 0, 328, 413, 270, 204, 105, 0), (219, 419, 351, 166, 122, 0, 341, 424, 275, 208, 108, 0), (226, 430, 361, 173, 123, 0, 352, 434, 279, 217, 110, 0), (232, 444, 369, 177, 127, 0, 359, 450, 286, 224, 113, 0), (234, 468, 381, 181, 132, 0, 368, 467, 292, 232, 115, 0), (240, 479, 383, 184, 133, 0, 371, 478, 300, 238, 118, 0), (249, 489, 394, 188, 136, 0, 377, 489, 306, 244, 120, 0), (255, 503, 410, 191, 138, 0, 384, 494, 312, 247, 122, 0), (260, 514, 419, 198, 139, 0, 396, 510, 323, 256, 126, 0), (266, 525, 431, 204, 142, 0, 402, 531, 327, 266, 130, 0), (271, 535, 441, 210, 142, 0, 412, 543, 333, 274, 132, 0), (275, 546, 451, 213, 146, 0, 425, 552, 337, 281, 136, 0), (281, 562, 461, 218, 150, 0, 433, 559, 349, 284, 142, 0), (285, 572, 465, 225, 155, 0, 438, 573, 352, 287, 149, 0), (291, 586, 477, 226, 159, 0, 443, 586, 360, 290, 155, 0), (297, 604, 489, 231, 161, 0, 451, 597, 367, 298, 156, 0), (305, 613, 496, 236, 166, 0, 455, 608, 377, 304, 158, 0), (315, 625, 503, 239, 167, 0, 465, 622, 383, 313, 162, 0), (318, 641, 516, 246, 171, 0, 471, 633, 390, 319, 166, 0), (326, 659, 521, 249, 174, 0, 476, 646, 396, 323, 167, 0), (334, 669, 529, 252, 177, 0, 481, 664, 407, 332, 169, 0), (337, 685, 536, 259, 178, 0, 485, 678, 412, 340, 174, 0), (337, 685, 536, 259, 178, 0, 485, 678, 412, 340, 174, 0))
passenger_arriving_rate = ((4.769372805092186, 9.786903409090908, 8.63377490359897, 4.56211956521739, 2.5714903846153843, 0.0, 8.562228260869567, 10.285961538461537, 6.843179347826086, 5.755849935732647, 2.446725852272727, 0.0), (4.81413961808604, 9.895739902146465, 8.680408780526994, 4.587526358695651, 2.5907639423076922, 0.0, 8.559309850543478, 10.363055769230769, 6.881289538043478, 5.786939187017995, 2.4739349755366162, 0.0), (4.8583952589991215, 10.00296202020202, 8.725935732647814, 4.612373913043478, 2.609630769230769, 0.0, 8.556302173913043, 10.438523076923076, 6.918560869565217, 5.817290488431875, 2.500740505050505, 0.0), (4.902102161984196, 10.1084540625, 8.770322501606683, 4.636641032608694, 2.628073557692308, 0.0, 8.553205638586958, 10.512294230769232, 6.954961548913042, 5.846881667737789, 2.527113515625, 0.0), (4.94522276119403, 10.212100328282828, 8.813535829048842, 4.66030652173913, 2.6460749999999997, 0.0, 8.550020652173911, 10.584299999999999, 6.990459782608696, 5.875690552699228, 2.553025082070707, 0.0), (4.987719490781387, 10.313785116792928, 8.855542456619537, 4.6833491847826085, 2.663617788461538, 0.0, 8.546747622282608, 10.654471153846153, 7.025023777173913, 5.90369497107969, 2.578446279198232, 0.0), (5.029554784899035, 10.413392727272727, 8.896309125964011, 4.705747826086957, 2.680684615384615, 0.0, 8.54338695652174, 10.72273846153846, 7.058621739130436, 5.930872750642674, 2.603348181818182, 0.0), (5.0706910776997365, 10.510807458964646, 8.935802578727506, 4.72748125, 2.697258173076923, 0.0, 8.5399390625, 10.789032692307693, 7.0912218750000005, 5.95720171915167, 2.6277018647411614, 0.0), (5.1110908033362605, 10.60591361111111, 8.97398955655527, 4.7485282608695645, 2.7133211538461537, 0.0, 8.536404347826087, 10.853284615384615, 7.122792391304347, 5.982659704370181, 2.6514784027777774, 0.0), (5.1507163959613695, 10.698595482954543, 9.010836801092546, 4.768867663043478, 2.7288562499999993, 0.0, 8.532783220108696, 10.915424999999997, 7.153301494565217, 6.007224534061697, 2.6746488707386358, 0.0), (5.1895302897278315, 10.788737373737373, 9.046311053984574, 4.7884782608695655, 2.743846153846154, 0.0, 8.529076086956522, 10.975384615384616, 7.182717391304348, 6.030874035989716, 2.697184343434343, 0.0), (5.227494918788412, 10.87622358270202, 9.080379056876605, 4.807338858695652, 2.7582735576923074, 0.0, 8.525283355978262, 11.03309423076923, 7.2110082880434785, 6.053586037917737, 2.719055895675505, 0.0), (5.2645727172958745, 10.960938409090907, 9.113007551413881, 4.825428260869565, 2.7721211538461534, 0.0, 8.521405434782608, 11.088484615384614, 7.238142391304347, 6.0753383676092545, 2.740234602272727, 0.0), (5.3007261194029835, 11.042766152146465, 9.144163279241644, 4.8427252717391305, 2.7853716346153847, 0.0, 8.51744273097826, 11.141486538461539, 7.264087907608696, 6.096108852827762, 2.760691538036616, 0.0), (5.335917559262511, 11.121591111111112, 9.173812982005138, 4.859208695652173, 2.7980076923076918, 0.0, 8.513395652173912, 11.192030769230767, 7.288813043478259, 6.115875321336759, 2.780397777777778, 0.0), (5.370109471027217, 11.19729758522727, 9.201923401349612, 4.874857336956521, 2.810012019230769, 0.0, 8.509264605978261, 11.240048076923076, 7.312286005434782, 6.134615600899742, 2.7993243963068175, 0.0), (5.403264288849868, 11.269769873737372, 9.228461278920308, 4.88965, 2.8213673076923076, 0.0, 8.50505, 11.28546923076923, 7.334474999999999, 6.152307519280206, 2.817442468434343, 0.0), (5.4353444468832315, 11.338892275883836, 9.253393356362468, 4.903565489130434, 2.83205625, 0.0, 8.500752241847827, 11.328225, 7.3553482336956515, 6.168928904241644, 2.834723068970959, 0.0), (5.46631237928007, 11.40454909090909, 9.276686375321336, 4.916582608695652, 2.842061538461539, 0.0, 8.496371739130435, 11.368246153846156, 7.374873913043479, 6.184457583547558, 2.8511372727272724, 0.0), (5.496130520193152, 11.466624618055553, 9.298307077442159, 4.928680163043477, 2.8513658653846155, 0.0, 8.491908899456522, 11.405463461538462, 7.393020244565217, 6.198871384961439, 2.866656154513888, 0.0), (5.524761303775241, 11.525003156565655, 9.318222204370178, 4.939836956521739, 2.859951923076923, 0.0, 8.487364130434782, 11.439807692307692, 7.409755434782609, 6.212148136246785, 2.8812507891414136, 0.0), (5.552167164179106, 11.579569005681815, 9.336398497750643, 4.95003179347826, 2.8678024038461536, 0.0, 8.482737839673913, 11.471209615384614, 7.425047690217391, 6.224265665167096, 2.894892251420454, 0.0), (5.578310535557506, 11.630206464646465, 9.352802699228791, 4.95924347826087, 2.8748999999999993, 0.0, 8.47803043478261, 11.499599999999997, 7.438865217391305, 6.235201799485861, 2.907551616161616, 0.0), (5.603153852063214, 11.67679983270202, 9.367401550449872, 4.967450815217391, 2.8812274038461534, 0.0, 8.473242323369567, 11.524909615384614, 7.451176222826087, 6.244934366966581, 2.919199958175505, 0.0), (5.62665954784899, 11.719233409090908, 9.380161793059125, 4.974632608695652, 2.8867673076923075, 0.0, 8.468373913043479, 11.54706923076923, 7.461948913043478, 6.25344119537275, 2.929808352272727, 0.0), (5.648790057067603, 11.757391493055556, 9.391050168701799, 4.980767663043478, 2.8915024038461534, 0.0, 8.463425611413044, 11.566009615384614, 7.471151494565217, 6.260700112467866, 2.939347873263889, 0.0), (5.669507813871817, 11.79115838383838, 9.400033419023135, 4.985834782608695, 2.8954153846153843, 0.0, 8.458397826086957, 11.581661538461537, 7.478752173913043, 6.266688946015424, 2.947789595959595, 0.0), (5.688775252414398, 11.820418380681815, 9.40707828566838, 4.989812771739131, 2.8984889423076923, 0.0, 8.453290964673915, 11.593955769230769, 7.484719157608696, 6.271385523778919, 2.9551045951704538, 0.0), (5.7065548068481124, 11.84505578282828, 9.412151510282778, 4.992680434782609, 2.9007057692307687, 0.0, 8.448105434782608, 11.602823076923075, 7.489020652173913, 6.274767673521851, 2.96126394570707, 0.0), (5.722808911325724, 11.864954889520202, 9.415219834511568, 4.994416576086956, 2.902048557692307, 0.0, 8.44284164402174, 11.608194230769229, 7.491624864130435, 6.276813223007712, 2.9662387223800506, 0.0), (5.7375, 11.879999999999999, 9.41625, 4.995, 2.9025, 0.0, 8.4375, 11.61, 7.4925, 6.277499999999999, 2.9699999999999998, 0.0), (5.751246651214834, 11.892497471590906, 9.415477744565216, 4.994894632352941, 2.9023357180851064, 0.0, 8.430077267616193, 11.609342872340426, 7.492341948529411, 6.276985163043476, 2.9731243678977264, 0.0), (5.7646965153452685, 11.904829772727274, 9.413182826086956, 4.994580588235293, 2.901846382978723, 0.0, 8.418644565217393, 11.607385531914892, 7.49187088235294, 6.275455217391303, 2.9762074431818184, 0.0), (5.777855634590792, 11.916995369318181, 9.40939801630435, 4.994060955882353, 2.9010372606382977, 0.0, 8.403313830584706, 11.60414904255319, 7.491091433823529, 6.272932010869566, 2.9792488423295453, 0.0), (5.790730051150895, 11.928992727272727, 9.40415608695652, 4.993338823529412, 2.899913617021276, 0.0, 8.38419700149925, 11.599654468085104, 7.490008235294118, 6.269437391304347, 2.9822481818181816, 0.0), (5.803325807225064, 11.940820312499996, 9.39748980978261, 4.9924172794117645, 2.898480718085106, 0.0, 8.361406015742128, 11.593922872340425, 7.488625919117647, 6.264993206521739, 2.985205078124999, 0.0), (5.815648945012788, 11.952476590909091, 9.389431956521738, 4.9912994117647065, 2.896743829787234, 0.0, 8.335052811094453, 11.586975319148936, 7.486949117647059, 6.259621304347825, 2.988119147727273, 0.0), (5.8277055067135555, 11.96396002840909, 9.380015298913044, 4.989988308823529, 2.8947082180851056, 0.0, 8.305249325337332, 11.578832872340422, 7.484982463235293, 6.253343532608695, 2.9909900071022726, 0.0), (5.839501534526853, 11.97526909090909, 9.369272608695653, 4.988487058823529, 2.89237914893617, 0.0, 8.272107496251873, 11.56951659574468, 7.4827305882352935, 6.246181739130434, 2.9938172727272727, 0.0), (5.851043070652174, 11.986402244318182, 9.357236657608695, 4.98679875, 2.8897618882978717, 0.0, 8.23573926161919, 11.559047553191487, 7.480198125, 6.23815777173913, 2.9966005610795454, 0.0), (5.862336157289003, 11.997357954545455, 9.343940217391305, 4.984926470588235, 2.886861702127659, 0.0, 8.196256559220389, 11.547446808510635, 7.477389705882353, 6.22929347826087, 2.999339488636364, 0.0), (5.873386836636828, 12.008134687499997, 9.329416059782607, 4.982873308823529, 2.8836838563829783, 0.0, 8.153771326836583, 11.534735425531913, 7.474309963235294, 6.219610706521738, 3.002033671874999, 0.0), (5.88420115089514, 12.01873090909091, 9.31369695652174, 4.980642352941176, 2.880233617021277, 0.0, 8.108395502248875, 11.520934468085107, 7.4709635294117644, 6.209131304347826, 3.0046827272727277, 0.0), (5.894785142263428, 12.02914508522727, 9.296815679347825, 4.978236691176471, 2.8765162499999994, 0.0, 8.060241023238381, 11.506064999999998, 7.467355036764706, 6.1978771195652165, 3.0072862713068176, 0.0), (5.905144852941176, 12.03937568181818, 9.278805, 4.975659411764705, 2.8725370212765955, 0.0, 8.009419827586207, 11.490148085106382, 7.4634891176470575, 6.1858699999999995, 3.009843920454545, 0.0), (5.915286325127877, 12.049421164772726, 9.259697690217394, 4.972913602941176, 2.8683011968085106, 0.0, 7.956043853073464, 11.473204787234042, 7.459370404411764, 6.1731317934782615, 3.0123552911931815, 0.0), (5.925215601023019, 12.059280000000001, 9.239526521739132, 4.970002352941176, 2.8638140425531913, 0.0, 7.90022503748126, 11.455256170212765, 7.455003529411765, 6.159684347826087, 3.0148200000000003, 0.0), (5.934938722826087, 12.06895065340909, 9.218324266304347, 4.966928749999999, 2.859080824468085, 0.0, 7.842075318590705, 11.43632329787234, 7.450393124999999, 6.145549510869564, 3.0172376633522724, 0.0), (5.944461732736574, 12.07843159090909, 9.196123695652174, 4.9636958823529405, 2.854106808510638, 0.0, 7.7817066341829095, 11.416427234042551, 7.445543823529412, 6.130749130434782, 3.0196078977272727, 0.0), (5.953790672953963, 12.087721278409088, 9.17295758152174, 4.960306838235294, 2.8488972606382976, 0.0, 7.71923092203898, 11.39558904255319, 7.4404602573529415, 6.115305054347826, 3.021930319602272, 0.0), (5.96293158567775, 12.096818181818177, 9.148858695652175, 4.956764705882353, 2.8434574468085105, 0.0, 7.65476011994003, 11.373829787234042, 7.43514705882353, 6.099239130434783, 3.0242045454545443, 0.0), (5.971890513107417, 12.105720767045453, 9.123859809782608, 4.953072573529411, 2.837792632978723, 0.0, 7.588406165667167, 11.351170531914892, 7.429608860294118, 6.082573206521738, 3.026430191761363, 0.0), (5.980673497442456, 12.114427499999998, 9.097993695652173, 4.949233529411764, 2.8319080851063827, 0.0, 7.5202809970015, 11.32763234042553, 7.4238502941176465, 6.065329130434781, 3.0286068749999995, 0.0), (5.989286580882353, 12.122936846590909, 9.071293125, 4.945250661764706, 2.8258090691489364, 0.0, 7.450496551724138, 11.303236276595745, 7.417875992647058, 6.04752875, 3.030734211647727, 0.0), (5.9977358056266, 12.13124727272727, 9.043790869565216, 4.941127058823529, 2.8195008510638297, 0.0, 7.379164767616192, 11.278003404255319, 7.411690588235294, 6.0291939130434775, 3.0328118181818176, 0.0), (6.00602721387468, 12.139357244318182, 9.015519701086955, 4.93686580882353, 2.8129886968085103, 0.0, 7.306397582458771, 11.251954787234041, 7.405298713235295, 6.010346467391304, 3.0348393110795455, 0.0), (6.014166847826087, 12.147265227272724, 8.986512391304348, 4.9324699999999995, 2.8062778723404254, 0.0, 7.232306934032984, 11.225111489361701, 7.398705, 5.991008260869565, 3.036816306818181, 0.0), (6.022160749680308, 12.154969687500001, 8.95680171195652, 4.927942720588234, 2.7993736436170207, 0.0, 7.15700476011994, 11.197494574468083, 7.391914080882352, 5.9712011413043475, 3.0387424218750003, 0.0), (6.030014961636829, 12.16246909090909, 8.926420434782608, 4.923287058823529, 2.792281276595744, 0.0, 7.0806029985007495, 11.169125106382976, 7.384930588235295, 5.950946956521738, 3.0406172727272724, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_allighting_rate = ((0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1))
'\nparameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html\n'
entropy = 258194110137029475889902652135037600173
child_seed_index = (1, 77)
|
'''
__program__: Taking user input from the user
__author__: Abhinav Anil
__submittedTo__: dataSciTech
__email__: dataascii@gmail.com
__instagram__: @data.sci_
'''
#Taking the user name, PAN card number to validate the information for the user details.
while(1):
name = input("\n Enter your name : ")
if name.isalpha() == False:
print("Invalid Name, Sorry you cannot proceed.")
break
else:
pan_card_no = input("\n Enter your PAN card number : ")
if pan_card_no.isalnum == False:
print("Invalid PAN card number, Sorry you cannot proceed.")
break
print("Please check "+name, "your PAN card number is: "+pan_card_no)
break
|
"""
__program__: Taking user input from the user
__author__: Abhinav Anil
__submittedTo__: dataSciTech
__email__: dataascii@gmail.com
__instagram__: @data.sci_
"""
while 1:
name = input('\n Enter your name : ')
if name.isalpha() == False:
print('Invalid Name, Sorry you cannot proceed.')
break
else:
pan_card_no = input('\n Enter your PAN card number : ')
if pan_card_no.isalnum == False:
print('Invalid PAN card number, Sorry you cannot proceed.')
break
print('Please check ' + name, 'your PAN card number is: ' + pan_card_no)
break
|
peoples = {
'first_name': 'le',
'last_name': 'xiaoyuan',
'age': 21,
'city': 'dawu'
}
print(peoples['first_name'])
print(peoples['last_name'])
print(peoples['age'])
print(peoples['city'])
for people in peoples.values():
print(people)
lucky_number = {
'lexiaoyuan': 6,
'benjamin': 66,
'lexiaoyuanbeta': 666,
'yege': 6666,
'ruanwei': 66666
}
print('lexiaoyuan'.title() + "'s lucky number is " +
str(lucky_number['lexiaoyuan']))
print('benjamin'.title() + "'s lucky number is " +
str(lucky_number['benjamin']))
print('lexiaoyuanbeta'.title() + "'s lucky number is " +
str(lucky_number['lexiaoyuanbeta']))
print('yege'.title() + "'s lucky number is " +
str(lucky_number['yege']))
print('ruanwei'.title() + "'s lucky number is " +
str(lucky_number['ruanwei']))
for name, number in lucky_number.items():
print(name.title() + "'s lucky number is " + str(number))
dictionary = {
'if': 'if',
'for': 'for',
'list': 'list',
'title': 'title',
'upper': 'upper'
}
print("if: " + dictionary['if'])
print("for: " + dictionary['for'])
print("list: " + dictionary['list'])
print("title: " + dictionary['title'])
print("upper: " + dictionary['upper'])
for dic in dictionary.keys():
print(dic)
people_1 = {
'first_name': 'le',
'last_name': 'xiaoyuan',
'age': 21,
'city': 'dawu'
}
people_2 = {
'first_name': 'le',
'last_name': 'xiaoyuanbeta',
'age': 21,
'city': 'dawu'
}
people_3 = {
'first_name': 'ben',
'last_name': 'jamin',
'age': 21,
'city': 'dawu'
}
people = [people_1, people_2, people_3]
for p in people:
print(p)
lucky_numbers = {
'lexiaoyuan': [6, 66],
'benjamin': [66, 666],
'lexiaoyuanbeta': [666, 6666],
'yege': [6666, 66666],
'ruanwei': [66666, 666666],
}
for name, numbers in lucky_numbers.items():
print(name.title() + "'s favorite number are:")
for number in numbers:
print("\t" + str(number))
|
peoples = {'first_name': 'le', 'last_name': 'xiaoyuan', 'age': 21, 'city': 'dawu'}
print(peoples['first_name'])
print(peoples['last_name'])
print(peoples['age'])
print(peoples['city'])
for people in peoples.values():
print(people)
lucky_number = {'lexiaoyuan': 6, 'benjamin': 66, 'lexiaoyuanbeta': 666, 'yege': 6666, 'ruanwei': 66666}
print('lexiaoyuan'.title() + "'s lucky number is " + str(lucky_number['lexiaoyuan']))
print('benjamin'.title() + "'s lucky number is " + str(lucky_number['benjamin']))
print('lexiaoyuanbeta'.title() + "'s lucky number is " + str(lucky_number['lexiaoyuanbeta']))
print('yege'.title() + "'s lucky number is " + str(lucky_number['yege']))
print('ruanwei'.title() + "'s lucky number is " + str(lucky_number['ruanwei']))
for (name, number) in lucky_number.items():
print(name.title() + "'s lucky number is " + str(number))
dictionary = {'if': 'if', 'for': 'for', 'list': 'list', 'title': 'title', 'upper': 'upper'}
print('if: ' + dictionary['if'])
print('for: ' + dictionary['for'])
print('list: ' + dictionary['list'])
print('title: ' + dictionary['title'])
print('upper: ' + dictionary['upper'])
for dic in dictionary.keys():
print(dic)
people_1 = {'first_name': 'le', 'last_name': 'xiaoyuan', 'age': 21, 'city': 'dawu'}
people_2 = {'first_name': 'le', 'last_name': 'xiaoyuanbeta', 'age': 21, 'city': 'dawu'}
people_3 = {'first_name': 'ben', 'last_name': 'jamin', 'age': 21, 'city': 'dawu'}
people = [people_1, people_2, people_3]
for p in people:
print(p)
lucky_numbers = {'lexiaoyuan': [6, 66], 'benjamin': [66, 666], 'lexiaoyuanbeta': [666, 6666], 'yege': [6666, 66666], 'ruanwei': [66666, 666666]}
for (name, numbers) in lucky_numbers.items():
print(name.title() + "'s favorite number are:")
for number in numbers:
print('\t' + str(number))
|
# Problem! you teach children about how to calculate the area and perimeter of the square
# and you will solve 20 questions about the way to find area and perimeter. to teach them.
# but that will consume the time, so you want to write a program to reduce the time
# when calculating all 20 quests.
# Now try to solve it.
# Hint: perimeter = (x * 4), area = (x ** 2)
# The first method
def calc(x):
sideLength = x
print(f"area = {sideLength ** 2}")
print(f"perimeter = {sideLength * 4}")
calc(int(input()))
# The second method
calcs = lambda x : (x**2, x*4)
c1, c2 = calcs(int(input()))
print(f'area = {c1}\nperimeter = {c2}')
# The 3rd method
def calc2(x):
return (x**2, x*4)
a, b = calcs(int(input()))
print(str(a) + ' is area', str(b) + ' is perimeter')
|
def calc(x):
side_length = x
print(f'area = {sideLength ** 2}')
print(f'perimeter = {sideLength * 4}')
calc(int(input()))
calcs = lambda x: (x ** 2, x * 4)
(c1, c2) = calcs(int(input()))
print(f'area = {c1}\nperimeter = {c2}')
def calc2(x):
return (x ** 2, x * 4)
(a, b) = calcs(int(input()))
print(str(a) + ' is area', str(b) + ' is perimeter')
|
class PullRequest:
"""
This class models a pull-request.
"""
@staticmethod
def __initialize_files(files_string):
return files_string.split("|")
def __init__(self, data):
self.pr_id = data[0]
self.pull_number = data[1]
self.requester_login = data[2]
self.title = data[3]
self.description = data[4]
self.created_date = data[5]
self.merged_date = data[6]
self.integrator_login = data[7]
self.files = self.__initialize_files(data[8])
@property
def pr_id(self):
return self.__pr_id
@property
def pull_number(self):
return self.__pull_number
@property
def requester_login(self):
return self.__requester_login
@property
def title(self):
return self.__title
@property
def description(self):
return self.__description
@property
def created_date(self):
return self.__created_date
@property
def merged_date(self):
return self.__merged_date
@property
def integrator_login(self):
return self.__integrator_login
@property
def files(self):
return self.__files
@pr_id.setter
def pr_id(self, val):
self.__pr_id = val
@pull_number.setter
def pull_number(self, val):
self.__pull_number = val
@requester_login.setter
def requester_login(self, val):
self.__requester_login = val
@title.setter
def title(self, val):
self.__title = val
@description.setter
def description(self, val):
self.__description = val
@created_date.setter
def created_date(self, val):
self.__created_date = val
@merged_date.setter
def merged_date(self, val):
self.__merged_date = val
@integrator_login.setter
def integrator_login(self, val):
self.__integrator_login = val
@files.setter
def files(self, val):
self.__files = val
|
class Pullrequest:
"""
This class models a pull-request.
"""
@staticmethod
def __initialize_files(files_string):
return files_string.split('|')
def __init__(self, data):
self.pr_id = data[0]
self.pull_number = data[1]
self.requester_login = data[2]
self.title = data[3]
self.description = data[4]
self.created_date = data[5]
self.merged_date = data[6]
self.integrator_login = data[7]
self.files = self.__initialize_files(data[8])
@property
def pr_id(self):
return self.__pr_id
@property
def pull_number(self):
return self.__pull_number
@property
def requester_login(self):
return self.__requester_login
@property
def title(self):
return self.__title
@property
def description(self):
return self.__description
@property
def created_date(self):
return self.__created_date
@property
def merged_date(self):
return self.__merged_date
@property
def integrator_login(self):
return self.__integrator_login
@property
def files(self):
return self.__files
@pr_id.setter
def pr_id(self, val):
self.__pr_id = val
@pull_number.setter
def pull_number(self, val):
self.__pull_number = val
@requester_login.setter
def requester_login(self, val):
self.__requester_login = val
@title.setter
def title(self, val):
self.__title = val
@description.setter
def description(self, val):
self.__description = val
@created_date.setter
def created_date(self, val):
self.__created_date = val
@merged_date.setter
def merged_date(self, val):
self.__merged_date = val
@integrator_login.setter
def integrator_login(self, val):
self.__integrator_login = val
@files.setter
def files(self, val):
self.__files = val
|
# *** these filters do NOT see ping messages, nor do routers see them ***
# *** global imports are NOT accessible, do imports in __init__ and bind them to an attribute ***
class Filters(Base):
def __init__(self, logger):
# init parent class
super().__init__(logger)
# some imports needed later
self.random = __import__("random")
self.base64 = __import__("base64")
self._thread = __import__("_thread")
self.time = __import__("time")
# some vars
#self.master_killed = False
self.started = 0
self.data_received = {}
self.overlay_constructed = False
self.mutation_logged = False
def gui_command_incoming(self, command):
global task
pass
def gui_command_completed(self, command, error):
global task
if command["_command"] == "start":
if not error:
pass #self.logger.info("*********** STARTED")
else:
pass #self.logger.info("*********** ERROR STARTING ROUTER: %s" % str(error))
def gui_event_outgoing(self, event):
global task
pass
def router_command_incoming(self, command, router):
global task
if command["_command"] == "subscribe":
self.started = self.time.time()
if command["_command"] == "remove_connection" and task["name"] in ["test", "all_reconnects_on_packetloss"]:
self.logger.error("*********** CODE_EVENT(remove_connection): reconnects += 1")
def subscribed_datamsg_incoming(self, msg, router):
global task
pass
def covert_msg_incoming(self, msg, con):
global task
if msg.get_type() == "Flooding_advertise" and not msg["reflood"] and task["name"] in ["flooding_suboptimal_paths"]:
channel = msg["channel"]
nonce = self.base64.b64decode(bytes(msg["nonce"], "ascii")) # decode nonce
peer_id = con.get_peer_id()
chain = (self.router._find_nonce(nonce, self.router.advertisement_routing_table[channel])
if channel in self.router.advertisement_routing_table else None)
if chain: # new advertisements (chain == None) aren't relevant here
sorting = self.router._compare_nonces(nonce, self.router.advertisement_routing_table[channel][chain].peekitem(0)[0])
if sorting != -1:
return # received advertisement is longer than already known one
publisher = self.router._canonize_active_path_identifier(channel, msg['nonce'])
for subscriber in self.router._ActivePathsMixin__reverse_edges[channel]:
if publisher in self.router._ActivePathsMixin__reverse_edges[channel][subscriber]:
active_peer = self.router._ActivePathsMixin__reverse_edges[channel][subscriber][publisher]["peer"]
if sorting == -1 and active_peer != peer_id:
if self.router.node_id == subscriber:
self.logger.error("*********** CODE_EVENT(shorter_nonce): shorter_subscribers += 1")
else:
self.logger.error("*********** CODE_EVENT(shorter_nonce): shorter_intermediates += 1")
self.logger.info("*********** DEBUG_DATA: node_id=%s, subscriber=%s, msg=%s" % (self.router.node_id, subscriber, str(msg)))
def covert_msg_outgoing(self, msg, con):
global task
# only check first advertisements
if msg.get_type() == "Flooding_advertise" and not msg["reflood"] and task["name"] in ["flooding_master_count"]:
channel = msg["channel"]
nonce = self.base64.b64decode(bytes(msg["nonce"], "ascii")) # decode nonce
peer_id = con.get_peer_id()
chain = (self.router._find_nonce(nonce, self.router.advertisement_routing_table[channel])
if channel in self.router.advertisement_routing_table else None)
shortest_nonce = self.router.advertisement_routing_table[channel][chain].peekitem(0)[0]
if None in self.router.advertisement_routing_table[channel][chain][shortest_nonce] and not self.mutation_logged:
self.logger.error("*********** CODE_EVENT(become_master): master_publishers += 1")
self.logger.info("*********** DEBUG_DATA: node_id=%s" % self.router.node_id)
self.mutation_logged = True
def msg_incoming(self, msg, con):
global task
if task["name"] in [
"test",
"flooding_overlay_construction",
"aco_overlay_construction",
"aco_overlay_construction_bandwidth",
"flooding_overlay_construction_packetloss",
"aco_overlay_construction_packetloss",
"simple_overlay_construction",
"simple_overlay_construction_packetloss",
]:
if msg["channel"] in self.router.subscriptions and msg["id"] not in self.router.seen_data_ids: # only check subscriber perspective
if msg["data"] not in self.data_received:
self.data_received[msg["data"]] = 0
self.data_received[msg["data"]] += 1
self.logger.info("*********** DEBUG_DATA: data_received[%s] --> %s" % (str(msg["data"]), str(self.data_received[msg["data"]])))
if self.data_received[msg["data"]] == task["publishers"] and not self.overlay_constructed:
self.logger.error("*********** CODE_EVENT(overlay_constructed): overlay_construction.append(%.3f)" % (self.time.time() - self.started))
self.logger.info("*********** DEBUG_DATA: node_id = %s" % self.router.node_id)
#TODO: this should be used by the evaluator to stop evaluation earlier if possible
self.logger.info("*********** MEASUREMENT_COMPLETED: %s" % self.router.node_id)
self.overlay_constructed = True
def msg_outgoing(self, msg, con):
global task
#if msg.get_type() == "Flooding_data":
#if self.time.time() - self.started > 60 and "test" in self.router.master and self.router.master["test"] and not self.master_killed:
#self.logger.info("*********** KILLING MASTER NODE: node_id=%s" % self.router.node_id)
#self.master_killed = True
#self._thread.interrupt_main()
pass
|
class Filters(Base):
def __init__(self, logger):
super().__init__(logger)
self.random = __import__('random')
self.base64 = __import__('base64')
self._thread = __import__('_thread')
self.time = __import__('time')
self.started = 0
self.data_received = {}
self.overlay_constructed = False
self.mutation_logged = False
def gui_command_incoming(self, command):
global task
pass
def gui_command_completed(self, command, error):
global task
if command['_command'] == 'start':
if not error:
pass
else:
pass
def gui_event_outgoing(self, event):
global task
pass
def router_command_incoming(self, command, router):
global task
if command['_command'] == 'subscribe':
self.started = self.time.time()
if command['_command'] == 'remove_connection' and task['name'] in ['test', 'all_reconnects_on_packetloss']:
self.logger.error('*********** CODE_EVENT(remove_connection): reconnects += 1')
def subscribed_datamsg_incoming(self, msg, router):
global task
pass
def covert_msg_incoming(self, msg, con):
global task
if msg.get_type() == 'Flooding_advertise' and (not msg['reflood']) and (task['name'] in ['flooding_suboptimal_paths']):
channel = msg['channel']
nonce = self.base64.b64decode(bytes(msg['nonce'], 'ascii'))
peer_id = con.get_peer_id()
chain = self.router._find_nonce(nonce, self.router.advertisement_routing_table[channel]) if channel in self.router.advertisement_routing_table else None
if chain:
sorting = self.router._compare_nonces(nonce, self.router.advertisement_routing_table[channel][chain].peekitem(0)[0])
if sorting != -1:
return
publisher = self.router._canonize_active_path_identifier(channel, msg['nonce'])
for subscriber in self.router._ActivePathsMixin__reverse_edges[channel]:
if publisher in self.router._ActivePathsMixin__reverse_edges[channel][subscriber]:
active_peer = self.router._ActivePathsMixin__reverse_edges[channel][subscriber][publisher]['peer']
if sorting == -1 and active_peer != peer_id:
if self.router.node_id == subscriber:
self.logger.error('*********** CODE_EVENT(shorter_nonce): shorter_subscribers += 1')
else:
self.logger.error('*********** CODE_EVENT(shorter_nonce): shorter_intermediates += 1')
self.logger.info('*********** DEBUG_DATA: node_id=%s, subscriber=%s, msg=%s' % (self.router.node_id, subscriber, str(msg)))
def covert_msg_outgoing(self, msg, con):
global task
if msg.get_type() == 'Flooding_advertise' and (not msg['reflood']) and (task['name'] in ['flooding_master_count']):
channel = msg['channel']
nonce = self.base64.b64decode(bytes(msg['nonce'], 'ascii'))
peer_id = con.get_peer_id()
chain = self.router._find_nonce(nonce, self.router.advertisement_routing_table[channel]) if channel in self.router.advertisement_routing_table else None
shortest_nonce = self.router.advertisement_routing_table[channel][chain].peekitem(0)[0]
if None in self.router.advertisement_routing_table[channel][chain][shortest_nonce] and (not self.mutation_logged):
self.logger.error('*********** CODE_EVENT(become_master): master_publishers += 1')
self.logger.info('*********** DEBUG_DATA: node_id=%s' % self.router.node_id)
self.mutation_logged = True
def msg_incoming(self, msg, con):
global task
if task['name'] in ['test', 'flooding_overlay_construction', 'aco_overlay_construction', 'aco_overlay_construction_bandwidth', 'flooding_overlay_construction_packetloss', 'aco_overlay_construction_packetloss', 'simple_overlay_construction', 'simple_overlay_construction_packetloss']:
if msg['channel'] in self.router.subscriptions and msg['id'] not in self.router.seen_data_ids:
if msg['data'] not in self.data_received:
self.data_received[msg['data']] = 0
self.data_received[msg['data']] += 1
self.logger.info('*********** DEBUG_DATA: data_received[%s] --> %s' % (str(msg['data']), str(self.data_received[msg['data']])))
if self.data_received[msg['data']] == task['publishers'] and (not self.overlay_constructed):
self.logger.error('*********** CODE_EVENT(overlay_constructed): overlay_construction.append(%.3f)' % (self.time.time() - self.started))
self.logger.info('*********** DEBUG_DATA: node_id = %s' % self.router.node_id)
self.logger.info('*********** MEASUREMENT_COMPLETED: %s' % self.router.node_id)
self.overlay_constructed = True
def msg_outgoing(self, msg, con):
global task
pass
|
class HwndSourceParameters(object):
"""
Contains the parameters that are used to create an System.Windows.Interop.HwndSource object using the System.Windows.Interop.HwndSource.#ctor(System.Windows.Interop.HwndSourceParameters) constructor.
HwndSourceParameters(name: str)
HwndSourceParameters(name: str,width: int,height: int)
"""
def Equals(self,obj):
"""
Equals(self: HwndSourceParameters,obj: HwndSourceParameters) -> bool
Determines whether this structure is equal to a specified
System.Windows.Interop.HwndSourceParameters structure.
obj: The structure to be tested for equality.
Returns: true if the structures are equal; otherwise,false.
Equals(self: HwndSourceParameters,obj: object) -> bool
Determines whether this structure is equal to a specified object.
obj: The objects to be tested for equality.
Returns: true if the comparison is equal; otherwise,false.
"""
pass
def GetHashCode(self):
"""
GetHashCode(self: HwndSourceParameters) -> int
Returns the hash code for this System.Windows.Interop.HwndSourceParameters
instance.
Returns: A 32-bit signed integer hash code.
"""
pass
def SetPosition(self,x,y):
"""
SetPosition(self: HwndSourceParameters,x: int,y: int)
Sets the values that are used for the screen position of the window for the
System.Windows.Interop.HwndSource.
x: The position of the left edge of the window.
y: The position of the upper edge of the window.
"""
pass
def SetSize(self,width,height):
"""
SetSize(self: HwndSourceParameters,width: int,height: int)
Sets the values that are used for the window size of the
System.Windows.Interop.HwndSource.
width: The width of the window,in device pixels.
height: The height of the window,in device pixels.
"""
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
@staticmethod
def __new__(self,name,width=None,height=None):
"""
__new__[HwndSourceParameters]() -> HwndSourceParameters
__new__(cls: type,name: str)
__new__(cls: type,name: str,width: int,height: int)
"""
pass
def __ne__(self,*args):
pass
AcquireHwndFocusInMenuMode=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the value that determines whether to acquire Win32 focus for the WPF containing window when an System.Windows.Interop.HwndSource is created.
Get: AcquireHwndFocusInMenuMode(self: HwndSourceParameters) -> bool
Set: AcquireHwndFocusInMenuMode(self: HwndSourceParameters)=value
"""
AdjustSizingForNonClientArea=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates whether to include the nonclient area for sizing.
Get: AdjustSizingForNonClientArea(self: HwndSourceParameters) -> bool
Set: AdjustSizingForNonClientArea(self: HwndSourceParameters)=value
"""
ExtendedWindowStyle=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the extended Microsoft Windows styles for the window.
Get: ExtendedWindowStyle(self: HwndSourceParameters) -> int
Set: ExtendedWindowStyle(self: HwndSourceParameters)=value
"""
HasAssignedSize=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that indicates whether a size was assigned.
Get: HasAssignedSize(self: HwndSourceParameters) -> bool
"""
Height=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates the height of the window.
Get: Height(self: HwndSourceParameters) -> int
Set: Height(self: HwndSourceParameters)=value
"""
HwndSourceHook=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the message hook for the window.
Get: HwndSourceHook(self: HwndSourceParameters) -> HwndSourceHook
Set: HwndSourceHook(self: HwndSourceParameters)=value
"""
ParentWindow=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the window handle (HWND) of the parent for the created window.
Get: ParentWindow(self: HwndSourceParameters) -> IntPtr
Set: ParentWindow(self: HwndSourceParameters)=value
"""
PositionX=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the left-edge position of the window.
Get: PositionX(self: HwndSourceParameters) -> int
Set: PositionX(self: HwndSourceParameters)=value
"""
PositionY=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the upper-edge position of the window.
Get: PositionY(self: HwndSourceParameters) -> int
Set: PositionY(self: HwndSourceParameters)=value
"""
RestoreFocusMode=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets how WPF handles restoring focus to the window.
Get: RestoreFocusMode(self: HwndSourceParameters) -> RestoreFocusMode
Set: RestoreFocusMode(self: HwndSourceParameters)=value
"""
TreatAncestorsAsNonClientArea=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: TreatAncestorsAsNonClientArea(self: HwndSourceParameters) -> bool
Set: TreatAncestorsAsNonClientArea(self: HwndSourceParameters)=value
"""
TreatAsInputRoot=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: TreatAsInputRoot(self: HwndSourceParameters) -> bool
Set: TreatAsInputRoot(self: HwndSourceParameters)=value
"""
UsesPerPixelOpacity=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that declares whether the per-pixel opacity of the source window content is respected.
Get: UsesPerPixelOpacity(self: HwndSourceParameters) -> bool
Set: UsesPerPixelOpacity(self: HwndSourceParameters)=value
"""
UsesPerPixelTransparency=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: UsesPerPixelTransparency(self: HwndSourceParameters) -> bool
Set: UsesPerPixelTransparency(self: HwndSourceParameters)=value
"""
Width=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value that indicates the width of the window.
Get: Width(self: HwndSourceParameters) -> int
Set: Width(self: HwndSourceParameters)=value
"""
WindowClassStyle=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the Microsoft Windows class style for the window.
Get: WindowClassStyle(self: HwndSourceParameters) -> int
Set: WindowClassStyle(self: HwndSourceParameters)=value
"""
WindowName=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the name of the window.
Get: WindowName(self: HwndSourceParameters) -> str
Set: WindowName(self: HwndSourceParameters)=value
"""
WindowStyle=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the style for the window.
Get: WindowStyle(self: HwndSourceParameters) -> int
Set: WindowStyle(self: HwndSourceParameters)=value
"""
|
class Hwndsourceparameters(object):
"""
Contains the parameters that are used to create an System.Windows.Interop.HwndSource object using the System.Windows.Interop.HwndSource.#ctor(System.Windows.Interop.HwndSourceParameters) constructor.
HwndSourceParameters(name: str)
HwndSourceParameters(name: str,width: int,height: int)
"""
def equals(self, obj):
"""
Equals(self: HwndSourceParameters,obj: HwndSourceParameters) -> bool
Determines whether this structure is equal to a specified
System.Windows.Interop.HwndSourceParameters structure.
obj: The structure to be tested for equality.
Returns: true if the structures are equal; otherwise,false.
Equals(self: HwndSourceParameters,obj: object) -> bool
Determines whether this structure is equal to a specified object.
obj: The objects to be tested for equality.
Returns: true if the comparison is equal; otherwise,false.
"""
pass
def get_hash_code(self):
"""
GetHashCode(self: HwndSourceParameters) -> int
Returns the hash code for this System.Windows.Interop.HwndSourceParameters
instance.
Returns: A 32-bit signed integer hash code.
"""
pass
def set_position(self, x, y):
"""
SetPosition(self: HwndSourceParameters,x: int,y: int)
Sets the values that are used for the screen position of the window for the
System.Windows.Interop.HwndSource.
x: The position of the left edge of the window.
y: The position of the upper edge of the window.
"""
pass
def set_size(self, width, height):
"""
SetSize(self: HwndSourceParameters,width: int,height: int)
Sets the values that are used for the window size of the
System.Windows.Interop.HwndSource.
width: The width of the window,in device pixels.
height: The height of the window,in device pixels.
"""
pass
def __eq__(self, *args):
""" x.__eq__(y) <==> x==y """
pass
@staticmethod
def __new__(self, name, width=None, height=None):
"""
__new__[HwndSourceParameters]() -> HwndSourceParameters
__new__(cls: type,name: str)
__new__(cls: type,name: str,width: int,height: int)
"""
pass
def __ne__(self, *args):
pass
acquire_hwnd_focus_in_menu_mode = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the value that determines whether to acquire Win32 focus for the WPF containing window when an System.Windows.Interop.HwndSource is created.\n\n\n\nGet: AcquireHwndFocusInMenuMode(self: HwndSourceParameters) -> bool\n\n\n\nSet: AcquireHwndFocusInMenuMode(self: HwndSourceParameters)=value\n\n'
adjust_sizing_for_non_client_area = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates whether to include the nonclient area for sizing.\n\n\n\nGet: AdjustSizingForNonClientArea(self: HwndSourceParameters) -> bool\n\n\n\nSet: AdjustSizingForNonClientArea(self: HwndSourceParameters)=value\n\n'
extended_window_style = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the extended Microsoft Windows styles for the window.\n\n\n\nGet: ExtendedWindowStyle(self: HwndSourceParameters) -> int\n\n\n\nSet: ExtendedWindowStyle(self: HwndSourceParameters)=value\n\n'
has_assigned_size = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that indicates whether a size was assigned.\n\n\n\nGet: HasAssignedSize(self: HwndSourceParameters) -> bool\n\n\n\n'
height = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates the height of the window.\n\n\n\nGet: Height(self: HwndSourceParameters) -> int\n\n\n\nSet: Height(self: HwndSourceParameters)=value\n\n'
hwnd_source_hook = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the message hook for the window.\n\n\n\nGet: HwndSourceHook(self: HwndSourceParameters) -> HwndSourceHook\n\n\n\nSet: HwndSourceHook(self: HwndSourceParameters)=value\n\n'
parent_window = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the window handle (HWND) of the parent for the created window.\n\n\n\nGet: ParentWindow(self: HwndSourceParameters) -> IntPtr\n\n\n\nSet: ParentWindow(self: HwndSourceParameters)=value\n\n'
position_x = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the left-edge position of the window.\n\n\n\nGet: PositionX(self: HwndSourceParameters) -> int\n\n\n\nSet: PositionX(self: HwndSourceParameters)=value\n\n'
position_y = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the upper-edge position of the window.\n\n\n\nGet: PositionY(self: HwndSourceParameters) -> int\n\n\n\nSet: PositionY(self: HwndSourceParameters)=value\n\n'
restore_focus_mode = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets how WPF handles restoring focus to the window.\n\n\n\nGet: RestoreFocusMode(self: HwndSourceParameters) -> RestoreFocusMode\n\n\n\nSet: RestoreFocusMode(self: HwndSourceParameters)=value\n\n'
treat_ancestors_as_non_client_area = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: TreatAncestorsAsNonClientArea(self: HwndSourceParameters) -> bool\n\n\n\nSet: TreatAncestorsAsNonClientArea(self: HwndSourceParameters)=value\n\n'
treat_as_input_root = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: TreatAsInputRoot(self: HwndSourceParameters) -> bool\n\n\n\nSet: TreatAsInputRoot(self: HwndSourceParameters)=value\n\n'
uses_per_pixel_opacity = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value that declares whether the per-pixel opacity of the source window content is respected.\n\n\n\nGet: UsesPerPixelOpacity(self: HwndSourceParameters) -> bool\n\n\n\nSet: UsesPerPixelOpacity(self: HwndSourceParameters)=value\n\n'
uses_per_pixel_transparency = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: UsesPerPixelTransparency(self: HwndSourceParameters) -> bool\n\n\n\nSet: UsesPerPixelTransparency(self: HwndSourceParameters)=value\n\n'
width = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets a value that indicates the width of the window.\n\n\n\nGet: Width(self: HwndSourceParameters) -> int\n\n\n\nSet: Width(self: HwndSourceParameters)=value\n\n'
window_class_style = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the Microsoft Windows class style for the window.\n\n\n\nGet: WindowClassStyle(self: HwndSourceParameters) -> int\n\n\n\nSet: WindowClassStyle(self: HwndSourceParameters)=value\n\n'
window_name = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the name of the window.\n\n\n\nGet: WindowName(self: HwndSourceParameters) -> str\n\n\n\nSet: WindowName(self: HwndSourceParameters)=value\n\n'
window_style = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the style for the window.\n\n\n\nGet: WindowStyle(self: HwndSourceParameters) -> int\n\n\n\nSet: WindowStyle(self: HwndSourceParameters)=value\n\n'
|
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
"""
Python module 'pydoc' causes the inclusion of Tcl/Tk library even in case
of simple hello_world script. Most of the we do not want this behavior.
This hook just removes this implicit dependency on Tcl/Tk.
"""
def hook(mod):
# Ignore 'Tkinter' to prevent inclusion of Tcl/Tk library.
for i, m in enumerate(mod.pyinstaller_imports):
if m[0] == 'Tkinter':
del mod.pyinstaller_imports[i]
break
return mod
|
"""
Python module 'pydoc' causes the inclusion of Tcl/Tk library even in case
of simple hello_world script. Most of the we do not want this behavior.
This hook just removes this implicit dependency on Tcl/Tk.
"""
def hook(mod):
for (i, m) in enumerate(mod.pyinstaller_imports):
if m[0] == 'Tkinter':
del mod.pyinstaller_imports[i]
break
return mod
|
number = input("Enter a series of number, using separator you like: ")
separator = ""
for char in number:
if not char.isnumeric():
separator = separator + char
print(separator)
str = 0;
sum = 0
for char in number:
if char not in separator:
str = str * 10 + int(char)
if char == number[len(number)-1]:
sum = sum + int(char)
elif char in separator:
sum = sum + str
str = 0
print(sum)
|
number = input('Enter a series of number, using separator you like: ')
separator = ''
for char in number:
if not char.isnumeric():
separator = separator + char
print(separator)
str = 0
sum = 0
for char in number:
if char not in separator:
str = str * 10 + int(char)
if char == number[len(number) - 1]:
sum = sum + int(char)
elif char in separator:
sum = sum + str
str = 0
print(sum)
|
{
"includes": [
"../common.gypi"
],
"targets": [
{
"target_name": "libgdal_ogr_pgdump_frmt",
"type": "static_library",
"sources": [
"../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp",
"../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp",
"../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumpdriver.cpp"
],
"include_dirs": [
"../gdal/ogr/ogrsf_frmts/pgdump"
]
}
]
}
|
{'includes': ['../common.gypi'], 'targets': [{'target_name': 'libgdal_ogr_pgdump_frmt', 'type': 'static_library', 'sources': ['../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumplayer.cpp', '../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumpdatasource.cpp', '../gdal/ogr/ogrsf_frmts/pgdump/ogrpgdumpdriver.cpp'], 'include_dirs': ['../gdal/ogr/ogrsf_frmts/pgdump']}]}
|
class Human(object):
def __init__(self, mark, io):
self.mark = mark
self.io = io
def sanitize_user_input(self, user_input):
try:
sanitized_input = int(user_input)
except TypeError:
sanitized_input = 0
except ValueError:
sanitized_input = 0
return sanitized_input
def get_sanitized_input(self):
user_input = self.io.get_input()
return self.sanitize_user_input(user_input)
def is_move_valid(self, move, board):
return isinstance(move, int) and board.is_spot_available(move)
def get_move(self, presenter, board):
while 1:
presenter.move_prompt(self.mark)
presenter.available_moves_message(board.available_spots())
chosen_move = self.get_sanitized_input()
if self.is_move_valid(chosen_move, board):
return chosen_move
presenter.invalid_move_message()
|
class Human(object):
def __init__(self, mark, io):
self.mark = mark
self.io = io
def sanitize_user_input(self, user_input):
try:
sanitized_input = int(user_input)
except TypeError:
sanitized_input = 0
except ValueError:
sanitized_input = 0
return sanitized_input
def get_sanitized_input(self):
user_input = self.io.get_input()
return self.sanitize_user_input(user_input)
def is_move_valid(self, move, board):
return isinstance(move, int) and board.is_spot_available(move)
def get_move(self, presenter, board):
while 1:
presenter.move_prompt(self.mark)
presenter.available_moves_message(board.available_spots())
chosen_move = self.get_sanitized_input()
if self.is_move_valid(chosen_move, board):
return chosen_move
presenter.invalid_move_message()
|
def razbi_stevilo(n, st):
s = []
st = str(st)
while len(st) > n:
stevilo = st[:n]
s.append(stevilo)
st = st[1:]
return s #seznam 13 mestnih steil podanih v nizu
def razbi_stevke(n):
sez_stevk = []
for stevka in n:
sez_stevk.append(int(stevka))
sez_stevk.sort()
return sez_stevk
def max_zmnozek(n, st):
s = razbi_stevilo(n, st)
sez_stevil = []
for ste in s:
sez_stevil.append(razbi_stevke(ste))
maxi = max(sez_stevil)
zmnozek = 1
for stevka in maxi:
zmnozek *= stevka
return zmnozek
st = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450
|
def razbi_stevilo(n, st):
s = []
st = str(st)
while len(st) > n:
stevilo = st[:n]
s.append(stevilo)
st = st[1:]
return s
def razbi_stevke(n):
sez_stevk = []
for stevka in n:
sez_stevk.append(int(stevka))
sez_stevk.sort()
return sez_stevk
def max_zmnozek(n, st):
s = razbi_stevilo(n, st)
sez_stevil = []
for ste in s:
sez_stevil.append(razbi_stevke(ste))
maxi = max(sez_stevil)
zmnozek = 1
for stevka in maxi:
zmnozek *= stevka
return zmnozek
st = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450
|
class Solution:
def longestMountain(self, A: List[int]) -> int:
'''
T: O(n) and S: O(1)
'''
if len(A) < 3: return 0
maxLen = 0
for i in range(1, len(A)-1):
left, right = i - 1, i + 1
if (A[left] < A[i]) and (A[i] > A[right]):
while left > 0 and A[left-1] < A[left]:
left -= 1
while right < len(A)-1 and A[right] > A[right+1]:
right += 1
maxLen = max(maxLen, right - left + 1)
return maxLen
|
class Solution:
def longest_mountain(self, A: List[int]) -> int:
"""
T: O(n) and S: O(1)
"""
if len(A) < 3:
return 0
max_len = 0
for i in range(1, len(A) - 1):
(left, right) = (i - 1, i + 1)
if A[left] < A[i] and A[i] > A[right]:
while left > 0 and A[left - 1] < A[left]:
left -= 1
while right < len(A) - 1 and A[right] > A[right + 1]:
right += 1
max_len = max(maxLen, right - left + 1)
return maxLen
|
# Loan repayment calculation service
# This is the program calculating the loan repayment amount for clients.
#
# Input parameters:
# principal(p) : Only integers equal or greater than one million are allowed
# years(y) : Only integers equal or greater than one are allowed
# annual interest rate(r) : Only floating point numbers from 0.0 to 100.0 are allowed
# Output parameters:
# annual repayment amount(d), monthly repayment amount(d / 12), total repayment amount(d * y)
#
# Developers : Hacktree
# Development date : 2021/06/16 (Version 1.0)
# Input and check input value
print("Welcome to loan repayment calculation service")
p = int(input("How much is the principal? (We only count over one million won.) "))
y = int(input("How many years is the repayment period? "))
r = float(input("What percent is the interest rate? "))
# Calcualte repayment amount
d = ((1 + (r / 100)) ** y * p * (r / 100)) // ((1 + (r / 100)) ** y - 1)
d = int(d)
# Print Output
print("We will inform you about the loan repayment details.")
print("If you repay once a year, you have to pay {} won for each year.".format(d))
print("If you repay once a month, you have to pay {} won for each month.".format(d // 12))
print("The total repayment amount until the repayment is completed is {} won.".format(d * y))
print("Thank you for using our service.")
print("I hope you to see again.")
|
print('Welcome to loan repayment calculation service')
p = int(input('How much is the principal? (We only count over one million won.) '))
y = int(input('How many years is the repayment period? '))
r = float(input('What percent is the interest rate? '))
d = (1 + r / 100) ** y * p * (r / 100) // ((1 + r / 100) ** y - 1)
d = int(d)
print('We will inform you about the loan repayment details.')
print('If you repay once a year, you have to pay {} won for each year.'.format(d))
print('If you repay once a month, you have to pay {} won for each month.'.format(d // 12))
print('The total repayment amount until the repayment is completed is {} won.'.format(d * y))
print('Thank you for using our service.')
print('I hope you to see again.')
|
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 12:58:44 2020
@author: SELICLO1
"""
def HammingDistance(a,b):
mm = 0
for i,s in enumerate(a):
if s != b[i]: mm+= 1
return mm
a = 'GTCTGGGCCGTGCGGACTTGTTGCGGATGATACAAGGGCTTCACTACGTCGAAGTAAGTTACCAATTATACAAGCTACCGGTGTAGAATGGTGAGTAGGTCCGCTTATAGCCCGCGCGGTGTACCTCGAGATAGATTGGGGTCAACCCAGTCCGACCCCACGCTACATGGTCATCCTATGTTGGACTGTTACCCCGACCAGTCCACACATCTACGTACTAACGAGCGACGTCGTCTAAGAGCTCATTTTAGACCTTTTGAGATGAAAGATACAAGTCAAACCGTGCGTTAGGCTGGCCCAACGCAAGTTTACAGATAGCGTTCTGGGGCACGTTTAATCGCTATGATTTAGTAGCACATAAGGAGCTGAAACGTTTATCGGCATTGGGGAGAGTAATCCGGAAGGGCTCATTCTCCCACGTTGTCCAATTACACACTGCTGTTCGATACTTGGCGCTCGGACTCACCGATAGCGCTGGCCCTGGTCGCCCCTAACACGTAACGGTTCTGGAGAATTGATCCGAACAACAGATAAGAAAGCTGATGAAGAAGTAACGGACGTAAACAGGACTGGTCGAGCAACACCCCTAGCTAGGGAAAGAGATAAAACGGGAATGCAGTTTTAATTTTCAGAATTATCTGGAATGCGCAAGCATTTTTTCGTTGGGGCCATGCGAGGCGAAGCAAATGTGTGAGAAAATTGCGGAGGTACGATACCATGGGAGTCTTGTGTTTTAGTCCGATGTCGCCCCTCACCCGCAAGAACGAGCACGGAACACTCTATCCCGAGGACTACTATGGCGAGAGCTCAATAACAGCACTGCTCTCCACAACGGCGCCTAGTGATCGTGAATCCCCCATTTCTGCCAATAGTAATATTCACCAGGGTATCCAATGCAACGTCTCATTAATGAAATATTTAGTGCGGTTGGCAAAAATCCCCGCTGAAAAGAGGTTTTACGTTGTAGAACTAGAATGTTCGTGGTTCGTTGCGACTTTTAACCTAAGCTGGTCGGTGGGCTTGAGACTAGCATGTTGCCCTCCTCGGGGCAGGGCGCGACAAACCATTGGTGTGAGGACACCAGCCAGACACGACAAATCGTCACGGCGCGCAT'
b = 'TTTGTGGATCCCCCTTAATGCAGCCACAAAGCAGCACCCACGAGTATGCAGTGCTTAAGGGGTTTCGATCTTACGATCCCTGCCTAACACACGGTAGCTTGTTATGGCCGGGCTGTACTTAAACGTTACACTCCGAACCCCAATGGGGTTAAGCGTCGAACAGGAGTACAGTGTATCATATTCGACTATGTCCACGTGAGATCGTAACCGTCCGAAAACCGGCAGTAGAAGGGCAGCTAACAGGTATCTTGCACCAGCTTACCTATCTTTTAGTGGCGGGCCATCAGGAGGCCAGTCCCGCGTCCCTACACGCCCGGAGTGTAGAGTAGGGTACGGGCTCGTCTGGTGCGAAAAAGACCGCAGCCTACATAAGCTCGCACAACATAGTCGATGCCTCAAAGCAAGGGCGTCACGAACCTACCCTCTGCTATATTACGGACCTGGTACAATCTAGCAGATTTATAAAGACTACCAAGCTAAACTCACCGTTTACCGCTGTCCCACTGAATTCGGAGTCTCTATGTGCAACCGCAGGTCATGTACACACATTGTACACCTTAGCGGAAGCCTGGAGTTGCTTATCAAGGGCATCCAGGGATAAAGGACGCAAGCTACAAAAAACAATTTTCTCCCAGTACCCTCTTCACAAATTGCAACTGTTCCTGTCAAACTCCCTCTGCAACGGCCGGGCTTTACCTTTAGACTAAACAACTACGAGTGTTGGTATCCTAGGGGTGTGCTAACAACTACACCATAGTAGGGGCCTAATATATTCGATGCGCTAGCGTTGGTGCACATTCGTTGCAGTGCGTTTAAGCCGTGTCACCATTGATATCCGCCACTGGTGTCCCGGATGGCGCCGCTCGTCGGATAACACGGTTGGCGGAGCATGCTATGGATAGGAGAGTCACTGATGACGGGGTTGATCCAAGACGCATCTGGGGCATCCAAGACTGGCTCAGTTAACAGAACCCAGTTTTGCATTTCGAGGGCATAGGGGGGGTGTTTAAGTGTTCAAATCCGGTCCTAACCTGCCCGGCGACGCCCGCGGTTACGTTTAGATACTGGGCTAAGGTGTAGGCACTTGGCGGGAATCGTTCGCTTTGGATAATGC'
hd = HammingDistance(a,b)
print(hd)
|
"""
Created on Wed Aug 26 12:58:44 2020
@author: SELICLO1
"""
def hamming_distance(a, b):
mm = 0
for (i, s) in enumerate(a):
if s != b[i]:
mm += 1
return mm
a = 'GTCTGGGCCGTGCGGACTTGTTGCGGATGATACAAGGGCTTCACTACGTCGAAGTAAGTTACCAATTATACAAGCTACCGGTGTAGAATGGTGAGTAGGTCCGCTTATAGCCCGCGCGGTGTACCTCGAGATAGATTGGGGTCAACCCAGTCCGACCCCACGCTACATGGTCATCCTATGTTGGACTGTTACCCCGACCAGTCCACACATCTACGTACTAACGAGCGACGTCGTCTAAGAGCTCATTTTAGACCTTTTGAGATGAAAGATACAAGTCAAACCGTGCGTTAGGCTGGCCCAACGCAAGTTTACAGATAGCGTTCTGGGGCACGTTTAATCGCTATGATTTAGTAGCACATAAGGAGCTGAAACGTTTATCGGCATTGGGGAGAGTAATCCGGAAGGGCTCATTCTCCCACGTTGTCCAATTACACACTGCTGTTCGATACTTGGCGCTCGGACTCACCGATAGCGCTGGCCCTGGTCGCCCCTAACACGTAACGGTTCTGGAGAATTGATCCGAACAACAGATAAGAAAGCTGATGAAGAAGTAACGGACGTAAACAGGACTGGTCGAGCAACACCCCTAGCTAGGGAAAGAGATAAAACGGGAATGCAGTTTTAATTTTCAGAATTATCTGGAATGCGCAAGCATTTTTTCGTTGGGGCCATGCGAGGCGAAGCAAATGTGTGAGAAAATTGCGGAGGTACGATACCATGGGAGTCTTGTGTTTTAGTCCGATGTCGCCCCTCACCCGCAAGAACGAGCACGGAACACTCTATCCCGAGGACTACTATGGCGAGAGCTCAATAACAGCACTGCTCTCCACAACGGCGCCTAGTGATCGTGAATCCCCCATTTCTGCCAATAGTAATATTCACCAGGGTATCCAATGCAACGTCTCATTAATGAAATATTTAGTGCGGTTGGCAAAAATCCCCGCTGAAAAGAGGTTTTACGTTGTAGAACTAGAATGTTCGTGGTTCGTTGCGACTTTTAACCTAAGCTGGTCGGTGGGCTTGAGACTAGCATGTTGCCCTCCTCGGGGCAGGGCGCGACAAACCATTGGTGTGAGGACACCAGCCAGACACGACAAATCGTCACGGCGCGCAT'
b = 'TTTGTGGATCCCCCTTAATGCAGCCACAAAGCAGCACCCACGAGTATGCAGTGCTTAAGGGGTTTCGATCTTACGATCCCTGCCTAACACACGGTAGCTTGTTATGGCCGGGCTGTACTTAAACGTTACACTCCGAACCCCAATGGGGTTAAGCGTCGAACAGGAGTACAGTGTATCATATTCGACTATGTCCACGTGAGATCGTAACCGTCCGAAAACCGGCAGTAGAAGGGCAGCTAACAGGTATCTTGCACCAGCTTACCTATCTTTTAGTGGCGGGCCATCAGGAGGCCAGTCCCGCGTCCCTACACGCCCGGAGTGTAGAGTAGGGTACGGGCTCGTCTGGTGCGAAAAAGACCGCAGCCTACATAAGCTCGCACAACATAGTCGATGCCTCAAAGCAAGGGCGTCACGAACCTACCCTCTGCTATATTACGGACCTGGTACAATCTAGCAGATTTATAAAGACTACCAAGCTAAACTCACCGTTTACCGCTGTCCCACTGAATTCGGAGTCTCTATGTGCAACCGCAGGTCATGTACACACATTGTACACCTTAGCGGAAGCCTGGAGTTGCTTATCAAGGGCATCCAGGGATAAAGGACGCAAGCTACAAAAAACAATTTTCTCCCAGTACCCTCTTCACAAATTGCAACTGTTCCTGTCAAACTCCCTCTGCAACGGCCGGGCTTTACCTTTAGACTAAACAACTACGAGTGTTGGTATCCTAGGGGTGTGCTAACAACTACACCATAGTAGGGGCCTAATATATTCGATGCGCTAGCGTTGGTGCACATTCGTTGCAGTGCGTTTAAGCCGTGTCACCATTGATATCCGCCACTGGTGTCCCGGATGGCGCCGCTCGTCGGATAACACGGTTGGCGGAGCATGCTATGGATAGGAGAGTCACTGATGACGGGGTTGATCCAAGACGCATCTGGGGCATCCAAGACTGGCTCAGTTAACAGAACCCAGTTTTGCATTTCGAGGGCATAGGGGGGGTGTTTAAGTGTTCAAATCCGGTCCTAACCTGCCCGGCGACGCCCGCGGTTACGTTTAGATACTGGGCTAAGGTGTAGGCACTTGGCGGGAATCGTTCGCTTTGGATAATGC'
hd = hamming_distance(a, b)
print(hd)
|
a = int(input("Enter the first no : "))
b = int(input("Enter the second no : "))
c = a+b
print("sum of",a,'+',b,'=',c)
print("The first no is: %d and second number is: %d and the sum is: %d"%(a,b,c))
print("%d + %d = %d"%(a,b,c))
print("%-10d + %-10d = %-10d"%(a,b,c))
print("%-10f + %-10f = %-10f"%(a,b,c))
print("%s + %s = %s"%("tony","george","tonygeorge"))
|
a = int(input('Enter the first no : '))
b = int(input('Enter the second no : '))
c = a + b
print('sum of', a, '+', b, '=', c)
print('The first no is: %d and second number is: %d and the sum is: %d' % (a, b, c))
print('%d + %d = %d' % (a, b, c))
print('%-10d + %-10d = %-10d' % (a, b, c))
print('%-10f + %-10f = %-10f' % (a, b, c))
print('%s + %s = %s' % ('tony', 'george', 'tonygeorge'))
|
class Node(object):
def __init__(self, data, next=None):
self.data = data
self.next = next
def kth_to_last(k, linked_list):
pointer1, pointer2 = linked_list, linked_list
for _ in range(k):
if not pointer1:
return None
pointer1 = pointer1.next
while pointer1:
pointer1, pointer2 = pointer1.next, pointer2.next
return pointer2
def kth_to_last2(k, linked_list):
ll_length = 0
head = linked_list
while head:
ll_length += 1
head = head.next
final_head = linked_list
while final_head.next and k != ll_length:
final_head = final_head.next
ll_length -= 1
return final_head
ll = Node(1, Node(2, Node(3, Node(4, None))))
k = 3
newll = kth_to_last2(k, ll)
print(newll.data)
print(newll.next.data)
print(newll.next.next.data)
|
class Node(object):
def __init__(self, data, next=None):
self.data = data
self.next = next
def kth_to_last(k, linked_list):
(pointer1, pointer2) = (linked_list, linked_list)
for _ in range(k):
if not pointer1:
return None
pointer1 = pointer1.next
while pointer1:
(pointer1, pointer2) = (pointer1.next, pointer2.next)
return pointer2
def kth_to_last2(k, linked_list):
ll_length = 0
head = linked_list
while head:
ll_length += 1
head = head.next
final_head = linked_list
while final_head.next and k != ll_length:
final_head = final_head.next
ll_length -= 1
return final_head
ll = node(1, node(2, node(3, node(4, None))))
k = 3
newll = kth_to_last2(k, ll)
print(newll.data)
print(newll.next.data)
print(newll.next.next.data)
|
print("-- Strings -- ")
print()
mystring = "hello"
myfloat = 10.0
myint = 20
if mystring == "hello":
print("String: %s" % mystring)
if isinstance(myfloat, float) and myfloat == 10.0:
print("Float: %f" % myfloat)
if isinstance(myint, int) and myint == 20:
print("Integer: %d" % myint)
print()
nome = 'Teste'
idade = 18
print('Nome: {a}, Idade: {b}'.format(a=nome, b=idade))
def print_full_name(a, b):
print('Hello {a} {b}! You just delved into python.'.format(a=a, b=b))
print_full_name('Ross', 'Taylor')
a = "this is a string"
a = a.split(" ") # a is converted to a list of strings.
print(a)
string = ''
for item in a:
if len(string) > 0:
string = string +"-"+ item
else:
string = string + item
print(string)
|
print('-- Strings -- ')
print()
mystring = 'hello'
myfloat = 10.0
myint = 20
if mystring == 'hello':
print('String: %s' % mystring)
if isinstance(myfloat, float) and myfloat == 10.0:
print('Float: %f' % myfloat)
if isinstance(myint, int) and myint == 20:
print('Integer: %d' % myint)
print()
nome = 'Teste'
idade = 18
print('Nome: {a}, Idade: {b}'.format(a=nome, b=idade))
def print_full_name(a, b):
print('Hello {a} {b}! You just delved into python.'.format(a=a, b=b))
print_full_name('Ross', 'Taylor')
a = 'this is a string'
a = a.split(' ')
print(a)
string = ''
for item in a:
if len(string) > 0:
string = string + '-' + item
else:
string = string + item
print(string)
|
def General(project):
feature_vectors = get_featrures(projects)
h_clusters = BIRCH(projects,feature_vectors)
for level in h_clusters.levels:
if level.depth == h_clusters.max_depth:
for cluster in level.clusters:
level.cluster.bell = bellwether(cluster.projects)
else:
for cluster in h_clusters.level.clusters:
bell_projects = cluster.child.get_bellwethers()
level.cluster.bell = bellwether(bell_projects)
return h_clusters
|
def general(project):
feature_vectors = get_featrures(projects)
h_clusters = birch(projects, feature_vectors)
for level in h_clusters.levels:
if level.depth == h_clusters.max_depth:
for cluster in level.clusters:
level.cluster.bell = bellwether(cluster.projects)
else:
for cluster in h_clusters.level.clusters:
bell_projects = cluster.child.get_bellwethers()
level.cluster.bell = bellwether(bell_projects)
return h_clusters
|
"""
LC89. Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
Example 1:
Input: 2
Output: [0,1,3,2]
Explanation:
00 - 0
01 - 1
11 - 3
10 - 2
For a given n, a gray code sequence may not be uniquely defined.
For example, [0,2,3,1] is also a valid gray code sequence.
00 - 0
10 - 2
11 - 3
01 - 1
Example 2:
Input: 0
Output: [0]
Explanation: We define the gray code sequence to begin with 0.
A gray code sequence of n has size = 2n, which for n = 0 the size is 20 = 1.
Therefore, for n = 0 the gray code sequence is [0].
"""
# Runtime: 40 ms, faster than 22.57% of Python3 online submissions for Gray Code.
# Memory Usage: 14.7 MB, less than 5.26% of Python3 online submissions for Gray Code.
class Solution:
def grayCode(self, n: int) -> List[int]:
if n == 0:
return [0]
res = {}
curr = "0" * n
self.dfs(res, curr, n, 0)
return [int(key, 2) for key,_ in sorted(res.items(), key=lambda x:x[1])]
def dfs(self, res, curr, n, index):
res[curr] = index
for i in range(n):
if curr[i] == "0":
tmp = curr[:i] + "1" + curr[i+1:]
else:
tmp = curr[:i] + "0" + curr[i+1:]
if tmp in res:
continue
self.dfs(res, tmp, n, index+1)
break
|
"""
LC89. Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
Example 1:
Input: 2
Output: [0,1,3,2]
Explanation:
00 - 0
01 - 1
11 - 3
10 - 2
For a given n, a gray code sequence may not be uniquely defined.
For example, [0,2,3,1] is also a valid gray code sequence.
00 - 0
10 - 2
11 - 3
01 - 1
Example 2:
Input: 0
Output: [0]
Explanation: We define the gray code sequence to begin with 0.
A gray code sequence of n has size = 2n, which for n = 0 the size is 20 = 1.
Therefore, for n = 0 the gray code sequence is [0].
"""
class Solution:
def gray_code(self, n: int) -> List[int]:
if n == 0:
return [0]
res = {}
curr = '0' * n
self.dfs(res, curr, n, 0)
return [int(key, 2) for (key, _) in sorted(res.items(), key=lambda x: x[1])]
def dfs(self, res, curr, n, index):
res[curr] = index
for i in range(n):
if curr[i] == '0':
tmp = curr[:i] + '1' + curr[i + 1:]
else:
tmp = curr[:i] + '0' + curr[i + 1:]
if tmp in res:
continue
self.dfs(res, tmp, n, index + 1)
break
|
# Sudoku Solver: https://leetcode.com/problems/sudoku-solver/
# Write a program to solve a Sudoku puzzle by filling the empty cells.
# A sudoku solution must satisfy all of the following rules:
# Each of the digits 1-9 must occur exactly once in each row.
# Each of the digits 1-9 must occur exactly once in each column.
# Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid.
# The '.' character indicates empty cells.
# This boils down from a really hard problem into a simple backtracking dfs solution
# basically what we need to do is create a set for rows, cols and the grid boxes
# once we have all those sets we move across from 0,0 -> 8,8 and if there is an empty box
# try and fill it with a value that is not in any of the three sets
class Solution:
def solveSudoku(self, board) -> None:
"""
Do not return anything, modify board in-place instead.
"""
# For checking we need to check if value is not in r, c or sqr
def canAddVal(value, r, c):
return value not in row[r] and value not in col[c] and value not in sqr[sqrIndex(r, c)]
# So for adding we need to add the number to the set
# and then to the board
def addToBoard(value, r, c):
board[r][c] = str(value)
row[r].add(value)
col[c].add(value)
sqr[sqrIndex(r, c)].add(value)
# Remove is the same as above but the opposite
def remFromBoard(value, r, c):
board[r][c] = '.'
row[r].remove(value)
col[c].remove(value)
sqr[sqrIndex(r, c)].remove(value)
def nextLocation(r, c):
# Check if we are at the final location because if we are we simply need to return
if r == N - 1 and c == N - 1:
self.isSolved = True
return
else:
# If we are here we need to move across col unless we are at edge
if c == N - 1:
backtrack(r+1)
else:
backtrack(r, c + 1)
def backtrack(r=0, c=0):
# For this solution we need try adding a number recursing down until it fails
# then removing the number if it gets back
if board[r][c] != '.':
# This r,c already has a number so we skip over it
nextLocation(r, c)
else:
# Otherwise try all possible numbers
for val in range(1, 10):
if canAddVal(val, r, c):
addToBoard(val, r, c)
nextLocation(r, c)
# If we get to the end we just need to return
if self.isSolved:
return
# Otherwise backtrack by removing the added num
remFromBoard(val, r, c)
# Set up the basic stuff we now
n = 3
N = n * n
# Create sets for row col and the sqr (aka grid box)
row = [set() for _ in range(N)]
col = [set() for _ in range(N)]
sqr = [set() for _ in range(N)]
# Create a lambda to convert the r,c pair into a index of sqr for our set
def sqrIndex(r, c): return (r // n * n) + (c // n)
# Create a way to trigger the end if we are at the last spot
self.isSolved = False
# Loop through the whole entire grid and add numbers to our sets
for r in range(N):
for c in range(N):
if board[r][c] != '.':
addToBoard(int(board[r][c]), r, c)
backtrack()
return board
# The above works out and runs in a horrible O(9!) which reduces to o(1) and uses o(!) space as well
# Score Card
# Did I need hints? N
# Did you finish within 30 min? 25
# Was the solution optimal? This is optimal
# Were there any bugs? No
# 5 5 5 5 = 5
|
class Solution:
def solve_sudoku(self, board) -> None:
"""
Do not return anything, modify board in-place instead.
"""
def can_add_val(value, r, c):
return value not in row[r] and value not in col[c] and (value not in sqr[sqr_index(r, c)])
def add_to_board(value, r, c):
board[r][c] = str(value)
row[r].add(value)
col[c].add(value)
sqr[sqr_index(r, c)].add(value)
def rem_from_board(value, r, c):
board[r][c] = '.'
row[r].remove(value)
col[c].remove(value)
sqr[sqr_index(r, c)].remove(value)
def next_location(r, c):
if r == N - 1 and c == N - 1:
self.isSolved = True
return
elif c == N - 1:
backtrack(r + 1)
else:
backtrack(r, c + 1)
def backtrack(r=0, c=0):
if board[r][c] != '.':
next_location(r, c)
else:
for val in range(1, 10):
if can_add_val(val, r, c):
add_to_board(val, r, c)
next_location(r, c)
if self.isSolved:
return
rem_from_board(val, r, c)
n = 3
n = n * n
row = [set() for _ in range(N)]
col = [set() for _ in range(N)]
sqr = [set() for _ in range(N)]
def sqr_index(r, c):
return r // n * n + c // n
self.isSolved = False
for r in range(N):
for c in range(N):
if board[r][c] != '.':
add_to_board(int(board[r][c]), r, c)
backtrack()
return board
|
abi = """[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_hashSender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "_hashId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "_hashContent",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"name": "NewHashStored",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_hashSender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "Withdrawn",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_price",
"type": "uint256"
}
],
"name": "StoreHash",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_hashId",
"type": "uint256"
}
],
"name": "find",
"outputs": [
{
"internalType": "address",
"name": "hashSender",
"type": "address"
},
{
"internalType": "string",
"name": "hashContent",
"type": "string"
},
{
"internalType": "string",
"name": "_lastHashContent",
"type": "string"
},
{
"internalType": "uint256",
"name": "hashTimestamp",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "hashes",
"outputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "string",
"name": "content",
"type": "string"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "string",
"name": "old",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lastHashId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "price",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_hashContent",
"type": "string"
},
{
"internalType": "string",
"name": "_lastHashContent",
"type": "string"
}
],
"name": "save",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]"""
|
abi = '[\n\t{\n\t\t"anonymous": false,\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"indexed": true,\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "_hashSender",\n\t\t\t\t"type": "address"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"indexed": false,\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "_hashId",\n\t\t\t\t"type": "uint256"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"indexed": false,\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "_hashContent",\n\t\t\t\t"type": "string"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"indexed": false,\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "timestamp",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"name": "NewHashStored",\n\t\t"type": "event"\n\t},\n\t{\n\t\t"anonymous": false,\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"indexed": true,\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "_previousOwner",\n\t\t\t\t"type": "address"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"indexed": true,\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "_newOwner",\n\t\t\t\t"type": "address"\n\t\t\t}\n\t\t],\n\t\t"name": "OwnershipTransferred",\n\t\t"type": "event"\n\t},\n\t{\n\t\t"anonymous": false,\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"indexed": true,\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "_hashSender",\n\t\t\t\t"type": "address"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"indexed": false,\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "amount",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"name": "Withdrawn",\n\t\t"type": "event"\n\t},\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "_price",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"name": "StoreHash",\n\t\t"outputs": [],\n\t\t"stateMutability": "nonpayable",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "_hashId",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"name": "find",\n\t\t"outputs": [\n\t\t\t{\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "hashSender",\n\t\t\t\t"type": "address"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "hashContent",\n\t\t\t\t"type": "string"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "_lastHashContent",\n\t\t\t\t"type": "string"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "hashTimestamp",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"stateMutability": "view",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"name": "hashes",\n\t\t"outputs": [\n\t\t\t{\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "sender",\n\t\t\t\t"type": "address"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "content",\n\t\t\t\t"type": "string"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "timestamp",\n\t\t\t\t"type": "uint256"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "old",\n\t\t\t\t"type": "string"\n\t\t\t}\n\t\t],\n\t\t"stateMutability": "view",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [],\n\t\t"name": "lastHashId",\n\t\t"outputs": [\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"stateMutability": "view",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [],\n\t\t"name": "owner",\n\t\t"outputs": [\n\t\t\t{\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "",\n\t\t\t\t"type": "address"\n\t\t\t}\n\t\t],\n\t\t"stateMutability": "view",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [],\n\t\t"name": "price",\n\t\t"outputs": [\n\t\t\t{\n\t\t\t\t"internalType": "uint256",\n\t\t\t\t"name": "",\n\t\t\t\t"type": "uint256"\n\t\t\t}\n\t\t],\n\t\t"stateMutability": "view",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "_hashContent",\n\t\t\t\t"type": "string"\n\t\t\t},\n\t\t\t{\n\t\t\t\t"internalType": "string",\n\t\t\t\t"name": "_lastHashContent",\n\t\t\t\t"type": "string"\n\t\t\t}\n\t\t],\n\t\t"name": "save",\n\t\t"outputs": [],\n\t\t"stateMutability": "payable",\n\t\t"type": "function"\n\t},\n\t{\n\t\t"inputs": [\n\t\t\t{\n\t\t\t\t"internalType": "address",\n\t\t\t\t"name": "_newOwner",\n\t\t\t\t"type": "address"\n\t\t\t}\n\t\t],\n\t\t"name": "transferOwnership",\n\t\t"outputs": [],\n\t\t"stateMutability": "nonpayable",\n\t\t"type": "function"\n\t}\n]'
|
# import contact: click on chart to draw a contact that gets pinged by sonar
colors = {'GRN':color(51, 255, 0), 'RED':color(193, 49, 36), 'BLK':color(10)}
def setup():
size(480, 480)
background(colors['BLK'])
fill(colors['RED'])
ellipse(240, 240, 430, 430)
fill(10)
ellipse(240, 240, 420, 420)
def draw():
stroke(colors['GRN'])
if mousePressed:
fill(colors['GRN'])
ellipse(mouseX, mouseY, 10, 10)
|
colors = {'GRN': color(51, 255, 0), 'RED': color(193, 49, 36), 'BLK': color(10)}
def setup():
size(480, 480)
background(colors['BLK'])
fill(colors['RED'])
ellipse(240, 240, 430, 430)
fill(10)
ellipse(240, 240, 420, 420)
def draw():
stroke(colors['GRN'])
if mousePressed:
fill(colors['GRN'])
ellipse(mouseX, mouseY, 10, 10)
|
def debug_policy_plot():
qq_right = []
x_vec = np.arange(vagent.max_q[0])
for xx in x_vec:
vagent.q[0] = xx
vsensor.update(vscene,vagent)
vobservation = local_observer(vsensor,vagent) #todo: generalize
qq_right.append(RL.compute_q_eval(vobservation.reshape([1,-1])))
qq_right = (np.reshape(qq_right,[-1,2]))
vax[0].clear()
vax[0].plot(qq_right, 'x-')
vax[1].clear()
vax[1].plot(qq_right[:,1]-qq_right[:,0], 'x-')
|
def debug_policy_plot():
qq_right = []
x_vec = np.arange(vagent.max_q[0])
for xx in x_vec:
vagent.q[0] = xx
vsensor.update(vscene, vagent)
vobservation = local_observer(vsensor, vagent)
qq_right.append(RL.compute_q_eval(vobservation.reshape([1, -1])))
qq_right = np.reshape(qq_right, [-1, 2])
vax[0].clear()
vax[0].plot(qq_right, 'x-')
vax[1].clear()
vax[1].plot(qq_right[:, 1] - qq_right[:, 0], 'x-')
|
class Solution:
def stringShift(self, s: str, shift: List[List[int]]) -> str:
sum = 0
for i in shift:
if i[0] == 0:
sum += i[1]
else:
sum -= i[1]
sum = sum % len(s)
return s[sum:]+s[:sum]
|
class Solution:
def string_shift(self, s: str, shift: List[List[int]]) -> str:
sum = 0
for i in shift:
if i[0] == 0:
sum += i[1]
else:
sum -= i[1]
sum = sum % len(s)
return s[sum:] + s[:sum]
|
"""
netparse.table
This module provides the necessary abstraction to take a TABLE pattern
output and generate an accurate datastructure based off it.
For further reading, please check out this article:
https://pyability.com/the-curse-of-the-cli/
"""
class ParseTable:
def __init__(self, unstructured_data, pattern):
self.unstructured_data = unstructured_data
self.pattern = pattern
self.data_range = self._populate_data_range()
self.row_data = self._populate_row_data()
def _populate_data_range(self):
""" parsetable._populate_data_range
Initializes the data range attribute which determines the size of each
column in the TABLE """
# Define the range of each data attribute
data_range = {}
# Populate the first level in the structured datastructure
for header, header_data in self.pattern.value_set.items():
header_location = header_data['header_location']
data_range[header] = {
'start': header_location,
'stop': header_location + len(header) - 1,
}
return data_range
def _populate_row_data(self):
""" parsetable._populate_row_data
Initializes the row data variable with row header information.
Also, this finishes up the full data range population as this method
analyzes all the values in the unstructured dataset """
# Define row data
row_data = {}
# Define the first header at which all rows will begin
pivot_header = ''
pivot_location = 100000
# Start iteration of the unstuctured dataset
for line_num, line in enumerate(self.unstructured_data):
# Analyze each word in the unstructured dataset
for word in line.split():
# Start iteration of the value set from the TABLE PATTERN
for header, header_data in self.pattern.value_set.items():
# Initialize header location and alignment parameters
header_location = header_data['header_location']
header_alignment = header_data['header_alignment']
# Check alignment as right aligned
if header_alignment == 'right_align':
# The following sets the value of the word's end location
# as the same as the end location for the header as
# it is right aligned
value_length = line.find(word) + len(word) - 1
header_length = header_location + len(header) - 1
# If they do match, then the word is indeed under
# the correct right aligned column set
if value_length == header_length:
start = line.find(word)
# Adjust the right aligned column's start position
# as necessary in case the word's length is longer
# than the previous values
if start < self.data_range[header]['start']:
self.data_range[header]['start'] = start
# Check alignment as left aligned
elif header_alignment == 'left_align':
# The following sets the value of the word's start location
# as the same as the start location for the header as
# it is left aligned
value_length = line.find(word)
header_length = header_location
# If they do match, then the word is indeed under
# the correct left aligned column set
if value_length == header_length:
stop = value_length + len(word) - 1
# Adjust the left aligned column's stop position
# as necessary in case the word's length is longer
# than the previous values
if stop > self.data_range[header]['stop']:
self.data_range[header]['stop'] = stop
# Sets up the pivot header which is the first header
# in the dataset with the lowest character location
# as this will determine the row values
if header_location < pivot_location:
pivot_header = header
pivot_location = header_location
# If the word is equivalent to the pivot location,
# then it is fair to set that up as the second level
# for the structured dataset with...
# COLUMN = HEADERS, ROWS = FIRST COLUMN DATA
if line.find(word) == pivot_location:
# Skip entry if it matches header
if word == pivot_header:
continue
# Otherwise, add the row header data to the dictionary
if (line_num+1) not in row_data:
row_data[line_num+1] = word
return row_data
def generate_structure(self):
""" parsetable.generate_structure
Based on the information gleaned from the pattern tuple,
generate structured data! """
# Define final datastructure
structured_data = []
# Define pattern length
pattern_length = sum(1 for _ in iter(self.pattern.value_set.items())) - 1
# Iterate through the unstructured data
for line_num, line in enumerate(self.unstructured_data):
# Temporary structure
json_structure = {}
# Skip any headers that do not have a row header
if (line_num+1) not in self.row_data:
continue
# Define row header
row_header = self.row_data[line_num+1]
# Start iteration of the value set from the TABLE PATTERN
for i, (c_header, c_header_data) in enumerate(self.pattern.value_set.items()):
# Initialize the previous and future header datasets
p_header, p_header_data, f_header, f_header_data = '', '', '', ''
# Initialize the start and stop parameters
start, stop = '', ''
# Fill in previous header data if applicable
if i != 0:
p_header, p_header_data = list(self.pattern.value_set.items())[i-1]
# Fill in future header data if applicable
if i != pattern_length:
f_header, f_header_data = list(self.pattern.value_set.items())[i+1]
# Initialize current header data
c_header_alignment = c_header_data['header_alignment']
# Initialize the data range values for each header
start = self.data_range[c_header]
stop = self.data_range[c_header]
# Define the correct start and stop conditions
if c_header_alignment == 'left_align':
start = self.data_range[c_header]['start']
if f_header:
stop = self.data_range[f_header]['start'] - 1
else:
stop = len(line)
# Define the correct start and stop conditions
elif c_header_alignment == 'right_align':
stop = self.data_range[c_header]['stop'] + 1
if p_header:
start = self.data_range[p_header]['stop'] + 1
else:
start = 0
json_structure[c_header] = line[start:stop].strip()
structured_data.append(json_structure)
return structured_data
|
"""
netparse.table
This module provides the necessary abstraction to take a TABLE pattern
output and generate an accurate datastructure based off it.
For further reading, please check out this article:
https://pyability.com/the-curse-of-the-cli/
"""
class Parsetable:
def __init__(self, unstructured_data, pattern):
self.unstructured_data = unstructured_data
self.pattern = pattern
self.data_range = self._populate_data_range()
self.row_data = self._populate_row_data()
def _populate_data_range(self):
""" parsetable._populate_data_range
Initializes the data range attribute which determines the size of each
column in the TABLE """
data_range = {}
for (header, header_data) in self.pattern.value_set.items():
header_location = header_data['header_location']
data_range[header] = {'start': header_location, 'stop': header_location + len(header) - 1}
return data_range
def _populate_row_data(self):
""" parsetable._populate_row_data
Initializes the row data variable with row header information.
Also, this finishes up the full data range population as this method
analyzes all the values in the unstructured dataset """
row_data = {}
pivot_header = ''
pivot_location = 100000
for (line_num, line) in enumerate(self.unstructured_data):
for word in line.split():
for (header, header_data) in self.pattern.value_set.items():
header_location = header_data['header_location']
header_alignment = header_data['header_alignment']
if header_alignment == 'right_align':
value_length = line.find(word) + len(word) - 1
header_length = header_location + len(header) - 1
if value_length == header_length:
start = line.find(word)
if start < self.data_range[header]['start']:
self.data_range[header]['start'] = start
elif header_alignment == 'left_align':
value_length = line.find(word)
header_length = header_location
if value_length == header_length:
stop = value_length + len(word) - 1
if stop > self.data_range[header]['stop']:
self.data_range[header]['stop'] = stop
if header_location < pivot_location:
pivot_header = header
pivot_location = header_location
if line.find(word) == pivot_location:
if word == pivot_header:
continue
if line_num + 1 not in row_data:
row_data[line_num + 1] = word
return row_data
def generate_structure(self):
""" parsetable.generate_structure
Based on the information gleaned from the pattern tuple,
generate structured data! """
structured_data = []
pattern_length = sum((1 for _ in iter(self.pattern.value_set.items()))) - 1
for (line_num, line) in enumerate(self.unstructured_data):
json_structure = {}
if line_num + 1 not in self.row_data:
continue
row_header = self.row_data[line_num + 1]
for (i, (c_header, c_header_data)) in enumerate(self.pattern.value_set.items()):
(p_header, p_header_data, f_header, f_header_data) = ('', '', '', '')
(start, stop) = ('', '')
if i != 0:
(p_header, p_header_data) = list(self.pattern.value_set.items())[i - 1]
if i != pattern_length:
(f_header, f_header_data) = list(self.pattern.value_set.items())[i + 1]
c_header_alignment = c_header_data['header_alignment']
start = self.data_range[c_header]
stop = self.data_range[c_header]
if c_header_alignment == 'left_align':
start = self.data_range[c_header]['start']
if f_header:
stop = self.data_range[f_header]['start'] - 1
else:
stop = len(line)
elif c_header_alignment == 'right_align':
stop = self.data_range[c_header]['stop'] + 1
if p_header:
start = self.data_range[p_header]['stop'] + 1
else:
start = 0
json_structure[c_header] = line[start:stop].strip()
structured_data.append(json_structure)
return structured_data
|
# Based on MicroPython config option, comparison of str and bytes
# or vice versa may issue a runtime warning. On CPython, if run as
# "python3 -b", only comparison of str to bytes issues a warning,
# not the other way around (while exactly comparison of bytes to
# str would be the most common error, as in sock.recv(3) == "GET").
# Update: the issue above with CPython apparently happens in REPL,
# when run as a script, both lines issue a warning.
if ("123" == b"123" or b"123" == "123"):
print("FAIL")
raise SystemExit
print("PASS")
|
if '123' == b'123' or b'123' == '123':
print('FAIL')
raise SystemExit
print('PASS')
|
class Solution:
def toGoatLatin(self, S: str) -> str:
words = S.split()
res = []
for i, w in enumerate(words):
if w[0].lower() not in "aeiou":
w = w[1:] + w[0]
w += "ma" + ("a" * (i + 1))
res.append(w)
return ' '.join(res)
if __name__ == '__main__':
S = input("Input: ")
print(f"Output: {Solution().toGoatLatin(S)}")
|
class Solution:
def to_goat_latin(self, S: str) -> str:
words = S.split()
res = []
for (i, w) in enumerate(words):
if w[0].lower() not in 'aeiou':
w = w[1:] + w[0]
w += 'ma' + 'a' * (i + 1)
res.append(w)
return ' '.join(res)
if __name__ == '__main__':
s = input('Input: ')
print(f'Output: {solution().toGoatLatin(S)}')
|
# the interface
# class, or the interface
# data type
# interface data types
# are inspired from
# the typescript language
# example
# f = Interface(types)
# f.create(data)
class InterfaceObject():
def __init__(self, object_info):
# the passed in values
# to create a new object
self.values = object_info
# get the interface
# property
def get_item(self, property_):
if property_ in self.values:
return self.values[property_]
else:
raise KeyError(f"Cannot find {property_}")
# set the interface
# property
# Note : cannot change types after assignment
def set_item(self, property_, value):
# check if property_ is in self.values
# if yes, pass
# else throw a KeyError
if property_ in self.values:
# check whether the current type
# of the key and the new type is same
# if yes , change the value
# else , raise a KeyError
typeof = isinstance(value, type(self.values[property_]))
if typeof:
self.values[property_] = value
else:
raise TypeError("Cannot change types after assignment")
else:
raise KeyError(f"Cannot find {property_}")
def __repr__(self):
return ""
class Interface(object):
def __init__(self, data_params):
# the main
# key names and the
# type of the value
self.params = self.__get_params(data_params)
# verifying the entered
# parameters and return
# them
def __get_params(self, data):
# check whether the data
# passed in is a dict
# else throw an Error
data_is_dict = isinstance(data, dict)
# loop through each dict
# value and check whether
# each value is
# a list
# the list of types it can be
# return the passed-in parameter
if data_is_dict:
for data_key in data:
if not isinstance(data[data_key], list):
raise TypeError("Expected to be a list")
return data
else:
raise TypeError("Expected a dict")
# create a new interface
# object
def create(self, *args):
# self.match = self.__match_param_types(data)
# print(args)
if len(args) == len(self.params):
match = self.__match_param_types(args)
return InterfaceObject(match)
else:
raise Exception(
f"Expected {len(self.params)} arguments but got {len(args)}")
# check whether
# the new create interface
# parameter type match
# with self.params
def __match_param_types(self, data):
# check if the passed in
# parameter is a
# tuple, else throw
# a TYpeError
if isinstance(data, tuple):
# the new interface
interface = {}
# loop through each element
# and index in the dictionary
# (self.params)
for index, key in enumerate(self.params):
# the current character
# of the argument
current_character = data[index]
# the number of types
# matches(a list of
# True and False(booleans))
types_matches = []
for allowed_type in self.params[key]:
# if the allowed types
# is (?) or 'any', append true
# as it resembles (any) type
# else, if the type of
# the param is in
# the list of types
# allowed
if allowed_type == "?" or allowed_type == "any":
types_matches.append(True)
else:
types_matches.append(allowed_type == type(data[index]))
# if the list is full of False
# or if no types match raise
# a type error
# else, add it to the
# interface dict
if True not in types_matches:
raise TypeError("Types don't match")
else:
interface[key] = data[index]
# return the interface dict
return interface
else:
raise TypeError("Expected a dict")
|
class Interfaceobject:
def __init__(self, object_info):
self.values = object_info
def get_item(self, property_):
if property_ in self.values:
return self.values[property_]
else:
raise key_error(f'Cannot find {property_}')
def set_item(self, property_, value):
if property_ in self.values:
typeof = isinstance(value, type(self.values[property_]))
if typeof:
self.values[property_] = value
else:
raise type_error('Cannot change types after assignment')
else:
raise key_error(f'Cannot find {property_}')
def __repr__(self):
return ''
class Interface(object):
def __init__(self, data_params):
self.params = self.__get_params(data_params)
def __get_params(self, data):
data_is_dict = isinstance(data, dict)
if data_is_dict:
for data_key in data:
if not isinstance(data[data_key], list):
raise type_error('Expected to be a list')
return data
else:
raise type_error('Expected a dict')
def create(self, *args):
if len(args) == len(self.params):
match = self.__match_param_types(args)
return interface_object(match)
else:
raise exception(f'Expected {len(self.params)} arguments but got {len(args)}')
def __match_param_types(self, data):
if isinstance(data, tuple):
interface = {}
for (index, key) in enumerate(self.params):
current_character = data[index]
types_matches = []
for allowed_type in self.params[key]:
if allowed_type == '?' or allowed_type == 'any':
types_matches.append(True)
else:
types_matches.append(allowed_type == type(data[index]))
if True not in types_matches:
raise type_error("Types don't match")
else:
interface[key] = data[index]
return interface
else:
raise type_error('Expected a dict')
|
"""
Standard disk mounted on a CIM_ComputerSystem.
"""
def EntityOntology():
return (["Name"],)
|
"""
Standard disk mounted on a CIM_ComputerSystem.
"""
def entity_ontology():
return (['Name'],)
|
def rotflip():
yield "rot1"
yield "rot2"
yield "rot3"
yield "rot4"
yield "flip"
yield "rot1"
yield "rot2"
yield "rot3"
yield "rot4"
raise ValueError("aaaaa")
i = 0
#for i,a in enumerate(rotflip()):
a_gen = rotflip()
while True:
a = a_gen.__next__()
print(a)
i += 1
if i == 6:
break
|
def rotflip():
yield 'rot1'
yield 'rot2'
yield 'rot3'
yield 'rot4'
yield 'flip'
yield 'rot1'
yield 'rot2'
yield 'rot3'
yield 'rot4'
raise value_error('aaaaa')
i = 0
a_gen = rotflip()
while True:
a = a_gen.__next__()
print(a)
i += 1
if i == 6:
break
|
marks = {}
for _ in range(int(input())):
line = input().split()
marks[line[0]] = sum(map(float, line[1:])) / 3
print('%.2f' % marks[input()])
|
marks = {}
for _ in range(int(input())):
line = input().split()
marks[line[0]] = sum(map(float, line[1:])) / 3
print('%.2f' % marks[input()])
|
# A script to recursively find the greatest common divisor of two numbers
def greatest_divisor(first, second):
assert first == int(first) and second == int(second) and first != 0 and second != 0, 'Numbers provided must be nonzero integers'
if first < 0:
first = -first
if second < 0:
second = -second
if (first >= second):
return gcd_ordered(first, second)
elif (first < second):
return gcd_ordered(second, first)
def gcd_ordered(higher, lower):
if higher % lower == 0:
return lower
return gcd_ordered(lower, higher % lower)
# Test the function
print(greatest_divisor(18,48))
print(greatest_divisor(12,8))
print(greatest_divisor(49,21))
print(greatest_divisor(4,9))
print(greatest_divisor(9,9))
|
def greatest_divisor(first, second):
assert first == int(first) and second == int(second) and (first != 0) and (second != 0), 'Numbers provided must be nonzero integers'
if first < 0:
first = -first
if second < 0:
second = -second
if first >= second:
return gcd_ordered(first, second)
elif first < second:
return gcd_ordered(second, first)
def gcd_ordered(higher, lower):
if higher % lower == 0:
return lower
return gcd_ordered(lower, higher % lower)
print(greatest_divisor(18, 48))
print(greatest_divisor(12, 8))
print(greatest_divisor(49, 21))
print(greatest_divisor(4, 9))
print(greatest_divisor(9, 9))
|
def main():
card_number = input("Enter credit card number: ")
print_card_value(card_number)
def print_card_value(card_number):
if check_for_sum(card_number) == False:
print("INVALID")
elif check_for_amex(card_number) == True:
print("AMEX")
elif check_for_master(card_number) == True:
print("MASTERCARD")
elif check_for_visa(card_number) == True:
print("VISA")
else:
print("INVALID")
def check_for_amex(card_number):
if len(card_number) == 15 and card_number[:2] in ["34", "37"]:
return True
else:
return False
def check_for_master(card_number):
if len(card_number) == 16 and card_number[:2] in ["51", "52", "53", "54", "55"]:
return True
else:
return False
def check_for_visa(card_number):
if len(card_number) in [13, 16] and card_number[0] == "4":
return True
else:
return False
def check_for_sum(card_number):
product_of_two_sequence = 0
not_product_of_two_sequence = 0
product_of_two_digit_array = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
for i in range(len(card_number)):
new_number = int(card_number[len(card_number) - 1 - i])
if i % 2 == 0:
not_product_of_two_sequence = not_product_of_two_sequence + new_number
else:
product_of_two_sequence = product_of_two_digit_array[new_number]
sum_of_total = not_product_of_two_sequence + product_of_two_sequence
return ((sum_of_total % 10) == 0)
main()
|
def main():
card_number = input('Enter credit card number: ')
print_card_value(card_number)
def print_card_value(card_number):
if check_for_sum(card_number) == False:
print('INVALID')
elif check_for_amex(card_number) == True:
print('AMEX')
elif check_for_master(card_number) == True:
print('MASTERCARD')
elif check_for_visa(card_number) == True:
print('VISA')
else:
print('INVALID')
def check_for_amex(card_number):
if len(card_number) == 15 and card_number[:2] in ['34', '37']:
return True
else:
return False
def check_for_master(card_number):
if len(card_number) == 16 and card_number[:2] in ['51', '52', '53', '54', '55']:
return True
else:
return False
def check_for_visa(card_number):
if len(card_number) in [13, 16] and card_number[0] == '4':
return True
else:
return False
def check_for_sum(card_number):
product_of_two_sequence = 0
not_product_of_two_sequence = 0
product_of_two_digit_array = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
for i in range(len(card_number)):
new_number = int(card_number[len(card_number) - 1 - i])
if i % 2 == 0:
not_product_of_two_sequence = not_product_of_two_sequence + new_number
else:
product_of_two_sequence = product_of_two_digit_array[new_number]
sum_of_total = not_product_of_two_sequence + product_of_two_sequence
return sum_of_total % 10 == 0
main()
|
best_bpsp = float("inf")
n_feats = 64
scale = 3
resblocks = 3
K = 10
plot = ""
log_likelihood = True
collect_probs = False
|
best_bpsp = float('inf')
n_feats = 64
scale = 3
resblocks = 3
k = 10
plot = ''
log_likelihood = True
collect_probs = False
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def reorderList(self, head):
"""
:type head: ListNode
:rtype: void Do not return anything, modify head in-place instead.
1->2->3->4
1->4->2->3
"""
if head == None:
return
stack = []
node = head
length = 0
while node != None:
length += 1
stack.append(node)
node = node.next
node = head
for _ in range(length//2 + 1):
n = stack.pop()
n.next = None
n.next = node.next
node.next = n
node = n.next
node.next = None
|
class Solution:
def reorder_list(self, head):
"""
:type head: ListNode
:rtype: void Do not return anything, modify head in-place instead.
1->2->3->4
1->4->2->3
"""
if head == None:
return
stack = []
node = head
length = 0
while node != None:
length += 1
stack.append(node)
node = node.next
node = head
for _ in range(length // 2 + 1):
n = stack.pop()
n.next = None
n.next = node.next
node.next = n
node = n.next
node.next = None
|
def countArrangement(n: int) -> int:
options = [[] * n for _ in range(n)]
for i in range(1, n + 1):
for j in range(1, i):
if i % j == 0:
options[i-1].append(j)
for j in range(i, n+1, i):
options[i-1].append(j)
options.sort(key=len)
taken = set()
def backtrack(i):
if i >= n:
return 1
total = 0
for option in [o for o in options[i] if o not in taken]:
taken.add(option)
total += backtrack(i+1)
taken.remove(option)
return total
return backtrack(0)
|
def count_arrangement(n: int) -> int:
options = [[] * n for _ in range(n)]
for i in range(1, n + 1):
for j in range(1, i):
if i % j == 0:
options[i - 1].append(j)
for j in range(i, n + 1, i):
options[i - 1].append(j)
options.sort(key=len)
taken = set()
def backtrack(i):
if i >= n:
return 1
total = 0
for option in [o for o in options[i] if o not in taken]:
taken.add(option)
total += backtrack(i + 1)
taken.remove(option)
return total
return backtrack(0)
|
S = 'I want that Farm House to be in my name, comprende? Also, I want Chocolates.'
D = {}
#SS = S.split()
for item in S:
if item in D:
D[item] = D[item] + 1
else:
D[item] = 1
print(D)
|
s = 'I want that Farm House to be in my name, comprende? Also, I want Chocolates.'
d = {}
for item in S:
if item in D:
D[item] = D[item] + 1
else:
D[item] = 1
print(D)
|
class TestSessOverallResults:
def __init__(self):
self._recall = -1.
self._precision = -1.
self._f_measure = -1.
def __str__(self):
rez = '\nRecall : ' + str(self.recall)
rez += '\nPrecision : ' + str(self.precision)
rez += '\nF-measure : ' + str(self.f_measure)
rez += '\n\nThe overall result values are valid : ' \
+ str(self.is_valid())
return rez
##########################################################################
# precision
@property
def precision(self):
return self._precision
@precision.setter
def precision(
self,
value: float):
if not isinstance(value, float) or value < .0 or value > 100.0:
raise ValueError('Precision must be float and >= 0, <= 100.')
self._precision = value
##########################################################################
# recall
@property
def recall(self):
return self._recall
@recall.setter
def recall(
self,
value: float):
if not isinstance(value, float) or value < .0 or value > 100.0:
raise ValueError('Recall must be float and >= 0, <= 100.')
self._recall = value
##########################################################################
# f_measure
@property
def f_measure(self):
return self._f_measure
@f_measure.setter
def f_measure(
self,
value: float):
if not isinstance(value, float) or value < .0 or value > 100.0:
raise ValueError('F_measure must be float and >= 0, <= 100.')
self._f_measure = value
##########################################################################
# Public methods
def is_valid(self):
"""
:return: - True if valid.
- False otherwise.
"""
if not isinstance(self.recall, float) \
or not isinstance(self.f_measure, float) \
or not isinstance(self.precision, float):
return False
if self.recall < .0 or self.recall > 100.0 \
or self.f_measure < .0 or self.f_measure > 100.0 \
or self.precision < .0 or self.precision > 100.0:
return False
return True
##########################################################################
|
class Testsessoverallresults:
def __init__(self):
self._recall = -1.0
self._precision = -1.0
self._f_measure = -1.0
def __str__(self):
rez = '\nRecall : ' + str(self.recall)
rez += '\nPrecision : ' + str(self.precision)
rez += '\nF-measure : ' + str(self.f_measure)
rez += '\n\nThe overall result values are valid : ' + str(self.is_valid())
return rez
@property
def precision(self):
return self._precision
@precision.setter
def precision(self, value: float):
if not isinstance(value, float) or value < 0.0 or value > 100.0:
raise value_error('Precision must be float and >= 0, <= 100.')
self._precision = value
@property
def recall(self):
return self._recall
@recall.setter
def recall(self, value: float):
if not isinstance(value, float) or value < 0.0 or value > 100.0:
raise value_error('Recall must be float and >= 0, <= 100.')
self._recall = value
@property
def f_measure(self):
return self._f_measure
@f_measure.setter
def f_measure(self, value: float):
if not isinstance(value, float) or value < 0.0 or value > 100.0:
raise value_error('F_measure must be float and >= 0, <= 100.')
self._f_measure = value
def is_valid(self):
"""
:return: - True if valid.
- False otherwise.
"""
if not isinstance(self.recall, float) or not isinstance(self.f_measure, float) or (not isinstance(self.precision, float)):
return False
if self.recall < 0.0 or self.recall > 100.0 or self.f_measure < 0.0 or (self.f_measure > 100.0) or (self.precision < 0.0) or (self.precision > 100.0):
return False
return True
|
def dfs(node,parent):
for child in graph[node]:
if child!=parent:
dfs(child,node)
taken,nottaken=1,0
for neigh in graph[node]:
if neigh!=parent:
taken+=dp[neigh][0]
nottaken+=dp[neigh][1]
dp[node][1]=min(taken,nottaken)
dp[node][0]=nottaken
if __name__ == '__main__':
n=int(input())
dp=[[0 for j in range(2)] for i in range(n)]
graph=[[]for i in range(n)]
for i in range(n-1):
a,b=map(int,input().split())
a=a-1
b=b-1
graph[a].append(b)
graph[b].append(a)
dfs(0,-1)
print(dp)
|
def dfs(node, parent):
for child in graph[node]:
if child != parent:
dfs(child, node)
(taken, nottaken) = (1, 0)
for neigh in graph[node]:
if neigh != parent:
taken += dp[neigh][0]
nottaken += dp[neigh][1]
dp[node][1] = min(taken, nottaken)
dp[node][0] = nottaken
if __name__ == '__main__':
n = int(input())
dp = [[0 for j in range(2)] for i in range(n)]
graph = [[] for i in range(n)]
for i in range(n - 1):
(a, b) = map(int, input().split())
a = a - 1
b = b - 1
graph[a].append(b)
graph[b].append(a)
dfs(0, -1)
print(dp)
|
# Application condition
waitFor.id == max_used_id and not cur_node_is_processed
# Reaction
wait_for_touch_sensor_code = "while (!ecrobot_get_touch_sensor(NXT_PORT_S" + waitFor.Port + ")) {}\n"
code.append([wait_for_touch_sensor_code])
id_to_pos_in_code[waitFor.id] = len(code) - 1
cur_node_is_processed = True
|
waitFor.id == max_used_id and (not cur_node_is_processed)
wait_for_touch_sensor_code = 'while (!ecrobot_get_touch_sensor(NXT_PORT_S' + waitFor.Port + ')) {}\n'
code.append([wait_for_touch_sensor_code])
id_to_pos_in_code[waitFor.id] = len(code) - 1
cur_node_is_processed = True
|
print('Event')
#-------------Lorem
for i in [5,4,5]:
print(i)
|
print('Event')
for i in [5, 4, 5]:
print(i)
|
# 4-6. Odd Numbers: Use the third argument of the range() function to make a list
# of the odd numbers from 1 to 20. Use a for loop to print each number.
for i in range(1,21):
if i%2!=0:
print(i)
|
for i in range(1, 21):
if i % 2 != 0:
print(i)
|
class ResponseObject():
def __init__(self, status=500, msg="Unknown Error", data=None):
self.status = status
self.msg = msg
if data:
self.data = data
else:
self.data = {}
self.response = { "status" : self.status, "msg" : self.msg, "data" : self.data }
|
class Responseobject:
def __init__(self, status=500, msg='Unknown Error', data=None):
self.status = status
self.msg = msg
if data:
self.data = data
else:
self.data = {}
self.response = {'status': self.status, 'msg': self.msg, 'data': self.data}
|
class Settings:
PROJECT_TITLE: str = "Book store"
PROJECT_VERSION: str = "0.1.1"
settings = Settings()
|
class Settings:
project_title: str = 'Book store'
project_version: str = '0.1.1'
settings = settings()
|
__all__ = [
'api_exception',
'update_webhook_400_response_exception',
'retrieve_webhook_400_response_exception',
'create_webhook_400_response_exception',
]
|
__all__ = ['api_exception', 'update_webhook_400_response_exception', 'retrieve_webhook_400_response_exception', 'create_webhook_400_response_exception']
|
"""
An example of a procedural style FizzBuzz program.
For coding interviews, this is okay, but in general,
I do NOT recommend this approach to coding as it is
nearly impossible to test its correctness.
"""
for x in range(1, 101):
if x % 15 is 0:
print("FizzBuzz")
elif x % 3 is 0:
print("Fizz")
elif x % 5 is 0:
print("Buzz")
else:
print(x)
|
"""
An example of a procedural style FizzBuzz program.
For coding interviews, this is okay, but in general,
I do NOT recommend this approach to coding as it is
nearly impossible to test its correctness.
"""
for x in range(1, 101):
if x % 15 is 0:
print('FizzBuzz')
elif x % 3 is 0:
print('Fizz')
elif x % 5 is 0:
print('Buzz')
else:
print(x)
|
# simple calculator
# This function adds two numbers
def add(x, y):
return float(x) + float(y)
# This function subtracts two numbers
def subtract(x, y):
return float(x) - float(y)
# This function multiplies two numbers
def multiply(x, y):
return float(x) * float(y)
# This function divides two numbers
def divide(x, y):
try:
return float(x) / float(y)
except ValueError:
return 0
except ZeroDivisionError:
return 0
finally:
print("There was a problem with the division.")
def union(list_one: set, list_two: set):
list_one = set(list_one.split(","))
list_two = set(list_two.split(","))
return list_one.union(list_two)
def difference(list_one, list_two):
list_one = set(list_one.split(","))
list_two = set(list_two.split(","))
return list_one.difference(list_two)
def intersection(list_one, list_two):
list_one = set(list_one.split(","))
list_two = set(list_two.split(","))
return list_one.intersection(list_two)
def calculate_stats(list_one, list_two):
list_one = list_one.split(",")
list_two = list_two.split(",")
print(f"List 1 Min: {min(list_one)}")
print(f"List 1 Max: {max(list_one)}")
print(f"List 1 Length: {len(list_one)}")
print(f"List 2 Min: {min(list_two)}")
print(f"List 2 Max: {max(list_two)}")
print(f"List 2 Length: {len(list_two)}")
def sort_lists(list_one, list_two):
list_one = list_one.split(",")
list_two = list_two.split(",")
combined_list = list_one + list_two
combined_list.sort()
return combined_list
operation = input("Please enter Operation:")
first_param = input("Please enter first parameter:")
second_param = input("Please enter second parameter:")
if operation == 'Add':
print(first_param, "+", second_param, "=", add(first_param, second_param))
elif operation == 'Sub':
print(first_param, "-", second_param, "=", subtract(first_param, second_param))
elif operation == 'Mul':
print(first_param, "*", second_param, "=", multiply(first_param, second_param))
elif operation == 'Div':
print(first_param, "/", second_param, "=", divide(first_param, second_param))
elif operation.upper() == 'UNION':
print(f"Union: {union(first_param, second_param)}")
elif operation.upper() == 'INTERSECTION':
print(f"Intersection: {intersection(first_param, second_param)}")
elif operation.upper() == 'DIFFERENCE':
print(f"Difference: {difference(first_param, second_param)}")
elif operation.upper() == 'SORT':
print(sort_lists(first_param, second_param))
elif operation.upper() == 'STATS':
print(calculate_stats(first_param, second_param))
else:
print("Unknown operation.")
|
def add(x, y):
return float(x) + float(y)
def subtract(x, y):
return float(x) - float(y)
def multiply(x, y):
return float(x) * float(y)
def divide(x, y):
try:
return float(x) / float(y)
except ValueError:
return 0
except ZeroDivisionError:
return 0
finally:
print('There was a problem with the division.')
def union(list_one: set, list_two: set):
list_one = set(list_one.split(','))
list_two = set(list_two.split(','))
return list_one.union(list_two)
def difference(list_one, list_two):
list_one = set(list_one.split(','))
list_two = set(list_two.split(','))
return list_one.difference(list_two)
def intersection(list_one, list_two):
list_one = set(list_one.split(','))
list_two = set(list_two.split(','))
return list_one.intersection(list_two)
def calculate_stats(list_one, list_two):
list_one = list_one.split(',')
list_two = list_two.split(',')
print(f'List 1 Min: {min(list_one)}')
print(f'List 1 Max: {max(list_one)}')
print(f'List 1 Length: {len(list_one)}')
print(f'List 2 Min: {min(list_two)}')
print(f'List 2 Max: {max(list_two)}')
print(f'List 2 Length: {len(list_two)}')
def sort_lists(list_one, list_two):
list_one = list_one.split(',')
list_two = list_two.split(',')
combined_list = list_one + list_two
combined_list.sort()
return combined_list
operation = input('Please enter Operation:')
first_param = input('Please enter first parameter:')
second_param = input('Please enter second parameter:')
if operation == 'Add':
print(first_param, '+', second_param, '=', add(first_param, second_param))
elif operation == 'Sub':
print(first_param, '-', second_param, '=', subtract(first_param, second_param))
elif operation == 'Mul':
print(first_param, '*', second_param, '=', multiply(first_param, second_param))
elif operation == 'Div':
print(first_param, '/', second_param, '=', divide(first_param, second_param))
elif operation.upper() == 'UNION':
print(f'Union: {union(first_param, second_param)}')
elif operation.upper() == 'INTERSECTION':
print(f'Intersection: {intersection(first_param, second_param)}')
elif operation.upper() == 'DIFFERENCE':
print(f'Difference: {difference(first_param, second_param)}')
elif operation.upper() == 'SORT':
print(sort_lists(first_param, second_param))
elif operation.upper() == 'STATS':
print(calculate_stats(first_param, second_param))
else:
print('Unknown operation.')
|
class Stop:
"""
Represents each one of the physical stops in a GTFS dataset (from https://developers.google.com/transit/gtfs/reference/)
Fields
______
* **id** `(stop_id)` **Required** - The stop_id field contains an ID that uniquely identifies a stop, station, or station entrance. Multiple routes may use the same stop. The stop_id is used by systems as an internal identifier of this record (e.g., primary key in database), and therefore the stop_id must be dataset unique.
* **code** `(stop_code)` **Optional** - The stop_code field contains short text or a number that uniquely identifies the stop for passengers. Stop codes are often used in phone-based transit information systems or printed on stop signage to make it easier for riders to get a stop schedule or real-time arrival information for a particular stop. The stop_code field contains short text or a number that uniquely identifies the stop for passengers. The stop_code can be the same as stop_id if it is passenger-facing. This field should be left blank for stops without a code presented to passengers.
* **name** `(stop_name)` **Required** - The stop_name field contains the name of a stop, station, or station entrance. Please use a name that people will understand in the local and tourist vernacular.
* **desc** `(stop_desc)` **Optional** - The stop_desc field contains a description of a stop. Please provide useful, quality information. Do not simply duplicate the name of the stop.
* **lat** `(stop_lat)` **Required** - The stop_lat field contains the latitude of a stop, station, or station entrance. The field value must be a valid WGS 84 latitude.
* **lon** `(stop_lon)` **Required** - The stop_lon field contains the longitude of a stop, station, or station entrance. The field value must be a valid WGS 84 longitude value from -180 to 180.
* **zone_id** `(zone_id)` **Optional** - The zone_id field defines the fare zone for a stop ID. Zone IDs are required if you want to provide fare information using fare_rules.txt. If this stop ID represents a station, the zone ID is ignored.
* **url** `(stop_url)` **Optional** - The stop_url field contains the URL of a web page about a particular stop. This should be different from the agency_url and the route_url fields. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.
* **location_type** `(location_type)` **Optional** - The location_type field identifies whether this stop ID represents a stop, station, or station entrance. If no location type is specified, or the location_type is blank, stop IDs are treated as stops. Stations may have different properties from stops when they are represented on a map or used in trip planning. The location type field can have the following values:
- 0 or blank - Stop. A location where passengers board or disembark from a transit vehicle.
- 1 - Station. A physical structure or area that contains one or more stop.
- 2 - Station Entrance/Exit. A location where passengers can enter or exit a station from the street. The stop entry must also specify a parent_station value referencing the stop ID of the parent station for the entrance.
* **parent_station** `(parent_station)` **Optional** - For stops that are physically located inside stations, the parent_station field identifies the station associated with the stop. To use this field, stops.txt must also contain a row where this stop ID is assigned location type=1.
This stop ID represents... This entry's location type... This entry's parent_station field contains...
A stop located inside a station. 0 or blank The stop ID of the station where this stop is located. The stop referenced by parent_station must have location_type=1.
A stop located outside a station. 0 or blank A blank value. The parent_station field doesn't apply to this stop.
A station. 1 A blank value. Stations can't contain other stations.
* **timezone** `(stop_timezone)` **Optional** - The stop_timezone field contains the timezone in which this stop, station, or station entrance is located. Please refer to Wikipedia List of Timezones for a list of valid values. If omitted, the stop should be assumed to be located in the timezone specified by agency_timezone in agency.txt. When a stop has a parent station, the stop is considered to be in the timezone specified by the parent station's stop_timezone value. If the parent has no stop_timezone value, the stops that belong to that station are assumed to be in the timezone specified by agency_timezone, even if the stops have their own stop_timezone values. In other words, if a given stop has a parent_station value, any stop_timezone value specified for that stop must be ignored. Even if stop_timezone values are provided in stops.txt, the times in stop_times.txt should continue to be specified as time since midnight in the timezone specified by agency_timezone in agency.txt. This ensures that the time values in a trip always increase over the course of a trip, regardless of which timezones the trip crosses.
* **wheelchair_boarding** `(wheelchair_boarding)` **Optional** - The wheelchair_boarding field identifies whether wheelchair boardings are possible from the specified stop, station, or station entrance. The field can have the following values:
- 0 (or empty) - indicates that there is no accessibility information for the stop
- 1 - indicates that at least some vehicles at this stop can be boarded by a rider in a wheelchair
- 2 - wheelchair boarding is not possible at this stop
When a stop is part of a larger station complex, as indicated by a stop with a parent_station value, the stop's wheelchair_boarding field has the following additional semantics:
- 0 (or empty) - the stop will inherit its wheelchair_boarding value from the parent station, if specified in the parent
- 1 - there exists some accessible path from outside the station to the specific stop / platform
- 2 - there exists no accessible path from outside the station to the specific stop / platform
For station entrances, the wheelchair_boarding field has the following additional semantics:
- 0 (or empty) - the station entrance will inherit its wheelchair_boarding value from the parent station, if specified in the parent
- 1 - the station entrance is wheelchair accessible (e.g. an elevator is available to platforms if they are not at-grade)
- 2 - there exists no accessible path from the entrance to station platforms
"""
def __init__(self):
"""
Initializes the class with members corresponding to all fields in the GTFS specification. See Stop class
documentation
"""
self.id = None
self.code = ""
self.name = None
self.desc = ""
self.lat = None
self.lon = None
self.zone_id = None
self.url = None
self.location_type = 0
self.parent_station = None
self.timezone = None
self.wheelchair_boarding = 0
|
class Stop:
"""
Represents each one of the physical stops in a GTFS dataset (from https://developers.google.com/transit/gtfs/reference/)
Fields
______
* **id** `(stop_id)` **Required** - The stop_id field contains an ID that uniquely identifies a stop, station, or station entrance. Multiple routes may use the same stop. The stop_id is used by systems as an internal identifier of this record (e.g., primary key in database), and therefore the stop_id must be dataset unique.
* **code** `(stop_code)` **Optional** - The stop_code field contains short text or a number that uniquely identifies the stop for passengers. Stop codes are often used in phone-based transit information systems or printed on stop signage to make it easier for riders to get a stop schedule or real-time arrival information for a particular stop. The stop_code field contains short text or a number that uniquely identifies the stop for passengers. The stop_code can be the same as stop_id if it is passenger-facing. This field should be left blank for stops without a code presented to passengers.
* **name** `(stop_name)` **Required** - The stop_name field contains the name of a stop, station, or station entrance. Please use a name that people will understand in the local and tourist vernacular.
* **desc** `(stop_desc)` **Optional** - The stop_desc field contains a description of a stop. Please provide useful, quality information. Do not simply duplicate the name of the stop.
* **lat** `(stop_lat)` **Required** - The stop_lat field contains the latitude of a stop, station, or station entrance. The field value must be a valid WGS 84 latitude.
* **lon** `(stop_lon)` **Required** - The stop_lon field contains the longitude of a stop, station, or station entrance. The field value must be a valid WGS 84 longitude value from -180 to 180.
* **zone_id** `(zone_id)` **Optional** - The zone_id field defines the fare zone for a stop ID. Zone IDs are required if you want to provide fare information using fare_rules.txt. If this stop ID represents a station, the zone ID is ignored.
* **url** `(stop_url)` **Optional** - The stop_url field contains the URL of a web page about a particular stop. This should be different from the agency_url and the route_url fields. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.
* **location_type** `(location_type)` **Optional** - The location_type field identifies whether this stop ID represents a stop, station, or station entrance. If no location type is specified, or the location_type is blank, stop IDs are treated as stops. Stations may have different properties from stops when they are represented on a map or used in trip planning. The location type field can have the following values:
- 0 or blank - Stop. A location where passengers board or disembark from a transit vehicle.
- 1 - Station. A physical structure or area that contains one or more stop.
- 2 - Station Entrance/Exit. A location where passengers can enter or exit a station from the street. The stop entry must also specify a parent_station value referencing the stop ID of the parent station for the entrance.
* **parent_station** `(parent_station)` **Optional** - For stops that are physically located inside stations, the parent_station field identifies the station associated with the stop. To use this field, stops.txt must also contain a row where this stop ID is assigned location type=1.
This stop ID represents... This entry's location type... This entry's parent_station field contains...
A stop located inside a station. 0 or blank The stop ID of the station where this stop is located. The stop referenced by parent_station must have location_type=1.
A stop located outside a station. 0 or blank A blank value. The parent_station field doesn't apply to this stop.
A station. 1 A blank value. Stations can't contain other stations.
* **timezone** `(stop_timezone)` **Optional** - The stop_timezone field contains the timezone in which this stop, station, or station entrance is located. Please refer to Wikipedia List of Timezones for a list of valid values. If omitted, the stop should be assumed to be located in the timezone specified by agency_timezone in agency.txt. When a stop has a parent station, the stop is considered to be in the timezone specified by the parent station's stop_timezone value. If the parent has no stop_timezone value, the stops that belong to that station are assumed to be in the timezone specified by agency_timezone, even if the stops have their own stop_timezone values. In other words, if a given stop has a parent_station value, any stop_timezone value specified for that stop must be ignored. Even if stop_timezone values are provided in stops.txt, the times in stop_times.txt should continue to be specified as time since midnight in the timezone specified by agency_timezone in agency.txt. This ensures that the time values in a trip always increase over the course of a trip, regardless of which timezones the trip crosses.
* **wheelchair_boarding** `(wheelchair_boarding)` **Optional** - The wheelchair_boarding field identifies whether wheelchair boardings are possible from the specified stop, station, or station entrance. The field can have the following values:
- 0 (or empty) - indicates that there is no accessibility information for the stop
- 1 - indicates that at least some vehicles at this stop can be boarded by a rider in a wheelchair
- 2 - wheelchair boarding is not possible at this stop
When a stop is part of a larger station complex, as indicated by a stop with a parent_station value, the stop's wheelchair_boarding field has the following additional semantics:
- 0 (or empty) - the stop will inherit its wheelchair_boarding value from the parent station, if specified in the parent
- 1 - there exists some accessible path from outside the station to the specific stop / platform
- 2 - there exists no accessible path from outside the station to the specific stop / platform
For station entrances, the wheelchair_boarding field has the following additional semantics:
- 0 (or empty) - the station entrance will inherit its wheelchair_boarding value from the parent station, if specified in the parent
- 1 - the station entrance is wheelchair accessible (e.g. an elevator is available to platforms if they are not at-grade)
- 2 - there exists no accessible path from the entrance to station platforms
"""
def __init__(self):
"""
Initializes the class with members corresponding to all fields in the GTFS specification. See Stop class
documentation
"""
self.id = None
self.code = ''
self.name = None
self.desc = ''
self.lat = None
self.lon = None
self.zone_id = None
self.url = None
self.location_type = 0
self.parent_station = None
self.timezone = None
self.wheelchair_boarding = 0
|
DEFAULT_MOD = 10 ** 9 + 7
def mod_permutation(n, k, mod=DEFAULT_MOD):
if k >= mod:
return 0
ret = 1
for i in range(n, n - k, -1):
ret = (ret * i) % mod
return ret
def mod_factorial(n, mod=DEFAULT_MOD):
if n >= mod:
return 0
else:
return mod_permutation(n, n, mod)
def mod_combination(n, k, mod=DEFAULT_MOD):
k = min(k, n - k)
mod_power = 0
numerator = 1
denominator = 1
for i in range(n, n - k, -1):
while i % mod == 0:
i //= mod
mod_power += 1
numerator = (numerator * i) % mod
for i in range(k, 0, -1):
while i % mod == 0:
i //= mod
mod_power -= 1
denominator = (denominator * i) % mod
if mod_power > 0:
return 0
else:
return (numerator * pow(denominator, mod - 2, mod)) % mod
|
default_mod = 10 ** 9 + 7
def mod_permutation(n, k, mod=DEFAULT_MOD):
if k >= mod:
return 0
ret = 1
for i in range(n, n - k, -1):
ret = ret * i % mod
return ret
def mod_factorial(n, mod=DEFAULT_MOD):
if n >= mod:
return 0
else:
return mod_permutation(n, n, mod)
def mod_combination(n, k, mod=DEFAULT_MOD):
k = min(k, n - k)
mod_power = 0
numerator = 1
denominator = 1
for i in range(n, n - k, -1):
while i % mod == 0:
i //= mod
mod_power += 1
numerator = numerator * i % mod
for i in range(k, 0, -1):
while i % mod == 0:
i //= mod
mod_power -= 1
denominator = denominator * i % mod
if mod_power > 0:
return 0
else:
return numerator * pow(denominator, mod - 2, mod) % mod
|
# -*- coding: utf-8 -*-
n = int(input("Enter one number: "))
if n < 0:
print("please enter a positive ")
else:
while n != 1:
print(int(n))
if n % 2 != 0:
n = 3 * n + 1
else:
n /= 2
print("result ", int(n))
|
n = int(input('Enter one number: '))
if n < 0:
print('please enter a positive ')
else:
while n != 1:
print(int(n))
if n % 2 != 0:
n = 3 * n + 1
else:
n /= 2
print('result ', int(n))
|
"""
Modified from https://github.com/facebookresearch/fvcore
"""
__all__ = ["Registry"]
class Registry:
"""A registry providing name -> object mapping, to support
custom modules.
To create a registry (e.g. a backbone registry):
.. code-block:: python
BACKBONE_REGISTRY = Registry('BACKBONE')
To register an object:
.. code-block:: python
@BACKBONE_REGISTRY.register()
class MyBackbone(nn.Module):
...
Or:
.. code-block:: python
BACKBONE_REGISTRY.register(MyBackbone)
"""
def __init__(self, name):
self._name = name
self._obj_map = dict()
def _do_register(self, name, obj, force=False):
if name in self._obj_map and not force:
raise KeyError(
'An object named "{}" was already '
'registered in "{}" registry'.format(name, self._name)
)
self._obj_map[name] = obj
def register(self, obj=None, force=False):
if obj is None:
# Used as a decorator
def wrapper(fn_or_class):
name = fn_or_class.__name__
self._do_register(name, fn_or_class, force=force)
return fn_or_class
return wrapper
# Used as a function call
name = obj.__name__
self._do_register(name, obj, force=force)
def get(self, name):
if name not in self._obj_map:
raise KeyError(
'Object name "{}" does not exist '
'in "{}" registry'.format(name, self._name)
)
return self._obj_map[name]
def registered_names(self):
return list(self._obj_map.keys())
|
"""
Modified from https://github.com/facebookresearch/fvcore
"""
__all__ = ['Registry']
class Registry:
"""A registry providing name -> object mapping, to support
custom modules.
To create a registry (e.g. a backbone registry):
.. code-block:: python
BACKBONE_REGISTRY = Registry('BACKBONE')
To register an object:
.. code-block:: python
@BACKBONE_REGISTRY.register()
class MyBackbone(nn.Module):
...
Or:
.. code-block:: python
BACKBONE_REGISTRY.register(MyBackbone)
"""
def __init__(self, name):
self._name = name
self._obj_map = dict()
def _do_register(self, name, obj, force=False):
if name in self._obj_map and (not force):
raise key_error('An object named "{}" was already registered in "{}" registry'.format(name, self._name))
self._obj_map[name] = obj
def register(self, obj=None, force=False):
if obj is None:
def wrapper(fn_or_class):
name = fn_or_class.__name__
self._do_register(name, fn_or_class, force=force)
return fn_or_class
return wrapper
name = obj.__name__
self._do_register(name, obj, force=force)
def get(self, name):
if name not in self._obj_map:
raise key_error('Object name "{}" does not exist in "{}" registry'.format(name, self._name))
return self._obj_map[name]
def registered_names(self):
return list(self._obj_map.keys())
|
"""The protocol_*.py files in this package are based on PySerial's file
test/handlers/protocol_test.py, modified for different behaviors. The call
serial.serial_for_url("XYZ://") looks for a class Serial in a file named protocol_XYZ.py in this
package (i.e. directory).
This package init file will be loaded as part of searching for a protocol handler in this package.
It is important to use root-relative imports (e.g. relative to the POCS directory) so that all
modules and packages are loaded only once.
"""
|
"""The protocol_*.py files in this package are based on PySerial's file
test/handlers/protocol_test.py, modified for different behaviors. The call
serial.serial_for_url("XYZ://") looks for a class Serial in a file named protocol_XYZ.py in this
package (i.e. directory).
This package init file will be loaded as part of searching for a protocol handler in this package.
It is important to use root-relative imports (e.g. relative to the POCS directory) so that all
modules and packages are loaded only once.
"""
|
def create_authority_hints(default_hints, trust_chains):
"""
:param default_hints: The authority hints provided to the entity at startup
:param trust_chains: A list of TrustChain instances
:return: An authority_hints dictionary
"""
intermediates = {trust_chain.iss_path[1] for trust_chain in trust_chains if
len(trust_chain.iss_path)}
return list(set(default_hints).intersection(intermediates))
|
def create_authority_hints(default_hints, trust_chains):
"""
:param default_hints: The authority hints provided to the entity at startup
:param trust_chains: A list of TrustChain instances
:return: An authority_hints dictionary
"""
intermediates = {trust_chain.iss_path[1] for trust_chain in trust_chains if len(trust_chain.iss_path)}
return list(set(default_hints).intersection(intermediates))
|
{"query": {"function_score": {"query": {
"bool": {"should": [{"multi_match": {"query": "python", "fields": ["nickname^2", "username^4"]}}],
"filter": {"range": {"follower_count": {"gte": "50000", "lte": "100000"}}}}},
"field_value_factor": {"field": "follower_count", "modifier": "log1p", "missing": 0,
"factor": 1}, "boost_mode": "avg"}},
"highlight": {"fields": {"nickname": {}, "description": {}}}, "size": 10, "from": 0}
{
"query": {
"function_score": {
"query": {
"bool": {"must": [{
"multi_match": {
"query": "python",
"fields": ["nickname^2", "username^4"]
}}],
"filter": {"range": {
"follower_count": {
"gte": "50000",
"lte": "100000"
}
}}}
},
"field_value_factor": {
"field": "follower_count",
"modifier": "log1p",
"missing": 0,
"factor": 1
},
"boost_mode": "avg"
}
},
"highlight": {
"fields": {
"nickname": {},
"description": {}
}
},
"size":10,
"from": 0
}
|
{'query': {'function_score': {'query': {'bool': {'should': [{'multi_match': {'query': 'python', 'fields': ['nickname^2', 'username^4']}}], 'filter': {'range': {'follower_count': {'gte': '50000', 'lte': '100000'}}}}}, 'field_value_factor': {'field': 'follower_count', 'modifier': 'log1p', 'missing': 0, 'factor': 1}, 'boost_mode': 'avg'}}, 'highlight': {'fields': {'nickname': {}, 'description': {}}}, 'size': 10, 'from': 0}
{'query': {'function_score': {'query': {'bool': {'must': [{'multi_match': {'query': 'python', 'fields': ['nickname^2', 'username^4']}}], 'filter': {'range': {'follower_count': {'gte': '50000', 'lte': '100000'}}}}}, 'field_value_factor': {'field': 'follower_count', 'modifier': 'log1p', 'missing': 0, 'factor': 1}, 'boost_mode': 'avg'}}, 'highlight': {'fields': {'nickname': {}, 'description': {}}}, 'size': 10, 'from': 0}
|
def restart():
prompt = input("Type [y] to play again or any other key to quit. ")
if prompt.lower() == "y":
return True
else:
return False
|
def restart():
prompt = input('Type [y] to play again or any other key to quit. ')
if prompt.lower() == 'y':
return True
else:
return False
|
#!/usr/bin/env python3
try:
checksum = 0
while True:
numbers = [int(n) for n in input().split()]
checksum += max(numbers) - min(numbers)
except EOFError:
print(checksum)
|
try:
checksum = 0
while True:
numbers = [int(n) for n in input().split()]
checksum += max(numbers) - min(numbers)
except EOFError:
print(checksum)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.