content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
class dotHierarchicList_t(object):
# no doc
aObjects = None
ModelFatherObject = None
nObjects = None
ObjectsLeftToGet = None
OperationType = None
|
class Dothierarchiclist_T(object):
a_objects = None
model_father_object = None
n_objects = None
objects_left_to_get = None
operation_type = None
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if not head:
return None
if not head.next:
return head
temp = head.next
head.next = self.swapPairs(temp.next)
temp.next = head
return temp
|
class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def swap_pairs(self, head: ListNode) -> ListNode:
if not head:
return None
if not head.next:
return head
temp = head.next
head.next = self.swapPairs(temp.next)
temp.next = head
return temp
|
RED = images.create_image("""
. # # # .
. # # # .
. . . . .
. . . . .
. . . . .
""")
RED_YELLOW = images.create_image("""
. # # # .
. # # # .
. # # # .
. . . . .
. . . . .
""")
YELLOW = images.create_image("""
. . . . .
. # # # .
. # # # .
. . . . .
. . . . .
""")
GREEN = images.create_image("""
. . . . .
. . . . .
. # # # .
. # # # .
. . . . .
""")
def on_forever():
RED.show_image(0)
basic.pause(15000)
RED_YELLOW.show_image(0)
basic.pause(3000)
GREEN.show_image(0)
basic.pause(15000)
YELLOW.show_image(0)
basic.pause(3000)
basic.forever(on_forever)
def on_button_pressed_a():
basic.clear_screen()
basic.show_string("Program exit.")
control.reset()
input.on_button_pressed(Button.A, on_button_pressed_a)
|
red = images.create_image('\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n. . . . .\n')
red_yellow = images.create_image('\n. # # # .\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n')
yellow = images.create_image('\n. . . . .\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n')
green = images.create_image('\n. . . . .\n. . . . .\n. # # # .\n. # # # .\n. . . . .\n')
def on_forever():
RED.show_image(0)
basic.pause(15000)
RED_YELLOW.show_image(0)
basic.pause(3000)
GREEN.show_image(0)
basic.pause(15000)
YELLOW.show_image(0)
basic.pause(3000)
basic.forever(on_forever)
def on_button_pressed_a():
basic.clear_screen()
basic.show_string('Program exit.')
control.reset()
input.on_button_pressed(Button.A, on_button_pressed_a)
|
# Lemoneval Project
# Author: Abhabongse Janthong <[email protected]>
"""Validator classes for each parameter in exercise frameworks."""
class BaseValidator(object):
"""Defines a callable object which checks if the given value is valid."""
__slots__ = ("name",)
def __init__(self, *, name=None):
self.name = name
def __call__(self, value, target):
"""Checks whether the value is valid. If the validation is successful
then True is returned. Otherwise, either False is returned or an
exception describing what went wrong is raised.
Target is the name of the object requiring the validation and it is
used for error messages in exceptions.
"""
pass
class PredicateValidator(BaseValidator):
"""Checks whether the given values passes the predicate test."""
__slots__ = ("predicate",)
def __init__(self, predicate, *, name=None):
if name is None:
name = getattr(predicate, "__qualname__", None)
super().__init__(name=name)
self.predicate = predicate
def __call__(self, value, target):
try:
if self.predicate(value):
return True
else:
raise ValueError
except Exception as e:
test_name = self.name or "the predicate test"
raise ValueError(
f"the given value {value!r} failed {test_name} for the "
f"parameter '{target}'"
) from e
|
"""Validator classes for each parameter in exercise frameworks."""
class Basevalidator(object):
"""Defines a callable object which checks if the given value is valid."""
__slots__ = ('name',)
def __init__(self, *, name=None):
self.name = name
def __call__(self, value, target):
"""Checks whether the value is valid. If the validation is successful
then True is returned. Otherwise, either False is returned or an
exception describing what went wrong is raised.
Target is the name of the object requiring the validation and it is
used for error messages in exceptions.
"""
pass
class Predicatevalidator(BaseValidator):
"""Checks whether the given values passes the predicate test."""
__slots__ = ('predicate',)
def __init__(self, predicate, *, name=None):
if name is None:
name = getattr(predicate, '__qualname__', None)
super().__init__(name=name)
self.predicate = predicate
def __call__(self, value, target):
try:
if self.predicate(value):
return True
else:
raise ValueError
except Exception as e:
test_name = self.name or 'the predicate test'
raise value_error(f"the given value {value!r} failed {test_name} for the parameter '{target}'") from e
|
# Source found at: https://datatables.net/extensions/scroller/examples/initialisation/large_js_source.html
def generate_html_page(file_path, prj_name, title, df):
"""
Write a dataframe to a HTML page.
:param file_path: File path to save the HTML file.
:param prj_name: Project name for the title.
:param title: Title for the title.
:param df: Dataframe for the data to display.
:return:
"""
print(file_path)
with open(file_path, 'w') as f:
f.write(header(prj_name=prj_name, title=title)) # Header and start of Body of HTML
f.write(table(df)) # Table of HTML
f.write(footer()) # End of body and HTML
def header(prj_name, title):
hdr = """<!DOCTYPE html>"
<html lang="en">
<head>
<meta charset="utf-8">
<title>{} - {}</title>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" crossorigin="anonymous">
<!--link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"-->
</head>
<body>
""".format(prj_name, title)
return hdr
def footer():
ftr = """<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script>
$(function(){
$("#example").dataTable();
})
</script>
</body>
</html>"""
return ftr
def table(df):
"""
Convert the dataframe to an HTML Table
In clude the id and class.
:param df: Dataframe to convert
:return:
"""
# Example of table start
# <table id="example" class="display" ..
df_html = df.to_html(classes='display" id="example')
return df_html
|
def generate_html_page(file_path, prj_name, title, df):
"""
Write a dataframe to a HTML page.
:param file_path: File path to save the HTML file.
:param prj_name: Project name for the title.
:param title: Title for the title.
:param df: Dataframe for the data to display.
:return:
"""
print(file_path)
with open(file_path, 'w') as f:
f.write(header(prj_name=prj_name, title=title))
f.write(table(df))
f.write(footer())
def header(prj_name, title):
hdr = '<!DOCTYPE html>"\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>{} - {}</title>\n \n <link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" crossorigin="anonymous">\n \n <!--link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css"-->\n \n </head>\n \n <body>\n '.format(prj_name, title)
return hdr
def footer():
ftr = '<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>\n <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>\n <script>\n $(function(){\n $("#example").dataTable();\n })\n </script>\n \n </body>\n \n </html>'
return ftr
def table(df):
"""
Convert the dataframe to an HTML Table
In clude the id and class.
:param df: Dataframe to convert
:return:
"""
df_html = df.to_html(classes='display" id="example')
return df_html
|
pytest_plugins = "pytester"
LEAKING_TEST = """
import threading
import time
def test_leak():
for i in range(2):
t = threading.Thread(
target=time.sleep,
args=(0.5,),
name="leaked-thread-%d" % i)
t.daemon = True
t.start()
"""
INI_ENABLED = """
[pytest]
threadleak = True
"""
INI_DISABLED = """
[pytest]
threadleak = False
"""
def test_leak_enabled_option(testdir):
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines([
'*::test_leak FAILED',
'*Failed: Test leaked *leaked-thread-0*leaked-thread-1*',
])
assert result.ret == 1
def test_leak_enabled_ini(testdir):
testdir.makeini(INI_ENABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines([
'*::test_leak FAILED',
'*Failed: Test leaked *leaked-thread-0*leaked-thread-1*',
])
assert result.ret == 1
def test_leak_option_overrides_ini(testdir):
testdir.makeini(INI_DISABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines([
'*::test_leak FAILED',
'*Failed: Test leaked *leaked-thread-0*leaked-thread-1*',
])
assert result.ret == 1
def test_leak_disabled(testdir):
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines(['*::test_leak PASSED'])
assert result.ret == 0
def test_leak_disabled_ini(testdir):
testdir.makeini(INI_DISABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines(['*::test_leak PASSED'])
assert result.ret == 0
def test_no_leak(testdir):
testdir.makepyfile("""
def test_no_leak():
pass
""")
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines(['*::test_no_leak PASSED'])
assert result.ret == 0
def test_help_message(testdir):
result = testdir.runpytest('--help')
result.stdout.fnmatch_lines([
'threadleak:',
'*--threadleak*Detect tests leaking threads',
])
|
pytest_plugins = 'pytester'
leaking_test = '\nimport threading\nimport time\n\ndef test_leak():\n for i in range(2):\n t = threading.Thread(\n target=time.sleep,\n args=(0.5,),\n name="leaked-thread-%d" % i)\n t.daemon = True\n t.start()\n'
ini_enabled = '\n[pytest]\nthreadleak = True\n'
ini_disabled = '\n[pytest]\nthreadleak = False\n'
def test_leak_enabled_option(testdir):
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines(['*::test_leak FAILED', '*Failed: Test leaked *leaked-thread-0*leaked-thread-1*'])
assert result.ret == 1
def test_leak_enabled_ini(testdir):
testdir.makeini(INI_ENABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines(['*::test_leak FAILED', '*Failed: Test leaked *leaked-thread-0*leaked-thread-1*'])
assert result.ret == 1
def test_leak_option_overrides_ini(testdir):
testdir.makeini(INI_DISABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines(['*::test_leak FAILED', '*Failed: Test leaked *leaked-thread-0*leaked-thread-1*'])
assert result.ret == 1
def test_leak_disabled(testdir):
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines(['*::test_leak PASSED'])
assert result.ret == 0
def test_leak_disabled_ini(testdir):
testdir.makeini(INI_DISABLED)
testdir.makepyfile(LEAKING_TEST)
result = testdir.runpytest('-v')
result.stdout.fnmatch_lines(['*::test_leak PASSED'])
assert result.ret == 0
def test_no_leak(testdir):
testdir.makepyfile('\n def test_no_leak():\n pass\n ')
result = testdir.runpytest('--threadleak', '-v')
result.stdout.fnmatch_lines(['*::test_no_leak PASSED'])
assert result.ret == 0
def test_help_message(testdir):
result = testdir.runpytest('--help')
result.stdout.fnmatch_lines(['threadleak:', '*--threadleak*Detect tests leaking threads'])
|
'''
Factorial (hacker challenge). Write a function factorial() that returns the
factorial of the given number. For example, factorial(5) should return 120.
Do this using recursion; remember that factorial(n) = n * factorial(n-1).
'''
def factorial(n):
if n == 1 or n == 0:
return 1
if n == 2:
return 2
return n*factorial(n-1)
print(factorial(5))
def factorial_iter(n):
res = 1
for i in range(1, n+1):
print('before ', res, i)
res *= i
print('after ', res, i)
return res
print(factorial_iter(5))
|
"""
Factorial (hacker challenge). Write a function factorial() that returns the
factorial of the given number. For example, factorial(5) should return 120.
Do this using recursion; remember that factorial(n) = n * factorial(n-1).
"""
def factorial(n):
if n == 1 or n == 0:
return 1
if n == 2:
return 2
return n * factorial(n - 1)
print(factorial(5))
def factorial_iter(n):
res = 1
for i in range(1, n + 1):
print('before ', res, i)
res *= i
print('after ', res, i)
return res
print(factorial_iter(5))
|
def infini(y : int) -> int:
x : int = y
while x >= 0:
x = x + 1
return x
def f(x : int) -> int:
return x + 1
|
def infini(y: int) -> int:
x: int = y
while x >= 0:
x = x + 1
return x
def f(x: int) -> int:
return x + 1
|
def changeConf(xmin=2., xmax=16., resolution=2, Nxx=1000, Ntt=20000, \
every_scalar_t=10, every_aaray_t=100, \
amplitud=0.1, sigma=1, x0=9., Boundaries=0, Metric=1):
conf = open('input.par','w')
conf.write('¶meters')
conf.write('xmin = ' + str(xmin) + '\n')
conf.write('xmax = ' + str(xmax) + '\n')
conf.write('resolution = ' + str(resolution) + '\n')
conf.write('Nxx = ' + str(Nxx) + '\n')
conf.write('Ntt = ' + str(Ntt) + '\n')
conf.write('courant = 0.25' + '\n')
conf.write('every_scalar_t = ' + str(every_scalar_t) + '\n')
conf.write('every_array_t = ' + str(every_aaray_t) + '\n')
conf.write('amplitud = ' + str(amplitud) + '\n')
conf.write('sigma = ' + str(sigma) + '\n')
conf.write('x0 = ' + str(x0) + '\n')
conf.write('Boundaries = ' + str(Boundaries) + '\n')
conf.write('Metric = ' + str(Metric) + '\n')
conf.write('\\')
conf.close()
print('-------------------------')
|
def change_conf(xmin=2.0, xmax=16.0, resolution=2, Nxx=1000, Ntt=20000, every_scalar_t=10, every_aaray_t=100, amplitud=0.1, sigma=1, x0=9.0, Boundaries=0, Metric=1):
conf = open('input.par', 'w')
conf.write('¶meters')
conf.write('xmin = ' + str(xmin) + '\n')
conf.write('xmax = ' + str(xmax) + '\n')
conf.write('resolution = ' + str(resolution) + '\n')
conf.write('Nxx = ' + str(Nxx) + '\n')
conf.write('Ntt = ' + str(Ntt) + '\n')
conf.write('courant = 0.25' + '\n')
conf.write('every_scalar_t = ' + str(every_scalar_t) + '\n')
conf.write('every_array_t = ' + str(every_aaray_t) + '\n')
conf.write('amplitud = ' + str(amplitud) + '\n')
conf.write('sigma = ' + str(sigma) + '\n')
conf.write('x0 = ' + str(x0) + '\n')
conf.write('Boundaries = ' + str(Boundaries) + '\n')
conf.write('Metric = ' + str(Metric) + '\n')
conf.write('\\')
conf.close()
print('-------------------------')
|
class Day3:
def part1(self):
with open(r'C:\Coding\AdventOfCode\AOC2019\Data\Data3.txt') as f:
lines = f.read().splitlines()
firstPath = lines[0].split(',')
secondPath = lines[1].split(',')
firstPathCoordinates = self.wiresPositionsDictionary(firstPath)
secondPathCoordinates = self.wiresPositionsDictionary(secondPath)
manhattanDistance = 9999999999999
for coordinate in firstPathCoordinates:
if coordinate in secondPathCoordinates:
distance = abs(coordinate.X) + abs(coordinate.Y)
if 0 < distance < manhattanDistance:
manhattanDistance = distance
print("Day 3, part 1: " + str(manhattanDistance))
def wiresPositionsDictionary(self, commands) -> dict:
position = Position(0, 0)
dictionary = {position: 0}
for command in commands:
firstLetter = command[0]
number = int(command[1:])
i = 0
while i < number:
i += 1
if firstLetter == 'U':
position = Position(position.X, position.Y + 1)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'D':
position = Position(position.X, position.Y - 1)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'L':
position = Position(position.X - 1, position.Y)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'R':
position = Position(position.X + 1, position.Y)
if position.X != 0 or position.Y != 0:
dictionary[position] = 1
return dictionary
def part2(self):
with open(r'C:\Coding\AdventOfCode\AOC2019\Data\Data3.txt') as f:
lines = f.read().splitlines()
firstPath = lines[0].split(',')
secondPath = lines[1].split(',')
firstPathCoordinates = self.wiresPositionsDictionaryWithTime(firstPath)
secondPathCoordinates = self.wiresPositionsDictionaryWithTime(secondPath)
minimumTime = 9999999999999
for coordinate in firstPathCoordinates:
if coordinate in secondPathCoordinates:
time = firstPathCoordinates[coordinate] + secondPathCoordinates[coordinate]
if 0 < time < minimumTime:
minimumTime = time
print("Day 3, part 2: " + str(minimumTime))
def wiresPositionsDictionaryWithTime(self, commands) -> dict:
position = Position(0, 0)
dictionary = {position: 0}
time = 1
for command in commands:
firstLetter = command[0]
number = int(command[1:])
i = 0
while i < number:
i += 1
if firstLetter == 'U':
position = Position(position.X, position.Y + 1)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'D':
position = Position(position.X, position.Y - 1)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'L':
position = Position(position.X - 1, position.Y)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'R':
position = Position(position.X + 1, position.Y)
self.addToDictionary(dictionary, position, time)
time += 1
return dictionary
def addToDictionary(self, dictionary, position, time):
if (position.X != 0 or position.Y != 0) and position not in dictionary:
dictionary[position] = time
class Position:
X = 0
Y = 0
def __init__(self, x, y):
self.X = x
self.Y = y
def __eq__(self, other):
return self.X == other.X and self.Y == other.Y
def __hash__(self):
return hash((self.X, self.Y))
|
class Day3:
def part1(self):
with open('C:\\Coding\\AdventOfCode\\AOC2019\\Data\\Data3.txt') as f:
lines = f.read().splitlines()
first_path = lines[0].split(',')
second_path = lines[1].split(',')
first_path_coordinates = self.wiresPositionsDictionary(firstPath)
second_path_coordinates = self.wiresPositionsDictionary(secondPath)
manhattan_distance = 9999999999999
for coordinate in firstPathCoordinates:
if coordinate in secondPathCoordinates:
distance = abs(coordinate.X) + abs(coordinate.Y)
if 0 < distance < manhattanDistance:
manhattan_distance = distance
print('Day 3, part 1: ' + str(manhattanDistance))
def wires_positions_dictionary(self, commands) -> dict:
position = position(0, 0)
dictionary = {position: 0}
for command in commands:
first_letter = command[0]
number = int(command[1:])
i = 0
while i < number:
i += 1
if firstLetter == 'U':
position = position(position.X, position.Y + 1)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'D':
position = position(position.X, position.Y - 1)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'L':
position = position(position.X - 1, position.Y)
if position.X != 0 and position.Y != 0:
dictionary[position] = 1
if firstLetter == 'R':
position = position(position.X + 1, position.Y)
if position.X != 0 or position.Y != 0:
dictionary[position] = 1
return dictionary
def part2(self):
with open('C:\\Coding\\AdventOfCode\\AOC2019\\Data\\Data3.txt') as f:
lines = f.read().splitlines()
first_path = lines[0].split(',')
second_path = lines[1].split(',')
first_path_coordinates = self.wiresPositionsDictionaryWithTime(firstPath)
second_path_coordinates = self.wiresPositionsDictionaryWithTime(secondPath)
minimum_time = 9999999999999
for coordinate in firstPathCoordinates:
if coordinate in secondPathCoordinates:
time = firstPathCoordinates[coordinate] + secondPathCoordinates[coordinate]
if 0 < time < minimumTime:
minimum_time = time
print('Day 3, part 2: ' + str(minimumTime))
def wires_positions_dictionary_with_time(self, commands) -> dict:
position = position(0, 0)
dictionary = {position: 0}
time = 1
for command in commands:
first_letter = command[0]
number = int(command[1:])
i = 0
while i < number:
i += 1
if firstLetter == 'U':
position = position(position.X, position.Y + 1)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'D':
position = position(position.X, position.Y - 1)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'L':
position = position(position.X - 1, position.Y)
self.addToDictionary(dictionary, position, time)
if firstLetter == 'R':
position = position(position.X + 1, position.Y)
self.addToDictionary(dictionary, position, time)
time += 1
return dictionary
def add_to_dictionary(self, dictionary, position, time):
if (position.X != 0 or position.Y != 0) and position not in dictionary:
dictionary[position] = time
class Position:
x = 0
y = 0
def __init__(self, x, y):
self.X = x
self.Y = y
def __eq__(self, other):
return self.X == other.X and self.Y == other.Y
def __hash__(self):
return hash((self.X, self.Y))
|
# --------------------------------------
#! /usr/bin/python
# File: 283. Move Zeros.py
# Author: Kimberly Gao
class Solution:
def _init_(self,name):
self.name = name
# My 1st solution: (Run time: 68ms(29.57%)) (2 pointer)
# Memory Usage: 15.4 MB (61.79%)
def moveZeros1(self, nums):
slow = 0
for fast in range(len(nums)):
if nums[fast] != 0:
nums[slow] = nums[fast]
slow += 1
for fast in range (slow, len(nums)):
nums[fast] = 0
return nums
# My 2nt solution: (Run time: 72ms(28.1%)) (2 pointer)
# Memory Usage: 15.5 MB (19.46%)
def moveZeros2(self, nums):
slow = 0
for fast in range(len(nums)):
i = nums[slow]
nums[slow] = nums[fast]
nums[fast] = i
slow += 1
return nums
'''For python, can use
if num == o:
nums.remove(num)
nums.append(num)
Also consider using:
for slow in xrange(len(nums))
'''
if __name__ == '__main__':
nums = [0,1,0,3,12]
# nums = 0 should be taken into consideration
my_solution = Solution().moveZeros1(nums)
print(my_solution)
better_solution = Solution().moveZeros2(nums)
print(better_solution)
|
class Solution:
def _init_(self, name):
self.name = name
def move_zeros1(self, nums):
slow = 0
for fast in range(len(nums)):
if nums[fast] != 0:
nums[slow] = nums[fast]
slow += 1
for fast in range(slow, len(nums)):
nums[fast] = 0
return nums
def move_zeros2(self, nums):
slow = 0
for fast in range(len(nums)):
i = nums[slow]
nums[slow] = nums[fast]
nums[fast] = i
slow += 1
return nums
'For python, can use\n if num == o:\n nums.remove(num)\n nums.append(num)\n \n Also consider using:\n for slow in xrange(len(nums))\n '
if __name__ == '__main__':
nums = [0, 1, 0, 3, 12]
my_solution = solution().moveZeros1(nums)
print(my_solution)
better_solution = solution().moveZeros2(nums)
print(better_solution)
|
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
def processChildNode(childNode, prev, leftmost):
if childNode:
if prev:
prev.next = childNode
else:
leftmost = childNode
prev = childNode
return prev, leftmost
if root is None:
return root
leftmost = root
while leftmost:
curr, prev = leftmost, None
leftmost = None
while curr:
prev, leftmost = processChildNode(curr.left, prev, leftmost)
prev, leftmost = processChildNode(curr.right, prev, leftmost)
curr = curr.next
return root
|
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
def process_child_node(childNode, prev, leftmost):
if childNode:
if prev:
prev.next = childNode
else:
leftmost = childNode
prev = childNode
return (prev, leftmost)
if root is None:
return root
leftmost = root
while leftmost:
(curr, prev) = (leftmost, None)
leftmost = None
while curr:
(prev, leftmost) = process_child_node(curr.left, prev, leftmost)
(prev, leftmost) = process_child_node(curr.right, prev, leftmost)
curr = curr.next
return root
|
'''
Created on Nov 3, 2018
@author: nilson.nieto
'''
list_numeros =input("Ingrese varios numeros separados por espacio : ").split(" , ")
for i in list_numeros:
print(i)
|
"""
Created on Nov 3, 2018
@author: nilson.nieto
"""
list_numeros = input('Ingrese varios numeros separados por espacio : ').split(' , ')
for i in list_numeros:
print(i)
|
def getVariableType(v):
""" Replacing bools with ints for Python compatibility """
vType = v['Type']
vType = vType.replace('bool', 'int')
vType = vType.replace('std::function<void(korali::Sample&)>', 'std::uint64_t')
return vType
def getCXXVariableName(v):
cVarName = ''
for name in v:
cVarName += name
cVarName = cVarName.replace(" ", "")
cVarName = cVarName.replace("(", "")
cVarName = cVarName.replace(")", "")
cVarName = cVarName.replace("+", "")
cVarName = cVarName.replace("-", "")
cVarName = cVarName.replace("[", "")
cVarName = cVarName.replace("]", "")
cVarName = '_' + cVarName[0].lower() + cVarName[1:]
return cVarName
def getVariablePath(v):
cVarPath = ''
for name in v["Name"]:
cVarPath += '["' + name + '"]'
return cVarPath
def getVariableOptions(v):
options = []
if (v.get('Options', '')):
for item in v["Options"]:
options.append(item["Value"])
return options
|
def get_variable_type(v):
""" Replacing bools with ints for Python compatibility """
v_type = v['Type']
v_type = vType.replace('bool', 'int')
v_type = vType.replace('std::function<void(korali::Sample&)>', 'std::uint64_t')
return vType
def get_cxx_variable_name(v):
c_var_name = ''
for name in v:
c_var_name += name
c_var_name = cVarName.replace(' ', '')
c_var_name = cVarName.replace('(', '')
c_var_name = cVarName.replace(')', '')
c_var_name = cVarName.replace('+', '')
c_var_name = cVarName.replace('-', '')
c_var_name = cVarName.replace('[', '')
c_var_name = cVarName.replace(']', '')
c_var_name = '_' + cVarName[0].lower() + cVarName[1:]
return cVarName
def get_variable_path(v):
c_var_path = ''
for name in v['Name']:
c_var_path += '["' + name + '"]'
return cVarPath
def get_variable_options(v):
options = []
if v.get('Options', ''):
for item in v['Options']:
options.append(item['Value'])
return options
|
def get_fuel(mass):
return int(mass / 3) - 2
def get_fuel_including_fuel(mass):
total = 0
while True:
fuel = get_fuel(mass)
if fuel <= 0:
break
total += fuel
mass = fuel
return total
# Part one
with open('input') as f:
print(sum(
get_fuel(
int(line)) # mass
for line in f))
# Part two
with open('input') as f:
print(sum(
get_fuel_including_fuel(
int(line)) # mass
for line in f))
|
def get_fuel(mass):
return int(mass / 3) - 2
def get_fuel_including_fuel(mass):
total = 0
while True:
fuel = get_fuel(mass)
if fuel <= 0:
break
total += fuel
mass = fuel
return total
with open('input') as f:
print(sum((get_fuel(int(line)) for line in f)))
with open('input') as f:
print(sum((get_fuel_including_fuel(int(line)) for line in f)))
|
class Manager:
def __init__(self):
self.worker = None
def set_worker(self, worker):
assert "Worker" in [el.__name__ for el in worker.__class__.__mro__], "'worker' must be of type Worker"
self.worker = worker
def manage(self):
if self.worker is not None:
self.worker.work()
class Worker:
def work(self):
print("I'm working!!")
class SuperWorker(Worker):
def work(self):
print("I work very hard!!!")
class LazyWorker(Worker):
def work(self):
print("I do not work very hard...")
class Animal:
def feed(self):
return "I am eating!"
worker = Worker()
manager = Manager()
manager.set_worker(worker)
manager.manage()
super_worker = SuperWorker()
lazy_worker = LazyWorker()
animal = Animal()
try:
manager.set_worker(super_worker)
manager.manage()
except AssertionError:
print("manager fails to support super_worker....")
|
class Manager:
def __init__(self):
self.worker = None
def set_worker(self, worker):
assert 'Worker' in [el.__name__ for el in worker.__class__.__mro__], "'worker' must be of type Worker"
self.worker = worker
def manage(self):
if self.worker is not None:
self.worker.work()
class Worker:
def work(self):
print("I'm working!!")
class Superworker(Worker):
def work(self):
print('I work very hard!!!')
class Lazyworker(Worker):
def work(self):
print('I do not work very hard...')
class Animal:
def feed(self):
return 'I am eating!'
worker = worker()
manager = manager()
manager.set_worker(worker)
manager.manage()
super_worker = super_worker()
lazy_worker = lazy_worker()
animal = animal()
try:
manager.set_worker(super_worker)
manager.manage()
except AssertionError:
print('manager fails to support super_worker....')
|
N, K = map(int, input().split())
A = [0]
total = 0
a = list(map(int, input().split()))
ans = 0
m = {0: 1}
for x in a:
total += x
count = m.get(total - K, 0)
ans += count
m[total] = m.get(total, 0) + 1
A.append(total)
print(ans)
|
(n, k) = map(int, input().split())
a = [0]
total = 0
a = list(map(int, input().split()))
ans = 0
m = {0: 1}
for x in a:
total += x
count = m.get(total - K, 0)
ans += count
m[total] = m.get(total, 0) + 1
A.append(total)
print(ans)
|
"""
This module will be having the locators of all the
food listing page which comes after clicks on
start ordering button
"""
class FoodSelectionPageLocators:
""" food selection class """
place_order_dialog_box_button = "//button[text()='Ok! Place Order']"
total_product_items = "//div/div/div[contains(@class, 'ProductItem')]"
for_the_table_list = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'For The Table')]"
crispy_roast_duck = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Crispy roast duck')]"
wet_noodles = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]"
empty_cart = "//label[contains(text(),'EMPTY')]"
add_to_cart_button_list = "//a[contains(@class, 'AddToCart')]"
add_to_cart_sweet_potato_roll= "(//a[contains(@class, 'AddToCart')])[3]"
add_button_for_wet_noodles = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]/child::div/child::a"
wet_noodles_text = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]/child::div/child::div/span"
checkout_order_button = "//button[text()='CHECKOUT' and @href='#']"
mobile_number_text_box = "//input[@id= 'cust_phoneNo']"
proceed_button = "//button[text()= 'PROCEED']"
invalid_mobile_no = "//label[contains(text(),'Enter Valid Mobile Number')]"
your_name_text_box = "//input[@id= 'cust_userName']"
your_email_id_text_box = "//input[@id= 'cust_useremail']"
invalid_email_id = "//label[contains(text(),'Enter Valid Email ID')]"
proceed_button_2 = "(//button[text()= 'PROCEED'])[2]"
category_side_bar = "//a[contains(@sidecat, 'category')]"
|
"""
This module will be having the locators of all the
food listing page which comes after clicks on
start ordering button
"""
class Foodselectionpagelocators:
""" food selection class """
place_order_dialog_box_button = "//button[text()='Ok! Place Order']"
total_product_items = "//div/div/div[contains(@class, 'ProductItem')]"
for_the_table_list = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'For The Table')]"
crispy_roast_duck = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Crispy roast duck')]"
wet_noodles = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]"
empty_cart = "//label[contains(text(),'EMPTY')]"
add_to_cart_button_list = "//a[contains(@class, 'AddToCart')]"
add_to_cart_sweet_potato_roll = "(//a[contains(@class, 'AddToCart')])[3]"
add_button_for_wet_noodles = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]/child::div/child::a"
wet_noodles_text = "//div/div/div[contains(@class, 'ProductItem') and contains(@category, 'Wet Noodles')]/child::div/child::div/span"
checkout_order_button = "//button[text()='CHECKOUT' and @href='#']"
mobile_number_text_box = "//input[@id= 'cust_phoneNo']"
proceed_button = "//button[text()= 'PROCEED']"
invalid_mobile_no = "//label[contains(text(),'Enter Valid Mobile Number')]"
your_name_text_box = "//input[@id= 'cust_userName']"
your_email_id_text_box = "//input[@id= 'cust_useremail']"
invalid_email_id = "//label[contains(text(),'Enter Valid Email ID')]"
proceed_button_2 = "(//button[text()= 'PROCEED'])[2]"
category_side_bar = "//a[contains(@sidecat, 'category')]"
|
class Solution:
def findMaxAverage(self, nums: List[int], k: int) -> float:
# sliding window, O(N) time, O(1) space
globMax = tempMax = sum(nums[:k])
for i in range(k, len(nums)):
tempMax += (nums[i] - nums[i-k])
globMax = max(tempMax, globMax)
return globMax / k
|
class Solution:
def find_max_average(self, nums: List[int], k: int) -> float:
glob_max = temp_max = sum(nums[:k])
for i in range(k, len(nums)):
temp_max += nums[i] - nums[i - k]
glob_max = max(tempMax, globMax)
return globMax / k
|
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class ChangeEnum(object):
"""Implementation of the 'Change' enum.
TODO: type enum description here.
Attributes:
KPROTECTIONJOBNAME: TODO: type description here.
KPROTECTIONJOBDESCRIPTION: TODO: type description here.
KPROTECTIONJOBSOURCES: TODO: type description here.
KPROTECTIONJOBSCHEDULE: TODO: type description here.
KPROTECTIONJOBFULLSCHEDULE: TODO: type description here.
KPROTECTIONJOBRETRYSETTINGS: TODO: type description here.
KPROTECTIONJOBRETENTIONPOLICY: TODO: type description here.
KPROTECTIONJOBINDEXINGPOLICY: TODO: type description here.
KPROTECTIONJOBALERTINGPOLICY: TODO: type description here.
KPROTECTIONJOBPRIORITY: TODO: type description here.
KPROTECTIONJOBQUIESCE: TODO: type description here.
KPROTECTIONJOBSLA: TODO: type description here.
KPROTECTIONJOBPOLICYID: TODO: type description here.
KPROTECTIONJOBTIMEZONE: TODO: type description here.
KPROTECTIONJOBFUTURERUNSPAUSED: TODO: type description here.
KPROTECTIONJOBFUTURERUNSRESUMED: TODO: type description here.
KSNAPSHOTTARGETPOLICY: TODO: type description here.
KPROTECTIONJOBBLACKOUTWINDOW: TODO: type description here.
KPROTECTIONJOBQOS: TODO: type description here.
KPROTECTIONJOBINVALIDFIELD: TODO: type description here.
"""
KPROTECTIONJOBNAME = 'kProtectionJobName'
KPROTECTIONJOBDESCRIPTION = 'kProtectionJobDescription'
KPROTECTIONJOBSOURCES = 'kProtectionJobSources'
KPROTECTIONJOBSCHEDULE = 'kProtectionJobSchedule'
KPROTECTIONJOBFULLSCHEDULE = 'kProtectionJobFullSchedule'
KPROTECTIONJOBRETRYSETTINGS = 'kProtectionJobRetrySettings'
KPROTECTIONJOBRETENTIONPOLICY = 'kProtectionJobRetentionPolicy'
KPROTECTIONJOBINDEXINGPOLICY = 'kProtectionJobIndexingPolicy'
KPROTECTIONJOBALERTINGPOLICY = 'kProtectionJobAlertingPolicy'
KPROTECTIONJOBPRIORITY = 'kProtectionJobPriority'
KPROTECTIONJOBQUIESCE = 'kProtectionJobQuiesce'
KPROTECTIONJOBSLA = 'kProtectionJobSla'
KPROTECTIONJOBPOLICYID = 'kProtectionJobPolicyId'
KPROTECTIONJOBTIMEZONE = 'kProtectionJobTimezone'
KPROTECTIONJOBFUTURERUNSPAUSED = 'kProtectionJobFutureRunsPaused'
KPROTECTIONJOBFUTURERUNSRESUMED = 'kProtectionJobFutureRunsResumed'
KSNAPSHOTTARGETPOLICY = 'kSnapshotTargetPolicy'
KPROTECTIONJOBBLACKOUTWINDOW = 'kProtectionJobBlackoutWindow'
KPROTECTIONJOBQOS = 'kProtectionJobQOS'
KPROTECTIONJOBINVALIDFIELD = 'kProtectionJobInvalidField'
|
class Changeenum(object):
"""Implementation of the 'Change' enum.
TODO: type enum description here.
Attributes:
KPROTECTIONJOBNAME: TODO: type description here.
KPROTECTIONJOBDESCRIPTION: TODO: type description here.
KPROTECTIONJOBSOURCES: TODO: type description here.
KPROTECTIONJOBSCHEDULE: TODO: type description here.
KPROTECTIONJOBFULLSCHEDULE: TODO: type description here.
KPROTECTIONJOBRETRYSETTINGS: TODO: type description here.
KPROTECTIONJOBRETENTIONPOLICY: TODO: type description here.
KPROTECTIONJOBINDEXINGPOLICY: TODO: type description here.
KPROTECTIONJOBALERTINGPOLICY: TODO: type description here.
KPROTECTIONJOBPRIORITY: TODO: type description here.
KPROTECTIONJOBQUIESCE: TODO: type description here.
KPROTECTIONJOBSLA: TODO: type description here.
KPROTECTIONJOBPOLICYID: TODO: type description here.
KPROTECTIONJOBTIMEZONE: TODO: type description here.
KPROTECTIONJOBFUTURERUNSPAUSED: TODO: type description here.
KPROTECTIONJOBFUTURERUNSRESUMED: TODO: type description here.
KSNAPSHOTTARGETPOLICY: TODO: type description here.
KPROTECTIONJOBBLACKOUTWINDOW: TODO: type description here.
KPROTECTIONJOBQOS: TODO: type description here.
KPROTECTIONJOBINVALIDFIELD: TODO: type description here.
"""
kprotectionjobname = 'kProtectionJobName'
kprotectionjobdescription = 'kProtectionJobDescription'
kprotectionjobsources = 'kProtectionJobSources'
kprotectionjobschedule = 'kProtectionJobSchedule'
kprotectionjobfullschedule = 'kProtectionJobFullSchedule'
kprotectionjobretrysettings = 'kProtectionJobRetrySettings'
kprotectionjobretentionpolicy = 'kProtectionJobRetentionPolicy'
kprotectionjobindexingpolicy = 'kProtectionJobIndexingPolicy'
kprotectionjobalertingpolicy = 'kProtectionJobAlertingPolicy'
kprotectionjobpriority = 'kProtectionJobPriority'
kprotectionjobquiesce = 'kProtectionJobQuiesce'
kprotectionjobsla = 'kProtectionJobSla'
kprotectionjobpolicyid = 'kProtectionJobPolicyId'
kprotectionjobtimezone = 'kProtectionJobTimezone'
kprotectionjobfuturerunspaused = 'kProtectionJobFutureRunsPaused'
kprotectionjobfuturerunsresumed = 'kProtectionJobFutureRunsResumed'
ksnapshottargetpolicy = 'kSnapshotTargetPolicy'
kprotectionjobblackoutwindow = 'kProtectionJobBlackoutWindow'
kprotectionjobqos = 'kProtectionJobQOS'
kprotectionjobinvalidfield = 'kProtectionJobInvalidField'
|
#Task 4: Login functionality
# In its parameter list, define three parameters: database, username, and password.
def login(database, username, password):
if username in dict.keys(database) and database[username] == password:
print("Welcome back: ", username)
elif username in dict.keys(database) or password in dict.values(database):
print("Check your credentials again!")
else:
print("Something went wrong")
def register(database, username):
if username in dict.values(database):
print("Username already registered")
else:
print("Username successfully registered: ", username)
def donate(username):
donation_amount = float(input("Enter an amount to donate: "))
donation = f'{username} donated ${donation_amount}'
return donation
def show_donations(donations):
print("\n--- All Donations ---")
if not donations:
print("There are currently no donations")
else:
for d in donations:
print(d)
|
def login(database, username, password):
if username in dict.keys(database) and database[username] == password:
print('Welcome back: ', username)
elif username in dict.keys(database) or password in dict.values(database):
print('Check your credentials again!')
else:
print('Something went wrong')
def register(database, username):
if username in dict.values(database):
print('Username already registered')
else:
print('Username successfully registered: ', username)
def donate(username):
donation_amount = float(input('Enter an amount to donate: '))
donation = f'{username} donated ${donation_amount}'
return donation
def show_donations(donations):
print('\n--- All Donations ---')
if not donations:
print('There are currently no donations')
else:
for d in donations:
print(d)
|
H, W = map(int, input().split())
N = 0
a_map = []
for i in range(H):
a = list(map(int, input().split()))
a_map.append(a)
result = []
for i in range(H):
for j in range(W):
if a_map[i][j]%2==1:
if j < W - 1:
N += 1
result.append([i + 1, j + 1, i + 1, j + 2])
a_map[i][j + 1] += 1;
a_map[i][j] -= 1;
elif i < H - 1:
N += 1;
result.append([i + 1, j + 1, i + 2, j + 1])
a_map[i][j] -= 1;
a_map[i + 1][j] += 1;
print(N)
for a in result:
print(a[0], a[1], a[2], a[3])
|
(h, w) = map(int, input().split())
n = 0
a_map = []
for i in range(H):
a = list(map(int, input().split()))
a_map.append(a)
result = []
for i in range(H):
for j in range(W):
if a_map[i][j] % 2 == 1:
if j < W - 1:
n += 1
result.append([i + 1, j + 1, i + 1, j + 2])
a_map[i][j + 1] += 1
a_map[i][j] -= 1
elif i < H - 1:
n += 1
result.append([i + 1, j + 1, i + 2, j + 1])
a_map[i][j] -= 1
a_map[i + 1][j] += 1
print(N)
for a in result:
print(a[0], a[1], a[2], a[3])
|
class Stairs:
def designs(self, maxHeight, minWidth, totalHeight, totalWidth):
c = 0
for r in xrange(1, maxHeight + 1):
if totalHeight % r == 0:
n = totalHeight / r
if (
n > 1
and totalWidth % (n - 1) == 0
and totalWidth / (n - 1) >= minWidth
):
c += 1
return c
|
class Stairs:
def designs(self, maxHeight, minWidth, totalHeight, totalWidth):
c = 0
for r in xrange(1, maxHeight + 1):
if totalHeight % r == 0:
n = totalHeight / r
if n > 1 and totalWidth % (n - 1) == 0 and (totalWidth / (n - 1) >= minWidth):
c += 1
return c
|
# Solve the Equation
class Solution(object):
def solveEquation(self, equation):
"""
:type equation: str
:rtype: str
"""
left, right = equation.split('=')
a1, b1 = self.get_coefficients(left)
a2, b2 = self.get_coefficients(right)
a, b = a1 - a2, b2 - b1 # ax = b
if a == 0:
if b == 0:
return "Infinite solutions"
else:
return "No solution"
else:
return "x={}".format(b / a)
def get_coefficients(self, s):
a = b = 0
sign = 1
i = j = 0
while i < len(s):
if s[i] == '+':
sign = 1
i += 1
elif s[i] == '-':
sign = -1
i += 1
else:
j = i
while j < len(s) and s[j] not in '+-':
j += 1
token = s[i:j]
if token == 'x':
a += sign
elif token[-1] == 'x':
a += sign * int(token[:-1])
else:
b += sign * int(token)
i = j
return a, b
|
class Solution(object):
def solve_equation(self, equation):
"""
:type equation: str
:rtype: str
"""
(left, right) = equation.split('=')
(a1, b1) = self.get_coefficients(left)
(a2, b2) = self.get_coefficients(right)
(a, b) = (a1 - a2, b2 - b1)
if a == 0:
if b == 0:
return 'Infinite solutions'
else:
return 'No solution'
else:
return 'x={}'.format(b / a)
def get_coefficients(self, s):
a = b = 0
sign = 1
i = j = 0
while i < len(s):
if s[i] == '+':
sign = 1
i += 1
elif s[i] == '-':
sign = -1
i += 1
else:
j = i
while j < len(s) and s[j] not in '+-':
j += 1
token = s[i:j]
if token == 'x':
a += sign
elif token[-1] == 'x':
a += sign * int(token[:-1])
else:
b += sign * int(token)
i = j
return (a, b)
|
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the German Aerospace Center nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
#OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
#THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Contains wrapper class around the property representation used in the core package.
"""
__version__ = "$Revision-Id:$"
class PropertyDescription(object):
"""
Wrapper around the internal property representation giving restricted access to
the relevant parameters.
All instance variables are read-only.
@ivar identifier: This is the logical identifier of the property.
@type identifier: C{unicode}
@ivar category: This holds the category of the property, i.e. if the property is
system, data model or user specific.
System specific: property can NOT be deleted from resource, values are read-only
Data model specific: property can NOT be deleted from resource, values changeable
User specific: property can be deleted from resource, values changeable
@type category: C{unicode}, for possible values see:
L{constants<datafinder.script_api.properties.constants>}
@ivar displayName: A readable name that can be presented in a user interface.
@type displayName: C{unicode}
@ivar description: Describes the purpose of the property.
@type description: C{unicode}
@ivar notNull: Flag indicating if C{None} is a allowed property value or not.
@type notNull: C{bool}
@ivar defaultValue: A default value for the property that is used for creation of the property on a resource.
@type defaultValue: The type of the default value depends on the property definition.
@ivar restrictions: This parameter holds the defined property restrictions that are
represented by parameters. The returned mapping can contain the following keys:
minimumValue: Defining the lower boundary of a value range.
maximumValue: Defining the upper boundary of a value range.
minimumLength: Defining the lower boundary of a length range.
maximumLength: Defining the upper boundary of a length range.
minimumNumberOfDecimalPlaces: Defining the minimum number of decimal places.
maximumNumberOfDecimalPlaces: Defining the maximum number of decimal places.
pattern: Regular expression pattern that restricts a string value.
options: A list of options the value can be chosen from.
optionsMandatory: Boolean indicating whether the value MUST be from the list of options.
subTypes: List of strings identifying supported types.
The possible restrictions depend on the type.
@type restrictions: C{dict}
@ivar namespace: Name space in which the property is valid, e.g. used to distinguish
different C{name} properties of different data types.
@type namespace: C{unicode}
"""
def __init__(self, propertyDefinition):
"""
Constructor.
@param propertyRepresentation: The property definition.
@type propertyRepresentation: L{PropertyTemplate<datafinder.application.metadata.property_types.PropertyBase>}
"""
self.__propertyDefinition = propertyDefinition
def __getIdentifier(self):
"""
Returns the identifier of the property.
"""
return self.__propertyDefinition.identifier
identifier = property(__getIdentifier)
def __getType(self):
""" Returns the propertyType. """
return self.__propertyDefinition.type
type = property(__getType)
def __getDisplayName(self):
"""
Returns the display name of the property.
"""
return self.__propertyDefinition.displayName
displayName = property(__getDisplayName)
def __getCategory(self):
"""
Returns the property category.
"""
return self.__propertyDefinition.category
category = property(__getCategory)
def __getDescription(self):
"""
Returns the property description.
"""
return self.__propertyDefinition.description
description = property(__getDescription)
def __getDefaultValue(self):
"""
Returns the specific default value.
"""
return self.__propertyDefinition.defaultValue
defaultValue = property(__getDefaultValue)
def __getNotNull(self):
"""
Returns whether the value can be C{None} or not.
"""
return self.__propertyDefinition.notNull
notNull = property(__getNotNull)
def __getNamespace(self):
"""
Returns the namespace.
"""
return self.__propertyDefinition.namespace
namespace = property(__getNamespace)
def __getRestrictions(self):
"""
Returns the defined restrictions of the property.
"""
return self.__propertyDefinition.restrictions
restrictions = property(__getRestrictions)
def __repr__(self):
""" Returns a readable representation. """
return self.identifier + " Type: " + self.type \
+ " Category: " + self.category
|
"""
Contains wrapper class around the property representation used in the core package.
"""
__version__ = '$Revision-Id:$'
class Propertydescription(object):
"""
Wrapper around the internal property representation giving restricted access to
the relevant parameters.
All instance variables are read-only.
@ivar identifier: This is the logical identifier of the property.
@type identifier: C{unicode}
@ivar category: This holds the category of the property, i.e. if the property is
system, data model or user specific.
System specific: property can NOT be deleted from resource, values are read-only
Data model specific: property can NOT be deleted from resource, values changeable
User specific: property can be deleted from resource, values changeable
@type category: C{unicode}, for possible values see:
L{constants<datafinder.script_api.properties.constants>}
@ivar displayName: A readable name that can be presented in a user interface.
@type displayName: C{unicode}
@ivar description: Describes the purpose of the property.
@type description: C{unicode}
@ivar notNull: Flag indicating if C{None} is a allowed property value or not.
@type notNull: C{bool}
@ivar defaultValue: A default value for the property that is used for creation of the property on a resource.
@type defaultValue: The type of the default value depends on the property definition.
@ivar restrictions: This parameter holds the defined property restrictions that are
represented by parameters. The returned mapping can contain the following keys:
minimumValue: Defining the lower boundary of a value range.
maximumValue: Defining the upper boundary of a value range.
minimumLength: Defining the lower boundary of a length range.
maximumLength: Defining the upper boundary of a length range.
minimumNumberOfDecimalPlaces: Defining the minimum number of decimal places.
maximumNumberOfDecimalPlaces: Defining the maximum number of decimal places.
pattern: Regular expression pattern that restricts a string value.
options: A list of options the value can be chosen from.
optionsMandatory: Boolean indicating whether the value MUST be from the list of options.
subTypes: List of strings identifying supported types.
The possible restrictions depend on the type.
@type restrictions: C{dict}
@ivar namespace: Name space in which the property is valid, e.g. used to distinguish
different C{name} properties of different data types.
@type namespace: C{unicode}
"""
def __init__(self, propertyDefinition):
"""
Constructor.
@param propertyRepresentation: The property definition.
@type propertyRepresentation: L{PropertyTemplate<datafinder.application.metadata.property_types.PropertyBase>}
"""
self.__propertyDefinition = propertyDefinition
def __get_identifier(self):
"""
Returns the identifier of the property.
"""
return self.__propertyDefinition.identifier
identifier = property(__getIdentifier)
def __get_type(self):
""" Returns the propertyType. """
return self.__propertyDefinition.type
type = property(__getType)
def __get_display_name(self):
"""
Returns the display name of the property.
"""
return self.__propertyDefinition.displayName
display_name = property(__getDisplayName)
def __get_category(self):
"""
Returns the property category.
"""
return self.__propertyDefinition.category
category = property(__getCategory)
def __get_description(self):
"""
Returns the property description.
"""
return self.__propertyDefinition.description
description = property(__getDescription)
def __get_default_value(self):
"""
Returns the specific default value.
"""
return self.__propertyDefinition.defaultValue
default_value = property(__getDefaultValue)
def __get_not_null(self):
"""
Returns whether the value can be C{None} or not.
"""
return self.__propertyDefinition.notNull
not_null = property(__getNotNull)
def __get_namespace(self):
"""
Returns the namespace.
"""
return self.__propertyDefinition.namespace
namespace = property(__getNamespace)
def __get_restrictions(self):
"""
Returns the defined restrictions of the property.
"""
return self.__propertyDefinition.restrictions
restrictions = property(__getRestrictions)
def __repr__(self):
""" Returns a readable representation. """
return self.identifier + ' Type: ' + self.type + ' Category: ' + self.category
|
length = int(raw_input())
s = raw_input()
n = length / 4
A = T = G = C = 0
for i in s:
if i == 'A':
A += 1
elif i == 'T':
T += 1
elif i == 'G':
G += 1
else:
C += 1
res = 0
if A != n or C != n or G != n or T != n:
res = length
l = 0
for r in xrange(length):
if s[r] == 'A':
A -= 1
if s[r] == 'T':
T -= 1
if s[r] == 'G':
G -= 1
if s[r] == 'C':
C -= 1
while A <= n and C <= n and G <= n and T <= n and l <= r:
res = min(res, r - l + 1)
if s[l] == 'A':
A += 1
if s[l] == 'T':
T += 1
if s[l] == 'G':
G += 1
if s[l] == 'C':
C += 1
l += 1
print(res)
|
length = int(raw_input())
s = raw_input()
n = length / 4
a = t = g = c = 0
for i in s:
if i == 'A':
a += 1
elif i == 'T':
t += 1
elif i == 'G':
g += 1
else:
c += 1
res = 0
if A != n or C != n or G != n or (T != n):
res = length
l = 0
for r in xrange(length):
if s[r] == 'A':
a -= 1
if s[r] == 'T':
t -= 1
if s[r] == 'G':
g -= 1
if s[r] == 'C':
c -= 1
while A <= n and C <= n and (G <= n) and (T <= n) and (l <= r):
res = min(res, r - l + 1)
if s[l] == 'A':
a += 1
if s[l] == 'T':
t += 1
if s[l] == 'G':
g += 1
if s[l] == 'C':
c += 1
l += 1
print(res)
|
class JellyBean:
def __init__( self, mass = 0 ):
self.mass = mass
def __add__( self, other ):
other_mass = other.mass
other.mass = 0
return JellyBean( self.mass + other_mass )
def __sub__( self, other ):
self_mass = self.mass
self.mass -= other.mass
def __str__( self ):
return f"Mass: { self.mass }"
def __repr__( self ):
return f"{ self.__dict__ }"
jelly = JellyBean( 3 )
bean = JellyBean( 2 )
jelly += bean
print( jelly )
print( bean )
|
class Jellybean:
def __init__(self, mass=0):
self.mass = mass
def __add__(self, other):
other_mass = other.mass
other.mass = 0
return jelly_bean(self.mass + other_mass)
def __sub__(self, other):
self_mass = self.mass
self.mass -= other.mass
def __str__(self):
return f'Mass: {self.mass}'
def __repr__(self):
return f'{self.__dict__}'
jelly = jelly_bean(3)
bean = jelly_bean(2)
jelly += bean
print(jelly)
print(bean)
|
class PlayerAlreadyHasItemError(Exception):
pass
class PlayerNotInitializedError(Exception):
pass
|
class Playeralreadyhasitemerror(Exception):
pass
class Playernotinitializederror(Exception):
pass
|
# Preferences defaults
PREFERENCES_PATH = "./config/preferences.json"
PREFERENCES_DEFAULTS = {
'on_time': 1200,
'off_time': 300
}
# Bot configureation
DISCORD_TOKEN = "from https://discord.com/developers"
ADMIN_ID = 420
USER_ID = 999
DEV_MODE = True
PREFIX = '!!'
PREFIXES = ('johnsmith ', 'john smith ')
COGS_LIST = ['cogs.misc', 'cogs.testing', 'cogs.admin']
|
preferences_path = './config/preferences.json'
preferences_defaults = {'on_time': 1200, 'off_time': 300}
discord_token = 'from https://discord.com/developers'
admin_id = 420
user_id = 999
dev_mode = True
prefix = '!!'
prefixes = ('johnsmith ', 'john smith ')
cogs_list = ['cogs.misc', 'cogs.testing', 'cogs.admin']
|
# has_good_credit = True
# has_criminal_record = True
#
# if has_good_credit and not has_criminal_record:
# print("Eligible for loan")
# temperature = 35
#
# if temperature > 30:
# print("It's a hot day")
# else:
# print("It's not a hot day")
name = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
if len(name) < 3:
print("Name must be at least 3 characters long")
elif len(name) > 50:
print("Name cannot be more than 50 characters long")
else:
print("Name looks good!")
|
name = 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
if len(name) < 3:
print('Name must be at least 3 characters long')
elif len(name) > 50:
print('Name cannot be more than 50 characters long')
else:
print('Name looks good!')
|
x = ''
while True:
x = input()
print(x)
if x == 'end':
break
print('end')
|
x = ''
while True:
x = input()
print(x)
if x == 'end':
break
print('end')
|
# -*- coding: utf-8 -*-
def main():
s = sorted([input() for _ in range(15)])
print(s[6])
if __name__ == '__main__':
main()
|
def main():
s = sorted([input() for _ in range(15)])
print(s[6])
if __name__ == '__main__':
main()
|
class Calculadora(object):
"""docstring for Calculadora"""
memoria = 10
def suma(a, b):
return a + b
def resta(a, b):
return a - b
def multiplicacion(a, b):
return a * b
def division(a, b):
return a / b
@classmethod
def numerosPrimos(cls, limite):
rango = range(2, limite)
return [primo for primo in rango if sum(primo % num == 0 for num in rango) < 2][:cls.memoria]
calc = Calculadora
print(calc.numerosPrimos(100))
|
class Calculadora(object):
"""docstring for Calculadora"""
memoria = 10
def suma(a, b):
return a + b
def resta(a, b):
return a - b
def multiplicacion(a, b):
return a * b
def division(a, b):
return a / b
@classmethod
def numeros_primos(cls, limite):
rango = range(2, limite)
return [primo for primo in rango if sum((primo % num == 0 for num in rango)) < 2][:cls.memoria]
calc = Calculadora
print(calc.numerosPrimos(100))
|
# Perulangan pada set dan dictionary
print('\n==========Perulangan Pada Set==========')
set_integer = {10, 20, 30, 40, 50}
# Cara pertama
for item in set_integer:
print(item, end=' ')
print('')
# Cara kedua
for i in range(len(set_integer)):
print(list(set_integer)[i], end=' ')
print('')
# Cara ketiga
i = 0
while i < len(set_integer):
print(list(set_integer)[i], end=' ')
i = i + 1
print('\n\n==========Perulangan Pada Dictionary==========')
# Menambah item
dictionary_kosong = {}
list_string = ['aku', 'sedang', 'belajar', 'python']
for i in range(len(list_string)):
dictionary_kosong[i] = list_string[i]
# dictionary_kosong.update({i:list_string[i]})
print(dictionary_kosong)
# Menampilkan item
dictionary_hari = {1:'Senin',
2:'Selasa',
3:'Rabu',
4:'Kamis',
5:'Jumat',
6:'Sabtu',
7:'Minggu'}
# Cara pertama
for key in dictionary_hari.keys():
print(key, end=' ' )
print('')
for value in dictionary_hari.values():
print(value, end=' ')
print('')
# Cara kedua
for key, value in dictionary_hari.items():
print(key, value, end=' ')
print('')
# Cara ketiga
i = 0
while i < len(dictionary_hari):
key = list(dictionary_hari.keys())
print(key[i], dictionary_hari[key[i]], end=' ')
i = i + 1
|
print('\n==========Perulangan Pada Set==========')
set_integer = {10, 20, 30, 40, 50}
for item in set_integer:
print(item, end=' ')
print('')
for i in range(len(set_integer)):
print(list(set_integer)[i], end=' ')
print('')
i = 0
while i < len(set_integer):
print(list(set_integer)[i], end=' ')
i = i + 1
print('\n\n==========Perulangan Pada Dictionary==========')
dictionary_kosong = {}
list_string = ['aku', 'sedang', 'belajar', 'python']
for i in range(len(list_string)):
dictionary_kosong[i] = list_string[i]
print(dictionary_kosong)
dictionary_hari = {1: 'Senin', 2: 'Selasa', 3: 'Rabu', 4: 'Kamis', 5: 'Jumat', 6: 'Sabtu', 7: 'Minggu'}
for key in dictionary_hari.keys():
print(key, end=' ')
print('')
for value in dictionary_hari.values():
print(value, end=' ')
print('')
for (key, value) in dictionary_hari.items():
print(key, value, end=' ')
print('')
i = 0
while i < len(dictionary_hari):
key = list(dictionary_hari.keys())
print(key[i], dictionary_hari[key[i]], end=' ')
i = i + 1
|
def word_time(word, elapsed_time):
return [word, elapsed_time]
p0 = [word_time('START', 0), word_time('What', 0.2), word_time('great', 0.4), word_time('luck', 0.8)]
p1 = [word_time('START', 0), word_time('What', 0.6), word_time('great', 0.8), word_time('luck', 1.19)]
p0
p1
|
def word_time(word, elapsed_time):
return [word, elapsed_time]
p0 = [word_time('START', 0), word_time('What', 0.2), word_time('great', 0.4), word_time('luck', 0.8)]
p1 = [word_time('START', 0), word_time('What', 0.6), word_time('great', 0.8), word_time('luck', 1.19)]
p0
p1
|
# Definition for singly-linked list.
# class LinkedListNode:
# def __init__(self, value = 0, next = None):
# self.value = value
# self.next = next
class Solution:
def containsCycle(self, head):
if not head or not head.next:
return False
current = head
s = set()
while current:
if id(current) in s:
return True
s.add(id(current))
current = current.next
return False
|
class Solution:
def contains_cycle(self, head):
if not head or not head.next:
return False
current = head
s = set()
while current:
if id(current) in s:
return True
s.add(id(current))
current = current.next
return False
|
def inf():
while True:
yield
for _ in inf():
input('>')
|
def inf():
while True:
yield
for _ in inf():
input('>')
|
def grep(pattern):
print("Searching for", pattern)
while True:
line = (yield)
if pattern in line:
print(line)
search = grep('coroutine')
next(search)
search.send("I love you")
search.send("Don't you love me")
search.send("I love coroutines")
|
def grep(pattern):
print('Searching for', pattern)
while True:
line = (yield)
if pattern in line:
print(line)
search = grep('coroutine')
next(search)
search.send('I love you')
search.send("Don't you love me")
search.send('I love coroutines')
|
def conf():
return {
"id":"discord",
"description":"this is the discord c360 component",
"enabled":False,
}
|
def conf():
return {'id': 'discord', 'description': 'this is the discord c360 component', 'enabled': False}
|
"""Custom errors and exceptions."""
class MusicAssistantError(Exception):
"""Custom Exception for all errors."""
class ProviderUnavailableError(MusicAssistantError):
"""Error raised when trying to access mediaitem of unavailable provider."""
class MediaNotFoundError(MusicAssistantError):
"""Error raised when trying to access non existing media item."""
class InvalidDataError(MusicAssistantError):
"""Error raised when an object has invalid data."""
class AlreadyRegisteredError(MusicAssistantError):
"""Error raised when a duplicate music provider or player is registered."""
class SetupFailedError(MusicAssistantError):
"""Error raised when setup of a provider or player failed."""
class LoginFailed(MusicAssistantError):
"""Error raised when a login failed."""
class AudioError(MusicAssistantError):
"""Error raised when an issue arrised when processing audio."""
class QueueEmpty(MusicAssistantError):
"""Error raised when trying to start queue stream while queue is empty."""
|
"""Custom errors and exceptions."""
class Musicassistanterror(Exception):
"""Custom Exception for all errors."""
class Providerunavailableerror(MusicAssistantError):
"""Error raised when trying to access mediaitem of unavailable provider."""
class Medianotfounderror(MusicAssistantError):
"""Error raised when trying to access non existing media item."""
class Invaliddataerror(MusicAssistantError):
"""Error raised when an object has invalid data."""
class Alreadyregisterederror(MusicAssistantError):
"""Error raised when a duplicate music provider or player is registered."""
class Setupfailederror(MusicAssistantError):
"""Error raised when setup of a provider or player failed."""
class Loginfailed(MusicAssistantError):
"""Error raised when a login failed."""
class Audioerror(MusicAssistantError):
"""Error raised when an issue arrised when processing audio."""
class Queueempty(MusicAssistantError):
"""Error raised when trying to start queue stream while queue is empty."""
|
S = input()
l = len(S)
nhug = 0
for i in range(l//2):
if S[i] != S[l-1-i]:
nhug += 1
print(nhug)
|
s = input()
l = len(S)
nhug = 0
for i in range(l // 2):
if S[i] != S[l - 1 - i]:
nhug += 1
print(nhug)
|
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print("Hi there! I'm {}, {} years old!".format(self.name, self.age))
maria = Person("Maria Popova", 25)
pesho = Person("Pesho", 27)
print(maria)
# name = Maria Popova
# age = 25
|
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print("Hi there! I'm {}, {} years old!".format(self.name, self.age))
maria = person('Maria Popova', 25)
pesho = person('Pesho', 27)
print(maria)
|
class Solution:
def maxNumber(self, nums1, nums2, k):
def merge(arr1, arr2):
res, i, j = [], 0, 0
while i < len(arr1) and j < len(arr2):
if arr1[i:] >= arr2[j:]:
res.append(arr1[i])
i += 1
else:
res.append(arr2[j])
j += 1
if i < len(arr1): res += arr1[i:]
elif j < len(arr2): res += arr2[j:]
return res
def makeArr(arr, l):
i, res = 0, []
for r in range(l - 1, -1, -1):
num, i = max(arr[i:-r] or arr[i:])
i = -i + 1
res.append(num)
return res
nums1, nums2, choices = [(num, -i) for i, num in enumerate(nums1)], [(num, -i) for i, num in enumerate(nums2)], []
for m in range(k + 1):
if m > len(nums1) or k - m > len(nums2): continue
arr1, arr2 = makeArr(nums1, m), makeArr(nums2, k - m)
choices.append(merge(arr1, arr2))
return max(choices)
|
class Solution:
def max_number(self, nums1, nums2, k):
def merge(arr1, arr2):
(res, i, j) = ([], 0, 0)
while i < len(arr1) and j < len(arr2):
if arr1[i:] >= arr2[j:]:
res.append(arr1[i])
i += 1
else:
res.append(arr2[j])
j += 1
if i < len(arr1):
res += arr1[i:]
elif j < len(arr2):
res += arr2[j:]
return res
def make_arr(arr, l):
(i, res) = (0, [])
for r in range(l - 1, -1, -1):
(num, i) = max(arr[i:-r] or arr[i:])
i = -i + 1
res.append(num)
return res
(nums1, nums2, choices) = ([(num, -i) for (i, num) in enumerate(nums1)], [(num, -i) for (i, num) in enumerate(nums2)], [])
for m in range(k + 1):
if m > len(nums1) or k - m > len(nums2):
continue
(arr1, arr2) = (make_arr(nums1, m), make_arr(nums2, k - m))
choices.append(merge(arr1, arr2))
return max(choices)
|
def sudoku2(grid):
seen = set()
# Iterate through grid
for i in range(len(grid)):
for j in range(len(grid[i])):
current_value = grid[i][j]
if current_value != ".":
if (
(current_value + " found in row " + str(i)) in seen
or (current_value + " found in column " + str(j)) in seen
or (
current_value
+ " found in subgrid "
+ str(i // 3)
+ "-"
+ str(j // 3)
)
in seen
):
return False
seen.add(current_value + " found in row " + str(i))
seen.add(current_value + " found in column " + str(j))
seen.add(
current_value
+ " found in subgrid "
+ str(i // 3)
+ "-"
+ str(j // 3)
)
return True
|
def sudoku2(grid):
seen = set()
for i in range(len(grid)):
for j in range(len(grid[i])):
current_value = grid[i][j]
if current_value != '.':
if current_value + ' found in row ' + str(i) in seen or current_value + ' found in column ' + str(j) in seen or current_value + ' found in subgrid ' + str(i // 3) + '-' + str(j // 3) in seen:
return False
seen.add(current_value + ' found in row ' + str(i))
seen.add(current_value + ' found in column ' + str(j))
seen.add(current_value + ' found in subgrid ' + str(i // 3) + '-' + str(j // 3))
return True
|
"""Constants for the tankerkoenig integration."""
DOMAIN = "tankerkoenig"
NAME = "tankerkoenig"
CONF_FUEL_TYPES = "fuel_types"
CONF_STATIONS = "stations"
FUEL_TYPES = ["e5", "e10", "diesel"]
|
"""Constants for the tankerkoenig integration."""
domain = 'tankerkoenig'
name = 'tankerkoenig'
conf_fuel_types = 'fuel_types'
conf_stations = 'stations'
fuel_types = ['e5', 'e10', 'diesel']
|
FEATURES = 'FEATURES'
AUTH_GITHUB = 'AUTH_GITHUB'
AUTH_GITLAB = 'AUTH_GITLAB'
AUTH_BITBUCKET = 'AUTH_BITBUCKET'
AUTH_AZURE = 'AUTH_AZURE'
AFFINITIES = 'AFFINITIES'
ARCHIVES_ROOT = 'ARCHIVES_ROOT'
DOWNLOADS_ROOT = 'DOWNLOADS_ROOT'
ADMIN = 'ADMIN'
NODE_SELECTORS = 'NODE_SELECTORS'
TOLERATIONS = 'TOLERATIONS'
ANNOTATIONS = 'ANNOTATIONS'
K8S_SECRETS = 'K8S_SECRETS'
K8S_CONFIG_MAPS = 'K8S_CONFIG_MAPS'
K8S_RESOURCES = 'K8S_RESOURCES'
ENV_VARS = 'ENV_VARS'
NOTEBOOKS = 'NOTEBOOKS'
TENSORBOARDS = 'TENSORBOARDS'
GROUPS = 'GROUPS'
BUILD_JOBS = 'BUILD_JOBS'
KANIKO = 'KANIKO'
SCHEDULER = 'SCHEDULER'
STATS = 'STATS'
EMAIL = 'EMAIL'
CONTAINER_NAME = 'CONTAINER_NAME'
MAX_RESTARTS = 'MAX_RESTARTS'
INTEGRATIONS_WEBHOOKS = 'INTEGRATIONS_WEBHOOKS'
TTL = 'TTL'
REPOS = 'REPOS'
SIDECARS = 'SIDECARS'
INIT = 'INIT'
K8S = 'K8S'
CLEANING_INTERVALS = 'CLEANING_INTERVALS'
POLYFLOW = 'POLYFLOW'
SERVICE_ACCOUNTS = 'SERVICE_ACCOUNTS'
ACCESS = 'ACCESS'
|
features = 'FEATURES'
auth_github = 'AUTH_GITHUB'
auth_gitlab = 'AUTH_GITLAB'
auth_bitbucket = 'AUTH_BITBUCKET'
auth_azure = 'AUTH_AZURE'
affinities = 'AFFINITIES'
archives_root = 'ARCHIVES_ROOT'
downloads_root = 'DOWNLOADS_ROOT'
admin = 'ADMIN'
node_selectors = 'NODE_SELECTORS'
tolerations = 'TOLERATIONS'
annotations = 'ANNOTATIONS'
k8_s_secrets = 'K8S_SECRETS'
k8_s_config_maps = 'K8S_CONFIG_MAPS'
k8_s_resources = 'K8S_RESOURCES'
env_vars = 'ENV_VARS'
notebooks = 'NOTEBOOKS'
tensorboards = 'TENSORBOARDS'
groups = 'GROUPS'
build_jobs = 'BUILD_JOBS'
kaniko = 'KANIKO'
scheduler = 'SCHEDULER'
stats = 'STATS'
email = 'EMAIL'
container_name = 'CONTAINER_NAME'
max_restarts = 'MAX_RESTARTS'
integrations_webhooks = 'INTEGRATIONS_WEBHOOKS'
ttl = 'TTL'
repos = 'REPOS'
sidecars = 'SIDECARS'
init = 'INIT'
k8_s = 'K8S'
cleaning_intervals = 'CLEANING_INTERVALS'
polyflow = 'POLYFLOW'
service_accounts = 'SERVICE_ACCOUNTS'
access = 'ACCESS'
|
# Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of jumps it will take Emma to jump from her starting postion to the last cloud. It is always possible to win the game.
# For each game, Emma will get an array of clouds numbered if they are safe or if they must be avoided. For example, indexed from . The number on each cloud is its index in the list so she must avoid the clouds at indexes and . She could follow the following two paths: or . The first path takes jumps while the second takes .
# Function Description
# Complete the jumpingOnClouds function in the editor below. It should return the minimum number of jumps required, as an integer.
# jumpingOnClouds has the following parameter(s):
# c: an array of binary integers
# Input Format
# The first line contains an integer , the total number of clouds. The second line contains space-separated binary integers describing clouds where .
# Constraints
# Output Format
# Print the minimum number of jumps needed to win the game.
# Sample Input 0
# 7
# 0 0 1 0 0 1 0
# Sample Output 0
# 4
# Explanation 0:
# Emma must avoid and . She can win the game with a minimum of jumps:
def jumpingOnClouds(c):
if len(c) == 1:
return 0
if len(c) == 2:
return 0 if c[1] == 1 else 1
if c[2] == 1:
return 1 + jumpingOnClouds(c[1:])
if c[2] == 0:
return 1 + jumpingOnClouds(c[2:])
print(jumpingOnClouds([0, 0, 0, 0, 1, 0]))
array = [0, 0, 0, 0, 1, 0]
print(array[1:])
|
def jumping_on_clouds(c):
if len(c) == 1:
return 0
if len(c) == 2:
return 0 if c[1] == 1 else 1
if c[2] == 1:
return 1 + jumping_on_clouds(c[1:])
if c[2] == 0:
return 1 + jumping_on_clouds(c[2:])
print(jumping_on_clouds([0, 0, 0, 0, 1, 0]))
array = [0, 0, 0, 0, 1, 0]
print(array[1:])
|
def func(*args):
print(args)
print(*args)
a = [1, 2, 3]
# here "a" is passed as tuple of list: ([1, 2, 3],)
func(a)
# print(args) -> ([1, 2, 3],)
# print(*args) -> [1, 2, 3]
# here "a" is passed as tuple of integers: (1, 2, 3)
func(*a)
# print(args) -> (1, 2, 3)
# print(*args) -> 1 2 3
|
def func(*args):
print(args)
print(*args)
a = [1, 2, 3]
func(a)
func(*a)
|
def main():
while True:
n,m = map(int, input().split())
if n==0 and m==0:
break
D = [9] * n
H = [0] * m
for d in range(n):
D[d] = int(input())
for k in range(m):
H[k] = int(input())
D.sort() # sorting is an important
H.sort() # pre-processing step
gold = 0
d = 0
k = 0 # both arrays are sorted
while d < n and k < m: # while not done yet
while k < m and D[d] > H[k]:
k += 1 # find required knight k
if k == m:
break # loowater is doomed :S
gold += H[k] # pay this amount of gold
d += 1 # next dragon
k += 1 # next knight
if d == n:
print("{}".format(gold)) # all dragons are chopped
else:
print("Loowater is doomed!")
main()
|
def main():
while True:
(n, m) = map(int, input().split())
if n == 0 and m == 0:
break
d = [9] * n
h = [0] * m
for d in range(n):
D[d] = int(input())
for k in range(m):
H[k] = int(input())
D.sort()
H.sort()
gold = 0
d = 0
k = 0
while d < n and k < m:
while k < m and D[d] > H[k]:
k += 1
if k == m:
break
gold += H[k]
d += 1
k += 1
if d == n:
print('{}'.format(gold))
else:
print('Loowater is doomed!')
main()
|
# Default Configurations
DEFAULT_PYTHON_PATH = '/usr/bin/python'
DEFAULT_STD_OUT_LOG_LOC = '/usr/local/bin/log/env_var_manager.log'
DEFAULT_STSD_ERR_LOG_LOC = '/usr/local/bin/log/env_var_manager.log'
DEFAULT_START_INTERVAL = 120
|
default_python_path = '/usr/bin/python'
default_std_out_log_loc = '/usr/local/bin/log/env_var_manager.log'
default_stsd_err_log_loc = '/usr/local/bin/log/env_var_manager.log'
default_start_interval = 120
|
n=int(input())
students={}
for k in range(0,n):
name = input()
grade=float(input())
if not name in students:
students[name]=[grade]
else:
students[name].append(grade)
for j in students:
gradesCount=len(students[j]); gradesSum=0
for k in range(0,len(students[j])):
gradesSum+=students[j][k]
students[j]=gradesSum/gradesCount
if students[j]<4.50:
students[j]="Doesn't pass"
for j in students:
if students[j]=="Doesn't pass":
continue
else:
print(f"{j} -> {students[j]:.2f}")
|
n = int(input())
students = {}
for k in range(0, n):
name = input()
grade = float(input())
if not name in students:
students[name] = [grade]
else:
students[name].append(grade)
for j in students:
grades_count = len(students[j])
grades_sum = 0
for k in range(0, len(students[j])):
grades_sum += students[j][k]
students[j] = gradesSum / gradesCount
if students[j] < 4.5:
students[j] = "Doesn't pass"
for j in students:
if students[j] == "Doesn't pass":
continue
else:
print(f'{j} -> {students[j]:.2f}')
|
def problem_2():
"By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."
sequence = [1]
total, sequence_next = 0, 0
# While the next term in the Fibonacci sequence is under 4000000...
while(sequence_next < 4000000):
# Calculate the next term in the sequence and append it to the list
sequence_next = sequence[len(sequence) - 1] + \
sequence[len(sequence) - 2]
sequence.append(sequence_next)
# If the entry is even, add it to the sum of even numbered terms
if(sequence_next % 2 == 0):
total += sequence_next
return total
if __name__ == "__main__":
answer = problem_2()
print(answer)
|
def problem_2():
"""By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."""
sequence = [1]
(total, sequence_next) = (0, 0)
while sequence_next < 4000000:
sequence_next = sequence[len(sequence) - 1] + sequence[len(sequence) - 2]
sequence.append(sequence_next)
if sequence_next % 2 == 0:
total += sequence_next
return total
if __name__ == '__main__':
answer = problem_2()
print(answer)
|
#
# PySNMP MIB module HUAWEI-VPLS-TNL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-VPLS-TNL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:49:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint")
hwDatacomm, = mibBuilder.importSymbols("HUAWEI-MIB", "hwDatacomm")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
ModuleIdentity, MibIdentifier, Counter32, Counter64, IpAddress, Integer32, NotificationType, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, ObjectIdentity, TimeTicks, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "MibIdentifier", "Counter32", "Counter64", "IpAddress", "Integer32", "NotificationType", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "ObjectIdentity", "TimeTicks", "Bits", "Gauge32")
TextualConvention, RowStatus, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString", "TruthValue")
hwL2VpnVplsTnlExt = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6))
if mibBuilder.loadTexts: hwL2VpnVplsTnlExt.setLastUpdated('200812151925Z')
if mibBuilder.loadTexts: hwL2VpnVplsTnlExt.setOrganization('Huawei Technologies Co., Ltd.')
if mibBuilder.loadTexts: hwL2VpnVplsTnlExt.setContactInfo('R&D BeiJing, Huawei Technologies co.,Ltd. Huawei Bld.,NO.3 Xinxi Rd., Shang-Di Information Industry Base, Hai-Dian District Beijing P.R. China Zip:100085 Http://www.huawei.com E-mail:[email protected]')
if mibBuilder.loadTexts: hwL2VpnVplsTnlExt.setDescription('This MIB defines all the objects that containing VPLS tunnel information.')
hwL2Vpn = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119))
hwVplsTunnelMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1))
hwVplsTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1), )
if mibBuilder.loadTexts: hwVplsTunnelTable.setStatus('current')
if mibBuilder.loadTexts: hwVplsTunnelTable.setDescription('Information about VPLS PW Tunnel. This object is used to get VPLS PW tunnel table.')
hwVplsTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1), ).setIndexNames((0, "HUAWEI-VPLS-TNL-MIB", "hwVplsVsiName"), (0, "HUAWEI-VPLS-TNL-MIB", "hwVplsNexthopPeer"), (0, "HUAWEI-VPLS-TNL-MIB", "hwVplsSiteOrPwId"), (0, "HUAWEI-VPLS-TNL-MIB", "hwVplsPeerTnlId"))
if mibBuilder.loadTexts: hwVplsTunnelEntry.setStatus('current')
if mibBuilder.loadTexts: hwVplsTunnelEntry.setDescription('It is used to get detailed tunnel information.')
hwVplsVsiName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31)))
if mibBuilder.loadTexts: hwVplsVsiName.setStatus('current')
if mibBuilder.loadTexts: hwVplsVsiName.setDescription('The name of this VPLS instance.')
hwVplsNexthopPeer = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 2), IpAddress())
if mibBuilder.loadTexts: hwVplsNexthopPeer.setStatus('current')
if mibBuilder.loadTexts: hwVplsNexthopPeer.setDescription('The ip address of the peer PE.')
hwVplsSiteOrPwId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 3), Unsigned32())
if mibBuilder.loadTexts: hwVplsSiteOrPwId.setStatus('current')
if mibBuilder.loadTexts: hwVplsSiteOrPwId.setDescription('Remote Site ID for BGP Mode, or PW id for LDP Mode')
hwVplsPeerTnlId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 4), Unsigned32())
if mibBuilder.loadTexts: hwVplsPeerTnlId.setStatus('current')
if mibBuilder.loadTexts: hwVplsPeerTnlId.setDescription('The Tunnel ID.')
hwVplsTnlName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsTnlName.setStatus('current')
if mibBuilder.loadTexts: hwVplsTnlName.setDescription('The name of this Tunnel.')
hwVplsTnlType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("lsp", 1), ("crlsp", 2), ("other", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsTnlType.setStatus('current')
if mibBuilder.loadTexts: hwVplsTnlType.setDescription('The type of this Tunnel. e.g. LSP/GRE/CR-LSP...')
hwVplsTnlSrcAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 7), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsTnlSrcAddress.setStatus('current')
if mibBuilder.loadTexts: hwVplsTnlSrcAddress.setDescription('The source ip address of this tunnel.')
hwVplsTnlDestAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 8), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsTnlDestAddress.setStatus('current')
if mibBuilder.loadTexts: hwVplsTnlDestAddress.setDescription('The destination ip address of this tunnel.')
hwVplsLspIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspIndex.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspIndex.setDescription('The index of lsp.')
hwVplsLspOutIf = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspOutIf.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspOutIf.setDescription('The out-interface of lsp.')
hwVplsLspOutLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspOutLabel.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspOutLabel.setDescription('The out-label of lsp.')
hwVplsLspNextHop = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 12), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspNextHop.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspNextHop.setDescription('The next-hop of lsp.')
hwVplsLspFec = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 13), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspFec.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspFec.setDescription('The Fec of lsp.')
hwVplsLspFecPfxLen = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspFecPfxLen.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspFecPfxLen.setDescription('The length of mask for hwVplsLspFec.')
hwVplsLspIsBackup = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 15), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspIsBackup.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspIsBackup.setDescription('Indicate whether the lsp is main.')
hwVplsIsBalance = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 16), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsIsBalance.setStatus('current')
if mibBuilder.loadTexts: hwVplsIsBalance.setDescription('Property of Balance. Rerurn True if Tunnel-Policy is configed.')
hwVplsLspTunnelId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspTunnelId.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspTunnelId.setDescription('This object indicates the tunnel ID of the tunnel interface.')
hwVplsLspSignType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20))).clone(namedValues=NamedValues(("ldp", 1), ("crLdp", 2), ("rsvp", 3), ("bgp", 4), ("l3vpn", 5), ("static", 6), ("crStatic", 7), ("bgpIpv6", 8), ("staticHa", 9), ("l2vpnIpv6", 10), ("maxSignal", 20)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwVplsLspSignType.setStatus('current')
if mibBuilder.loadTexts: hwVplsLspSignType.setDescription('This object indicates the signaling protocol of the tunnel.')
hwVplsTnlRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 50), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwVplsTnlRowStatus.setStatus('current')
if mibBuilder.loadTexts: hwVplsTnlRowStatus.setDescription('The operating state of the row.')
hwVplsTunnelMIBTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 2))
hwVplsTunnelMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3))
hwVplsTunnelMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 1))
hwVplsTunnelMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 1, 1)).setObjects(("HUAWEI-VPLS-TNL-MIB", "hwVplsTunnelGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwVplsTunnelMIBCompliance = hwVplsTunnelMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: hwVplsTunnelMIBCompliance.setDescription('The compliance statement for systems supporting the HUAWEI-VPLS-TNL-MIB.')
hwVplsTunnelMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 2))
hwVplsTunnelGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 2, 1)).setObjects(("HUAWEI-VPLS-TNL-MIB", "hwVplsTnlName"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsTnlType"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsTnlSrcAddress"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsTnlDestAddress"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspOutIf"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspOutLabel"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspNextHop"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspFec"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspFecPfxLen"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspIsBackup"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsIsBalance"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspTunnelId"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsLspSignType"), ("HUAWEI-VPLS-TNL-MIB", "hwVplsTnlRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwVplsTunnelGroup = hwVplsTunnelGroup.setStatus('current')
if mibBuilder.loadTexts: hwVplsTunnelGroup.setDescription('The VPLS tunnel group.')
mibBuilder.exportSymbols("HUAWEI-VPLS-TNL-MIB", hwVplsSiteOrPwId=hwVplsSiteOrPwId, hwVplsTunnelMIBConformance=hwVplsTunnelMIBConformance, hwVplsIsBalance=hwVplsIsBalance, PYSNMP_MODULE_ID=hwL2VpnVplsTnlExt, hwVplsTunnelMIBCompliances=hwVplsTunnelMIBCompliances, hwVplsTunnelMIBObjects=hwVplsTunnelMIBObjects, hwVplsTunnelGroup=hwVplsTunnelGroup, hwVplsTunnelMIBTraps=hwVplsTunnelMIBTraps, hwVplsTnlRowStatus=hwVplsTnlRowStatus, hwVplsLspSignType=hwVplsLspSignType, hwVplsTunnelMIBCompliance=hwVplsTunnelMIBCompliance, hwVplsLspFec=hwVplsLspFec, hwVplsLspTunnelId=hwVplsLspTunnelId, hwVplsLspIndex=hwVplsLspIndex, hwVplsTunnelEntry=hwVplsTunnelEntry, hwVplsTunnelMIBGroups=hwVplsTunnelMIBGroups, hwVplsTnlName=hwVplsTnlName, hwVplsLspOutIf=hwVplsLspOutIf, hwVplsLspFecPfxLen=hwVplsLspFecPfxLen, hwL2Vpn=hwL2Vpn, hwVplsTnlType=hwVplsTnlType, hwVplsTunnelTable=hwVplsTunnelTable, hwVplsLspNextHop=hwVplsLspNextHop, hwVplsTnlSrcAddress=hwVplsTnlSrcAddress, hwVplsTnlDestAddress=hwVplsTnlDestAddress, hwVplsPeerTnlId=hwVplsPeerTnlId, hwL2VpnVplsTnlExt=hwL2VpnVplsTnlExt, hwVplsLspOutLabel=hwVplsLspOutLabel, hwVplsLspIsBackup=hwVplsLspIsBackup, hwVplsNexthopPeer=hwVplsNexthopPeer, hwVplsVsiName=hwVplsVsiName)
|
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint')
(hw_datacomm,) = mibBuilder.importSymbols('HUAWEI-MIB', 'hwDatacomm')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup')
(module_identity, mib_identifier, counter32, counter64, ip_address, integer32, notification_type, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, object_identity, time_ticks, bits, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'MibIdentifier', 'Counter32', 'Counter64', 'IpAddress', 'Integer32', 'NotificationType', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'ObjectIdentity', 'TimeTicks', 'Bits', 'Gauge32')
(textual_convention, row_status, display_string, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'DisplayString', 'TruthValue')
hw_l2_vpn_vpls_tnl_ext = module_identity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6))
if mibBuilder.loadTexts:
hwL2VpnVplsTnlExt.setLastUpdated('200812151925Z')
if mibBuilder.loadTexts:
hwL2VpnVplsTnlExt.setOrganization('Huawei Technologies Co., Ltd.')
if mibBuilder.loadTexts:
hwL2VpnVplsTnlExt.setContactInfo('R&D BeiJing, Huawei Technologies co.,Ltd. Huawei Bld.,NO.3 Xinxi Rd., Shang-Di Information Industry Base, Hai-Dian District Beijing P.R. China Zip:100085 Http://www.huawei.com E-mail:[email protected]')
if mibBuilder.loadTexts:
hwL2VpnVplsTnlExt.setDescription('This MIB defines all the objects that containing VPLS tunnel information.')
hw_l2_vpn = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119))
hw_vpls_tunnel_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1))
hw_vpls_tunnel_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1))
if mibBuilder.loadTexts:
hwVplsTunnelTable.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTunnelTable.setDescription('Information about VPLS PW Tunnel. This object is used to get VPLS PW tunnel table.')
hw_vpls_tunnel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1)).setIndexNames((0, 'HUAWEI-VPLS-TNL-MIB', 'hwVplsVsiName'), (0, 'HUAWEI-VPLS-TNL-MIB', 'hwVplsNexthopPeer'), (0, 'HUAWEI-VPLS-TNL-MIB', 'hwVplsSiteOrPwId'), (0, 'HUAWEI-VPLS-TNL-MIB', 'hwVplsPeerTnlId'))
if mibBuilder.loadTexts:
hwVplsTunnelEntry.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTunnelEntry.setDescription('It is used to get detailed tunnel information.')
hw_vpls_vsi_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 31)))
if mibBuilder.loadTexts:
hwVplsVsiName.setStatus('current')
if mibBuilder.loadTexts:
hwVplsVsiName.setDescription('The name of this VPLS instance.')
hw_vpls_nexthop_peer = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 2), ip_address())
if mibBuilder.loadTexts:
hwVplsNexthopPeer.setStatus('current')
if mibBuilder.loadTexts:
hwVplsNexthopPeer.setDescription('The ip address of the peer PE.')
hw_vpls_site_or_pw_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 3), unsigned32())
if mibBuilder.loadTexts:
hwVplsSiteOrPwId.setStatus('current')
if mibBuilder.loadTexts:
hwVplsSiteOrPwId.setDescription('Remote Site ID for BGP Mode, or PW id for LDP Mode')
hw_vpls_peer_tnl_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 4), unsigned32())
if mibBuilder.loadTexts:
hwVplsPeerTnlId.setStatus('current')
if mibBuilder.loadTexts:
hwVplsPeerTnlId.setDescription('The Tunnel ID.')
hw_vpls_tnl_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 5), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsTnlName.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTnlName.setDescription('The name of this Tunnel.')
hw_vpls_tnl_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('lsp', 1), ('crlsp', 2), ('other', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsTnlType.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTnlType.setDescription('The type of this Tunnel. e.g. LSP/GRE/CR-LSP...')
hw_vpls_tnl_src_address = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 7), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsTnlSrcAddress.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTnlSrcAddress.setDescription('The source ip address of this tunnel.')
hw_vpls_tnl_dest_address = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 8), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsTnlDestAddress.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTnlDestAddress.setDescription('The destination ip address of this tunnel.')
hw_vpls_lsp_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspIndex.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspIndex.setDescription('The index of lsp.')
hw_vpls_lsp_out_if = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 10), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspOutIf.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspOutIf.setDescription('The out-interface of lsp.')
hw_vpls_lsp_out_label = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspOutLabel.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspOutLabel.setDescription('The out-label of lsp.')
hw_vpls_lsp_next_hop = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 12), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspNextHop.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspNextHop.setDescription('The next-hop of lsp.')
hw_vpls_lsp_fec = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 13), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspFec.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspFec.setDescription('The Fec of lsp.')
hw_vpls_lsp_fec_pfx_len = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspFecPfxLen.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspFecPfxLen.setDescription('The length of mask for hwVplsLspFec.')
hw_vpls_lsp_is_backup = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 15), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspIsBackup.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspIsBackup.setDescription('Indicate whether the lsp is main.')
hw_vpls_is_balance = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 16), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsIsBalance.setStatus('current')
if mibBuilder.loadTexts:
hwVplsIsBalance.setDescription('Property of Balance. Rerurn True if Tunnel-Policy is configed.')
hw_vpls_lsp_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 17), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspTunnelId.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspTunnelId.setDescription('This object indicates the tunnel ID of the tunnel interface.')
hw_vpls_lsp_sign_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20))).clone(namedValues=named_values(('ldp', 1), ('crLdp', 2), ('rsvp', 3), ('bgp', 4), ('l3vpn', 5), ('static', 6), ('crStatic', 7), ('bgpIpv6', 8), ('staticHa', 9), ('l2vpnIpv6', 10), ('maxSignal', 20)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hwVplsLspSignType.setStatus('current')
if mibBuilder.loadTexts:
hwVplsLspSignType.setDescription('This object indicates the signaling protocol of the tunnel.')
hw_vpls_tnl_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 1, 1, 1, 50), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hwVplsTnlRowStatus.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTnlRowStatus.setDescription('The operating state of the row.')
hw_vpls_tunnel_mib_traps = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 2))
hw_vpls_tunnel_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3))
hw_vpls_tunnel_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 1))
hw_vpls_tunnel_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 1, 1)).setObjects(('HUAWEI-VPLS-TNL-MIB', 'hwVplsTunnelGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hw_vpls_tunnel_mib_compliance = hwVplsTunnelMIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTunnelMIBCompliance.setDescription('The compliance statement for systems supporting the HUAWEI-VPLS-TNL-MIB.')
hw_vpls_tunnel_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 2))
hw_vpls_tunnel_group = object_group((1, 3, 6, 1, 4, 1, 2011, 5, 25, 119, 6, 3, 2, 1)).setObjects(('HUAWEI-VPLS-TNL-MIB', 'hwVplsTnlName'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsTnlType'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsTnlSrcAddress'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsTnlDestAddress'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspOutIf'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspOutLabel'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspNextHop'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspFec'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspFecPfxLen'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspIsBackup'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsIsBalance'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspTunnelId'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsLspSignType'), ('HUAWEI-VPLS-TNL-MIB', 'hwVplsTnlRowStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hw_vpls_tunnel_group = hwVplsTunnelGroup.setStatus('current')
if mibBuilder.loadTexts:
hwVplsTunnelGroup.setDescription('The VPLS tunnel group.')
mibBuilder.exportSymbols('HUAWEI-VPLS-TNL-MIB', hwVplsSiteOrPwId=hwVplsSiteOrPwId, hwVplsTunnelMIBConformance=hwVplsTunnelMIBConformance, hwVplsIsBalance=hwVplsIsBalance, PYSNMP_MODULE_ID=hwL2VpnVplsTnlExt, hwVplsTunnelMIBCompliances=hwVplsTunnelMIBCompliances, hwVplsTunnelMIBObjects=hwVplsTunnelMIBObjects, hwVplsTunnelGroup=hwVplsTunnelGroup, hwVplsTunnelMIBTraps=hwVplsTunnelMIBTraps, hwVplsTnlRowStatus=hwVplsTnlRowStatus, hwVplsLspSignType=hwVplsLspSignType, hwVplsTunnelMIBCompliance=hwVplsTunnelMIBCompliance, hwVplsLspFec=hwVplsLspFec, hwVplsLspTunnelId=hwVplsLspTunnelId, hwVplsLspIndex=hwVplsLspIndex, hwVplsTunnelEntry=hwVplsTunnelEntry, hwVplsTunnelMIBGroups=hwVplsTunnelMIBGroups, hwVplsTnlName=hwVplsTnlName, hwVplsLspOutIf=hwVplsLspOutIf, hwVplsLspFecPfxLen=hwVplsLspFecPfxLen, hwL2Vpn=hwL2Vpn, hwVplsTnlType=hwVplsTnlType, hwVplsTunnelTable=hwVplsTunnelTable, hwVplsLspNextHop=hwVplsLspNextHop, hwVplsTnlSrcAddress=hwVplsTnlSrcAddress, hwVplsTnlDestAddress=hwVplsTnlDestAddress, hwVplsPeerTnlId=hwVplsPeerTnlId, hwL2VpnVplsTnlExt=hwL2VpnVplsTnlExt, hwVplsLspOutLabel=hwVplsLspOutLabel, hwVplsLspIsBackup=hwVplsLspIsBackup, hwVplsNexthopPeer=hwVplsNexthopPeer, hwVplsVsiName=hwVplsVsiName)
|
print('a sequence from 0 to 2')
for i in range(3):
print(i)
print('----------------------')
print('a sequence from 2 to 4')
for i in range(2, 5):
print(i)
print('----------------------')
print('a sequence from 2 to 8 with a step of 2')
for i in range(2, 9, 2):
print(i)
'''
Output:
a sequence from 0 to 2
0
1
2
----------------------
a sequence from 2 to 4
2
3
4
----------------------
a sequence from 2 to 8 with a step of 2
2
4
6
8
'''
|
print('a sequence from 0 to 2')
for i in range(3):
print(i)
print('----------------------')
print('a sequence from 2 to 4')
for i in range(2, 5):
print(i)
print('----------------------')
print('a sequence from 2 to 8 with a step of 2')
for i in range(2, 9, 2):
print(i)
'\nOutput:\na sequence from 0 to 2\n0\n1\n2\n----------------------\na sequence from 2 to 4\n2\n3\n4\n----------------------\na sequence from 2 to 8 with a step of 2\n2\n4\n6\n8\n'
|
class MockResponse:
def __init__(self, status_code, data):
self.status_code = status_code
self.data = data
def json(self):
return self.data
class AuthenticationMock:
def get_token(self):
pass
def get_headers(self):
return {"Authorization": "Bearer token"}
def give_response(status_code, data):
return MockResponse(status_code, data)
GUIDS_MOCK = {
"resources": [
{
"entity": {
"name": "test1",
"space_guid": "space",
"state": "STARTED"
},
"metadata": {
"guid": "guid",
"updated_at": "2012-01-01T13:00:00Z"
}
},
{
"entity": {
"name": "test2",
"space_guid": "space",
"state": "STOPPED"
},
"metadata": {
"guid": "guid",
"updated_at": "2012-01-01T13:00:00Z"
}
}
]
}
|
class Mockresponse:
def __init__(self, status_code, data):
self.status_code = status_code
self.data = data
def json(self):
return self.data
class Authenticationmock:
def get_token(self):
pass
def get_headers(self):
return {'Authorization': 'Bearer token'}
def give_response(status_code, data):
return mock_response(status_code, data)
guids_mock = {'resources': [{'entity': {'name': 'test1', 'space_guid': 'space', 'state': 'STARTED'}, 'metadata': {'guid': 'guid', 'updated_at': '2012-01-01T13:00:00Z'}}, {'entity': {'name': 'test2', 'space_guid': 'space', 'state': 'STOPPED'}, 'metadata': {'guid': 'guid', 'updated_at': '2012-01-01T13:00:00Z'}}]}
|
#Creating a Tuple
newtuple = 'a','b','c','d'
print(newtuple)
# Tuple with 1 element
tupple = 'a',
print(tupple)
newtuple1 = tuple('abcd')
print(newtuple1)
print("------------------")
#Accessing Tuples
newtuple = 'a','b','c','d'
print(newtuple[1])
print(newtuple[-1])
#Traversing a Tuple
for i in newtuple:
print(i)
print("------------------")
#Searching a tuple
print('b' in newtuple)
|
newtuple = ('a', 'b', 'c', 'd')
print(newtuple)
tupple = ('a',)
print(tupple)
newtuple1 = tuple('abcd')
print(newtuple1)
print('------------------')
newtuple = ('a', 'b', 'c', 'd')
print(newtuple[1])
print(newtuple[-1])
for i in newtuple:
print(i)
print('------------------')
print('b' in newtuple)
|
my_favorite_things = {'food': ['burgers', 'pho', 'mangoes'], 'basketball': ['dribbling', 'passing', 'shooting']}
# A list uses square brackets while a dictionary uses curly braces.
my_favorite_things['movies'] = ['Avengers', 'Star Wars']
# my_favorite_things of movies is value
# A square bracket after a variable allows you to indicate which key you're talking about.
print(my_favorite_things['food'])
# We are giving the computer the value of the key food in the variable my_favorite_things.
# We have to be very SPECIFIC in our language on python so the program can understand us.
appliances = ['lamp', 'toaster', 'microwave']
# lists a dictionary were numbers are the keys
print(appliances[1])
appliances[1] = 'blender'
# Use line 12 format to reassign the value the index or position in a list.
print(appliances)
my_favorite_things['movies'].append('Harry Potter')
print(my_favorite_things['movies'])
def plus_5(x):
return x + 5
p = plus_5(3)
print(p)
def max(x, y):
if x < y:
return y
else:
return x
v = max(3, 11)
print(v)
|
my_favorite_things = {'food': ['burgers', 'pho', 'mangoes'], 'basketball': ['dribbling', 'passing', 'shooting']}
my_favorite_things['movies'] = ['Avengers', 'Star Wars']
print(my_favorite_things['food'])
appliances = ['lamp', 'toaster', 'microwave']
print(appliances[1])
appliances[1] = 'blender'
print(appliances)
my_favorite_things['movies'].append('Harry Potter')
print(my_favorite_things['movies'])
def plus_5(x):
return x + 5
p = plus_5(3)
print(p)
def max(x, y):
if x < y:
return y
else:
return x
v = max(3, 11)
print(v)
|
#
# @lc app=leetcode id=2 lang=python
#
# [2] Add Two Numbers
#
# @lc code=start
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if l1 == None:
return l2
if l2 == None:
return l1
head1 = l1
head2 = l2
ret = ListNode()
head = ret
toSum = 0
while (head1 != None and head2 != None):
cur = ListNode((head1.val+head2.val+toSum)%10, None)
head.next = cur
head = cur
toSum = (head1.val+head2.val+toSum)/10
head1 = head1.next
head2 = head2.next
while (head1 != None):
cur = ListNode((head1.val+toSum)%10, None)
head.next = cur
head = cur
toSum = (head1.val+toSum)/10
head1 = head1.next
while (head2 != None):
cur = ListNode((head2.val+toSum)%10, None)
head.next = cur
head = cur
toSum = (head2.val+toSum)/10
head2 = head2.next
if toSum != 0:
head.next = ListNode(toSum, None)
return ret.next
# @lc code=end
|
class Listnode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution(object):
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if l1 == None:
return l2
if l2 == None:
return l1
head1 = l1
head2 = l2
ret = list_node()
head = ret
to_sum = 0
while head1 != None and head2 != None:
cur = list_node((head1.val + head2.val + toSum) % 10, None)
head.next = cur
head = cur
to_sum = (head1.val + head2.val + toSum) / 10
head1 = head1.next
head2 = head2.next
while head1 != None:
cur = list_node((head1.val + toSum) % 10, None)
head.next = cur
head = cur
to_sum = (head1.val + toSum) / 10
head1 = head1.next
while head2 != None:
cur = list_node((head2.val + toSum) % 10, None)
head.next = cur
head = cur
to_sum = (head2.val + toSum) / 10
head2 = head2.next
if toSum != 0:
head.next = list_node(toSum, None)
return ret.next
|
def get_words_indexes(words_indexes_dictionary, review):
words = review.split(' ')
words_indexes = set()
for word in words:
if word in words_indexes_dictionary:
word_index = words_indexes_dictionary[word]
words_indexes.add(word_index)
return words_indexes
|
def get_words_indexes(words_indexes_dictionary, review):
words = review.split(' ')
words_indexes = set()
for word in words:
if word in words_indexes_dictionary:
word_index = words_indexes_dictionary[word]
words_indexes.add(word_index)
return words_indexes
|
bool_expected_methods = [
'__abs__',
'__add__',
'__and__',
'__bool__',
'__ceil__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floor__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__getnewargs__',
'__gt__',
'__hash__',
'__index__',
'__init__',
'__init_subclass__',
'__int__',
'__invert__',
'__le__',
'__lshift__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__or__',
'__pos__',
'__pow__',
'__radd__',
'__rand__',
'__rdivmod__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rfloordiv__',
'__rlshift__',
'__rmod__',
'__rmul__',
'__ror__',
'__round__',
'__rpow__',
'__rrshift__',
'__rshift__',
'__rsub__',
'__rtruediv__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'__trunc__',
'__xor__',
'bit_length',
'conjugate',
'denominator',
'from_bytes',
'imag',
'numerator',
'real',
'to_bytes',
]
bytearray_expected_methods = [
'__add__',
'__alloc__',
'__class__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__iadd__',
'__imul__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'append',
'capitalize',
'center',
'clear',
'copy',
'count',
'decode',
'endswith',
'expandtabs',
'extend',
'find',
'fromhex',
'hex',
'index',
'insert',
'isalnum',
'isalpha',
'isascii',
'isdigit',
'islower',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'pop',
'remove',
'replace',
'reverse',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill',
]
bytes_expected_methods = [
'__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'center',
'count',
'decode',
'endswith',
'expandtabs',
'find',
'fromhex',
'hex',
'index',
'isalnum',
'isalpha',
'isascii',
'isdigit',
'islower',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill',
]
complex_expected_methods = [
'__abs__',
'__add__',
'__bool__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__getnewargs__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__int__',
'__le__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__pos__',
'__pow__',
'__radd__',
'__rdivmod__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rfloordiv__',
'__rmod__',
'__rmul__',
'__rpow__',
'__rsub__',
'__rtruediv__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'conjugate',
'imag',
'real',
]
dict_expected_methods = [
'__class__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'clear',
'copy',
'fromkeys',
'get',
'items',
'keys',
'pop',
'popitem',
'setdefault',
'update',
'values',
]
float_expected_methods = [
'__abs__',
'__add__',
'__bool__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__getformat__',
'__getnewargs__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__int__',
'__le__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__pos__',
'__pow__',
'__radd__',
'__rdivmod__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rfloordiv__',
'__rmod__',
'__rmul__',
'__round__',
'__rpow__',
'__rsub__',
'__rtruediv__',
'__set_format__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'__trunc__',
'as_integer_ratio',
'conjugate',
'fromhex',
'hex',
'imag',
'is_integer',
'real',
]
frozenset_expected_methods = [
'__and__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__or__',
'__rand__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__ror__',
'__rsub__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__xor__',
'copy',
'difference',
'intersection',
'isdisjoint',
'issubset',
'issuperset',
'symmetric_difference',
'union',
]
int_expected_methods = [
'__abs__',
'__add__',
'__and__',
'__bool__',
'__ceil__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floor__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__getnewargs__',
'__gt__',
'__hash__',
'__index__',
'__init__',
'__init_subclass__',
'__int__',
'__invert__',
'__le__',
'__lshift__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__or__',
'__pos__',
'__pow__',
'__radd__',
'__rand__',
'__rdivmod__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rfloordiv__',
'__rlshift__',
'__rmod__',
'__rmul__',
'__ror__',
'__round__',
'__rpow__',
'__rrshift__',
'__rshift__',
'__rsub__',
'__rtruediv__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'__trunc__',
'__xor__',
'bit_length',
'conjugate',
'denominator',
'from_bytes',
'imag',
'numerator',
'real',
'to_bytes',
]
iter_expected_methods = [
'__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__length_hint__',
'__lt__',
'__ne__',
'__new__',
'__next__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__setstate__',
'__sizeof__',
'__str__',
'__subclasshook__',
]
list_expected_methods = [
'__add__',
'__class__',
'__contains__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__iadd__',
'__imul__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__reversed__',
'__rmul__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'append',
'clear',
'copy',
'count',
'extend',
'index',
'insert',
'pop',
'remove',
'reverse',
'sort',
]
memoryview_expected_methods = [
'__class__',
'__delattr__',
'__delitem__',
'__dir__',
'__doc__',
'__enter__',
'__eq__',
'__exit__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__setitem__',
'__sizeof__',
'__str__',
'__subclasshook__',
'c_contiguous',
'cast',
'contiguous',
'f_contiguous',
'format',
'hex',
'itemsize',
'nbytes',
'ndim',
'obj',
'readonly',
'release',
'shape',
'strides',
'suboffsets',
'tobytes',
'tolist',
]
range_expected_methods = [
'__bool__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__reversed__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'count',
'index',
'start',
'step',
'stop',
]
set_expected_methods = [
'__and__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__iand__',
'__init__',
'__init_subclass__',
'__ior__',
'__isub__',
'__iter__',
'__ixor__',
'__le__',
'__len__',
'__lt__',
'__ne__',
'__new__',
'__or__',
'__rand__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__ror__',
'__rsub__',
'__rxor__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__xor__',
'add',
'clear',
'copy',
'difference',
'difference_update',
'discard',
'intersection',
'intersection_update',
'isdisjoint',
'issubset',
'issuperset',
'pop',
'remove',
'symmetric_difference',
'symmetric_difference_update',
'union',
'update',
]
string_expected_methods = [
'__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mod__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmod__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'capitalize',
'casefold',
'center',
'count',
'encode',
'endswith',
'expandtabs',
'find',
'format',
'format_map',
'index',
'isalnum',
'isalpha',
'isascii',
'isdecimal',
'isdigit',
'isidentifier',
'islower',
'isnumeric',
'isprintable',
'isspace',
'istitle',
'isupper',
'join',
'ljust',
'lower',
'lstrip',
'maketrans',
'partition',
'replace',
'rfind',
'rindex',
'rjust',
'rpartition',
'rsplit',
'rstrip',
'split',
'splitlines',
'startswith',
'strip',
'swapcase',
'title',
'translate',
'upper',
'zfill'
]
tuple_expected_methods = [
'__add__',
'__class__',
'__contains__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__getnewargs__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__iter__',
'__le__',
'__len__',
'__lt__',
'__mul__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmul__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'count',
'index',
]
object_expected_methods = [
'__repr__',
'__hash__',
'__str__',
'__getattribute__',
'__setattr__',
'__delattr__',
'__lt__',
'__le__',
'__eq__',
'__ne__',
'__gt__',
'__ge__',
'__init__',
'__new__',
'__reduce_ex__',
'__reduce__',
'__subclasshook__',
'__init_subclass__',
'__format__',
'__sizeof__',
'__dir__',
'__class__',
'__doc__'
]
not_implemented = []
for method in bool_expected_methods:
try:
if not hasattr(bool, method):
not_implemented.append(("bool", method))
except NameError:
not_implemented.append(("bool", method))
for method in bytearray_expected_methods:
try:
if not hasattr(bytearray(), method):
not_implemented.append(("bytearray", method))
except NameError:
not_implemented.append(("bytearray", method))
for method in bytes_expected_methods:
try:
if not hasattr(bytes, method):
not_implemented.append(("bytes", method))
except NameError:
not_implemented.append(("bytes", method))
for method in complex_expected_methods:
try:
if not hasattr(complex, method):
not_implemented.append(("complex", method))
except NameError:
not_implemented.append(("complex", method))
for method in dict_expected_methods:
try:
if not hasattr(dict, method):
not_implemented.append(("dict", method))
except NameError:
not_implemented.append(("dict", method))
for method in float_expected_methods:
try:
if not hasattr(float, method):
not_implemented.append(("float", method))
except NameError:
not_implemented.append(("float", method))
for method in frozenset_expected_methods:
# TODO: uncomment this when frozenset is implemented
# try:
# if not hasattr(frozenset, method):
# not_implemented.append(("frozenset", method))
# except NameError:
not_implemented.append(("frozenset", method))
for method in int_expected_methods:
try:
if not hasattr(int, method):
not_implemented.append(("int", method))
except NameError:
not_implemented.append(("int", method))
for method in iter_expected_methods:
try:
if not hasattr(iter([]), method):
not_implemented.append(("iter", method))
except NameError:
not_implemented.append(("iter", method))
for method in list_expected_methods:
try:
if not hasattr(list, method):
not_implemented.append(("list", method))
except NameError:
not_implemented.append(("list", method))
for method in memoryview_expected_methods:
# TODO: uncomment this when memoryview is implemented
# try:
# if not hasattr(memoryview, method):
# not_implemented.append(("memoryview", method))
# except NameError:
not_implemented.append(("memoryview", method))
for method in range_expected_methods:
try:
if not hasattr(range, method):
not_implemented.append(("range", method))
except NameError:
not_implemented.append(("range", method))
for method in set_expected_methods:
try:
if not hasattr(set, method):
not_implemented.append(("set", method))
except NameError:
not_implemented.append(("set", method))
for method in string_expected_methods:
try:
if not hasattr(str, method):
not_implemented.append(("string", method))
except NameError:
not_implemented.append(("string", method))
for method in tuple_expected_methods:
try:
if not hasattr(tuple, method):
not_implemented.append(("tuple", method))
except NameError:
not_implemented.append(("tuple", method))
for method in object_expected_methods:
try:
if not hasattr(bool, method):
not_implemented.append(("object", method))
except NameError:
not_implemented.append(("object", method))
for r in not_implemented:
print(r[0], ".", r[1])
else:
print("Not much \\o/")
|
bool_expected_methods = ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
bytearray_expected_methods = ['__add__', '__alloc__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'capitalize', 'center', 'clear', 'copy', 'count', 'decode', 'endswith', 'expandtabs', 'extend', 'find', 'fromhex', 'hex', 'index', 'insert', 'isalnum', 'isalpha', 'isascii', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'pop', 'remove', 'replace', 'reverse', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
bytes_expected_methods = ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'center', 'count', 'decode', 'endswith', 'expandtabs', 'find', 'fromhex', 'hex', 'index', 'isalnum', 'isalpha', 'isascii', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
complex_expected_methods = ['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 'conjugate', 'imag', 'real']
dict_expected_methods = ['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
float_expected_methods = ['__abs__', '__add__', '__bool__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getformat__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__round__', '__rpow__', '__rsub__', '__rtruediv__', '__set_format__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', 'as_integer_ratio', 'conjugate', 'fromhex', 'hex', 'imag', 'is_integer', 'real']
frozenset_expected_methods = ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union']
int_expected_methods = ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
iter_expected_methods = ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__length_hint__', '__lt__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__']
list_expected_methods = ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
memoryview_expected_methods = ['__class__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'c_contiguous', 'cast', 'contiguous', 'f_contiguous', 'format', 'hex', 'itemsize', 'nbytes', 'ndim', 'obj', 'readonly', 'release', 'shape', 'strides', 'suboffsets', 'tobytes', 'tolist']
range_expected_methods = ['__bool__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index', 'start', 'step', 'stop']
set_expected_methods = ['__and__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__init_subclass__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update']
string_expected_methods = ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
tuple_expected_methods = ['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
object_expected_methods = ['__repr__', '__hash__', '__str__', '__getattribute__', '__setattr__', '__delattr__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__init__', '__new__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__sizeof__', '__dir__', '__class__', '__doc__']
not_implemented = []
for method in bool_expected_methods:
try:
if not hasattr(bool, method):
not_implemented.append(('bool', method))
except NameError:
not_implemented.append(('bool', method))
for method in bytearray_expected_methods:
try:
if not hasattr(bytearray(), method):
not_implemented.append(('bytearray', method))
except NameError:
not_implemented.append(('bytearray', method))
for method in bytes_expected_methods:
try:
if not hasattr(bytes, method):
not_implemented.append(('bytes', method))
except NameError:
not_implemented.append(('bytes', method))
for method in complex_expected_methods:
try:
if not hasattr(complex, method):
not_implemented.append(('complex', method))
except NameError:
not_implemented.append(('complex', method))
for method in dict_expected_methods:
try:
if not hasattr(dict, method):
not_implemented.append(('dict', method))
except NameError:
not_implemented.append(('dict', method))
for method in float_expected_methods:
try:
if not hasattr(float, method):
not_implemented.append(('float', method))
except NameError:
not_implemented.append(('float', method))
for method in frozenset_expected_methods:
not_implemented.append(('frozenset', method))
for method in int_expected_methods:
try:
if not hasattr(int, method):
not_implemented.append(('int', method))
except NameError:
not_implemented.append(('int', method))
for method in iter_expected_methods:
try:
if not hasattr(iter([]), method):
not_implemented.append(('iter', method))
except NameError:
not_implemented.append(('iter', method))
for method in list_expected_methods:
try:
if not hasattr(list, method):
not_implemented.append(('list', method))
except NameError:
not_implemented.append(('list', method))
for method in memoryview_expected_methods:
not_implemented.append(('memoryview', method))
for method in range_expected_methods:
try:
if not hasattr(range, method):
not_implemented.append(('range', method))
except NameError:
not_implemented.append(('range', method))
for method in set_expected_methods:
try:
if not hasattr(set, method):
not_implemented.append(('set', method))
except NameError:
not_implemented.append(('set', method))
for method in string_expected_methods:
try:
if not hasattr(str, method):
not_implemented.append(('string', method))
except NameError:
not_implemented.append(('string', method))
for method in tuple_expected_methods:
try:
if not hasattr(tuple, method):
not_implemented.append(('tuple', method))
except NameError:
not_implemented.append(('tuple', method))
for method in object_expected_methods:
try:
if not hasattr(bool, method):
not_implemented.append(('object', method))
except NameError:
not_implemented.append(('object', method))
for r in not_implemented:
print(r[0], '.', r[1])
else:
print('Not much \\o/')
|
#the program calculates the average of numbers whose input is in the form of a string
def average():
numbers = str(input("Enter a string of numbers: "))
numbers = numbers.split()
numbers2 = []
total = 0
for number in numbers:
number = int(number)
total += number
numbers2.append(number)
avg = total // len(numbers2)
print(avg)
average()
|
def average():
numbers = str(input('Enter a string of numbers: '))
numbers = numbers.split()
numbers2 = []
total = 0
for number in numbers:
number = int(number)
total += number
numbers2.append(number)
avg = total // len(numbers2)
print(avg)
average()
|
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
num_dict = {}
for i, num in enumerate(nums):
n = target - num
if n not in num_dict:
num_dict[num] = i
else:
return [num_dict[n], i]
|
class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
num_dict = {}
for (i, num) in enumerate(nums):
n = target - num
if n not in num_dict:
num_dict[num] = i
else:
return [num_dict[n], i]
|
def pick_arr(arr, b):
nums = arr[:b]
idxsum = sum(nums)
maxsum = idxsum
for i in range(b):
remove = nums.pop()
add = arr.pop()
idxsum = idxsum - remove + add
maxsum = max(maxsum, idxsum)
return maxsum
print(pick_arr([5,-2,3,1,2], 3))
|
def pick_arr(arr, b):
nums = arr[:b]
idxsum = sum(nums)
maxsum = idxsum
for i in range(b):
remove = nums.pop()
add = arr.pop()
idxsum = idxsum - remove + add
maxsum = max(maxsum, idxsum)
return maxsum
print(pick_arr([5, -2, 3, 1, 2], 3))
|
#!/usr/bin/env python
# encoding: utf-8
class HashInterface(object):
@staticmethod
def hash(*arg):
pass
|
class Hashinterface(object):
@staticmethod
def hash(*arg):
pass
|
class Solution:
def solve(self, nums):
ans = [-1]*len(nums)
unmatched = []
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
heappush(unmatched, [nums[i], i])
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
return ans
|
class Solution:
def solve(self, nums):
ans = [-1] * len(nums)
unmatched = []
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
heappush(unmatched, [nums[i], i])
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
return ans
|
'''
Created on Aug 30, 2012
@author: philipkershaw
'''
|
"""
Created on Aug 30, 2012
@author: philipkershaw
"""
|
SETTINGS = {
'gee': {
'service_account': None,
'privatekey_file': None,
}
}
|
settings = {'gee': {'service_account': None, 'privatekey_file': None}}
|
def fibonacci(n):
"""
Def: In mathematics, the Fibonacci numbers are the numbers in the following
integer sequence, called the Fibonacci sequence, and characterized by the
fact that every number after the first two is the sum of the two preceding
ones: `0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...`
"""
fibonacci_sequence = [0, 1]
for i in range(0, n, 1):
next = fibonacci_sequence[i] + fibonacci_sequence[i + 1]
fibonacci_sequence.append(next)
return fibonacci_sequence[:-2]
|
def fibonacci(n):
"""
Def: In mathematics, the Fibonacci numbers are the numbers in the following
integer sequence, called the Fibonacci sequence, and characterized by the
fact that every number after the first two is the sum of the two preceding
ones: `0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...`
"""
fibonacci_sequence = [0, 1]
for i in range(0, n, 1):
next = fibonacci_sequence[i] + fibonacci_sequence[i + 1]
fibonacci_sequence.append(next)
return fibonacci_sequence[:-2]
|
# Fried Chicken Damage Skin
success = sm.addDamageSkin(2435960)
if success:
sm.chat("The Fried Chicken Damage Skin has been added to your account's damage skin collection.")
# sm.consumeItem(2435960)
|
success = sm.addDamageSkin(2435960)
if success:
sm.chat("The Fried Chicken Damage Skin has been added to your account's damage skin collection.")
|
# -*- coding: utf-8 -*-
# Tests for the different contrib/localflavor/ form fields.
localflavor_tests = r"""
# USZipCodeField ##############################################################
USZipCodeField validates that the data is either a five-digit U.S. zip code or
a zip+4.
>>> from django.contrib.localflavor.us.forms import USZipCodeField
>>> f = USZipCodeField()
>>> f.clean('60606')
u'60606'
>>> f.clean(60606)
u'60606'
>>> f.clean('04000')
u'04000'
>>> f.clean('4000')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean('60606-1234')
u'60606-1234'
>>> f.clean('6060-1234')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean('60606-')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = USZipCodeField(required=False)
>>> f.clean('60606')
u'60606'
>>> f.clean(60606)
u'60606'
>>> f.clean('04000')
u'04000'
>>> f.clean('4000')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean('60606-1234')
u'60606-1234'
>>> f.clean('6060-1234')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean('60606-')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# USPhoneNumberField ##########################################################
USPhoneNumberField validates that the data is a valid U.S. phone number,
including the area code. It's normalized to XXX-XXX-XXXX format.
>>> from django.contrib.localflavor.us.forms import USPhoneNumberField
>>> f = USPhoneNumberField()
>>> f.clean('312-555-1212')
u'312-555-1212'
>>> f.clean('3125551212')
u'312-555-1212'
>>> f.clean('312 555-1212')
u'312-555-1212'
>>> f.clean('(312) 555-1212')
u'312-555-1212'
>>> f.clean('312 555 1212')
u'312-555-1212'
>>> f.clean('312.555.1212')
u'312-555-1212'
>>> f.clean('312.555-1212')
u'312-555-1212'
>>> f.clean(' (312) 555.1212 ')
u'312-555-1212'
>>> f.clean('555-1212')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
>>> f.clean('312-55-1212')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = USPhoneNumberField(required=False)
>>> f.clean('312-555-1212')
u'312-555-1212'
>>> f.clean('3125551212')
u'312-555-1212'
>>> f.clean('312 555-1212')
u'312-555-1212'
>>> f.clean('(312) 555-1212')
u'312-555-1212'
>>> f.clean('312 555 1212')
u'312-555-1212'
>>> f.clean('312.555.1212')
u'312-555-1212'
>>> f.clean('312.555-1212')
u'312-555-1212'
>>> f.clean(' (312) 555.1212 ')
u'312-555-1212'
>>> f.clean('555-1212')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
>>> f.clean('312-55-1212')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# USStateField ################################################################
USStateField validates that the data is either an abbreviation or name of a
U.S. state.
>>> from django.contrib.localflavor.us.forms import USStateField
>>> f = USStateField()
>>> f.clean('il')
u'IL'
>>> f.clean('IL')
u'IL'
>>> f.clean('illinois')
u'IL'
>>> f.clean(' illinois ')
u'IL'
>>> f.clean(60606)
Traceback (most recent call last):
...
ValidationError: [u'Enter a U.S. state or territory.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = USStateField(required=False)
>>> f.clean('il')
u'IL'
>>> f.clean('IL')
u'IL'
>>> f.clean('illinois')
u'IL'
>>> f.clean(' illinois ')
u'IL'
>>> f.clean(60606)
Traceback (most recent call last):
...
ValidationError: [u'Enter a U.S. state or territory.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# USStateSelect ###############################################################
USStateSelect is a Select widget that uses a list of U.S. states/territories
as its choices.
>>> from django.contrib.localflavor.us.forms import USStateSelect
>>> w = USStateSelect()
>>> print w.render('state', 'IL')
<select name="state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AS">American Samoa</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FM">Federated States of Micronesia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="GU">Guam</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL" selected="selected">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MH">Marshall Islands</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="MP">Northern Mariana Islands</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PW">Palau</option>
<option value="PA">Pennsylvania</option>
<option value="PR">Puerto Rico</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VI">Virgin Islands</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
# USSocialSecurityNumberField #################################################
>>> from django.contrib.localflavor.us.forms import USSocialSecurityNumberField
>>> f = USSocialSecurityNumberField()
>>> f.clean('987-65-4330')
u'987-65-4330'
>>> f.clean('987654330')
u'987-65-4330'
>>> f.clean('078-05-1120')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.']
# UKPostcodeField #############################################################
UKPostcodeField validates that the data is a valid UK postcode.
>>> from django.contrib.localflavor.uk.forms import UKPostcodeField
>>> f = UKPostcodeField()
>>> f.clean('BT32 4PX')
u'BT32 4PX'
>>> f.clean('GIR 0AA')
u'GIR 0AA'
>>> f.clean('BT324PX')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
>>> f.clean('1NV 4L1D')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = UKPostcodeField(required=False)
>>> f.clean('BT32 4PX')
u'BT32 4PX'
>>> f.clean('GIR 0AA')
u'GIR 0AA'
>>> f.clean('1NV 4L1D')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
>>> f.clean('BT324PX')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# FRZipCodeField #############################################################
FRZipCodeField validates that the data is a valid FR zipcode.
>>> from django.contrib.localflavor.fr.forms import FRZipCodeField
>>> f = FRZipCodeField()
>>> f.clean('75001')
u'75001'
>>> f.clean('93200')
u'93200'
>>> f.clean('2A200')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean('980001')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = FRZipCodeField(required=False)
>>> f.clean('75001')
u'75001'
>>> f.clean('93200')
u'93200'
>>> f.clean('2A200')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean('980001')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# FRPhoneNumberField ##########################################################
FRPhoneNumberField validates that the data is a valid french phone number.
It's normalized to 0X XX XX XX XX format. Dots are valid too.
>>> from django.contrib.localflavor.fr.forms import FRPhoneNumberField
>>> f = FRPhoneNumberField()
>>> f.clean('01 55 44 58 64')
u'01 55 44 58 64'
>>> f.clean('0155445864')
u'01 55 44 58 64'
>>> f.clean('01 5544 5864')
u'01 55 44 58 64'
>>> f.clean('01 55.44.58.64')
u'01 55 44 58 64'
>>> f.clean('01.55.44.58.64')
u'01 55 44 58 64'
>>> f.clean('01,55,44,58,64')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
>>> f.clean('555 015 544')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = FRPhoneNumberField(required=False)
>>> f.clean('01 55 44 58 64')
u'01 55 44 58 64'
>>> f.clean('0155445864')
u'01 55 44 58 64'
>>> f.clean('01 5544 5864')
u'01 55 44 58 64'
>>> f.clean('01 55.44.58.64')
u'01 55 44 58 64'
>>> f.clean('01.55.44.58.64')
u'01 55 44 58 64'
>>> f.clean('01,55,44,58,64')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
>>> f.clean('555 015 544')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# FRDepartmentSelect ###############################################################
FRDepartmentSelect is a Select widget that uses a list of french departments
including DOM TOM
>>> from django.contrib.localflavor.fr.forms import FRDepartmentSelect
>>> w = FRDepartmentSelect()
>>> print w.render('dep', 'Paris')
<select name="dep">
<option value="01">01 - Ain</option>
<option value="02">02 - Aisne</option>
<option value="03">03 - Allier</option>
<option value="04">04 - Alpes-de-Haute-Provence</option>
<option value="05">05 - Hautes-Alpes</option>
<option value="06">06 - Alpes-Maritimes</option>
<option value="07">07 - Ardeche</option>
<option value="08">08 - Ardennes</option>
<option value="09">09 - Ariege</option>
<option value="10">10 - Aube</option>
<option value="11">11 - Aude</option>
<option value="12">12 - Aveyron</option>
<option value="13">13 - Bouches-du-Rhone</option>
<option value="14">14 - Calvados</option>
<option value="15">15 - Cantal</option>
<option value="16">16 - Charente</option>
<option value="17">17 - Charente-Maritime</option>
<option value="18">18 - Cher</option>
<option value="19">19 - Correze</option>
<option value="21">21 - Cote-d'Or</option>
<option value="22">22 - Cotes-d'Armor</option>
<option value="23">23 - Creuse</option>
<option value="24">24 - Dordogne</option>
<option value="25">25 - Doubs</option>
<option value="26">26 - Drome</option>
<option value="27">27 - Eure</option>
<option value="28">28 - Eure-et-Loire</option>
<option value="29">29 - Finistere</option>
<option value="2A">2A - Corse-du-Sud</option>
<option value="2B">2B - Haute-Corse</option>
<option value="30">30 - Gard</option>
<option value="31">31 - Haute-Garonne</option>
<option value="32">32 - Gers</option>
<option value="33">33 - Gironde</option>
<option value="34">34 - Herault</option>
<option value="35">35 - Ille-et-Vilaine</option>
<option value="36">36 - Indre</option>
<option value="37">37 - Indre-et-Loire</option>
<option value="38">38 - Isere</option>
<option value="39">39 - Jura</option>
<option value="40">40 - Landes</option>
<option value="41">41 - Loir-et-Cher</option>
<option value="42">42 - Loire</option>
<option value="43">43 - Haute-Loire</option>
<option value="44">44 - Loire-Atlantique</option>
<option value="45">45 - Loiret</option>
<option value="46">46 - Lot</option>
<option value="47">47 - Lot-et-Garonne</option>
<option value="48">48 - Lozere</option>
<option value="49">49 - Maine-et-Loire</option>
<option value="50">50 - Manche</option>
<option value="51">51 - Marne</option>
<option value="52">52 - Haute-Marne</option>
<option value="53">53 - Mayenne</option>
<option value="54">54 - Meurthe-et-Moselle</option>
<option value="55">55 - Meuse</option>
<option value="56">56 - Morbihan</option>
<option value="57">57 - Moselle</option>
<option value="58">58 - Nievre</option>
<option value="59">59 - Nord</option>
<option value="60">60 - Oise</option>
<option value="61">61 - Orne</option>
<option value="62">62 - Pas-de-Calais</option>
<option value="63">63 - Puy-de-Dome</option>
<option value="64">64 - Pyrenees-Atlantiques</option>
<option value="65">65 - Hautes-Pyrenees</option>
<option value="66">66 - Pyrenees-Orientales</option>
<option value="67">67 - Bas-Rhin</option>
<option value="68">68 - Haut-Rhin</option>
<option value="69">69 - Rhone</option>
<option value="70">70 - Haute-Saone</option>
<option value="71">71 - Saone-et-Loire</option>
<option value="72">72 - Sarthe</option>
<option value="73">73 - Savoie</option>
<option value="74">74 - Haute-Savoie</option>
<option value="75">75 - Paris</option>
<option value="76">76 - Seine-Maritime</option>
<option value="77">77 - Seine-et-Marne</option>
<option value="78">78 - Yvelines</option>
<option value="79">79 - Deux-Sevres</option>
<option value="80">80 - Somme</option>
<option value="81">81 - Tarn</option>
<option value="82">82 - Tarn-et-Garonne</option>
<option value="83">83 - Var</option>
<option value="84">84 - Vaucluse</option>
<option value="85">85 - Vendee</option>
<option value="86">86 - Vienne</option>
<option value="87">87 - Haute-Vienne</option>
<option value="88">88 - Vosges</option>
<option value="89">89 - Yonne</option>
<option value="90">90 - Territoire de Belfort</option>
<option value="91">91 - Essonne</option>
<option value="92">92 - Hauts-de-Seine</option>
<option value="93">93 - Seine-Saint-Denis</option>
<option value="94">94 - Val-de-Marne</option>
<option value="95">95 - Val-d'Oise</option>
<option value="2A">2A - Corse du sud</option>
<option value="2B">2B - Haute Corse</option>
<option value="971">971 - Guadeloupe</option>
<option value="972">972 - Martinique</option>
<option value="973">973 - Guyane</option>
<option value="974">974 - La Reunion</option>
<option value="975">975 - Saint-Pierre-et-Miquelon</option>
<option value="976">976 - Mayotte</option>
<option value="984">984 - Terres Australes et Antarctiques</option>
<option value="986">986 - Wallis et Futuna</option>
<option value="987">987 - Polynesie Francaise</option>
<option value="988">988 - Nouvelle-Caledonie</option>
</select>
# JPPostalCodeField ###############################################################
A form field that validates its input is a Japanese postcode.
Accepts 7 digits(with/out hyphen).
>>> from django.contrib.localflavor.jp.forms import JPPostalCodeField
>>> f = JPPostalCodeField()
>>> f.clean('251-0032')
u'2510032'
>>> f.clean('2510032')
u'2510032'
>>> f.clean('2510-032')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
>>> f.clean('251a0032')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
>>> f.clean('a51-0032')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
>>> f.clean('25100321')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = JPPostalCodeField(required=False)
>>> f.clean('251-0032')
u'2510032'
>>> f.clean('2510032')
u'2510032'
>>> f.clean('2510-032')
Traceback (most recent call last):
...
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
>>> f.clean('')
u''
>>> f.clean(None)
u''
# JPPrefectureSelect ###############################################################
A Select widget that uses a list of Japanese prefectures as its choices.
>>> from django.contrib.localflavor.jp.forms import JPPrefectureSelect
>>> w = JPPrefectureSelect()
>>> print w.render('prefecture', 'kanagawa')
<select name="prefecture">
<option value="hokkaido">Hokkaido</option>
<option value="aomori">Aomori</option>
<option value="iwate">Iwate</option>
<option value="miyagi">Miyagi</option>
<option value="akita">Akita</option>
<option value="yamagata">Yamagata</option>
<option value="fukushima">Fukushima</option>
<option value="ibaraki">Ibaraki</option>
<option value="tochigi">Tochigi</option>
<option value="gunma">Gunma</option>
<option value="saitama">Saitama</option>
<option value="chiba">Chiba</option>
<option value="tokyo">Tokyo</option>
<option value="kanagawa" selected="selected">Kanagawa</option>
<option value="yamanashi">Yamanashi</option>
<option value="nagano">Nagano</option>
<option value="niigata">Niigata</option>
<option value="toyama">Toyama</option>
<option value="ishikawa">Ishikawa</option>
<option value="fukui">Fukui</option>
<option value="gifu">Gifu</option>
<option value="shizuoka">Shizuoka</option>
<option value="aichi">Aichi</option>
<option value="mie">Mie</option>
<option value="shiga">Shiga</option>
<option value="kyoto">Kyoto</option>
<option value="osaka">Osaka</option>
<option value="hyogo">Hyogo</option>
<option value="nara">Nara</option>
<option value="wakayama">Wakayama</option>
<option value="tottori">Tottori</option>
<option value="shimane">Shimane</option>
<option value="okayama">Okayama</option>
<option value="hiroshima">Hiroshima</option>
<option value="yamaguchi">Yamaguchi</option>
<option value="tokushima">Tokushima</option>
<option value="kagawa">Kagawa</option>
<option value="ehime">Ehime</option>
<option value="kochi">Kochi</option>
<option value="fukuoka">Fukuoka</option>
<option value="saga">Saga</option>
<option value="nagasaki">Nagasaki</option>
<option value="kumamoto">Kumamoto</option>
<option value="oita">Oita</option>
<option value="miyazaki">Miyazaki</option>
<option value="kagoshima">Kagoshima</option>
<option value="okinawa">Okinawa</option>
</select>
# ITZipCodeField #############################################################
>>> from django.contrib.localflavor.it.forms import ITZipCodeField
>>> f = ITZipCodeField()
>>> f.clean('00100')
u'00100'
>>> f.clean(' 00100')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid zip code.']
# ITRegionSelect #############################################################
>>> from django.contrib.localflavor.it.forms import ITRegionSelect
>>> w = ITRegionSelect()
>>> w.render('regions', 'PMN')
u'<select name="regions">\n<option value="ABR">Abruzzo</option>\n<option value="BAS">Basilicata</option>\n<option value="CAL">Calabria</option>\n<option value="CAM">Campania</option>\n<option value="EMR">Emilia-Romagna</option>\n<option value="FVG">Friuli-Venezia Giulia</option>\n<option value="LAZ">Lazio</option>\n<option value="LIG">Liguria</option>\n<option value="LOM">Lombardia</option>\n<option value="MAR">Marche</option>\n<option value="MOL">Molise</option>\n<option value="PMN" selected="selected">Piemonte</option>\n<option value="PUG">Puglia</option>\n<option value="SAR">Sardegna</option>\n<option value="SIC">Sicilia</option>\n<option value="TOS">Toscana</option>\n<option value="TAA">Trentino-Alto Adige</option>\n<option value="UMB">Umbria</option>\n<option value="VAO">Valle d\u2019Aosta</option>\n<option value="VEN">Veneto</option>\n</select>'
# ITSocialSecurityNumberField #################################################
>>> from django.contrib.localflavor.it.forms import ITSocialSecurityNumberField
>>> f = ITSocialSecurityNumberField()
>>> f.clean('LVSGDU99T71H501L')
u'LVSGDU99T71H501L'
>>> f.clean('LBRRME11A01L736W')
u'LBRRME11A01L736W'
>>> f.clean('lbrrme11a01l736w')
u'LBRRME11A01L736W'
>>> f.clean('LBR RME 11A01 L736W')
u'LBRRME11A01L736W'
>>> f.clean('LBRRME11A01L736A')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Social Security number.']
>>> f.clean('%BRRME11A01L736W')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Social Security number.']
# ITVatNumberField ###########################################################
>>> from django.contrib.localflavor.it.forms import ITVatNumberField
>>> f = ITVatNumberField()
>>> f.clean('07973780013')
u'07973780013'
>>> f.clean('7973780013')
u'07973780013'
>>> f.clean(7973780013)
u'07973780013'
>>> f.clean('07973780014')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid VAT number.']
>>> f.clean('A7973780013')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid VAT number.']
# FIZipCodeField #############################################################
FIZipCodeField validates that the data is a valid FI zipcode.
>>> from django.contrib.localflavor.fi.forms import FIZipCodeField
>>> f = FIZipCodeField()
>>> f.clean('20540')
u'20540'
>>> f.clean('20101')
u'20101'
>>> f.clean('20s40')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean('205401')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = FIZipCodeField(required=False)
>>> f.clean('20540')
u'20540'
>>> f.clean('20101')
u'20101'
>>> f.clean('20s40')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean('205401')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
# FIMunicipalitySelect ###############################################################
A Select widget that uses a list of Finnish municipalities as its choices.
>>> from django.contrib.localflavor.fi.forms import FIMunicipalitySelect
>>> w = FIMunicipalitySelect()
>>> unicode(w.render('municipalities', 'turku'))
u'<select name="municipalities">\n<option value="akaa">Akaa</option>\n<option value="alaharma">Alah\xe4rm\xe4</option>\n<option value="alajarvi">Alaj\xe4rvi</option>\n<option value="alastaro">Alastaro</option>\n<option value="alavieska">Alavieska</option>\n<option value="alavus">Alavus</option>\n<option value="anjalankoski">Anjalankoski</option>\n<option value="artjarvi">Artj\xe4rvi</option>\n<option value="asikkala">Asikkala</option>\n<option value="askainen">Askainen</option>\n<option value="askola">Askola</option>\n<option value="aura">Aura</option>\n<option value="brando">Br\xe4nd\xf6</option>\n<option value="dragsfjard">Dragsfj\xe4rd</option>\n<option value="eckero">Ecker\xf6</option>\n<option value="elimaki">Elim\xe4ki</option>\n<option value="eno">Eno</option>\n<option value="enonkoski">Enonkoski</option>\n<option value="enontekio">Enonteki\xf6</option>\n<option value="espoo">Espoo</option>\n<option value="eura">Eura</option>\n<option value="eurajoki">Eurajoki</option>\n<option value="evijarvi">Evij\xe4rvi</option>\n<option value="finstrom">Finstr\xf6m</option>\n<option value="forssa">Forssa</option>\n<option value="foglo">F\xf6gl\xf6</option>\n<option value="geta">Geta</option>\n<option value="haapajarvi">Haapaj\xe4rvi</option>\n<option value="haapavesi">Haapavesi</option>\n<option value="hailuoto">Hailuoto</option>\n<option value="halikko">Halikko</option>\n<option value="halsua">Halsua</option>\n<option value="hamina">Hamina</option>\n<option value="hammarland">Hammarland</option>\n<option value="hankasalmi">Hankasalmi</option>\n<option value="hanko">Hanko</option>\n<option value="harjavalta">Harjavalta</option>\n<option value="hartola">Hartola</option>\n<option value="hattula">Hattula</option>\n<option value="hauho">Hauho</option>\n<option value="haukipudas">Haukipudas</option>\n<option value="hausjarvi">Hausj\xe4rvi</option>\n<option value="heinola">Heinola</option>\n<option value="heinavesi">Hein\xe4vesi</option>\n<option value="helsinki">Helsinki</option>\n<option value="himanka">Himanka</option>\n<option value="hirvensalmi">Hirvensalmi</option>\n<option value="hollola">Hollola</option>\n<option value="honkajoki">Honkajoki</option>\n<option value="houtskari">Houtskari</option>\n<option value="huittinen">Huittinen</option>\n<option value="humppila">Humppila</option>\n<option value="hyrynsalmi">Hyrynsalmi</option>\n<option value="hyvinkaa">Hyvink\xe4\xe4</option>\n<option value="hameenkoski">H\xe4meenkoski</option>\n<option value="hameenkyro">H\xe4meenkyr\xf6</option>\n<option value="hameenlinna">H\xe4meenlinna</option>\n<option value="ii">Ii</option>\n<option value="iisalmi">Iisalmi</option>\n<option value="iitti">Iitti</option>\n<option value="ikaalinen">Ikaalinen</option>\n<option value="ilmajoki">Ilmajoki</option>\n<option value="ilomantsi">Ilomantsi</option>\n<option value="imatra">Imatra</option>\n<option value="inari">Inari</option>\n<option value="inio">Ini\xf6</option>\n<option value="inkoo">Inkoo</option>\n<option value="isojoki">Isojoki</option>\n<option value="isokyro">Isokyr\xf6</option>\n<option value="jaala">Jaala</option>\n<option value="jalasjarvi">Jalasj\xe4rvi</option>\n<option value="janakkala">Janakkala</option>\n<option value="joensuu">Joensuu</option>\n<option value="jokioinen">Jokioinen</option>\n<option value="jomala">Jomala</option>\n<option value="joroinen">Joroinen</option>\n<option value="joutsa">Joutsa</option>\n<option value="joutseno">Joutseno</option>\n<option value="juankoski">Juankoski</option>\n<option value="jurva">Jurva</option>\n<option value="juuka">Juuka</option>\n<option value="juupajoki">Juupajoki</option>\n<option value="juva">Juva</option>\n<option value="jyvaskyla">Jyv\xe4skyl\xe4</option>\n<option value="jyvaskylan_mlk">Jyv\xe4skyl\xe4n maalaiskunta</option>\n<option value="jamijarvi">J\xe4mij\xe4rvi</option>\n<option value="jamsa">J\xe4ms\xe4</option>\n<option value="jamsankoski">J\xe4ms\xe4nkoski</option>\n<option value="jarvenpaa">J\xe4rvenp\xe4\xe4</option>\n<option value="kaarina">Kaarina</option>\n<option value="kaavi">Kaavi</option>\n<option value="kajaani">Kajaani</option>\n<option value="kalajoki">Kalajoki</option>\n<option value="kalvola">Kalvola</option>\n<option value="kangasala">Kangasala</option>\n<option value="kangasniemi">Kangasniemi</option>\n<option value="kankaanpaa">Kankaanp\xe4\xe4</option>\n<option value="kannonkoski">Kannonkoski</option>\n<option value="kannus">Kannus</option>\n<option value="karijoki">Karijoki</option>\n<option value="karjaa">Karjaa</option>\n<option value="karjalohja">Karjalohja</option>\n<option value="karkkila">Karkkila</option>\n<option value="karstula">Karstula</option>\n<option value="karttula">Karttula</option>\n<option value="karvia">Karvia</option>\n<option value="kaskinen">Kaskinen</option>\n<option value="kauhajoki">Kauhajoki</option>\n<option value="kauhava">Kauhava</option>\n<option value="kauniainen">Kauniainen</option>\n<option value="kaustinen">Kaustinen</option>\n<option value="keitele">Keitele</option>\n<option value="kemi">Kemi</option>\n<option value="kemijarvi">Kemij\xe4rvi</option>\n<option value="keminmaa">Keminmaa</option>\n<option value="kemio">Kemi\xf6</option>\n<option value="kempele">Kempele</option>\n<option value="kerava">Kerava</option>\n<option value="kerimaki">Kerim\xe4ki</option>\n<option value="kestila">Kestil\xe4</option>\n<option value="kesalahti">Kes\xe4lahti</option>\n<option value="keuruu">Keuruu</option>\n<option value="kihnio">Kihni\xf6</option>\n<option value="kiikala">Kiikala</option>\n<option value="kiikoinen">Kiikoinen</option>\n<option value="kiiminki">Kiiminki</option>\n<option value="kinnula">Kinnula</option>\n<option value="kirkkonummi">Kirkkonummi</option>\n<option value="kisko">Kisko</option>\n<option value="kitee">Kitee</option>\n<option value="kittila">Kittil\xe4</option>\n<option value="kiukainen">Kiukainen</option>\n<option value="kiuruvesi">Kiuruvesi</option>\n<option value="kivijarvi">Kivij\xe4rvi</option>\n<option value="kokemaki">Kokem\xe4ki</option>\n<option value="kokkola">Kokkola</option>\n<option value="kolari">Kolari</option>\n<option value="konnevesi">Konnevesi</option>\n<option value="kontiolahti">Kontiolahti</option>\n<option value="korpilahti">Korpilahti</option>\n<option value="korppoo">Korppoo</option>\n<option value="korsnas">Korsn\xe4s</option>\n<option value="kortesjarvi">Kortesj\xe4rvi</option>\n<option value="koskitl">KoskiTl</option>\n<option value="kotka">Kotka</option>\n<option value="kouvola">Kouvola</option>\n<option value="kristiinankaupunki">Kristiinankaupunki</option>\n<option value="kruunupyy">Kruunupyy</option>\n<option value="kuhmalahti">Kuhmalahti</option>\n<option value="kuhmo">Kuhmo</option>\n<option value="kuhmoinen">Kuhmoinen</option>\n<option value="kumlinge">Kumlinge</option>\n<option value="kuopio">Kuopio</option>\n<option value="kuortane">Kuortane</option>\n<option value="kurikka">Kurikka</option>\n<option value="kuru">Kuru</option>\n<option value="kustavi">Kustavi</option>\n<option value="kuusamo">Kuusamo</option>\n<option value="kuusankoski">Kuusankoski</option>\n<option value="kuusjoki">Kuusjoki</option>\n<option value="kylmakoski">Kylm\xe4koski</option>\n<option value="kyyjarvi">Kyyj\xe4rvi</option>\n<option value="kalvia">K\xe4lvi\xe4</option>\n<option value="karkola">K\xe4rk\xf6l\xe4</option>\n<option value="karsamaki">K\xe4rs\xe4m\xe4ki</option>\n<option value="kokar">K\xf6kar</option>\n<option value="koylio">K\xf6yli\xf6</option>\n<option value="lahti">Lahti</option>\n<option value="laihia">Laihia</option>\n<option value="laitila">Laitila</option>\n<option value="lammi">Lammi</option>\n<option value="lapinjarvi">Lapinj\xe4rvi</option>\n<option value="lapinlahti">Lapinlahti</option>\n<option value="lappajarvi">Lappaj\xe4rvi</option>\n<option value="lappeenranta">Lappeenranta</option>\n<option value="lappi">Lappi</option>\n<option value="lapua">Lapua</option>\n<option value="laukaa">Laukaa</option>\n<option value="lavia">Lavia</option>\n<option value="lehtimaki">Lehtim\xe4ki</option>\n<option value="leivonmaki">Leivonm\xe4ki</option>\n<option value="lemi">Lemi</option>\n<option value="lemland">Lemland</option>\n<option value="lempaala">Lemp\xe4\xe4l\xe4</option>\n<option value="lemu">Lemu</option>\n<option value="leppavirta">Lepp\xe4virta</option>\n<option value="lestijarvi">Lestij\xe4rvi</option>\n<option value="lieksa">Lieksa</option>\n<option value="lieto">Lieto</option>\n<option value="liljendal">Liljendal</option>\n<option value="liminka">Liminka</option>\n<option value="liperi">Liperi</option>\n<option value="lohja">Lohja</option>\n<option value="lohtaja">Lohtaja</option>\n<option value="loimaa">Loimaa</option>\n<option value="loppi">Loppi</option>\n<option value="loviisa">Loviisa</option>\n<option value="luhanka">Luhanka</option>\n<option value="lumijoki">Lumijoki</option>\n<option value="lumparland">Lumparland</option>\n<option value="luoto">Luoto</option>\n<option value="luumaki">Luum\xe4ki</option>\n<option value="luvia">Luvia</option>\n<option value="maalahti">Maalahti</option>\n<option value="maaninka">Maaninka</option>\n<option value="maarianhamina">Maarianhamina</option>\n<option value="marttila">Marttila</option>\n<option value="masku">Masku</option>\n<option value="mellila">Mellil\xe4</option>\n<option value="merijarvi">Merij\xe4rvi</option>\n<option value="merikarvia">Merikarvia</option>\n<option value="merimasku">Merimasku</option>\n<option value="miehikkala">Miehikk\xe4l\xe4</option>\n<option value="mikkeli">Mikkeli</option>\n<option value="mouhijarvi">Mouhij\xe4rvi</option>\n<option value="muhos">Muhos</option>\n<option value="multia">Multia</option>\n<option value="muonio">Muonio</option>\n<option value="mustasaari">Mustasaari</option>\n<option value="muurame">Muurame</option>\n<option value="muurla">Muurla</option>\n<option value="mynamaki">Myn\xe4m\xe4ki</option>\n<option value="myrskyla">Myrskyl\xe4</option>\n<option value="mantsala">M\xe4nts\xe4l\xe4</option>\n<option value="mantta">M\xe4ntt\xe4</option>\n<option value="mantyharju">M\xe4ntyharju</option>\n<option value="naantali">Naantali</option>\n<option value="nakkila">Nakkila</option>\n<option value="nastola">Nastola</option>\n<option value="nauvo">Nauvo</option>\n<option value="nilsia">Nilsi\xe4</option>\n<option value="nivala">Nivala</option>\n<option value="nokia">Nokia</option>\n<option value="noormarkku">Noormarkku</option>\n<option value="nousiainen">Nousiainen</option>\n<option value="nummi-pusula">Nummi-Pusula</option>\n<option value="nurmes">Nurmes</option>\n<option value="nurmijarvi">Nurmij\xe4rvi</option>\n<option value="nurmo">Nurmo</option>\n<option value="narpio">N\xe4rpi\xf6</option>\n<option value="oravainen">Oravainen</option>\n<option value="orimattila">Orimattila</option>\n<option value="oripaa">Orip\xe4\xe4</option>\n<option value="orivesi">Orivesi</option>\n<option value="oulainen">Oulainen</option>\n<option value="oulu">Oulu</option>\n<option value="oulunsalo">Oulunsalo</option>\n<option value="outokumpu">Outokumpu</option>\n<option value="padasjoki">Padasjoki</option>\n<option value="paimio">Paimio</option>\n<option value="paltamo">Paltamo</option>\n<option value="parainen">Parainen</option>\n<option value="parikkala">Parikkala</option>\n<option value="parkano">Parkano</option>\n<option value="pedersore">Peders\xf6re</option>\n<option value="pelkosenniemi">Pelkosenniemi</option>\n<option value="pello">Pello</option>\n<option value="perho">Perho</option>\n<option value="pernaja">Pernaja</option>\n<option value="pernio">Perni\xf6</option>\n<option value="pertteli">Pertteli</option>\n<option value="pertunmaa">Pertunmaa</option>\n<option value="petajavesi">Pet\xe4j\xe4vesi</option>\n<option value="pieksamaki">Pieks\xe4m\xe4ki</option>\n<option value="pielavesi">Pielavesi</option>\n<option value="pietarsaari">Pietarsaari</option>\n<option value="pihtipudas">Pihtipudas</option>\n<option value="piikkio">Piikki\xf6</option>\n<option value="piippola">Piippola</option>\n<option value="pirkkala">Pirkkala</option>\n<option value="pohja">Pohja</option>\n<option value="polvijarvi">Polvij\xe4rvi</option>\n<option value="pomarkku">Pomarkku</option>\n<option value="pori">Pori</option>\n<option value="pornainen">Pornainen</option>\n<option value="porvoo">Porvoo</option>\n<option value="posio">Posio</option>\n<option value="pudasjarvi">Pudasj\xe4rvi</option>\n<option value="pukkila">Pukkila</option>\n<option value="pulkkila">Pulkkila</option>\n<option value="punkaharju">Punkaharju</option>\n<option value="punkalaidun">Punkalaidun</option>\n<option value="puolanka">Puolanka</option>\n<option value="puumala">Puumala</option>\n<option value="pyhtaa">Pyht\xe4\xe4</option>\n<option value="pyhajoki">Pyh\xe4joki</option>\n<option value="pyhajarvi">Pyh\xe4j\xe4rvi</option>\n<option value="pyhanta">Pyh\xe4nt\xe4</option>\n<option value="pyharanta">Pyh\xe4ranta</option>\n<option value="pyhaselka">Pyh\xe4selk\xe4</option>\n<option value="pylkonmaki">Pylk\xf6nm\xe4ki</option>\n<option value="palkane">P\xe4lk\xe4ne</option>\n<option value="poytya">P\xf6yty\xe4</option>\n<option value="raahe">Raahe</option>\n<option value="raisio">Raisio</option>\n<option value="rantasalmi">Rantasalmi</option>\n<option value="rantsila">Rantsila</option>\n<option value="ranua">Ranua</option>\n<option value="rauma">Rauma</option>\n<option value="rautalampi">Rautalampi</option>\n<option value="rautavaara">Rautavaara</option>\n<option value="rautjarvi">Rautj\xe4rvi</option>\n<option value="reisjarvi">Reisj\xe4rvi</option>\n<option value="renko">Renko</option>\n<option value="riihimaki">Riihim\xe4ki</option>\n<option value="ristiina">Ristiina</option>\n<option value="ristijarvi">Ristij\xe4rvi</option>\n<option value="rovaniemi">Rovaniemi</option>\n<option value="ruokolahti">Ruokolahti</option>\n<option value="ruotsinpyhtaa">Ruotsinpyht\xe4\xe4</option>\n<option value="ruovesi">Ruovesi</option>\n<option value="rusko">Rusko</option>\n<option value="rymattyla">Rym\xe4ttyl\xe4</option>\n<option value="raakkyla">R\xe4\xe4kkyl\xe4</option>\n<option value="saarijarvi">Saarij\xe4rvi</option>\n<option value="salla">Salla</option>\n<option value="salo">Salo</option>\n<option value="saltvik">Saltvik</option>\n<option value="sammatti">Sammatti</option>\n<option value="sauvo">Sauvo</option>\n<option value="savitaipale">Savitaipale</option>\n<option value="savonlinna">Savonlinna</option>\n<option value="savonranta">Savonranta</option>\n<option value="savukoski">Savukoski</option>\n<option value="seinajoki">Sein\xe4joki</option>\n<option value="sievi">Sievi</option>\n<option value="siikainen">Siikainen</option>\n<option value="siikajoki">Siikajoki</option>\n<option value="siilinjarvi">Siilinj\xe4rvi</option>\n<option value="simo">Simo</option>\n<option value="sipoo">Sipoo</option>\n<option value="siuntio">Siuntio</option>\n<option value="sodankyla">Sodankyl\xe4</option>\n<option value="soini">Soini</option>\n<option value="somero">Somero</option>\n<option value="sonkajarvi">Sonkaj\xe4rvi</option>\n<option value="sotkamo">Sotkamo</option>\n<option value="sottunga">Sottunga</option>\n<option value="sulkava">Sulkava</option>\n<option value="sund">Sund</option>\n<option value="suomenniemi">Suomenniemi</option>\n<option value="suomusjarvi">Suomusj\xe4rvi</option>\n<option value="suomussalmi">Suomussalmi</option>\n<option value="suonenjoki">Suonenjoki</option>\n<option value="sysma">Sysm\xe4</option>\n<option value="sakyla">S\xe4kyl\xe4</option>\n<option value="sarkisalo">S\xe4rkisalo</option>\n<option value="taipalsaari">Taipalsaari</option>\n<option value="taivalkoski">Taivalkoski</option>\n<option value="taivassalo">Taivassalo</option>\n<option value="tammela">Tammela</option>\n<option value="tammisaari">Tammisaari</option>\n<option value="tampere">Tampere</option>\n<option value="tarvasjoki">Tarvasjoki</option>\n<option value="tervo">Tervo</option>\n<option value="tervola">Tervola</option>\n<option value="teuva">Teuva</option>\n<option value="tohmajarvi">Tohmaj\xe4rvi</option>\n<option value="toholampi">Toholampi</option>\n<option value="toivakka">Toivakka</option>\n<option value="tornio">Tornio</option>\n<option value="turku" selected="selected">Turku</option>\n<option value="tuulos">Tuulos</option>\n<option value="tuusniemi">Tuusniemi</option>\n<option value="tuusula">Tuusula</option>\n<option value="tyrnava">Tyrn\xe4v\xe4</option>\n<option value="toysa">T\xf6ys\xe4</option>\n<option value="ullava">Ullava</option>\n<option value="ulvila">Ulvila</option>\n<option value="urjala">Urjala</option>\n<option value="utajarvi">Utaj\xe4rvi</option>\n<option value="utsjoki">Utsjoki</option>\n<option value="uurainen">Uurainen</option>\n<option value="uusikaarlepyy">Uusikaarlepyy</option>\n<option value="uusikaupunki">Uusikaupunki</option>\n<option value="vaala">Vaala</option>\n<option value="vaasa">Vaasa</option>\n<option value="vahto">Vahto</option>\n<option value="valkeakoski">Valkeakoski</option>\n<option value="valkeala">Valkeala</option>\n<option value="valtimo">Valtimo</option>\n<option value="vammala">Vammala</option>\n<option value="vampula">Vampula</option>\n<option value="vantaa">Vantaa</option>\n<option value="varkaus">Varkaus</option>\n<option value="varpaisjarvi">Varpaisj\xe4rvi</option>\n<option value="vehmaa">Vehmaa</option>\n<option value="velkua">Velkua</option>\n<option value="vesanto">Vesanto</option>\n<option value="vesilahti">Vesilahti</option>\n<option value="veteli">Veteli</option>\n<option value="vierema">Vierem\xe4</option>\n<option value="vihanti">Vihanti</option>\n<option value="vihti">Vihti</option>\n<option value="viitasaari">Viitasaari</option>\n<option value="vilppula">Vilppula</option>\n<option value="vimpeli">Vimpeli</option>\n<option value="virolahti">Virolahti</option>\n<option value="virrat">Virrat</option>\n<option value="vardo">V\xe5rd\xf6</option>\n<option value="vahakyro">V\xe4h\xe4kyr\xf6</option>\n<option value="vastanfjard">V\xe4stanfj\xe4rd</option>\n<option value="voyri-maksamaa">V\xf6yri-Maksamaa</option>\n<option value="yliharma">Ylih\xe4rm\xe4</option>\n<option value="yli-ii">Yli-Ii</option>\n<option value="ylikiiminki">Ylikiiminki</option>\n<option value="ylistaro">Ylistaro</option>\n<option value="ylitornio">Ylitornio</option>\n<option value="ylivieska">Ylivieska</option>\n<option value="ylamaa">Yl\xe4maa</option>\n<option value="ylane">Yl\xe4ne</option>\n<option value="ylojarvi">Yl\xf6j\xe4rvi</option>\n<option value="ypaja">Yp\xe4j\xe4</option>\n<option value="aetsa">\xc4ets\xe4</option>\n<option value="ahtari">\xc4ht\xe4ri</option>\n<option value="aanekoski">\xc4\xe4nekoski</option>\n</select>'
# FISocialSecurityNumber
##############################################################
>>> from django.contrib.localflavor.fi.forms import FISocialSecurityNumber
>>> f = FISocialSecurityNumber()
>>> f.clean('010101-0101')
u'010101-0101'
>>> f.clean('010101+0101')
u'010101+0101'
>>> f.clean('010101A0101')
u'010101A0101'
>>> f.clean('101010-0102')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Finnish social security number.']
>>> f.clean('10a010-0101')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Finnish social security number.']
>>> f.clean('101010-0\xe401')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Finnish social security number.']
>>> f.clean('101010b0101')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Finnish social security number.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = FISocialSecurityNumber(required=False)
>>> f.clean('010101-0101')
u'010101-0101'
>>> f.clean(None)
u''
>>> f.clean('')
u''
# BRZipCodeField ############################################################
>>> from django.contrib.localflavor.br.forms import BRZipCodeField
>>> f = BRZipCodeField()
>>> f.clean('12345-123')
u'12345-123'
>>> f.clean('12345_123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('1234-123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('abcde-abc')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('12345-')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('-123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = BRZipCodeField(required=False)
>>> f.clean(None)
u''
>>> f.clean('')
u''
>>> f.clean('-123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('12345-')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('abcde-abc')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('1234-123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('12345_123')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX-XXX.']
>>> f.clean('12345-123')
u'12345-123'
# BRCNPJField ############################################################
>>> from django.contrib.localflavor.br.forms import BRCNPJField
>>> f = BRCNPJField(required=True)
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('12-345-678/9012-10')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('12.345.678/9012-10')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('12345678/9012-10')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CNPJ number.']
>>> f.clean('64.132.916/0001-88')
'64.132.916/0001-88'
>>> f.clean('64-132-916/0001-88')
'64-132-916/0001-88'
>>> f.clean('64132916/0001-88')
'64132916/0001-88'
>>> f.clean('64.132.916/0001-XX')
Traceback (most recent call last):
...
ValidationError: [u'This field requires only numbers.']
>>> f = BRCNPJField(required=False)
>>> f.clean('')
u''
# BRCPFField #################################################################
>>> from django.contrib.localflavor.br.forms import BRCPFField
>>> f = BRCPFField()
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('489.294.654-54')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CPF number.']
>>> f.clean('295.669.575-98')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CPF number.']
>>> f.clean('539.315.127-22')
Traceback (most recent call last):
...
ValidationError: [u'Invalid CPF number.']
>>> f.clean('663.256.017-26')
u'663.256.017-26'
>>> f.clean('66325601726')
u'66325601726'
>>> f.clean('375.788.573-20')
u'375.788.573-20'
>>> f.clean('84828509895')
u'84828509895'
>>> f.clean('375.788.573-XX')
Traceback (most recent call last):
...
ValidationError: [u'This field requires only numbers.']
>>> f.clean('375.788.573-000')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at most 14 characters.']
>>> f.clean('123.456.78')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at least 11 characters.']
>>> f.clean('123456789555')
Traceback (most recent call last):
...
ValidationError: [u'This field requires at most 11 digits or 14 characters.']
>>> f = BRCPFField(required=False)
>>> f.clean('')
u''
>>> f.clean(None)
u''
# BRPhoneNumberField #########################################################
>>> from django.contrib.localflavor.br.forms import BRPhoneNumberField
>>> f = BRPhoneNumberField()
>>> f.clean('41-3562-3464')
u'41-3562-3464'
>>> f.clean('4135623464')
u'41-3562-3464'
>>> f.clean('41 3562-3464')
u'41-3562-3464'
>>> f.clean('41 3562 3464')
u'41-3562-3464'
>>> f.clean('(41) 3562 3464')
u'41-3562-3464'
>>> f.clean('41.3562.3464')
u'41-3562-3464'
>>> f.clean('41.3562-3464')
u'41-3562-3464'
>>> f.clean(' (41) 3562.3464')
u'41-3562-3464'
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = BRPhoneNumberField(required=False)
>>> f.clean('')
u''
>>> f.clean(None)
u''
>>> f.clean(' (41) 3562.3464')
u'41-3562-3464'
>>> f.clean('41.3562-3464')
u'41-3562-3464'
>>> f.clean('(41) 3562 3464')
u'41-3562-3464'
>>> f.clean('4135623464')
u'41-3562-3464'
>>> f.clean('41 3562-3464')
u'41-3562-3464'
# BRStateSelect ##############################################################
>>> from django.contrib.localflavor.br.forms import BRStateSelect
>>> w = BRStateSelect()
>>> w.render('states', 'PR')
u'<select name="states">\n<option value="AC">Acre</option>\n<option value="AL">Alagoas</option>\n<option value="AP">Amap\xe1</option>\n<option value="AM">Amazonas</option>\n<option value="BA">Bahia</option>\n<option value="CE">Cear\xe1</option>\n<option value="DF">Distrito Federal</option>\n<option value="ES">Esp\xedrito Santo</option>\n<option value="GO">Goi\xe1s</option>\n<option value="MA">Maranh\xe3o</option>\n<option value="MT">Mato Grosso</option>\n<option value="MS">Mato Grosso do Sul</option>\n<option value="MG">Minas Gerais</option>\n<option value="PA">Par\xe1</option>\n<option value="PB">Para\xedba</option>\n<option value="PR" selected="selected">Paran\xe1</option>\n<option value="PE">Pernambuco</option>\n<option value="PI">Piau\xed</option>\n<option value="RJ">Rio de Janeiro</option>\n<option value="RN">Rio Grande do Norte</option>\n<option value="RS">Rio Grande do Sul</option>\n<option value="RO">Rond\xf4nia</option>\n<option value="RR">Roraima</option>\n<option value="SC">Santa Catarina</option>\n<option value="SP">S\xe3o Paulo</option>\n<option value="SE">Sergipe</option>\n<option value="TO">Tocantins</option>\n</select>'
# DEZipCodeField ##############################################################
>>> from django.contrib.localflavor.de.forms import DEZipCodeField
>>> f = DEZipCodeField()
>>> f.clean('99423')
u'99423'
>>> f.clean(' 99423')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXXX.']
# DEStateSelect #############################################################
>>> from django.contrib.localflavor.de.forms import DEStateSelect
>>> w = DEStateSelect()
>>> w.render('states', 'TH')
u'<select name="states">\n<option value="BW">Baden-Wuerttemberg</option>\n<option value="BY">Bavaria</option>\n<option value="BE">Berlin</option>\n<option value="BB">Brandenburg</option>\n<option value="HB">Bremen</option>\n<option value="HH">Hamburg</option>\n<option value="HE">Hessen</option>\n<option value="MV">Mecklenburg-Western Pomerania</option>\n<option value="NI">Lower Saxony</option>\n<option value="NW">North Rhine-Westphalia</option>\n<option value="RP">Rhineland-Palatinate</option>\n<option value="SL">Saarland</option>\n<option value="SN">Saxony</option>\n<option value="ST">Saxony-Anhalt</option>\n<option value="SH">Schleswig-Holstein</option>\n<option value="TH" selected="selected">Thuringia</option>\n</select>'
# DEIdentityCardNumberField #################################################
>>> from django.contrib.localflavor.de.forms import DEIdentityCardNumberField
>>> f = DEIdentityCardNumberField()
>>> f.clean('7549313035D-6004103-0903042-0')
u'7549313035D-6004103-0903042-0'
>>> f.clean('9786324830D 6104243 0910271 2')
u'9786324830D-6104243-0910271-2'
>>> f.clean('0434657485D-6407276-0508137-9')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.']
# CHZipCodeField ############################################################
>>> from django.contrib.localflavor.ch.forms import CHZipCodeField
>>> f = CHZipCodeField()
>>> f.clean('800x')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXX.']
>>> f.clean('80 00')
Traceback (most recent call last):
...
ValidationError: [u'Enter a zip code in the format XXXX.']
>>> f.clean('8000')
u'8000'
# CHPhoneNumberField ########################################################
>>> from django.contrib.localflavor.ch.forms import CHPhoneNumberField
>>> f = CHPhoneNumberField()
>>> f.clean('01234567890')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0XX XXX XX XX format.']
>>> f.clean('1234567890')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must be in 0XX XXX XX XX format.']
>>> f.clean('0123456789')
u'012 345 67 89'
# CHIdentityCardNumberField #################################################
>>> from django.contrib.localflavor.ch.forms import CHIdentityCardNumberField
>>> f = CHIdentityCardNumberField()
>>> f.clean('C1234567<0')
u'C1234567<0'
>>> f.clean('C1234567<1')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.']
>>> f.clean('2123456700')
u'2123456700'
>>> f.clean('2123456701')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.']
# CHStateSelect #############################################################
>>> from django.contrib.localflavor.ch.forms import CHStateSelect
>>> w = CHStateSelect()
>>> w.render('state', 'AG')
u'<select name="state">\n<option value="AG" selected="selected">Aargau</option>\n<option value="AI">Appenzell Innerrhoden</option>\n<option value="AR">Appenzell Ausserrhoden</option>\n<option value="BS">Basel-Stadt</option>\n<option value="BL">Basel-Land</option>\n<option value="BE">Berne</option>\n<option value="FR">Fribourg</option>\n<option value="GE">Geneva</option>\n<option value="GL">Glarus</option>\n<option value="GR">Graubuenden</option>\n<option value="JU">Jura</option>\n<option value="LU">Lucerne</option>\n<option value="NE">Neuchatel</option>\n<option value="NW">Nidwalden</option>\n<option value="OW">Obwalden</option>\n<option value="SH">Schaffhausen</option>\n<option value="SZ">Schwyz</option>\n<option value="SO">Solothurn</option>\n<option value="SG">St. Gallen</option>\n<option value="TG">Thurgau</option>\n<option value="TI">Ticino</option>\n<option value="UR">Uri</option>\n<option value="VS">Valais</option>\n<option value="VD">Vaud</option>\n<option value="ZG">Zug</option>\n<option value="ZH">Zurich</option>\n</select>'
## AUPostCodeField ##########################################################
A field that accepts a four digit Australian post code.
>>> from django.contrib.localflavor.au.forms import AUPostCodeField
>>> f = AUPostCodeField()
>>> f.clean('1234')
u'1234'
>>> f.clean('2000')
u'2000'
>>> f.clean('abcd')
Traceback (most recent call last):
...
ValidationError: [u'Enter a 4 digit post code.']
>>> f.clean('20001')
Traceback (most recent call last):
...
ValidationError: [u'Enter a 4 digit post code.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = AUPostCodeField(required=False)
>>> f.clean('1234')
u'1234'
>>> f.clean('2000')
u'2000'
>>> f.clean('abcd')
Traceback (most recent call last):
...
ValidationError: [u'Enter a 4 digit post code.']
>>> f.clean('20001')
Traceback (most recent call last):
...
ValidationError: [u'Enter a 4 digit post code.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
## AUPhoneNumberField ########################################################
A field that accepts a 10 digit Australian phone number.
llows spaces and parentheses around area code.
>>> from django.contrib.localflavor.au.forms import AUPhoneNumberField
>>> f = AUPhoneNumberField()
>>> f.clean('1234567890')
u'1234567890'
>>> f.clean('0213456789')
u'0213456789'
>>> f.clean('02 13 45 67 89')
u'0213456789'
>>> f.clean('(02) 1345 6789')
u'0213456789'
>>> f.clean('(02) 1345-6789')
u'0213456789'
>>> f.clean('(02)1345-6789')
u'0213456789'
>>> f.clean('0408 123 456')
u'0408123456'
>>> f.clean('123')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must contain 10 digits.']
>>> f.clean('1800DJANGO')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must contain 10 digits.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = AUPhoneNumberField(required=False)
>>> f.clean('1234567890')
u'1234567890'
>>> f.clean('0213456789')
u'0213456789'
>>> f.clean('02 13 45 67 89')
u'0213456789'
>>> f.clean('(02) 1345 6789')
u'0213456789'
>>> f.clean('(02) 1345-6789')
u'0213456789'
>>> f.clean('(02)1345-6789')
u'0213456789'
>>> f.clean('0408 123 456')
u'0408123456'
>>> f.clean('123')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must contain 10 digits.']
>>> f.clean('1800DJANGO')
Traceback (most recent call last):
...
ValidationError: [u'Phone numbers must contain 10 digits.']
>>> f.clean(None)
u''
>>> f.clean('')
u''
## AUStateSelect #############################################################
AUStateSelect is a Select widget that uses a list of Australian
states/territories as its choices.
>>> from django.contrib.localflavor.au.forms import AUStateSelect
>>> f = AUStateSelect()
>>> print f.render('state', 'NSW')
<select name="state">
<option value="ACT">Australian Capital Territory</option>
<option value="NSW" selected="selected">New South Wales</option>
<option value="NT">Northern Territory</option>
<option value="QLD">Queensland</option>
<option value="SA">South Australia</option>
<option value="TAS">Tasmania</option>
<option value="VIC">Victoria</option>
<option value="WA">Western Australia</option>
</select>
## ISIdNumberField #############################################################
>>> from django.contrib.localflavor.is_.forms import *
>>> f = ISIdNumberField()
>>> f.clean('2308803449')
u'230880-3449'
>>> f.clean('230880-3449')
u'230880-3449'
>>> f.clean('230880 3449')
u'230880-3449'
>>> f.clean('230880343')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at least 10 characters.']
>>> f.clean('230880343234')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at most 11 characters.']
>>> f.clean('abcdefghijk')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean('2308803439')
Traceback (most recent call last):
...
ValidationError: [u'The Icelandic identification number is not valid.']
>>> f.clean('2308803440')
u'230880-3440'
>>> f = ISIdNumberField(required=False)
>>> f.clean(None)
u''
>>> f.clean('')
u''
## ISPhoneNumberField #############################################################
>>> from django.contrib.localflavor.is_.forms import *
>>> f = ISPhoneNumberField()
>>> f.clean('1234567')
u'1234567'
>>> f.clean('123 4567')
u'1234567'
>>> f.clean('123-4567')
u'1234567'
>>> f.clean('123-456')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid value.']
>>> f.clean('123456')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at least 7 characters.']
>>> f.clean('123456555')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at most 8 characters.']
>>> f.clean('abcdefg')
Traceback (most recent call last):
ValidationError: [u'Enter a valid value.']
>>> f.clean(' 1234567 ')
Traceback (most recent call last):
...
ValidationError: [u'Ensure this value has at most 8 characters.']
>>> f.clean(' 12367 ')
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid value.']
>>> f.clean('')
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f.clean(None)
Traceback (most recent call last):
...
ValidationError: [u'This field is required.']
>>> f = ISPhoneNumberField(required=False)
>>> f.clean(None)
u''
>>> f.clean('')
u''
## ISPostalCodeSelect #############################################################
>>> from django.contrib.localflavor.is_.forms import *
>>> f = ISPostalCodeSelect()
>>> f.render('foo', 'bar')
u'<select name="foo">\n<option value="101">101 Reykjav\xedk</option>\n<option value="103">103 Reykjav\xedk</option>\n<option value="104">104 Reykjav\xedk</option>\n<option value="105">105 Reykjav\xedk</option>\n<option value="107">107 Reykjav\xedk</option>\n<option value="108">108 Reykjav\xedk</option>\n<option value="109">109 Reykjav\xedk</option>\n<option value="110">110 Reykjav\xedk</option>\n<option value="111">111 Reykjav\xedk</option>\n<option value="112">112 Reykjav\xedk</option>\n<option value="113">113 Reykjav\xedk</option>\n<option value="116">116 Kjalarnes</option>\n<option value="121">121 Reykjav\xedk</option>\n<option value="123">123 Reykjav\xedk</option>\n<option value="124">124 Reykjav\xedk</option>\n<option value="125">125 Reykjav\xedk</option>\n<option value="127">127 Reykjav\xedk</option>\n<option value="128">128 Reykjav\xedk</option>\n<option value="129">129 Reykjav\xedk</option>\n<option value="130">130 Reykjav\xedk</option>\n<option value="132">132 Reykjav\xedk</option>\n<option value="150">150 Reykjav\xedk</option>\n<option value="155">155 Reykjav\xedk</option>\n<option value="170">170 Seltjarnarnes</option>\n<option value="172">172 Seltjarnarnes</option>\n<option value="190">190 Vogar</option>\n<option value="200">200 K\xf3pavogur</option>\n<option value="201">201 K\xf3pavogur</option>\n<option value="202">202 K\xf3pavogur</option>\n<option value="203">203 K\xf3pavogur</option>\n<option value="210">210 Gar\xf0ab\xe6r</option>\n<option value="212">212 Gar\xf0ab\xe6r</option>\n<option value="220">220 Hafnarfj\xf6r\xf0ur</option>\n<option value="221">221 Hafnarfj\xf6r\xf0ur</option>\n<option value="222">222 Hafnarfj\xf6r\xf0ur</option>\n<option value="225">225 \xc1lftanes</option>\n<option value="230">230 Reykjanesb\xe6r</option>\n<option value="232">232 Reykjanesb\xe6r</option>\n<option value="233">233 Reykjanesb\xe6r</option>\n<option value="235">235 Keflav\xedkurflugv\xf6llur</option>\n<option value="240">240 Grindav\xedk</option>\n<option value="245">245 Sandger\xf0i</option>\n<option value="250">250 Gar\xf0ur</option>\n<option value="260">260 Reykjanesb\xe6r</option>\n<option value="270">270 Mosfellsb\xe6r</option>\n<option value="300">300 Akranes</option>\n<option value="301">301 Akranes</option>\n<option value="302">302 Akranes</option>\n<option value="310">310 Borgarnes</option>\n<option value="311">311 Borgarnes</option>\n<option value="320">320 Reykholt \xed Borgarfir\xf0i</option>\n<option value="340">340 Stykkish\xf3lmur</option>\n<option value="345">345 Flatey \xe1 Brei\xf0afir\xf0i</option>\n<option value="350">350 Grundarfj\xf6r\xf0ur</option>\n<option value="355">355 \xd3lafsv\xedk</option>\n<option value="356">356 Sn\xe6fellsb\xe6r</option>\n<option value="360">360 Hellissandur</option>\n<option value="370">370 B\xfa\xf0ardalur</option>\n<option value="371">371 B\xfa\xf0ardalur</option>\n<option value="380">380 Reykh\xf3lahreppur</option>\n<option value="400">400 \xcdsafj\xf6r\xf0ur</option>\n<option value="401">401 \xcdsafj\xf6r\xf0ur</option>\n<option value="410">410 Hn\xedfsdalur</option>\n<option value="415">415 Bolungarv\xedk</option>\n<option value="420">420 S\xfa\xf0av\xedk</option>\n<option value="425">425 Flateyri</option>\n<option value="430">430 Su\xf0ureyri</option>\n<option value="450">450 Patreksfj\xf6r\xf0ur</option>\n<option value="451">451 Patreksfj\xf6r\xf0ur</option>\n<option value="460">460 T\xe1lknafj\xf6r\xf0ur</option>\n<option value="465">465 B\xedldudalur</option>\n<option value="470">470 \xdeingeyri</option>\n<option value="471">471 \xdeingeyri</option>\n<option value="500">500 Sta\xf0ur</option>\n<option value="510">510 H\xf3lmav\xedk</option>\n<option value="512">512 H\xf3lmav\xedk</option>\n<option value="520">520 Drangsnes</option>\n<option value="522">522 Kj\xf6rvogur</option>\n<option value="523">523 B\xe6r</option>\n<option value="524">524 Nor\xf0urfj\xf6r\xf0ur</option>\n<option value="530">530 Hvammstangi</option>\n<option value="531">531 Hvammstangi</option>\n<option value="540">540 Bl\xf6ndu\xf3s</option>\n<option value="541">541 Bl\xf6ndu\xf3s</option>\n<option value="545">545 Skagastr\xf6nd</option>\n<option value="550">550 Sau\xf0\xe1rkr\xf3kur</option>\n<option value="551">551 Sau\xf0\xe1rkr\xf3kur</option>\n<option value="560">560 Varmahl\xed\xf0</option>\n<option value="565">565 Hofs\xf3s</option>\n<option value="566">566 Hofs\xf3s</option>\n<option value="570">570 Flj\xf3t</option>\n<option value="580">580 Siglufj\xf6r\xf0ur</option>\n<option value="600">600 Akureyri</option>\n<option value="601">601 Akureyri</option>\n<option value="602">602 Akureyri</option>\n<option value="603">603 Akureyri</option>\n<option value="610">610 Greniv\xedk</option>\n<option value="611">611 Gr\xedmsey</option>\n<option value="620">620 Dalv\xedk</option>\n<option value="621">621 Dalv\xedk</option>\n<option value="625">625 \xd3lafsfj\xf6r\xf0ur</option>\n<option value="630">630 Hr\xedsey</option>\n<option value="640">640 H\xfasav\xedk</option>\n<option value="641">641 H\xfasav\xedk</option>\n<option value="645">645 Fossh\xf3ll</option>\n<option value="650">650 Laugar</option>\n<option value="660">660 M\xfdvatn</option>\n<option value="670">670 K\xf3pasker</option>\n<option value="671">671 K\xf3pasker</option>\n<option value="675">675 Raufarh\xf6fn</option>\n<option value="680">680 \xde\xf3rsh\xf6fn</option>\n<option value="681">681 \xde\xf3rsh\xf6fn</option>\n<option value="685">685 Bakkafj\xf6r\xf0ur</option>\n<option value="690">690 Vopnafj\xf6r\xf0ur</option>\n<option value="700">700 Egilssta\xf0ir</option>\n<option value="701">701 Egilssta\xf0ir</option>\n<option value="710">710 Sey\xf0isfj\xf6r\xf0ur</option>\n<option value="715">715 Mj\xf3ifj\xf6r\xf0ur</option>\n<option value="720">720 Borgarfj\xf6r\xf0ur eystri</option>\n<option value="730">730 Rey\xf0arfj\xf6r\xf0ur</option>\n<option value="735">735 Eskifj\xf6r\xf0ur</option>\n<option value="740">740 Neskaupsta\xf0ur</option>\n<option value="750">750 F\xe1skr\xfa\xf0sfj\xf6r\xf0ur</option>\n<option value="755">755 St\xf6\xf0varfj\xf6r\xf0ur</option>\n<option value="760">760 Brei\xf0dalsv\xedk</option>\n<option value="765">765 Dj\xfapivogur</option>\n<option value="780">780 H\xf6fn \xed Hornafir\xf0i</option>\n<option value="781">781 H\xf6fn \xed Hornafir\xf0i</option>\n<option value="785">785 \xd6r\xe6fi</option>\n<option value="800">800 Selfoss</option>\n<option value="801">801 Selfoss</option>\n<option value="802">802 Selfoss</option>\n<option value="810">810 Hverager\xf0i</option>\n<option value="815">815 \xdeorl\xe1ksh\xf6fn</option>\n<option value="820">820 Eyrarbakki</option>\n<option value="825">825 Stokkseyri</option>\n<option value="840">840 Laugarvatn</option>\n<option value="845">845 Fl\xfa\xf0ir</option>\n<option value="850">850 Hella</option>\n<option value="851">851 Hella</option>\n<option value="860">860 Hvolsv\xf6llur</option>\n<option value="861">861 Hvolsv\xf6llur</option>\n<option value="870">870 V\xedk</option>\n<option value="871">871 V\xedk</option>\n<option value="880">880 Kirkjub\xe6jarklaustur</option>\n<option value="900">900 Vestmannaeyjar</option>\n<option value="902">902 Vestmannaeyjar</option>\n</select>'
## CLRutField #############################################################
CLRutField is a Field that checks the validity of the Chilean
personal identification number (RUT). It has two modes relaxed (default) and
strict.
>>> from django.contrib.localflavor.cl.forms import CLRutField
>>> rut = CLRutField()
>>> rut.clean('11-6')
'11-6'
>>> rut.clean('116')
'11-6'
# valid format, bad verifier.
>>> rut.clean('11.111.111-0')
Traceback (most recent call last):
...
ValidationError: [u'The Chilean RUT is not valid.']
>>> rut.clean('111')
Traceback (most recent call last):
...
ValidationError: [u'The Chilean RUT is not valid.']
>>> rut.clean('767484100')
'76.748.410-0'
>>> rut.clean('78.412.790-7')
'78.412.790-7'
>>> rut.clean('8.334.6043')
'8.334.604-3'
>>> rut.clean('76793310-K')
'76.793.310-K'
Strict RUT usage (does not allow imposible values)
>>> rut = CLRutField(strict=True)
>>> rut.clean('11-6')
Traceback (most recent call last):
...
ValidationError: [u'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.']
# valid format, bad verifier.
>>> rut.clean('11.111.111-0')
Traceback (most recent call last):
...
ValidationError: [u'The Chilean RUT is not valid.']
# Correct input, invalid format.
>>> rut.clean('767484100')
Traceback (most recent call last):
...
ValidationError: [u'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.']
>>> rut.clean('78.412.790-7')
'78.412.790-7'
>>> rut.clean('8.334.6043')
Traceback (most recent call last):
...
ValidationError: [u'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.']
>>> rut.clean('76793310-K')
Traceback (most recent call last):
...
ValidationError: [u'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.']
"""
|
localflavor_tests = '\n# USZipCodeField ##############################################################\n\nUSZipCodeField validates that the data is either a five-digit U.S. zip code or\na zip+4.\n>>> from django.contrib.localflavor.us.forms import USZipCodeField\n>>> f = USZipCodeField()\n>>> f.clean(\'60606\')\nu\'60606\'\n>>> f.clean(60606)\nu\'60606\'\n>>> f.clean(\'04000\')\nu\'04000\'\n>>> f.clean(\'4000\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(\'60606-1234\')\nu\'60606-1234\'\n>>> f.clean(\'6060-1234\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(\'60606-\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = USZipCodeField(required=False)\n>>> f.clean(\'60606\')\nu\'60606\'\n>>> f.clean(60606)\nu\'60606\'\n>>> f.clean(\'04000\')\nu\'04000\'\n>>> f.clean(\'4000\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(\'60606-1234\')\nu\'60606-1234\'\n>>> f.clean(\'6060-1234\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(\'60606-\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX or XXXXX-XXXX.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# USPhoneNumberField ##########################################################\n\nUSPhoneNumberField validates that the data is a valid U.S. phone number,\nincluding the area code. It\'s normalized to XXX-XXX-XXXX format.\n>>> from django.contrib.localflavor.us.forms import USPhoneNumberField\n>>> f = USPhoneNumberField()\n>>> f.clean(\'312-555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'3125551212\')\nu\'312-555-1212\'\n>>> f.clean(\'312 555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'(312) 555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312 555 1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312.555.1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312.555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\' (312) 555.1212 \')\nu\'312-555-1212\'\n>>> f.clean(\'555-1212\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in XXX-XXX-XXXX format.\']\n>>> f.clean(\'312-55-1212\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in XXX-XXX-XXXX format.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = USPhoneNumberField(required=False)\n>>> f.clean(\'312-555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'3125551212\')\nu\'312-555-1212\'\n>>> f.clean(\'312 555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'(312) 555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312 555 1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312.555.1212\')\nu\'312-555-1212\'\n>>> f.clean(\'312.555-1212\')\nu\'312-555-1212\'\n>>> f.clean(\' (312) 555.1212 \')\nu\'312-555-1212\'\n>>> f.clean(\'555-1212\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in XXX-XXX-XXXX format.\']\n>>> f.clean(\'312-55-1212\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in XXX-XXX-XXXX format.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# USStateField ################################################################\n\nUSStateField validates that the data is either an abbreviation or name of a\nU.S. state.\n>>> from django.contrib.localflavor.us.forms import USStateField\n>>> f = USStateField()\n>>> f.clean(\'il\')\nu\'IL\'\n>>> f.clean(\'IL\')\nu\'IL\'\n>>> f.clean(\'illinois\')\nu\'IL\'\n>>> f.clean(\' illinois \')\nu\'IL\'\n>>> f.clean(60606)\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a U.S. state or territory.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = USStateField(required=False)\n>>> f.clean(\'il\')\nu\'IL\'\n>>> f.clean(\'IL\')\nu\'IL\'\n>>> f.clean(\'illinois\')\nu\'IL\'\n>>> f.clean(\' illinois \')\nu\'IL\'\n>>> f.clean(60606)\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a U.S. state or territory.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# USStateSelect ###############################################################\n\nUSStateSelect is a Select widget that uses a list of U.S. states/territories\nas its choices.\n>>> from django.contrib.localflavor.us.forms import USStateSelect\n>>> w = USStateSelect()\n>>> print w.render(\'state\', \'IL\')\n<select name="state">\n<option value="AL">Alabama</option>\n<option value="AK">Alaska</option>\n<option value="AS">American Samoa</option>\n<option value="AZ">Arizona</option>\n<option value="AR">Arkansas</option>\n<option value="CA">California</option>\n<option value="CO">Colorado</option>\n<option value="CT">Connecticut</option>\n<option value="DE">Delaware</option>\n<option value="DC">District of Columbia</option>\n<option value="FM">Federated States of Micronesia</option>\n<option value="FL">Florida</option>\n<option value="GA">Georgia</option>\n<option value="GU">Guam</option>\n<option value="HI">Hawaii</option>\n<option value="ID">Idaho</option>\n<option value="IL" selected="selected">Illinois</option>\n<option value="IN">Indiana</option>\n<option value="IA">Iowa</option>\n<option value="KS">Kansas</option>\n<option value="KY">Kentucky</option>\n<option value="LA">Louisiana</option>\n<option value="ME">Maine</option>\n<option value="MH">Marshall Islands</option>\n<option value="MD">Maryland</option>\n<option value="MA">Massachusetts</option>\n<option value="MI">Michigan</option>\n<option value="MN">Minnesota</option>\n<option value="MS">Mississippi</option>\n<option value="MO">Missouri</option>\n<option value="MT">Montana</option>\n<option value="NE">Nebraska</option>\n<option value="NV">Nevada</option>\n<option value="NH">New Hampshire</option>\n<option value="NJ">New Jersey</option>\n<option value="NM">New Mexico</option>\n<option value="NY">New York</option>\n<option value="NC">North Carolina</option>\n<option value="ND">North Dakota</option>\n<option value="MP">Northern Mariana Islands</option>\n<option value="OH">Ohio</option>\n<option value="OK">Oklahoma</option>\n<option value="OR">Oregon</option>\n<option value="PW">Palau</option>\n<option value="PA">Pennsylvania</option>\n<option value="PR">Puerto Rico</option>\n<option value="RI">Rhode Island</option>\n<option value="SC">South Carolina</option>\n<option value="SD">South Dakota</option>\n<option value="TN">Tennessee</option>\n<option value="TX">Texas</option>\n<option value="UT">Utah</option>\n<option value="VT">Vermont</option>\n<option value="VI">Virgin Islands</option>\n<option value="VA">Virginia</option>\n<option value="WA">Washington</option>\n<option value="WV">West Virginia</option>\n<option value="WI">Wisconsin</option>\n<option value="WY">Wyoming</option>\n</select>\n\n# USSocialSecurityNumberField #################################################\n>>> from django.contrib.localflavor.us.forms import USSocialSecurityNumberField\n>>> f = USSocialSecurityNumberField()\n>>> f.clean(\'987-65-4330\')\nu\'987-65-4330\'\n>>> f.clean(\'987654330\')\nu\'987-65-4330\'\n>>> f.clean(\'078-05-1120\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.\']\n\n# UKPostcodeField #############################################################\n\nUKPostcodeField validates that the data is a valid UK postcode.\n>>> from django.contrib.localflavor.uk.forms import UKPostcodeField\n>>> f = UKPostcodeField()\n>>> f.clean(\'BT32 4PX\')\nu\'BT32 4PX\'\n>>> f.clean(\'GIR 0AA\')\nu\'GIR 0AA\'\n>>> f.clean(\'BT324PX\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postcode. A space is required between the two postcode parts.\']\n>>> f.clean(\'1NV 4L1D\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postcode. A space is required between the two postcode parts.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = UKPostcodeField(required=False)\n>>> f.clean(\'BT32 4PX\')\nu\'BT32 4PX\'\n>>> f.clean(\'GIR 0AA\')\nu\'GIR 0AA\'\n>>> f.clean(\'1NV 4L1D\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postcode. A space is required between the two postcode parts.\']\n>>> f.clean(\'BT324PX\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postcode. A space is required between the two postcode parts.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# FRZipCodeField #############################################################\n\nFRZipCodeField validates that the data is a valid FR zipcode.\n>>> from django.contrib.localflavor.fr.forms import FRZipCodeField\n>>> f = FRZipCodeField()\n>>> f.clean(\'75001\')\nu\'75001\'\n>>> f.clean(\'93200\')\nu\'93200\'\n>>> f.clean(\'2A200\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(\'980001\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = FRZipCodeField(required=False)\n>>> f.clean(\'75001\')\nu\'75001\'\n>>> f.clean(\'93200\')\nu\'93200\'\n>>> f.clean(\'2A200\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(\'980001\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n\n# FRPhoneNumberField ##########################################################\n\nFRPhoneNumberField validates that the data is a valid french phone number.\nIt\'s normalized to 0X XX XX XX XX format. Dots are valid too.\n>>> from django.contrib.localflavor.fr.forms import FRPhoneNumberField\n>>> f = FRPhoneNumberField()\n>>> f.clean(\'01 55 44 58 64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'0155445864\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01 5544 5864\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01 55.44.58.64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01.55.44.58.64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01,55,44,58,64\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0X XX XX XX XX format.\']\n>>> f.clean(\'555 015 544\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0X XX XX XX XX format.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = FRPhoneNumberField(required=False)\n>>> f.clean(\'01 55 44 58 64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'0155445864\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01 5544 5864\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01 55.44.58.64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01.55.44.58.64\')\nu\'01 55 44 58 64\'\n>>> f.clean(\'01,55,44,58,64\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0X XX XX XX XX format.\']\n>>> f.clean(\'555 015 544\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0X XX XX XX XX format.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# FRDepartmentSelect ###############################################################\n\nFRDepartmentSelect is a Select widget that uses a list of french departments\nincluding DOM TOM\n>>> from django.contrib.localflavor.fr.forms import FRDepartmentSelect\n>>> w = FRDepartmentSelect()\n>>> print w.render(\'dep\', \'Paris\')\n<select name="dep">\n<option value="01">01 - Ain</option>\n<option value="02">02 - Aisne</option>\n<option value="03">03 - Allier</option>\n<option value="04">04 - Alpes-de-Haute-Provence</option>\n<option value="05">05 - Hautes-Alpes</option>\n<option value="06">06 - Alpes-Maritimes</option>\n<option value="07">07 - Ardeche</option>\n<option value="08">08 - Ardennes</option>\n<option value="09">09 - Ariege</option>\n<option value="10">10 - Aube</option>\n<option value="11">11 - Aude</option>\n<option value="12">12 - Aveyron</option>\n<option value="13">13 - Bouches-du-Rhone</option>\n<option value="14">14 - Calvados</option>\n<option value="15">15 - Cantal</option>\n<option value="16">16 - Charente</option>\n<option value="17">17 - Charente-Maritime</option>\n<option value="18">18 - Cher</option>\n<option value="19">19 - Correze</option>\n<option value="21">21 - Cote-d'Or</option>\n<option value="22">22 - Cotes-d'Armor</option>\n<option value="23">23 - Creuse</option>\n<option value="24">24 - Dordogne</option>\n<option value="25">25 - Doubs</option>\n<option value="26">26 - Drome</option>\n<option value="27">27 - Eure</option>\n<option value="28">28 - Eure-et-Loire</option>\n<option value="29">29 - Finistere</option>\n<option value="2A">2A - Corse-du-Sud</option>\n<option value="2B">2B - Haute-Corse</option>\n<option value="30">30 - Gard</option>\n<option value="31">31 - Haute-Garonne</option>\n<option value="32">32 - Gers</option>\n<option value="33">33 - Gironde</option>\n<option value="34">34 - Herault</option>\n<option value="35">35 - Ille-et-Vilaine</option>\n<option value="36">36 - Indre</option>\n<option value="37">37 - Indre-et-Loire</option>\n<option value="38">38 - Isere</option>\n<option value="39">39 - Jura</option>\n<option value="40">40 - Landes</option>\n<option value="41">41 - Loir-et-Cher</option>\n<option value="42">42 - Loire</option>\n<option value="43">43 - Haute-Loire</option>\n<option value="44">44 - Loire-Atlantique</option>\n<option value="45">45 - Loiret</option>\n<option value="46">46 - Lot</option>\n<option value="47">47 - Lot-et-Garonne</option>\n<option value="48">48 - Lozere</option>\n<option value="49">49 - Maine-et-Loire</option>\n<option value="50">50 - Manche</option>\n<option value="51">51 - Marne</option>\n<option value="52">52 - Haute-Marne</option>\n<option value="53">53 - Mayenne</option>\n<option value="54">54 - Meurthe-et-Moselle</option>\n<option value="55">55 - Meuse</option>\n<option value="56">56 - Morbihan</option>\n<option value="57">57 - Moselle</option>\n<option value="58">58 - Nievre</option>\n<option value="59">59 - Nord</option>\n<option value="60">60 - Oise</option>\n<option value="61">61 - Orne</option>\n<option value="62">62 - Pas-de-Calais</option>\n<option value="63">63 - Puy-de-Dome</option>\n<option value="64">64 - Pyrenees-Atlantiques</option>\n<option value="65">65 - Hautes-Pyrenees</option>\n<option value="66">66 - Pyrenees-Orientales</option>\n<option value="67">67 - Bas-Rhin</option>\n<option value="68">68 - Haut-Rhin</option>\n<option value="69">69 - Rhone</option>\n<option value="70">70 - Haute-Saone</option>\n<option value="71">71 - Saone-et-Loire</option>\n<option value="72">72 - Sarthe</option>\n<option value="73">73 - Savoie</option>\n<option value="74">74 - Haute-Savoie</option>\n<option value="75">75 - Paris</option>\n<option value="76">76 - Seine-Maritime</option>\n<option value="77">77 - Seine-et-Marne</option>\n<option value="78">78 - Yvelines</option>\n<option value="79">79 - Deux-Sevres</option>\n<option value="80">80 - Somme</option>\n<option value="81">81 - Tarn</option>\n<option value="82">82 - Tarn-et-Garonne</option>\n<option value="83">83 - Var</option>\n<option value="84">84 - Vaucluse</option>\n<option value="85">85 - Vendee</option>\n<option value="86">86 - Vienne</option>\n<option value="87">87 - Haute-Vienne</option>\n<option value="88">88 - Vosges</option>\n<option value="89">89 - Yonne</option>\n<option value="90">90 - Territoire de Belfort</option>\n<option value="91">91 - Essonne</option>\n<option value="92">92 - Hauts-de-Seine</option>\n<option value="93">93 - Seine-Saint-Denis</option>\n<option value="94">94 - Val-de-Marne</option>\n<option value="95">95 - Val-d'Oise</option>\n<option value="2A">2A - Corse du sud</option>\n<option value="2B">2B - Haute Corse</option>\n<option value="971">971 - Guadeloupe</option>\n<option value="972">972 - Martinique</option>\n<option value="973">973 - Guyane</option>\n<option value="974">974 - La Reunion</option>\n<option value="975">975 - Saint-Pierre-et-Miquelon</option>\n<option value="976">976 - Mayotte</option>\n<option value="984">984 - Terres Australes et Antarctiques</option>\n<option value="986">986 - Wallis et Futuna</option>\n<option value="987">987 - Polynesie Francaise</option>\n<option value="988">988 - Nouvelle-Caledonie</option>\n</select>\n\n# JPPostalCodeField ###############################################################\n\nA form field that validates its input is a Japanese postcode.\n\nAccepts 7 digits(with/out hyphen).\n>>> from django.contrib.localflavor.jp.forms import JPPostalCodeField\n>>> f = JPPostalCodeField()\n>>> f.clean(\'251-0032\')\nu\'2510032\'\n>>> f.clean(\'2510032\')\nu\'2510032\'\n>>> f.clean(\'2510-032\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postal code in the format XXXXXXX or XXX-XXXX.\']\n>>> f.clean(\'251a0032\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postal code in the format XXXXXXX or XXX-XXXX.\']\n>>> f.clean(\'a51-0032\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postal code in the format XXXXXXX or XXX-XXXX.\']\n>>> f.clean(\'25100321\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postal code in the format XXXXXXX or XXX-XXXX.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = JPPostalCodeField(required=False)\n>>> f.clean(\'251-0032\')\nu\'2510032\'\n>>> f.clean(\'2510032\')\nu\'2510032\'\n>>> f.clean(\'2510-032\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a postal code in the format XXXXXXX or XXX-XXXX.\']\n>>> f.clean(\'\')\nu\'\'\n>>> f.clean(None)\nu\'\'\n\n# JPPrefectureSelect ###############################################################\n\nA Select widget that uses a list of Japanese prefectures as its choices.\n>>> from django.contrib.localflavor.jp.forms import JPPrefectureSelect\n>>> w = JPPrefectureSelect()\n>>> print w.render(\'prefecture\', \'kanagawa\')\n<select name="prefecture">\n<option value="hokkaido">Hokkaido</option>\n<option value="aomori">Aomori</option>\n<option value="iwate">Iwate</option>\n<option value="miyagi">Miyagi</option>\n<option value="akita">Akita</option>\n<option value="yamagata">Yamagata</option>\n<option value="fukushima">Fukushima</option>\n<option value="ibaraki">Ibaraki</option>\n<option value="tochigi">Tochigi</option>\n<option value="gunma">Gunma</option>\n<option value="saitama">Saitama</option>\n<option value="chiba">Chiba</option>\n<option value="tokyo">Tokyo</option>\n<option value="kanagawa" selected="selected">Kanagawa</option>\n<option value="yamanashi">Yamanashi</option>\n<option value="nagano">Nagano</option>\n<option value="niigata">Niigata</option>\n<option value="toyama">Toyama</option>\n<option value="ishikawa">Ishikawa</option>\n<option value="fukui">Fukui</option>\n<option value="gifu">Gifu</option>\n<option value="shizuoka">Shizuoka</option>\n<option value="aichi">Aichi</option>\n<option value="mie">Mie</option>\n<option value="shiga">Shiga</option>\n<option value="kyoto">Kyoto</option>\n<option value="osaka">Osaka</option>\n<option value="hyogo">Hyogo</option>\n<option value="nara">Nara</option>\n<option value="wakayama">Wakayama</option>\n<option value="tottori">Tottori</option>\n<option value="shimane">Shimane</option>\n<option value="okayama">Okayama</option>\n<option value="hiroshima">Hiroshima</option>\n<option value="yamaguchi">Yamaguchi</option>\n<option value="tokushima">Tokushima</option>\n<option value="kagawa">Kagawa</option>\n<option value="ehime">Ehime</option>\n<option value="kochi">Kochi</option>\n<option value="fukuoka">Fukuoka</option>\n<option value="saga">Saga</option>\n<option value="nagasaki">Nagasaki</option>\n<option value="kumamoto">Kumamoto</option>\n<option value="oita">Oita</option>\n<option value="miyazaki">Miyazaki</option>\n<option value="kagoshima">Kagoshima</option>\n<option value="okinawa">Okinawa</option>\n</select>\n\n# ITZipCodeField #############################################################\n\n>>> from django.contrib.localflavor.it.forms import ITZipCodeField\n>>> f = ITZipCodeField()\n>>> f.clean(\'00100\')\nu\'00100\'\n>>> f.clean(\' 00100\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid zip code.\']\n\n# ITRegionSelect #############################################################\n\n>>> from django.contrib.localflavor.it.forms import ITRegionSelect\n>>> w = ITRegionSelect()\n>>> w.render(\'regions\', \'PMN\')\nu\'<select name="regions">\\n<option value="ABR">Abruzzo</option>\\n<option value="BAS">Basilicata</option>\\n<option value="CAL">Calabria</option>\\n<option value="CAM">Campania</option>\\n<option value="EMR">Emilia-Romagna</option>\\n<option value="FVG">Friuli-Venezia Giulia</option>\\n<option value="LAZ">Lazio</option>\\n<option value="LIG">Liguria</option>\\n<option value="LOM">Lombardia</option>\\n<option value="MAR">Marche</option>\\n<option value="MOL">Molise</option>\\n<option value="PMN" selected="selected">Piemonte</option>\\n<option value="PUG">Puglia</option>\\n<option value="SAR">Sardegna</option>\\n<option value="SIC">Sicilia</option>\\n<option value="TOS">Toscana</option>\\n<option value="TAA">Trentino-Alto Adige</option>\\n<option value="UMB">Umbria</option>\\n<option value="VAO">Valle d\\u2019Aosta</option>\\n<option value="VEN">Veneto</option>\\n</select>\'\n\n# ITSocialSecurityNumberField #################################################\n\n>>> from django.contrib.localflavor.it.forms import ITSocialSecurityNumberField\n>>> f = ITSocialSecurityNumberField()\n>>> f.clean(\'LVSGDU99T71H501L\')\nu\'LVSGDU99T71H501L\'\n>>> f.clean(\'LBRRME11A01L736W\')\nu\'LBRRME11A01L736W\'\n>>> f.clean(\'lbrrme11a01l736w\')\nu\'LBRRME11A01L736W\'\n>>> f.clean(\'LBR RME 11A01 L736W\')\nu\'LBRRME11A01L736W\'\n>>> f.clean(\'LBRRME11A01L736A\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Social Security number.\']\n>>> f.clean(\'%BRRME11A01L736W\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Social Security number.\']\n\n# ITVatNumberField ###########################################################\n\n>>> from django.contrib.localflavor.it.forms import ITVatNumberField\n>>> f = ITVatNumberField()\n>>> f.clean(\'07973780013\')\nu\'07973780013\'\n>>> f.clean(\'7973780013\')\nu\'07973780013\'\n>>> f.clean(7973780013)\nu\'07973780013\'\n>>> f.clean(\'07973780014\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid VAT number.\']\n>>> f.clean(\'A7973780013\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid VAT number.\']\n\n# FIZipCodeField #############################################################\n\nFIZipCodeField validates that the data is a valid FI zipcode.\n>>> from django.contrib.localflavor.fi.forms import FIZipCodeField\n>>> f = FIZipCodeField()\n>>> f.clean(\'20540\')\nu\'20540\'\n>>> f.clean(\'20101\')\nu\'20101\'\n>>> f.clean(\'20s40\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(\'205401\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = FIZipCodeField(required=False)\n>>> f.clean(\'20540\')\nu\'20540\'\n>>> f.clean(\'20101\')\nu\'20101\'\n>>> f.clean(\'20s40\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(\'205401\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# FIMunicipalitySelect ###############################################################\n\nA Select widget that uses a list of Finnish municipalities as its choices.\n>>> from django.contrib.localflavor.fi.forms import FIMunicipalitySelect\n>>> w = FIMunicipalitySelect()\n>>> unicode(w.render(\'municipalities\', \'turku\'))\nu\'<select name="municipalities">\\n<option value="akaa">Akaa</option>\\n<option value="alaharma">Alah\\xe4rm\\xe4</option>\\n<option value="alajarvi">Alaj\\xe4rvi</option>\\n<option value="alastaro">Alastaro</option>\\n<option value="alavieska">Alavieska</option>\\n<option value="alavus">Alavus</option>\\n<option value="anjalankoski">Anjalankoski</option>\\n<option value="artjarvi">Artj\\xe4rvi</option>\\n<option value="asikkala">Asikkala</option>\\n<option value="askainen">Askainen</option>\\n<option value="askola">Askola</option>\\n<option value="aura">Aura</option>\\n<option value="brando">Br\\xe4nd\\xf6</option>\\n<option value="dragsfjard">Dragsfj\\xe4rd</option>\\n<option value="eckero">Ecker\\xf6</option>\\n<option value="elimaki">Elim\\xe4ki</option>\\n<option value="eno">Eno</option>\\n<option value="enonkoski">Enonkoski</option>\\n<option value="enontekio">Enonteki\\xf6</option>\\n<option value="espoo">Espoo</option>\\n<option value="eura">Eura</option>\\n<option value="eurajoki">Eurajoki</option>\\n<option value="evijarvi">Evij\\xe4rvi</option>\\n<option value="finstrom">Finstr\\xf6m</option>\\n<option value="forssa">Forssa</option>\\n<option value="foglo">F\\xf6gl\\xf6</option>\\n<option value="geta">Geta</option>\\n<option value="haapajarvi">Haapaj\\xe4rvi</option>\\n<option value="haapavesi">Haapavesi</option>\\n<option value="hailuoto">Hailuoto</option>\\n<option value="halikko">Halikko</option>\\n<option value="halsua">Halsua</option>\\n<option value="hamina">Hamina</option>\\n<option value="hammarland">Hammarland</option>\\n<option value="hankasalmi">Hankasalmi</option>\\n<option value="hanko">Hanko</option>\\n<option value="harjavalta">Harjavalta</option>\\n<option value="hartola">Hartola</option>\\n<option value="hattula">Hattula</option>\\n<option value="hauho">Hauho</option>\\n<option value="haukipudas">Haukipudas</option>\\n<option value="hausjarvi">Hausj\\xe4rvi</option>\\n<option value="heinola">Heinola</option>\\n<option value="heinavesi">Hein\\xe4vesi</option>\\n<option value="helsinki">Helsinki</option>\\n<option value="himanka">Himanka</option>\\n<option value="hirvensalmi">Hirvensalmi</option>\\n<option value="hollola">Hollola</option>\\n<option value="honkajoki">Honkajoki</option>\\n<option value="houtskari">Houtskari</option>\\n<option value="huittinen">Huittinen</option>\\n<option value="humppila">Humppila</option>\\n<option value="hyrynsalmi">Hyrynsalmi</option>\\n<option value="hyvinkaa">Hyvink\\xe4\\xe4</option>\\n<option value="hameenkoski">H\\xe4meenkoski</option>\\n<option value="hameenkyro">H\\xe4meenkyr\\xf6</option>\\n<option value="hameenlinna">H\\xe4meenlinna</option>\\n<option value="ii">Ii</option>\\n<option value="iisalmi">Iisalmi</option>\\n<option value="iitti">Iitti</option>\\n<option value="ikaalinen">Ikaalinen</option>\\n<option value="ilmajoki">Ilmajoki</option>\\n<option value="ilomantsi">Ilomantsi</option>\\n<option value="imatra">Imatra</option>\\n<option value="inari">Inari</option>\\n<option value="inio">Ini\\xf6</option>\\n<option value="inkoo">Inkoo</option>\\n<option value="isojoki">Isojoki</option>\\n<option value="isokyro">Isokyr\\xf6</option>\\n<option value="jaala">Jaala</option>\\n<option value="jalasjarvi">Jalasj\\xe4rvi</option>\\n<option value="janakkala">Janakkala</option>\\n<option value="joensuu">Joensuu</option>\\n<option value="jokioinen">Jokioinen</option>\\n<option value="jomala">Jomala</option>\\n<option value="joroinen">Joroinen</option>\\n<option value="joutsa">Joutsa</option>\\n<option value="joutseno">Joutseno</option>\\n<option value="juankoski">Juankoski</option>\\n<option value="jurva">Jurva</option>\\n<option value="juuka">Juuka</option>\\n<option value="juupajoki">Juupajoki</option>\\n<option value="juva">Juva</option>\\n<option value="jyvaskyla">Jyv\\xe4skyl\\xe4</option>\\n<option value="jyvaskylan_mlk">Jyv\\xe4skyl\\xe4n maalaiskunta</option>\\n<option value="jamijarvi">J\\xe4mij\\xe4rvi</option>\\n<option value="jamsa">J\\xe4ms\\xe4</option>\\n<option value="jamsankoski">J\\xe4ms\\xe4nkoski</option>\\n<option value="jarvenpaa">J\\xe4rvenp\\xe4\\xe4</option>\\n<option value="kaarina">Kaarina</option>\\n<option value="kaavi">Kaavi</option>\\n<option value="kajaani">Kajaani</option>\\n<option value="kalajoki">Kalajoki</option>\\n<option value="kalvola">Kalvola</option>\\n<option value="kangasala">Kangasala</option>\\n<option value="kangasniemi">Kangasniemi</option>\\n<option value="kankaanpaa">Kankaanp\\xe4\\xe4</option>\\n<option value="kannonkoski">Kannonkoski</option>\\n<option value="kannus">Kannus</option>\\n<option value="karijoki">Karijoki</option>\\n<option value="karjaa">Karjaa</option>\\n<option value="karjalohja">Karjalohja</option>\\n<option value="karkkila">Karkkila</option>\\n<option value="karstula">Karstula</option>\\n<option value="karttula">Karttula</option>\\n<option value="karvia">Karvia</option>\\n<option value="kaskinen">Kaskinen</option>\\n<option value="kauhajoki">Kauhajoki</option>\\n<option value="kauhava">Kauhava</option>\\n<option value="kauniainen">Kauniainen</option>\\n<option value="kaustinen">Kaustinen</option>\\n<option value="keitele">Keitele</option>\\n<option value="kemi">Kemi</option>\\n<option value="kemijarvi">Kemij\\xe4rvi</option>\\n<option value="keminmaa">Keminmaa</option>\\n<option value="kemio">Kemi\\xf6</option>\\n<option value="kempele">Kempele</option>\\n<option value="kerava">Kerava</option>\\n<option value="kerimaki">Kerim\\xe4ki</option>\\n<option value="kestila">Kestil\\xe4</option>\\n<option value="kesalahti">Kes\\xe4lahti</option>\\n<option value="keuruu">Keuruu</option>\\n<option value="kihnio">Kihni\\xf6</option>\\n<option value="kiikala">Kiikala</option>\\n<option value="kiikoinen">Kiikoinen</option>\\n<option value="kiiminki">Kiiminki</option>\\n<option value="kinnula">Kinnula</option>\\n<option value="kirkkonummi">Kirkkonummi</option>\\n<option value="kisko">Kisko</option>\\n<option value="kitee">Kitee</option>\\n<option value="kittila">Kittil\\xe4</option>\\n<option value="kiukainen">Kiukainen</option>\\n<option value="kiuruvesi">Kiuruvesi</option>\\n<option value="kivijarvi">Kivij\\xe4rvi</option>\\n<option value="kokemaki">Kokem\\xe4ki</option>\\n<option value="kokkola">Kokkola</option>\\n<option value="kolari">Kolari</option>\\n<option value="konnevesi">Konnevesi</option>\\n<option value="kontiolahti">Kontiolahti</option>\\n<option value="korpilahti">Korpilahti</option>\\n<option value="korppoo">Korppoo</option>\\n<option value="korsnas">Korsn\\xe4s</option>\\n<option value="kortesjarvi">Kortesj\\xe4rvi</option>\\n<option value="koskitl">KoskiTl</option>\\n<option value="kotka">Kotka</option>\\n<option value="kouvola">Kouvola</option>\\n<option value="kristiinankaupunki">Kristiinankaupunki</option>\\n<option value="kruunupyy">Kruunupyy</option>\\n<option value="kuhmalahti">Kuhmalahti</option>\\n<option value="kuhmo">Kuhmo</option>\\n<option value="kuhmoinen">Kuhmoinen</option>\\n<option value="kumlinge">Kumlinge</option>\\n<option value="kuopio">Kuopio</option>\\n<option value="kuortane">Kuortane</option>\\n<option value="kurikka">Kurikka</option>\\n<option value="kuru">Kuru</option>\\n<option value="kustavi">Kustavi</option>\\n<option value="kuusamo">Kuusamo</option>\\n<option value="kuusankoski">Kuusankoski</option>\\n<option value="kuusjoki">Kuusjoki</option>\\n<option value="kylmakoski">Kylm\\xe4koski</option>\\n<option value="kyyjarvi">Kyyj\\xe4rvi</option>\\n<option value="kalvia">K\\xe4lvi\\xe4</option>\\n<option value="karkola">K\\xe4rk\\xf6l\\xe4</option>\\n<option value="karsamaki">K\\xe4rs\\xe4m\\xe4ki</option>\\n<option value="kokar">K\\xf6kar</option>\\n<option value="koylio">K\\xf6yli\\xf6</option>\\n<option value="lahti">Lahti</option>\\n<option value="laihia">Laihia</option>\\n<option value="laitila">Laitila</option>\\n<option value="lammi">Lammi</option>\\n<option value="lapinjarvi">Lapinj\\xe4rvi</option>\\n<option value="lapinlahti">Lapinlahti</option>\\n<option value="lappajarvi">Lappaj\\xe4rvi</option>\\n<option value="lappeenranta">Lappeenranta</option>\\n<option value="lappi">Lappi</option>\\n<option value="lapua">Lapua</option>\\n<option value="laukaa">Laukaa</option>\\n<option value="lavia">Lavia</option>\\n<option value="lehtimaki">Lehtim\\xe4ki</option>\\n<option value="leivonmaki">Leivonm\\xe4ki</option>\\n<option value="lemi">Lemi</option>\\n<option value="lemland">Lemland</option>\\n<option value="lempaala">Lemp\\xe4\\xe4l\\xe4</option>\\n<option value="lemu">Lemu</option>\\n<option value="leppavirta">Lepp\\xe4virta</option>\\n<option value="lestijarvi">Lestij\\xe4rvi</option>\\n<option value="lieksa">Lieksa</option>\\n<option value="lieto">Lieto</option>\\n<option value="liljendal">Liljendal</option>\\n<option value="liminka">Liminka</option>\\n<option value="liperi">Liperi</option>\\n<option value="lohja">Lohja</option>\\n<option value="lohtaja">Lohtaja</option>\\n<option value="loimaa">Loimaa</option>\\n<option value="loppi">Loppi</option>\\n<option value="loviisa">Loviisa</option>\\n<option value="luhanka">Luhanka</option>\\n<option value="lumijoki">Lumijoki</option>\\n<option value="lumparland">Lumparland</option>\\n<option value="luoto">Luoto</option>\\n<option value="luumaki">Luum\\xe4ki</option>\\n<option value="luvia">Luvia</option>\\n<option value="maalahti">Maalahti</option>\\n<option value="maaninka">Maaninka</option>\\n<option value="maarianhamina">Maarianhamina</option>\\n<option value="marttila">Marttila</option>\\n<option value="masku">Masku</option>\\n<option value="mellila">Mellil\\xe4</option>\\n<option value="merijarvi">Merij\\xe4rvi</option>\\n<option value="merikarvia">Merikarvia</option>\\n<option value="merimasku">Merimasku</option>\\n<option value="miehikkala">Miehikk\\xe4l\\xe4</option>\\n<option value="mikkeli">Mikkeli</option>\\n<option value="mouhijarvi">Mouhij\\xe4rvi</option>\\n<option value="muhos">Muhos</option>\\n<option value="multia">Multia</option>\\n<option value="muonio">Muonio</option>\\n<option value="mustasaari">Mustasaari</option>\\n<option value="muurame">Muurame</option>\\n<option value="muurla">Muurla</option>\\n<option value="mynamaki">Myn\\xe4m\\xe4ki</option>\\n<option value="myrskyla">Myrskyl\\xe4</option>\\n<option value="mantsala">M\\xe4nts\\xe4l\\xe4</option>\\n<option value="mantta">M\\xe4ntt\\xe4</option>\\n<option value="mantyharju">M\\xe4ntyharju</option>\\n<option value="naantali">Naantali</option>\\n<option value="nakkila">Nakkila</option>\\n<option value="nastola">Nastola</option>\\n<option value="nauvo">Nauvo</option>\\n<option value="nilsia">Nilsi\\xe4</option>\\n<option value="nivala">Nivala</option>\\n<option value="nokia">Nokia</option>\\n<option value="noormarkku">Noormarkku</option>\\n<option value="nousiainen">Nousiainen</option>\\n<option value="nummi-pusula">Nummi-Pusula</option>\\n<option value="nurmes">Nurmes</option>\\n<option value="nurmijarvi">Nurmij\\xe4rvi</option>\\n<option value="nurmo">Nurmo</option>\\n<option value="narpio">N\\xe4rpi\\xf6</option>\\n<option value="oravainen">Oravainen</option>\\n<option value="orimattila">Orimattila</option>\\n<option value="oripaa">Orip\\xe4\\xe4</option>\\n<option value="orivesi">Orivesi</option>\\n<option value="oulainen">Oulainen</option>\\n<option value="oulu">Oulu</option>\\n<option value="oulunsalo">Oulunsalo</option>\\n<option value="outokumpu">Outokumpu</option>\\n<option value="padasjoki">Padasjoki</option>\\n<option value="paimio">Paimio</option>\\n<option value="paltamo">Paltamo</option>\\n<option value="parainen">Parainen</option>\\n<option value="parikkala">Parikkala</option>\\n<option value="parkano">Parkano</option>\\n<option value="pedersore">Peders\\xf6re</option>\\n<option value="pelkosenniemi">Pelkosenniemi</option>\\n<option value="pello">Pello</option>\\n<option value="perho">Perho</option>\\n<option value="pernaja">Pernaja</option>\\n<option value="pernio">Perni\\xf6</option>\\n<option value="pertteli">Pertteli</option>\\n<option value="pertunmaa">Pertunmaa</option>\\n<option value="petajavesi">Pet\\xe4j\\xe4vesi</option>\\n<option value="pieksamaki">Pieks\\xe4m\\xe4ki</option>\\n<option value="pielavesi">Pielavesi</option>\\n<option value="pietarsaari">Pietarsaari</option>\\n<option value="pihtipudas">Pihtipudas</option>\\n<option value="piikkio">Piikki\\xf6</option>\\n<option value="piippola">Piippola</option>\\n<option value="pirkkala">Pirkkala</option>\\n<option value="pohja">Pohja</option>\\n<option value="polvijarvi">Polvij\\xe4rvi</option>\\n<option value="pomarkku">Pomarkku</option>\\n<option value="pori">Pori</option>\\n<option value="pornainen">Pornainen</option>\\n<option value="porvoo">Porvoo</option>\\n<option value="posio">Posio</option>\\n<option value="pudasjarvi">Pudasj\\xe4rvi</option>\\n<option value="pukkila">Pukkila</option>\\n<option value="pulkkila">Pulkkila</option>\\n<option value="punkaharju">Punkaharju</option>\\n<option value="punkalaidun">Punkalaidun</option>\\n<option value="puolanka">Puolanka</option>\\n<option value="puumala">Puumala</option>\\n<option value="pyhtaa">Pyht\\xe4\\xe4</option>\\n<option value="pyhajoki">Pyh\\xe4joki</option>\\n<option value="pyhajarvi">Pyh\\xe4j\\xe4rvi</option>\\n<option value="pyhanta">Pyh\\xe4nt\\xe4</option>\\n<option value="pyharanta">Pyh\\xe4ranta</option>\\n<option value="pyhaselka">Pyh\\xe4selk\\xe4</option>\\n<option value="pylkonmaki">Pylk\\xf6nm\\xe4ki</option>\\n<option value="palkane">P\\xe4lk\\xe4ne</option>\\n<option value="poytya">P\\xf6yty\\xe4</option>\\n<option value="raahe">Raahe</option>\\n<option value="raisio">Raisio</option>\\n<option value="rantasalmi">Rantasalmi</option>\\n<option value="rantsila">Rantsila</option>\\n<option value="ranua">Ranua</option>\\n<option value="rauma">Rauma</option>\\n<option value="rautalampi">Rautalampi</option>\\n<option value="rautavaara">Rautavaara</option>\\n<option value="rautjarvi">Rautj\\xe4rvi</option>\\n<option value="reisjarvi">Reisj\\xe4rvi</option>\\n<option value="renko">Renko</option>\\n<option value="riihimaki">Riihim\\xe4ki</option>\\n<option value="ristiina">Ristiina</option>\\n<option value="ristijarvi">Ristij\\xe4rvi</option>\\n<option value="rovaniemi">Rovaniemi</option>\\n<option value="ruokolahti">Ruokolahti</option>\\n<option value="ruotsinpyhtaa">Ruotsinpyht\\xe4\\xe4</option>\\n<option value="ruovesi">Ruovesi</option>\\n<option value="rusko">Rusko</option>\\n<option value="rymattyla">Rym\\xe4ttyl\\xe4</option>\\n<option value="raakkyla">R\\xe4\\xe4kkyl\\xe4</option>\\n<option value="saarijarvi">Saarij\\xe4rvi</option>\\n<option value="salla">Salla</option>\\n<option value="salo">Salo</option>\\n<option value="saltvik">Saltvik</option>\\n<option value="sammatti">Sammatti</option>\\n<option value="sauvo">Sauvo</option>\\n<option value="savitaipale">Savitaipale</option>\\n<option value="savonlinna">Savonlinna</option>\\n<option value="savonranta">Savonranta</option>\\n<option value="savukoski">Savukoski</option>\\n<option value="seinajoki">Sein\\xe4joki</option>\\n<option value="sievi">Sievi</option>\\n<option value="siikainen">Siikainen</option>\\n<option value="siikajoki">Siikajoki</option>\\n<option value="siilinjarvi">Siilinj\\xe4rvi</option>\\n<option value="simo">Simo</option>\\n<option value="sipoo">Sipoo</option>\\n<option value="siuntio">Siuntio</option>\\n<option value="sodankyla">Sodankyl\\xe4</option>\\n<option value="soini">Soini</option>\\n<option value="somero">Somero</option>\\n<option value="sonkajarvi">Sonkaj\\xe4rvi</option>\\n<option value="sotkamo">Sotkamo</option>\\n<option value="sottunga">Sottunga</option>\\n<option value="sulkava">Sulkava</option>\\n<option value="sund">Sund</option>\\n<option value="suomenniemi">Suomenniemi</option>\\n<option value="suomusjarvi">Suomusj\\xe4rvi</option>\\n<option value="suomussalmi">Suomussalmi</option>\\n<option value="suonenjoki">Suonenjoki</option>\\n<option value="sysma">Sysm\\xe4</option>\\n<option value="sakyla">S\\xe4kyl\\xe4</option>\\n<option value="sarkisalo">S\\xe4rkisalo</option>\\n<option value="taipalsaari">Taipalsaari</option>\\n<option value="taivalkoski">Taivalkoski</option>\\n<option value="taivassalo">Taivassalo</option>\\n<option value="tammela">Tammela</option>\\n<option value="tammisaari">Tammisaari</option>\\n<option value="tampere">Tampere</option>\\n<option value="tarvasjoki">Tarvasjoki</option>\\n<option value="tervo">Tervo</option>\\n<option value="tervola">Tervola</option>\\n<option value="teuva">Teuva</option>\\n<option value="tohmajarvi">Tohmaj\\xe4rvi</option>\\n<option value="toholampi">Toholampi</option>\\n<option value="toivakka">Toivakka</option>\\n<option value="tornio">Tornio</option>\\n<option value="turku" selected="selected">Turku</option>\\n<option value="tuulos">Tuulos</option>\\n<option value="tuusniemi">Tuusniemi</option>\\n<option value="tuusula">Tuusula</option>\\n<option value="tyrnava">Tyrn\\xe4v\\xe4</option>\\n<option value="toysa">T\\xf6ys\\xe4</option>\\n<option value="ullava">Ullava</option>\\n<option value="ulvila">Ulvila</option>\\n<option value="urjala">Urjala</option>\\n<option value="utajarvi">Utaj\\xe4rvi</option>\\n<option value="utsjoki">Utsjoki</option>\\n<option value="uurainen">Uurainen</option>\\n<option value="uusikaarlepyy">Uusikaarlepyy</option>\\n<option value="uusikaupunki">Uusikaupunki</option>\\n<option value="vaala">Vaala</option>\\n<option value="vaasa">Vaasa</option>\\n<option value="vahto">Vahto</option>\\n<option value="valkeakoski">Valkeakoski</option>\\n<option value="valkeala">Valkeala</option>\\n<option value="valtimo">Valtimo</option>\\n<option value="vammala">Vammala</option>\\n<option value="vampula">Vampula</option>\\n<option value="vantaa">Vantaa</option>\\n<option value="varkaus">Varkaus</option>\\n<option value="varpaisjarvi">Varpaisj\\xe4rvi</option>\\n<option value="vehmaa">Vehmaa</option>\\n<option value="velkua">Velkua</option>\\n<option value="vesanto">Vesanto</option>\\n<option value="vesilahti">Vesilahti</option>\\n<option value="veteli">Veteli</option>\\n<option value="vierema">Vierem\\xe4</option>\\n<option value="vihanti">Vihanti</option>\\n<option value="vihti">Vihti</option>\\n<option value="viitasaari">Viitasaari</option>\\n<option value="vilppula">Vilppula</option>\\n<option value="vimpeli">Vimpeli</option>\\n<option value="virolahti">Virolahti</option>\\n<option value="virrat">Virrat</option>\\n<option value="vardo">V\\xe5rd\\xf6</option>\\n<option value="vahakyro">V\\xe4h\\xe4kyr\\xf6</option>\\n<option value="vastanfjard">V\\xe4stanfj\\xe4rd</option>\\n<option value="voyri-maksamaa">V\\xf6yri-Maksamaa</option>\\n<option value="yliharma">Ylih\\xe4rm\\xe4</option>\\n<option value="yli-ii">Yli-Ii</option>\\n<option value="ylikiiminki">Ylikiiminki</option>\\n<option value="ylistaro">Ylistaro</option>\\n<option value="ylitornio">Ylitornio</option>\\n<option value="ylivieska">Ylivieska</option>\\n<option value="ylamaa">Yl\\xe4maa</option>\\n<option value="ylane">Yl\\xe4ne</option>\\n<option value="ylojarvi">Yl\\xf6j\\xe4rvi</option>\\n<option value="ypaja">Yp\\xe4j\\xe4</option>\\n<option value="aetsa">\\xc4ets\\xe4</option>\\n<option value="ahtari">\\xc4ht\\xe4ri</option>\\n<option value="aanekoski">\\xc4\\xe4nekoski</option>\\n</select>\'\n\n# FISocialSecurityNumber\n##############################################################\n\n>>> from django.contrib.localflavor.fi.forms import FISocialSecurityNumber\n>>> f = FISocialSecurityNumber()\n>>> f.clean(\'010101-0101\')\nu\'010101-0101\'\n>>> f.clean(\'010101+0101\')\nu\'010101+0101\'\n>>> f.clean(\'010101A0101\')\nu\'010101A0101\'\n>>> f.clean(\'101010-0102\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Finnish social security number.\']\n>>> f.clean(\'10a010-0101\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Finnish social security number.\']\n>>> f.clean(\'101010-0\\xe401\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Finnish social security number.\']\n>>> f.clean(\'101010b0101\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Finnish social security number.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f = FISocialSecurityNumber(required=False)\n>>> f.clean(\'010101-0101\')\nu\'010101-0101\'\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n# BRZipCodeField ############################################################\n>>> from django.contrib.localflavor.br.forms import BRZipCodeField\n>>> f = BRZipCodeField()\n>>> f.clean(\'12345-123\')\nu\'12345-123\'\n>>> f.clean(\'12345_123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'1234-123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'abcde-abc\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'12345-\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'-123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = BRZipCodeField(required=False)\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n>>> f.clean(\'-123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'12345-\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'abcde-abc\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'1234-123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'12345_123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX-XXX.\']\n>>> f.clean(\'12345-123\')\nu\'12345-123\'\n\n# BRCNPJField ############################################################\n\n>>> from django.contrib.localflavor.br.forms import BRCNPJField\n>>> f = BRCNPJField(required=True)\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'12-345-678/9012-10\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CNPJ number.\']\n>>> f.clean(\'12.345.678/9012-10\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CNPJ number.\']\n>>> f.clean(\'12345678/9012-10\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CNPJ number.\']\n>>> f.clean(\'64.132.916/0001-88\')\n\'64.132.916/0001-88\'\n>>> f.clean(\'64-132-916/0001-88\')\n\'64-132-916/0001-88\'\n>>> f.clean(\'64132916/0001-88\')\n\'64132916/0001-88\'\n>>> f.clean(\'64.132.916/0001-XX\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field requires only numbers.\']\n>>> f = BRCNPJField(required=False)\n>>> f.clean(\'\')\nu\'\'\n\n# BRCPFField #################################################################\n\n>>> from django.contrib.localflavor.br.forms import BRCPFField\n>>> f = BRCPFField()\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'489.294.654-54\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CPF number.\']\n>>> f.clean(\'295.669.575-98\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CPF number.\']\n>>> f.clean(\'539.315.127-22\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Invalid CPF number.\']\n>>> f.clean(\'663.256.017-26\')\nu\'663.256.017-26\'\n>>> f.clean(\'66325601726\')\nu\'66325601726\'\n>>> f.clean(\'375.788.573-20\')\nu\'375.788.573-20\'\n>>> f.clean(\'84828509895\')\nu\'84828509895\'\n>>> f.clean(\'375.788.573-XX\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field requires only numbers.\']\n>>> f.clean(\'375.788.573-000\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at most 14 characters.\']\n>>> f.clean(\'123.456.78\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at least 11 characters.\']\n>>> f.clean(\'123456789555\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field requires at most 11 digits or 14 characters.\']\n>>> f = BRCPFField(required=False)\n>>> f.clean(\'\')\nu\'\'\n>>> f.clean(None)\nu\'\'\n\n# BRPhoneNumberField #########################################################\n\n>>> from django.contrib.localflavor.br.forms import BRPhoneNumberField\n>>> f = BRPhoneNumberField()\n>>> f.clean(\'41-3562-3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'4135623464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41 3562-3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41 3562 3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'(41) 3562 3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41.3562.3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41.3562-3464\')\nu\'41-3562-3464\'\n>>> f.clean(\' (41) 3562.3464\')\nu\'41-3562-3464\'\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = BRPhoneNumberField(required=False)\n>>> f.clean(\'\')\nu\'\'\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\' (41) 3562.3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41.3562-3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'(41) 3562 3464\')\nu\'41-3562-3464\'\n>>> f.clean(\'4135623464\')\nu\'41-3562-3464\'\n>>> f.clean(\'41 3562-3464\')\nu\'41-3562-3464\'\n\n# BRStateSelect ##############################################################\n\n>>> from django.contrib.localflavor.br.forms import BRStateSelect\n>>> w = BRStateSelect()\n>>> w.render(\'states\', \'PR\')\nu\'<select name="states">\\n<option value="AC">Acre</option>\\n<option value="AL">Alagoas</option>\\n<option value="AP">Amap\\xe1</option>\\n<option value="AM">Amazonas</option>\\n<option value="BA">Bahia</option>\\n<option value="CE">Cear\\xe1</option>\\n<option value="DF">Distrito Federal</option>\\n<option value="ES">Esp\\xedrito Santo</option>\\n<option value="GO">Goi\\xe1s</option>\\n<option value="MA">Maranh\\xe3o</option>\\n<option value="MT">Mato Grosso</option>\\n<option value="MS">Mato Grosso do Sul</option>\\n<option value="MG">Minas Gerais</option>\\n<option value="PA">Par\\xe1</option>\\n<option value="PB">Para\\xedba</option>\\n<option value="PR" selected="selected">Paran\\xe1</option>\\n<option value="PE">Pernambuco</option>\\n<option value="PI">Piau\\xed</option>\\n<option value="RJ">Rio de Janeiro</option>\\n<option value="RN">Rio Grande do Norte</option>\\n<option value="RS">Rio Grande do Sul</option>\\n<option value="RO">Rond\\xf4nia</option>\\n<option value="RR">Roraima</option>\\n<option value="SC">Santa Catarina</option>\\n<option value="SP">S\\xe3o Paulo</option>\\n<option value="SE">Sergipe</option>\\n<option value="TO">Tocantins</option>\\n</select>\'\n\n# DEZipCodeField ##############################################################\n\n>>> from django.contrib.localflavor.de.forms import DEZipCodeField\n>>> f = DEZipCodeField()\n>>> f.clean(\'99423\')\nu\'99423\'\n>>> f.clean(\' 99423\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXXX.\']\n\n# DEStateSelect #############################################################\n\n>>> from django.contrib.localflavor.de.forms import DEStateSelect\n>>> w = DEStateSelect()\n>>> w.render(\'states\', \'TH\')\nu\'<select name="states">\\n<option value="BW">Baden-Wuerttemberg</option>\\n<option value="BY">Bavaria</option>\\n<option value="BE">Berlin</option>\\n<option value="BB">Brandenburg</option>\\n<option value="HB">Bremen</option>\\n<option value="HH">Hamburg</option>\\n<option value="HE">Hessen</option>\\n<option value="MV">Mecklenburg-Western Pomerania</option>\\n<option value="NI">Lower Saxony</option>\\n<option value="NW">North Rhine-Westphalia</option>\\n<option value="RP">Rhineland-Palatinate</option>\\n<option value="SL">Saarland</option>\\n<option value="SN">Saxony</option>\\n<option value="ST">Saxony-Anhalt</option>\\n<option value="SH">Schleswig-Holstein</option>\\n<option value="TH" selected="selected">Thuringia</option>\\n</select>\'\n\n# DEIdentityCardNumberField #################################################\n\n>>> from django.contrib.localflavor.de.forms import DEIdentityCardNumberField\n>>> f = DEIdentityCardNumberField()\n>>> f.clean(\'7549313035D-6004103-0903042-0\')\nu\'7549313035D-6004103-0903042-0\'\n>>> f.clean(\'9786324830D 6104243 0910271 2\')\nu\'9786324830D-6104243-0910271-2\'\n>>> f.clean(\'0434657485D-6407276-0508137-9\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.\']\n\n# CHZipCodeField ############################################################\n\n>>> from django.contrib.localflavor.ch.forms import CHZipCodeField\n>>> f = CHZipCodeField()\n>>> f.clean(\'800x\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXX.\']\n>>> f.clean(\'80 00\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a zip code in the format XXXX.\']\n>>> f.clean(\'8000\')\nu\'8000\'\n\n# CHPhoneNumberField ########################################################\n\n>>> from django.contrib.localflavor.ch.forms import CHPhoneNumberField\n>>> f = CHPhoneNumberField()\n>>> f.clean(\'01234567890\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0XX XXX XX XX format.\']\n>>> f.clean(\'1234567890\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must be in 0XX XXX XX XX format.\']\n>>> f.clean(\'0123456789\')\nu\'012 345 67 89\'\n\n# CHIdentityCardNumberField #################################################\n\n>>> from django.contrib.localflavor.ch.forms import CHIdentityCardNumberField\n>>> f = CHIdentityCardNumberField()\n>>> f.clean(\'C1234567<0\')\nu\'C1234567<0\'\n>>> f.clean(\'C1234567<1\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.\']\n>>> f.clean(\'2123456700\')\nu\'2123456700\'\n>>> f.clean(\'2123456701\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.\']\n\n# CHStateSelect #############################################################\n\n>>> from django.contrib.localflavor.ch.forms import CHStateSelect\n>>> w = CHStateSelect()\n>>> w.render(\'state\', \'AG\')\nu\'<select name="state">\\n<option value="AG" selected="selected">Aargau</option>\\n<option value="AI">Appenzell Innerrhoden</option>\\n<option value="AR">Appenzell Ausserrhoden</option>\\n<option value="BS">Basel-Stadt</option>\\n<option value="BL">Basel-Land</option>\\n<option value="BE">Berne</option>\\n<option value="FR">Fribourg</option>\\n<option value="GE">Geneva</option>\\n<option value="GL">Glarus</option>\\n<option value="GR">Graubuenden</option>\\n<option value="JU">Jura</option>\\n<option value="LU">Lucerne</option>\\n<option value="NE">Neuchatel</option>\\n<option value="NW">Nidwalden</option>\\n<option value="OW">Obwalden</option>\\n<option value="SH">Schaffhausen</option>\\n<option value="SZ">Schwyz</option>\\n<option value="SO">Solothurn</option>\\n<option value="SG">St. Gallen</option>\\n<option value="TG">Thurgau</option>\\n<option value="TI">Ticino</option>\\n<option value="UR">Uri</option>\\n<option value="VS">Valais</option>\\n<option value="VD">Vaud</option>\\n<option value="ZG">Zug</option>\\n<option value="ZH">Zurich</option>\\n</select>\'\n\n## AUPostCodeField ##########################################################\n\nA field that accepts a four digit Australian post code.\n\n>>> from django.contrib.localflavor.au.forms import AUPostCodeField\n>>> f = AUPostCodeField()\n>>> f.clean(\'1234\')\nu\'1234\'\n>>> f.clean(\'2000\')\nu\'2000\'\n>>> f.clean(\'abcd\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a 4 digit post code.\']\n>>> f.clean(\'20001\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a 4 digit post code.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = AUPostCodeField(required=False)\n>>> f.clean(\'1234\')\nu\'1234\'\n>>> f.clean(\'2000\')\nu\'2000\'\n>>> f.clean(\'abcd\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a 4 digit post code.\']\n>>> f.clean(\'20001\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a 4 digit post code.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n## AUPhoneNumberField ########################################################\n\nA field that accepts a 10 digit Australian phone number.\nllows spaces and parentheses around area code.\n\n>>> from django.contrib.localflavor.au.forms import AUPhoneNumberField\n>>> f = AUPhoneNumberField()\n>>> f.clean(\'1234567890\')\nu\'1234567890\'\n>>> f.clean(\'0213456789\')\nu\'0213456789\'\n>>> f.clean(\'02 13 45 67 89\')\nu\'0213456789\'\n>>> f.clean(\'(02) 1345 6789\')\nu\'0213456789\'\n>>> f.clean(\'(02) 1345-6789\')\nu\'0213456789\'\n>>> f.clean(\'(02)1345-6789\')\nu\'0213456789\'\n>>> f.clean(\'0408 123 456\')\nu\'0408123456\'\n>>> f.clean(\'123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must contain 10 digits.\']\n>>> f.clean(\'1800DJANGO\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must contain 10 digits.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n\n>>> f = AUPhoneNumberField(required=False)\n>>> f.clean(\'1234567890\')\nu\'1234567890\'\n>>> f.clean(\'0213456789\')\nu\'0213456789\'\n>>> f.clean(\'02 13 45 67 89\')\nu\'0213456789\'\n>>> f.clean(\'(02) 1345 6789\')\nu\'0213456789\'\n>>> f.clean(\'(02) 1345-6789\')\nu\'0213456789\'\n>>> f.clean(\'(02)1345-6789\')\nu\'0213456789\'\n>>> f.clean(\'0408 123 456\')\nu\'0408123456\'\n>>> f.clean(\'123\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must contain 10 digits.\']\n>>> f.clean(\'1800DJANGO\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Phone numbers must contain 10 digits.\']\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n## AUStateSelect #############################################################\n\nAUStateSelect is a Select widget that uses a list of Australian\nstates/territories as its choices.\n\n>>> from django.contrib.localflavor.au.forms import AUStateSelect\n>>> f = AUStateSelect()\n>>> print f.render(\'state\', \'NSW\')\n<select name="state">\n<option value="ACT">Australian Capital Territory</option>\n<option value="NSW" selected="selected">New South Wales</option>\n<option value="NT">Northern Territory</option>\n<option value="QLD">Queensland</option>\n<option value="SA">South Australia</option>\n<option value="TAS">Tasmania</option>\n<option value="VIC">Victoria</option>\n<option value="WA">Western Australia</option>\n</select>\n\n## ISIdNumberField #############################################################\n\n>>> from django.contrib.localflavor.is_.forms import *\n>>> f = ISIdNumberField()\n>>> f.clean(\'2308803449\')\nu\'230880-3449\'\n>>> f.clean(\'230880-3449\')\nu\'230880-3449\'\n>>> f.clean(\'230880 3449\')\nu\'230880-3449\'\n>>> f.clean(\'230880343\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at least 10 characters.\']\n>>> f.clean(\'230880343234\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at most 11 characters.\']\n>>> f.clean(\'abcdefghijk\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.\']\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(\'2308803439\')\nTraceback (most recent call last):\n...\nValidationError: [u\'The Icelandic identification number is not valid.\']\n>>> f.clean(\'2308803440\')\nu\'230880-3440\'\n>>> f = ISIdNumberField(required=False)\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n## ISPhoneNumberField #############################################################\n\n>>> from django.contrib.localflavor.is_.forms import *\n>>> f = ISPhoneNumberField()\n>>> f.clean(\'1234567\')\nu\'1234567\'\n>>> f.clean(\'123 4567\')\nu\'1234567\'\n>>> f.clean(\'123-4567\')\nu\'1234567\'\n>>> f.clean(\'123-456\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid value.\']\n>>> f.clean(\'123456\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at least 7 characters.\']\n>>> f.clean(\'123456555\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at most 8 characters.\']\n>>> f.clean(\'abcdefg\')\nTraceback (most recent call last):\nValidationError: [u\'Enter a valid value.\']\n>>> f.clean(\' 1234567 \')\nTraceback (most recent call last):\n...\nValidationError: [u\'Ensure this value has at most 8 characters.\']\n>>> f.clean(\' 12367 \')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter a valid value.\']\n\n>>> f.clean(\'\')\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f.clean(None)\nTraceback (most recent call last):\n...\nValidationError: [u\'This field is required.\']\n>>> f = ISPhoneNumberField(required=False)\n>>> f.clean(None)\nu\'\'\n>>> f.clean(\'\')\nu\'\'\n\n## ISPostalCodeSelect #############################################################\n\n>>> from django.contrib.localflavor.is_.forms import *\n>>> f = ISPostalCodeSelect()\n\n>>> f.render(\'foo\', \'bar\')\nu\'<select name="foo">\\n<option value="101">101 Reykjav\\xedk</option>\\n<option value="103">103 Reykjav\\xedk</option>\\n<option value="104">104 Reykjav\\xedk</option>\\n<option value="105">105 Reykjav\\xedk</option>\\n<option value="107">107 Reykjav\\xedk</option>\\n<option value="108">108 Reykjav\\xedk</option>\\n<option value="109">109 Reykjav\\xedk</option>\\n<option value="110">110 Reykjav\\xedk</option>\\n<option value="111">111 Reykjav\\xedk</option>\\n<option value="112">112 Reykjav\\xedk</option>\\n<option value="113">113 Reykjav\\xedk</option>\\n<option value="116">116 Kjalarnes</option>\\n<option value="121">121 Reykjav\\xedk</option>\\n<option value="123">123 Reykjav\\xedk</option>\\n<option value="124">124 Reykjav\\xedk</option>\\n<option value="125">125 Reykjav\\xedk</option>\\n<option value="127">127 Reykjav\\xedk</option>\\n<option value="128">128 Reykjav\\xedk</option>\\n<option value="129">129 Reykjav\\xedk</option>\\n<option value="130">130 Reykjav\\xedk</option>\\n<option value="132">132 Reykjav\\xedk</option>\\n<option value="150">150 Reykjav\\xedk</option>\\n<option value="155">155 Reykjav\\xedk</option>\\n<option value="170">170 Seltjarnarnes</option>\\n<option value="172">172 Seltjarnarnes</option>\\n<option value="190">190 Vogar</option>\\n<option value="200">200 K\\xf3pavogur</option>\\n<option value="201">201 K\\xf3pavogur</option>\\n<option value="202">202 K\\xf3pavogur</option>\\n<option value="203">203 K\\xf3pavogur</option>\\n<option value="210">210 Gar\\xf0ab\\xe6r</option>\\n<option value="212">212 Gar\\xf0ab\\xe6r</option>\\n<option value="220">220 Hafnarfj\\xf6r\\xf0ur</option>\\n<option value="221">221 Hafnarfj\\xf6r\\xf0ur</option>\\n<option value="222">222 Hafnarfj\\xf6r\\xf0ur</option>\\n<option value="225">225 \\xc1lftanes</option>\\n<option value="230">230 Reykjanesb\\xe6r</option>\\n<option value="232">232 Reykjanesb\\xe6r</option>\\n<option value="233">233 Reykjanesb\\xe6r</option>\\n<option value="235">235 Keflav\\xedkurflugv\\xf6llur</option>\\n<option value="240">240 Grindav\\xedk</option>\\n<option value="245">245 Sandger\\xf0i</option>\\n<option value="250">250 Gar\\xf0ur</option>\\n<option value="260">260 Reykjanesb\\xe6r</option>\\n<option value="270">270 Mosfellsb\\xe6r</option>\\n<option value="300">300 Akranes</option>\\n<option value="301">301 Akranes</option>\\n<option value="302">302 Akranes</option>\\n<option value="310">310 Borgarnes</option>\\n<option value="311">311 Borgarnes</option>\\n<option value="320">320 Reykholt \\xed Borgarfir\\xf0i</option>\\n<option value="340">340 Stykkish\\xf3lmur</option>\\n<option value="345">345 Flatey \\xe1 Brei\\xf0afir\\xf0i</option>\\n<option value="350">350 Grundarfj\\xf6r\\xf0ur</option>\\n<option value="355">355 \\xd3lafsv\\xedk</option>\\n<option value="356">356 Sn\\xe6fellsb\\xe6r</option>\\n<option value="360">360 Hellissandur</option>\\n<option value="370">370 B\\xfa\\xf0ardalur</option>\\n<option value="371">371 B\\xfa\\xf0ardalur</option>\\n<option value="380">380 Reykh\\xf3lahreppur</option>\\n<option value="400">400 \\xcdsafj\\xf6r\\xf0ur</option>\\n<option value="401">401 \\xcdsafj\\xf6r\\xf0ur</option>\\n<option value="410">410 Hn\\xedfsdalur</option>\\n<option value="415">415 Bolungarv\\xedk</option>\\n<option value="420">420 S\\xfa\\xf0av\\xedk</option>\\n<option value="425">425 Flateyri</option>\\n<option value="430">430 Su\\xf0ureyri</option>\\n<option value="450">450 Patreksfj\\xf6r\\xf0ur</option>\\n<option value="451">451 Patreksfj\\xf6r\\xf0ur</option>\\n<option value="460">460 T\\xe1lknafj\\xf6r\\xf0ur</option>\\n<option value="465">465 B\\xedldudalur</option>\\n<option value="470">470 \\xdeingeyri</option>\\n<option value="471">471 \\xdeingeyri</option>\\n<option value="500">500 Sta\\xf0ur</option>\\n<option value="510">510 H\\xf3lmav\\xedk</option>\\n<option value="512">512 H\\xf3lmav\\xedk</option>\\n<option value="520">520 Drangsnes</option>\\n<option value="522">522 Kj\\xf6rvogur</option>\\n<option value="523">523 B\\xe6r</option>\\n<option value="524">524 Nor\\xf0urfj\\xf6r\\xf0ur</option>\\n<option value="530">530 Hvammstangi</option>\\n<option value="531">531 Hvammstangi</option>\\n<option value="540">540 Bl\\xf6ndu\\xf3s</option>\\n<option value="541">541 Bl\\xf6ndu\\xf3s</option>\\n<option value="545">545 Skagastr\\xf6nd</option>\\n<option value="550">550 Sau\\xf0\\xe1rkr\\xf3kur</option>\\n<option value="551">551 Sau\\xf0\\xe1rkr\\xf3kur</option>\\n<option value="560">560 Varmahl\\xed\\xf0</option>\\n<option value="565">565 Hofs\\xf3s</option>\\n<option value="566">566 Hofs\\xf3s</option>\\n<option value="570">570 Flj\\xf3t</option>\\n<option value="580">580 Siglufj\\xf6r\\xf0ur</option>\\n<option value="600">600 Akureyri</option>\\n<option value="601">601 Akureyri</option>\\n<option value="602">602 Akureyri</option>\\n<option value="603">603 Akureyri</option>\\n<option value="610">610 Greniv\\xedk</option>\\n<option value="611">611 Gr\\xedmsey</option>\\n<option value="620">620 Dalv\\xedk</option>\\n<option value="621">621 Dalv\\xedk</option>\\n<option value="625">625 \\xd3lafsfj\\xf6r\\xf0ur</option>\\n<option value="630">630 Hr\\xedsey</option>\\n<option value="640">640 H\\xfasav\\xedk</option>\\n<option value="641">641 H\\xfasav\\xedk</option>\\n<option value="645">645 Fossh\\xf3ll</option>\\n<option value="650">650 Laugar</option>\\n<option value="660">660 M\\xfdvatn</option>\\n<option value="670">670 K\\xf3pasker</option>\\n<option value="671">671 K\\xf3pasker</option>\\n<option value="675">675 Raufarh\\xf6fn</option>\\n<option value="680">680 \\xde\\xf3rsh\\xf6fn</option>\\n<option value="681">681 \\xde\\xf3rsh\\xf6fn</option>\\n<option value="685">685 Bakkafj\\xf6r\\xf0ur</option>\\n<option value="690">690 Vopnafj\\xf6r\\xf0ur</option>\\n<option value="700">700 Egilssta\\xf0ir</option>\\n<option value="701">701 Egilssta\\xf0ir</option>\\n<option value="710">710 Sey\\xf0isfj\\xf6r\\xf0ur</option>\\n<option value="715">715 Mj\\xf3ifj\\xf6r\\xf0ur</option>\\n<option value="720">720 Borgarfj\\xf6r\\xf0ur eystri</option>\\n<option value="730">730 Rey\\xf0arfj\\xf6r\\xf0ur</option>\\n<option value="735">735 Eskifj\\xf6r\\xf0ur</option>\\n<option value="740">740 Neskaupsta\\xf0ur</option>\\n<option value="750">750 F\\xe1skr\\xfa\\xf0sfj\\xf6r\\xf0ur</option>\\n<option value="755">755 St\\xf6\\xf0varfj\\xf6r\\xf0ur</option>\\n<option value="760">760 Brei\\xf0dalsv\\xedk</option>\\n<option value="765">765 Dj\\xfapivogur</option>\\n<option value="780">780 H\\xf6fn \\xed Hornafir\\xf0i</option>\\n<option value="781">781 H\\xf6fn \\xed Hornafir\\xf0i</option>\\n<option value="785">785 \\xd6r\\xe6fi</option>\\n<option value="800">800 Selfoss</option>\\n<option value="801">801 Selfoss</option>\\n<option value="802">802 Selfoss</option>\\n<option value="810">810 Hverager\\xf0i</option>\\n<option value="815">815 \\xdeorl\\xe1ksh\\xf6fn</option>\\n<option value="820">820 Eyrarbakki</option>\\n<option value="825">825 Stokkseyri</option>\\n<option value="840">840 Laugarvatn</option>\\n<option value="845">845 Fl\\xfa\\xf0ir</option>\\n<option value="850">850 Hella</option>\\n<option value="851">851 Hella</option>\\n<option value="860">860 Hvolsv\\xf6llur</option>\\n<option value="861">861 Hvolsv\\xf6llur</option>\\n<option value="870">870 V\\xedk</option>\\n<option value="871">871 V\\xedk</option>\\n<option value="880">880 Kirkjub\\xe6jarklaustur</option>\\n<option value="900">900 Vestmannaeyjar</option>\\n<option value="902">902 Vestmannaeyjar</option>\\n</select>\'\n\n## CLRutField #############################################################\n\nCLRutField is a Field that checks the validity of the Chilean\npersonal identification number (RUT). It has two modes relaxed (default) and\nstrict.\n\n>>> from django.contrib.localflavor.cl.forms import CLRutField\n>>> rut = CLRutField()\n\n>>> rut.clean(\'11-6\')\n\'11-6\'\n>>> rut.clean(\'116\')\n\'11-6\'\n\n# valid format, bad verifier.\n>>> rut.clean(\'11.111.111-0\')\nTraceback (most recent call last):\n...\nValidationError: [u\'The Chilean RUT is not valid.\']\n>>> rut.clean(\'111\')\nTraceback (most recent call last):\n...\nValidationError: [u\'The Chilean RUT is not valid.\']\n\n>>> rut.clean(\'767484100\')\n\'76.748.410-0\'\n>>> rut.clean(\'78.412.790-7\')\n\'78.412.790-7\'\n>>> rut.clean(\'8.334.6043\')\n\'8.334.604-3\'\n>>> rut.clean(\'76793310-K\')\n\'76.793.310-K\'\n\nStrict RUT usage (does not allow imposible values)\n>>> rut = CLRutField(strict=True)\n\n>>> rut.clean(\'11-6\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.\']\n\n# valid format, bad verifier.\n>>> rut.clean(\'11.111.111-0\')\nTraceback (most recent call last):\n...\nValidationError: [u\'The Chilean RUT is not valid.\']\n\n# Correct input, invalid format.\n>>> rut.clean(\'767484100\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.\']\n>>> rut.clean(\'78.412.790-7\')\n\'78.412.790-7\'\n>>> rut.clean(\'8.334.6043\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.\']\n>>> rut.clean(\'76793310-K\')\nTraceback (most recent call last):\n...\nValidationError: [u\'Enter valid a Chilean RUT. The format is XX.XXX.XXX-X.\']\n\n'
|
class Solution(object):
def decompressRLElist(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
new = []
for i in range(len(nums)/2):
new += nums[2*i] * [nums[2*i+1]]
return new
|
class Solution(object):
def decompress_rl_elist(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
new = []
for i in range(len(nums) / 2):
new += nums[2 * i] * [nums[2 * i + 1]]
return new
|
# -*- coding: utf-8 -*-
BADREQUEST = 400
UNAUTHORIZED = 401
FORBIDDEN = 403
GONE = 410
TOOMANYREQUESTS = 412
class DnsdbException(Exception):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
self.message = message
self.errcode = errcode
self.detail = detail
self.msg_ch = msg_ch
super(DnsdbException, self).__init__()
def __str__(self):
return self.message
def json(self):
return dict(code=self.errcode, why=self.message)
class Unauthorized(DnsdbException):
def __init__(self, message='Unauthorized', errcode=UNAUTHORIZED, detail=None, msg_ch=u''):
super(Unauthorized, self).__init__(message, errcode, detail, msg_ch)
class Forbidden(DnsdbException):
def __init__(self, message='Forbidden', errcode=FORBIDDEN, detail=None, msg_ch=u''):
super(Forbidden, self).__init__(message, errcode, detail, msg_ch)
class OperationLogErr(DnsdbException):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
super(OperationLogErr, self).__init__(message, errcode, detail, msg_ch)
class BadParam(DnsdbException):
def __init__(self, message='Bad params', errcode=BADREQUEST, detail=None, msg_ch=u''):
super(BadParam, self).__init__(message, errcode, detail, msg_ch)
class UpdaterErr(DnsdbException):
pass
class ConfigErr(UpdaterErr):
def __init__(self, message):
super(ConfigErr, self).__init__(message=message, errcode=501)
|
badrequest = 400
unauthorized = 401
forbidden = 403
gone = 410
toomanyrequests = 412
class Dnsdbexception(Exception):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
self.message = message
self.errcode = errcode
self.detail = detail
self.msg_ch = msg_ch
super(DnsdbException, self).__init__()
def __str__(self):
return self.message
def json(self):
return dict(code=self.errcode, why=self.message)
class Unauthorized(DnsdbException):
def __init__(self, message='Unauthorized', errcode=UNAUTHORIZED, detail=None, msg_ch=u''):
super(Unauthorized, self).__init__(message, errcode, detail, msg_ch)
class Forbidden(DnsdbException):
def __init__(self, message='Forbidden', errcode=FORBIDDEN, detail=None, msg_ch=u''):
super(Forbidden, self).__init__(message, errcode, detail, msg_ch)
class Operationlogerr(DnsdbException):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
super(OperationLogErr, self).__init__(message, errcode, detail, msg_ch)
class Badparam(DnsdbException):
def __init__(self, message='Bad params', errcode=BADREQUEST, detail=None, msg_ch=u''):
super(BadParam, self).__init__(message, errcode, detail, msg_ch)
class Updatererr(DnsdbException):
pass
class Configerr(UpdaterErr):
def __init__(self, message):
super(ConfigErr, self).__init__(message=message, errcode=501)
|
#create class
class Event:
#create class variables
def __init__(self , eventId , eventType , themeColor , location):
self.eventId = eventId
self.eventType = eventType
self.themeColor = themeColor
self.location = location
#define class functions
def displayEventDetails(self):
print()
print("Event Type = " + self.eventType)
print("Theme Color = " + self.themeColor)
print("Location = " + self.location)
def setEventLocation(self):
self.location = input("Input new location of event " + str(self.eventId) + " : ")
|
class Event:
def __init__(self, eventId, eventType, themeColor, location):
self.eventId = eventId
self.eventType = eventType
self.themeColor = themeColor
self.location = location
def display_event_details(self):
print()
print('Event Type = ' + self.eventType)
print('Theme Color = ' + self.themeColor)
print('Location = ' + self.location)
def set_event_location(self):
self.location = input('Input new location of event ' + str(self.eventId) + ' : ')
|
class Piece:
def __init__(self, row, col):
self.clicked = False
self.numAround = -1
self.flagged = False
self.row, self.col = row, col
def setNeighbors(self, neighbors):
self.neighbors = neighbors
def getNumFlaggedAround(self):
num = 0
for n in self.neighbors:
num += 1 if n.flagged else 0
return num
def getNumUnclickedAround(self):
num = 0
for n in self.neighbors:
num += 0 if n.clicked else 1
return num
def hasClickedNeighbor(self):
for n in self.neighbors:
if n.clicked:
return True
return False
|
class Piece:
def __init__(self, row, col):
self.clicked = False
self.numAround = -1
self.flagged = False
(self.row, self.col) = (row, col)
def set_neighbors(self, neighbors):
self.neighbors = neighbors
def get_num_flagged_around(self):
num = 0
for n in self.neighbors:
num += 1 if n.flagged else 0
return num
def get_num_unclicked_around(self):
num = 0
for n in self.neighbors:
num += 0 if n.clicked else 1
return num
def has_clicked_neighbor(self):
for n in self.neighbors:
if n.clicked:
return True
return False
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@AUTHOR:Joselyn Zhao
@CONTACT:[email protected]
@HOME_PAGE:joselynzhao.top
@SOFTWERE:PyCharm
@FILE:del.py
@TIME:2020/4/29 19:57
@DES:
'''
dict = {'shuxue':99,'yuwen':99,'yingyu':99}
print('shuxue:',dict['shuxue'])
print('yuwen:',dict['yuwen'])
print('yingyu:',dict['yingyu'])
dict['wuli'] = 100
dict['huaxue'] = 89
print(dict)
del dict['yingyu']
print(dict)
|
"""
@AUTHOR:Joselyn Zhao
@CONTACT:[email protected]
@HOME_PAGE:joselynzhao.top
@SOFTWERE:PyCharm
@FILE:del.py
@TIME:2020/4/29 19:57
@DES:
"""
dict = {'shuxue': 99, 'yuwen': 99, 'yingyu': 99}
print('shuxue:', dict['shuxue'])
print('yuwen:', dict['yuwen'])
print('yingyu:', dict['yingyu'])
dict['wuli'] = 100
dict['huaxue'] = 89
print(dict)
del dict['yingyu']
print(dict)
|
# Input is square matrix A whose rows are sorted lists.
# Returns a list B by merging all rows into a single list.
#
# Goal: O(n^2 log n)
# Actually O(n^2 log(n^2)) but since log(n^2) == 2log(n) and constant factors can be ignored => O(2log(n)) can be relaxed to O(log(n))
def mergesort(Sublists):
sublists_count=len(Sublists)
if (sublists_count is 0): return Sublists
elif(sublists_count is 1): return Sublists[0]
k=sublists_count//2
first_half=mergesort(Sublists[:k])
second_half=mergesort(Sublists[k:])
return merge(first_half,second_half) # This merge operation takes O(n) time
def merge(list1,list2):
if list2 is []: return list1
Result=[]
list1_ptr=0
list2_ptr=0
while (list1_ptr<len(list1) and list2_ptr<len(list2)):
if (list1[list1_ptr]<=list2[list2_ptr]):
Result.append(list1[list1_ptr])
list1_ptr+=1
elif(list1[list1_ptr]>list2[list2_ptr]):
Result.append(list2[list2_ptr])
list2_ptr+=1
while (list1_ptr<len(list1)):
Result.append(list1[list1_ptr])
list1_ptr+=1
while (list2_ptr<len(list2)):
Result.append(list2[list2_ptr])
list2_ptr+=1
return Result
if __name__ == "__main__":
A=[[1,2,8],
[2,3,9],
[3,4,4]]
print(mergesort(A))
|
def mergesort(Sublists):
sublists_count = len(Sublists)
if sublists_count is 0:
return Sublists
elif sublists_count is 1:
return Sublists[0]
k = sublists_count // 2
first_half = mergesort(Sublists[:k])
second_half = mergesort(Sublists[k:])
return merge(first_half, second_half)
def merge(list1, list2):
if list2 is []:
return list1
result = []
list1_ptr = 0
list2_ptr = 0
while list1_ptr < len(list1) and list2_ptr < len(list2):
if list1[list1_ptr] <= list2[list2_ptr]:
Result.append(list1[list1_ptr])
list1_ptr += 1
elif list1[list1_ptr] > list2[list2_ptr]:
Result.append(list2[list2_ptr])
list2_ptr += 1
while list1_ptr < len(list1):
Result.append(list1[list1_ptr])
list1_ptr += 1
while list2_ptr < len(list2):
Result.append(list2[list2_ptr])
list2_ptr += 1
return Result
if __name__ == '__main__':
a = [[1, 2, 8], [2, 3, 9], [3, 4, 4]]
print(mergesort(A))
|
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# Author: Flyaway - [email protected]
# Blog: zhouyichu.com
#
# Python release: 3.4.5
#
# Date: 2017-02-28 13:43:07
# Last modified: 2017-03-01 17:02:35
"""
Database for DIRT
"""
class Path:
"""Path is the real data structure that store in the database.
"""
def __init__(self, path, slotX, slotY):
self._path = path
self._slot = dict()
self._slot['slotX'] = dict()
self._slot['slotY'] = dict()
self._slot['slotX'][slotX] = 1
self._slot['slotY'][slotY] = 1
########################################################
# Public methods
########################################################
def insert(self, slotX, slotY):
self.slotX[slotX] = self.slotX.get(slotX, 0) + 1
self.slotY[slotY] = self.slotY.get(slotY, 0) + 1
self._check()
def slot(self, value):
"""Return the whole slot based on the given value.
Args:
value: str - 'SlotX' ot 'SlotY'
"""
return self._slot[value]
########################################################
# Property
########################################################
@property
def path(self):
return self._path
@property
def slotX(self):
return self._slot['slotX']
@property
def slotY(self):
return self._slot['slotY']
########################################################
# Magic methods
########################################################
def __len__(self):
"""Return the total number of slots.
"""
return sum([v for v in self.slotY.values()])
def __eq__(self, other):
return self.path == other.path
def __hash__(self):
return hash(self.path)
########################################################
# Private methods
########################################################
def _check(self):
"""To make ure the number of slotX and slotY is equal
"""
X = sum([v for v in self.slotX.values()])
Y = sum([v for v in self.slotY.values()])
assert X == Y
class Database:
"""Construct the Triple Database.
As a database, there should be some basic operations:
Attributes:
self_db: dict(path)
- insert(): Insert a new item.
- search(): Seach for a particular item.
"""
def __init__(self):
self._db = dict()
def insert(self, triple):
path = triple.path
slotX = triple.slotX
slotY = triple.slotY
if triple.path not in self._db:
ins = Path(path, slotX, slotY)
self._db[path] = ins
else:
self._db[path].insert(slotX, slotY)
def path_number(self):
"""Return the numbe of paths intotal.
"""
values = sum([len(v) for v in self._db.values()])
return values
def apply_minfreq(self, k):
paths = [p for p in self._db if len(self._db[p]) < k]
for p in paths:
del self._db[p]
def search_counter(self, path=None, slot=None, filler=None):
"""Search the counter number based on the given path, slotX and slotY.
Args:
path: str
"""
if path is None:
inss = self._db.values()
else:
inss = [self._db[path]]
if slot is None:
raise Exception('Must given a slot name !')
value = 0
slots = [ins.slot(slot) for ins in inss]
if filler is None:
value += sum([sum(v.values()) for v in slots])
else:
value = sum([v.get(filler, 0) for v in slots])
return value
def search_words(self, path, slot):
"""Return all the words the fill the slot in path.
Return:
set(str)
"""
ins = self._db[path]
return set(ins.slot(slot).keys())
########################################################
# Magic methods
########################################################
def __len__(self):
"""Return the number of distinct paths.
"""
return len(self._db)
def __contains__(self, path):
"""Check if the given path is in the database.
"""
return path in self._db
def __iter__(self):
return iter(self._db.keys())
|
"""
Database for DIRT
"""
class Path:
"""Path is the real data structure that store in the database.
"""
def __init__(self, path, slotX, slotY):
self._path = path
self._slot = dict()
self._slot['slotX'] = dict()
self._slot['slotY'] = dict()
self._slot['slotX'][slotX] = 1
self._slot['slotY'][slotY] = 1
def insert(self, slotX, slotY):
self.slotX[slotX] = self.slotX.get(slotX, 0) + 1
self.slotY[slotY] = self.slotY.get(slotY, 0) + 1
self._check()
def slot(self, value):
"""Return the whole slot based on the given value.
Args:
value: str - 'SlotX' ot 'SlotY'
"""
return self._slot[value]
@property
def path(self):
return self._path
@property
def slot_x(self):
return self._slot['slotX']
@property
def slot_y(self):
return self._slot['slotY']
def __len__(self):
"""Return the total number of slots.
"""
return sum([v for v in self.slotY.values()])
def __eq__(self, other):
return self.path == other.path
def __hash__(self):
return hash(self.path)
def _check(self):
"""To make ure the number of slotX and slotY is equal
"""
x = sum([v for v in self.slotX.values()])
y = sum([v for v in self.slotY.values()])
assert X == Y
class Database:
"""Construct the Triple Database.
As a database, there should be some basic operations:
Attributes:
self_db: dict(path)
- insert(): Insert a new item.
- search(): Seach for a particular item.
"""
def __init__(self):
self._db = dict()
def insert(self, triple):
path = triple.path
slot_x = triple.slotX
slot_y = triple.slotY
if triple.path not in self._db:
ins = path(path, slotX, slotY)
self._db[path] = ins
else:
self._db[path].insert(slotX, slotY)
def path_number(self):
"""Return the numbe of paths intotal.
"""
values = sum([len(v) for v in self._db.values()])
return values
def apply_minfreq(self, k):
paths = [p for p in self._db if len(self._db[p]) < k]
for p in paths:
del self._db[p]
def search_counter(self, path=None, slot=None, filler=None):
"""Search the counter number based on the given path, slotX and slotY.
Args:
path: str
"""
if path is None:
inss = self._db.values()
else:
inss = [self._db[path]]
if slot is None:
raise exception('Must given a slot name !')
value = 0
slots = [ins.slot(slot) for ins in inss]
if filler is None:
value += sum([sum(v.values()) for v in slots])
else:
value = sum([v.get(filler, 0) for v in slots])
return value
def search_words(self, path, slot):
"""Return all the words the fill the slot in path.
Return:
set(str)
"""
ins = self._db[path]
return set(ins.slot(slot).keys())
def __len__(self):
"""Return the number of distinct paths.
"""
return len(self._db)
def __contains__(self, path):
"""Check if the given path is in the database.
"""
return path in self._db
def __iter__(self):
return iter(self._db.keys())
|
def non_contiguous_motif(str1, dna_list):
index = -1
num = 0
for i in str1:
for j in dna_list:
index+= 1
if i == j:
num = index
return num
|
def non_contiguous_motif(str1, dna_list):
index = -1
num = 0
for i in str1:
for j in dna_list:
index += 1
if i == j:
num = index
return num
|
#!/usr/bin/env python
NAME = 'Microsoft ISA Server'
def is_waf(self):
detected = False
r = self.invalid_host()
if r is None:
return
if r.reason in self.isaservermatch:
detected = True
return detected
|
name = 'Microsoft ISA Server'
def is_waf(self):
detected = False
r = self.invalid_host()
if r is None:
return
if r.reason in self.isaservermatch:
detected = True
return detected
|
#
# PySNMP MIB module Unisphere-Data-L2F-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-L2F-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:24:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
InterfaceIndex, InterfaceIndexOrZero = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex", "InterfaceIndexOrZero")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
IpAddress, ModuleIdentity, ObjectIdentity, NotificationType, Bits, Integer32, iso, Counter32, Unsigned32, TimeTicks, MibIdentifier, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "ModuleIdentity", "ObjectIdentity", "NotificationType", "Bits", "Integer32", "iso", "Counter32", "Unsigned32", "TimeTicks", "MibIdentifier", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32")
TruthValue, TextualConvention, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "DisplayString", "RowStatus")
usDataMibs, = mibBuilder.importSymbols("Unisphere-Data-MIBs", "usDataMibs")
UsdEnable, = mibBuilder.importSymbols("Unisphere-Data-TC", "UsdEnable")
usdL2fMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53))
usdL2fMIB.setRevisions(('2001-09-25 13:54', '2001-09-19 18:07',))
if mibBuilder.loadTexts: usdL2fMIB.setLastUpdated('200109251354Z')
if mibBuilder.loadTexts: usdL2fMIB.setOrganization('Unisphere Networks, Inc.')
class UsdL2fTunnelId(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535)
class UsdL2fSessionId(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535)
class UsdL2fAdminState(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2))
namedValues = NamedValues(("enabled", 0), ("disabled", 1), ("drain", 2))
class UsdL2fTransport(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1))
namedValues = NamedValues(("other", 0), ("udpIp", 1))
usdL2fTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 0))
usdL2fObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1))
usdL2fTrapControl = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 2))
usdL2fConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3))
usdL2fSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1))
usdL2fDestination = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2))
usdL2fTunnel = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3))
usdL2fSession = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4))
usdL2fTransport = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5))
usdL2fSystemConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1))
usdL2fSystemStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2))
usdL2fSysConfigAdminState = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 1), UsdL2fAdminState()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: usdL2fSysConfigAdminState.setStatus('current')
usdL2fSysConfigDestructTimeout = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3600))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: usdL2fSysConfigDestructTimeout.setStatus('current')
usdL2fSysConfigIpChecksumEnable = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 3), UsdEnable()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: usdL2fSysConfigIpChecksumEnable.setStatus('current')
usdL2fSysConfigReceiveDataSequencingIgnore = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 4), UsdEnable()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: usdL2fSysConfigReceiveDataSequencingIgnore.setStatus('current')
usdL2fSysStatusProtocolVersion = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 256))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusProtocolVersion.setStatus('current')
usdL2fSysStatusVendorName = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusVendorName.setStatus('current')
usdL2fSysStatusFirmwareRev = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusFirmwareRev.setStatus('current')
usdL2fSysStatusTotalDestinations = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusTotalDestinations.setStatus('current')
usdL2fSysStatusFailedDestinations = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusFailedDestinations.setStatus('current')
usdL2fSysStatusActiveDestinations = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 6), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusActiveDestinations.setStatus('current')
usdL2fSysStatusTotalTunnels = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusTotalTunnels.setStatus('current')
usdL2fSysStatusFailedTunnels = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusFailedTunnels.setStatus('current')
usdL2fSysStatusFailedTunnelAuthens = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusFailedTunnelAuthens.setStatus('current')
usdL2fSysStatusActiveTunnels = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 10), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusActiveTunnels.setStatus('current')
usdL2fSysStatusTotalSessions = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusTotalSessions.setStatus('current')
usdL2fSysStatusFailedSessions = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusFailedSessions.setStatus('current')
usdL2fSysStatusActiveSessions = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 13), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSysStatusActiveSessions.setStatus('current')
usdL2fDestConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1))
usdL2fDestStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2))
usdL2fDestStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3))
usdL2fDestConfigTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2), )
if mibBuilder.loadTexts: usdL2fDestConfigTable.setStatus('current')
usdL2fDestConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fDestConfigIfIndex"))
if mibBuilder.loadTexts: usdL2fDestConfigEntry.setStatus('current')
usdL2fDestConfigIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fDestConfigIfIndex.setStatus('current')
usdL2fDestConfigRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fDestConfigRowStatus.setStatus('current')
usdL2fDestConfigAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 3), UsdL2fAdminState().clone('enabled')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fDestConfigAdminState.setStatus('current')
usdL2fDestStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1), )
if mibBuilder.loadTexts: usdL2fDestStatusTable.setStatus('current')
usdL2fDestStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fDestStatusIfIndex"))
if mibBuilder.loadTexts: usdL2fDestStatusEntry.setStatus('current')
usdL2fDestStatusIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fDestStatusIfIndex.setStatus('current')
usdL2fDestStatusTransport = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 2), UsdL2fTransport()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusTransport.setStatus('current')
usdL2fDestStatusEffectiveAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 3), UsdL2fAdminState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusEffectiveAdminState.setStatus('current')
usdL2fDestStatusTotalTunnels = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusTotalTunnels.setStatus('current')
usdL2fDestStatusFailedTunnels = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusFailedTunnels.setStatus('current')
usdL2fDestStatusFailedTunnelAuthens = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusFailedTunnelAuthens.setStatus('current')
usdL2fDestStatusActiveTunnels = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusActiveTunnels.setStatus('current')
usdL2fDestStatusTotalSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusTotalSessions.setStatus('current')
usdL2fDestStatusFailedSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusFailedSessions.setStatus('current')
usdL2fDestStatusActiveSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 10), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatusActiveSessions.setStatus('current')
usdL2fDestStatTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1), )
if mibBuilder.loadTexts: usdL2fDestStatTable.setStatus('current')
usdL2fDestStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fDestStatIfIndex"))
if mibBuilder.loadTexts: usdL2fDestStatEntry.setStatus('current')
usdL2fDestStatIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fDestStatIfIndex.setStatus('current')
usdL2fDestStatCtlRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlRecvOctets.setStatus('current')
usdL2fDestStatCtlRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlRecvPackets.setStatus('current')
usdL2fDestStatCtlRecvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlRecvErrors.setStatus('current')
usdL2fDestStatCtlRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlRecvDiscards.setStatus('current')
usdL2fDestStatCtlSendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlSendOctets.setStatus('current')
usdL2fDestStatCtlSendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlSendPackets.setStatus('current')
usdL2fDestStatCtlSendErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlSendErrors.setStatus('current')
usdL2fDestStatCtlSendDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatCtlSendDiscards.setStatus('current')
usdL2fDestStatPayRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPayRecvOctets.setStatus('current')
usdL2fDestStatPayRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPayRecvPackets.setStatus('current')
usdL2fDestStatPayRecvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPayRecvErrors.setStatus('current')
usdL2fDestStatPayRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPayRecvDiscards.setStatus('current')
usdL2fDestStatPaySendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPaySendOctets.setStatus('current')
usdL2fDestStatPaySendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPaySendPackets.setStatus('current')
usdL2fDestStatPaySendErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPaySendErrors.setStatus('current')
usdL2fDestStatPaySendDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fDestStatPaySendDiscards.setStatus('current')
usdL2fTunnelConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1))
usdL2fTunnelStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2))
usdL2fTunnelStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3))
usdL2fTunnelMap = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4))
usdL2fTunnelConfigTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2), )
if mibBuilder.loadTexts: usdL2fTunnelConfigTable.setStatus('current')
usdL2fTunnelConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fTunnelConfigIfIndex"))
if mibBuilder.loadTexts: usdL2fTunnelConfigEntry.setStatus('current')
usdL2fTunnelConfigIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fTunnelConfigIfIndex.setStatus('current')
usdL2fTunnelConfigRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fTunnelConfigRowStatus.setStatus('current')
usdL2fTunnelConfigAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 3), UsdL2fAdminState().clone('enabled')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fTunnelConfigAdminState.setStatus('current')
usdL2fTunnelStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1), )
if mibBuilder.loadTexts: usdL2fTunnelStatusTable.setStatus('current')
usdL2fTunnelStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusIfIndex"))
if mibBuilder.loadTexts: usdL2fTunnelStatusEntry.setStatus('current')
usdL2fTunnelStatusIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fTunnelStatusIfIndex.setStatus('current')
usdL2fTunnelStatusTransport = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 2), UsdL2fTransport()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusTransport.setStatus('current')
usdL2fTunnelStatusLocalTunnelId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 3), UsdL2fTunnelId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusLocalTunnelId.setStatus('current')
usdL2fTunnelStatusRemoteTunnelId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 4), UsdL2fTunnelId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusRemoteTunnelId.setStatus('current')
usdL2fTunnelStatusEffectiveAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 5), UsdL2fAdminState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusEffectiveAdminState.setStatus('current')
usdL2fTunnelStatusState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("idle", 0), ("connecting", 1), ("established", 2), ("disconnecting", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusState.setStatus('current')
usdL2fTunnelStatusInitiated = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("local", 1), ("remote", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusInitiated.setStatus('current')
usdL2fTunnelStatusRemoteHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusRemoteHostName.setStatus('current')
usdL2fTunnelStatusTotalSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusTotalSessions.setStatus('current')
usdL2fTunnelStatusFailedSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusFailedSessions.setStatus('current')
usdL2fTunnelStatusActiveSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 11), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusActiveSessions.setStatus('current')
usdL2fTunnelStatusLastErrorCode = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusLastErrorCode.setStatus('current')
usdL2fTunnelStatusLastErrorMessage = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 13), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusLastErrorMessage.setStatus('current')
usdL2fTunnelStatusCumEstabTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 14), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatusCumEstabTime.setStatus('current')
usdL2fTunnelStatTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1), )
if mibBuilder.loadTexts: usdL2fTunnelStatTable.setStatus('current')
usdL2fTunnelStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fTunnelStatIfIndex"))
if mibBuilder.loadTexts: usdL2fTunnelStatEntry.setStatus('current')
usdL2fTunnelStatIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fTunnelStatIfIndex.setStatus('current')
usdL2fTunnelStatCtlRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlRecvOctets.setStatus('current')
usdL2fTunnelStatCtlRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlRecvPackets.setStatus('current')
usdL2fTunnelStatCtlRecvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlRecvErrors.setStatus('current')
usdL2fTunnelStatCtlRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlRecvDiscards.setStatus('current')
usdL2fTunnelStatCtlSendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlSendOctets.setStatus('current')
usdL2fTunnelStatCtlSendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlSendPackets.setStatus('current')
usdL2fTunnelStatCtlSendErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlSendErrors.setStatus('current')
usdL2fTunnelStatCtlSendDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlSendDiscards.setStatus('current')
usdL2fTunnelStatPayRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPayRecvOctets.setStatus('current')
usdL2fTunnelStatPayRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPayRecvPackets.setStatus('current')
usdL2fTunnelStatPayRecvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPayRecvErrors.setStatus('current')
usdL2fTunnelStatPayRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPayRecvDiscards.setStatus('current')
usdL2fTunnelStatPaySendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPaySendOctets.setStatus('current')
usdL2fTunnelStatPaySendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPaySendPackets.setStatus('current')
usdL2fTunnelStatPaySendErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPaySendErrors.setStatus('current')
usdL2fTunnelStatPaySendDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatPaySendDiscards.setStatus('current')
usdL2fTunnelStatCtlRecvOutOfSequence = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fTunnelStatCtlRecvOutOfSequence.setStatus('current')
usdL2fMapTifSidToSifTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1), )
if mibBuilder.loadTexts: usdL2fMapTifSidToSifTable.setStatus('current')
usdL2fMapTifSidToSifEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fMapTifSidToSifTunnelIfIndex"), (0, "Unisphere-Data-L2F-MIB", "usdL2fMapTifSidToSifLocalSessionId"))
if mibBuilder.loadTexts: usdL2fMapTifSidToSifEntry.setStatus('current')
usdL2fMapTifSidToSifTunnelIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fMapTifSidToSifTunnelIfIndex.setStatus('current')
usdL2fMapTifSidToSifLocalSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 2), UsdL2fSessionId())
if mibBuilder.loadTexts: usdL2fMapTifSidToSifLocalSessionId.setStatus('current')
usdL2fMapTifSidToSifSessionIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 3), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fMapTifSidToSifSessionIfIndex.setStatus('current')
usdL2fMapTidToTifTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2), )
if mibBuilder.loadTexts: usdL2fMapTidToTifTable.setStatus('current')
usdL2fMapTidToTifEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fMapTidToTifLocalTunnelId"))
if mibBuilder.loadTexts: usdL2fMapTidToTifEntry.setStatus('current')
usdL2fMapTidToTifLocalTunnelId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1, 1), UsdL2fTunnelId())
if mibBuilder.loadTexts: usdL2fMapTidToTifLocalTunnelId.setStatus('current')
usdL2fMapTidToTifIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1, 2), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fMapTidToTifIfIndex.setStatus('current')
usdL2fSessionConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1))
usdL2fSessionStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2))
usdL2fSessionStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3))
usdL2fSessionConfigTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2), )
if mibBuilder.loadTexts: usdL2fSessionConfigTable.setStatus('current')
usdL2fSessionConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fSessionConfigIfIndex"))
if mibBuilder.loadTexts: usdL2fSessionConfigEntry.setStatus('current')
usdL2fSessionConfigIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fSessionConfigIfIndex.setStatus('current')
usdL2fSessionConfigRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fSessionConfigRowStatus.setStatus('current')
usdL2fSessionConfigAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 3), UsdL2fAdminState().clone('enabled')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usdL2fSessionConfigAdminState.setStatus('current')
usdL2fSessionStatusTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1), )
if mibBuilder.loadTexts: usdL2fSessionStatusTable.setStatus('current')
usdL2fSessionStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fSessionStatusIfIndex"))
if mibBuilder.loadTexts: usdL2fSessionStatusEntry.setStatus('current')
usdL2fSessionStatusIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fSessionStatusIfIndex.setStatus('current')
usdL2fSessionStatusLocalSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 2), UsdL2fSessionId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusLocalSessionId.setStatus('current')
usdL2fSessionStatusRemoteSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 3), UsdL2fSessionId()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusRemoteSessionId.setStatus('current')
usdL2fSessionStatusUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusUserName.setStatus('current')
usdL2fSessionStatusEffectiveAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 5), UsdL2fAdminState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusEffectiveAdminState.setStatus('current')
usdL2fSessionStatusState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("idle", 0), ("connecting", 1), ("established", 2), ("disconnecting", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusState.setStatus('current')
usdL2fSessionStatusCallType = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 0), ("lacIncoming", 1), ("lnsIncoming", 2), ("lacOutgoing", 3), ("lnsOutgoing", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusCallType.setStatus('current')
usdL2fSessionStatusTxConnectSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusTxConnectSpeed.setStatus('current')
usdL2fSessionStatusRxConnectSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusRxConnectSpeed.setStatus('current')
usdL2fSessionStatusProxyLcp = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 10), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusProxyLcp.setStatus('current')
usdL2fSessionStatusAuthMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("pppChap", 1), ("pppPap", 2), ("pppMsChap", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusAuthMethod.setStatus('current')
usdL2fSessionStatusSequencingState = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("remote", 1), ("local", 2), ("both", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusSequencingState.setStatus('current')
usdL2fSessionStatusLacTunneledIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 13), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusLacTunneledIfIndex.setStatus('current')
usdL2fSessionStatusCumEstabTime = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 14), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatusCumEstabTime.setStatus('current')
usdL2fSessionStatTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1), )
if mibBuilder.loadTexts: usdL2fSessionStatTable.setStatus('current')
usdL2fSessionStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fSessionStatIfIndex"))
if mibBuilder.loadTexts: usdL2fSessionStatEntry.setStatus('current')
usdL2fSessionStatIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fSessionStatIfIndex.setStatus('current')
usdL2fSessionStatPayRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPayRecvOctets.setStatus('current')
usdL2fSessionStatPayRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPayRecvPackets.setStatus('current')
usdL2fSessionStatPayRecvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPayRecvErrors.setStatus('current')
usdL2fSessionStatPayRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPayRecvDiscards.setStatus('current')
usdL2fSessionStatPaySendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPaySendOctets.setStatus('current')
usdL2fSessionStatPaySendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPaySendPackets.setStatus('current')
usdL2fSessionStatPaySendErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPaySendErrors.setStatus('current')
usdL2fSessionStatPaySendDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPaySendDiscards.setStatus('current')
usdL2fSessionStatRecvOutOfSequence = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatRecvOutOfSequence.setStatus('current')
usdL2fSessionStatResequencingTimeouts = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatResequencingTimeouts.setStatus('current')
usdL2fSessionStatPayLostPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fSessionStatPayLostPackets.setStatus('current')
usdL2fTransportUdpIp = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1))
usdL2fUdpIpDestination = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1))
usdL2fUdpIpTunnel = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2))
usdL2fUdpIpDestTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1), )
if mibBuilder.loadTexts: usdL2fUdpIpDestTable.setStatus('current')
usdL2fUdpIpDestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fUdpIpDestIfIndex"))
if mibBuilder.loadTexts: usdL2fUdpIpDestEntry.setStatus('current')
usdL2fUdpIpDestIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fUdpIpDestIfIndex.setStatus('current')
usdL2fUdpIpDestRouterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpDestRouterIndex.setStatus('current')
usdL2fUdpIpDestLocalAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpDestLocalAddress.setStatus('current')
usdL2fUdpIpDestRemoteAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpDestRemoteAddress.setStatus('current')
usdL2fUdpIpTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1), )
if mibBuilder.loadTexts: usdL2fUdpIpTunnelTable.setStatus('current')
usdL2fUdpIpTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1), ).setIndexNames((0, "Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelIfIndex"))
if mibBuilder.loadTexts: usdL2fUdpIpTunnelEntry.setStatus('current')
usdL2fUdpIpTunnelIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: usdL2fUdpIpTunnelIfIndex.setStatus('current')
usdL2fUdpIpTunnelRouterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpTunnelRouterIndex.setStatus('current')
usdL2fUdpIpTunnelLocalAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpTunnelLocalAddress.setStatus('current')
usdL2fUdpIpTunnelLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpTunnelLocalPort.setStatus('current')
usdL2fUdpIpTunnelRemoteAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpTunnelRemoteAddress.setStatus('current')
usdL2fUdpIpTunnelRemotePort = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usdL2fUdpIpTunnelRemotePort.setStatus('current')
usdL2fGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1))
usdL2fCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 2))
usdL2fCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 2, 1)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fConfigGroup"), ("Unisphere-Data-L2F-MIB", "usdL2fStatusGroup"), ("Unisphere-Data-L2F-MIB", "usdL2fStatGroup"), ("Unisphere-Data-L2F-MIB", "usdL2fMapGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fCompliance = usdL2fCompliance.setStatus('current')
usdL2fConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 1)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fSysConfigAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fSysConfigDestructTimeout"), ("Unisphere-Data-L2F-MIB", "usdL2fSysConfigIpChecksumEnable"), ("Unisphere-Data-L2F-MIB", "usdL2fSysConfigReceiveDataSequencingIgnore"), ("Unisphere-Data-L2F-MIB", "usdL2fDestConfigRowStatus"), ("Unisphere-Data-L2F-MIB", "usdL2fDestConfigAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelConfigRowStatus"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelConfigAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionConfigRowStatus"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionConfigAdminState"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fConfigGroup = usdL2fConfigGroup.setStatus('current')
usdL2fStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 2)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fSysStatusProtocolVersion"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusVendorName"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusFirmwareRev"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusTotalDestinations"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusFailedDestinations"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusActiveDestinations"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusTotalTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusFailedTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusFailedTunnelAuthens"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusActiveTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusTotalSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusFailedSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fSysStatusActiveSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusTransport"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusEffectiveAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusTotalTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusFailedTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusFailedTunnelAuthens"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusActiveTunnels"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusTotalSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusFailedSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatusActiveSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusTransport"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusLocalTunnelId"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusRemoteTunnelId"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusEffectiveAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusState"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusInitiated"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusRemoteHostName"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusTotalSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusFailedSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusActiveSessions"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusLastErrorCode"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusLastErrorMessage"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatusCumEstabTime"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusLocalSessionId"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusRemoteSessionId"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusUserName"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusEffectiveAdminState"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusState"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusCallType"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusTxConnectSpeed"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusRxConnectSpeed"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusProxyLcp"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusAuthMethod"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusSequencingState"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusLacTunneledIfIndex"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatusCumEstabTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fStatusGroup = usdL2fStatusGroup.setStatus('current')
usdL2fStatGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 3)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlRecvOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlRecvPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlRecvErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlRecvDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlSendOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlSendPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlSendErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatCtlSendDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPayRecvOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPayRecvPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPayRecvErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPayRecvDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPaySendOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPaySendPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPaySendErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fDestStatPaySendDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlRecvOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlRecvPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlRecvErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlRecvDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlSendOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlSendPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlSendErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlSendDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPayRecvOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPayRecvPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPayRecvErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPayRecvDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPaySendOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPaySendPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPaySendErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatPaySendDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fTunnelStatCtlRecvOutOfSequence"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPayRecvOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPayRecvPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPayRecvErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPayRecvDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPaySendOctets"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPaySendPackets"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPaySendErrors"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPaySendDiscards"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatRecvOutOfSequence"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatResequencingTimeouts"), ("Unisphere-Data-L2F-MIB", "usdL2fSessionStatPayLostPackets"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fStatGroup = usdL2fStatGroup.setStatus('current')
usdL2fMapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 4)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fMapTifSidToSifSessionIfIndex"), ("Unisphere-Data-L2F-MIB", "usdL2fMapTidToTifIfIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fMapGroup = usdL2fMapGroup.setStatus('current')
usdL2fUdpIpGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 5)).setObjects(("Unisphere-Data-L2F-MIB", "usdL2fUdpIpDestRouterIndex"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpDestLocalAddress"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpDestRemoteAddress"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelRouterIndex"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelLocalAddress"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelLocalPort"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelRemoteAddress"), ("Unisphere-Data-L2F-MIB", "usdL2fUdpIpTunnelRemotePort"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usdL2fUdpIpGroup = usdL2fUdpIpGroup.setStatus('current')
mibBuilder.exportSymbols("Unisphere-Data-L2F-MIB", usdL2fUdpIpTunnelEntry=usdL2fUdpIpTunnelEntry, usdL2fTraps=usdL2fTraps, usdL2fTunnelConfigEntry=usdL2fTunnelConfigEntry, usdL2fSessionStatusUserName=usdL2fSessionStatusUserName, usdL2fDestStatPaySendErrors=usdL2fDestStatPaySendErrors, usdL2fDestConfigIfIndex=usdL2fDestConfigIfIndex, usdL2fTunnelStatCtlSendPackets=usdL2fTunnelStatCtlSendPackets, usdL2fTunnelStatusCumEstabTime=usdL2fTunnelStatusCumEstabTime, usdL2fDestStatusTable=usdL2fDestStatusTable, usdL2fDestStatusFailedTunnelAuthens=usdL2fDestStatusFailedTunnelAuthens, usdL2fTunnelStatusTable=usdL2fTunnelStatusTable, usdL2fSessionStatistics=usdL2fSessionStatistics, usdL2fSysStatusFailedTunnels=usdL2fSysStatusFailedTunnels, usdL2fSystemStatus=usdL2fSystemStatus, usdL2fDestStatusActiveSessions=usdL2fDestStatusActiveSessions, usdL2fTunnelStatCtlRecvDiscards=usdL2fTunnelStatCtlRecvDiscards, usdL2fSysStatusActiveDestinations=usdL2fSysStatusActiveDestinations, usdL2fUdpIpTunnel=usdL2fUdpIpTunnel, usdL2fDestStatusEntry=usdL2fDestStatusEntry, usdL2fDestStatCtlRecvOctets=usdL2fDestStatCtlRecvOctets, usdL2fDestStatus=usdL2fDestStatus, usdL2fTrapControl=usdL2fTrapControl, usdL2fObjects=usdL2fObjects, usdL2fDestStatCtlRecvErrors=usdL2fDestStatCtlRecvErrors, usdL2fTunnelStatusTransport=usdL2fTunnelStatusTransport, usdL2fTransport=usdL2fTransport, usdL2fDestStatPayRecvDiscards=usdL2fDestStatPayRecvDiscards, usdL2fTunnelStatusEffectiveAdminState=usdL2fTunnelStatusEffectiveAdminState, usdL2fDestStatusIfIndex=usdL2fDestStatusIfIndex, usdL2fUdpIpDestEntry=usdL2fUdpIpDestEntry, usdL2fTunnelConfigTable=usdL2fTunnelConfigTable, usdL2fSessionStatPaySendDiscards=usdL2fSessionStatPaySendDiscards, usdL2fStatGroup=usdL2fStatGroup, usdL2fMapTidToTifLocalTunnelId=usdL2fMapTidToTifLocalTunnelId, usdL2fDestConfigEntry=usdL2fDestConfigEntry, usdL2fSessionStatusTable=usdL2fSessionStatusTable, usdL2fTunnelStatPaySendErrors=usdL2fTunnelStatPaySendErrors, usdL2fSysStatusFirmwareRev=usdL2fSysStatusFirmwareRev, usdL2fMapTidToTifTable=usdL2fMapTidToTifTable, usdL2fDestStatPayRecvPackets=usdL2fDestStatPayRecvPackets, usdL2fUdpIpDestRemoteAddress=usdL2fUdpIpDestRemoteAddress, usdL2fSession=usdL2fSession, usdL2fSysStatusProtocolVersion=usdL2fSysStatusProtocolVersion, usdL2fSysStatusVendorName=usdL2fSysStatusVendorName, usdL2fSessionConfigEntry=usdL2fSessionConfigEntry, usdL2fSessionStatPayRecvErrors=usdL2fSessionStatPayRecvErrors, usdL2fTunnelStatPayRecvPackets=usdL2fTunnelStatPayRecvPackets, usdL2fSessionConfigRowStatus=usdL2fSessionConfigRowStatus, usdL2fMapTifSidToSifTable=usdL2fMapTifSidToSifTable, usdL2fUdpIpDestIfIndex=usdL2fUdpIpDestIfIndex, usdL2fStatusGroup=usdL2fStatusGroup, usdL2fMapTifSidToSifEntry=usdL2fMapTifSidToSifEntry, usdL2fSysStatusTotalDestinations=usdL2fSysStatusTotalDestinations, usdL2fDestStatusFailedSessions=usdL2fDestStatusFailedSessions, usdL2fDestStatCtlSendOctets=usdL2fDestStatCtlSendOctets, usdL2fTunnelStatus=usdL2fTunnelStatus, usdL2fUdpIpTunnelLocalAddress=usdL2fUdpIpTunnelLocalAddress, usdL2fTunnelStatusLastErrorCode=usdL2fTunnelStatusLastErrorCode, usdL2fUdpIpDestLocalAddress=usdL2fUdpIpDestLocalAddress, usdL2fDestConfigAdminState=usdL2fDestConfigAdminState, usdL2fTunnelConfigRowStatus=usdL2fTunnelConfigRowStatus, usdL2fTunnelStatusFailedSessions=usdL2fTunnelStatusFailedSessions, usdL2fTunnelStatusActiveSessions=usdL2fTunnelStatusActiveSessions, usdL2fSessionStatusEntry=usdL2fSessionStatusEntry, usdL2fMapTidToTifEntry=usdL2fMapTidToTifEntry, usdL2fSessionConfigAdminState=usdL2fSessionConfigAdminState, usdL2fDestStatTable=usdL2fDestStatTable, usdL2fTunnelStatusTotalSessions=usdL2fTunnelStatusTotalSessions, usdL2fTunnelStatCtlSendOctets=usdL2fTunnelStatCtlSendOctets, usdL2fTunnelStatTable=usdL2fTunnelStatTable, usdL2fMapTifSidToSifLocalSessionId=usdL2fMapTifSidToSifLocalSessionId, usdL2fSessionStatPaySendOctets=usdL2fSessionStatPaySendOctets, usdL2fSystem=usdL2fSystem, usdL2fSessionStatIfIndex=usdL2fSessionStatIfIndex, usdL2fSessionConfig=usdL2fSessionConfig, usdL2fDestStatPaySendOctets=usdL2fDestStatPaySendOctets, usdL2fSessionStatResequencingTimeouts=usdL2fSessionStatResequencingTimeouts, usdL2fCompliance=usdL2fCompliance, usdL2fSessionStatusCallType=usdL2fSessionStatusCallType, usdL2fSessionStatPayRecvPackets=usdL2fSessionStatPayRecvPackets, usdL2fTunnelStatPaySendDiscards=usdL2fTunnelStatPaySendDiscards, usdL2fTunnelMap=usdL2fTunnelMap, usdL2fConformance=usdL2fConformance, usdL2fSysStatusTotalTunnels=usdL2fSysStatusTotalTunnels, usdL2fDestStatCtlRecvPackets=usdL2fDestStatCtlRecvPackets, usdL2fTunnelStatCtlRecvErrors=usdL2fTunnelStatCtlRecvErrors, usdL2fTunnelStatCtlSendErrors=usdL2fTunnelStatCtlSendErrors, usdL2fSessionStatusRxConnectSpeed=usdL2fSessionStatusRxConnectSpeed, usdL2fSystemConfig=usdL2fSystemConfig, usdL2fSessionStatusTxConnectSpeed=usdL2fSessionStatusTxConnectSpeed, usdL2fSessionStatusSequencingState=usdL2fSessionStatusSequencingState, usdL2fDestStatEntry=usdL2fDestStatEntry, usdL2fUdpIpGroup=usdL2fUdpIpGroup, usdL2fTunnelStatPaySendPackets=usdL2fTunnelStatPaySendPackets, usdL2fTunnelStatusEntry=usdL2fTunnelStatusEntry, usdL2fSessionStatusRemoteSessionId=usdL2fSessionStatusRemoteSessionId, usdL2fDestConfigTable=usdL2fDestConfigTable, usdL2fDestStatPayRecvErrors=usdL2fDestStatPayRecvErrors, usdL2fSysStatusFailedDestinations=usdL2fSysStatusFailedDestinations, usdL2fDestStatIfIndex=usdL2fDestStatIfIndex, UsdL2fTunnelId=UsdL2fTunnelId, usdL2fDestStatCtlRecvDiscards=usdL2fDestStatCtlRecvDiscards, usdL2fTunnelStatusIfIndex=usdL2fTunnelStatusIfIndex, usdL2fSessionStatusProxyLcp=usdL2fSessionStatusProxyLcp, usdL2fSessionStatusState=usdL2fSessionStatusState, usdL2fSessionStatusCumEstabTime=usdL2fSessionStatusCumEstabTime, usdL2fUdpIpDestRouterIndex=usdL2fUdpIpDestRouterIndex, UsdL2fSessionId=UsdL2fSessionId, usdL2fMIB=usdL2fMIB, usdL2fUdpIpDestTable=usdL2fUdpIpDestTable, usdL2fDestStatusTotalTunnels=usdL2fDestStatusTotalTunnels, usdL2fSessionStatus=usdL2fSessionStatus, usdL2fDestStatCtlSendErrors=usdL2fDestStatCtlSendErrors, usdL2fSessionStatusLacTunneledIfIndex=usdL2fSessionStatusLacTunneledIfIndex, usdL2fMapTifSidToSifSessionIfIndex=usdL2fMapTifSidToSifSessionIfIndex, usdL2fDestStatCtlSendPackets=usdL2fDestStatCtlSendPackets, usdL2fDestStatPaySendPackets=usdL2fDestStatPaySendPackets, usdL2fSessionStatPayRecvDiscards=usdL2fSessionStatPayRecvDiscards, usdL2fTunnel=usdL2fTunnel, usdL2fUdpIpTunnelRemoteAddress=usdL2fUdpIpTunnelRemoteAddress, usdL2fGroups=usdL2fGroups, usdL2fCompliances=usdL2fCompliances, usdL2fDestConfig=usdL2fDestConfig, UsdL2fTransport=UsdL2fTransport, usdL2fTunnelStatPayRecvDiscards=usdL2fTunnelStatPayRecvDiscards, usdL2fTransportUdpIp=usdL2fTransportUdpIp, usdL2fTunnelStatCtlRecvOutOfSequence=usdL2fTunnelStatCtlRecvOutOfSequence, UsdL2fAdminState=UsdL2fAdminState, usdL2fTunnelStatPayRecvErrors=usdL2fTunnelStatPayRecvErrors, usdL2fTunnelStatusRemoteTunnelId=usdL2fTunnelStatusRemoteTunnelId, usdL2fTunnelStatistics=usdL2fTunnelStatistics, PYSNMP_MODULE_ID=usdL2fMIB, usdL2fSessionStatusLocalSessionId=usdL2fSessionStatusLocalSessionId, usdL2fTunnelStatusLastErrorMessage=usdL2fTunnelStatusLastErrorMessage, usdL2fTunnelStatPaySendOctets=usdL2fTunnelStatPaySendOctets, usdL2fMapTifSidToSifTunnelIfIndex=usdL2fMapTifSidToSifTunnelIfIndex, usdL2fDestConfigRowStatus=usdL2fDestConfigRowStatus, usdL2fDestination=usdL2fDestination, usdL2fTunnelStatusRemoteHostName=usdL2fTunnelStatusRemoteHostName, usdL2fSysConfigDestructTimeout=usdL2fSysConfigDestructTimeout, usdL2fSessionStatRecvOutOfSequence=usdL2fSessionStatRecvOutOfSequence, usdL2fSysConfigAdminState=usdL2fSysConfigAdminState, usdL2fDestStatusEffectiveAdminState=usdL2fDestStatusEffectiveAdminState, usdL2fTunnelStatusState=usdL2fTunnelStatusState, usdL2fTunnelStatIfIndex=usdL2fTunnelStatIfIndex, usdL2fDestStatusTransport=usdL2fDestStatusTransport, usdL2fTunnelConfig=usdL2fTunnelConfig, usdL2fDestStatPaySendDiscards=usdL2fDestStatPaySendDiscards, usdL2fDestStatusActiveTunnels=usdL2fDestStatusActiveTunnels, usdL2fSysStatusFailedTunnelAuthens=usdL2fSysStatusFailedTunnelAuthens, usdL2fDestStatusTotalSessions=usdL2fDestStatusTotalSessions, usdL2fDestStatCtlSendDiscards=usdL2fDestStatCtlSendDiscards, usdL2fSessionConfigTable=usdL2fSessionConfigTable, usdL2fSessionStatPaySendErrors=usdL2fSessionStatPaySendErrors, usdL2fSessionStatPayLostPackets=usdL2fSessionStatPayLostPackets, usdL2fSysStatusFailedSessions=usdL2fSysStatusFailedSessions, usdL2fSessionStatPaySendPackets=usdL2fSessionStatPaySendPackets, usdL2fTunnelStatCtlRecvPackets=usdL2fTunnelStatCtlRecvPackets, usdL2fDestStatistics=usdL2fDestStatistics, usdL2fTunnelStatPayRecvOctets=usdL2fTunnelStatPayRecvOctets, usdL2fSysStatusActiveTunnels=usdL2fSysStatusActiveTunnels, usdL2fSessionStatusIfIndex=usdL2fSessionStatusIfIndex, usdL2fUdpIpTunnelRouterIndex=usdL2fUdpIpTunnelRouterIndex, usdL2fSysStatusActiveSessions=usdL2fSysStatusActiveSessions, usdL2fUdpIpTunnelRemotePort=usdL2fUdpIpTunnelRemotePort, usdL2fDestStatusFailedTunnels=usdL2fDestStatusFailedTunnels, usdL2fUdpIpTunnelLocalPort=usdL2fUdpIpTunnelLocalPort, usdL2fUdpIpDestination=usdL2fUdpIpDestination, usdL2fConfigGroup=usdL2fConfigGroup, usdL2fTunnelStatEntry=usdL2fTunnelStatEntry, usdL2fSessionConfigIfIndex=usdL2fSessionConfigIfIndex, usdL2fMapTidToTifIfIndex=usdL2fMapTidToTifIfIndex, usdL2fTunnelConfigIfIndex=usdL2fTunnelConfigIfIndex, usdL2fTunnelStatusLocalTunnelId=usdL2fTunnelStatusLocalTunnelId, usdL2fDestStatPayRecvOctets=usdL2fDestStatPayRecvOctets, usdL2fTunnelStatCtlSendDiscards=usdL2fTunnelStatCtlSendDiscards, usdL2fSysConfigReceiveDataSequencingIgnore=usdL2fSysConfigReceiveDataSequencingIgnore, usdL2fSessionStatusEffectiveAdminState=usdL2fSessionStatusEffectiveAdminState, usdL2fUdpIpTunnelTable=usdL2fUdpIpTunnelTable, usdL2fSessionStatTable=usdL2fSessionStatTable, usdL2fSessionStatPayRecvOctets=usdL2fSessionStatPayRecvOctets, usdL2fSysStatusTotalSessions=usdL2fSysStatusTotalSessions, usdL2fUdpIpTunnelIfIndex=usdL2fUdpIpTunnelIfIndex, usdL2fTunnelStatCtlRecvOctets=usdL2fTunnelStatCtlRecvOctets, usdL2fSessionStatusAuthMethod=usdL2fSessionStatusAuthMethod, usdL2fSessionStatEntry=usdL2fSessionStatEntry, usdL2fMapGroup=usdL2fMapGroup, usdL2fTunnelConfigAdminState=usdL2fTunnelConfigAdminState, usdL2fTunnelStatusInitiated=usdL2fTunnelStatusInitiated, usdL2fSysConfigIpChecksumEnable=usdL2fSysConfigIpChecksumEnable)
|
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint')
(interface_index, interface_index_or_zero) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex', 'InterfaceIndexOrZero')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(ip_address, module_identity, object_identity, notification_type, bits, integer32, iso, counter32, unsigned32, time_ticks, mib_identifier, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'ModuleIdentity', 'ObjectIdentity', 'NotificationType', 'Bits', 'Integer32', 'iso', 'Counter32', 'Unsigned32', 'TimeTicks', 'MibIdentifier', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32')
(truth_value, textual_convention, display_string, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'DisplayString', 'RowStatus')
(us_data_mibs,) = mibBuilder.importSymbols('Unisphere-Data-MIBs', 'usDataMibs')
(usd_enable,) = mibBuilder.importSymbols('Unisphere-Data-TC', 'UsdEnable')
usd_l2f_mib = module_identity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53))
usdL2fMIB.setRevisions(('2001-09-25 13:54', '2001-09-19 18:07'))
if mibBuilder.loadTexts:
usdL2fMIB.setLastUpdated('200109251354Z')
if mibBuilder.loadTexts:
usdL2fMIB.setOrganization('Unisphere Networks, Inc.')
class Usdl2Ftunnelid(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Usdl2Fsessionid(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Usdl2Fadminstate(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2))
named_values = named_values(('enabled', 0), ('disabled', 1), ('drain', 2))
class Usdl2Ftransport(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1))
named_values = named_values(('other', 0), ('udpIp', 1))
usd_l2f_traps = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 0))
usd_l2f_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1))
usd_l2f_trap_control = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 2))
usd_l2f_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3))
usd_l2f_system = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1))
usd_l2f_destination = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2))
usd_l2f_tunnel = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3))
usd_l2f_session = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4))
usd_l2f_transport = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5))
usd_l2f_system_config = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1))
usd_l2f_system_status = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2))
usd_l2f_sys_config_admin_state = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 1), usd_l2f_admin_state()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
usdL2fSysConfigAdminState.setStatus('current')
usd_l2f_sys_config_destruct_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 3600))).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
usdL2fSysConfigDestructTimeout.setStatus('current')
usd_l2f_sys_config_ip_checksum_enable = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 3), usd_enable()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
usdL2fSysConfigIpChecksumEnable.setStatus('current')
usd_l2f_sys_config_receive_data_sequencing_ignore = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 1, 4), usd_enable()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
usdL2fSysConfigReceiveDataSequencingIgnore.setStatus('current')
usd_l2f_sys_status_protocol_version = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(2, 256))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusProtocolVersion.setStatus('current')
usd_l2f_sys_status_vendor_name = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusVendorName.setStatus('current')
usd_l2f_sys_status_firmware_rev = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusFirmwareRev.setStatus('current')
usd_l2f_sys_status_total_destinations = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusTotalDestinations.setStatus('current')
usd_l2f_sys_status_failed_destinations = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusFailedDestinations.setStatus('current')
usd_l2f_sys_status_active_destinations = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 6), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusActiveDestinations.setStatus('current')
usd_l2f_sys_status_total_tunnels = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusTotalTunnels.setStatus('current')
usd_l2f_sys_status_failed_tunnels = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusFailedTunnels.setStatus('current')
usd_l2f_sys_status_failed_tunnel_authens = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusFailedTunnelAuthens.setStatus('current')
usd_l2f_sys_status_active_tunnels = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 10), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusActiveTunnels.setStatus('current')
usd_l2f_sys_status_total_sessions = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusTotalSessions.setStatus('current')
usd_l2f_sys_status_failed_sessions = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusFailedSessions.setStatus('current')
usd_l2f_sys_status_active_sessions = mib_scalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 1, 2, 13), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSysStatusActiveSessions.setStatus('current')
usd_l2f_dest_config = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1))
usd_l2f_dest_status = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2))
usd_l2f_dest_statistics = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3))
usd_l2f_dest_config_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2))
if mibBuilder.loadTexts:
usdL2fDestConfigTable.setStatus('current')
usd_l2f_dest_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fDestConfigIfIndex'))
if mibBuilder.loadTexts:
usdL2fDestConfigEntry.setStatus('current')
usd_l2f_dest_config_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fDestConfigIfIndex.setStatus('current')
usd_l2f_dest_config_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 2), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fDestConfigRowStatus.setStatus('current')
usd_l2f_dest_config_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 1, 2, 1, 3), usd_l2f_admin_state().clone('enabled')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fDestConfigAdminState.setStatus('current')
usd_l2f_dest_status_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1))
if mibBuilder.loadTexts:
usdL2fDestStatusTable.setStatus('current')
usd_l2f_dest_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fDestStatusIfIndex'))
if mibBuilder.loadTexts:
usdL2fDestStatusEntry.setStatus('current')
usd_l2f_dest_status_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fDestStatusIfIndex.setStatus('current')
usd_l2f_dest_status_transport = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 2), usd_l2f_transport()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusTransport.setStatus('current')
usd_l2f_dest_status_effective_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 3), usd_l2f_admin_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusEffectiveAdminState.setStatus('current')
usd_l2f_dest_status_total_tunnels = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusTotalTunnels.setStatus('current')
usd_l2f_dest_status_failed_tunnels = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusFailedTunnels.setStatus('current')
usd_l2f_dest_status_failed_tunnel_authens = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusFailedTunnelAuthens.setStatus('current')
usd_l2f_dest_status_active_tunnels = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 7), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusActiveTunnels.setStatus('current')
usd_l2f_dest_status_total_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusTotalSessions.setStatus('current')
usd_l2f_dest_status_failed_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusFailedSessions.setStatus('current')
usd_l2f_dest_status_active_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 2, 1, 1, 10), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatusActiveSessions.setStatus('current')
usd_l2f_dest_stat_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1))
if mibBuilder.loadTexts:
usdL2fDestStatTable.setStatus('current')
usd_l2f_dest_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fDestStatIfIndex'))
if mibBuilder.loadTexts:
usdL2fDestStatEntry.setStatus('current')
usd_l2f_dest_stat_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fDestStatIfIndex.setStatus('current')
usd_l2f_dest_stat_ctl_recv_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlRecvOctets.setStatus('current')
usd_l2f_dest_stat_ctl_recv_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlRecvPackets.setStatus('current')
usd_l2f_dest_stat_ctl_recv_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlRecvErrors.setStatus('current')
usd_l2f_dest_stat_ctl_recv_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlRecvDiscards.setStatus('current')
usd_l2f_dest_stat_ctl_send_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlSendOctets.setStatus('current')
usd_l2f_dest_stat_ctl_send_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlSendPackets.setStatus('current')
usd_l2f_dest_stat_ctl_send_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlSendErrors.setStatus('current')
usd_l2f_dest_stat_ctl_send_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatCtlSendDiscards.setStatus('current')
usd_l2f_dest_stat_pay_recv_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPayRecvOctets.setStatus('current')
usd_l2f_dest_stat_pay_recv_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPayRecvPackets.setStatus('current')
usd_l2f_dest_stat_pay_recv_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPayRecvErrors.setStatus('current')
usd_l2f_dest_stat_pay_recv_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPayRecvDiscards.setStatus('current')
usd_l2f_dest_stat_pay_send_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPaySendOctets.setStatus('current')
usd_l2f_dest_stat_pay_send_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPaySendPackets.setStatus('current')
usd_l2f_dest_stat_pay_send_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 16), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPaySendErrors.setStatus('current')
usd_l2f_dest_stat_pay_send_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 2, 3, 1, 1, 17), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fDestStatPaySendDiscards.setStatus('current')
usd_l2f_tunnel_config = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1))
usd_l2f_tunnel_status = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2))
usd_l2f_tunnel_statistics = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3))
usd_l2f_tunnel_map = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4))
usd_l2f_tunnel_config_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2))
if mibBuilder.loadTexts:
usdL2fTunnelConfigTable.setStatus('current')
usd_l2f_tunnel_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fTunnelConfigIfIndex'))
if mibBuilder.loadTexts:
usdL2fTunnelConfigEntry.setStatus('current')
usd_l2f_tunnel_config_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fTunnelConfigIfIndex.setStatus('current')
usd_l2f_tunnel_config_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 2), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fTunnelConfigRowStatus.setStatus('current')
usd_l2f_tunnel_config_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 1, 2, 1, 3), usd_l2f_admin_state().clone('enabled')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fTunnelConfigAdminState.setStatus('current')
usd_l2f_tunnel_status_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1))
if mibBuilder.loadTexts:
usdL2fTunnelStatusTable.setStatus('current')
usd_l2f_tunnel_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusIfIndex'))
if mibBuilder.loadTexts:
usdL2fTunnelStatusEntry.setStatus('current')
usd_l2f_tunnel_status_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fTunnelStatusIfIndex.setStatus('current')
usd_l2f_tunnel_status_transport = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 2), usd_l2f_transport()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusTransport.setStatus('current')
usd_l2f_tunnel_status_local_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 3), usd_l2f_tunnel_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusLocalTunnelId.setStatus('current')
usd_l2f_tunnel_status_remote_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 4), usd_l2f_tunnel_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusRemoteTunnelId.setStatus('current')
usd_l2f_tunnel_status_effective_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 5), usd_l2f_admin_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusEffectiveAdminState.setStatus('current')
usd_l2f_tunnel_status_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('idle', 0), ('connecting', 1), ('established', 2), ('disconnecting', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusState.setStatus('current')
usd_l2f_tunnel_status_initiated = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('none', 0), ('local', 1), ('remote', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusInitiated.setStatus('current')
usd_l2f_tunnel_status_remote_host_name = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 8), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusRemoteHostName.setStatus('current')
usd_l2f_tunnel_status_total_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusTotalSessions.setStatus('current')
usd_l2f_tunnel_status_failed_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusFailedSessions.setStatus('current')
usd_l2f_tunnel_status_active_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 11), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusActiveSessions.setStatus('current')
usd_l2f_tunnel_status_last_error_code = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusLastErrorCode.setStatus('current')
usd_l2f_tunnel_status_last_error_message = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 13), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusLastErrorMessage.setStatus('current')
usd_l2f_tunnel_status_cum_estab_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 2, 1, 1, 14), unsigned32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatusCumEstabTime.setStatus('current')
usd_l2f_tunnel_stat_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1))
if mibBuilder.loadTexts:
usdL2fTunnelStatTable.setStatus('current')
usd_l2f_tunnel_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatIfIndex'))
if mibBuilder.loadTexts:
usdL2fTunnelStatEntry.setStatus('current')
usd_l2f_tunnel_stat_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fTunnelStatIfIndex.setStatus('current')
usd_l2f_tunnel_stat_ctl_recv_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlRecvOctets.setStatus('current')
usd_l2f_tunnel_stat_ctl_recv_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlRecvPackets.setStatus('current')
usd_l2f_tunnel_stat_ctl_recv_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlRecvErrors.setStatus('current')
usd_l2f_tunnel_stat_ctl_recv_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlRecvDiscards.setStatus('current')
usd_l2f_tunnel_stat_ctl_send_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlSendOctets.setStatus('current')
usd_l2f_tunnel_stat_ctl_send_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlSendPackets.setStatus('current')
usd_l2f_tunnel_stat_ctl_send_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlSendErrors.setStatus('current')
usd_l2f_tunnel_stat_ctl_send_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlSendDiscards.setStatus('current')
usd_l2f_tunnel_stat_pay_recv_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPayRecvOctets.setStatus('current')
usd_l2f_tunnel_stat_pay_recv_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPayRecvPackets.setStatus('current')
usd_l2f_tunnel_stat_pay_recv_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPayRecvErrors.setStatus('current')
usd_l2f_tunnel_stat_pay_recv_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPayRecvDiscards.setStatus('current')
usd_l2f_tunnel_stat_pay_send_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPaySendOctets.setStatus('current')
usd_l2f_tunnel_stat_pay_send_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPaySendPackets.setStatus('current')
usd_l2f_tunnel_stat_pay_send_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 16), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPaySendErrors.setStatus('current')
usd_l2f_tunnel_stat_pay_send_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 17), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatPaySendDiscards.setStatus('current')
usd_l2f_tunnel_stat_ctl_recv_out_of_sequence = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 3, 1, 1, 18), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fTunnelStatCtlRecvOutOfSequence.setStatus('current')
usd_l2f_map_tif_sid_to_sif_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1))
if mibBuilder.loadTexts:
usdL2fMapTifSidToSifTable.setStatus('current')
usd_l2f_map_tif_sid_to_sif_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fMapTifSidToSifTunnelIfIndex'), (0, 'Unisphere-Data-L2F-MIB', 'usdL2fMapTifSidToSifLocalSessionId'))
if mibBuilder.loadTexts:
usdL2fMapTifSidToSifEntry.setStatus('current')
usd_l2f_map_tif_sid_to_sif_tunnel_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fMapTifSidToSifTunnelIfIndex.setStatus('current')
usd_l2f_map_tif_sid_to_sif_local_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 2), usd_l2f_session_id())
if mibBuilder.loadTexts:
usdL2fMapTifSidToSifLocalSessionId.setStatus('current')
usd_l2f_map_tif_sid_to_sif_session_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 1, 1, 3), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fMapTifSidToSifSessionIfIndex.setStatus('current')
usd_l2f_map_tid_to_tif_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2))
if mibBuilder.loadTexts:
usdL2fMapTidToTifTable.setStatus('current')
usd_l2f_map_tid_to_tif_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fMapTidToTifLocalTunnelId'))
if mibBuilder.loadTexts:
usdL2fMapTidToTifEntry.setStatus('current')
usd_l2f_map_tid_to_tif_local_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1, 1), usd_l2f_tunnel_id())
if mibBuilder.loadTexts:
usdL2fMapTidToTifLocalTunnelId.setStatus('current')
usd_l2f_map_tid_to_tif_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 3, 4, 2, 1, 2), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fMapTidToTifIfIndex.setStatus('current')
usd_l2f_session_config = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1))
usd_l2f_session_status = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2))
usd_l2f_session_statistics = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3))
usd_l2f_session_config_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2))
if mibBuilder.loadTexts:
usdL2fSessionConfigTable.setStatus('current')
usd_l2f_session_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fSessionConfigIfIndex'))
if mibBuilder.loadTexts:
usdL2fSessionConfigEntry.setStatus('current')
usd_l2f_session_config_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fSessionConfigIfIndex.setStatus('current')
usd_l2f_session_config_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 2), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fSessionConfigRowStatus.setStatus('current')
usd_l2f_session_config_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 1, 2, 1, 3), usd_l2f_admin_state().clone('enabled')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usdL2fSessionConfigAdminState.setStatus('current')
usd_l2f_session_status_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1))
if mibBuilder.loadTexts:
usdL2fSessionStatusTable.setStatus('current')
usd_l2f_session_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusIfIndex'))
if mibBuilder.loadTexts:
usdL2fSessionStatusEntry.setStatus('current')
usd_l2f_session_status_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fSessionStatusIfIndex.setStatus('current')
usd_l2f_session_status_local_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 2), usd_l2f_session_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusLocalSessionId.setStatus('current')
usd_l2f_session_status_remote_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 3), usd_l2f_session_id()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusRemoteSessionId.setStatus('current')
usd_l2f_session_status_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusUserName.setStatus('current')
usd_l2f_session_status_effective_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 5), usd_l2f_admin_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusEffectiveAdminState.setStatus('current')
usd_l2f_session_status_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('idle', 0), ('connecting', 1), ('established', 2), ('disconnecting', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusState.setStatus('current')
usd_l2f_session_status_call_type = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4))).clone(namedValues=named_values(('none', 0), ('lacIncoming', 1), ('lnsIncoming', 2), ('lacOutgoing', 3), ('lnsOutgoing', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusCallType.setStatus('current')
usd_l2f_session_status_tx_connect_speed = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusTxConnectSpeed.setStatus('current')
usd_l2f_session_status_rx_connect_speed = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusRxConnectSpeed.setStatus('current')
usd_l2f_session_status_proxy_lcp = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 10), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusProxyLcp.setStatus('current')
usd_l2f_session_status_auth_method = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('none', 0), ('pppChap', 1), ('pppPap', 2), ('pppMsChap', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusAuthMethod.setStatus('current')
usd_l2f_session_status_sequencing_state = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('none', 0), ('remote', 1), ('local', 2), ('both', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusSequencingState.setStatus('current')
usd_l2f_session_status_lac_tunneled_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 13), interface_index_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusLacTunneledIfIndex.setStatus('current')
usd_l2f_session_status_cum_estab_time = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 2, 1, 1, 14), unsigned32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatusCumEstabTime.setStatus('current')
usd_l2f_session_stat_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1))
if mibBuilder.loadTexts:
usdL2fSessionStatTable.setStatus('current')
usd_l2f_session_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fSessionStatIfIndex'))
if mibBuilder.loadTexts:
usdL2fSessionStatEntry.setStatus('current')
usd_l2f_session_stat_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fSessionStatIfIndex.setStatus('current')
usd_l2f_session_stat_pay_recv_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPayRecvOctets.setStatus('current')
usd_l2f_session_stat_pay_recv_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPayRecvPackets.setStatus('current')
usd_l2f_session_stat_pay_recv_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPayRecvErrors.setStatus('current')
usd_l2f_session_stat_pay_recv_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPayRecvDiscards.setStatus('current')
usd_l2f_session_stat_pay_send_octets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPaySendOctets.setStatus('current')
usd_l2f_session_stat_pay_send_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPaySendPackets.setStatus('current')
usd_l2f_session_stat_pay_send_errors = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPaySendErrors.setStatus('current')
usd_l2f_session_stat_pay_send_discards = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPaySendDiscards.setStatus('current')
usd_l2f_session_stat_recv_out_of_sequence = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatRecvOutOfSequence.setStatus('current')
usd_l2f_session_stat_resequencing_timeouts = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatResequencingTimeouts.setStatus('current')
usd_l2f_session_stat_pay_lost_packets = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 4, 3, 1, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fSessionStatPayLostPackets.setStatus('current')
usd_l2f_transport_udp_ip = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1))
usd_l2f_udp_ip_destination = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1))
usd_l2f_udp_ip_tunnel = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2))
usd_l2f_udp_ip_dest_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1))
if mibBuilder.loadTexts:
usdL2fUdpIpDestTable.setStatus('current')
usd_l2f_udp_ip_dest_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fUdpIpDestIfIndex'))
if mibBuilder.loadTexts:
usdL2fUdpIpDestEntry.setStatus('current')
usd_l2f_udp_ip_dest_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fUdpIpDestIfIndex.setStatus('current')
usd_l2f_udp_ip_dest_router_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpDestRouterIndex.setStatus('current')
usd_l2f_udp_ip_dest_local_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 3), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpDestLocalAddress.setStatus('current')
usd_l2f_udp_ip_dest_remote_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 1, 1, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpDestRemoteAddress.setStatus('current')
usd_l2f_udp_ip_tunnel_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1))
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelTable.setStatus('current')
usd_l2f_udp_ip_tunnel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1)).setIndexNames((0, 'Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelIfIndex'))
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelEntry.setStatus('current')
usd_l2f_udp_ip_tunnel_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelIfIndex.setStatus('current')
usd_l2f_udp_ip_tunnel_router_index = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelRouterIndex.setStatus('current')
usd_l2f_udp_ip_tunnel_local_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 3), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelLocalAddress.setStatus('current')
usd_l2f_udp_ip_tunnel_local_port = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelLocalPort.setStatus('current')
usd_l2f_udp_ip_tunnel_remote_address = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 5), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelRemoteAddress.setStatus('current')
usd_l2f_udp_ip_tunnel_remote_port = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 1, 5, 1, 2, 1, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usdL2fUdpIpTunnelRemotePort.setStatus('current')
usd_l2f_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1))
usd_l2f_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 2))
usd_l2f_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 2, 1)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fConfigGroup'), ('Unisphere-Data-L2F-MIB', 'usdL2fStatusGroup'), ('Unisphere-Data-L2F-MIB', 'usdL2fStatGroup'), ('Unisphere-Data-L2F-MIB', 'usdL2fMapGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_compliance = usdL2fCompliance.setStatus('current')
usd_l2f_config_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 1)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fSysConfigAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysConfigDestructTimeout'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysConfigIpChecksumEnable'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysConfigReceiveDataSequencingIgnore'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestConfigRowStatus'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestConfigAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelConfigRowStatus'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelConfigAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionConfigRowStatus'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionConfigAdminState'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_config_group = usdL2fConfigGroup.setStatus('current')
usd_l2f_status_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 2)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusProtocolVersion'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusVendorName'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusFirmwareRev'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusTotalDestinations'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusFailedDestinations'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusActiveDestinations'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusTotalTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusFailedTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusFailedTunnelAuthens'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusActiveTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusTotalSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusFailedSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fSysStatusActiveSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusTransport'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusEffectiveAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusTotalTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusFailedTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusFailedTunnelAuthens'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusActiveTunnels'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusTotalSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusFailedSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatusActiveSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusTransport'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusLocalTunnelId'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusRemoteTunnelId'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusEffectiveAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusState'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusInitiated'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusRemoteHostName'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusTotalSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusFailedSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusActiveSessions'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusLastErrorCode'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusLastErrorMessage'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatusCumEstabTime'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusLocalSessionId'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusRemoteSessionId'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusUserName'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusEffectiveAdminState'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusState'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusCallType'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusTxConnectSpeed'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusRxConnectSpeed'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusProxyLcp'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusAuthMethod'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusSequencingState'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusLacTunneledIfIndex'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatusCumEstabTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_status_group = usdL2fStatusGroup.setStatus('current')
usd_l2f_stat_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 3)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlRecvOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlRecvPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlRecvErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlRecvDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlSendOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlSendPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlSendErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatCtlSendDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPayRecvOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPayRecvPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPayRecvErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPayRecvDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPaySendOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPaySendPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPaySendErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fDestStatPaySendDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlRecvOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlRecvPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlRecvErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlRecvDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlSendOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlSendPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlSendErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlSendDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPayRecvOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPayRecvPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPayRecvErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPayRecvDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPaySendOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPaySendPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPaySendErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatPaySendDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fTunnelStatCtlRecvOutOfSequence'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPayRecvOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPayRecvPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPayRecvErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPayRecvDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPaySendOctets'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPaySendPackets'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPaySendErrors'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPaySendDiscards'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatRecvOutOfSequence'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatResequencingTimeouts'), ('Unisphere-Data-L2F-MIB', 'usdL2fSessionStatPayLostPackets'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_stat_group = usdL2fStatGroup.setStatus('current')
usd_l2f_map_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 4)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fMapTifSidToSifSessionIfIndex'), ('Unisphere-Data-L2F-MIB', 'usdL2fMapTidToTifIfIndex'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_map_group = usdL2fMapGroup.setStatus('current')
usd_l2f_udp_ip_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 53, 3, 1, 5)).setObjects(('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpDestRouterIndex'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpDestLocalAddress'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpDestRemoteAddress'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelRouterIndex'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelLocalAddress'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelLocalPort'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelRemoteAddress'), ('Unisphere-Data-L2F-MIB', 'usdL2fUdpIpTunnelRemotePort'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usd_l2f_udp_ip_group = usdL2fUdpIpGroup.setStatus('current')
mibBuilder.exportSymbols('Unisphere-Data-L2F-MIB', usdL2fUdpIpTunnelEntry=usdL2fUdpIpTunnelEntry, usdL2fTraps=usdL2fTraps, usdL2fTunnelConfigEntry=usdL2fTunnelConfigEntry, usdL2fSessionStatusUserName=usdL2fSessionStatusUserName, usdL2fDestStatPaySendErrors=usdL2fDestStatPaySendErrors, usdL2fDestConfigIfIndex=usdL2fDestConfigIfIndex, usdL2fTunnelStatCtlSendPackets=usdL2fTunnelStatCtlSendPackets, usdL2fTunnelStatusCumEstabTime=usdL2fTunnelStatusCumEstabTime, usdL2fDestStatusTable=usdL2fDestStatusTable, usdL2fDestStatusFailedTunnelAuthens=usdL2fDestStatusFailedTunnelAuthens, usdL2fTunnelStatusTable=usdL2fTunnelStatusTable, usdL2fSessionStatistics=usdL2fSessionStatistics, usdL2fSysStatusFailedTunnels=usdL2fSysStatusFailedTunnels, usdL2fSystemStatus=usdL2fSystemStatus, usdL2fDestStatusActiveSessions=usdL2fDestStatusActiveSessions, usdL2fTunnelStatCtlRecvDiscards=usdL2fTunnelStatCtlRecvDiscards, usdL2fSysStatusActiveDestinations=usdL2fSysStatusActiveDestinations, usdL2fUdpIpTunnel=usdL2fUdpIpTunnel, usdL2fDestStatusEntry=usdL2fDestStatusEntry, usdL2fDestStatCtlRecvOctets=usdL2fDestStatCtlRecvOctets, usdL2fDestStatus=usdL2fDestStatus, usdL2fTrapControl=usdL2fTrapControl, usdL2fObjects=usdL2fObjects, usdL2fDestStatCtlRecvErrors=usdL2fDestStatCtlRecvErrors, usdL2fTunnelStatusTransport=usdL2fTunnelStatusTransport, usdL2fTransport=usdL2fTransport, usdL2fDestStatPayRecvDiscards=usdL2fDestStatPayRecvDiscards, usdL2fTunnelStatusEffectiveAdminState=usdL2fTunnelStatusEffectiveAdminState, usdL2fDestStatusIfIndex=usdL2fDestStatusIfIndex, usdL2fUdpIpDestEntry=usdL2fUdpIpDestEntry, usdL2fTunnelConfigTable=usdL2fTunnelConfigTable, usdL2fSessionStatPaySendDiscards=usdL2fSessionStatPaySendDiscards, usdL2fStatGroup=usdL2fStatGroup, usdL2fMapTidToTifLocalTunnelId=usdL2fMapTidToTifLocalTunnelId, usdL2fDestConfigEntry=usdL2fDestConfigEntry, usdL2fSessionStatusTable=usdL2fSessionStatusTable, usdL2fTunnelStatPaySendErrors=usdL2fTunnelStatPaySendErrors, usdL2fSysStatusFirmwareRev=usdL2fSysStatusFirmwareRev, usdL2fMapTidToTifTable=usdL2fMapTidToTifTable, usdL2fDestStatPayRecvPackets=usdL2fDestStatPayRecvPackets, usdL2fUdpIpDestRemoteAddress=usdL2fUdpIpDestRemoteAddress, usdL2fSession=usdL2fSession, usdL2fSysStatusProtocolVersion=usdL2fSysStatusProtocolVersion, usdL2fSysStatusVendorName=usdL2fSysStatusVendorName, usdL2fSessionConfigEntry=usdL2fSessionConfigEntry, usdL2fSessionStatPayRecvErrors=usdL2fSessionStatPayRecvErrors, usdL2fTunnelStatPayRecvPackets=usdL2fTunnelStatPayRecvPackets, usdL2fSessionConfigRowStatus=usdL2fSessionConfigRowStatus, usdL2fMapTifSidToSifTable=usdL2fMapTifSidToSifTable, usdL2fUdpIpDestIfIndex=usdL2fUdpIpDestIfIndex, usdL2fStatusGroup=usdL2fStatusGroup, usdL2fMapTifSidToSifEntry=usdL2fMapTifSidToSifEntry, usdL2fSysStatusTotalDestinations=usdL2fSysStatusTotalDestinations, usdL2fDestStatusFailedSessions=usdL2fDestStatusFailedSessions, usdL2fDestStatCtlSendOctets=usdL2fDestStatCtlSendOctets, usdL2fTunnelStatus=usdL2fTunnelStatus, usdL2fUdpIpTunnelLocalAddress=usdL2fUdpIpTunnelLocalAddress, usdL2fTunnelStatusLastErrorCode=usdL2fTunnelStatusLastErrorCode, usdL2fUdpIpDestLocalAddress=usdL2fUdpIpDestLocalAddress, usdL2fDestConfigAdminState=usdL2fDestConfigAdminState, usdL2fTunnelConfigRowStatus=usdL2fTunnelConfigRowStatus, usdL2fTunnelStatusFailedSessions=usdL2fTunnelStatusFailedSessions, usdL2fTunnelStatusActiveSessions=usdL2fTunnelStatusActiveSessions, usdL2fSessionStatusEntry=usdL2fSessionStatusEntry, usdL2fMapTidToTifEntry=usdL2fMapTidToTifEntry, usdL2fSessionConfigAdminState=usdL2fSessionConfigAdminState, usdL2fDestStatTable=usdL2fDestStatTable, usdL2fTunnelStatusTotalSessions=usdL2fTunnelStatusTotalSessions, usdL2fTunnelStatCtlSendOctets=usdL2fTunnelStatCtlSendOctets, usdL2fTunnelStatTable=usdL2fTunnelStatTable, usdL2fMapTifSidToSifLocalSessionId=usdL2fMapTifSidToSifLocalSessionId, usdL2fSessionStatPaySendOctets=usdL2fSessionStatPaySendOctets, usdL2fSystem=usdL2fSystem, usdL2fSessionStatIfIndex=usdL2fSessionStatIfIndex, usdL2fSessionConfig=usdL2fSessionConfig, usdL2fDestStatPaySendOctets=usdL2fDestStatPaySendOctets, usdL2fSessionStatResequencingTimeouts=usdL2fSessionStatResequencingTimeouts, usdL2fCompliance=usdL2fCompliance, usdL2fSessionStatusCallType=usdL2fSessionStatusCallType, usdL2fSessionStatPayRecvPackets=usdL2fSessionStatPayRecvPackets, usdL2fTunnelStatPaySendDiscards=usdL2fTunnelStatPaySendDiscards, usdL2fTunnelMap=usdL2fTunnelMap, usdL2fConformance=usdL2fConformance, usdL2fSysStatusTotalTunnels=usdL2fSysStatusTotalTunnels, usdL2fDestStatCtlRecvPackets=usdL2fDestStatCtlRecvPackets, usdL2fTunnelStatCtlRecvErrors=usdL2fTunnelStatCtlRecvErrors, usdL2fTunnelStatCtlSendErrors=usdL2fTunnelStatCtlSendErrors, usdL2fSessionStatusRxConnectSpeed=usdL2fSessionStatusRxConnectSpeed, usdL2fSystemConfig=usdL2fSystemConfig, usdL2fSessionStatusTxConnectSpeed=usdL2fSessionStatusTxConnectSpeed, usdL2fSessionStatusSequencingState=usdL2fSessionStatusSequencingState, usdL2fDestStatEntry=usdL2fDestStatEntry, usdL2fUdpIpGroup=usdL2fUdpIpGroup, usdL2fTunnelStatPaySendPackets=usdL2fTunnelStatPaySendPackets, usdL2fTunnelStatusEntry=usdL2fTunnelStatusEntry, usdL2fSessionStatusRemoteSessionId=usdL2fSessionStatusRemoteSessionId, usdL2fDestConfigTable=usdL2fDestConfigTable, usdL2fDestStatPayRecvErrors=usdL2fDestStatPayRecvErrors, usdL2fSysStatusFailedDestinations=usdL2fSysStatusFailedDestinations, usdL2fDestStatIfIndex=usdL2fDestStatIfIndex, UsdL2fTunnelId=UsdL2fTunnelId, usdL2fDestStatCtlRecvDiscards=usdL2fDestStatCtlRecvDiscards, usdL2fTunnelStatusIfIndex=usdL2fTunnelStatusIfIndex, usdL2fSessionStatusProxyLcp=usdL2fSessionStatusProxyLcp, usdL2fSessionStatusState=usdL2fSessionStatusState, usdL2fSessionStatusCumEstabTime=usdL2fSessionStatusCumEstabTime, usdL2fUdpIpDestRouterIndex=usdL2fUdpIpDestRouterIndex, UsdL2fSessionId=UsdL2fSessionId, usdL2fMIB=usdL2fMIB, usdL2fUdpIpDestTable=usdL2fUdpIpDestTable, usdL2fDestStatusTotalTunnels=usdL2fDestStatusTotalTunnels, usdL2fSessionStatus=usdL2fSessionStatus, usdL2fDestStatCtlSendErrors=usdL2fDestStatCtlSendErrors, usdL2fSessionStatusLacTunneledIfIndex=usdL2fSessionStatusLacTunneledIfIndex, usdL2fMapTifSidToSifSessionIfIndex=usdL2fMapTifSidToSifSessionIfIndex, usdL2fDestStatCtlSendPackets=usdL2fDestStatCtlSendPackets, usdL2fDestStatPaySendPackets=usdL2fDestStatPaySendPackets, usdL2fSessionStatPayRecvDiscards=usdL2fSessionStatPayRecvDiscards, usdL2fTunnel=usdL2fTunnel, usdL2fUdpIpTunnelRemoteAddress=usdL2fUdpIpTunnelRemoteAddress, usdL2fGroups=usdL2fGroups, usdL2fCompliances=usdL2fCompliances, usdL2fDestConfig=usdL2fDestConfig, UsdL2fTransport=UsdL2fTransport, usdL2fTunnelStatPayRecvDiscards=usdL2fTunnelStatPayRecvDiscards, usdL2fTransportUdpIp=usdL2fTransportUdpIp, usdL2fTunnelStatCtlRecvOutOfSequence=usdL2fTunnelStatCtlRecvOutOfSequence, UsdL2fAdminState=UsdL2fAdminState, usdL2fTunnelStatPayRecvErrors=usdL2fTunnelStatPayRecvErrors, usdL2fTunnelStatusRemoteTunnelId=usdL2fTunnelStatusRemoteTunnelId, usdL2fTunnelStatistics=usdL2fTunnelStatistics, PYSNMP_MODULE_ID=usdL2fMIB, usdL2fSessionStatusLocalSessionId=usdL2fSessionStatusLocalSessionId, usdL2fTunnelStatusLastErrorMessage=usdL2fTunnelStatusLastErrorMessage, usdL2fTunnelStatPaySendOctets=usdL2fTunnelStatPaySendOctets, usdL2fMapTifSidToSifTunnelIfIndex=usdL2fMapTifSidToSifTunnelIfIndex, usdL2fDestConfigRowStatus=usdL2fDestConfigRowStatus, usdL2fDestination=usdL2fDestination, usdL2fTunnelStatusRemoteHostName=usdL2fTunnelStatusRemoteHostName, usdL2fSysConfigDestructTimeout=usdL2fSysConfigDestructTimeout, usdL2fSessionStatRecvOutOfSequence=usdL2fSessionStatRecvOutOfSequence, usdL2fSysConfigAdminState=usdL2fSysConfigAdminState, usdL2fDestStatusEffectiveAdminState=usdL2fDestStatusEffectiveAdminState, usdL2fTunnelStatusState=usdL2fTunnelStatusState, usdL2fTunnelStatIfIndex=usdL2fTunnelStatIfIndex, usdL2fDestStatusTransport=usdL2fDestStatusTransport, usdL2fTunnelConfig=usdL2fTunnelConfig, usdL2fDestStatPaySendDiscards=usdL2fDestStatPaySendDiscards, usdL2fDestStatusActiveTunnels=usdL2fDestStatusActiveTunnels, usdL2fSysStatusFailedTunnelAuthens=usdL2fSysStatusFailedTunnelAuthens, usdL2fDestStatusTotalSessions=usdL2fDestStatusTotalSessions, usdL2fDestStatCtlSendDiscards=usdL2fDestStatCtlSendDiscards, usdL2fSessionConfigTable=usdL2fSessionConfigTable, usdL2fSessionStatPaySendErrors=usdL2fSessionStatPaySendErrors, usdL2fSessionStatPayLostPackets=usdL2fSessionStatPayLostPackets, usdL2fSysStatusFailedSessions=usdL2fSysStatusFailedSessions, usdL2fSessionStatPaySendPackets=usdL2fSessionStatPaySendPackets, usdL2fTunnelStatCtlRecvPackets=usdL2fTunnelStatCtlRecvPackets, usdL2fDestStatistics=usdL2fDestStatistics, usdL2fTunnelStatPayRecvOctets=usdL2fTunnelStatPayRecvOctets, usdL2fSysStatusActiveTunnels=usdL2fSysStatusActiveTunnels, usdL2fSessionStatusIfIndex=usdL2fSessionStatusIfIndex, usdL2fUdpIpTunnelRouterIndex=usdL2fUdpIpTunnelRouterIndex, usdL2fSysStatusActiveSessions=usdL2fSysStatusActiveSessions, usdL2fUdpIpTunnelRemotePort=usdL2fUdpIpTunnelRemotePort, usdL2fDestStatusFailedTunnels=usdL2fDestStatusFailedTunnels, usdL2fUdpIpTunnelLocalPort=usdL2fUdpIpTunnelLocalPort, usdL2fUdpIpDestination=usdL2fUdpIpDestination, usdL2fConfigGroup=usdL2fConfigGroup, usdL2fTunnelStatEntry=usdL2fTunnelStatEntry, usdL2fSessionConfigIfIndex=usdL2fSessionConfigIfIndex, usdL2fMapTidToTifIfIndex=usdL2fMapTidToTifIfIndex, usdL2fTunnelConfigIfIndex=usdL2fTunnelConfigIfIndex, usdL2fTunnelStatusLocalTunnelId=usdL2fTunnelStatusLocalTunnelId, usdL2fDestStatPayRecvOctets=usdL2fDestStatPayRecvOctets, usdL2fTunnelStatCtlSendDiscards=usdL2fTunnelStatCtlSendDiscards, usdL2fSysConfigReceiveDataSequencingIgnore=usdL2fSysConfigReceiveDataSequencingIgnore, usdL2fSessionStatusEffectiveAdminState=usdL2fSessionStatusEffectiveAdminState, usdL2fUdpIpTunnelTable=usdL2fUdpIpTunnelTable, usdL2fSessionStatTable=usdL2fSessionStatTable, usdL2fSessionStatPayRecvOctets=usdL2fSessionStatPayRecvOctets, usdL2fSysStatusTotalSessions=usdL2fSysStatusTotalSessions, usdL2fUdpIpTunnelIfIndex=usdL2fUdpIpTunnelIfIndex, usdL2fTunnelStatCtlRecvOctets=usdL2fTunnelStatCtlRecvOctets, usdL2fSessionStatusAuthMethod=usdL2fSessionStatusAuthMethod, usdL2fSessionStatEntry=usdL2fSessionStatEntry, usdL2fMapGroup=usdL2fMapGroup, usdL2fTunnelConfigAdminState=usdL2fTunnelConfigAdminState, usdL2fTunnelStatusInitiated=usdL2fTunnelStatusInitiated, usdL2fSysConfigIpChecksumEnable=usdL2fSysConfigIpChecksumEnable)
|
# -*- coding: utf-8 -*-
# Docstring
"""Run the Full create_MW_potential_2014 set of scripts."""
__author__ = "Nathaniel Starkman"
__all__ = [
"main",
]
###############################################################################
# IMPORTS
###############################################################################
# END
|
"""Run the Full create_MW_potential_2014 set of scripts."""
__author__ = 'Nathaniel Starkman'
__all__ = ['main']
|
enu = 3
zenn = 0
for ai in range(enu, -1, -1):
zenn += ai*ai*ai
print(zenn)
|
enu = 3
zenn = 0
for ai in range(enu, -1, -1):
zenn += ai * ai * ai
print(zenn)
|
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
File for Message object and associated functions.
The Message object's key function is to prevent users from editing fields in an action
or observation dict unintentionally.
"""
class Message(dict):
"""
Class for observations and actions in ParlAI.
Functions like a dict, but triggers a RuntimeError when calling __setitem__ for a
key that already exists in the dict.
"""
def __setitem__(self, key, val):
if key in self:
raise RuntimeError(
'Message already contains key `{}`. If this was intentional, '
'please use the function `force_set(key, value)`.'.format(key)
)
super().__setitem__(key, val)
def force_set(self, key, val):
super().__setitem__(key, val)
def copy(self):
return Message(self)
|
"""
File for Message object and associated functions.
The Message object's key function is to prevent users from editing fields in an action
or observation dict unintentionally.
"""
class Message(dict):
"""
Class for observations and actions in ParlAI.
Functions like a dict, but triggers a RuntimeError when calling __setitem__ for a
key that already exists in the dict.
"""
def __setitem__(self, key, val):
if key in self:
raise runtime_error('Message already contains key `{}`. If this was intentional, please use the function `force_set(key, value)`.'.format(key))
super().__setitem__(key, val)
def force_set(self, key, val):
super().__setitem__(key, val)
def copy(self):
return message(self)
|
deck = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
value = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
deck_values = dict(zip(deck, value))
hand = [input() for _ in range(6)]
hand_values = [deck_values.get(card) for card in hand]
print(sum(hand_values) / 6)
|
deck = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
value = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
deck_values = dict(zip(deck, value))
hand = [input() for _ in range(6)]
hand_values = [deck_values.get(card) for card in hand]
print(sum(hand_values) / 6)
|
"""Codon to amino acid dictionary"""
codon_to_aa = {
"TTT": "F",
"TTC": "F",
"TTA": "L",
"TTG": "L",
"TCT": "S",
"TCC": "S",
"TCA": "S",
"TCG": "S",
"TAT": "Y",
"TAC": "Y",
"TAA": "*",
"TAG": "*",
"TGT": "C",
"TGC": "C",
"TGA": "*",
"TGG": "W",
"CTT": "L",
"CTC": "L",
"CTA": "L",
"CTG": "L",
"CCT": "P",
"CCC": "P",
"CCA": "P",
"CCG": "P",
"CAT": "H",
"CAC": "H",
"CAA": "Q",
"CAG": "Q",
"CGT": "R",
"CGC": "R",
"CGA": "R",
"CGG": "R",
"ATT": "I",
"ATC": "I",
"ATA": "I",
"ATG": "M",
"ACT": "T",
"ACC": "T",
"ACA": "T",
"ACG": "T",
"AAT": "N",
"AAC": "N",
"AAA": "K",
"AAG": "K",
"AGT": "S",
"AGC": "S",
"AGA": "R",
"AGG": "R",
"GTT": "V",
"GTC": "V",
"GTA": "V",
"GTG": "V",
"GCT": "A",
"GCC": "A",
"GCA": "A",
"GCG": "A",
"GAT": "D",
"GAC": "D",
"GAA": "E",
"GAG": "E",
"GGT": "G",
"GGC": "G",
"GGA": "G",
"GGG": "G",
}
"""Amino acid to codon dictionary, using extended nucleotide letters"""
aa_to_codon_extended = {
"A": ["GCX"],
"B": ["RAY"],
"C": ["TGY"],
"D": ["GAY"],
"E": ["GAR"],
"F": ["TTY"],
"G": ["GGX"],
"H": ["CAY"],
"I": ["ATH"],
# 'J': ['-'],
"K": ["AAR"],
"L": ["TTR", "CTX", "YTR"],
"M": ["ATG"],
"N": ["AAY"],
# 'O': ['-'],
"P": ["CCX"],
"Q": ["CAR"],
"R": ["CGX", "AGR", "MGR"],
"S": ["TCX", "AGY"],
"T": ["ACX"],
# "U": ["-"],
"V": ["GTX"],
"W": ["TGG"],
"X": ["XXX"],
"Y": ["TAY"],
"Z": ["SAR"],
".": ["-"], # no amino acid (deletion or gap)
"*": ["TAR", "TRA"], # STOP codons
}
"""Codon to amino acid dictionary, using extended nucleotide letters"""
codon_extended_to_aa = {
"GCX": "A",
"RAY": "B",
"TGY": "C",
"GAY": "D",
"GAR": "E",
"TTY": "F",
"GGX": "G",
"CAY": "H",
"ATH": "I",
# "-": "J",
"AAR": "K",
"TTR": "L",
"CTX": "L",
"YTR": "L",
"ATG": "M",
"AAY": "N",
# "-": "O",
"CCX": "P",
"CAR": "Q",
"CGX": "R",
"AGR": "R",
"MGR": "R",
"TCX": "S",
"AGY": "S",
"ACX": "T",
# "-": "U",
"GTX": "V",
"TGG": "W",
"XXX": "X",
"TAY": "Y",
"SAR": "Z",
# "-": ".", # no amino acid (deletion or gap)
"TAR": "*", # STOP codon
"TRA": "*", # STOP codon
}
"""Extended nucleotide letter to nucleotide letter dictionary"""
ambiguity_code_to_nt_set = {
"A": {"A"},
"G": {"G"},
"C": {"C"},
"T": {"T"},
"Y": {"C", "T"},
"R": {"A", "G"},
"W": {"A", "T"},
"S": {"G", "C"},
"K": {"T", "G"},
"M": {"C", "A"},
"D": {"A", "G", "T"},
"V": {"A", "C", "G"},
"H": {"A", "C", "T"},
"B": {"C", "G", "T"},
"X": {"A", "C", "G", "T"},
"N": {"A", "C", "G", "T"},
}
"""Extended nucleotide letter to complement letter dictionary"""
complement_table = {
"A": "T",
"G": "C",
"C": "G",
"T": "A",
"Y": "R",
"R": "Y",
"W": "W",
"S": "S",
"K": "M",
"M": "K",
"D": "H",
"V": "B",
"H": "D",
"B": "V",
"X": "X",
"N": "N",
}
allowed_aa_transitions = {
"A": ["G", "A", "V", "L", "I"],
"B": ["D", "E", "N", "Q", "B", "Z"],
"C": ["S", "C", "M", "T"],
"D": ["D", "E", "N", "Q", "B", "Z"],
"E": ["D", "E", "N", "Q", "B", "Z"],
"F": ["F", "Y", "W"],
"G": ["G", "A", "V", "L", "I"],
"H": ["H", "K", "R"],
"I": ["G", "A", "V", "L", "I"],
# 'J': ['J'],
"K": ["H", "K", "R"],
"L": ["G", "A", "V", "L", "I"],
"M": ["S", "C", "M", "T"],
"N": ["D", "E", "N", "Q", "B", "Z"],
# 'O': ['O'],
"P": ["P"],
"Q": ["D", "E", "N", "Q", "B", "Z"],
"R": ["H", "K", "R"],
"S": ["S", "C", "M", "T"],
"T": ["S", "C", "M", "T"],
# "U": ['S', 'C', 'U', 'M', 'T'],
"V": ["G", "A", "V", "L", "I"],
"W": ["F", "Y", "W"],
"X": ["X"],
"Y": ["F", "Y", "W"],
"Z": ["D", "E", "N", "Q", "B", "Z"],
".": ["."],
"*": ["*"],
}
def make_transition_dictionary(aa_to_codon_extended, allowed_aa_transitions):
transition_dictionary = {}
for aa, aa_list in allowed_aa_transitions.items():
codons = []
for aa_element in aa_list:
triplets_to_add = aa_to_codon_extended[aa_element]
codons = codons + triplets_to_add
transition_dictionary[aa] = codons
return transition_dictionary
# TODO rename aa_to_codon_extended --> transition_dictionary and references elsewhere
def generate_swaptable(codon_to_aa, aa_to_codon_extended):
"""Generate a codon to extended codon dictionary"""
codon_to_codon_extended = dict()
for k, v in codon_to_aa.items():
codon_to_codon_extended[k] = tuple(aa_to_codon_extended[v])
return codon_to_codon_extended
def compare_letters(letter1, letter2, table=ambiguity_code_to_nt_set):
"""Compare two extended nucleotide letters and return True if they match"""
set1 = table[letter1]
set2 = table[letter2]
if set1 & set2 != set():
is_match = True
else:
is_match = False
return is_match
|
"""Codon to amino acid dictionary"""
codon_to_aa = {'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L', 'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S', 'TAT': 'Y', 'TAC': 'Y', 'TAA': '*', 'TAG': '*', 'TGT': 'C', 'TGC': 'C', 'TGA': '*', 'TGG': 'W', 'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L', 'CCT': 'P', 'CCC': 'P', 'CCA': 'P', 'CCG': 'P', 'CAT': 'H', 'CAC': 'H', 'CAA': 'Q', 'CAG': 'Q', 'CGT': 'R', 'CGC': 'R', 'CGA': 'R', 'CGG': 'R', 'ATT': 'I', 'ATC': 'I', 'ATA': 'I', 'ATG': 'M', 'ACT': 'T', 'ACC': 'T', 'ACA': 'T', 'ACG': 'T', 'AAT': 'N', 'AAC': 'N', 'AAA': 'K', 'AAG': 'K', 'AGT': 'S', 'AGC': 'S', 'AGA': 'R', 'AGG': 'R', 'GTT': 'V', 'GTC': 'V', 'GTA': 'V', 'GTG': 'V', 'GCT': 'A', 'GCC': 'A', 'GCA': 'A', 'GCG': 'A', 'GAT': 'D', 'GAC': 'D', 'GAA': 'E', 'GAG': 'E', 'GGT': 'G', 'GGC': 'G', 'GGA': 'G', 'GGG': 'G'}
'Amino acid to codon dictionary, using extended nucleotide letters'
aa_to_codon_extended = {'A': ['GCX'], 'B': ['RAY'], 'C': ['TGY'], 'D': ['GAY'], 'E': ['GAR'], 'F': ['TTY'], 'G': ['GGX'], 'H': ['CAY'], 'I': ['ATH'], 'K': ['AAR'], 'L': ['TTR', 'CTX', 'YTR'], 'M': ['ATG'], 'N': ['AAY'], 'P': ['CCX'], 'Q': ['CAR'], 'R': ['CGX', 'AGR', 'MGR'], 'S': ['TCX', 'AGY'], 'T': ['ACX'], 'V': ['GTX'], 'W': ['TGG'], 'X': ['XXX'], 'Y': ['TAY'], 'Z': ['SAR'], '.': ['-'], '*': ['TAR', 'TRA']}
'Codon to amino acid dictionary, using extended nucleotide letters'
codon_extended_to_aa = {'GCX': 'A', 'RAY': 'B', 'TGY': 'C', 'GAY': 'D', 'GAR': 'E', 'TTY': 'F', 'GGX': 'G', 'CAY': 'H', 'ATH': 'I', 'AAR': 'K', 'TTR': 'L', 'CTX': 'L', 'YTR': 'L', 'ATG': 'M', 'AAY': 'N', 'CCX': 'P', 'CAR': 'Q', 'CGX': 'R', 'AGR': 'R', 'MGR': 'R', 'TCX': 'S', 'AGY': 'S', 'ACX': 'T', 'GTX': 'V', 'TGG': 'W', 'XXX': 'X', 'TAY': 'Y', 'SAR': 'Z', 'TAR': '*', 'TRA': '*'}
'Extended nucleotide letter to nucleotide letter dictionary'
ambiguity_code_to_nt_set = {'A': {'A'}, 'G': {'G'}, 'C': {'C'}, 'T': {'T'}, 'Y': {'C', 'T'}, 'R': {'A', 'G'}, 'W': {'A', 'T'}, 'S': {'G', 'C'}, 'K': {'T', 'G'}, 'M': {'C', 'A'}, 'D': {'A', 'G', 'T'}, 'V': {'A', 'C', 'G'}, 'H': {'A', 'C', 'T'}, 'B': {'C', 'G', 'T'}, 'X': {'A', 'C', 'G', 'T'}, 'N': {'A', 'C', 'G', 'T'}}
'Extended nucleotide letter to complement letter dictionary'
complement_table = {'A': 'T', 'G': 'C', 'C': 'G', 'T': 'A', 'Y': 'R', 'R': 'Y', 'W': 'W', 'S': 'S', 'K': 'M', 'M': 'K', 'D': 'H', 'V': 'B', 'H': 'D', 'B': 'V', 'X': 'X', 'N': 'N'}
allowed_aa_transitions = {'A': ['G', 'A', 'V', 'L', 'I'], 'B': ['D', 'E', 'N', 'Q', 'B', 'Z'], 'C': ['S', 'C', 'M', 'T'], 'D': ['D', 'E', 'N', 'Q', 'B', 'Z'], 'E': ['D', 'E', 'N', 'Q', 'B', 'Z'], 'F': ['F', 'Y', 'W'], 'G': ['G', 'A', 'V', 'L', 'I'], 'H': ['H', 'K', 'R'], 'I': ['G', 'A', 'V', 'L', 'I'], 'K': ['H', 'K', 'R'], 'L': ['G', 'A', 'V', 'L', 'I'], 'M': ['S', 'C', 'M', 'T'], 'N': ['D', 'E', 'N', 'Q', 'B', 'Z'], 'P': ['P'], 'Q': ['D', 'E', 'N', 'Q', 'B', 'Z'], 'R': ['H', 'K', 'R'], 'S': ['S', 'C', 'M', 'T'], 'T': ['S', 'C', 'M', 'T'], 'V': ['G', 'A', 'V', 'L', 'I'], 'W': ['F', 'Y', 'W'], 'X': ['X'], 'Y': ['F', 'Y', 'W'], 'Z': ['D', 'E', 'N', 'Q', 'B', 'Z'], '.': ['.'], '*': ['*']}
def make_transition_dictionary(aa_to_codon_extended, allowed_aa_transitions):
transition_dictionary = {}
for (aa, aa_list) in allowed_aa_transitions.items():
codons = []
for aa_element in aa_list:
triplets_to_add = aa_to_codon_extended[aa_element]
codons = codons + triplets_to_add
transition_dictionary[aa] = codons
return transition_dictionary
def generate_swaptable(codon_to_aa, aa_to_codon_extended):
"""Generate a codon to extended codon dictionary"""
codon_to_codon_extended = dict()
for (k, v) in codon_to_aa.items():
codon_to_codon_extended[k] = tuple(aa_to_codon_extended[v])
return codon_to_codon_extended
def compare_letters(letter1, letter2, table=ambiguity_code_to_nt_set):
"""Compare two extended nucleotide letters and return True if they match"""
set1 = table[letter1]
set2 = table[letter2]
if set1 & set2 != set():
is_match = True
else:
is_match = False
return is_match
|
# -*- coding: utf-8 -*-
class RedirectError(Exception):
def __init__(self, response):
self.response = response
class NotLoggedInError(Exception):
pass
class SessionNotFreshError(Exception):
pass
|
class Redirecterror(Exception):
def __init__(self, response):
self.response = response
class Notloggedinerror(Exception):
pass
class Sessionnotfresherror(Exception):
pass
|
class Cell(object):
def __init__(self):
self.neighbours = [None for _ in range(8)]
self.current_state = False
self.next_state = False
self.fixed = False
def count_neighbours(self) -> int:
count = 0
for n in self.neighbours:
if n.current_state:
count += 1
return count
def ready_change(self):
if self.fixed:
self.next_state = True
else:
count = self.count_neighbours()
if self.current_state:
self.next_state = count in [2, 3]
else:
self.next_state = count == 3
def switch(self):
self.current_state = self.next_state
def __str__(self):
return '#' if self.current_state else '.'
class Life(object):
def __init__(self, initial_grid):
self.grid = [[Cell() for _ in range(100)] for _ in range(100)]
self.setup_grid(initial_grid)
def setup_grid(self, initial_grid, fixed_corners=False):
for row, line in enumerate(self.grid):
for col, cell in enumerate(line):
if fixed_corners and (col == 0 or col == 99) and (row == 0 or row == 99):
cell.current_state = True
cell.fixed = True
cell.neighbours = []
else:
cell.current_state = initial_grid[row][col] == '#'
cell.neighbours = [self.grid[r][c] for r, c in self.neighbours(row, col)]
def neighbours(self, row, col):
for n_r, n_c in [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]:
pos = row + n_r, col + n_c
if 0 <= pos[0] < 100 and 0 <= pos[1] < 100:
yield pos
def on_lamps(self):
return sum(1 for line in self.grid for cell in line if cell.current_state)
def generation(self):
for line in self.grid:
for cell in line:
cell.ready_change()
for line in self.grid:
for cell in line:
cell.switch()
def print_grid(self):
for line in self.grid:
for cell in line:
print(cell, end='')
print()
if __name__ == '__main__':
with open('input') as f:
initial_grid = f.read().splitlines(keepends=False)
life = Life(initial_grid)
for _ in range(100):
life.generation()
life.print_grid()
print(f'Part 1: {life.on_lamps()}')
# Part 1: 814
life.setup_grid(initial_grid, fixed_corners=True)
for _ in range(100):
life.generation()
life.print_grid()
print(f'Part 2: {life.on_lamps()}')
# Part 2: 924
|
class Cell(object):
def __init__(self):
self.neighbours = [None for _ in range(8)]
self.current_state = False
self.next_state = False
self.fixed = False
def count_neighbours(self) -> int:
count = 0
for n in self.neighbours:
if n.current_state:
count += 1
return count
def ready_change(self):
if self.fixed:
self.next_state = True
else:
count = self.count_neighbours()
if self.current_state:
self.next_state = count in [2, 3]
else:
self.next_state = count == 3
def switch(self):
self.current_state = self.next_state
def __str__(self):
return '#' if self.current_state else '.'
class Life(object):
def __init__(self, initial_grid):
self.grid = [[cell() for _ in range(100)] for _ in range(100)]
self.setup_grid(initial_grid)
def setup_grid(self, initial_grid, fixed_corners=False):
for (row, line) in enumerate(self.grid):
for (col, cell) in enumerate(line):
if fixed_corners and (col == 0 or col == 99) and (row == 0 or row == 99):
cell.current_state = True
cell.fixed = True
cell.neighbours = []
else:
cell.current_state = initial_grid[row][col] == '#'
cell.neighbours = [self.grid[r][c] for (r, c) in self.neighbours(row, col)]
def neighbours(self, row, col):
for (n_r, n_c) in [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]]:
pos = (row + n_r, col + n_c)
if 0 <= pos[0] < 100 and 0 <= pos[1] < 100:
yield pos
def on_lamps(self):
return sum((1 for line in self.grid for cell in line if cell.current_state))
def generation(self):
for line in self.grid:
for cell in line:
cell.ready_change()
for line in self.grid:
for cell in line:
cell.switch()
def print_grid(self):
for line in self.grid:
for cell in line:
print(cell, end='')
print()
if __name__ == '__main__':
with open('input') as f:
initial_grid = f.read().splitlines(keepends=False)
life = life(initial_grid)
for _ in range(100):
life.generation()
life.print_grid()
print(f'Part 1: {life.on_lamps()}')
life.setup_grid(initial_grid, fixed_corners=True)
for _ in range(100):
life.generation()
life.print_grid()
print(f'Part 2: {life.on_lamps()}')
|
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
class DimensionOrder(object):
c_order = 0
fortran_order = 1
|
class Dimensionorder(object):
c_order = 0
fortran_order = 1
|
def specialPolynomial(x, n):
s = 1
k = 0
while s <= n:
k += 1
s += x**k
return k-1
if __name__ == '__main__':
input0 = [2, 10, 1, 3]
input1 = [5, 111111110, 100, 140]
expectedOutput = [1, 7, 99, 4]
assert len(input0) == len(expectedOutput), '# input0 = {}, # expectedOutput = {}'.format(len(input0), len(expectedOutput))
assert len(input1) == len(expectedOutput), '# input1 = {}, # expectedOutput = {}'.format(len(input1), len(expectedOutput))
for i, expected in enumerate(expectedOutput):
actual = specialPolynomial(input0[i], input1[i])
assert actual == expected, 'specialPolynomial({}, {}) returned {}, but expected {}'.format(input0[i], input1[i], actual, expected)
print('PASSES {} out of {} tests'.format(len(expectedOutput), len(expectedOutput)))
|
def special_polynomial(x, n):
s = 1
k = 0
while s <= n:
k += 1
s += x ** k
return k - 1
if __name__ == '__main__':
input0 = [2, 10, 1, 3]
input1 = [5, 111111110, 100, 140]
expected_output = [1, 7, 99, 4]
assert len(input0) == len(expectedOutput), '# input0 = {}, # expectedOutput = {}'.format(len(input0), len(expectedOutput))
assert len(input1) == len(expectedOutput), '# input1 = {}, # expectedOutput = {}'.format(len(input1), len(expectedOutput))
for (i, expected) in enumerate(expectedOutput):
actual = special_polynomial(input0[i], input1[i])
assert actual == expected, 'specialPolynomial({}, {}) returned {}, but expected {}'.format(input0[i], input1[i], actual, expected)
print('PASSES {} out of {} tests'.format(len(expectedOutput), len(expectedOutput)))
|
class TermGroupScope:
"""Specifies the values different group types can take within the termStore."""
global_ = 0
system = 1
siteCollection = 2
unknownFutureValue = 3
|
class Termgroupscope:
"""Specifies the values different group types can take within the termStore."""
global_ = 0
system = 1
site_collection = 2
unknown_future_value = 3
|
def render_q(world, q_learner):
qvalues_list = []
for h in range(world.height):
row = []
qvalues_row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
# print('c', c)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
qvalues = q_learner(Variable(s))
# print('qvalues', qvalues)
qvalue, a = qvalues.data.max(1)
qvalue = qvalue[0]
qvalues_row.append(qvalue)
a = a[0]
# print('a', a)
act, direction = world.render_action(a)
# print(act, dir)
if act == 'M':
row.append(direction)
elif act == 'C':
row.append('c')
elif act == 'E':
row.append('e')
else:
row.append(c)
qvalues_row.append(0)
print(''.join(row))
qvalues_list.append(qvalues_row)
print('')
for row in qvalues_list:
print(' '.join(['%.2f' % q for q in row]))
def render_policy(world, state_features, policy):
for h in range(world.height):
row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
global_idxes = torch.LongTensor([[0]])
phi = state_features(Variable(s))
action_probs_l, elig_idxes_pairs, actions, entropy, (matches_argmax_count, stochastic_draws_count) = policy(
phi, global_idxes=global_idxes)
# print('actions[0]', actions[0])
# asdf
a = actions[0][0]
act, direction = world.render_action(a)
if act == 'M':
row.append(direction)
elif act == 'C':
row.append('c')
elif act == 'E':
row.append('e')
else:
row.append(c)
print(''.join(row))
def render_v(value_png, world, state_features, value_function):
"""
assumptions on world. has following properties:
- height
- width
- locs (location of various objects, like food)
- reps
and methods:
- get_at(loc)
- set_agent_loc(loc)
- get_state()
- render()
state_features is a net, that takes a world state, and generates features
value_function takes state_features, and outputs a value
value_png is path to generated png file
"""
v_matrix = torch.FloatTensor(world.height, world.width).fill_(0)
for h in range(world.height):
row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
phi = state_features(Variable(s))
v = value_function(phi).data[0][0]
v_matrix[h, w] = v
row.append('%.3f' % v)
else:
row.append(c)
print(' '.join(row))
# values_list.append(values_row)
print('')
world.render()
print('v_matrix', v_matrix)
plt.clf()
plt.imshow(v_matrix.numpy(), interpolation='nearest')
for loc in world.locs:
_loc = loc['loc']
p = loc['p']
plt.text(_loc[1], _loc[0], '[%s:%s]' % (p, world.reps[p]))
plt.colorbar()
plt.savefig(value_png)
# for row in values_list:
# print(' '.join(['%.2f' % q for q in row]))
|
def render_q(world, q_learner):
qvalues_list = []
for h in range(world.height):
row = []
qvalues_row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
qvalues = q_learner(variable(s))
(qvalue, a) = qvalues.data.max(1)
qvalue = qvalue[0]
qvalues_row.append(qvalue)
a = a[0]
(act, direction) = world.render_action(a)
if act == 'M':
row.append(direction)
elif act == 'C':
row.append('c')
elif act == 'E':
row.append('e')
else:
row.append(c)
qvalues_row.append(0)
print(''.join(row))
qvalues_list.append(qvalues_row)
print('')
for row in qvalues_list:
print(' '.join(['%.2f' % q for q in row]))
def render_policy(world, state_features, policy):
for h in range(world.height):
row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
global_idxes = torch.LongTensor([[0]])
phi = state_features(variable(s))
(action_probs_l, elig_idxes_pairs, actions, entropy, (matches_argmax_count, stochastic_draws_count)) = policy(phi, global_idxes=global_idxes)
a = actions[0][0]
(act, direction) = world.render_action(a)
if act == 'M':
row.append(direction)
elif act == 'C':
row.append('c')
elif act == 'E':
row.append('e')
else:
row.append(c)
print(''.join(row))
def render_v(value_png, world, state_features, value_function):
"""
assumptions on world. has following properties:
- height
- width
- locs (location of various objects, like food)
- reps
and methods:
- get_at(loc)
- set_agent_loc(loc)
- get_state()
- render()
state_features is a net, that takes a world state, and generates features
value_function takes state_features, and outputs a value
value_png is path to generated png file
"""
v_matrix = torch.FloatTensor(world.height, world.width).fill_(0)
for h in range(world.height):
row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)
s = world.get_state()
s = s.view(1, *s.size())
phi = state_features(variable(s))
v = value_function(phi).data[0][0]
v_matrix[h, w] = v
row.append('%.3f' % v)
else:
row.append(c)
print(' '.join(row))
print('')
world.render()
print('v_matrix', v_matrix)
plt.clf()
plt.imshow(v_matrix.numpy(), interpolation='nearest')
for loc in world.locs:
_loc = loc['loc']
p = loc['p']
plt.text(_loc[1], _loc[0], '[%s:%s]' % (p, world.reps[p]))
plt.colorbar()
plt.savefig(value_png)
|
__all__ = [
"deployment_pb2",
"repository_pb2",
"status_pb2",
"yatai_service_pb2_grpc",
"yatai_service_pb2",
]
|
__all__ = ['deployment_pb2', 'repository_pb2', 'status_pb2', 'yatai_service_pb2_grpc', 'yatai_service_pb2']
|
class UnresolvedChild(Exception):
"""
Exception raised when children should be lazyloaded first
"""
pass
class TimeConstraintError(Exception):
"""
Exception raised when it is not possble to satisfy timing constraints
"""
pass
|
class Unresolvedchild(Exception):
"""
Exception raised when children should be lazyloaded first
"""
pass
class Timeconstrainterror(Exception):
"""
Exception raised when it is not possble to satisfy timing constraints
"""
pass
|
def solve():
N = int(input())
V = list(map(int, input().split()))
V1 = sorted(V[::2])
V2 = sorted(V[1::2])
flag = -1
for i in range(1, N):
i_ = i // 2
# if i&1: print('Check {} {}'.format(V1[i_], V2[i_]))
# if i&1==0: print('Check {} {}'.format(V2[i_-1], V1[i_]))
if i&1 and V1[i_] > V2[i_] or i&1==0 and V2[i_-1] > V1[i_]: # odd
flag = i - 1
break
print('OK') if flag == -1 else print(flag)
if __name__ == '__main__':
T = int(input())
for t in range(T):
print('Case #{}: '.format(t+1), end='')
solve()
|
def solve():
n = int(input())
v = list(map(int, input().split()))
v1 = sorted(V[::2])
v2 = sorted(V[1::2])
flag = -1
for i in range(1, N):
i_ = i // 2
if i & 1 and V1[i_] > V2[i_] or (i & 1 == 0 and V2[i_ - 1] > V1[i_]):
flag = i - 1
break
print('OK') if flag == -1 else print(flag)
if __name__ == '__main__':
t = int(input())
for t in range(T):
print('Case #{}: '.format(t + 1), end='')
solve()
|
"""
This file contains mappings:
parameters_names_mapping - Mapping of Tcl/Tk command attributes
to methods of Qt/own objects.
Own objects are included because
of implementation details such as
menu problem (see description of
Implementer file.
parameters_values_mapping - Mapping of Tcl/Tk attributes values
to valid values for parameters of
methods got from parameters_names_mapping.
Mappigs are obtained with get_parameters_names_mapping and
get_parameters_values_mapping functions respectively with
private _get_mapping function.
Mappings are used by tktoqt file.
Note that this could be heavily extended - TODO.
Note that this might get changed when problem with step 5) from Implementer
will be solved - TODO.
"""
parameters_names_mapping = {
"all": {
'-text': 'setText',
'-fg': 'setStyleSheet',
'-padx': 'setStyleSheet',
'-pady': 'setStyleSheet',
# TODO Margins and so on.
},
"QPushButton": {
'-command': 'clicked.connect',
},
"QWidget": {
'-width': 'setMinimumWidth',
'-height': 'setMinimumHeight',
'-background': 'setStyleSheet',
},
"QGridBox": {
'-text': 'setTitle',
'-relief': 'setStyleSheet',
},
"QMenu": {
# TODO Remove if combinations working.
'-label': 'addAction',
# TODO Remove if combinations working.
'-command': 'triggered[QAction].connect',
'-menu': 'addMenu',
},
"QListWidget": {
'-insert': 'addItem',
},
"QGroupBox": {
'-text': 'setTitle',
},
"QLabel": {
'-text': 'setText',
},
"QSpinBox": {
'-from': 'setMinimum',
'-to': 'setMaximum',
},
"QRadioButton": {
# TODO finish StringVar '-variable': 'setText',
'-command': 'toggled.connect'
},
"QComboBox": {
'-values': 'addItems',
# TODO finish StringVar'-textvariable': 'setText',
},
"QPixmap": {
'-file': 'load',
# TODO finish StringVar'-textvariable': 'setText',
},
"Menu": { # TODO: Might change name
'-menu': 'add_menu', # My own function
'-label': 'remember_label',
},
"Implementer": { # TODO: Might change name
'-menu': 'create_menu', # My own function
},
}
def get_parameters_names_mapping(class_name):
# TODO Docs.
return _get_mapping(class_name, parameters_names_mapping)
parameters_values_mapping = {
"all": {
'-padx': 'padding: {} px;',
# TODO Difference between horizontal and vertical padding? ...
'-pady': 'padding: {} px;',
'-fg': 'color: {} ;',
},
"QWidget": {
'-background': 'background-color: {} ;',
},
}
def get_parameters_values_mapping(class_name):
# TODO Docs.
return _get_mapping(class_name, parameters_values_mapping)
def _get_mapping(class_name, mapping):
# TODO Docs.
output = mapping["all"].copy()
override_and_extra_parameters = mapping.get(class_name.__name__, {})
for key in override_and_extra_parameters:
output[key] = override_and_extra_parameters[key]
return output
|
"""
This file contains mappings:
parameters_names_mapping - Mapping of Tcl/Tk command attributes
to methods of Qt/own objects.
Own objects are included because
of implementation details such as
menu problem (see description of
Implementer file.
parameters_values_mapping - Mapping of Tcl/Tk attributes values
to valid values for parameters of
methods got from parameters_names_mapping.
Mappigs are obtained with get_parameters_names_mapping and
get_parameters_values_mapping functions respectively with
private _get_mapping function.
Mappings are used by tktoqt file.
Note that this could be heavily extended - TODO.
Note that this might get changed when problem with step 5) from Implementer
will be solved - TODO.
"""
parameters_names_mapping = {'all': {'-text': 'setText', '-fg': 'setStyleSheet', '-padx': 'setStyleSheet', '-pady': 'setStyleSheet'}, 'QPushButton': {'-command': 'clicked.connect'}, 'QWidget': {'-width': 'setMinimumWidth', '-height': 'setMinimumHeight', '-background': 'setStyleSheet'}, 'QGridBox': {'-text': 'setTitle', '-relief': 'setStyleSheet'}, 'QMenu': {'-label': 'addAction', '-command': 'triggered[QAction].connect', '-menu': 'addMenu'}, 'QListWidget': {'-insert': 'addItem'}, 'QGroupBox': {'-text': 'setTitle'}, 'QLabel': {'-text': 'setText'}, 'QSpinBox': {'-from': 'setMinimum', '-to': 'setMaximum'}, 'QRadioButton': {'-command': 'toggled.connect'}, 'QComboBox': {'-values': 'addItems'}, 'QPixmap': {'-file': 'load'}, 'Menu': {'-menu': 'add_menu', '-label': 'remember_label'}, 'Implementer': {'-menu': 'create_menu'}}
def get_parameters_names_mapping(class_name):
return _get_mapping(class_name, parameters_names_mapping)
parameters_values_mapping = {'all': {'-padx': 'padding: {} px;', '-pady': 'padding: {} px;', '-fg': 'color: {} ;'}, 'QWidget': {'-background': 'background-color: {} ;'}}
def get_parameters_values_mapping(class_name):
return _get_mapping(class_name, parameters_values_mapping)
def _get_mapping(class_name, mapping):
output = mapping['all'].copy()
override_and_extra_parameters = mapping.get(class_name.__name__, {})
for key in override_and_extra_parameters:
output[key] = override_and_extra_parameters[key]
return output
|
def target(x0, sink):
print(f'input: {x0}')
while True:
task = yield
x0 = task(x0)
sink.send(x0)
def sink():
try:
while True:
x = yield
except GeneratorExit:
print(f'final output: {x}')
|
def target(x0, sink):
print(f'input: {x0}')
while True:
task = (yield)
x0 = task(x0)
sink.send(x0)
def sink():
try:
while True:
x = (yield)
except GeneratorExit:
print(f'final output: {x}')
|
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
return None
fake_head = ListNode(None)
fake_head.next = head
last_node = fake_head
curr_node = fake_head.next
duplicate_val = None
while curr_node:
if curr_node and curr_node.next and curr_node.val == curr_node.next.val:
# Update deplicate_val
duplicate_val = curr_node.val
if curr_node.val == duplicate_val:
last_node.next = curr_node.next
curr_node = curr_node.next
else:
last_node = curr_node
curr_node = curr_node.next
return fake_head.next
|
class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def delete_duplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
return None
fake_head = list_node(None)
fake_head.next = head
last_node = fake_head
curr_node = fake_head.next
duplicate_val = None
while curr_node:
if curr_node and curr_node.next and (curr_node.val == curr_node.next.val):
duplicate_val = curr_node.val
if curr_node.val == duplicate_val:
last_node.next = curr_node.next
curr_node = curr_node.next
else:
last_node = curr_node
curr_node = curr_node.next
return fake_head.next
|
def data_cart(request):
total_cart=0
total_items=0
if request.user.is_authenticated and request.session.__contains__('cart'):
for key, value in request.session['cart'].items():
if not key == "is_modify" and not key == 'id_update':
total_cart = total_cart + float(value['price'])*value['quantity']
total_items+=1
return {
'total_cart': total_cart,
'total_items': total_items,
}
|
def data_cart(request):
total_cart = 0
total_items = 0
if request.user.is_authenticated and request.session.__contains__('cart'):
for (key, value) in request.session['cart'].items():
if not key == 'is_modify' and (not key == 'id_update'):
total_cart = total_cart + float(value['price']) * value['quantity']
total_items += 1
return {'total_cart': total_cart, 'total_items': total_items}
|
# int: Minimum number of n-grams occurence to be retained
# All Ngrams that occur less than n times are removed
# default value: 0
ngram_min_to_be_retained = 0
# real: Minimum ratio n-grams to skip
# (will be chosen among the ones that occur rarely)
# expressed as a ratio of the cumulated histogram
# default value: 0
ngram_min_rejected_ratio = 0
# NB: the n-gram skipping will go on until:
# ( minimal_ngram_count < ngram_min_to_be_retained ) OR ( rejected_ratio <= ngram_min_rejected_ratio)
# int: the 'n' of 'n'-gram
# default value: 2
gram_size = 3
# File containing the textual data to convert
# Image in file_name*.img
# Image in file_name*.txt
# Output will be :
# file_name*.onehot
# file_name*.ngram
# file_name*.info
files_path = '/u/lisa/db/babyAI/textual_v2'
file_name_train_amat = 'BABYAI_gray_4obj_64x64.train.img'
file_name_valid_amat = 'BABYAI_gray_4obj_64x64.valid.img'
file_name_test_amat = 'BABYAI_gray_4obj_64x64.test.img'
image_size = 32*32
# Use empty string if no dataset
file_name_train_img = 'BABYAI_gray_4obj_64x64.train.img'
file_name_valid_img = 'BABYAI_gray_4obj_64x64.valid.img'
file_name_test_img = 'BABYAI_gray_4obj_64x64.test.img'
file_name_train_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.train.txt'
file_name_valid_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.valid.txt'
file_name_test_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.test.txt'
file_name_train_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.train'
file_name_valid_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.valid'
file_name_test_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.test'
# None or a file '*.info'
file_info = None # 'BABYAI_gray_4obj_64x64.color-size-location-shape.train.info'
|
ngram_min_to_be_retained = 0
ngram_min_rejected_ratio = 0
gram_size = 3
files_path = '/u/lisa/db/babyAI/textual_v2'
file_name_train_amat = 'BABYAI_gray_4obj_64x64.train.img'
file_name_valid_amat = 'BABYAI_gray_4obj_64x64.valid.img'
file_name_test_amat = 'BABYAI_gray_4obj_64x64.test.img'
image_size = 32 * 32
file_name_train_img = 'BABYAI_gray_4obj_64x64.train.img'
file_name_valid_img = 'BABYAI_gray_4obj_64x64.valid.img'
file_name_test_img = 'BABYAI_gray_4obj_64x64.test.img'
file_name_train_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.train.txt'
file_name_valid_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.valid.txt'
file_name_test_txt = 'BABYAI_gray_4obj_64x64.color-size-location-shape.test.txt'
file_name_train_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.train'
file_name_valid_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.valid'
file_name_test_out = 'BABYAI_gray_4obj_64x64.color-size-location-shape.test'
file_info = None
|
customcb = {'_smps_flo': ["#000000",
"#000002",
"#000004",
"#000007",
"#000009",
"#00000b",
"#00000d",
"#000010",
"#000012",
"#000014",
"#000016",
"#000019",
"#00001b",
"#00001d",
"#00001f",
"#000021",
"#000024",
"#000026",
"#000028",
"#00002a",
"#00002d",
"#00002f",
"#000031",
"#000033",
"#000036",
"#000038",
"#00003a",
"#00003c",
"#00003e",
"#000041",
"#000043",
"#000045",
"#000047",
"#00004a",
"#00004c",
"#00004e",
"#000050",
"#000053",
"#000055",
"#000057",
"#000059",
"#00005b",
"#00005e",
"#000060",
"#000062",
"#000064",
"#000067",
"#000069",
"#00006b",
"#00006d",
"#000070",
"#000072", # "#000074",
"#000076",
"#000078",
"#00007b", # "#00007d",
"#00007f",
"#000081", # "#000084",
"#000086",
"#000088", # "#00008a",
"#00008d",
"#00018e", # "#00038c",
"#00068b",
"#000989", # "#000b88",
"#000e87",
"#001185",
"#001384", # "#001682",
"#001881",
"#001b7f",
"#001e7e",
"#00207d",
"#00237b",
"#00267a",
"#002878",
"#002b77",
"#002e75",
"#003074",
"#003372",
"#003671",
"#003870",
"#003b6e",
"#003d6d",
"#00406b",
"#00436a",
"#004568",
"#004867",
"#004b65",
"#004d64",
"#005063",
"#005361",
"#005560",
"#00585e",
"#005b5d",
"#005d5b",
"#00605a",
"#006258",
"#006557",
"#006856",
"#006a54",
"#006d53", # dark azul
"#007051",
"#007151", # input
"#007150", # input
"#007250",
"#00754e", # azul
"#00764E",
"#00774E",
"#00784d",
"#007a4b",
"#007d4a", # azul green
"#007f49",
"#008247",
"#008546",
"#008744", # donker groen blauwig
"#008a43",
"#008B42",
"#008B41",
"#008C41",
"#008d41",
"#008d41",
"#008f40",
"#00923e",
"#00953d",
"#00963D",
"#00973c",
"#009a3a",
"#009d39",
"#009e38",
"#009f38",
"#009f37",
"#00a236", # 61 licht groen
"#009F35", # 62
"#00a434", # 64
"#00A534", # 64
"#00a634", # 64
"#00A633", # 65
"#00a733", # 65
"#00a434", # 64
"#00A534", # 64
"#00A634", # 64
"#00a733", # 65
"#00A635", # 65
"#02a732",
"#05a431",
"#08a230",
"#0c9f2f",
"#0f9d2f",
"#129a2e",
"#16972d",
"#19952c",
"#1c922c",
"#208f2b",
"#238d2a",
"#268a29",
"#2a8728",
"#2d8528",
"#308227", # donkergroen
"#337f26",
"#377d25",
"#3a7a24",
"#3d7824",
"#417523",
"#447222",
"#477021",
"#4b6d21",
"#4e6a20", # bruingroen
"#51681f",
"#55651e",
"#58621d",
"#5b601d",
"#5f5d1c",
"#625b1b",
"#65581a",
"#695519",
"#6c5319",
"#6f5018",
"#734d17",
"#764b16",
"#794815",
"#7d4515",
"#804314", # bruin
"#834013",
"#873d12",
"#8a3b12",
"#8d3811",
"#903610",
"#94330f",
"#97300e",
"#9a2e0e",
"#9e2b0d",
"#a1280c",
"#a4260b",
"#a8230a",
"#ab200a",
"#ae1e09",
"#b21b08",
"#b51807",
"#b81607",
"#bc1306",
"#bf1105",
"#c20e04",
"#c60b03",
"#c90903",
"#cc0602",
"#d00301",
"#d30100",# donker rood
"#d40200",
"#d40300",
"#d40400",
"#d40500",
"#d40600",
"#d40700",
"#d40800",
"#d40900", # fel rood
"#d40c00",
"#d41000",
"#D41100",
"#D41200",
"#d41300", #
"#D41400",
"#D41500",
"#d41600",
"#d41a00",
"#d41d00",
"#d42000", #
"#d42400",
"#d42700",
"#d42a00", # begin oranje
"#d42b00",
"#d42c00",
"#d42d00",
"#d42e00",
"#D43100",
"#D43200",
"#D43300",
"#d43400",
"#d43500",
"#D43600",
"#D43700",
"#d43800", # 16 donker oranje
"#d43b00", # 18
"#D43C00",
"#D43D00",
"#d43e00", # 18
"#D44200", # hh
"#d44200", # 20
"#d44300",
"#d44400",
"#d44500",
"#d44800",
"#d44c00",
"#d44f00",
"#d45200",
"#d45600",
"#d45900",
"#d45c00",
"#d45f00",
"#d46300",
"#d46600",
"#d46900",
"#d46d00",
"#d47000",
"#d47300",
"#d47700", # wat lichter oranje
"#d47a00",
"#D47B00",
"#D47C00",
"#d47d00",
"#d48100",
"#D48200",
"#D48300",
"#d48400",
"#d48700",
"#d48b00",
"#d48e00",
"#d49100",
"#d49500",
"#d49800",
"#d49b00",
"#d49f00",
"#d4a200",
"#d4a500",
"#d4a900",
"#d4ac00",
"#d4af00", # donker geel
"#d4b300",
"#d4b600",
"#d4b900",
"#d4bc00",
"#d4c000",
"#d4c300",
"#d4c600",
"#d4ca00",
"#d4cd00",
"#d4d000",
"#d4d400",
"#D7D700",
"#DADA00",
"#DCDC00",
"#DFDF00",
"#E1E100",
"#E4E400",
"#E6E600",
"#E9E900",
"#ECEC00",
"#F1F100",
"#F6F200",
"#F6F300",
"#F6F400",
"#F6F600",
"#F6F700",
"#F8F800",
"#FBFB00",
"#FDFD00",
"#FDFE00",
"#FFFD00",
"#FDFF00",
"#FFFF00",
],
'_smps_flo_w' : ["#FFFFFF",
"#000002",
"#000004",
"#000007",
"#000009",
"#00000b",
"#00000d",
"#000010",
"#000012",
"#000014",
"#000016",
"#000019",
"#00001b",
"#00001d",
"#00001f",
"#000021",
"#000024",
"#000026",
"#000028",
"#00002a",
"#00002d",
"#00002f",
"#000031",
"#000033",
"#000036",
"#000038",
"#00003a",
"#00003c",
"#00003e",
"#000041",
"#000043",
"#000045",
"#000047",
"#00004a",
"#00004c",
"#00004e",
"#000050",
"#000053",
"#000055",
"#000057",
"#000059",
"#00005b",
"#00005e",
"#000060",
"#000062",
"#000064",
"#000067",
"#000069",
"#00006b",
"#00006d",
"#000070",
"#000072", # "#000074",
"#000076",
"#000078",
"#00007b", # "#00007d",
"#00007f",
"#000081", # "#000084",
"#000086",
"#000088", # "#00008a",
"#00008d",
"#00018e", # "#00038c",
"#00068b",
"#000989", # "#000b88",
"#000e87",
"#001185",
"#001384", # "#001682",
"#001881",
"#001b7f",
"#001e7e",
"#00207d",
"#00237b",
"#00267a",
"#002878",
"#002b77",
"#002e75",
"#003074",
"#003372",
"#003671",
"#003870",
"#003b6e",
"#003d6d",
"#00406b",
"#00436a",
"#004568",
"#004867",
"#004b65",
"#004d64",
"#005063",
"#005361",
"#005560",
"#00585e",
"#005b5d",
"#005d5b",
"#00605a",
"#006258",
"#006557",
"#006856",
"#006a54",
"#006d53", # dark azul
"#007051",
"#007151", # input
"#007150", # input
"#007250",
"#00754e", # azul
"#00764E",
"#00774E",
"#00784d",
"#007a4b",
"#007d4a", # azul green
"#007f49",
"#008247",
"#008546",
"#008744", # donker groen blauwig
"#008a43",
"#008B42",
"#008B41",
"#008C41",
"#008d41",
"#008d41",
"#008f40",
"#00923e",
"#00953d",
"#00963D",
"#00973c",
"#009a3a",
"#009d39",
"#009e38",
"#009f38",
"#009f37",
"#00a236", # 61 licht groen
"#009F35", # 62
"#00a434", # 64
"#00A534", # 64
"#00a634", # 64
"#00A633", # 65
"#00a733", # 65
"#00a434", # 64
"#00A534", # 64
"#00A634", # 64
"#00a733", # 65
"#00A635", # 65
"#02a732",
"#05a431",
"#08a230",
"#0c9f2f",
"#0f9d2f",
"#129a2e",
"#16972d",
"#19952c",
"#1c922c",
"#208f2b",
"#238d2a",
"#268a29",
"#2a8728",
"#2d8528",
"#308227", # donkergroen
"#337f26",
"#377d25",
"#3a7a24",
"#3d7824",
"#417523",
"#447222",
"#477021",
"#4b6d21",
"#4e6a20", # bruingroen
"#51681f",
"#55651e",
"#58621d",
"#5b601d",
"#5f5d1c",
"#625b1b",
"#65581a",
"#695519",
"#6c5319",
"#6f5018",
"#734d17",
"#764b16",
"#794815",
"#7d4515",
"#804314", # bruin
"#834013",
"#873d12",
"#8a3b12",
"#8d3811",
"#903610",
"#94330f",
"#97300e",
"#9a2e0e",
"#9e2b0d",
"#a1280c",
"#a4260b",
"#a8230a",
"#ab200a",
"#ae1e09",
"#b21b08",
"#b51807",
"#b81607",
"#bc1306",
"#bf1105",
"#c20e04",
"#c60b03",
"#c90903",
"#cc0602",
"#d00301",
"#d30100",# donker rood
"#d40200",
"#d40300",
"#d40400",
"#d40500",
"#d40600",
"#d40700",
"#d40800",
"#d40900", # fel rood
"#d40c00",
"#d41000",
"#D41100",
"#D41200",
"#d41300", #
"#D41400",
"#D41500",
"#d41600",
"#d41a00",
"#d41d00",
"#d42000", #
"#d42400",
"#d42700",
"#d42a00", # begin oranje
"#d42b00",
"#d42c00",
"#d42d00",
"#d42e00",
"#D43100",
"#D43200",
"#D43300",
"#d43400",
"#d43500",
"#D43600",
"#D43700",
"#d43800", # 16 donker oranje
"#d43b00", # 18
"#D43C00",
"#D43D00",
"#d43e00", # 18
"#D44200", # hh
"#d44200", # 20
"#d44300",
"#d44400",
"#d44500",
"#d44800",
"#d44c00",
"#d44f00",
"#d45200",
"#d45600",
"#d45900",
"#d45c00",
"#d45f00",
"#d46300",
"#d46600",
"#d46900",
"#d46d00",
"#d47000",
"#d47300",
"#d47700", # wat lichter oranje
"#d47a00",
"#D47B00",
"#D47C00",
"#d47d00",
"#d48100",
"#D48200",
"#D48300",
"#d48400",
"#d48700",
"#d48b00",
"#d48e00",
"#d49100",
"#d49500",
"#d49800",
"#d49b00",
"#d49f00",
"#d4a200",
"#d4a500",
"#d4a900",
"#d4ac00",
"#d4af00", # donker geel
"#d4b300",
"#d4b600",
"#d4b900",
"#d4bc00",
"#d4c000",
"#d4c300",
"#d4c600",
"#d4ca00",
"#d4cd00",
"#d4d000",
"#d4d400",
"#D7D700",
"#DADA00",
"#DCDC00",
"#DFDF00",
"#E1E100",
"#E4E400",
"#E6E600",
"#E9E900",
"#ECEC00",
"#F1F100",
"#F6F200",
"#F6F300",
"#F6F400",
"#F6F600",
"#F6F700",
"#F8F800",
"#FBFB00",
"#FDFD00",
"#FDFE00",
"#FFFD00",
"#FDFF00",
"#FFFF00",
]}
|
customcb = {'_smps_flo': ['#000000', '#000002', '#000004', '#000007', '#000009', '#00000b', '#00000d', '#000010', '#000012', '#000014', '#000016', '#000019', '#00001b', '#00001d', '#00001f', '#000021', '#000024', '#000026', '#000028', '#00002a', '#00002d', '#00002f', '#000031', '#000033', '#000036', '#000038', '#00003a', '#00003c', '#00003e', '#000041', '#000043', '#000045', '#000047', '#00004a', '#00004c', '#00004e', '#000050', '#000053', '#000055', '#000057', '#000059', '#00005b', '#00005e', '#000060', '#000062', '#000064', '#000067', '#000069', '#00006b', '#00006d', '#000070', '#000072', '#000076', '#000078', '#00007b', '#00007f', '#000081', '#000086', '#000088', '#00008d', '#00018e', '#00068b', '#000989', '#000e87', '#001185', '#001384', '#001881', '#001b7f', '#001e7e', '#00207d', '#00237b', '#00267a', '#002878', '#002b77', '#002e75', '#003074', '#003372', '#003671', '#003870', '#003b6e', '#003d6d', '#00406b', '#00436a', '#004568', '#004867', '#004b65', '#004d64', '#005063', '#005361', '#005560', '#00585e', '#005b5d', '#005d5b', '#00605a', '#006258', '#006557', '#006856', '#006a54', '#006d53', '#007051', '#007151', '#007150', '#007250', '#00754e', '#00764E', '#00774E', '#00784d', '#007a4b', '#007d4a', '#007f49', '#008247', '#008546', '#008744', '#008a43', '#008B42', '#008B41', '#008C41', '#008d41', '#008d41', '#008f40', '#00923e', '#00953d', '#00963D', '#00973c', '#009a3a', '#009d39', '#009e38', '#009f38', '#009f37', '#00a236', '#009F35', '#00a434', '#00A534', '#00a634', '#00A633', '#00a733', '#00a434', '#00A534', '#00A634', '#00a733', '#00A635', '#02a732', '#05a431', '#08a230', '#0c9f2f', '#0f9d2f', '#129a2e', '#16972d', '#19952c', '#1c922c', '#208f2b', '#238d2a', '#268a29', '#2a8728', '#2d8528', '#308227', '#337f26', '#377d25', '#3a7a24', '#3d7824', '#417523', '#447222', '#477021', '#4b6d21', '#4e6a20', '#51681f', '#55651e', '#58621d', '#5b601d', '#5f5d1c', '#625b1b', '#65581a', '#695519', '#6c5319', '#6f5018', '#734d17', '#764b16', '#794815', '#7d4515', '#804314', '#834013', '#873d12', '#8a3b12', '#8d3811', '#903610', '#94330f', '#97300e', '#9a2e0e', '#9e2b0d', '#a1280c', '#a4260b', '#a8230a', '#ab200a', '#ae1e09', '#b21b08', '#b51807', '#b81607', '#bc1306', '#bf1105', '#c20e04', '#c60b03', '#c90903', '#cc0602', '#d00301', '#d30100', '#d40200', '#d40300', '#d40400', '#d40500', '#d40600', '#d40700', '#d40800', '#d40900', '#d40c00', '#d41000', '#D41100', '#D41200', '#d41300', '#D41400', '#D41500', '#d41600', '#d41a00', '#d41d00', '#d42000', '#d42400', '#d42700', '#d42a00', '#d42b00', '#d42c00', '#d42d00', '#d42e00', '#D43100', '#D43200', '#D43300', '#d43400', '#d43500', '#D43600', '#D43700', '#d43800', '#d43b00', '#D43C00', '#D43D00', '#d43e00', '#D44200', '#d44200', '#d44300', '#d44400', '#d44500', '#d44800', '#d44c00', '#d44f00', '#d45200', '#d45600', '#d45900', '#d45c00', '#d45f00', '#d46300', '#d46600', '#d46900', '#d46d00', '#d47000', '#d47300', '#d47700', '#d47a00', '#D47B00', '#D47C00', '#d47d00', '#d48100', '#D48200', '#D48300', '#d48400', '#d48700', '#d48b00', '#d48e00', '#d49100', '#d49500', '#d49800', '#d49b00', '#d49f00', '#d4a200', '#d4a500', '#d4a900', '#d4ac00', '#d4af00', '#d4b300', '#d4b600', '#d4b900', '#d4bc00', '#d4c000', '#d4c300', '#d4c600', '#d4ca00', '#d4cd00', '#d4d000', '#d4d400', '#D7D700', '#DADA00', '#DCDC00', '#DFDF00', '#E1E100', '#E4E400', '#E6E600', '#E9E900', '#ECEC00', '#F1F100', '#F6F200', '#F6F300', '#F6F400', '#F6F600', '#F6F700', '#F8F800', '#FBFB00', '#FDFD00', '#FDFE00', '#FFFD00', '#FDFF00', '#FFFF00'], '_smps_flo_w': ['#FFFFFF', '#000002', '#000004', '#000007', '#000009', '#00000b', '#00000d', '#000010', '#000012', '#000014', '#000016', '#000019', '#00001b', '#00001d', '#00001f', '#000021', '#000024', '#000026', '#000028', '#00002a', '#00002d', '#00002f', '#000031', '#000033', '#000036', '#000038', '#00003a', '#00003c', '#00003e', '#000041', '#000043', '#000045', '#000047', '#00004a', '#00004c', '#00004e', '#000050', '#000053', '#000055', '#000057', '#000059', '#00005b', '#00005e', '#000060', '#000062', '#000064', '#000067', '#000069', '#00006b', '#00006d', '#000070', '#000072', '#000076', '#000078', '#00007b', '#00007f', '#000081', '#000086', '#000088', '#00008d', '#00018e', '#00068b', '#000989', '#000e87', '#001185', '#001384', '#001881', '#001b7f', '#001e7e', '#00207d', '#00237b', '#00267a', '#002878', '#002b77', '#002e75', '#003074', '#003372', '#003671', '#003870', '#003b6e', '#003d6d', '#00406b', '#00436a', '#004568', '#004867', '#004b65', '#004d64', '#005063', '#005361', '#005560', '#00585e', '#005b5d', '#005d5b', '#00605a', '#006258', '#006557', '#006856', '#006a54', '#006d53', '#007051', '#007151', '#007150', '#007250', '#00754e', '#00764E', '#00774E', '#00784d', '#007a4b', '#007d4a', '#007f49', '#008247', '#008546', '#008744', '#008a43', '#008B42', '#008B41', '#008C41', '#008d41', '#008d41', '#008f40', '#00923e', '#00953d', '#00963D', '#00973c', '#009a3a', '#009d39', '#009e38', '#009f38', '#009f37', '#00a236', '#009F35', '#00a434', '#00A534', '#00a634', '#00A633', '#00a733', '#00a434', '#00A534', '#00A634', '#00a733', '#00A635', '#02a732', '#05a431', '#08a230', '#0c9f2f', '#0f9d2f', '#129a2e', '#16972d', '#19952c', '#1c922c', '#208f2b', '#238d2a', '#268a29', '#2a8728', '#2d8528', '#308227', '#337f26', '#377d25', '#3a7a24', '#3d7824', '#417523', '#447222', '#477021', '#4b6d21', '#4e6a20', '#51681f', '#55651e', '#58621d', '#5b601d', '#5f5d1c', '#625b1b', '#65581a', '#695519', '#6c5319', '#6f5018', '#734d17', '#764b16', '#794815', '#7d4515', '#804314', '#834013', '#873d12', '#8a3b12', '#8d3811', '#903610', '#94330f', '#97300e', '#9a2e0e', '#9e2b0d', '#a1280c', '#a4260b', '#a8230a', '#ab200a', '#ae1e09', '#b21b08', '#b51807', '#b81607', '#bc1306', '#bf1105', '#c20e04', '#c60b03', '#c90903', '#cc0602', '#d00301', '#d30100', '#d40200', '#d40300', '#d40400', '#d40500', '#d40600', '#d40700', '#d40800', '#d40900', '#d40c00', '#d41000', '#D41100', '#D41200', '#d41300', '#D41400', '#D41500', '#d41600', '#d41a00', '#d41d00', '#d42000', '#d42400', '#d42700', '#d42a00', '#d42b00', '#d42c00', '#d42d00', '#d42e00', '#D43100', '#D43200', '#D43300', '#d43400', '#d43500', '#D43600', '#D43700', '#d43800', '#d43b00', '#D43C00', '#D43D00', '#d43e00', '#D44200', '#d44200', '#d44300', '#d44400', '#d44500', '#d44800', '#d44c00', '#d44f00', '#d45200', '#d45600', '#d45900', '#d45c00', '#d45f00', '#d46300', '#d46600', '#d46900', '#d46d00', '#d47000', '#d47300', '#d47700', '#d47a00', '#D47B00', '#D47C00', '#d47d00', '#d48100', '#D48200', '#D48300', '#d48400', '#d48700', '#d48b00', '#d48e00', '#d49100', '#d49500', '#d49800', '#d49b00', '#d49f00', '#d4a200', '#d4a500', '#d4a900', '#d4ac00', '#d4af00', '#d4b300', '#d4b600', '#d4b900', '#d4bc00', '#d4c000', '#d4c300', '#d4c600', '#d4ca00', '#d4cd00', '#d4d000', '#d4d400', '#D7D700', '#DADA00', '#DCDC00', '#DFDF00', '#E1E100', '#E4E400', '#E6E600', '#E9E900', '#ECEC00', '#F1F100', '#F6F200', '#F6F300', '#F6F400', '#F6F600', '#F6F700', '#F8F800', '#FBFB00', '#FDFD00', '#FDFE00', '#FFFD00', '#FDFF00', '#FFFF00']}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.