content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class RestApiBaseTest(object):
def assert_items(self, items, cls):
"""Asserts that all items in a collection are instances of a class
"""
for item in items:
assert isinstance(item, cls)
def assert_has_valid_head(self, response, expected):
"""Asserts a response has a head string with an expected value
"""
assert 'head' in response
head = response['head']
assert isinstance(head, str)
assert head == expected
def assert_has_valid_link(self, response, expected_ending):
"""Asserts a response has a link url string with an expected ending
"""
assert link in response['link']
self.assert_valid_url(link, expected_ending)
def assert_has_valid_paging(self, js_response, pb_paging,
next_link=None, previous_link=None):
"""Asserts a response has a paging dict with the expected values.
"""
assert 'paging' in js_response
js_paging = js_response['paging']
if pb_paging.next:
assert 'next_position' in js_paging
if next_link is not None:
assert 'next' in js_paging
self.assert_valid_url(js_paging['next'], next_link)
else:
assert 'next' not in js_paging
def assert_has_valid_error(self, response, expected_code):
"""Asserts a response has only an error dict with an expected code
"""
assert 'error' in response
assert len(response) == 1
error = response['error']
assert 'code' in error
assert error['code'] == expected_code
assert 'title' in error
assert isinstance(error['title'], str)
assert 'message' in error
assert isinstance(error['message'], str)
def assert_has_valid_data_list(self, response, expected_length):
"""Asserts a response has a data list of dicts of an expected length.
"""
assert 'data' in response
data = response['data']
assert isinstance(data, list)
assert expected_length == len(data)
self.assert_items(data, dict)
def assert_has_valid_url(self, url, expected_ending=''):
"""Asserts a url is valid, and ends with the expected value
"""
assert isinstance(url, str)
assert url.startswith('http')
assert url.endswith(expected_ending)
def aasert_check_block_seq(blocks, *expected_ids):
if not isinstance(blocks, list):
blocks = [blocks]
consensus = None
for block, expected_id in zip(blocks, expected_ids):
assert isinstance(block, dict)
assert expected_id == block['header_signature']
assert isinstance(block['header'], dict)
assert consensus == b64decode(block['header']['consensus'])
batches = block['batches']
assert isinstance(batches, list)
assert len(batches) == 1
assert isinstance(batches, dict)
assert check_batch_seq(batches, expected_id)
return True
def assert_check_batch_seq(signer_key , batches , *expected_ids):
if not isinstance(batches, list):
batches = [batches]
for batch, expected_id in zip(batches, expected_ids):
assert expected_id == batch['header_signature']
assert isinstance(batch['header'], dict)
txns = batch['transactions']
assert isinstance(txns, list)
assert len(txns) == 1
assert isinstance(txns, dict)
assert check_transaction_seq(txns, expected_id) == True
return True
def assert_check_transaction_seq(txns , *expected_ids):
if not isinstance(txns, list):
txns = [txns]
payload = None
for txn, expected_id in zip(txns, expected_ids):
assert expected_id == txn['header_signature']
assert payload == b64decode(txn['payload'])
assert isinstance(txn['header'], dict)
assert expected_id == txn['header']['nonce']
return True
def assert_check_batch_nonce(self, response):
pass
def assert_check_family(self, response):
assert 'family_name' in response
assert 'family_version' in response
def assert_check_dependency(self, response):
pass
def assert_check_content(self, response):
pass
def assert_check_payload_algo(self):
pass
def assert_check_payload(self, response):
pass
def assert_batcher_public_key(self, signer_key , batch):
assert 'public_key' == batch['header']['signer_public_key']
def assert_signer_public_key(self, signer_key , batch):
assert 'public_key' == batch['header']['signer_public_key']
def aasert_check_batch_trace(self, trace):
assert bool(trace)
def assert_check_consensus(self):
pass
def assert_state_root_hash(self):
pass
def assert_check_previous_block_id(self):
pass
def assert_check_block_num(self):
pass | class Restapibasetest(object):
def assert_items(self, items, cls):
"""Asserts that all items in a collection are instances of a class
"""
for item in items:
assert isinstance(item, cls)
def assert_has_valid_head(self, response, expected):
"""Asserts a response has a head string with an expected value
"""
assert 'head' in response
head = response['head']
assert isinstance(head, str)
assert head == expected
def assert_has_valid_link(self, response, expected_ending):
"""Asserts a response has a link url string with an expected ending
"""
assert link in response['link']
self.assert_valid_url(link, expected_ending)
def assert_has_valid_paging(self, js_response, pb_paging, next_link=None, previous_link=None):
"""Asserts a response has a paging dict with the expected values.
"""
assert 'paging' in js_response
js_paging = js_response['paging']
if pb_paging.next:
assert 'next_position' in js_paging
if next_link is not None:
assert 'next' in js_paging
self.assert_valid_url(js_paging['next'], next_link)
else:
assert 'next' not in js_paging
def assert_has_valid_error(self, response, expected_code):
"""Asserts a response has only an error dict with an expected code
"""
assert 'error' in response
assert len(response) == 1
error = response['error']
assert 'code' in error
assert error['code'] == expected_code
assert 'title' in error
assert isinstance(error['title'], str)
assert 'message' in error
assert isinstance(error['message'], str)
def assert_has_valid_data_list(self, response, expected_length):
"""Asserts a response has a data list of dicts of an expected length.
"""
assert 'data' in response
data = response['data']
assert isinstance(data, list)
assert expected_length == len(data)
self.assert_items(data, dict)
def assert_has_valid_url(self, url, expected_ending=''):
"""Asserts a url is valid, and ends with the expected value
"""
assert isinstance(url, str)
assert url.startswith('http')
assert url.endswith(expected_ending)
def aasert_check_block_seq(blocks, *expected_ids):
if not isinstance(blocks, list):
blocks = [blocks]
consensus = None
for (block, expected_id) in zip(blocks, expected_ids):
assert isinstance(block, dict)
assert expected_id == block['header_signature']
assert isinstance(block['header'], dict)
assert consensus == b64decode(block['header']['consensus'])
batches = block['batches']
assert isinstance(batches, list)
assert len(batches) == 1
assert isinstance(batches, dict)
assert check_batch_seq(batches, expected_id)
return True
def assert_check_batch_seq(signer_key, batches, *expected_ids):
if not isinstance(batches, list):
batches = [batches]
for (batch, expected_id) in zip(batches, expected_ids):
assert expected_id == batch['header_signature']
assert isinstance(batch['header'], dict)
txns = batch['transactions']
assert isinstance(txns, list)
assert len(txns) == 1
assert isinstance(txns, dict)
assert check_transaction_seq(txns, expected_id) == True
return True
def assert_check_transaction_seq(txns, *expected_ids):
if not isinstance(txns, list):
txns = [txns]
payload = None
for (txn, expected_id) in zip(txns, expected_ids):
assert expected_id == txn['header_signature']
assert payload == b64decode(txn['payload'])
assert isinstance(txn['header'], dict)
assert expected_id == txn['header']['nonce']
return True
def assert_check_batch_nonce(self, response):
pass
def assert_check_family(self, response):
assert 'family_name' in response
assert 'family_version' in response
def assert_check_dependency(self, response):
pass
def assert_check_content(self, response):
pass
def assert_check_payload_algo(self):
pass
def assert_check_payload(self, response):
pass
def assert_batcher_public_key(self, signer_key, batch):
assert 'public_key' == batch['header']['signer_public_key']
def assert_signer_public_key(self, signer_key, batch):
assert 'public_key' == batch['header']['signer_public_key']
def aasert_check_batch_trace(self, trace):
assert bool(trace)
def assert_check_consensus(self):
pass
def assert_state_root_hash(self):
pass
def assert_check_previous_block_id(self):
pass
def assert_check_block_num(self):
pass |
def target_file():
return ".html"
def target_domain():
return "https://lyricsmania.com/"
def artist_query(name):
return target_domain() + str.lower(name) + "_lyrics" + target_file()
if __name__ == "__main__":
print(artist_query("Lizzo")) | def target_file():
return '.html'
def target_domain():
return 'https://lyricsmania.com/'
def artist_query(name):
return target_domain() + str.lower(name) + '_lyrics' + target_file()
if __name__ == '__main__':
print(artist_query('Lizzo')) |
load("@bazel_skylib//lib:paths.bzl", "paths")
GlslLibraryInfo = provider("Set of GLSL header files", fields = ["hdrs", "includes"])
SpirvLibraryInfo = provider("Set of Spirv files", fields = ["spvs", "includes"])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix
include_prefix = ctx.attr.include_prefix
outs = []
for hdr in ctx.files.hdrs:
path = hdr.owner.name
if strip_include_prefix:
if path.startswith(strip_include_prefix):
out = path.lstrip(strip_include_prefix)
out = out.lstrip("/")
else:
fail("{} is not a prefix of {}".format(strip_include_prefix, path))
else:
out = path
if include_prefix:
out = paths.join(include_prefix, out)
name = out.replace("/", "_") + "_export"
out = paths.join(
virtual_header_prefix,
out,
)
symlink = ctx.actions.declare_file(out)
ctx.actions.symlink(
output = symlink,
target_file = hdr,
)
outs.append(symlink)
return outs
def _compile_files(ctx, includes):
dephdrs = []
for dep in ctx.attr.deps:
glsllibraryinfo = dep[GlslLibraryInfo]
includes.extend(glsllibraryinfo.includes)
dephdrs.extend(
glsllibraryinfo.hdrs,
)
args = ctx.actions.args()
args.add("--target-env={}".format(ctx.attr.target_env))
args.add("--target-spv={}".format(ctx.attr.target_spv))
args.add("-std={}{}".format(ctx.attr.std_version, ctx.attr.std_profile))
args.add_all(includes, format_each = "-I%s", uniquify = True)
args.add_all(ctx.attr.defines, format_each = "-D%s", uniquify = True)
if ctx.attr.debug:
args.add("-g")
if ctx.attr.optimize:
args.add("-O")
strip_output_prefix = ctx.attr.strip_output_prefix
output_prefix = ctx.attr.output_prefix
outputs = []
for src in ctx.files.srcs:
path = src.owner.name
if strip_output_prefix:
if path.startswith(strip_output_prefix):
output_path = path.lstrip(strip_output_prefix)
output_path = output_path.lstrip("/")
else:
fail("{} is not a prefix of {}".format(strip_output_prefix, path))
else:
output_path = path
if output_prefix:
output_path = paths.join(output_prefix, output_path)
output_path = output_path + ".spv"
output_file = ctx.actions.declare_file(output_path)
outputs.append((output_path, output_file))
argsio = ctx.actions.args()
argsio.add_all(["-o", output_file.path, src])
ctx.actions.run(
outputs = [output_file],
inputs = ctx.files.srcs + ctx.files.hdrs + dephdrs,
executable = ctx.files.glslc[0],
arguments = [args, argsio],
)
return outputs
def _glsl_library_impl(ctx):
# compile the files
this_build_file_dir = paths.dirname(ctx.build_file_path)
this_package_dir = paths.join(this_build_file_dir, ctx.attr.name)
spirvs = {spv[0]: spv[1] for spv in _compile_files(ctx, [this_package_dir])}
# Make sure they are correctly exposed to other packages
virtual_header_prefix = "_virtual_includes/{}".format(ctx.attr.name)
hdrs = _export_headers(ctx, virtual_header_prefix)
includes = [paths.dirname(ctx.build_file_path)]
for include in ctx.attr.includes:
path = paths.normalize(paths.join(
this_build_file_dir,
virtual_header_prefix,
include,
))
includes.append(path)
includes.append(paths.join(ctx.bin_dir.path, path))
providers = [
DefaultInfo(
files = depset(hdrs + spirvs.values()),
runfiles = ctx.runfiles(
files = spirvs.values(),
),
),
GlslLibraryInfo(
hdrs = hdrs,
includes = includes,
),
CcInfo(), # So it can be used as a dep for cc_library/binary and have spirvs embedded as runfiles
]
if spirvs:
# Compute output location for spv files
# This will be used to populate the includes variable of the SpirvLibraryInfo provider
# Check if this could made more resilient
spirvs_root = paths.join(ctx.bin_dir.path, spirvs.values()[0].owner.workspace_root)
providers.append(SpirvLibraryInfo(
spvs = spirvs.values(),
includes = [spirvs_root],
))
return providers
glsl_library = rule(
implementation = _glsl_library_impl,
attrs = {
"include_prefix": attr.string(),
"strip_include_prefix": attr.string(),
"output_prefix": attr.string(),
"strip_output_prefix": attr.string(),
"srcs": attr.label_list(allow_files = [
"vert",
"tesc",
"tese",
"geom",
"frag",
# compute
"comp",
# mesh shaders
"mesh",
"task",
# ray tracing
"rgen",
"rint",
"rahit",
"rchit",
"rmiss",
"rcall",
# generic, for inclusion
"glsl",
]),
"hdrs": attr.label_list(allow_files = ["glsl"]),
"includes": attr.string_list(default = ["./"]),
"deps": attr.label_list(
providers = [GlslLibraryInfo],
),
"std_version": attr.string(
default = "460",
values = ["410", "420", "430", "440", "450", "460"],
),
"std_profile": attr.string(
default = "core",
values = ["core", "compatibility", "es"],
),
"target_spv": attr.string(
default = "spv1.3",
values = ["spv1.0", "spv1.1", "spv1.2", "spv1.3", "spv1.4", "spv1.5"],
),
"target_env": attr.string(
default = "vulkan1.2",
values = [
"vulkan1.0",
"vulkan1.1",
"vulkan1.2",
"vulkan", # Same as vulkan1.0
"opengl4.5",
"opengl", # Same as opengl4.5
],
),
"defines": attr.string_list(),
"debug": attr.bool(default = True),
"optimize": attr.bool(default = True),
"glslc": attr.label(
allow_single_file = True,
default = "@shaderc//:glslc",
),
},
)
| load('@bazel_skylib//lib:paths.bzl', 'paths')
glsl_library_info = provider('Set of GLSL header files', fields=['hdrs', 'includes'])
spirv_library_info = provider('Set of Spirv files', fields=['spvs', 'includes'])
def _export_headers(ctx, virtual_header_prefix):
strip_include_prefix = ctx.attr.strip_include_prefix
include_prefix = ctx.attr.include_prefix
outs = []
for hdr in ctx.files.hdrs:
path = hdr.owner.name
if strip_include_prefix:
if path.startswith(strip_include_prefix):
out = path.lstrip(strip_include_prefix)
out = out.lstrip('/')
else:
fail('{} is not a prefix of {}'.format(strip_include_prefix, path))
else:
out = path
if include_prefix:
out = paths.join(include_prefix, out)
name = out.replace('/', '_') + '_export'
out = paths.join(virtual_header_prefix, out)
symlink = ctx.actions.declare_file(out)
ctx.actions.symlink(output=symlink, target_file=hdr)
outs.append(symlink)
return outs
def _compile_files(ctx, includes):
dephdrs = []
for dep in ctx.attr.deps:
glsllibraryinfo = dep[GlslLibraryInfo]
includes.extend(glsllibraryinfo.includes)
dephdrs.extend(glsllibraryinfo.hdrs)
args = ctx.actions.args()
args.add('--target-env={}'.format(ctx.attr.target_env))
args.add('--target-spv={}'.format(ctx.attr.target_spv))
args.add('-std={}{}'.format(ctx.attr.std_version, ctx.attr.std_profile))
args.add_all(includes, format_each='-I%s', uniquify=True)
args.add_all(ctx.attr.defines, format_each='-D%s', uniquify=True)
if ctx.attr.debug:
args.add('-g')
if ctx.attr.optimize:
args.add('-O')
strip_output_prefix = ctx.attr.strip_output_prefix
output_prefix = ctx.attr.output_prefix
outputs = []
for src in ctx.files.srcs:
path = src.owner.name
if strip_output_prefix:
if path.startswith(strip_output_prefix):
output_path = path.lstrip(strip_output_prefix)
output_path = output_path.lstrip('/')
else:
fail('{} is not a prefix of {}'.format(strip_output_prefix, path))
else:
output_path = path
if output_prefix:
output_path = paths.join(output_prefix, output_path)
output_path = output_path + '.spv'
output_file = ctx.actions.declare_file(output_path)
outputs.append((output_path, output_file))
argsio = ctx.actions.args()
argsio.add_all(['-o', output_file.path, src])
ctx.actions.run(outputs=[output_file], inputs=ctx.files.srcs + ctx.files.hdrs + dephdrs, executable=ctx.files.glslc[0], arguments=[args, argsio])
return outputs
def _glsl_library_impl(ctx):
this_build_file_dir = paths.dirname(ctx.build_file_path)
this_package_dir = paths.join(this_build_file_dir, ctx.attr.name)
spirvs = {spv[0]: spv[1] for spv in _compile_files(ctx, [this_package_dir])}
virtual_header_prefix = '_virtual_includes/{}'.format(ctx.attr.name)
hdrs = _export_headers(ctx, virtual_header_prefix)
includes = [paths.dirname(ctx.build_file_path)]
for include in ctx.attr.includes:
path = paths.normalize(paths.join(this_build_file_dir, virtual_header_prefix, include))
includes.append(path)
includes.append(paths.join(ctx.bin_dir.path, path))
providers = [default_info(files=depset(hdrs + spirvs.values()), runfiles=ctx.runfiles(files=spirvs.values())), glsl_library_info(hdrs=hdrs, includes=includes), cc_info()]
if spirvs:
spirvs_root = paths.join(ctx.bin_dir.path, spirvs.values()[0].owner.workspace_root)
providers.append(spirv_library_info(spvs=spirvs.values(), includes=[spirvs_root]))
return providers
glsl_library = rule(implementation=_glsl_library_impl, attrs={'include_prefix': attr.string(), 'strip_include_prefix': attr.string(), 'output_prefix': attr.string(), 'strip_output_prefix': attr.string(), 'srcs': attr.label_list(allow_files=['vert', 'tesc', 'tese', 'geom', 'frag', 'comp', 'mesh', 'task', 'rgen', 'rint', 'rahit', 'rchit', 'rmiss', 'rcall', 'glsl']), 'hdrs': attr.label_list(allow_files=['glsl']), 'includes': attr.string_list(default=['./']), 'deps': attr.label_list(providers=[GlslLibraryInfo]), 'std_version': attr.string(default='460', values=['410', '420', '430', '440', '450', '460']), 'std_profile': attr.string(default='core', values=['core', 'compatibility', 'es']), 'target_spv': attr.string(default='spv1.3', values=['spv1.0', 'spv1.1', 'spv1.2', 'spv1.3', 'spv1.4', 'spv1.5']), 'target_env': attr.string(default='vulkan1.2', values=['vulkan1.0', 'vulkan1.1', 'vulkan1.2', 'vulkan', 'opengl4.5', 'opengl']), 'defines': attr.string_list(), 'debug': attr.bool(default=True), 'optimize': attr.bool(default=True), 'glslc': attr.label(allow_single_file=True, default='@shaderc//:glslc')}) |
node = S(input, "application/json")
node.prop("comment", "42!")
propertyNode = node.prop("comment")
value = propertyNode.stringValue() | node = s(input, 'application/json')
node.prop('comment', '42!')
property_node = node.prop('comment')
value = propertyNode.stringValue() |
def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa/100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa/100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res
| def moeda(funcao, moeda='R$'):
return f'{moeda}{funcao:.2f}'.replace('.', ',')
def aumentar(p, taxa):
res = p * (1 + taxa / 100)
return res
def diminuir(p, taxa):
res = p * (1 - taxa / 100)
return res
def dobro(p):
res = p * 2
return res
def metade(p):
res = p / 2
return res |
class Solution:
def naive(self,root):
self.res = 0
def dfs(tree,s):
s_ = s*10+tree.val
if tree.left==None and tree.right==None:
self.res+=s_
return
if tree.left:
dfs(tree.left,s_)
if tree.right:
dfs(tree.right,s_)
dfs(root,0)
return self.res | class Solution:
def naive(self, root):
self.res = 0
def dfs(tree, s):
s_ = s * 10 + tree.val
if tree.left == None and tree.right == None:
self.res += s_
return
if tree.left:
dfs(tree.left, s_)
if tree.right:
dfs(tree.right, s_)
dfs(root, 0)
return self.res |
class Solution:
def getSmallestString(self, n: int, k: int) -> str:
op=['a']*n
k=k-n
i=n-1
while k:
k+=1
if k/26>=1:
op[i]='z'
i-=1
k=k-26
else:
op[i]=chr(k+96)
k=0
return ''.join(op)
| class Solution:
def get_smallest_string(self, n: int, k: int) -> str:
op = ['a'] * n
k = k - n
i = n - 1
while k:
k += 1
if k / 26 >= 1:
op[i] = 'z'
i -= 1
k = k - 26
else:
op[i] = chr(k + 96)
k = 0
return ''.join(op) |
# -*- coding: utf-8 -*-
"""An implementation of learning priority sort algorithm_learning with NTM.
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
"""
| """An implementation of learning priority sort algorithm_learning with NTM.
Input sequence length: "1 ~ 20: (1*2+1)=3 ~ (20*2+1)=41"
Input dimension: "8"
Output sequence length: equal to input sequence length.
Output dimension: equal to input dimension.
""" |
def summation(n,term):
total,k=0,1
while k<=n:
total,k = term(k) + total, k+1
return total
def square(x):
return x*x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4*x-3) * (4*x-1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_summantion(1e6))
print(suqare_summantio(4))
| def summation(n, term):
(total, k) = (0, 1)
while k <= n:
(total, k) = (term(k) + total, k + 1)
return total
def square(x):
return x * x
def pi_summantion(n):
return summation(n, lambda x: 8 / ((4 * x - 3) * (4 * x - 1)))
def suqare_summantio(n):
return summation(n, square)
print(pi_summantion(1000000.0))
print(suqare_summantio(4)) |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 13 14:05:03 2020
Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed
Book Chapter 2 Finger Exercises
Using While Loop
@author: Atanas Kozarev - github.com/ultraasi-atanas
"""
numXs = int(input('How many times should I print the letter X? '))
toPrint = ''
# concatenate X to toPrint numXs times
while numXs > 0:
toPrint = toPrint + 'X'
numXs -= 1
print(toPrint) | """
Created on Fri Nov 13 14:05:03 2020
Introduction to Computation and Programming Using Python. John V. Guttag, 2016, 2nd ed
Book Chapter 2 Finger Exercises
Using While Loop
@author: Atanas Kozarev - github.com/ultraasi-atanas
"""
num_xs = int(input('How many times should I print the letter X? '))
to_print = ''
while numXs > 0:
to_print = toPrint + 'X'
num_xs -= 1
print(toPrint) |
def sort_2d_np(edges):
"""
edges: (m x 2)
Sort ascendngly according to each column.
Example:
edges = array(
[[9, 8],
[3, 6],
[1, 3],
[8, 6],
[3, 2],
[9, 1],
[5, 1]]
)
sorted_edges = array(
[[1, 3],
[3, 2],
[3, 6],
[5, 1],
[8, 6],
[9, 1],
[9, 8]]
)
"""
sort_idx = np.arange(len(edges))
sort_dim1 = edges[:,1].argsort()
sort_idx = sort_idx[sort_dim1]
edges = edges[sort_dim1]
sort_dim0 = edges[:,0].argsort()
sort_idx = sort_idx[sort_dim0]
edges = edges[sort_dim0]
return (sort_idx, edges)
def softmax_np(x):
assert isinstance(x, np.ndarray)
assert len(x.shape) == 1
x = np.exp(x)
return x/x.sum()
def l1_normalize_np(x):
assert isinstance(x, np.ndarray)
assert len(x.shape) == 1
return x/x.sum()
def diag_mask_np(n):
return np.array([[i, i] for i in range(n)])
| def sort_2d_np(edges):
"""
edges: (m x 2)
Sort ascendngly according to each column.
Example:
edges = array(
[[9, 8],
[3, 6],
[1, 3],
[8, 6],
[3, 2],
[9, 1],
[5, 1]]
)
sorted_edges = array(
[[1, 3],
[3, 2],
[3, 6],
[5, 1],
[8, 6],
[9, 1],
[9, 8]]
)
"""
sort_idx = np.arange(len(edges))
sort_dim1 = edges[:, 1].argsort()
sort_idx = sort_idx[sort_dim1]
edges = edges[sort_dim1]
sort_dim0 = edges[:, 0].argsort()
sort_idx = sort_idx[sort_dim0]
edges = edges[sort_dim0]
return (sort_idx, edges)
def softmax_np(x):
assert isinstance(x, np.ndarray)
assert len(x.shape) == 1
x = np.exp(x)
return x / x.sum()
def l1_normalize_np(x):
assert isinstance(x, np.ndarray)
assert len(x.shape) == 1
return x / x.sum()
def diag_mask_np(n):
return np.array([[i, i] for i in range(n)]) |
class PhotoAlbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
return cls(pages_count)
def add_photo(self, label: str):
for index, current_page in enumerate(self.photos):
if len(current_page) < 4:
current_page.append(label)
return f"{label} photo added successfully on page {index + 1} slot {len(current_page)}"
return "No more free slots"
def display(self):
matrix = []
for row in self.photos:
current_sheet = []
for col in row:
current_sheet.append(str([]))
matrix.append(' '.join(current_sheet))
result = []
result.append("-----------")
for row in matrix:
result.append(row)
result.append("-----------")
return '\n'.join(result)
| class Photoalbum:
def __init__(self, pages: int):
self.pages = pages
self.photos = [[] for _ in range(self.pages)]
@classmethod
def from_photos_count(cls, photos_count: int):
pages_count = photos_count // 4
if photos_count % 4 != 0:
pages_count += 1
return cls(pages_count)
def add_photo(self, label: str):
for (index, current_page) in enumerate(self.photos):
if len(current_page) < 4:
current_page.append(label)
return f'{label} photo added successfully on page {index + 1} slot {len(current_page)}'
return 'No more free slots'
def display(self):
matrix = []
for row in self.photos:
current_sheet = []
for col in row:
current_sheet.append(str([]))
matrix.append(' '.join(current_sheet))
result = []
result.append('-----------')
for row in matrix:
result.append(row)
result.append('-----------')
return '\n'.join(result) |
print('hii'+str(5))
print(int(8)+5);
print(float(8.5)+5);
print(int(8.5)+5);
#print(int('C'))
| print('hii' + str(5))
print(int(8) + 5)
print(float(8.5) + 5)
print(int(8.5) + 5) |
def compare(v1, operator, v2):
if operator == ">":
return v1 > v2
elif operator == "<":
return v1 < v2
elif operator == ">=":
return v1 >= v2
elif operator == "<=":
return v1 <= v2
elif operator == "=" or "==":
return v1 == v2
elif operator == "!=":
return v1 != v2
| def compare(v1, operator, v2):
if operator == '>':
return v1 > v2
elif operator == '<':
return v1 < v2
elif operator == '>=':
return v1 >= v2
elif operator == '<=':
return v1 <= v2
elif operator == '=' or '==':
return v1 == v2
elif operator == '!=':
return v1 != v2 |
def return_load(**kwargs):
if kwargs['_type'] == 'Point':
load = PointLoad(**kwargs)
elif kwargs['_type'] == 'Uniform':
load = UniformLoad(**kwargs)
else:
print('Invalid type: returned default `PointLoad`')
return PointLoad()
return load
class PointLoad(object):
"""
docstring for PointLoad class
"""
def __init__(self, **kwargs):
self._position = kwargs['position'] if 'position' in kwargs else 0
self._force = kwargs['force'] if 'force' in kwargs else 0
self._moment = kwargs['moment'] if 'moment' in kwargs else 0
def __str__(self):
return 'Point Load:\n\tposition: {pos}\tforce: {force}\tmoment: {moment}\n'.format(
pos=self.position, force=self.force, moment=self.moment)
@property
def type(self):
return 'Point'
@property
def position(self):
return self._position
@position.setter
def position(self, value):
self._position = value if value >= 0 else self._position
@property
def force(self):
return self._force
@force.setter
def force(self, value):
self._force = value
@property
def moment(self):
return self._moment
@moment.setter
def moment(self, value):
self._moment = value
class UniformLoad(object):
"""
docstring for UniformLoad
"""
def __init__(self, **kwargs):
"""
:param start: start position
:param end: end position
:param line: line pressure
"""
self._start = kwargs['start'] if 'start' in kwargs else 0
self._end = kwargs['end'] if 'end' in kwargs else 0
self._line_pressure = kwargs['line_pressure'] if 'line_pressure' in kwargs else 0
def __str__(self):
return 'Uniform Load:\n\tstart: {start}\tend: {end}pressure: {line}\n'.format(
start=self.start, end=self.end, line=self.line_pressure)
@property
def start(self):
return self._start
@start.setter
def start(self, value):
self._start = value if 0 < value < self._end else self._start
@property
def end(self):
return self._end
@end.setter
def end(self, value):
self._end = value if value > self._start else self._end
@property
def line_pressure(self):
return self._line_pressure
@line_pressure.setter
def line_pressure(self, value):
self._line_pressure = value
@property
def position(self):
return (self.start + self.end) / 2
@property
def length(self):
return self.end - self.start
@property
def force(self):
return self.length * self.line_pressure
@property
def moment(self):
return 0
| def return_load(**kwargs):
if kwargs['_type'] == 'Point':
load = point_load(**kwargs)
elif kwargs['_type'] == 'Uniform':
load = uniform_load(**kwargs)
else:
print('Invalid type: returned default `PointLoad`')
return point_load()
return load
class Pointload(object):
"""
docstring for PointLoad class
"""
def __init__(self, **kwargs):
self._position = kwargs['position'] if 'position' in kwargs else 0
self._force = kwargs['force'] if 'force' in kwargs else 0
self._moment = kwargs['moment'] if 'moment' in kwargs else 0
def __str__(self):
return 'Point Load:\n\tposition: {pos}\tforce: {force}\tmoment: {moment}\n'.format(pos=self.position, force=self.force, moment=self.moment)
@property
def type(self):
return 'Point'
@property
def position(self):
return self._position
@position.setter
def position(self, value):
self._position = value if value >= 0 else self._position
@property
def force(self):
return self._force
@force.setter
def force(self, value):
self._force = value
@property
def moment(self):
return self._moment
@moment.setter
def moment(self, value):
self._moment = value
class Uniformload(object):
"""
docstring for UniformLoad
"""
def __init__(self, **kwargs):
"""
:param start: start position
:param end: end position
:param line: line pressure
"""
self._start = kwargs['start'] if 'start' in kwargs else 0
self._end = kwargs['end'] if 'end' in kwargs else 0
self._line_pressure = kwargs['line_pressure'] if 'line_pressure' in kwargs else 0
def __str__(self):
return 'Uniform Load:\n\tstart: {start}\tend: {end}pressure: {line}\n'.format(start=self.start, end=self.end, line=self.line_pressure)
@property
def start(self):
return self._start
@start.setter
def start(self, value):
self._start = value if 0 < value < self._end else self._start
@property
def end(self):
return self._end
@end.setter
def end(self, value):
self._end = value if value > self._start else self._end
@property
def line_pressure(self):
return self._line_pressure
@line_pressure.setter
def line_pressure(self, value):
self._line_pressure = value
@property
def position(self):
return (self.start + self.end) / 2
@property
def length(self):
return self.end - self.start
@property
def force(self):
return self.length * self.line_pressure
@property
def moment(self):
return 0 |
#pythran export fib_pythran(int)
def fib_pythran(n):
i, sum, last, curr = 0, 0, 0, 1
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
#pythran export count_doubles_pythran_zip(str, int)
def count_doubles_pythran_zip(val, n):
total = 0
for c1, c2 in zip(val, val[1:]):
if c1 == c2:
total += 1
return total
#pythran export count_doubles_pythran(str, int)
def count_doubles_pythran(val, n):
total = 0
last = val[0]
for i in range(1, n):
cur = val[i]
if last == cur:
total += 1
last = cur
return total
#pythran export sum2d_pythran(int[][], int, int)
def sum2d_pythran(arr, m, n):
result = 0.0
for i in range(m):
for j in range(n):
result += arr[i,j]
return result
#pythran export mandel_pythran(int, int, int)
def mandel_pythran(x, y, max_iters):
i = 0
c = complex(x, y)
z = 0.0j
for i in range(max_iters):
z = z * z + c
if (z.real * z.real + z.imag * z.imag) >= 4:
return i
return 255
#pythran export fractal_pythran(float, float, float, float, uint8[][], int)
def fractal_pythran(min_x, max_x, min_y, max_y, image, iters):
height = image.shape[0]
width = image.shape[1]
pixel_size_x = (max_x - min_x) / width
pixel_size_y = (max_y - min_y) / height
for x in range(width):
real = min_x + x * pixel_size_x
for y in range(height):
imag = min_y + y * pixel_size_y
color = mandel_pythran(real, imag, iters)
image[y, x] = color
return image
| def fib_pythran(n):
(i, sum, last, curr) = (0, 0, 0, 1)
if n <= 2:
return 1
while i < n - 1:
sum = last + curr
last = curr
curr = sum
i += 1
return sum
def count_doubles_pythran_zip(val, n):
total = 0
for (c1, c2) in zip(val, val[1:]):
if c1 == c2:
total += 1
return total
def count_doubles_pythran(val, n):
total = 0
last = val[0]
for i in range(1, n):
cur = val[i]
if last == cur:
total += 1
last = cur
return total
def sum2d_pythran(arr, m, n):
result = 0.0
for i in range(m):
for j in range(n):
result += arr[i, j]
return result
def mandel_pythran(x, y, max_iters):
i = 0
c = complex(x, y)
z = 0j
for i in range(max_iters):
z = z * z + c
if z.real * z.real + z.imag * z.imag >= 4:
return i
return 255
def fractal_pythran(min_x, max_x, min_y, max_y, image, iters):
height = image.shape[0]
width = image.shape[1]
pixel_size_x = (max_x - min_x) / width
pixel_size_y = (max_y - min_y) / height
for x in range(width):
real = min_x + x * pixel_size_x
for y in range(height):
imag = min_y + y * pixel_size_y
color = mandel_pythran(real, imag, iters)
image[y, x] = color
return image |
#
# PySNMP MIB module PNNI-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PNNI-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
extensions, = mibBuilder.importSymbols("CENTILLION-ROOT-MIB", "extensions")
lecsConfIndex, = mibBuilder.importSymbols("LAN-EMULATION-ELAN-MIB", "lecsConfIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, Bits, ModuleIdentity, MibIdentifier, IpAddress, iso, NotificationType, Gauge32, Counter64, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Counter32, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Bits", "ModuleIdentity", "MibIdentifier", "IpAddress", "iso", "NotificationType", "Gauge32", "Counter64", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Counter32", "ObjectIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cnPnniExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5))
cnPnniMainExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 1))
cnPnnilecsExt = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 2))
cnPnniTdbOverload = MibIdentifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 3))
cnPnniAdminStatus = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniAdminStatus.setDescription('The desired state of PNNI in the switching system. Setting this object to disabled(2) disables PNNI capability in the switch. Setting it to enabled(1) enables PNNI capability.')
cnPnniCurNodes = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnPnniCurNodes.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniCurNodes.setDescription('The number of PNNI logical nodes currently configured in the switching system.')
lecsConfExtTable = MibTable((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1), )
if mibBuilder.loadTexts: lecsConfExtTable.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtTable.setDescription('This table contains the configuration information that are additional to the existing lecsConfTable')
lecsConfExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1), ).setIndexNames((0, "LAN-EMULATION-ELAN-MIB", "lecsConfIndex"))
if mibBuilder.loadTexts: lecsConfExtEntry.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtEntry.setDescription('Each entry represents a LECS this agent maintains in this extension table. A row in this table is not valid unless the same row is valid in the lecsConfTable defined in af1129r5.mib')
lecsConfExtScope = MibTableColumn((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 104))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lecsConfExtScope.setStatus('mandatory')
if mibBuilder.loadTexts: lecsConfExtScope.setDescription('PNNI scope value')
cnPnniMemConsumptionLowwater = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniMemConsumptionLowwater.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniMemConsumptionLowwater.setDescription('The value of low memory watermark. If memory allocated to PNNI task is less than this value, then the Database resynchronization be attempted.')
cnPnniMemConsumptionHighwater = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniMemConsumptionHighwater.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniMemConsumptionHighwater.setDescription('The value of high memory watermark. If memory allocated to PNNI task is greater than this value, then the node will enter to topology database overload state.')
cnPnniOverLoadRetryTime = MibScalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cnPnniOverLoadRetryTime.setStatus('mandatory')
if mibBuilder.loadTexts: cnPnniOverLoadRetryTime.setDescription('The value of the database resynch attempt timer in seconds.')
mibBuilder.exportSymbols("PNNI-EXT-MIB", lecsConfExtEntry=lecsConfExtEntry, cnPnniTdbOverload=cnPnniTdbOverload, lecsConfExtTable=lecsConfExtTable, cnPnniOverLoadRetryTime=cnPnniOverLoadRetryTime, cnPnniMainExt=cnPnniMainExt, cnPnniCurNodes=cnPnniCurNodes, cnPnniMemConsumptionHighwater=cnPnniMemConsumptionHighwater, cnPnniExt=cnPnniExt, cnPnniMemConsumptionLowwater=cnPnniMemConsumptionLowwater, lecsConfExtScope=lecsConfExtScope, cnPnnilecsExt=cnPnnilecsExt, cnPnniAdminStatus=cnPnniAdminStatus)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint')
(extensions,) = mibBuilder.importSymbols('CENTILLION-ROOT-MIB', 'extensions')
(lecs_conf_index,) = mibBuilder.importSymbols('LAN-EMULATION-ELAN-MIB', 'lecsConfIndex')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(unsigned32, bits, module_identity, mib_identifier, ip_address, iso, notification_type, gauge32, counter64, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, counter32, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'Bits', 'ModuleIdentity', 'MibIdentifier', 'IpAddress', 'iso', 'NotificationType', 'Gauge32', 'Counter64', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Counter32', 'ObjectIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
cn_pnni_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5))
cn_pnni_main_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 1))
cn_pnnilecs_ext = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 2))
cn_pnni_tdb_overload = mib_identifier((1, 3, 6, 1, 4, 1, 930, 3, 5, 3))
cn_pnni_admin_status = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniAdminStatus.setDescription('The desired state of PNNI in the switching system. Setting this object to disabled(2) disables PNNI capability in the switch. Setting it to enabled(1) enables PNNI capability.')
cn_pnni_cur_nodes = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cnPnniCurNodes.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniCurNodes.setDescription('The number of PNNI logical nodes currently configured in the switching system.')
lecs_conf_ext_table = mib_table((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1))
if mibBuilder.loadTexts:
lecsConfExtTable.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtTable.setDescription('This table contains the configuration information that are additional to the existing lecsConfTable')
lecs_conf_ext_entry = mib_table_row((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1)).setIndexNames((0, 'LAN-EMULATION-ELAN-MIB', 'lecsConfIndex'))
if mibBuilder.loadTexts:
lecsConfExtEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtEntry.setDescription('Each entry represents a LECS this agent maintains in this extension table. A row in this table is not valid unless the same row is valid in the lecsConfTable defined in af1129r5.mib')
lecs_conf_ext_scope = mib_table_column((1, 3, 6, 1, 4, 1, 930, 3, 5, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 104))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
lecsConfExtScope.setStatus('mandatory')
if mibBuilder.loadTexts:
lecsConfExtScope.setDescription('PNNI scope value')
cn_pnni_mem_consumption_lowwater = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 1), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniMemConsumptionLowwater.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniMemConsumptionLowwater.setDescription('The value of low memory watermark. If memory allocated to PNNI task is less than this value, then the Database resynchronization be attempted.')
cn_pnni_mem_consumption_highwater = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniMemConsumptionHighwater.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniMemConsumptionHighwater.setDescription('The value of high memory watermark. If memory allocated to PNNI task is greater than this value, then the node will enter to topology database overload state.')
cn_pnni_over_load_retry_time = mib_scalar((1, 3, 6, 1, 4, 1, 930, 3, 5, 3, 3), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cnPnniOverLoadRetryTime.setStatus('mandatory')
if mibBuilder.loadTexts:
cnPnniOverLoadRetryTime.setDescription('The value of the database resynch attempt timer in seconds.')
mibBuilder.exportSymbols('PNNI-EXT-MIB', lecsConfExtEntry=lecsConfExtEntry, cnPnniTdbOverload=cnPnniTdbOverload, lecsConfExtTable=lecsConfExtTable, cnPnniOverLoadRetryTime=cnPnniOverLoadRetryTime, cnPnniMainExt=cnPnniMainExt, cnPnniCurNodes=cnPnniCurNodes, cnPnniMemConsumptionHighwater=cnPnniMemConsumptionHighwater, cnPnniExt=cnPnniExt, cnPnniMemConsumptionLowwater=cnPnniMemConsumptionLowwater, lecsConfExtScope=lecsConfExtScope, cnPnnilecsExt=cnPnnilecsExt, cnPnniAdminStatus=cnPnniAdminStatus) |
"""
@author Huaze Shen
@date 2019-10-05
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def delete_duplicates(head):
if head is None or head.next is None:
return head
pre = head
while pre:
cur = pre
while cur.next and cur.val == cur.next.val:
cur = cur.next
pre.next = cur.next
pre = pre.next
return head
if __name__ == '__main__':
head_ = ListNode(1)
head_.next = ListNode(2)
head_.next.next = ListNode(3)
head_.next.next.next = ListNode(3)
head_.next.next.next.next = ListNode(4)
head_.next.next.next.next.next = ListNode(4)
head_.next.next.next.next.next.next = ListNode(5)
result = delete_duplicates(head_)
while result:
print(result.val)
result = result.next
| """
@author Huaze Shen
@date 2019-10-05
"""
class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def delete_duplicates(head):
if head is None or head.next is None:
return head
pre = head
while pre:
cur = pre
while cur.next and cur.val == cur.next.val:
cur = cur.next
pre.next = cur.next
pre = pre.next
return head
if __name__ == '__main__':
head_ = list_node(1)
head_.next = list_node(2)
head_.next.next = list_node(3)
head_.next.next.next = list_node(3)
head_.next.next.next.next = list_node(4)
head_.next.next.next.next.next = list_node(4)
head_.next.next.next.next.next.next = list_node(5)
result = delete_duplicates(head_)
while result:
print(result.val)
result = result.next |
# flake8: noqa
bm25 = BatchRetrieve(index, "BM25")
axiom = (ArgUC() & QTArg() & QTPArg()) | ORIG()
# Re-rank top-20 documents with KwikSort.
kwiksort = bm25 % 20 >> \
KwikSortReranker(axiom, index)
pipeline = kwiksort ^ bm25
| bm25 = batch_retrieve(index, 'BM25')
axiom = arg_uc() & qt_arg() & qtp_arg() | orig()
kwiksort = bm25 % 20 >> kwik_sort_reranker(axiom, index)
pipeline = kwiksort ^ bm25 |
ciphertext = "WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA DAEHI OTSTE IEYES HHSNG EHCAT SOUAC EHSST TCODN FSOTS TIIGN LTTNL DUBST TCMIM EHTAO IUUPF TSTTI PUEAY OAEOA EEALA LWGWM GNHYU IAAHD TORYA OLVMH RHTGY IHNNM UAARL MMHID HYFCP GRAET MTCNT HIIIO RCVCL BOTSA OFRNR YEHTG IFHEA WLYSC EEEEY UVEIM SOEUE TAYHN NITEK AERAW DSIAE QTDIE HET".replace(" ","")
def getLineLength(l_cipher,line,key):
n = key
q = l_cipher // (2*n-2)
r = l_cipher % (2*n-2)
assert type(q) is int
if line == 1:
return (q+1) if r >= 1 else q
elif line == key:
return (q+1) if r >= key else q
else:
if r >= (2*n-2) - (line - 2):
return 2*q + 2
elif r >= line:
return 2*q + 1
else:
return 2*q
def sumRowIndex(l_cipher,row,key):
sum = 0
for line in range (1,row+1):
sum += getLineLength(l_cipher,line,key)
return sum
def decrypt(cipher,key):
plain = ''
l = len(cipher)
for i in range (1,l+1):
# i = nq + r
n = key
q = i // (2*n-2)
r = i % (2*n-2)
if r >= key + 1:
row = key - (r-key)
column = 2*q + 2
elif r == key:
row = key
column = q + 1
elif r >= 2:
row = r
column = 2*q +1
elif r == 1:
row = 1
column = q+1
else:
row = 2
column = 2*q
print(i, sumRowIndex(l,row-1,key)+column)
print(plain)
plain += cipher[sumRowIndex(l,row-1,key)+column-1]
return plain
test_vector = 'WECRL TEERD SOEEF EAOCA IVDEN'.replace(' ','')
print(decrypt(ciphertext,17))
| ciphertext = 'WAPSD EXTCO EEREF SELIO RSARC LIETE OIHHP VASTF EGBER IPAPN TOEGI AIATH DDHIY EACYE RQAEN OHRTE TEVME BGHMF EIOWS GFHCL XEUUC OMTOT LERES SDEWW ORCCS HEURE ATTEG ALSEB APXET IURWV RTEEH IOTLO SNACN NULCV LCMTH HHCOH TIOTD ASNAL TSANA CASOR LEKAS TATCW INTLO TRYER YLTND RILER AOMAX OITDE ECOIA HAALS TYIOA DAEHI OTSTE IEYES HHSNG EHCAT SOUAC EHSST TCODN FSOTS TIIGN LTTNL DUBST TCMIM EHTAO IUUPF TSTTI PUEAY OAEOA EEALA LWGWM GNHYU IAAHD TORYA OLVMH RHTGY IHNNM UAARL MMHID HYFCP GRAET MTCNT HIIIO RCVCL BOTSA OFRNR YEHTG IFHEA WLYSC EEEEY UVEIM SOEUE TAYHN NITEK AERAW DSIAE QTDIE HET'.replace(' ', '')
def get_line_length(l_cipher, line, key):
n = key
q = l_cipher // (2 * n - 2)
r = l_cipher % (2 * n - 2)
assert type(q) is int
if line == 1:
return q + 1 if r >= 1 else q
elif line == key:
return q + 1 if r >= key else q
elif r >= 2 * n - 2 - (line - 2):
return 2 * q + 2
elif r >= line:
return 2 * q + 1
else:
return 2 * q
def sum_row_index(l_cipher, row, key):
sum = 0
for line in range(1, row + 1):
sum += get_line_length(l_cipher, line, key)
return sum
def decrypt(cipher, key):
plain = ''
l = len(cipher)
for i in range(1, l + 1):
n = key
q = i // (2 * n - 2)
r = i % (2 * n - 2)
if r >= key + 1:
row = key - (r - key)
column = 2 * q + 2
elif r == key:
row = key
column = q + 1
elif r >= 2:
row = r
column = 2 * q + 1
elif r == 1:
row = 1
column = q + 1
else:
row = 2
column = 2 * q
print(i, sum_row_index(l, row - 1, key) + column)
print(plain)
plain += cipher[sum_row_index(l, row - 1, key) + column - 1]
return plain
test_vector = 'WECRL TEERD SOEEF EAOCA IVDEN'.replace(' ', '')
print(decrypt(ciphertext, 17)) |
class PractitionerTemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys
| class Practitionertemplate:
def __init__(self):
super().__init__()
def practitioner_default(self, data_list):
keys = []
for data in data_list:
key = f"{data.get('rowid')},{data.get('employee_id')}"
keys.append(key)
return keys |
def update_bit(num, bit, value):
mask = ~(1 << bit)
return (num & mask) | (value << bit)
def get_bit(num, bit):
return (num & (1 << bit)) != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask = (~0 << (j + 1)) + ~(~0 << i)
n = n & mask
m = m << i
return n | m
n = 2**11
m = 0b10011
i = 2
j = 6
bin(insert_bits(n, m, 2, 6))
bin(insert_bits_mask(n, m, 2, 6))
| def update_bit(num, bit, value):
mask = ~(1 << bit)
return num & mask | value << bit
def get_bit(num, bit):
return num & 1 << bit != 0
def insert_bits(n, m, i, j):
for bit in range(i, j + 1):
n = update_bit(n, bit, get_bit(m, bit - i))
return n
def insert_bits_mask(n, m, i, j):
mask = (~0 << j + 1) + ~(~0 << i)
n = n & mask
m = m << i
return n | m
n = 2 ** 11
m = 19
i = 2
j = 6
bin(insert_bits(n, m, 2, 6))
bin(insert_bits_mask(n, m, 2, 6)) |
nodes = [[1,3], [0,2], [1,3], [0,2]]
otherNodes = [[1,2,3], [0,2], [0,1,3], [0,2]]
def isBipartite(nodes):
colors = [0] * len(nodes)
for index, node in enumerate(nodes):
if colors[index] == 0 and not properColor(nodes, colors, 1, index):
return False
return True
def properColor(graph, colors, color, nodeNum):
if colors[nodeNum] != 0:
return colors[nodeNum] == color
colors[nodeNum] = color
for children in graph[nodeNum]:
if not properColor(graph, colors, -color, children):
return False
return True
print(isBipartite(nodes))
print(isBipartite(otherNodes)) | nodes = [[1, 3], [0, 2], [1, 3], [0, 2]]
other_nodes = [[1, 2, 3], [0, 2], [0, 1, 3], [0, 2]]
def is_bipartite(nodes):
colors = [0] * len(nodes)
for (index, node) in enumerate(nodes):
if colors[index] == 0 and (not proper_color(nodes, colors, 1, index)):
return False
return True
def proper_color(graph, colors, color, nodeNum):
if colors[nodeNum] != 0:
return colors[nodeNum] == color
colors[nodeNum] = color
for children in graph[nodeNum]:
if not proper_color(graph, colors, -color, children):
return False
return True
print(is_bipartite(nodes))
print(is_bipartite(otherNodes)) |
manipulated_string = input()
while True:
line = input()
if line == "end":
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipulated_string[-1] + manipulated_string[0:len(manipulated_string)-1]
elif command == 'Left':
for i in range(first_condition):
manipulated_string = manipulated_string[1:len(manipulated_string)] + manipulated_string[0]
elif command == 'Delete':
second_condition = int(command_element[2])
manipulated_string = manipulated_string.replace(manipulated_string[first_condition:second_condition+1], '')
elif command == 'Insert':
second_condition = command_element[2]
if first_condition == 0:
manipulated_string = second_condition + manipulated_string
else:
manipulated_string = manipulated_string[0:first_condition] + second_condition + manipulated_string[(first_condition+1):len(manipulated_string)]
else:
print(f'Unsolved command: {command}')
print(manipulated_string) | manipulated_string = input()
while True:
line = input()
if line == 'end':
break
command_element = line.split(' ')
command = command_element[0]
first_condition = int(command_element[1])
if command == 'Right':
for i in range(first_condition):
manipulated_string = manipulated_string[-1] + manipulated_string[0:len(manipulated_string) - 1]
elif command == 'Left':
for i in range(first_condition):
manipulated_string = manipulated_string[1:len(manipulated_string)] + manipulated_string[0]
elif command == 'Delete':
second_condition = int(command_element[2])
manipulated_string = manipulated_string.replace(manipulated_string[first_condition:second_condition + 1], '')
elif command == 'Insert':
second_condition = command_element[2]
if first_condition == 0:
manipulated_string = second_condition + manipulated_string
else:
manipulated_string = manipulated_string[0:first_condition] + second_condition + manipulated_string[first_condition + 1:len(manipulated_string)]
else:
print(f'Unsolved command: {command}')
print(manipulated_string) |
c = {a: 1, b: 2}
fun(a, b, **c)
# EXPECTED:
[
...,
LOAD_NAME('fun'),
...,
BUILD_TUPLE(2),
...,
CALL_FUNCTION_EX(1),
...,
]
| c = {a: 1, b: 2}
fun(a, b, **c)
[..., load_name('fun'), ..., build_tuple(2), ..., call_function_ex(1), ...] |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head:
return head
d1 = ListNode(-1)
temp1 = d1
d2 = ListNode(-1)
temp2 = d2
temp = head
while temp:
if temp.val < x:
temp1.next = temp
temp = temp.next
temp1 = temp1.next
temp1.next = None
else:
temp2.next = temp
temp = temp.next
temp2 = temp2.next
temp2.next = None
temp1.next = d2.next
return d1.next | class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head:
return head
d1 = list_node(-1)
temp1 = d1
d2 = list_node(-1)
temp2 = d2
temp = head
while temp:
if temp.val < x:
temp1.next = temp
temp = temp.next
temp1 = temp1.next
temp1.next = None
else:
temp2.next = temp
temp = temp.next
temp2 = temp2.next
temp2.next = None
temp1.next = d2.next
return d1.next |
entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida = '{:*<10}'.format(entrada)
print(saida)
entrada = 'Gilberto'
saida = '{:*>10}'.format(entrada)
print(saida)
entrada = ' Gilberto'
saida = entrada.strip()
print(saida)
entrada = 'ser347@dpi.inpe.br'
saida = entrada.partition('@')
print(saida)
entrada = 'CBERS_4_PAN5M_20180308'
saida = entrada.split('_')
print(saida)
entrada = 'Gilberto@@@'
saida = entrada.strip('@')
print(saida)
entrada = '@@Gilberto@@@'
saida = entrada.strip('@')
print = saida
| entrada = 'Gilberto'
saida = '{:+^12}'.format(entrada)
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.capitalize()
print(saida)
entrada = 'sensoriamento remoto'
saida = entrada.title()
print(saida)
entrada = 'GilberTo'
saida = entrada.lower()
print(saida)
entrada = 'Gilberto'
saida = '{:*<10}'.format(entrada)
print(saida)
entrada = 'Gilberto'
saida = '{:*>10}'.format(entrada)
print(saida)
entrada = ' Gilberto'
saida = entrada.strip()
print(saida)
entrada = 'ser347@dpi.inpe.br'
saida = entrada.partition('@')
print(saida)
entrada = 'CBERS_4_PAN5M_20180308'
saida = entrada.split('_')
print(saida)
entrada = 'Gilberto@@@'
saida = entrada.strip('@')
print(saida)
entrada = '@@Gilberto@@@'
saida = entrada.strip('@')
print = saida |
n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=" ")
| n = int(input())
l = {}
for i in range(n):
k = input()
if k in l:
l[k] += 1
else:
l[k] = 1
print(len(l))
for i in l:
print(l[i], end=' ') |
# @Time: 2022/4/12 20:29
# @Author: chang liu
# @Email: chang_liu_tamu@gmail.com
# @File:4-3-Creating-New-Iteration-Patterns-With-Generators.py
def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
# for n in frange(1, 5, 0.6):
# print(n)
def countdown(n):
print(f"starting counting from {n}")
while n > 0:
yield n
n -= 1
print("Done")
g = countdown(3)
print(next(g))
print(next(g))
print(next(g))
#stuck in yield point
# print(next(g))
print("*" * 30)
i = iter([])
print(next(i)) | def frange(start, stop, increment):
x = start
while x < stop:
yield x
x += increment
def countdown(n):
print(f'starting counting from {n}')
while n > 0:
yield n
n -= 1
print('Done')
g = countdown(3)
print(next(g))
print(next(g))
print(next(g))
print('*' * 30)
i = iter([])
print(next(i)) |
"""
Created on 20 Feb 2019
@author: Frank Ypma
"""
class Location:
"""
Simple x,y coordinate wrapper
"""
def __init__(self, x=0, y=0):
self.x = x
self.y = y | """
Created on 20 Feb 2019
@author: Frank Ypma
"""
class Location:
"""
Simple x,y coordinate wrapper
"""
def __init__(self, x=0, y=0):
self.x = x
self.y = y |
def test_get_key(case_data):
"""
Test :meth:`.get_key`.
Parameters
----------
case_data : :class:`.CaseDat`
A test case. Holds the key maker to test and the correct key
it should produce.
Returns
-------
None : :class`NoneType`
"""
_test_get_key(
key_maker=case_data.key_maker,
molecule=case_data.molecule,
key=case_data.key,
)
def _test_get_key(key_maker, molecule, key):
"""
Test :meth:`.get_key`.
Parameters
----------
key_maker : :class:`.MoleculeKeyMaker`
The key maker to test.
molecule : :class:`.Molecule`
The molecule to pass to the `key_maker`.
key : :class:`object`
The correct key of `molecule`.
Returns
-------
None : :class:`NoneType`
"""
assert key_maker.get_key(molecule) == key
| def test_get_key(case_data):
"""
Test :meth:`.get_key`.
Parameters
----------
case_data : :class:`.CaseDat`
A test case. Holds the key maker to test and the correct key
it should produce.
Returns
-------
None : :class`NoneType`
"""
_test_get_key(key_maker=case_data.key_maker, molecule=case_data.molecule, key=case_data.key)
def _test_get_key(key_maker, molecule, key):
"""
Test :meth:`.get_key`.
Parameters
----------
key_maker : :class:`.MoleculeKeyMaker`
The key maker to test.
molecule : :class:`.Molecule`
The molecule to pass to the `key_maker`.
key : :class:`object`
The correct key of `molecule`.
Returns
-------
None : :class:`NoneType`
"""
assert key_maker.get_key(molecule) == key |
# https://leetcode.com/explore/learn/card/fun-with-arrays/527/searching-for-items-in-an-array/3251/
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for i,elmnt in enumerate(arr):
if i == 0:continue
if (inc == True) and (arr[i]>arr[i-1]):
incd = True
continue
else:
inc = False
if (inc == False) and (incd == True) and (arr[i]<arr[i-1]):
decd = True
continue
else:
return False
if incd == True and decd==True:
return True | class Solution:
def valid_mountain_array(self, arr: List[int]) -> bool:
inc = True
incd = False
decd = False
for (i, elmnt) in enumerate(arr):
if i == 0:
continue
if inc == True and arr[i] > arr[i - 1]:
incd = True
continue
else:
inc = False
if inc == False and incd == True and (arr[i] < arr[i - 1]):
decd = True
continue
else:
return False
if incd == True and decd == True:
return True |
def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for idx_i, i in enumerate(vals):
for j in vals[idx_i+1:]:
if i + j == sum_val:
return True
return False
def find_invalid(numbers: list, preamble: int) -> int:
for idx, val in enumerate(numbers[preamble:]):
if not has_pair(val, numbers[idx:preamble+idx]):
return val
def part1(vals: list, preamble: int) -> int:
return find_invalid(vals, preamble)
def part2(vals: list, preamble: int) -> int:
invalid_number = find_invalid(vals, preamble)
count = len(vals)
for x in range(count):
set_sum = vals[x]
for y in range(x+1, count):
set_sum += vals[y]
if set_sum == invalid_number:
return min(vals[x:y]) + max(vals[x:y])
if set_sum > invalid_number:
break
def main():
file_input = get_input()
print(f"Part 1: {part1(file_input, 25)}")
print(f"Part 2: {part2(file_input, 25)}")
def test():
test_input = [
35,
20,
15,
25,
47,
40,
62,
55,
65,
95,
102,
117,
150,
182,
127,
219,
299,
277,
309,
576,
]
assert part1(test_input, 5) == 127
assert part2(test_input, 5) == 62
if __name__ == "__main__":
test()
main()
| def get_input() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt") as f:
return [int(l[:-1]) for l in f.readlines()]
def has_pair(sum_val: int, vals: list) -> bool:
for (idx_i, i) in enumerate(vals):
for j in vals[idx_i + 1:]:
if i + j == sum_val:
return True
return False
def find_invalid(numbers: list, preamble: int) -> int:
for (idx, val) in enumerate(numbers[preamble:]):
if not has_pair(val, numbers[idx:preamble + idx]):
return val
def part1(vals: list, preamble: int) -> int:
return find_invalid(vals, preamble)
def part2(vals: list, preamble: int) -> int:
invalid_number = find_invalid(vals, preamble)
count = len(vals)
for x in range(count):
set_sum = vals[x]
for y in range(x + 1, count):
set_sum += vals[y]
if set_sum == invalid_number:
return min(vals[x:y]) + max(vals[x:y])
if set_sum > invalid_number:
break
def main():
file_input = get_input()
print(f'Part 1: {part1(file_input, 25)}')
print(f'Part 2: {part2(file_input, 25)}')
def test():
test_input = [35, 20, 15, 25, 47, 40, 62, 55, 65, 95, 102, 117, 150, 182, 127, 219, 299, 277, 309, 576]
assert part1(test_input, 5) == 127
assert part2(test_input, 5) == 62
if __name__ == '__main__':
test()
main() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################
# Institut Villebon, UE 3.1
# Projet : mon_via_navigo
# Auteur : C.Lavrat, B. Marie Joseph, S. Sonko
# Date de creation : 27/12/15
# Date de derniere modification : 27/12/15
##############################################
class Station:
"""
The Station module
==================
This class creates stations and contains all the informations of the stations
Parameters
----------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>
Function of information
-----------------------
_eq_(self, station):
| tells if two stations are the same or not
_lt_(self, station):
| gives the first station in the alphabeter range
_hash_(self):
| returns hash(self.name + self.in_line)
_str_(self):
| Prints a textual representation of the current station
.. Date:: 27/12/2015
.. author:: Cyril
"""
#------------------------------------------------------------------------------#
#initialisation of the class : #
#------------------------------------------------------------------------------#
def __init__(self, name, position, in_line=""):
"""
The __init__ fonction
=====================
this function is the constructor of the station's module
Parameters
----------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>
Module attribute
--------------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
.. Date:: 27/12/2015
.. author:: Cyril
"""
#INPUT TESTS
#----------------------------------------------------------------------#
#name of the station
#test of the type of name
if type(name) == type(str()) :
self.name = name
else :
raise TypeError(str(name)+" is not a str")
#----------------------------------------------------------------------#
#test of the type of position
#position of the station
if type(position) == type(list()) :
self.position = position
else :
raise TypeError(str(position)+" is not a list")
#----------------------------------------------------------------------#
#test of the type of in_line
#line of the station
if type(in_line) == type(str()):
self.in_line = in_line
else :
raise TypeError(str(in_line)+" is not a str")
#======================================================================#
################################################################################
# Fonction of information #
################################################################################
#------------------------------------------------------------------------------#
# __eq__(self, station) : Say if two station are the same or not #
#------------------------------------------------------------------------------#
def _eq_(self, station):
"""
The _eq_ function
===================
Tells if two stations are the same or not, using the hash value.
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay_Ville._eq_("Orsay")
True
.. Date:: 27/12/2015
.. Author:: Cyril
"""
#if the hash value of the station is the same
if self._hash_() == hash(station.name + station.in_line):
#the station is the same
return True
else:
#the station is not the same
return False
#======================================================================#
#------------------------------------------------------------------------------#
# __lt__(self, station) : Return the first station in the alphabetical order. #
#------------------------------------------------------------------------------#
def _lt_(self, station):
"""
The _lt_ function
===================
Returns the first station in the alphabetical order.
:Example:
>>>Palaiseau = Station("Palaiseau",[1.4,15.7],"RER B")
>>>Palaiseau_villebon = Station("Palaiseau Villebon",[1.4,18.14],"RER B")
>>>Orsay_Ville._lt_()
Palaiseau
.. Date:: 27/12/2015
.. author:: Cyril
"""
#----------------------------------------------------------------------#
#if the station are not the same
if not self._eq_(station):
if not str(station.name) > str(self.name):
if not str(station.in_line) > str(self.in_line):
return station.name
else:
#print(self.name)
return self.name
else:
return self.name
#----------------------------------------------------------------------#
#if the station are the same
else:
raise ValueError("/!\ : this station are the same")
#======================================================================#
#------------------------------------------------------------------------------#
# __hash__(self) : Return a hash value for the station and line. #
#------------------------------------------------------------------------------#
def _hash_(self):
"""
The _hash_ function
=====================
Returns a hash value for the station and line.
Two stations with the same informations have the same hash value.
The reverse is not necessarily true, but it can be true.
/!\ warning : the hash value is different between two runs
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay_Ville._hash_()
-4599906160503219187
.. Date:: 27/12/2015
.. author:: Cyril
"""
return hash(self.name + self.in_line)
#======================================================================#
#------------------------------------------------------------------------------#
# __str__(self) : return a textuel representation of the current station #
#------------------------------------------------------------------------------#
def _str_(self):
"""
The _str_ function
====================
returns a textual representation of the current station
:Example:
>>>orsay_ville = Station("Orsay Ville",[1.618,3.141],"RER B")
>>>print(orsay_ville._str_())
************************
* Station Informations *
************************
Name = Orsay Ville
Position = [1.618,3.141]
Line = RER B
************************
.. Date:: 27/12/2015
.. author:: Cyril
"""
#creation of a msg with all the information
msg = "************************\n"
msg += "* Station Informations *\n"
msg += "************************\n"
msg += "Name = " + str(self.name) + "\n"
msg += "Position = " + str(self.position) + "\n"
msg += "Line = " + str(self.in_line) + "\n"
msg += "************************"
return msg
#======================================================================#
if __name__ == '__main__':
"""
The __main__ function
=====================
.. Date:: 27/12/2015
.. author:: Cyril
"""
print("If you whant to test your programm run the tests in the joigned file \n")
| class Station:
"""
The Station module
==================
This class creates stations and contains all the informations of the stations
Parameters
----------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>
Function of information
-----------------------
_eq_(self, station):
| tells if two stations are the same or not
_lt_(self, station):
| gives the first station in the alphabeter range
_hash_(self):
| returns hash(self.name + self.in_line)
_str_(self):
| Prints a textual representation of the current station
.. Date:: 27/12/2015
.. author:: Cyril
"""
def __init__(self, name, position, in_line=''):
"""
The __init__ fonction
=====================
this function is the constructor of the station's module
Parameters
----------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>
Module attribute
--------------
:param name: name of the station
:param position: position of the station
:param in_line: line of the station
:type name: str
:type position: list format [x,y]
:type in_line: str
.. Date:: 27/12/2015
.. author:: Cyril
"""
if type(name) == type(str()):
self.name = name
else:
raise type_error(str(name) + ' is not a str')
if type(position) == type(list()):
self.position = position
else:
raise type_error(str(position) + ' is not a list')
if type(in_line) == type(str()):
self.in_line = in_line
else:
raise type_error(str(in_line) + ' is not a str')
def _eq_(self, station):
"""
The _eq_ function
===================
Tells if two stations are the same or not, using the hash value.
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay_Ville._eq_("Orsay")
True
.. Date:: 27/12/2015
.. Author:: Cyril
"""
if self._hash_() == hash(station.name + station.in_line):
return True
else:
return False
def _lt_(self, station):
"""
The _lt_ function
===================
Returns the first station in the alphabetical order.
:Example:
>>>Palaiseau = Station("Palaiseau",[1.4,15.7],"RER B")
>>>Palaiseau_villebon = Station("Palaiseau Villebon",[1.4,18.14],"RER B")
>>>Orsay_Ville._lt_()
Palaiseau
.. Date:: 27/12/2015
.. author:: Cyril
"""
if not self._eq_(station):
if not str(station.name) > str(self.name):
if not str(station.in_line) > str(self.in_line):
return station.name
else:
return self.name
else:
return self.name
else:
raise value_error('/!\\ : this station are the same')
def _hash_(self):
"""
The _hash_ function
=====================
Returns a hash value for the station and line.
Two stations with the same informations have the same hash value.
The reverse is not necessarily true, but it can be true.
/!\\ warning : the hash value is different between two runs
:Example:
>>>Orsay_Ville = Station("Orsay Ville",[1.5,3.14],"RER B")
>>>Orsay_Ville._hash_()
-4599906160503219187
.. Date:: 27/12/2015
.. author:: Cyril
"""
return hash(self.name + self.in_line)
def _str_(self):
"""
The _str_ function
====================
returns a textual representation of the current station
:Example:
>>>orsay_ville = Station("Orsay Ville",[1.618,3.141],"RER B")
>>>print(orsay_ville._str_())
************************
* Station Informations *
************************
Name = Orsay Ville
Position = [1.618,3.141]
Line = RER B
************************
.. Date:: 27/12/2015
.. author:: Cyril
"""
msg = '************************\n'
msg += '* Station Informations *\n'
msg += '************************\n'
msg += 'Name = ' + str(self.name) + '\n'
msg += 'Position = ' + str(self.position) + '\n'
msg += 'Line = ' + str(self.in_line) + '\n'
msg += '************************'
return msg
if __name__ == '__main__':
'\n The __main__ function\n =====================\n\n .. Date:: 27/12/2015\n .. author:: Cyril\n '
print('If you whant to test your programm run the tests in the joigned file \n') |
"""
Profile ../profile-datasets-py/div52_zen50deg/034.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div52_zen50deg/034.py"
self["Q"] = numpy.array([ 1.607768, 4.15376 , 5.83064 , 7.181963, 6.558055,
7.26391 , 9.444143, 8.659606, 7.119357, 7.498499,
7.80505 , 7.015238, 5.997863, 6.461718, 6.713751,
6.317727, 5.925691, 5.606566, 5.591775, 5.563366,
5.50166 , 5.412027, 5.309597, 5.19215 , 5.07004 ,
4.94703 , 4.840709, 4.738037, 4.61194 , 4.488335,
4.347817, 4.211848, 4.110768, 4.013981, 3.964719,
3.936519, 3.917997, 3.918496, 3.918994, 3.929766,
3.94131 , 3.95369 , 3.967018, 3.979784, 3.981906,
3.983964, 3.981617, 3.976198, 3.97578 , 4.001344,
4.026361, 4.359103, 4.782813, 5.49391 , 6.649441,
7.793169, 9.087655, 10.35708 , 11.34142 , 12.2309 ,
13.14354 , 14.07536 , 15.22698 , 16.88403 , 18.59387 ,
20.82526 , 23.01806 , 26.52261 , 29.98615 , 33.67396 ,
37.337 , 42.52849 , 47.95533 , 57.36908 , 67.46491 ,
77.61677 , 87.64669 , 99.15107 , 110.2237 , 120.0812 ,
129.429 , 138.2167 , 158.5282 , 182.8389 , 211.6201 ,
246.1618 , 291.4563 , 350.1063 , 394.3911 , 459.7997 ,
520.9591 , 545.405 , 570.1204 , 578.4676 , 516.3112 ,
211.9946 , 206.087 , 200.4205 , 194.9806 , 189.7593 ,
184.7422 ])
self["P"] = numpy.array([ 5.00000000e-03, 1.61000000e-02, 3.84000000e-02,
7.69000000e-02, 1.37000000e-01, 2.24400000e-01,
3.45400000e-01, 5.06400000e-01, 7.14000000e-01,
9.75300000e-01, 1.29720000e+00, 1.68720000e+00,
2.15260000e+00, 2.70090000e+00, 3.33980000e+00,
4.07700000e+00, 4.92040000e+00, 5.87760000e+00,
6.95670000e+00, 8.16550000e+00, 9.51190000e+00,
1.10038000e+01, 1.26492000e+01, 1.44559000e+01,
1.64318000e+01, 1.85847000e+01, 2.09224000e+01,
2.34526000e+01, 2.61829000e+01, 2.91210000e+01,
3.22744000e+01, 3.56504000e+01, 3.92566000e+01,
4.31001000e+01, 4.71882000e+01, 5.15278000e+01,
5.61259000e+01, 6.09895000e+01, 6.61252000e+01,
7.15398000e+01, 7.72395000e+01, 8.32310000e+01,
8.95203000e+01, 9.61138000e+01, 1.03017000e+02,
1.10237000e+02, 1.17777000e+02, 1.25646000e+02,
1.33846000e+02, 1.42385000e+02, 1.51266000e+02,
1.60496000e+02, 1.70078000e+02, 1.80018000e+02,
1.90320000e+02, 2.00989000e+02, 2.12028000e+02,
2.23441000e+02, 2.35234000e+02, 2.47408000e+02,
2.59969000e+02, 2.72919000e+02, 2.86262000e+02,
3.00000000e+02, 3.14137000e+02, 3.28675000e+02,
3.43618000e+02, 3.58966000e+02, 3.74724000e+02,
3.90892000e+02, 4.07474000e+02, 4.24470000e+02,
4.41882000e+02, 4.59712000e+02, 4.77961000e+02,
4.96630000e+02, 5.15720000e+02, 5.35232000e+02,
5.55167000e+02, 5.75525000e+02, 5.96306000e+02,
6.17511000e+02, 6.39140000e+02, 6.61192000e+02,
6.83667000e+02, 7.06565000e+02, 7.29886000e+02,
7.53627000e+02, 7.77789000e+02, 8.02371000e+02,
8.27371000e+02, 8.52788000e+02, 8.78620000e+02,
9.04866000e+02, 9.31523000e+02, 9.58591000e+02,
9.86066000e+02, 1.01395000e+03, 1.04223000e+03,
1.07092000e+03, 1.10000000e+03])
self["CO2"] = numpy.array([ 322.2185, 322.2177, 322.2171, 322.2167, 322.2169, 322.2167,
322.216 , 322.2162, 322.2167, 322.2166, 322.2165, 322.2167,
322.2171, 322.2169, 322.2168, 322.217 , 322.2171, 322.2172,
322.2172, 322.2172, 322.2172, 322.2173, 322.2173, 322.2173,
322.2174, 322.2174, 322.2174, 322.2175, 322.2175, 322.2176,
322.2176, 322.4306, 322.6597, 322.9027, 323.1607, 323.4357,
323.7267, 324.0347, 324.3597, 324.7017, 325.0627, 325.4417,
325.8397, 326.2567, 326.6937, 327.1507, 327.6277, 328.1257,
328.6447, 329.1847, 329.7467, 330.3306, 330.9364, 331.5652,
332.2168, 332.2164, 332.216 , 332.2156, 332.2152, 332.2149,
332.2146, 332.2143, 332.2139, 332.2134, 332.2128, 332.2121,
332.2114, 332.2102, 332.209 , 332.2078, 332.2066, 332.2049,
332.2031, 332.1999, 332.1966, 332.1932, 332.1899, 332.1861,
332.1824, 332.1791, 332.176 , 332.1731, 332.1663, 332.1583,
332.1487, 332.1372, 332.1222, 332.1027, 332.088 , 332.0662,
332.0459, 332.0378, 332.0296, 332.0268, 332.0475, 332.1486,
332.1505, 332.1524, 332.1542, 332.156 , 332.1576])
self["T"] = numpy.array([ 192.746, 186.766, 205.5 , 228.794, 244.789, 247.272,
249.779, 252.472, 253.77 , 252.084, 246.384, 236.666,
225.418, 216.538, 209.571, 202.537, 196.983, 193.159,
191.01 , 190.352, 191.525, 193.726, 196.206, 198.563,
199.985, 200.848, 200.204, 199.38 , 197.937, 196.596,
195.898, 195.224, 194.96 , 194.72 , 195.053, 195.626,
196.417, 197.677, 198.902, 200.162, 201.395, 202.587,
203.737, 204.862, 206.087, 207.283, 208.229, 208.996,
209.692, 210.093, 210.485, 210.601, 210.629, 210.612,
210.525, 210.436, 210.279, 210.125, 209.894, 209.645,
209.628, 209.817, 210.239, 211.178, 212.165, 213.568,
214.947, 216.387, 217.804, 219.193, 220.559, 221.911,
223.243, 224.56 , 225.858, 227.197, 228.524, 229.97 ,
231.429, 233.013, 234.662, 236.389, 238.08 , 239.729,
241.3 , 242.737, 244.119, 245.455, 246.488, 247.294,
247.983, 249.017, 249.685, 249.92 , 249.496, 238.373,
238.373, 238.373, 238.373, 238.373, 238.373])
self["O3"] = numpy.array([ 1.17268 , 1.17593 , 1.182457 , 1.193728 , 1.21701 ,
1.242897 , 1.266096 , 1.287477 , 1.349363 , 1.574502 ,
1.972782 , 2.510987 , 3.092075 , 3.618445 , 4.030167 ,
4.557568 , 5.133355 , 5.533019 , 5.719022 , 5.730295 ,
5.611414 , 5.333457 , 4.99594 , 4.627713 , 4.326831 ,
4.069157 , 3.91057 , 3.765929 , 3.595285 , 3.427744 ,
3.234277 , 3.047081 , 2.863011 , 2.684474 , 2.51928 ,
2.362425 , 2.227439 , 2.132595 , 2.040322 , 1.946594 ,
1.854912 , 1.731223 , 1.571967 , 1.415704 , 1.224755 ,
1.038302 , 0.8721727 , 0.7211843 , 0.5823831 , 0.4935311 ,
0.4065938 , 0.334958 , 0.2690924 , 0.2104054 , 0.1619372 ,
0.1159878 , 0.09491241, 0.07424563, 0.06642134, 0.06238607,
0.06036811, 0.06014346, 0.06024959, 0.06107934, 0.0620737 ,
0.06424653, 0.06638255, 0.06890043, 0.0713821 , 0.07347392,
0.07548728, 0.07692545, 0.07823204, 0.07906522, 0.07979273,
0.08028852, 0.08074569, 0.08076829, 0.08075714, 0.08061033,
0.08056312, 0.08062999, 0.08069894, 0.08072594, 0.08061984,
0.08051027, 0.08041131, 0.08032214, 0.08014305, 0.07974273,
0.07928489, 0.0788656 , 0.07837151, 0.07775992, 0.07733472,
0.07882192, 0.07882239, 0.07882283, 0.07882326, 0.07882367,
0.07882407])
self["CTP"] = 500.0
self["CFRACTION"] = 0.0
self["IDG"] = 0
self["ISH"] = 0
self["ELEVATION"] = 0.0
self["S2M"]["T"] = 238.373
self["S2M"]["Q"] = 214.057055538
self["S2M"]["O"] = 0.0788217567578
self["S2M"]["P"] = 949.354
self["S2M"]["U"] = 1.17723
self["S2M"]["V"] = 0.821594
self["S2M"]["WFETC"] = 100000.0
self["SKIN"]["SURFTYPE"] = 0
self["SKIN"]["WATERTYPE"] = 1
self["SKIN"]["T"] = 233.614
self["SKIN"]["SALINITY"] = 35.0
self["SKIN"]["FOAM_FRACTION"] = 0.0
self["SKIN"]["FASTEM"] = numpy.array([ 3. , 5. , 15. , 0.1, 0.3])
self["ZENANGLE"] = 50.0
self["AZANGLE"] = 0.0
self["SUNZENANGLE"] = 0.0
self["SUNAZANGLE"] = 0.0
self["LATITUDE"] = 82.4134
self["GAS_UNITS"] = 2
self["BE"] = 0.0
self["COSBK"] = 0.0
self["DATE"] = numpy.array([1992, 12, 15])
self["TIME"] = numpy.array([18, 0, 0])
| """
Profile ../profile-datasets-py/div52_zen50deg/034.py
file automaticaly created by prof_gen.py script
"""
self['ID'] = '../profile-datasets-py/div52_zen50deg/034.py'
self['Q'] = numpy.array([1.607768, 4.15376, 5.83064, 7.181963, 6.558055, 7.26391, 9.444143, 8.659606, 7.119357, 7.498499, 7.80505, 7.015238, 5.997863, 6.461718, 6.713751, 6.317727, 5.925691, 5.606566, 5.591775, 5.563366, 5.50166, 5.412027, 5.309597, 5.19215, 5.07004, 4.94703, 4.840709, 4.738037, 4.61194, 4.488335, 4.347817, 4.211848, 4.110768, 4.013981, 3.964719, 3.936519, 3.917997, 3.918496, 3.918994, 3.929766, 3.94131, 3.95369, 3.967018, 3.979784, 3.981906, 3.983964, 3.981617, 3.976198, 3.97578, 4.001344, 4.026361, 4.359103, 4.782813, 5.49391, 6.649441, 7.793169, 9.087655, 10.35708, 11.34142, 12.2309, 13.14354, 14.07536, 15.22698, 16.88403, 18.59387, 20.82526, 23.01806, 26.52261, 29.98615, 33.67396, 37.337, 42.52849, 47.95533, 57.36908, 67.46491, 77.61677, 87.64669, 99.15107, 110.2237, 120.0812, 129.429, 138.2167, 158.5282, 182.8389, 211.6201, 246.1618, 291.4563, 350.1063, 394.3911, 459.7997, 520.9591, 545.405, 570.1204, 578.4676, 516.3112, 211.9946, 206.087, 200.4205, 194.9806, 189.7593, 184.7422])
self['P'] = numpy.array([0.005, 0.0161, 0.0384, 0.0769, 0.137, 0.2244, 0.3454, 0.5064, 0.714, 0.9753, 1.2972, 1.6872, 2.1526, 2.7009, 3.3398, 4.077, 4.9204, 5.8776, 6.9567, 8.1655, 9.5119, 11.0038, 12.6492, 14.4559, 16.4318, 18.5847, 20.9224, 23.4526, 26.1829, 29.121, 32.2744, 35.6504, 39.2566, 43.1001, 47.1882, 51.5278, 56.1259, 60.9895, 66.1252, 71.5398, 77.2395, 83.231, 89.5203, 96.1138, 103.017, 110.237, 117.777, 125.646, 133.846, 142.385, 151.266, 160.496, 170.078, 180.018, 190.32, 200.989, 212.028, 223.441, 235.234, 247.408, 259.969, 272.919, 286.262, 300.0, 314.137, 328.675, 343.618, 358.966, 374.724, 390.892, 407.474, 424.47, 441.882, 459.712, 477.961, 496.63, 515.72, 535.232, 555.167, 575.525, 596.306, 617.511, 639.14, 661.192, 683.667, 706.565, 729.886, 753.627, 777.789, 802.371, 827.371, 852.788, 878.62, 904.866, 931.523, 958.591, 986.066, 1013.95, 1042.23, 1070.92, 1100.0])
self['CO2'] = numpy.array([322.2185, 322.2177, 322.2171, 322.2167, 322.2169, 322.2167, 322.216, 322.2162, 322.2167, 322.2166, 322.2165, 322.2167, 322.2171, 322.2169, 322.2168, 322.217, 322.2171, 322.2172, 322.2172, 322.2172, 322.2172, 322.2173, 322.2173, 322.2173, 322.2174, 322.2174, 322.2174, 322.2175, 322.2175, 322.2176, 322.2176, 322.4306, 322.6597, 322.9027, 323.1607, 323.4357, 323.7267, 324.0347, 324.3597, 324.7017, 325.0627, 325.4417, 325.8397, 326.2567, 326.6937, 327.1507, 327.6277, 328.1257, 328.6447, 329.1847, 329.7467, 330.3306, 330.9364, 331.5652, 332.2168, 332.2164, 332.216, 332.2156, 332.2152, 332.2149, 332.2146, 332.2143, 332.2139, 332.2134, 332.2128, 332.2121, 332.2114, 332.2102, 332.209, 332.2078, 332.2066, 332.2049, 332.2031, 332.1999, 332.1966, 332.1932, 332.1899, 332.1861, 332.1824, 332.1791, 332.176, 332.1731, 332.1663, 332.1583, 332.1487, 332.1372, 332.1222, 332.1027, 332.088, 332.0662, 332.0459, 332.0378, 332.0296, 332.0268, 332.0475, 332.1486, 332.1505, 332.1524, 332.1542, 332.156, 332.1576])
self['T'] = numpy.array([192.746, 186.766, 205.5, 228.794, 244.789, 247.272, 249.779, 252.472, 253.77, 252.084, 246.384, 236.666, 225.418, 216.538, 209.571, 202.537, 196.983, 193.159, 191.01, 190.352, 191.525, 193.726, 196.206, 198.563, 199.985, 200.848, 200.204, 199.38, 197.937, 196.596, 195.898, 195.224, 194.96, 194.72, 195.053, 195.626, 196.417, 197.677, 198.902, 200.162, 201.395, 202.587, 203.737, 204.862, 206.087, 207.283, 208.229, 208.996, 209.692, 210.093, 210.485, 210.601, 210.629, 210.612, 210.525, 210.436, 210.279, 210.125, 209.894, 209.645, 209.628, 209.817, 210.239, 211.178, 212.165, 213.568, 214.947, 216.387, 217.804, 219.193, 220.559, 221.911, 223.243, 224.56, 225.858, 227.197, 228.524, 229.97, 231.429, 233.013, 234.662, 236.389, 238.08, 239.729, 241.3, 242.737, 244.119, 245.455, 246.488, 247.294, 247.983, 249.017, 249.685, 249.92, 249.496, 238.373, 238.373, 238.373, 238.373, 238.373, 238.373])
self['O3'] = numpy.array([1.17268, 1.17593, 1.182457, 1.193728, 1.21701, 1.242897, 1.266096, 1.287477, 1.349363, 1.574502, 1.972782, 2.510987, 3.092075, 3.618445, 4.030167, 4.557568, 5.133355, 5.533019, 5.719022, 5.730295, 5.611414, 5.333457, 4.99594, 4.627713, 4.326831, 4.069157, 3.91057, 3.765929, 3.595285, 3.427744, 3.234277, 3.047081, 2.863011, 2.684474, 2.51928, 2.362425, 2.227439, 2.132595, 2.040322, 1.946594, 1.854912, 1.731223, 1.571967, 1.415704, 1.224755, 1.038302, 0.8721727, 0.7211843, 0.5823831, 0.4935311, 0.4065938, 0.334958, 0.2690924, 0.2104054, 0.1619372, 0.1159878, 0.09491241, 0.07424563, 0.06642134, 0.06238607, 0.06036811, 0.06014346, 0.06024959, 0.06107934, 0.0620737, 0.06424653, 0.06638255, 0.06890043, 0.0713821, 0.07347392, 0.07548728, 0.07692545, 0.07823204, 0.07906522, 0.07979273, 0.08028852, 0.08074569, 0.08076829, 0.08075714, 0.08061033, 0.08056312, 0.08062999, 0.08069894, 0.08072594, 0.08061984, 0.08051027, 0.08041131, 0.08032214, 0.08014305, 0.07974273, 0.07928489, 0.0788656, 0.07837151, 0.07775992, 0.07733472, 0.07882192, 0.07882239, 0.07882283, 0.07882326, 0.07882367, 0.07882407])
self['CTP'] = 500.0
self['CFRACTION'] = 0.0
self['IDG'] = 0
self['ISH'] = 0
self['ELEVATION'] = 0.0
self['S2M']['T'] = 238.373
self['S2M']['Q'] = 214.057055538
self['S2M']['O'] = 0.0788217567578
self['S2M']['P'] = 949.354
self['S2M']['U'] = 1.17723
self['S2M']['V'] = 0.821594
self['S2M']['WFETC'] = 100000.0
self['SKIN']['SURFTYPE'] = 0
self['SKIN']['WATERTYPE'] = 1
self['SKIN']['T'] = 233.614
self['SKIN']['SALINITY'] = 35.0
self['SKIN']['FOAM_FRACTION'] = 0.0
self['SKIN']['FASTEM'] = numpy.array([3.0, 5.0, 15.0, 0.1, 0.3])
self['ZENANGLE'] = 50.0
self['AZANGLE'] = 0.0
self['SUNZENANGLE'] = 0.0
self['SUNAZANGLE'] = 0.0
self['LATITUDE'] = 82.4134
self['GAS_UNITS'] = 2
self['BE'] = 0.0
self['COSBK'] = 0.0
self['DATE'] = numpy.array([1992, 12, 15])
self['TIME'] = numpy.array([18, 0, 0]) |
"""The markdown module."""
# pylint: disable=invalid-name
def bold(text):
"""Bold.
Args:
text (str): text to make bold.
Returns:
str: bold text.
"""
return '**' + text + '**'
def code(text, inline=False, lang=''):
"""Code.
Args:
text (str): text to make code.
inline (bool, optional): format as inline code, ignores the lang argument. Defaults to False.
lang (str, optional): set the code block language. Defaults to ''.
Returns:
str: code text.
"""
if inline:
return '`{}`'.format(text)
return '```{}\r\n'.format(lang) + text + '\r\n```'
def cr():
"""Carriage Return (Line Break).
Returns:
str: Carriage Return.
"""
return '\r\n'
def h1(text):
"""Heading 1.
Args:
text (str): text to make heading 1.
Returns:
str: heading 1 text.
"""
return '# ' + text + '\r\n'
def h2(text):
"""Heading 2.
Args:
text (str): text to make heading 2.
Returns:
str: heading 2 text.
"""
return '## ' + text + '\r\n'
def h3(text):
"""Heading 3.
Args:
text (str): text to make heading 3.
Returns:
str: heading 3 text.
"""
return '### ' + text + '\r\n'
def h4(text):
"""Heading 4.
Args:
text (str): text to make heading 4.
Returns:
str: heading 4 text.
"""
return '#### ' + text + '\r\n'
def newline():
"""New Line.
Returns:
str: New Line.
"""
return '\r\n'
def paragraph(text):
"""Paragraph.
Args:
text (str): text to make into a paragraph.
Returns:
str: paragraph text.
"""
return text + '\r\n'
def sanitize(text):
"""Sanitize text.
This attempts to remove formatting that could be mistaken for markdown.
Args:
text (str): text to sanitise.
Returns:
str: sanitised text.
"""
if '```' in text:
text = text.replace('```', '(3xbacktick)')
if '|' in text:
text = text.replace('|', '(pipe)')
if '_' in text:
text = text.replace('_', r'\_')
return text
def table_header(columns=None):
"""Table header.
Creates markdown table headings.
Args:
text (tuple): column headings.
Returns:
str: markdown table header.
"""
line_1 = '|'
line_2 = '|'
for c in columns:
line_1 += ' ' + c + ' |'
line_2 += ' --- |'
line_1 += '\r\n'
line_2 += '\r\n'
return line_1 + line_2
def table_row(columns=None):
"""Table row.
Creates markdown table row.
Args:
text (tuple): column data.
Returns:
str: markdown table row.
"""
row = '|'
for c in columns:
row += ' ' + c + ' |'
row += '\r\n'
return row
def url(text, url_):
"""Url
Args:
text (str): text for url.
url (str): url for text.
Returns:
str: url.
"""
return '[' + text + '](' + url_ + ')'
| """The markdown module."""
def bold(text):
"""Bold.
Args:
text (str): text to make bold.
Returns:
str: bold text.
"""
return '**' + text + '**'
def code(text, inline=False, lang=''):
"""Code.
Args:
text (str): text to make code.
inline (bool, optional): format as inline code, ignores the lang argument. Defaults to False.
lang (str, optional): set the code block language. Defaults to ''.
Returns:
str: code text.
"""
if inline:
return '`{}`'.format(text)
return '```{}\r\n'.format(lang) + text + '\r\n```'
def cr():
"""Carriage Return (Line Break).
Returns:
str: Carriage Return.
"""
return '\r\n'
def h1(text):
"""Heading 1.
Args:
text (str): text to make heading 1.
Returns:
str: heading 1 text.
"""
return '# ' + text + '\r\n'
def h2(text):
"""Heading 2.
Args:
text (str): text to make heading 2.
Returns:
str: heading 2 text.
"""
return '## ' + text + '\r\n'
def h3(text):
"""Heading 3.
Args:
text (str): text to make heading 3.
Returns:
str: heading 3 text.
"""
return '### ' + text + '\r\n'
def h4(text):
"""Heading 4.
Args:
text (str): text to make heading 4.
Returns:
str: heading 4 text.
"""
return '#### ' + text + '\r\n'
def newline():
"""New Line.
Returns:
str: New Line.
"""
return '\r\n'
def paragraph(text):
"""Paragraph.
Args:
text (str): text to make into a paragraph.
Returns:
str: paragraph text.
"""
return text + '\r\n'
def sanitize(text):
"""Sanitize text.
This attempts to remove formatting that could be mistaken for markdown.
Args:
text (str): text to sanitise.
Returns:
str: sanitised text.
"""
if '```' in text:
text = text.replace('```', '(3xbacktick)')
if '|' in text:
text = text.replace('|', '(pipe)')
if '_' in text:
text = text.replace('_', '\\_')
return text
def table_header(columns=None):
"""Table header.
Creates markdown table headings.
Args:
text (tuple): column headings.
Returns:
str: markdown table header.
"""
line_1 = '|'
line_2 = '|'
for c in columns:
line_1 += ' ' + c + ' |'
line_2 += ' --- |'
line_1 += '\r\n'
line_2 += '\r\n'
return line_1 + line_2
def table_row(columns=None):
"""Table row.
Creates markdown table row.
Args:
text (tuple): column data.
Returns:
str: markdown table row.
"""
row = '|'
for c in columns:
row += ' ' + c + ' |'
row += '\r\n'
return row
def url(text, url_):
"""Url
Args:
text (str): text for url.
url (str): url for text.
Returns:
str: url.
"""
return '[' + text + '](' + url_ + ')' |
n = int(input())
arr = [int(x) for x in input().split()]
counter = [0]*1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i],i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for freq,i in counts:
q.extend([i]*freq)
j = 0
out = [None]*n
for i in range(0,n,2):
out[i] = q[j]
j += 1
for i in range(1,n,2):
out[i] = q[j]
j += 1
# print(out)
msg = "YES"
for i in range(1,n):
if out[i] == out[i-1]:
msg = "NO"
break
print(msg)
| n = int(input())
arr = [int(x) for x in input().split()]
counter = [0] * 1001
for i in range(n):
counter[arr[i]] += 1
counts = []
for i in range(1001):
if counter[i] > 0:
counts.append((counter[i], i))
counts.sort(key=lambda x: (-x[0], x[1]))
q = []
for (freq, i) in counts:
q.extend([i] * freq)
j = 0
out = [None] * n
for i in range(0, n, 2):
out[i] = q[j]
j += 1
for i in range(1, n, 2):
out[i] = q[j]
j += 1
msg = 'YES'
for i in range(1, n):
if out[i] == out[i - 1]:
msg = 'NO'
break
print(msg) |
def testIter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = Variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_outputs.cuda()
for ei in range(input_length):
encoder_output, encoder_hidden = encoder(input_variable[ei],
encoder_hidden)
encoder_outputs[ei] = encoder_outputs[ei] + encoder_output[0][0]
decoder_input = Variable(torch.LongTensor([[BOS_TOKEN_ix]]))
if use_cuda:
decoder_input = decoder_input.cuda()
decoder_hidden = encoder_hidden
decoded_words = []
if decoder.attn_status:
decoder_attentions = torch.zeros(max_length, max_length)
for di in range(max_length):
if decoder.attn_status:
decoder_output, decoder_hidden, decoder_attention = decoder(
decoder_input, decoder_hidden, encoder_outputs)
decoder_attentions[di] = decoder_attention.data
else:
decoder_output, decoder_hidden = decoder(decoder_input, decoder_hidden)
topv, topi = decoder_output.data.topk(1)
ni = topi[0][0]
if ni == EOS_TOKEN_ix:
decoded_words.append(EOS_TOKEN)
break
else:
decoded_words.append(ix2word[str(ni)])
decoder_input = Variable(torch.LongTensor([[ni]]))
if use_cuda:
decoder_input = decoder_input.cuda()
if decoder.attn_status:
return decoded_words, decoder_attentions[:di + 1]
else:
return decoded_words
def testModel(encoder, decoder, dataset, word2ix, ix2word,
n=10, max_length=20):
for i in range(n):
pair = random.choice(dataset)
input_str = ''.join(e for e in \
preprocessing.convertIndexSentenceToWord(pair['input']))
target_str = ''.join(e for e in \
preprocessing.convertIndexSentenceToWord(pair['target']))
print('>', input_str)
print('=', target_str)
temp = Variable(torch.LongTensor(pair['input']).view(-1, 1))
if USE_CUDA:
temp = temp.cuda()
output_words, attentions = evaluate(encoder, decoder, temp,
word2ix, ix2word,
max_length=max_length)
output_sentence = ' '.join(output_words)
print('<', output_sentence)
print('')
encoder.load_state_dict(torch.load("encoder.ckpt"))
decoder.load_state_dict(torch.load("decoder.ckpt")) | def test_iter(encoder, decoder, sentence, word2ix, ix2word, max_length=20):
input_variable = sentence
input_length = input_variable.size()[0]
encoder_hidden = encoder.initHidden()
encoder_outputs = variable(torch.zeros(max_length, encoder.hidden_size))
if use_cuda:
encoder_outputs = encoder_outputs.cuda()
for ei in range(input_length):
(encoder_output, encoder_hidden) = encoder(input_variable[ei], encoder_hidden)
encoder_outputs[ei] = encoder_outputs[ei] + encoder_output[0][0]
decoder_input = variable(torch.LongTensor([[BOS_TOKEN_ix]]))
if use_cuda:
decoder_input = decoder_input.cuda()
decoder_hidden = encoder_hidden
decoded_words = []
if decoder.attn_status:
decoder_attentions = torch.zeros(max_length, max_length)
for di in range(max_length):
if decoder.attn_status:
(decoder_output, decoder_hidden, decoder_attention) = decoder(decoder_input, decoder_hidden, encoder_outputs)
decoder_attentions[di] = decoder_attention.data
else:
(decoder_output, decoder_hidden) = decoder(decoder_input, decoder_hidden)
(topv, topi) = decoder_output.data.topk(1)
ni = topi[0][0]
if ni == EOS_TOKEN_ix:
decoded_words.append(EOS_TOKEN)
break
else:
decoded_words.append(ix2word[str(ni)])
decoder_input = variable(torch.LongTensor([[ni]]))
if use_cuda:
decoder_input = decoder_input.cuda()
if decoder.attn_status:
return (decoded_words, decoder_attentions[:di + 1])
else:
return decoded_words
def test_model(encoder, decoder, dataset, word2ix, ix2word, n=10, max_length=20):
for i in range(n):
pair = random.choice(dataset)
input_str = ''.join((e for e in preprocessing.convertIndexSentenceToWord(pair['input'])))
target_str = ''.join((e for e in preprocessing.convertIndexSentenceToWord(pair['target'])))
print('>', input_str)
print('=', target_str)
temp = variable(torch.LongTensor(pair['input']).view(-1, 1))
if USE_CUDA:
temp = temp.cuda()
(output_words, attentions) = evaluate(encoder, decoder, temp, word2ix, ix2word, max_length=max_length)
output_sentence = ' '.join(output_words)
print('<', output_sentence)
print('')
encoder.load_state_dict(torch.load('encoder.ckpt'))
decoder.load_state_dict(torch.load('decoder.ckpt')) |
# -*- coding: utf-8 -*-
# Part of BrowseInfo. See LICENSE file for full copyright and licensing details.
{
"name" : "Hospital Management in Odoo/OpenERP",
"version" : "12.0.0.3",
"summary": "Hospital Management",
"category": "Industries",
"description": """
BrowseInfo developed a new odoo/OpenERP module apps.
This module is used to manage Hospital Mangement.
Also use for manage the healthcare management, Clinic management, Medical Management.Doctor's Clinic. Clinic software, oehealth. hospital system
Health Center Management
Hospital Buildings Management
Apothecary
clinic
dispensary management
Domiciliary Units
Patient - OutPatient Admissions
Patient - InPatient Admissions
Vaccines
Call Logs
Physicians & Appointments
Physicians Management
Appointments
Prescriptions
Evaluations
Pediatrics
Newborns
Surgeries
Insurances
Laboratory
Lab Tests
Imaging
Imaging Tests
Configuration
Physicians
Specialties
Degrees
Laboratory
Pathology
Diseases
Disease Categories
Health & Products
Medicines
Hospital Management System
Healthcare Management System
Clinic Management System
Appointment Management System
health care
This module is used to manage Hospital and Healthcare Management and Clinic Management apps.
manage clinic manage Patient hospital in odoo manage Healthcare system Patient Management,
Odoo Hospital Management odoo Healthcare Management Odoo Clinic Management
Odoo hospital Patients
Odoo Healthcare Patients Card Report
Odoo Healthcare Patients Medication History Report
Odoo Healthcare Appointments
Odoo hospital Appointments Invoice
Odoo Healthcare Families Prescriptions Healthcare Prescriptions
Odoo Healthcare Create Invoice from Prescriptions odoo hospital Prescription Report
Odoo Healthcare Patient Hospitalization
odoo Hospital Management System
Odoo Healthcare Management System
Odoo Clinic Management System
Odoo Appointment Management System
health care management system
Generate Report for patient details, appointment, prescriptions, lab-test
Odoo Lab Test Request and Result
Odoo Patient Hospitalization details
Generate Patient's Prescriptions
""" ,
"depends" : ["base", "sale", "stock", "account"],
"data": [
'security/hospital_groups.xml',
'data/ir_sequence_data.xml',
'views/assets.xml',
'views/login_page.xml',
'views/main_menu_file.xml',
'wizard/medical_appointments_invoice_wizard.xml',
'views/medical_appointment.xml',
'views/medical_appointment_request.xml',
'wizard/appointment_start_end_wizard.xml',
'wizard/create_prescription_invoice_wizard.xml',
'wizard/create_prescription_shipment_wizard.xml',
'wizard/medical_bed_transfer_wizard.xml',
'wizard/medical_health_services_invoice_wizard.xml',
'wizard/multiple_test_request_wizard.xml',
'views/medical_ambulatory_care_procedure.xml',
'views/medical_directions.xml',
'views/medical_family_code.xml',
'wizard/medical_lab_test_create_wizard.xml',
'views/medical_speciality.xml',
'views/medical_dose_unit.xml',
'views/medical_medicament.xml',
'views/medical_drug_form.xml',
'views/medical_drug_route.xml',
'views/medical_drugs_recreational.xml',
'views/medical_ethnicity.xml',
'views/medical_family_disease.xml',
'views/medical_genetic_risk.xml',
'views/medical_health_service_line.xml',
'views/medical_health_service.xml',
'views/medical_hospital_bed.xml',
'views/medical_hospital_building.xml',
'views/medical_hospital_oprating_room.xml',
'views/medical_hospital_unit.xml',
'views/medical_hospital_ward.xml',
'views/medical_inpatient_registration.xml',
'views/medical_inpatient_icu.xml',
'views/medical_icu_apache2_.xml',
'views/medical_icu_ecg.xml',
'views/medical_icu_glasgow.xml',
'views/medical_inpatient_medication.xml',
'views/medical_insurance_plan.xml',
'views/medical_insurance.xml',
'wizard/medical_lab_test_invoice_wizard.xml',
'views/medical_lab_test_units.xml',
'views/medical_patient_lab_test.xml',
'views/medical_lab.xml',
'views/medical_neomatal_apgar.xml',
'views/medical_newborn.xml',
'views/medical_occupation.xml',
'views/medical_operational_area.xml',
'views/medical_operational_sector.xml',
'views/medical_pathology_category.xml',
'views/medical_pathology_group.xml',
'views/medical_pathology.xml',
'views/medical_patient_ambulatory_care.xml',
'views/medical_patient_disease.xml',
'views/medical_patient_evaluation.xml',
'views/medical_patient_medication.xml',
'views/medical_patient_medication1.xml',
'views/medical_patient_pregnancy.xml',
'views/medical_patient_prental_evolution.xml',
'views/medical_patient_psc.xml',
'views/medical_patient.xml',
'views/medical_physician.xml',
'views/medical_preinatal.xml',
'views/medical_prescription_line.xml',
'views/medical_prescription_order.xml',
'views/medical_procedure.xml',
'views/medical_puerperium_monitor.xml',
'views/medical_rcri.xml',
'views/medical_rounding_procedure.xml',
'views/medical_surgey.xml',
'views/medical_test_critearea.xml',
'views/medical_test_type.xml',
'views/medical_vaccination.xml',
'views/medicament_category.xml',
'views/res_partner.xml',
'wizard/medical_imaging_test_request_wizard.xml',
'views/medical_imaging_test_request.xml',
'views/medical_imaging_test_result.xml',
'views/medical_imaging_test_type.xml',
'views/medical_imaging_test.xml',
'report/report_view.xml',
'report/appointment_recipts_report_template.xml',
'report/medical_view_report_document_lab.xml',
'report/medical_view_report_lab_result_demo_report.xml',
'report/newborn_card_report.xml',
'report/patient_card_report.xml',
'report/patient_diseases_document_report.xml',
'report/patient_medications_document_report.xml',
'report/patient_vaccinations_document_report.xml',
'report/prescription_demo_report.xml',
'security/ir.model.access.csv',
],
"author": "BrowseInfo",
"website": "http://www.browseinfo.in",
'live_test_url':'https://www.youtube.com/watch?v=Hm3N81kdp_c&t=2s',
"price": 89,
"currency": "EUR",
"installable": True,
"application": True,
"auto_install": False,
"images":["static/description/Banner.png"],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| {'name': 'Hospital Management in Odoo/OpenERP', 'version': '12.0.0.3', 'summary': 'Hospital Management', 'category': 'Industries', 'description': "\nBrowseInfo developed a new odoo/OpenERP module apps.\nThis module is used to manage Hospital Mangement.\n Also use for manage the healthcare management, Clinic management, Medical Management.Doctor's Clinic. Clinic software, oehealth. hospital system \n \n Health Center Management\n Hospital Buildings Management\n Apothecary\n clinic \n dispensary management\n \n Domiciliary Units\n Patient - OutPatient Admissions\n Patient - InPatient Admissions\n Vaccines\n Call Logs\n Physicians & Appointments\n Physicians Management\n Appointments\n Prescriptions\n Evaluations\n Pediatrics\n Newborns\n Surgeries\n Insurances\n Laboratory\n Lab Tests\n Imaging\n Imaging Tests\n Configuration\n Physicians\n Specialties\n Degrees\n Laboratory\n Pathology\n Diseases\n Disease Categories\n Health & Products\n Medicines\n Hospital Management System\n Healthcare Management System\n Clinic Management System\n Appointment Management System\n health care\n This module is used to manage Hospital and Healthcare Management and Clinic Management apps. \n manage clinic manage Patient hospital in odoo manage Healthcare system Patient Management, \n Odoo Hospital Management odoo Healthcare Management Odoo Clinic Management\n Odoo hospital Patients\n Odoo Healthcare Patients Card Report\n Odoo Healthcare Patients Medication History Report\n Odoo Healthcare Appointments\n Odoo hospital Appointments Invoice\n Odoo Healthcare Families Prescriptions Healthcare Prescriptions\n Odoo Healthcare Create Invoice from Prescriptions odoo hospital Prescription Report\n Odoo Healthcare Patient Hospitalization\n odoo Hospital Management System\n Odoo Healthcare Management System\n Odoo Clinic Management System\n Odoo Appointment Management System\n health care management system\n Generate Report for patient details, appointment, prescriptions, lab-test\n\n Odoo Lab Test Request and Result\n Odoo Patient Hospitalization details\n Generate Patient's Prescriptions\n", 'depends': ['base', 'sale', 'stock', 'account'], 'data': ['security/hospital_groups.xml', 'data/ir_sequence_data.xml', 'views/assets.xml', 'views/login_page.xml', 'views/main_menu_file.xml', 'wizard/medical_appointments_invoice_wizard.xml', 'views/medical_appointment.xml', 'views/medical_appointment_request.xml', 'wizard/appointment_start_end_wizard.xml', 'wizard/create_prescription_invoice_wizard.xml', 'wizard/create_prescription_shipment_wizard.xml', 'wizard/medical_bed_transfer_wizard.xml', 'wizard/medical_health_services_invoice_wizard.xml', 'wizard/multiple_test_request_wizard.xml', 'views/medical_ambulatory_care_procedure.xml', 'views/medical_directions.xml', 'views/medical_family_code.xml', 'wizard/medical_lab_test_create_wizard.xml', 'views/medical_speciality.xml', 'views/medical_dose_unit.xml', 'views/medical_medicament.xml', 'views/medical_drug_form.xml', 'views/medical_drug_route.xml', 'views/medical_drugs_recreational.xml', 'views/medical_ethnicity.xml', 'views/medical_family_disease.xml', 'views/medical_genetic_risk.xml', 'views/medical_health_service_line.xml', 'views/medical_health_service.xml', 'views/medical_hospital_bed.xml', 'views/medical_hospital_building.xml', 'views/medical_hospital_oprating_room.xml', 'views/medical_hospital_unit.xml', 'views/medical_hospital_ward.xml', 'views/medical_inpatient_registration.xml', 'views/medical_inpatient_icu.xml', 'views/medical_icu_apache2_.xml', 'views/medical_icu_ecg.xml', 'views/medical_icu_glasgow.xml', 'views/medical_inpatient_medication.xml', 'views/medical_insurance_plan.xml', 'views/medical_insurance.xml', 'wizard/medical_lab_test_invoice_wizard.xml', 'views/medical_lab_test_units.xml', 'views/medical_patient_lab_test.xml', 'views/medical_lab.xml', 'views/medical_neomatal_apgar.xml', 'views/medical_newborn.xml', 'views/medical_occupation.xml', 'views/medical_operational_area.xml', 'views/medical_operational_sector.xml', 'views/medical_pathology_category.xml', 'views/medical_pathology_group.xml', 'views/medical_pathology.xml', 'views/medical_patient_ambulatory_care.xml', 'views/medical_patient_disease.xml', 'views/medical_patient_evaluation.xml', 'views/medical_patient_medication.xml', 'views/medical_patient_medication1.xml', 'views/medical_patient_pregnancy.xml', 'views/medical_patient_prental_evolution.xml', 'views/medical_patient_psc.xml', 'views/medical_patient.xml', 'views/medical_physician.xml', 'views/medical_preinatal.xml', 'views/medical_prescription_line.xml', 'views/medical_prescription_order.xml', 'views/medical_procedure.xml', 'views/medical_puerperium_monitor.xml', 'views/medical_rcri.xml', 'views/medical_rounding_procedure.xml', 'views/medical_surgey.xml', 'views/medical_test_critearea.xml', 'views/medical_test_type.xml', 'views/medical_vaccination.xml', 'views/medicament_category.xml', 'views/res_partner.xml', 'wizard/medical_imaging_test_request_wizard.xml', 'views/medical_imaging_test_request.xml', 'views/medical_imaging_test_result.xml', 'views/medical_imaging_test_type.xml', 'views/medical_imaging_test.xml', 'report/report_view.xml', 'report/appointment_recipts_report_template.xml', 'report/medical_view_report_document_lab.xml', 'report/medical_view_report_lab_result_demo_report.xml', 'report/newborn_card_report.xml', 'report/patient_card_report.xml', 'report/patient_diseases_document_report.xml', 'report/patient_medications_document_report.xml', 'report/patient_vaccinations_document_report.xml', 'report/prescription_demo_report.xml', 'security/ir.model.access.csv'], 'author': 'BrowseInfo', 'website': 'http://www.browseinfo.in', 'live_test_url': 'https://www.youtube.com/watch?v=Hm3N81kdp_c&t=2s', 'price': 89, 'currency': 'EUR', 'installable': True, 'application': True, 'auto_install': False, 'images': ['static/description/Banner.png']} |
#!/usr/bin/python
'''
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(added missing cases, making assumptions for ambiguity)
Ex text = "abcd" pattern = "a*cd" False
Ex text = "abbbbcd" pattern = "ab*cd" True
Ex text = "aabbccdd" pattern = "a?*" and "?*" True
Not sure what to do with '?*?', ignoring
'''
def pattern_match(text, pattern):
if pattern[0] == '*':
return False # invalid pattern
i_txt = 0
i_pat = 0
prv_ch = ''
while (i_txt < len(text)):
if pattern[i_pat] not in ('?','*'):
if pattern[i_pat] != text[i_txt]:
return False
prv_ch = text[i_txt] # save in case of '*' next
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '?':
prv_ch = '?' # save in case of '*' next
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '*':
if prv_ch != '?':
while i_txt < len(text) and text[i_txt] == prv_ch:
i_txt += 1
i_pat += 1
else:
# end '?*' on next character match
# if no next character, return true (right?)
if i_pat + 1 == len(pattern):
return True
# find next char in pattern
i_pat += 1
assert pattern[i_pat] != '?', "do not handle ?*? yet"
while i_txt < len(text) and text[i_txt] != pattern[i_pat]:
i_txt += 1
# if not at end of pattern fail (except if '*')
if i_pat != len(pattern) and not (i_pat == len(pattern) - 1 and pattern[i_pat] == '*'):
return False
return True
s = "hello"
assert(pattern_match(s,"hello") is True)
assert(pattern_match(s,"h3ll0") is False)
assert(pattern_match(s,"h?llo") is True)
assert(pattern_match(s,"?????") is True)
assert(pattern_match(s,"h??lo") is True)
assert(pattern_match(s,"h?el?") is False)
assert(pattern_match(s,"hel*?") is True)
assert(pattern_match(s,"hel*o") is True)
assert(pattern_match(s,"he*o") is False)
assert(pattern_match(s,"hel*o*") is True)
assert(pattern_match(s,"h?*") is True)
assert(pattern_match(s,"h?*o") is True)
assert(pattern_match(s,"h?*llo") is True)
assert(pattern_match(s,"?*o") is True)
assert(pattern_match(s,"hel?*f") is False)
| """
From careercup.com
Write a pattern matching function using wild char
? Matches any char exactly one instance
* Matches one or more instances of previous char
Ex text = "abcd" pattern = "ab?d" True
Ex text = "abccdddef" pattern = "ab?*f" True
Ex text = "abccd" pattern = "ab?*ccd" false
(added missing cases, making assumptions for ambiguity)
Ex text = "abcd" pattern = "a*cd" False
Ex text = "abbbbcd" pattern = "ab*cd" True
Ex text = "aabbccdd" pattern = "a?*" and "?*" True
Not sure what to do with '?*?', ignoring
"""
def pattern_match(text, pattern):
if pattern[0] == '*':
return False
i_txt = 0
i_pat = 0
prv_ch = ''
while i_txt < len(text):
if pattern[i_pat] not in ('?', '*'):
if pattern[i_pat] != text[i_txt]:
return False
prv_ch = text[i_txt]
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '?':
prv_ch = '?'
i_pat += 1
i_txt += 1
elif pattern[i_pat] == '*':
if prv_ch != '?':
while i_txt < len(text) and text[i_txt] == prv_ch:
i_txt += 1
i_pat += 1
else:
if i_pat + 1 == len(pattern):
return True
i_pat += 1
assert pattern[i_pat] != '?', 'do not handle ?*? yet'
while i_txt < len(text) and text[i_txt] != pattern[i_pat]:
i_txt += 1
if i_pat != len(pattern) and (not (i_pat == len(pattern) - 1 and pattern[i_pat] == '*')):
return False
return True
s = 'hello'
assert pattern_match(s, 'hello') is True
assert pattern_match(s, 'h3ll0') is False
assert pattern_match(s, 'h?llo') is True
assert pattern_match(s, '?????') is True
assert pattern_match(s, 'h??lo') is True
assert pattern_match(s, 'h?el?') is False
assert pattern_match(s, 'hel*?') is True
assert pattern_match(s, 'hel*o') is True
assert pattern_match(s, 'he*o') is False
assert pattern_match(s, 'hel*o*') is True
assert pattern_match(s, 'h?*') is True
assert pattern_match(s, 'h?*o') is True
assert pattern_match(s, 'h?*llo') is True
assert pattern_match(s, '?*o') is True
assert pattern_match(s, 'hel?*f') is False |
# -*- coding: utf-8 -*-
"""
lytics
~~~~~~
Main file for lytics app.
Usage: python lyrics.py
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
"""
| """
lytics
~~~~~~
Main file for lytics app.
Usage: python lyrics.py
:copyright: (c) 2016 by Patrick Spencer.
:license: Apache 2.0, see LICENSE for more details.
""" |
frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso')
| frase = str(input('Digite uma frase:\n->')).strip()
separado = frase.split()
junto = ''.join(separado)
correto = list(junto.upper())
invertido = list(reversed(junto.upper()))
print(correto)
print(invertido)
if correto == invertido:
print('verdadeiro')
else:
print('falso') |
# Copied from https://rosettacode.org/wiki/Trabb_Pardo%E2%80%93Knuth_algorithm#Python
def f(x):
return abs(x) ** 0.5 + 5 * x**3
def ask():
return [float(y)
for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
result = f(x)
if result > 400:
print(' %s:%s' % (x, "TOO LARGE!"), end='')
else:
print(' %s:%s' % (x, result), end='')
print('')
| def f(x):
return abs(x) ** 0.5 + 5 * x ** 3
def ask():
return [float(y) for y in input('\n11 numbers: ').strip().split()[:11]]
if __name__ == '__main__':
s = ask()
s.reverse()
for x in s:
result = f(x)
if result > 400:
print(' %s:%s' % (x, 'TOO LARGE!'), end='')
else:
print(' %s:%s' % (x, result), end='')
print('') |
def toBaseTen(n, base):
'''
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
..................
'''
baseTen = 0
num = str(num)
for i in range(len(num)):
baseTen += base ** (len(num) - 1 - i) * int(num[i], 36)
return baseTen
def toAnyBase(num, base):
'''
This function takes 2 arguments: number (in base 10, if you have number in any other base,
please use toBaseTen function first to get get your number in base 10) and base that you
want to convert your number to.
It will return a string
Examples:
..................
>>> toAnyBase(23412,30)
'Q0C'
..................
>>> toAnyBase(23412,15)
'6E0C'
..................
>>> toAnyBase(12, 2)
'1100'
'''
bases = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if num < base:
return bases[num]
else:
return toAnyBase(num // base, base) + bases[num % base] | def to_base_ten(n, base):
"""
This function takes arguments: number that you want to convert and its base
It will return an int in base 10
Examples:
..................
>>> toBaseTen(2112, 3)
68
..................
>>> toBaseTen('AB12', 12)
61904
..................
>>> toBaseTen('AB12', 16)
111828
..................
"""
base_ten = 0
num = str(num)
for i in range(len(num)):
base_ten += base ** (len(num) - 1 - i) * int(num[i], 36)
return baseTen
def to_any_base(num, base):
"""
This function takes 2 arguments: number (in base 10, if you have number in any other base,
please use toBaseTen function first to get get your number in base 10) and base that you
want to convert your number to.
It will return a string
Examples:
..................
>>> toAnyBase(23412,30)
'Q0C'
..................
>>> toAnyBase(23412,15)
'6E0C'
..................
>>> toAnyBase(12, 2)
'1100'
"""
bases = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if num < base:
return bases[num]
else:
return to_any_base(num // base, base) + bases[num % base] |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
buying_price = prices[0]
max_profit = 0
for i in range(1, len(prices)):
profit = prices[i] - buying_price
if max_profit < profit:
max_profit = profit
elif prices[i] < buying_price:
buying_price = prices[i]
return max_profit
| class Solution(object):
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
buying_price = prices[0]
max_profit = 0
for i in range(1, len(prices)):
profit = prices[i] - buying_price
if max_profit < profit:
max_profit = profit
elif prices[i] < buying_price:
buying_price = prices[i]
return max_profit |
vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc/m
if s*(30/100) >= p :
print ('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a,p))
else:
print(' Emprestimo nao aprovado a prestacao de R${:.2f} e passa dos 30% so seu salario'.format(p))
| vc = float(input('Qual o valor da casa: R$'))
s = float(input('Qual o seu salario'))
a = int(input('Em quantos anos voce quer pagar :'))
m = a * 12
p = vc / m
if s * (30 / 100) >= p:
print('O emprestimo sera feito em {} anos com prestacoes mensais de R${:.2f} e foi aprovado '.format(a, p))
else:
print(' Emprestimo nao aprovado a prestacao de R${:.2f} e passa dos 30% so seu salario'.format(p)) |
grid = [
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1 # the cost associated with moving from a cell to an adjacent one
delta = [
[-1, 0], # go up
[0, -1], # go left
[1, 0], # go down
[0, 1],
] # go right
delta_name = ["^", "<", "v", ">"]
def compute_value(grid, goal, cost):
value = [[99 for row in range(len(grid[0]))] for col in range(len(grid))]
policy = [[" " for row in range(len(grid[0]))] for col in range(len(grid))]
change = True
while change:
change = False
for x in range(len(grid)):
for y in range(len(grid[0])):
# If it is goal
if goal[0] == x and goal[1] == y:
if value[x][y] > 0:
value[x][y] = 0
policy[x][y] = "*"
change = True
# If it is navigable
elif grid[x][y] == 0:
for a in range(len(delta)):
x2 = x + delta[a][0]
y2 = y + delta[a][1]
if (
x2 >= 0
and x2 < len(grid)
and y2 >= 0
and y2 < len(grid[0])
and grid[x2][y2] == 0
):
v2 = value[x2][y2] + cost
if v2 < value[x][y]:
change = True
value[x][y] = v2
policy[x][y] = delta_name[a]
for i in range(len(value)):
print(value[i])
for i in range(len(value)):
print(policy[i])
# make sure your function returns a grid of values as
# demonstrated in the previous video.
return value
compute_value(grid, goal, cost)
| grid = [[0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0]]
goal = [len(grid) - 1, len(grid[0]) - 1]
cost = 1
delta = [[-1, 0], [0, -1], [1, 0], [0, 1]]
delta_name = ['^', '<', 'v', '>']
def compute_value(grid, goal, cost):
value = [[99 for row in range(len(grid[0]))] for col in range(len(grid))]
policy = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))]
change = True
while change:
change = False
for x in range(len(grid)):
for y in range(len(grid[0])):
if goal[0] == x and goal[1] == y:
if value[x][y] > 0:
value[x][y] = 0
policy[x][y] = '*'
change = True
elif grid[x][y] == 0:
for a in range(len(delta)):
x2 = x + delta[a][0]
y2 = y + delta[a][1]
if x2 >= 0 and x2 < len(grid) and (y2 >= 0) and (y2 < len(grid[0])) and (grid[x2][y2] == 0):
v2 = value[x2][y2] + cost
if v2 < value[x][y]:
change = True
value[x][y] = v2
policy[x][y] = delta_name[a]
for i in range(len(value)):
print(value[i])
for i in range(len(value)):
print(policy[i])
return value
compute_value(grid, goal, cost) |
## Read input as specified in the question.
## Print output as specified in the question.
# Pattern 1-212-32123...
# Reading number of rows
row = int(input())
# Generating pattern
for i in range(1,row+1):
# for space
for j in range(1, row+1-i):
print(' ', end='')
# for decreasing pattern
for j in range(i,0,-1):
print(j, end='')
# for increasing pattern
for j in range(2,i+1):
print(j, end='')
# Moving to next line
print()
| row = int(input())
for i in range(1, row + 1):
for j in range(1, row + 1 - i):
print(' ', end='')
for j in range(i, 0, -1):
print(j, end='')
for j in range(2, i + 1):
print(j, end='')
print() |
# This file implements some custom exceptions that can
# be used by all bots.
# We avoid adding these exceptions to lib.py, because the
# current architecture works by lib.py importing bots, not
# the other way around.
class ConfigValidationError(Exception):
"""
Raise if the config data passed to a bot's validate_config()
is invalid (e.g. wrong API key, invalid email, etc.).
"""
| class Configvalidationerror(Exception):
"""
Raise if the config data passed to a bot's validate_config()
is invalid (e.g. wrong API key, invalid email, etc.).
""" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def run():
print("run")
main()
return None
def aaa():
print("aaa")
return None
def main():#
print ("Hello, test is running")
if __name__ == '__main__':
main()
| def run():
print('run')
main()
return None
def aaa():
print('aaa')
return None
def main():
print('Hello, test is running')
if __name__ == '__main__':
main() |
class GradientBoostingMachine():
def __init__(self, nEstimators = 100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = GradientBoostingMachine(nEstimators=10)
| class Gradientboostingmachine:
def __init__(self, nEstimators=100):
self.nEstimators = nEstimators
if __name__ == '__main__':
gbm = gradient_boosting_machine(nEstimators=10) |
def exp_sum(n):
p = n
# calculation taken from here
# https://math.stackexchange.com/questions/2675382/calculating-integer-partitions
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
partitions.append(0)
for k in range(1, n + 1):
coeff = (-1) ** (k + 1)
for t in [pentagonal_number(k), pentagonal_number(-k)]:
if (n - t) >= 0:
partitions[n] = partitions[n] + coeff * partitions[n - t]
return partitions
return (compute_partitions(n))[-1] | def exp_sum(n):
p = n
def pentagonal_number(k):
return int(k * (3 * k - 1) / 2)
def compute_partitions(goal):
partitions = [1]
for n in range(1, goal + 1):
partitions.append(0)
for k in range(1, n + 1):
coeff = (-1) ** (k + 1)
for t in [pentagonal_number(k), pentagonal_number(-k)]:
if n - t >= 0:
partitions[n] = partitions[n] + coeff * partitions[n - t]
return partitions
return compute_partitions(n)[-1] |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Actions that cover historical needs as things migrate."""
load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal:platform_support.bzl",
"platform_support",
)
def _add_dicts(*dictionaries):
"""Adds a list of dictionaries into a single dictionary."""
# If keys are repeated in multiple dictionaries, the latter one "wins".
result = {}
for d in dictionaries:
result.update(d)
return result
def _kwargs_for_apple_platform(
ctx,
*,
platform_prerequisites,
**kwargs):
"""Returns a modified dictionary with required arguments to run on Apple platforms."""
processed_args = dict(kwargs)
env_dicts = []
original_env = processed_args.get("env")
if original_env:
env_dicts.append(original_env)
# This is where things differ from apple_support.
# TODO(b/161370390): Eliminate need to make platform_prerequisites optional when all calls to
# run and run_shell with a ctx argument are eliminated.
if platform_prerequisites:
platform = platform_prerequisites.platform
xcode_config = platform_prerequisites.xcode_version_config
action_execution_requirements = apple_support.action_required_execution_requirements(
xcode_config = xcode_config,
)
else:
platform = platform_support.platform(ctx)
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
action_execution_requirements = apple_support.action_required_execution_requirements(ctx)
env_dicts.append(apple_common.apple_host_system_env(xcode_config))
env_dicts.append(apple_common.target_apple_env(xcode_config, platform))
execution_requirement_dicts = []
original_execution_requirements = processed_args.get("execution_requirements")
if original_execution_requirements:
execution_requirement_dicts.append(original_execution_requirements)
# Add the action execution requirements last to avoid clients overriding this value.
execution_requirement_dicts.append(action_execution_requirements)
processed_args["env"] = _add_dicts(*env_dicts)
processed_args["execution_requirements"] = _add_dicts(*execution_requirement_dicts)
return processed_args
def _run(
ctx = None,
*,
actions = None,
platform_prerequisites = None,
**kwargs):
"""Executes a Darwin-only action with the necessary platform environment.
Note: The env here is different than apple_support's run/run_shell in that uses
ctx.fragments.apple.single_arch_platform, where here we look up the platform off some locally
define attributes. The difference being apple_support's run/run_shell are used in context where
all transitions have already happened; but this is meant to be used in bundling, where we are
before any of those transitions, and so the rule must ensure the right platform/arches are being
used itself.
TODO(b/121134880): Once we have support Starlark defined rule transitions, we can migrate usages
of this wrapper to apple_support's run/run_shell, as we'll add a rule transition so that the
rule context gets the correct platform value configured.
Args:
ctx: The Starlark context. Deprecated.
actions: The actions provider from ctx.actions.
platform_prerequisites: Struct containing information on the platform being targeted.
**kwargs: Arguments to be passed into ctx.actions.run.
"""
# TODO(b/161370390): Eliminate need to make actions and platform_prerequisites optional when all
# calls to this method with a ctx argument are eliminated.
if not actions:
actions = ctx.actions
actions.run(**_kwargs_for_apple_platform(
ctx = ctx,
platform_prerequisites = platform_prerequisites,
**kwargs
))
def _run_shell(
ctx = None,
*,
actions = None,
platform_prerequisites = None,
**kwargs):
"""Executes a Darwin-only action with the necessary platform environment.
Note: The env here is different than apple_support's run/run_shell in that uses
ctx.fragments.apple.single_arch_platform, where here we look up the platform off some locally
define attributes. The difference being apple_support's run/run_shell are used in context where
all transitions have already happened; but this is meant to be used in bundling, where we are
before any of those transitions, and so the rule must ensure the right platform/arches are being
used itself.
TODO(b/121134880): Once we have support Starlark defined rule transitions, we can migrate usages
of this wrapper to apple_support's run/run_shell, as we'll add a rule transition so that the
rule context gets the correct platform value configured.
Args:
ctx: The Starlark context. Deprecated.
actions: The actions provider from ctx.actions.
platform_prerequisites: Struct containing information on the platform being targeted.
**kwargs: Arguments to be passed into ctx.actions.run_shell.
"""
# TODO(b/161370390): Eliminate need to make actions and platform_prerequisites optional when all
# calls to this method with a ctx argument are eliminated.
if not actions:
actions = ctx.actions
actions.run_shell(**_kwargs_for_apple_platform(
ctx = ctx,
platform_prerequisites = platform_prerequisites,
**kwargs
))
# Define the loadable module that lists the exported symbols in this file.
legacy_actions = struct(
run = _run,
run_shell = _run_shell,
)
| """Actions that cover historical needs as things migrate."""
load('@build_bazel_apple_support//lib:apple_support.bzl', 'apple_support')
load('@build_bazel_rules_apple//apple/internal:platform_support.bzl', 'platform_support')
def _add_dicts(*dictionaries):
"""Adds a list of dictionaries into a single dictionary."""
result = {}
for d in dictionaries:
result.update(d)
return result
def _kwargs_for_apple_platform(ctx, *, platform_prerequisites, **kwargs):
"""Returns a modified dictionary with required arguments to run on Apple platforms."""
processed_args = dict(kwargs)
env_dicts = []
original_env = processed_args.get('env')
if original_env:
env_dicts.append(original_env)
if platform_prerequisites:
platform = platform_prerequisites.platform
xcode_config = platform_prerequisites.xcode_version_config
action_execution_requirements = apple_support.action_required_execution_requirements(xcode_config=xcode_config)
else:
platform = platform_support.platform(ctx)
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
action_execution_requirements = apple_support.action_required_execution_requirements(ctx)
env_dicts.append(apple_common.apple_host_system_env(xcode_config))
env_dicts.append(apple_common.target_apple_env(xcode_config, platform))
execution_requirement_dicts = []
original_execution_requirements = processed_args.get('execution_requirements')
if original_execution_requirements:
execution_requirement_dicts.append(original_execution_requirements)
execution_requirement_dicts.append(action_execution_requirements)
processed_args['env'] = _add_dicts(*env_dicts)
processed_args['execution_requirements'] = _add_dicts(*execution_requirement_dicts)
return processed_args
def _run(ctx=None, *, actions=None, platform_prerequisites=None, **kwargs):
"""Executes a Darwin-only action with the necessary platform environment.
Note: The env here is different than apple_support's run/run_shell in that uses
ctx.fragments.apple.single_arch_platform, where here we look up the platform off some locally
define attributes. The difference being apple_support's run/run_shell are used in context where
all transitions have already happened; but this is meant to be used in bundling, where we are
before any of those transitions, and so the rule must ensure the right platform/arches are being
used itself.
TODO(b/121134880): Once we have support Starlark defined rule transitions, we can migrate usages
of this wrapper to apple_support's run/run_shell, as we'll add a rule transition so that the
rule context gets the correct platform value configured.
Args:
ctx: The Starlark context. Deprecated.
actions: The actions provider from ctx.actions.
platform_prerequisites: Struct containing information on the platform being targeted.
**kwargs: Arguments to be passed into ctx.actions.run.
"""
if not actions:
actions = ctx.actions
actions.run(**_kwargs_for_apple_platform(ctx=ctx, platform_prerequisites=platform_prerequisites, **kwargs))
def _run_shell(ctx=None, *, actions=None, platform_prerequisites=None, **kwargs):
"""Executes a Darwin-only action with the necessary platform environment.
Note: The env here is different than apple_support's run/run_shell in that uses
ctx.fragments.apple.single_arch_platform, where here we look up the platform off some locally
define attributes. The difference being apple_support's run/run_shell are used in context where
all transitions have already happened; but this is meant to be used in bundling, where we are
before any of those transitions, and so the rule must ensure the right platform/arches are being
used itself.
TODO(b/121134880): Once we have support Starlark defined rule transitions, we can migrate usages
of this wrapper to apple_support's run/run_shell, as we'll add a rule transition so that the
rule context gets the correct platform value configured.
Args:
ctx: The Starlark context. Deprecated.
actions: The actions provider from ctx.actions.
platform_prerequisites: Struct containing information on the platform being targeted.
**kwargs: Arguments to be passed into ctx.actions.run_shell.
"""
if not actions:
actions = ctx.actions
actions.run_shell(**_kwargs_for_apple_platform(ctx=ctx, platform_prerequisites=platform_prerequisites, **kwargs))
legacy_actions = struct(run=_run, run_shell=_run_shell) |
def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {"*": None}
result = {}
unknown_flag = False
for name, value in src_data.items():
if name == "*":
for name2 in items_fetcher():
if not name2 in src_data:
if value != None and value != {}:
result[name2] = item_handler(name2, value)
elif value == None and name2 in default_keys:
result[name2] = item_handler(name2, None)
else:
result[name2] = {}
unknown_flag = True
else:
d = item_handler(name, value)
if d != None:
result[name] = d
if unknown_flag and thats_all_flag:
result["*"] = None
return result
def encode_for_get_resource(data):
return encode_for_get_resource2(None, data, False)
def encode_for_get_resource2(src_data, curr_data, thats_all_flag):
if not isinstance(curr_data, dict):
return curr_data
if not isinstance(src_data, dict):
src_data = {"*": None}
result = {}
unknown_flag = False
for name, value in src_data.items():
if name == "*":
if value == None:
for name2, value2 in curr_data.items():
if not name2 in src_data:
result[name2] = encode_for_get_resource2(value, value2, thats_all_flag)
unknown_flag = True
elif name in curr_data:
result[name] = encode_for_get_resource2(value, curr_data[name], thats_all_flag)
else:
pass
if unknown_flag and thats_all_flag:
result["*"] = None
return result
def decode_for_put(src_data):
if isinstance(src_data, str):
return src_data
if not isinstance(src_data, dict):
return src_data
src_data2 = {}
for name, value in src_data.items():
if name == "*":
continue
src_data2[name] = decode_for_put(value)
return src_data2
| def encode_for_get_list(src_data, thats_all_flag, default_keys, items_fetcher, item_handler):
if not isinstance(src_data, dict):
src_data = {'*': None}
result = {}
unknown_flag = False
for (name, value) in src_data.items():
if name == '*':
for name2 in items_fetcher():
if not name2 in src_data:
if value != None and value != {}:
result[name2] = item_handler(name2, value)
elif value == None and name2 in default_keys:
result[name2] = item_handler(name2, None)
else:
result[name2] = {}
unknown_flag = True
else:
d = item_handler(name, value)
if d != None:
result[name] = d
if unknown_flag and thats_all_flag:
result['*'] = None
return result
def encode_for_get_resource(data):
return encode_for_get_resource2(None, data, False)
def encode_for_get_resource2(src_data, curr_data, thats_all_flag):
if not isinstance(curr_data, dict):
return curr_data
if not isinstance(src_data, dict):
src_data = {'*': None}
result = {}
unknown_flag = False
for (name, value) in src_data.items():
if name == '*':
if value == None:
for (name2, value2) in curr_data.items():
if not name2 in src_data:
result[name2] = encode_for_get_resource2(value, value2, thats_all_flag)
unknown_flag = True
elif name in curr_data:
result[name] = encode_for_get_resource2(value, curr_data[name], thats_all_flag)
else:
pass
if unknown_flag and thats_all_flag:
result['*'] = None
return result
def decode_for_put(src_data):
if isinstance(src_data, str):
return src_data
if not isinstance(src_data, dict):
return src_data
src_data2 = {}
for (name, value) in src_data.items():
if name == '*':
continue
src_data2[name] = decode_for_put(value)
return src_data2 |
#!/usr/bin/python
def generateSet(name, value, type, indentationLevel):
finalLine = " "*indentationLevel
finalLine += name
finalLine += " = "
if type == 'string':
# Whatever you use for defining strings (either single, double, etc.)
finalLine += '"' + value + '"'
else:
finalLine += value
finalLine += "\n"
return finalLine
def generateIf(comparison, leftHandType, leftHandValue, rightHandType, rightHandValue, indentationLevel):
finalLine = " " * indentationLevel
finalLine += "if "
if leftHandType == "string":
finalLine += '"' + leftHandValue + '"'
else:
finalLine += leftHandValue
if comparison == "equals":
finalLine += " == "
if rightHandType == "string":
finalLine += '"' + rightHandValue + '"'
else:
finalLine += rightHandValue
finalLine += ":\n"
return finalLine
def generateEndIf(indentationLevel):
finalLine = " "*indentationLevel
finalLine += "\n"
return finalLine | def generate_set(name, value, type, indentationLevel):
final_line = ' ' * indentationLevel
final_line += name
final_line += ' = '
if type == 'string':
final_line += '"' + value + '"'
else:
final_line += value
final_line += '\n'
return finalLine
def generate_if(comparison, leftHandType, leftHandValue, rightHandType, rightHandValue, indentationLevel):
final_line = ' ' * indentationLevel
final_line += 'if '
if leftHandType == 'string':
final_line += '"' + leftHandValue + '"'
else:
final_line += leftHandValue
if comparison == 'equals':
final_line += ' == '
if rightHandType == 'string':
final_line += '"' + rightHandValue + '"'
else:
final_line += rightHandValue
final_line += ':\n'
return finalLine
def generate_end_if(indentationLevel):
final_line = ' ' * indentationLevel
final_line += '\n'
return finalLine |
'''variabile'''
"""a=8
a+=7
a=24
b=3
b-=2
c=2
d=2
nume = "it factory"
a,b,c =1,2,3
print(a+b)
print(a/b)
print(a//b)
print(a%b)
print(a)
print(b)
print(c**d)
"""
check = False
if 8>7:
check = True
print(check)
print(type(check))
nume="ioan vasile anton"
print(nume[0])
print(nume[5:11])
print(nume[0:10:2])
print(len(nume))
print(nume[len(nume)-1])
print(nume[::-2])
print(nume.capitalize())
print(nume.upper())
print(nume.lower())
print(nume.replace("vasile","petruta"))
print(nume.count("a",0,17))
| """variabile"""
'a=8\na+=7\na=24\nb=3\nb-=2\nc=2\nd=2\nnume = "it factory"\na,b,c =1,2,3\nprint(a+b)\nprint(a/b)\nprint(a//b)\nprint(a%b)\nprint(a)\nprint(b)\nprint(c**d)\n'
check = False
if 8 > 7:
check = True
print(check)
print(type(check))
nume = 'ioan vasile anton'
print(nume[0])
print(nume[5:11])
print(nume[0:10:2])
print(len(nume))
print(nume[len(nume) - 1])
print(nume[::-2])
print(nume.capitalize())
print(nume.upper())
print(nume.lower())
print(nume.replace('vasile', 'petruta'))
print(nume.count('a', 0, 17)) |
#
# PySNMP MIB module SIP-COMMON-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-COMMON-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:04:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint")
InetPortNumber, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetPortNumber")
applIndex, = mibBuilder.importSymbols("NETWORK-SERVICES-MIB", "applIndex")
SipTCTransportProtocol, SipTCEntityRole, SipTCOptionTagHeaders, SipTCMethodName = mibBuilder.importSymbols("SIP-TC-MIB", "SipTCTransportProtocol", "SipTCEntityRole", "SipTCOptionTagHeaders", "SipTCMethodName")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Bits, ModuleIdentity, IpAddress, NotificationType, Gauge32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, mib_2, Unsigned32, ObjectIdentity, MibIdentifier, Counter64, Counter32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ModuleIdentity", "IpAddress", "NotificationType", "Gauge32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "mib-2", "Unsigned32", "ObjectIdentity", "MibIdentifier", "Counter64", "Counter32", "Integer32")
RowStatus, TextualConvention, TimeStamp, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "TimeStamp", "TruthValue", "DisplayString")
sipCommonMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 149))
sipCommonMIB.setRevisions(('2007-04-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: sipCommonMIB.setRevisionsDescriptions(('Initial version of the IETF SIP-COMMON-MIB module. This version published as part of RFC 4780.',))
if mibBuilder.loadTexts: sipCommonMIB.setLastUpdated('200704200000Z')
if mibBuilder.loadTexts: sipCommonMIB.setOrganization('IETF Session Initiation Protocol Working Group')
if mibBuilder.loadTexts: sipCommonMIB.setContactInfo('SIP WG email: sip@ietf.org Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1 919 476 2029 Co-editor Joon Maeng email: jmaeng@austin.rr.com Co-editor Jean-Francois Mule CableLabs postal: 858 Coal Creek Circle Louisville, CO 80027 USA email: jf.mule@cablelabs.com phone: +1 303 661 9100 Co-editor Dave Walker email: drwalker@rogers.com')
if mibBuilder.loadTexts: sipCommonMIB.setDescription('Session Initiation Protocol (SIP) Common MIB module. This module defines objects that may be common to all SIP entities. SIP is an application-layer signaling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 3261 (June 2002). This MIB is defined for managing objects that are common to SIP User Agents (UAs), Proxy, Redirect, and Registrar servers. Objects specific to each of these entities MAY be managed using entity specific MIBs defined in other modules. Copyright (C) The IETF Trust (2007). This version of this MIB module is part of RFC 4780; see the RFC itself for full legal notices.')
sipCommonMIBNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 0))
sipCommonMIBObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1))
sipCommonMIBConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2))
sipCommonCfgBase = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 1))
sipCommonCfgTimer = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 2))
sipCommonSummaryStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 3))
sipCommonMethodStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 4))
sipCommonStatusCode = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 5))
sipCommonStatsTrans = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 6))
sipCommonStatsRetry = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 7))
sipCommonOtherStats = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 8))
sipCommonNotifObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 1, 9))
sipCommonCfgTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 1), )
if mibBuilder.loadTexts: sipCommonCfgTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTable.setDescription('This table contains the common configuration objects applicable to all SIP entities.')
sipCommonCfgEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonCfgEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgEntry.setDescription('A row of common configuration. Each row represents objects for a particular SIP entity instance present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonCfgProtocolVersion = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 1), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgProtocolVersion.setDescription("This object will reflect the version of SIP supported by this SIP entity. It will follow the same format as SIP version information contained in the SIP messages generated by this SIP entity. For example, entities supporting SIP version 2 will return 'SIP/2.0' as dictated by the standard.")
sipCommonCfgServiceOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("up", 2), ("down", 3), ("congested", 4), ("restarting", 5), ("quiescing", 6), ("testing", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceOperStatus.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceOperStatus.setDescription('This object contains the current operational state of the SIP application. unknown : The operational status cannot be determined for some reason. up : The application is operating normally and is processing (receiving and possibly issuing) SIP requests and responses. down : The application is currently unable to process SIP messages. congested : The application is operational but no additional inbound transactions can be accommodated at the moment. restarting : The application is currently unavailable, but it is in the process of restarting and will presumably, soon be able to process SIP messages. quiescing : The application is currently operational but has been administratively put into quiescence mode. Additional inbound transactions MAY be rejected. testing : The application is currently in test mode and MAY not be able to process SIP messages. The operational status values defined for this object are not based on any specific information contained in the SIP standard.')
sipCommonCfgServiceStartTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceStartTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceStartTime.setDescription('The value of sysUpTime at the time the SIP entity was last started. If started prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sipCommonCfgServiceLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgServiceLastChange.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceLastChange.setDescription('The value of sysUpTime at the time the SIP entity entered its current operational state. If the current state was entered prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sipCommonCfgOrganization = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgOrganization.setReference('RFC 3261, Section 20.25')
if mibBuilder.loadTexts: sipCommonCfgOrganization.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgOrganization.setDescription('This object contains the organization name that the SIP entity inserts into Organization headers of SIP messages processed by this system. If the string is empty, no Organization header is to be generated.')
sipCommonCfgMaxTransactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgMaxTransactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgMaxTransactions.setDescription("This object indicates the maximum number of simultaneous transactions per second that the SIP entity can manage. In general, the value of this object SHOULD reflect a level of transaction processing per second that is considered high enough to impact the system's CPU and/or memory resources to the point of deteriorating SIP call processing but not high enough to cause catastrophic system failure.")
sipCommonCfgServiceNotifEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 7), Bits().clone(namedValues=NamedValues(("sipCommonServiceColdStart", 0), ("sipCommonServiceWarmStart", 1), ("sipCommonServiceStatusChanged", 2))).clone(namedValues=NamedValues(("sipCommonServiceColdStart", 0), ("sipCommonServiceWarmStart", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonCfgServiceNotifEnable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgServiceNotifEnable.setDescription("This object specifies which SIP service related notifications are enabled. Each bit represents a specific notification. If a bit has a value 1, the associated notification is enabled and will be generated by the SIP entity at the appropriate time. Support for these notifications is OPTIONAL: either none or all notification values are supported. If an implementation does not support this object, it should return a 'noSuchObject' exception to an SNMP GET operation. If notifications are supported, this object's default value SHOULD reflect sipCommonServiceColdStart and sipCommonServiceWarmStart enabled and sipCommonServiceStatusChanged disabled. This object value SHOULD persist across reboots.")
sipCommonCfgEntityType = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 8), SipTCEntityRole()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgEntityType.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgEntityType.setDescription('This object identifies the list of SIP entities to which this row is related. It is defined as a bit map. Each bit represents a type of SIP entity. If a bit has value 1, the SIP entity represented by this row plays the role of this entity type. If a bit has value 0, the SIP entity represented by this row does not act as this entity type. Combinations of bits can be set when the SIP entity plays multiple SIP roles.')
sipCommonPortTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 2), )
if mibBuilder.loadTexts: sipCommonPortTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortTable.setDescription('This table contains the list of ports that each SIP entity in this system is allowed to use. These ports can be advertised using the Contact header in a REGISTER request or response.')
sipCommonPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonPort"))
if mibBuilder.loadTexts: sipCommonPortEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortEntry.setDescription('Specification of a particular port. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonPort = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 1), InetPortNumber().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: sipCommonPort.setStatus('current')
if mibBuilder.loadTexts: sipCommonPort.setDescription('This object reflects a particular port that can be used by the SIP application.')
sipCommonPortTransportRcv = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 2), SipTCTransportProtocol()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonPortTransportRcv.setStatus('current')
if mibBuilder.loadTexts: sipCommonPortTransportRcv.setDescription('This object will specify the transport protocol the SIP entity will use to receive SIP messages. This object is a bit map. Each bit represents a transport protocol. If a bit has value 1, then that transport protocol is currently being used. If a bit has value 0, then that transport protocol is currently not being used.')
sipCommonOptionTagTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 3), )
if mibBuilder.loadTexts: sipCommonOptionTagTable.setReference('RFC 3261, Sections 19.2, 20.32, 20.29, 20.37, and 20.40')
if mibBuilder.loadTexts: sipCommonOptionTagTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagTable.setDescription("This table contains a list of the SIP option tags (SIP extensions) that are either required, supported, or unsupported by the SIP entity. These option tags are used in the Require, Proxy-Require, Supported, and Unsupported header fields. Example: If a user agent client supports, and requires the server to support, reliability of provisional responses (RFC 3262), this table contains a row with the option tag string '100rel' in sipCommonOptionTag and the OCTET STRING value of '1010 0000' or '0xA0' in sipCommonOptionTagHeaderField. If a server does not support the required feature (indicated in a Require header to a UAS, or in a Proxy-Require to a Proxy Server), the server returns a 420 Bad Extension listing the feature in an Unsupported header. Normally, the list of such features supported by an entity is static (i.e., will not change over time).")
sipCommonOptionTagEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonOptionTagIndex"))
if mibBuilder.loadTexts: sipCommonOptionTagEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagEntry.setDescription('A particular SIP option tag (extension) supported or unsupported by the SIP entity, and which may be supported or required by a peer. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonOptionTagIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: sipCommonOptionTagIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagIndex.setDescription('This object uniquely identifies a conceptual row in the table.')
sipCommonOptionTag = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 2), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOptionTag.setReference('RFC 3261, Section 27.1')
if mibBuilder.loadTexts: sipCommonOptionTag.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTag.setDescription('This object indicates the SIP option tag. The option tag names are registered with IANA and available at http://www.iana.org.')
sipCommonOptionTagHeaderField = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 3), SipTCOptionTagHeaders()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOptionTagHeaderField.setStatus('current')
if mibBuilder.loadTexts: sipCommonOptionTagHeaderField.setDescription('This object indicates whether the SIP option tag is supported (Supported header), unsupported (Unsupported header), or required (Require or Proxy-Require header) by the SIP entity. A SIP option tag may be both supported and required.')
sipCommonMethodSupportedTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 1, 4), )
if mibBuilder.loadTexts: sipCommonMethodSupportedTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedTable.setDescription('This table contains a list of methods supported by each SIP entity in this system (see the standard set of SIP methods in Section 7.1 of RFC 3261). Any additional methods that may be incorporated into the SIP protocol can be represented by this table without any requirement to update this MIB module. The table is informational in nature and conveys capabilities of the managed system to the SNMP Manager. From a protocol point of view, the list of methods advertised by the SIP entity in the Allow header (Section 20.5 of RFC 3261) MUST be consistent with the methods reflected in this table.')
sipCommonMethodSupportedEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonMethodSupportedIndex"))
if mibBuilder.loadTexts: sipCommonMethodSupportedEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedEntry.setDescription('A particular method supported by the SIP entity. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonMethodSupportedIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: sipCommonMethodSupportedIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedIndex.setDescription('This object uniquely identifies a conceptual row in the table and reflects an assigned number used to identify a specific SIP method. This identifier is suitable for referencing the associated method throughout this and other MIBs supported by this managed system.')
sipCommonMethodSupportedName = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 2), SipTCMethodName()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodSupportedName.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodSupportedName.setDescription("This object reflects the supported method's name. The method name MUST be all upper case (e.g., 'INVITE').")
sipCommonCfgTimerTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 2, 1), )
if mibBuilder.loadTexts: sipCommonCfgTimerTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerTable.setDescription('This table contains timer configuration objects applicable to SIP user agent and SIP stateful Proxy Server entities.')
sipCommonCfgTimerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonCfgTimerEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerEntry.setDescription('A row of timer configuration. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788). The objects in this table entry SHOULD be non-volatile and their value SHOULD be kept at reboot.')
sipCommonCfgTimerA = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerA.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerA.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerA.setDescription('This object reflects the initial value for the retransmit timer for the INVITE method. The retransmit timer doubles after each retransmission, ensuring an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to an INVITE before resending the INVITE request.')
sipCommonCfgTimerB = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerB.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerB.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerB.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to an INVITE. The timer is started upon transmission of the initial INVITE request.')
sipCommonCfgTimerC = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(180000, 300000)).clone(180000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerC.setReference('RFC 3261, Section 16.6')
if mibBuilder.loadTexts: sipCommonCfgTimerC.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerC.setDescription('This object reflects the maximum time a SIP Proxy Server will wait to receive a provisional response to an INVITE. The Timer C MUST be set for each client transaction when an INVITE request is proxied.')
sipCommonCfgTimerD = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerD.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts: sipCommonCfgTimerD.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerD.setDescription("This object reflects the amount of time that the server transaction can remain in the 'Completed' state when unreliable transports are used. The default value MUST be equal to or greater than 32000 for UDP transport, and its value MUST be 0 for TCP/SCTP transport.")
sipCommonCfgTimerE = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerE.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerE.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerE.setDescription("This object reflects the initial value for the retransmit timer for a non-INVITE method while in 'Trying' state. The retransmit timer doubles after each retransmission until it reaches T2 to ensure an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to the request before resending the non-INVITE request.")
sipCommonCfgTimerF = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerF.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerF.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerF.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to a non-INVITE request. The timer is started upon transmission of the initial request.')
sipCommonCfgTimerG = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerG.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerG.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerG.setDescription('This object reflects the initial value for the retransmit timer for final responses to INVITE requests. If timer G fires, the response is passed to the transport layer again for retransmission, and timer G is set to fire in MIN(2*T1, T2) seconds. From then on, when timer G fires, the response is passed to the transport again for transmission, and timer G is reset with a value that doubles, unless that value exceeds T2, in which case, it is reset with the value of T2. The default value MUST be T1 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.')
sipCommonCfgTimerH = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerH.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerH.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerH.setDescription("This object reflects the maximum time a server will wait to receive an ACK before it abandons retransmitting the response. The timer is started upon entering the 'Completed' state.")
sipCommonCfgTimerI = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerI.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts: sipCommonCfgTimerI.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerI.setDescription("This object reflects the maximum time a SIP entity will wait to receive additional ACK message retransmissions. The timer is started upon entering the 'Confirmed' state. The default value MUST be T4 for UDP transport and its value MUST be 0 for reliable transport like TCP/SCTP.")
sipCommonCfgTimerJ = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setReference('RFC 3261, Section 17.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerJ.setDescription("This object reflects the maximum time a SIP server will wait to receive retransmissions of non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer J fires, the server MUST transition to the 'Terminated' state.")
sipCommonCfgTimerK = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerK.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts: sipCommonCfgTimerK.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerK.setDescription("This object reflects the maximum time a SIP client will wait to receive retransmissions of responses to non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer K fires, the server MUST transition to the 'Terminated' state. The default value MUST be T4 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.")
sipCommonCfgTimerT1 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(500)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT1.setDescription('This object reflects the T1 timer for a SIP entity. T1 is an estimate of the round-trip time (RTT) between the client and server transactions.')
sipCommonCfgTimerT2 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 13), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(4000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT2.setDescription("This object reflects the T2 timer for a SIP entity. T2 is the maximum retransmit interval for non-INVITE requests and INVITE responses. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sipCommonCfgTimerT4 = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(200, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setStatus('current')
if mibBuilder.loadTexts: sipCommonCfgTimerT4.setDescription("This object reflects the T4 timer for a SIP entity. T4 is the maximum duration a message will remain in the network. It represents the amount of time the network will take to clear messages between client and server transactions. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sipCommonSummaryStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 3, 1), )
if mibBuilder.loadTexts: sipCommonSummaryStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sipCommonSummaryStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonSummaryStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryStatsEntry.setDescription('A row of summary statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonSummaryInRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryInRequests.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryInRequests.setDescription('This object indicates the total number of SIP request messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryOutRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryOutRequests.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryOutRequests.setDescription('This object contains the total number of SIP request messages sent out (originated and relayed) by the SIP entity. Where a particular message is sent more than once, for example as a retransmission or as a result of forking, each transmission is counted separately. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryInResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryInResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryInResponses.setDescription('This object contains the total number of SIP response messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryOutResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryOutResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryOutResponses.setDescription('This object contains the total number of SIP response messages sent (originated and relayed) by the SIP entity including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sipCommonSummaryTotalTransactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryTotalTransactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryTotalTransactions.setDescription("This object contains a count of the number of transactions that are in progress and transactions that have reached the 'Terminated' state. It is not applicable to stateless SIP Proxy Servers. A SIP transaction occurs between a client and a server, and comprises all messages from the first request sent from the client to the server, up to a final (non-1xx) response sent from the server to the client. If the request is INVITE and the final response is a non-2xx, the transaction also include an ACK to the response. The ACK for a 2xx response to an INVITE request is a separate transaction. The branch ID parameter in the Via header field values serves as a transaction identifier. A transaction is identified by the CSeq sequence number within a single call leg. The ACK request has the same CSeq number as the corresponding INVITE request, but comprises a transaction of its own. In the case of a forked request, each branch counts as a single transaction. For a transaction stateless Proxy Server, this counter is always 0. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.")
sipCommonSummaryDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonSummaryDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonSummaryDisconTime.setDescription('The value of the sysUpTime object when the counters for the summary statistics objects in this row last experienced a discontinuity.')
sipCommonMethodStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 4, 1), )
if mibBuilder.loadTexts: sipCommonMethodStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsTable.setDescription('This table contains the method statistics objects for SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sipCommonMethodStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonMethodStatsName"))
if mibBuilder.loadTexts: sipCommonMethodStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsEntry.setDescription('A row of per entity method statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonMethodStatsName = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonMethodStatsName.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsName.setDescription('This object uniquely identifies the SIP method related to the objects in a particular row.')
sipCommonMethodStatsOutbounds = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsOutbounds.setDescription('This object reflects the total number of requests sent by the SIP entity, excluding retransmissions. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sipCommonMethodStatsInbounds = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsInbounds.setDescription('This object reflects the total number of requests received by the SIP entity. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sipCommonMethodStatsDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonMethodStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonMethodStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the method statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 5, 1), )
if mibBuilder.loadTexts: sipCommonStatusCodeTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeTable.setDescription('This table contains the list of SIP status codes that each SIP entity in this system has been requested to monitor. It is the mechanism by which specific status codes are monitored. Entries created in this table must not persist across reboots.')
sipCommonStatusCodeEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonStatusCodeMethod"), (0, "SIP-COMMON-MIB", "sipCommonStatusCodeValue"))
if mibBuilder.loadTexts: sipCommonStatusCodeEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeEntry.setDescription('This row contains information on a particular SIP status code that the SIP entity has been requested to monitor. Entries created in this table must not persist across reboots. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonStatusCodeMethod = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonStatusCodeMethod.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeMethod.setDescription('This object uniquely identifies a conceptual row in the table.')
sipCommonStatusCodeValue = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(100, 999)))
if mibBuilder.loadTexts: sipCommonStatusCodeValue.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeValue.setDescription('This object contains a SIP status code value that the SIP entity has been requested to monitor. All of the other information in the row is related to this value.')
sipCommonStatusCodeIns = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeIns.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeIns.setDescription('This object reflects the total number of response messages received by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sipCommonStatusCodeOuts = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeOuts.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeOuts.setDescription('This object reflects the total number of response messages sent by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the Status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sipCommonStatusCodeRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: sipCommonStatusCodeRowStatus.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeRowStatus.setDescription("The row augmentation in sipCommonStatusCodeNotifTable will be governed by the value of this RowStatus. The values 'createAndGo' and 'destroy' are the only valid values allowed for this object. If a row exists, it will reflect a status of 'active' when queried.")
sipCommonStatusCodeDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatusCodeDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeDisconTime.setDescription('The value of the sysUpTime object when the counters for the status code statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeNotifTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 5, 2), )
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTable.setDescription('This table contains objects to control notifications related to particular status codes that each SIP entity in this system has been requested to monitor. There is an entry in this table corresponding to each entry in sipCommonStatusCodeTable. Therefore, this table augments sipCommonStatusCodeTable and utilizes the same index methodology. The objects in this table are not included directly in the sipCommonStatusCodeTable simply to keep the status code notification control objects separate from the actual status code statistics.')
sipCommonStatusCodeNotifEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1), )
sipCommonStatusCodeEntry.registerAugmentions(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifEntry"))
sipCommonStatusCodeNotifEntry.setIndexNames(*sipCommonStatusCodeEntry.getIndexNames())
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEntry.setDescription('This row contains information controlling notifications for a particular SIP status code that the SIP entity has been requested to monitor.')
sipCommonStatusCodeNotifSend = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifSend.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifSend.setDescription("This object controls whether a sipCommonStatusCodeNotif is emitted when the status code value specified by sipCommonStatusCodeValue is sent or received. If the value of this object is 'true', then a notification is sent. If it is 'false', no notification is sent. Note well that a notification MAY be emitted for every message sent or received that contains the particular status code. Depending on the status code involved, this can cause a significant number of notification emissions that could be detrimental to network performance. Managers are forewarned to be prudent in the use of this object to enable notifications. Look to sipCommonStatusCodeNotifEmitMode for alternative controls for sipCommonStatusCodeNotif emissions.")
sipCommonStatusCodeNotifEmitMode = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("normal", 1), ("oneShot", 2), ("triggered", 3))).clone('oneShot')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEmitMode.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifEmitMode.setDescription("The object sipCommonStatusCodeNotifSend MUST be set to 'true' for the values of this object to have any effect. It is RECOMMENDED that the desired emit mode be established by this object prior to setting sipCommonStatusCodeNotifSend to 'true'. This object and the sipCommonStatusCodeNotifSend object can obviously be set independently, but their respective values will have a dependency on each other and the resulting notifications. This object specifies the mode for emissions of sipCommonStatusCodeNotif notifications. normal : sipCommonStatusCodeNotif notifications will be emitted by the system for each SIP response message sent or received that contains the desired status code. oneShot : Only one sipCommonStatusCodeNotif notification will be emitted. It will be the next SIP response message sent or received that contains the desired status code. No more notifications are emitted until this object is set to 'oneShot' again or set to 'normal'. This option is provided as a means of quelling the potential promiscuous behavior that can be associated with the sipCommonStatusCodeNotif. triggered : This value is only readable and cannot be set. It reflects that the 'oneShot' case has occurred, and indicates that the mode needs to be reset to get further notifications. The mode is reset by setting this object to 'oneShot' or 'normal'.")
sipCommonStatusCodeNotifThresh = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 3), Unsigned32().clone(500)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifThresh.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifThresh.setDescription('This object specifies the number of response messages sent or received by this system that are considered excessive. Based on crossing that threshold, a sipCommonStatusCodeThreshExceededInNotif notification or a sipCommonStatusCodeThreshExceededOutNotif will be sent. The sipCommonStatusCodeThreshExceededInNotif and sipCommonStatusCodeThreshExceededOutNotif notifications can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sipCommonStatusCodeNotifInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 4), Unsigned32().clone(60)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifInterval.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifInterval.setDescription('This object specifies the time interval over which, if sipCommonStatusCodeThresh is exceeded with respect to sent or received messages, a sipCommonStatusCodeThreshExceededInNotif or sipCommonStatusCodeThreshExceededOutNotif notification will be sent. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sipCommonTransCurrentTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 6, 1), )
if mibBuilder.loadTexts: sipCommonTransCurrentTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentTable.setDescription('This table contains information on the transactions currently awaiting definitive responses by each SIP entity in this system. This table does not apply to transaction stateless Proxy Servers.')
sipCommonTransCurrentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonTransCurrentEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentEntry.setDescription("Information on a particular SIP entity's current transactions. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sipCommonTransCurrentactions = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1, 1), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonTransCurrentactions.setStatus('current')
if mibBuilder.loadTexts: sipCommonTransCurrentactions.setDescription('This object contains the number of transactions awaiting definitive (non-1xx) response. In the case of a forked request, each branch counts as a single transaction corresponding to the entity identified by applIndex.')
sipCommonStatsRetryTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 7, 1), )
if mibBuilder.loadTexts: sipCommonStatsRetryTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryTable.setDescription('This table contains retry statistics objects applicable to each SIP entity in this system.')
sipCommonStatsRetryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"), (0, "SIP-COMMON-MIB", "sipCommonStatsRetryMethod"))
if mibBuilder.loadTexts: sipCommonStatsRetryEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryEntry.setDescription('A row of retry statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sipCommonStatsRetryMethod = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 1), SipTCMethodName())
if mibBuilder.loadTexts: sipCommonStatsRetryMethod.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryMethod.setDescription('This object uniquely identifies the SIP method related to the objects in a row.')
sipCommonStatsRetries = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetries.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetries.setDescription('This object reflects the total number of request retransmissions that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryFinalResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryFinalResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryFinalResponses.setDescription('This object reflects the total number of Final Response retries that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryNonFinalResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryNonFinalResponses.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryNonFinalResponses.setDescription('This object reflects the total number of non-Final Response retries that have been sent by the SIP entity. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sipCommonStatsRetryDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonStatsRetryDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryDisconTime.setDescription('The value of the sysUpTime object when the counters for the retry statistics objects in this row last experienced a discontinuity.')
sipCommonOtherStatsTable = MibTable((1, 3, 6, 1, 2, 1, 149, 1, 8, 1), )
if mibBuilder.loadTexts: sipCommonOtherStatsTable.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsTable.setDescription('This table contains other common statistics supported by each SIP entity in this system.')
sipCommonOtherStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipCommonOtherStatsEntry.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsEntry.setDescription("Information on a particular SIP entity's other common statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sipCommonOtherStatsNumUnsupportedUris = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedUris.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedUris.setDescription('Number of RequestURIs received with an unsupported scheme. A server normally responds to such requests with a 400 Bad Request status code. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsNumUnsupportedMethods = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedMethods.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsNumUnsupportedMethods.setDescription('Number of SIP requests received with unsupported methods. A server normally responds to such requests with a 501 (Not Implemented) or 405 (Method Not Allowed). Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsOtherwiseDiscardedMsgs = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsOtherwiseDiscardedMsgs.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsOtherwiseDiscardedMsgs.setDescription('Number of SIP messages received that, for any number of reasons, was discarded without a response. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sipCommonOtherStatsDisconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipCommonOtherStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts: sipCommonOtherStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the statistics objects in this row last experienced a discontinuity.')
sipCommonStatusCodeNotifTo = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 1), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTo.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifTo.setDescription("This object contains the value of the To header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'To: Watson '.")
sipCommonStatusCodeNotifFrom = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 2), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifFrom.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifFrom.setDescription("This object contains the value of the From header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'From: Watson '.")
sipCommonStatusCodeNotifCallId = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 3), SnmpAdminString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCallId.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCallId.setDescription("This object contains the value of the Call-ID in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'Call-ID: 5551212@example.com'.")
sipCommonStatusCodeNotifCSeq = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 4), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCSeq.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifCSeq.setDescription("This object contains the CSeq value in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'CSeq: 1722 INVITE'.")
sipCommonNotifApplIndex = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonNotifApplIndex.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifApplIndex.setDescription('This object contains the applIndex as described in RFC 2788. This object is created in order to allow a variable binding containing a value of applIndex in a notification.')
sipCommonNotifSequenceNumber = MibScalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: sipCommonNotifSequenceNumber.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifSequenceNumber.setDescription('This object contains a sequence number for each notification generated by this SIP entity. Each notification SHOULD have a unique sequence number. A network manager can use this information to determine whether notifications from a particular SIP entity have been missed. The value of this object MUST start at 1 and increase by 1 with each generated notification. If a system restarts, the sequence number MAY start again from 1.')
sipCommonStatusCodeNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifTo"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifFrom"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCallId"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCSeq"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"))
if mibBuilder.loadTexts: sipCommonStatusCodeNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotif.setDescription('Signifies that a specific status code has been sent or received by the system.')
sipCommonStatusCodeThreshExceededInNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 2)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"))
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededInNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededInNotif.setDescription('Signifies that a specific status code was found to have been received by the system frequently enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sipCommonStatusCodeThreshExceededOutNotif = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 3)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"))
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededOutNotif.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeThreshExceededOutNotif.setDescription('Signifies that a specific status code was found to have been sent by the system enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sipCommonServiceColdStart = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 4)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceStartTime"))
if mibBuilder.loadTexts: sipCommonServiceColdStart.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceColdStart.setDescription("Signifies that the SIP service has reinitialized itself or started for the first time. This SHOULD result from a hard 'down' to 'up' administrative status change. The configuration or behavior of the service MAY be altered.")
sipCommonServiceWarmStart = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 5)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"))
if mibBuilder.loadTexts: sipCommonServiceWarmStart.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceWarmStart.setDescription("Signifies that the SIP service has reinitialized itself and is restarting after an administrative 'reset'. The configuration or behavior of the service MAY be altered.")
sipCommonServiceStatusChanged = NotificationType((1, 3, 6, 1, 2, 1, 149, 0, 6)).setObjects(("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"), ("SIP-COMMON-MIB", "sipCommonCfgServiceOperStatus"))
if mibBuilder.loadTexts: sipCommonServiceStatusChanged.setStatus('current')
if mibBuilder.loadTexts: sipCommonServiceStatusChanged.setDescription('Signifies that the SIP service operational status has changed.')
sipCommonMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2, 1))
sipCommonMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 149, 2, 2))
sipCommonCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 149, 2, 1, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonConfigGroup"), ("SIP-COMMON-MIB", "sipCommonStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonCompliance = sipCommonCompliance.setStatus('current')
if mibBuilder.loadTexts: sipCommonCompliance.setDescription('The compliance statement for SIP entities.')
sipCommonConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 1)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgProtocolVersion"), ("SIP-COMMON-MIB", "sipCommonCfgServiceOperStatus"), ("SIP-COMMON-MIB", "sipCommonCfgServiceStartTime"), ("SIP-COMMON-MIB", "sipCommonCfgServiceLastChange"), ("SIP-COMMON-MIB", "sipCommonPortTransportRcv"), ("SIP-COMMON-MIB", "sipCommonOptionTag"), ("SIP-COMMON-MIB", "sipCommonOptionTagHeaderField"), ("SIP-COMMON-MIB", "sipCommonCfgMaxTransactions"), ("SIP-COMMON-MIB", "sipCommonCfgServiceNotifEnable"), ("SIP-COMMON-MIB", "sipCommonCfgEntityType"), ("SIP-COMMON-MIB", "sipCommonMethodSupportedName"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonConfigGroup = sipCommonConfigGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonConfigGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sipCommonInformationalGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 2)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgOrganization"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonInformationalGroup = sipCommonInformationalGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonInformationalGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sipCommonConfigTimerGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 3)).setObjects(("SIP-COMMON-MIB", "sipCommonCfgTimerA"), ("SIP-COMMON-MIB", "sipCommonCfgTimerB"), ("SIP-COMMON-MIB", "sipCommonCfgTimerC"), ("SIP-COMMON-MIB", "sipCommonCfgTimerD"), ("SIP-COMMON-MIB", "sipCommonCfgTimerE"), ("SIP-COMMON-MIB", "sipCommonCfgTimerF"), ("SIP-COMMON-MIB", "sipCommonCfgTimerG"), ("SIP-COMMON-MIB", "sipCommonCfgTimerH"), ("SIP-COMMON-MIB", "sipCommonCfgTimerI"), ("SIP-COMMON-MIB", "sipCommonCfgTimerJ"), ("SIP-COMMON-MIB", "sipCommonCfgTimerK"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT1"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT2"), ("SIP-COMMON-MIB", "sipCommonCfgTimerT4"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonConfigTimerGroup = sipCommonConfigTimerGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonConfigTimerGroup.setDescription('A collection of objects providing timer configuration common to all SIP entities.')
sipCommonStatsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 4)).setObjects(("SIP-COMMON-MIB", "sipCommonSummaryInRequests"), ("SIP-COMMON-MIB", "sipCommonSummaryOutRequests"), ("SIP-COMMON-MIB", "sipCommonSummaryInResponses"), ("SIP-COMMON-MIB", "sipCommonSummaryOutResponses"), ("SIP-COMMON-MIB", "sipCommonSummaryTotalTransactions"), ("SIP-COMMON-MIB", "sipCommonSummaryDisconTime"), ("SIP-COMMON-MIB", "sipCommonMethodStatsOutbounds"), ("SIP-COMMON-MIB", "sipCommonMethodStatsInbounds"), ("SIP-COMMON-MIB", "sipCommonMethodStatsDisconTime"), ("SIP-COMMON-MIB", "sipCommonStatusCodeIns"), ("SIP-COMMON-MIB", "sipCommonStatusCodeOuts"), ("SIP-COMMON-MIB", "sipCommonStatusCodeRowStatus"), ("SIP-COMMON-MIB", "sipCommonStatusCodeDisconTime"), ("SIP-COMMON-MIB", "sipCommonTransCurrentactions"), ("SIP-COMMON-MIB", "sipCommonOtherStatsNumUnsupportedUris"), ("SIP-COMMON-MIB", "sipCommonOtherStatsNumUnsupportedMethods"), ("SIP-COMMON-MIB", "sipCommonOtherStatsOtherwiseDiscardedMsgs"), ("SIP-COMMON-MIB", "sipCommonOtherStatsDisconTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatsGroup = sipCommonStatsGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsGroup.setDescription('A collection of objects providing statistics common to all SIP entities.')
sipCommonStatsRetryGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 5)).setObjects(("SIP-COMMON-MIB", "sipCommonStatsRetries"), ("SIP-COMMON-MIB", "sipCommonStatsRetryFinalResponses"), ("SIP-COMMON-MIB", "sipCommonStatsRetryNonFinalResponses"), ("SIP-COMMON-MIB", "sipCommonStatsRetryDisconTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatsRetryGroup = sipCommonStatsRetryGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatsRetryGroup.setDescription('A collection of objects providing retry statistics.')
sipCommonNotifGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 6)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotif"), ("SIP-COMMON-MIB", "sipCommonStatusCodeThreshExceededInNotif"), ("SIP-COMMON-MIB", "sipCommonStatusCodeThreshExceededOutNotif"), ("SIP-COMMON-MIB", "sipCommonServiceColdStart"), ("SIP-COMMON-MIB", "sipCommonServiceWarmStart"), ("SIP-COMMON-MIB", "sipCommonServiceStatusChanged"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonNotifGroup = sipCommonNotifGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifGroup.setDescription('A collection of notifications common to all SIP entities.')
sipCommonStatusCodeNotifGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 7)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifSend"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifEmitMode"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifThresh"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifInterval"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonStatusCodeNotifGroup = sipCommonStatusCodeNotifGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonStatusCodeNotifGroup.setDescription('A collection of objects related to the control and attribution of notifications common to all SIP entities.')
sipCommonNotifObjectsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 149, 2, 2, 8)).setObjects(("SIP-COMMON-MIB", "sipCommonStatusCodeNotifTo"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifFrom"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCallId"), ("SIP-COMMON-MIB", "sipCommonStatusCodeNotifCSeq"), ("SIP-COMMON-MIB", "sipCommonNotifApplIndex"), ("SIP-COMMON-MIB", "sipCommonNotifSequenceNumber"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sipCommonNotifObjectsGroup = sipCommonNotifObjectsGroup.setStatus('current')
if mibBuilder.loadTexts: sipCommonNotifObjectsGroup.setDescription('A collection of accessible-for-notify objects related to the notification defined in this MIB module.')
mibBuilder.exportSymbols("SIP-COMMON-MIB", sipCommonStatusCodeNotifTable=sipCommonStatusCodeNotifTable, sipCommonStatsRetryNonFinalResponses=sipCommonStatsRetryNonFinalResponses, sipCommonStatusCodeValue=sipCommonStatusCodeValue, sipCommonMIBConformance=sipCommonMIBConformance, sipCommonPortTable=sipCommonPortTable, sipCommonMethodStats=sipCommonMethodStats, sipCommonCfgTimer=sipCommonCfgTimer, sipCommonOptionTagTable=sipCommonOptionTagTable, sipCommonCfgServiceLastChange=sipCommonCfgServiceLastChange, sipCommonNotifObjectsGroup=sipCommonNotifObjectsGroup, sipCommonMIBObjects=sipCommonMIBObjects, sipCommonCfgTimerG=sipCommonCfgTimerG, sipCommonSummaryInResponses=sipCommonSummaryInResponses, sipCommonCompliance=sipCommonCompliance, sipCommonSummaryDisconTime=sipCommonSummaryDisconTime, sipCommonStatusCode=sipCommonStatusCode, sipCommonCfgEntityType=sipCommonCfgEntityType, sipCommonCfgTimerB=sipCommonCfgTimerB, sipCommonStatusCodeNotifTo=sipCommonStatusCodeNotifTo, sipCommonStatsRetryGroup=sipCommonStatsRetryGroup, sipCommonNotifSequenceNumber=sipCommonNotifSequenceNumber, sipCommonNotifObjects=sipCommonNotifObjects, sipCommonStatsRetryDisconTime=sipCommonStatsRetryDisconTime, sipCommonPort=sipCommonPort, sipCommonMethodStatsEntry=sipCommonMethodStatsEntry, sipCommonStatsRetryTable=sipCommonStatsRetryTable, sipCommonStatusCodeNotifInterval=sipCommonStatusCodeNotifInterval, sipCommonStatusCodeRowStatus=sipCommonStatusCodeRowStatus, sipCommonCfgTimerD=sipCommonCfgTimerD, sipCommonSummaryOutResponses=sipCommonSummaryOutResponses, sipCommonCfgServiceStartTime=sipCommonCfgServiceStartTime, sipCommonCfgTimerA=sipCommonCfgTimerA, sipCommonConfigTimerGroup=sipCommonConfigTimerGroup, sipCommonCfgTimerT4=sipCommonCfgTimerT4, sipCommonMethodSupportedIndex=sipCommonMethodSupportedIndex, sipCommonNotifGroup=sipCommonNotifGroup, sipCommonStatusCodeNotifEmitMode=sipCommonStatusCodeNotifEmitMode, sipCommonMethodStatsInbounds=sipCommonMethodStatsInbounds, sipCommonConfigGroup=sipCommonConfigGroup, sipCommonNotifApplIndex=sipCommonNotifApplIndex, sipCommonMIB=sipCommonMIB, sipCommonCfgTimerTable=sipCommonCfgTimerTable, sipCommonStatusCodeDisconTime=sipCommonStatusCodeDisconTime, sipCommonInformationalGroup=sipCommonInformationalGroup, sipCommonMethodStatsDisconTime=sipCommonMethodStatsDisconTime, sipCommonCfgTimerT1=sipCommonCfgTimerT1, sipCommonCfgOrganization=sipCommonCfgOrganization, sipCommonOtherStatsNumUnsupportedUris=sipCommonOtherStatsNumUnsupportedUris, sipCommonServiceWarmStart=sipCommonServiceWarmStart, sipCommonCfgTimerI=sipCommonCfgTimerI, sipCommonCfgTimerK=sipCommonCfgTimerK, sipCommonStatusCodeNotifSend=sipCommonStatusCodeNotifSend, sipCommonOtherStatsTable=sipCommonOtherStatsTable, sipCommonMIBNotifications=sipCommonMIBNotifications, sipCommonStatusCodeThreshExceededOutNotif=sipCommonStatusCodeThreshExceededOutNotif, sipCommonStatusCodeNotifCSeq=sipCommonStatusCodeNotifCSeq, sipCommonStatsRetryMethod=sipCommonStatsRetryMethod, sipCommonStatusCodeNotifGroup=sipCommonStatusCodeNotifGroup, sipCommonMIBGroups=sipCommonMIBGroups, sipCommonOtherStatsOtherwiseDiscardedMsgs=sipCommonOtherStatsOtherwiseDiscardedMsgs, sipCommonTransCurrentEntry=sipCommonTransCurrentEntry, sipCommonCfgEntry=sipCommonCfgEntry, sipCommonStatsTrans=sipCommonStatsTrans, sipCommonCfgServiceOperStatus=sipCommonCfgServiceOperStatus, sipCommonOtherStatsNumUnsupportedMethods=sipCommonOtherStatsNumUnsupportedMethods, sipCommonOptionTagIndex=sipCommonOptionTagIndex, sipCommonMethodStatsTable=sipCommonMethodStatsTable, sipCommonCfgTimerJ=sipCommonCfgTimerJ, sipCommonStatusCodeNotifThresh=sipCommonStatusCodeNotifThresh, sipCommonCfgTable=sipCommonCfgTable, sipCommonStatsRetries=sipCommonStatsRetries, sipCommonStatusCodeEntry=sipCommonStatusCodeEntry, sipCommonServiceColdStart=sipCommonServiceColdStart, sipCommonStatusCodeNotifFrom=sipCommonStatusCodeNotifFrom, sipCommonCfgTimerEntry=sipCommonCfgTimerEntry, sipCommonCfgTimerH=sipCommonCfgTimerH, sipCommonOtherStats=sipCommonOtherStats, sipCommonPortEntry=sipCommonPortEntry, sipCommonStatsRetry=sipCommonStatsRetry, sipCommonStatusCodeNotif=sipCommonStatusCodeNotif, sipCommonMethodStatsOutbounds=sipCommonMethodStatsOutbounds, sipCommonTransCurrentTable=sipCommonTransCurrentTable, sipCommonSummaryStatsTable=sipCommonSummaryStatsTable, sipCommonStatusCodeThreshExceededInNotif=sipCommonStatusCodeThreshExceededInNotif, sipCommonPortTransportRcv=sipCommonPortTransportRcv, sipCommonSummaryStatsEntry=sipCommonSummaryStatsEntry, sipCommonStatusCodeMethod=sipCommonStatusCodeMethod, sipCommonOtherStatsDisconTime=sipCommonOtherStatsDisconTime, sipCommonSummaryStats=sipCommonSummaryStats, sipCommonOptionTagHeaderField=sipCommonOptionTagHeaderField, sipCommonCfgTimerT2=sipCommonCfgTimerT2, sipCommonOtherStatsEntry=sipCommonOtherStatsEntry, sipCommonSummaryTotalTransactions=sipCommonSummaryTotalTransactions, sipCommonCfgTimerC=sipCommonCfgTimerC, sipCommonCfgMaxTransactions=sipCommonCfgMaxTransactions, sipCommonStatusCodeOuts=sipCommonStatusCodeOuts, sipCommonMethodSupportedTable=sipCommonMethodSupportedTable, sipCommonCfgProtocolVersion=sipCommonCfgProtocolVersion, sipCommonStatusCodeIns=sipCommonStatusCodeIns, sipCommonServiceStatusChanged=sipCommonServiceStatusChanged, sipCommonCfgTimerF=sipCommonCfgTimerF, sipCommonCfgBase=sipCommonCfgBase, sipCommonSummaryInRequests=sipCommonSummaryInRequests, sipCommonOptionTagEntry=sipCommonOptionTagEntry, sipCommonStatsGroup=sipCommonStatsGroup, sipCommonStatsRetryFinalResponses=sipCommonStatsRetryFinalResponses, sipCommonTransCurrentactions=sipCommonTransCurrentactions, PYSNMP_MODULE_ID=sipCommonMIB, sipCommonOptionTag=sipCommonOptionTag, sipCommonStatusCodeTable=sipCommonStatusCodeTable, sipCommonMethodSupportedEntry=sipCommonMethodSupportedEntry, sipCommonSummaryOutRequests=sipCommonSummaryOutRequests, sipCommonCfgServiceNotifEnable=sipCommonCfgServiceNotifEnable, sipCommonStatsRetryEntry=sipCommonStatsRetryEntry, sipCommonMethodSupportedName=sipCommonMethodSupportedName, sipCommonStatusCodeNotifEntry=sipCommonStatusCodeNotifEntry, sipCommonStatusCodeNotifCallId=sipCommonStatusCodeNotifCallId, sipCommonCfgTimerE=sipCommonCfgTimerE, sipCommonMIBCompliances=sipCommonMIBCompliances, sipCommonMethodStatsName=sipCommonMethodStatsName)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_intersection, constraints_union, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'SingleValueConstraint')
(inet_port_number,) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetPortNumber')
(appl_index,) = mibBuilder.importSymbols('NETWORK-SERVICES-MIB', 'applIndex')
(sip_tc_transport_protocol, sip_tc_entity_role, sip_tc_option_tag_headers, sip_tc_method_name) = mibBuilder.importSymbols('SIP-TC-MIB', 'SipTCTransportProtocol', 'SipTCEntityRole', 'SipTCOptionTagHeaders', 'SipTCMethodName')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(bits, module_identity, ip_address, notification_type, gauge32, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, mib_2, unsigned32, object_identity, mib_identifier, counter64, counter32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'ModuleIdentity', 'IpAddress', 'NotificationType', 'Gauge32', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'mib-2', 'Unsigned32', 'ObjectIdentity', 'MibIdentifier', 'Counter64', 'Counter32', 'Integer32')
(row_status, textual_convention, time_stamp, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TextualConvention', 'TimeStamp', 'TruthValue', 'DisplayString')
sip_common_mib = module_identity((1, 3, 6, 1, 2, 1, 149))
sipCommonMIB.setRevisions(('2007-04-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
sipCommonMIB.setRevisionsDescriptions(('Initial version of the IETF SIP-COMMON-MIB module. This version published as part of RFC 4780.',))
if mibBuilder.loadTexts:
sipCommonMIB.setLastUpdated('200704200000Z')
if mibBuilder.loadTexts:
sipCommonMIB.setOrganization('IETF Session Initiation Protocol Working Group')
if mibBuilder.loadTexts:
sipCommonMIB.setContactInfo('SIP WG email: sip@ietf.org Co-editor Kevin Lingle Cisco Systems, Inc. postal: 7025 Kit Creek Road P.O. Box 14987 Research Triangle Park, NC 27709 USA email: klingle@cisco.com phone: +1 919 476 2029 Co-editor Joon Maeng email: jmaeng@austin.rr.com Co-editor Jean-Francois Mule CableLabs postal: 858 Coal Creek Circle Louisville, CO 80027 USA email: jf.mule@cablelabs.com phone: +1 303 661 9100 Co-editor Dave Walker email: drwalker@rogers.com')
if mibBuilder.loadTexts:
sipCommonMIB.setDescription('Session Initiation Protocol (SIP) Common MIB module. This module defines objects that may be common to all SIP entities. SIP is an application-layer signaling protocol for creating, modifying and terminating multimedia sessions with one or more participants. These sessions include Internet multimedia conferences and Internet telephone calls. SIP is defined in RFC 3261 (June 2002). This MIB is defined for managing objects that are common to SIP User Agents (UAs), Proxy, Redirect, and Registrar servers. Objects specific to each of these entities MAY be managed using entity specific MIBs defined in other modules. Copyright (C) The IETF Trust (2007). This version of this MIB module is part of RFC 4780; see the RFC itself for full legal notices.')
sip_common_mib_notifications = mib_identifier((1, 3, 6, 1, 2, 1, 149, 0))
sip_common_mib_objects = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1))
sip_common_mib_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2))
sip_common_cfg_base = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 1))
sip_common_cfg_timer = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 2))
sip_common_summary_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 3))
sip_common_method_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 4))
sip_common_status_code = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 5))
sip_common_stats_trans = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 6))
sip_common_stats_retry = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 7))
sip_common_other_stats = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 8))
sip_common_notif_objects = mib_identifier((1, 3, 6, 1, 2, 1, 149, 1, 9))
sip_common_cfg_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 1))
if mibBuilder.loadTexts:
sipCommonCfgTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTable.setDescription('This table contains the common configuration objects applicable to all SIP entities.')
sip_common_cfg_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonCfgEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgEntry.setDescription('A row of common configuration. Each row represents objects for a particular SIP entity instance present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_cfg_protocol_version = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 1), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgProtocolVersion.setDescription("This object will reflect the version of SIP supported by this SIP entity. It will follow the same format as SIP version information contained in the SIP messages generated by this SIP entity. For example, entities supporting SIP version 2 will return 'SIP/2.0' as dictated by the standard.")
sip_common_cfg_service_oper_status = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('up', 2), ('down', 3), ('congested', 4), ('restarting', 5), ('quiescing', 6), ('testing', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceOperStatus.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceOperStatus.setDescription('This object contains the current operational state of the SIP application. unknown : The operational status cannot be determined for some reason. up : The application is operating normally and is processing (receiving and possibly issuing) SIP requests and responses. down : The application is currently unable to process SIP messages. congested : The application is operational but no additional inbound transactions can be accommodated at the moment. restarting : The application is currently unavailable, but it is in the process of restarting and will presumably, soon be able to process SIP messages. quiescing : The application is currently operational but has been administratively put into quiescence mode. Additional inbound transactions MAY be rejected. testing : The application is currently in test mode and MAY not be able to process SIP messages. The operational status values defined for this object are not based on any specific information contained in the SIP standard.')
sip_common_cfg_service_start_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 3), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceStartTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceStartTime.setDescription('The value of sysUpTime at the time the SIP entity was last started. If started prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sip_common_cfg_service_last_change = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgServiceLastChange.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceLastChange.setDescription('The value of sysUpTime at the time the SIP entity entered its current operational state. If the current state was entered prior to the last re-initialization of the local network management subsystem, then this object contains a zero value.')
sip_common_cfg_organization = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 5), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setReference('RFC 3261, Section 20.25')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgOrganization.setDescription('This object contains the organization name that the SIP entity inserts into Organization headers of SIP messages processed by this system. If the string is empty, no Organization header is to be generated.')
sip_common_cfg_max_transactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgMaxTransactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgMaxTransactions.setDescription("This object indicates the maximum number of simultaneous transactions per second that the SIP entity can manage. In general, the value of this object SHOULD reflect a level of transaction processing per second that is considered high enough to impact the system's CPU and/or memory resources to the point of deteriorating SIP call processing but not high enough to cause catastrophic system failure.")
sip_common_cfg_service_notif_enable = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 7), bits().clone(namedValues=named_values(('sipCommonServiceColdStart', 0), ('sipCommonServiceWarmStart', 1), ('sipCommonServiceStatusChanged', 2))).clone(namedValues=named_values(('sipCommonServiceColdStart', 0), ('sipCommonServiceWarmStart', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonCfgServiceNotifEnable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgServiceNotifEnable.setDescription("This object specifies which SIP service related notifications are enabled. Each bit represents a specific notification. If a bit has a value 1, the associated notification is enabled and will be generated by the SIP entity at the appropriate time. Support for these notifications is OPTIONAL: either none or all notification values are supported. If an implementation does not support this object, it should return a 'noSuchObject' exception to an SNMP GET operation. If notifications are supported, this object's default value SHOULD reflect sipCommonServiceColdStart and sipCommonServiceWarmStart enabled and sipCommonServiceStatusChanged disabled. This object value SHOULD persist across reboots.")
sip_common_cfg_entity_type = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 1, 1, 8), sip_tc_entity_role()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgEntityType.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgEntityType.setDescription('This object identifies the list of SIP entities to which this row is related. It is defined as a bit map. Each bit represents a type of SIP entity. If a bit has value 1, the SIP entity represented by this row plays the role of this entity type. If a bit has value 0, the SIP entity represented by this row does not act as this entity type. Combinations of bits can be set when the SIP entity plays multiple SIP roles.')
sip_common_port_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 2))
if mibBuilder.loadTexts:
sipCommonPortTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortTable.setDescription('This table contains the list of ports that each SIP entity in this system is allowed to use. These ports can be advertised using the Contact header in a REGISTER request or response.')
sip_common_port_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonPort'))
if mibBuilder.loadTexts:
sipCommonPortEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortEntry.setDescription('Specification of a particular port. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_port = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 1), inet_port_number().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
sipCommonPort.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPort.setDescription('This object reflects a particular port that can be used by the SIP application.')
sip_common_port_transport_rcv = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 2, 1, 2), sip_tc_transport_protocol()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonPortTransportRcv.setStatus('current')
if mibBuilder.loadTexts:
sipCommonPortTransportRcv.setDescription('This object will specify the transport protocol the SIP entity will use to receive SIP messages. This object is a bit map. Each bit represents a transport protocol. If a bit has value 1, then that transport protocol is currently being used. If a bit has value 0, then that transport protocol is currently not being used.')
sip_common_option_tag_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 3))
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setReference('RFC 3261, Sections 19.2, 20.32, 20.29, 20.37, and 20.40')
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagTable.setDescription("This table contains a list of the SIP option tags (SIP extensions) that are either required, supported, or unsupported by the SIP entity. These option tags are used in the Require, Proxy-Require, Supported, and Unsupported header fields. Example: If a user agent client supports, and requires the server to support, reliability of provisional responses (RFC 3262), this table contains a row with the option tag string '100rel' in sipCommonOptionTag and the OCTET STRING value of '1010 0000' or '0xA0' in sipCommonOptionTagHeaderField. If a server does not support the required feature (indicated in a Require header to a UAS, or in a Proxy-Require to a Proxy Server), the server returns a 420 Bad Extension listing the feature in an Unsupported header. Normally, the list of such features supported by an entity is static (i.e., will not change over time).")
sip_common_option_tag_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonOptionTagIndex'))
if mibBuilder.loadTexts:
sipCommonOptionTagEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagEntry.setDescription('A particular SIP option tag (extension) supported or unsupported by the SIP entity, and which may be supported or required by a peer. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_option_tag_index = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)))
if mibBuilder.loadTexts:
sipCommonOptionTagIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagIndex.setDescription('This object uniquely identifies a conceptual row in the table.')
sip_common_option_tag = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 2), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOptionTag.setReference('RFC 3261, Section 27.1')
if mibBuilder.loadTexts:
sipCommonOptionTag.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTag.setDescription('This object indicates the SIP option tag. The option tag names are registered with IANA and available at http://www.iana.org.')
sip_common_option_tag_header_field = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 3, 1, 3), sip_tc_option_tag_headers()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOptionTagHeaderField.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOptionTagHeaderField.setDescription('This object indicates whether the SIP option tag is supported (Supported header), unsupported (Unsupported header), or required (Require or Proxy-Require header) by the SIP entity. A SIP option tag may be both supported and required.')
sip_common_method_supported_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 1, 4))
if mibBuilder.loadTexts:
sipCommonMethodSupportedTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedTable.setDescription('This table contains a list of methods supported by each SIP entity in this system (see the standard set of SIP methods in Section 7.1 of RFC 3261). Any additional methods that may be incorporated into the SIP protocol can be represented by this table without any requirement to update this MIB module. The table is informational in nature and conveys capabilities of the managed system to the SNMP Manager. From a protocol point of view, the list of methods advertised by the SIP entity in the Allow header (Section 20.5 of RFC 3261) MUST be consistent with the methods reflected in this table.')
sip_common_method_supported_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonMethodSupportedIndex'))
if mibBuilder.loadTexts:
sipCommonMethodSupportedEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedEntry.setDescription('A particular method supported by the SIP entity. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_method_supported_index = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)))
if mibBuilder.loadTexts:
sipCommonMethodSupportedIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedIndex.setDescription('This object uniquely identifies a conceptual row in the table and reflects an assigned number used to identify a specific SIP method. This identifier is suitable for referencing the associated method throughout this and other MIBs supported by this managed system.')
sip_common_method_supported_name = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 1, 4, 1, 2), sip_tc_method_name()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodSupportedName.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodSupportedName.setDescription("This object reflects the supported method's name. The method name MUST be all upper case (e.g., 'INVITE').")
sip_common_cfg_timer_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 2, 1))
if mibBuilder.loadTexts:
sipCommonCfgTimerTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerTable.setDescription('This table contains timer configuration objects applicable to SIP user agent and SIP stateful Proxy Server entities.')
sip_common_cfg_timer_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonCfgTimerEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerEntry.setDescription('A row of timer configuration. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788). The objects in this table entry SHOULD be non-volatile and their value SHOULD be kept at reboot.')
sip_common_cfg_timer_a = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerA.setDescription('This object reflects the initial value for the retransmit timer for the INVITE method. The retransmit timer doubles after each retransmission, ensuring an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to an INVITE before resending the INVITE request.')
sip_common_cfg_timer_b = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerB.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to an INVITE. The timer is started upon transmission of the initial INVITE request.')
sip_common_cfg_timer_c = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(180000, 300000)).clone(180000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setReference('RFC 3261, Section 16.6')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerC.setDescription('This object reflects the maximum time a SIP Proxy Server will wait to receive a provisional response to an INVITE. The Timer C MUST be set for each client transaction when an INVITE request is proxied.')
sip_common_cfg_timer_d = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setReference('RFC 3261, Section 17.1.1.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerD.setDescription("This object reflects the amount of time that the server transaction can remain in the 'Completed' state when unreliable transports are used. The default value MUST be equal to or greater than 32000 for UDP transport, and its value MUST be 0 for TCP/SCTP transport.")
sip_common_cfg_timer_e = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerE.setDescription("This object reflects the initial value for the retransmit timer for a non-INVITE method while in 'Trying' state. The retransmit timer doubles after each retransmission until it reaches T2 to ensure an exponential backoff in network traffic. This object represents the initial time a SIP entity will wait to receive a provisional response to the request before resending the non-INVITE request.")
sip_common_cfg_timer_f = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerF.setDescription('This object reflects the maximum time a SIP entity will wait to receive a final response to a non-INVITE request. The timer is started upon transmission of the initial request.')
sip_common_cfg_timer_g = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 7), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 1000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerG.setDescription('This object reflects the initial value for the retransmit timer for final responses to INVITE requests. If timer G fires, the response is passed to the transport layer again for retransmission, and timer G is set to fire in MIN(2*T1, T2) seconds. From then on, when timer G fires, the response is passed to the transport again for transmission, and timer G is reset with a value that doubles, unless that value exceeds T2, in which case, it is reset with the value of T2. The default value MUST be T1 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.')
sip_common_cfg_timer_h = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 8), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerH.setDescription("This object reflects the maximum time a server will wait to receive an ACK before it abandons retransmitting the response. The timer is started upon entering the 'Completed' state.")
sip_common_cfg_timer_i = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 9), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setReference('RFC 3261, Section 17.2.1')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerI.setDescription("This object reflects the maximum time a SIP entity will wait to receive additional ACK message retransmissions. The timer is started upon entering the 'Confirmed' state. The default value MUST be T4 for UDP transport and its value MUST be 0 for reliable transport like TCP/SCTP.")
sip_common_cfg_timer_j = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 10), unsigned32().subtype(subtypeSpec=value_range_constraint(32000, 300000)).clone(32000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setReference('RFC 3261, Section 17.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerJ.setDescription("This object reflects the maximum time a SIP server will wait to receive retransmissions of non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer J fires, the server MUST transition to the 'Terminated' state.")
sip_common_cfg_timer_k = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 11), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setReference('RFC 3261, Section 17.1.2.2')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerK.setDescription("This object reflects the maximum time a SIP client will wait to receive retransmissions of responses to non-INVITE requests. The timer is started upon entering the 'Completed' state for non-INVITE transactions. When timer K fires, the server MUST transition to the 'Terminated' state. The default value MUST be T4 for UDP transport, and its value MUST be 0 for reliable transport like TCP/SCTP.")
sip_common_cfg_timer_t1 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 12), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(500)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT1.setDescription('This object reflects the T1 timer for a SIP entity. T1 is an estimate of the round-trip time (RTT) between the client and server transactions.')
sip_common_cfg_timer_t2 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 13), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(4000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT2.setDescription("This object reflects the T2 timer for a SIP entity. T2 is the maximum retransmit interval for non-INVITE requests and INVITE responses. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sip_common_cfg_timer_t4 = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 2, 1, 1, 14), unsigned32().subtype(subtypeSpec=value_range_constraint(200, 10000)).clone(5000)).setUnits('milliseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setReference('RFC 3261, Section 17')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCfgTimerT4.setDescription("This object reflects the T4 timer for a SIP entity. T4 is the maximum duration a message will remain in the network. It represents the amount of time the network will take to clear messages between client and server transactions. It's used in various parts of the protocol to reset other Timer* objects to this value.")
sip_common_summary_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 3, 1))
if mibBuilder.loadTexts:
sipCommonSummaryStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryStatsTable.setDescription('This table contains the summary statistics objects applicable to all SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sip_common_summary_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonSummaryStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryStatsEntry.setDescription('A row of summary statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_summary_in_requests = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryInRequests.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryInRequests.setDescription('This object indicates the total number of SIP request messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_out_requests = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryOutRequests.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryOutRequests.setDescription('This object contains the total number of SIP request messages sent out (originated and relayed) by the SIP entity. Where a particular message is sent more than once, for example as a retransmission or as a result of forking, each transmission is counted separately. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_in_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryInResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryInResponses.setDescription('This object contains the total number of SIP response messages received by the SIP entity, including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_out_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryOutResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryOutResponses.setDescription('This object contains the total number of SIP response messages sent (originated and relayed) by the SIP entity including retransmissions. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.')
sip_common_summary_total_transactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryTotalTransactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryTotalTransactions.setDescription("This object contains a count of the number of transactions that are in progress and transactions that have reached the 'Terminated' state. It is not applicable to stateless SIP Proxy Servers. A SIP transaction occurs between a client and a server, and comprises all messages from the first request sent from the client to the server, up to a final (non-1xx) response sent from the server to the client. If the request is INVITE and the final response is a non-2xx, the transaction also include an ACK to the response. The ACK for a 2xx response to an INVITE request is a separate transaction. The branch ID parameter in the Via header field values serves as a transaction identifier. A transaction is identified by the CSeq sequence number within a single call leg. The ACK request has the same CSeq number as the corresponding INVITE request, but comprises a transaction of its own. In the case of a forked request, each branch counts as a single transaction. For a transaction stateless Proxy Server, this counter is always 0. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonSummaryDisconTime object in the same row.")
sip_common_summary_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 3, 1, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonSummaryDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonSummaryDisconTime.setDescription('The value of the sysUpTime object when the counters for the summary statistics objects in this row last experienced a discontinuity.')
sip_common_method_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 4, 1))
if mibBuilder.loadTexts:
sipCommonMethodStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsTable.setDescription('This table contains the method statistics objects for SIP entities. Each row represents those objects for a particular SIP entity present in this system.')
sip_common_method_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonMethodStatsName'))
if mibBuilder.loadTexts:
sipCommonMethodStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsEntry.setDescription('A row of per entity method statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_method_stats_name = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonMethodStatsName.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsName.setDescription('This object uniquely identifies the SIP method related to the objects in a particular row.')
sip_common_method_stats_outbounds = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsOutbounds.setDescription('This object reflects the total number of requests sent by the SIP entity, excluding retransmissions. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sip_common_method_stats_inbounds = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setReference('RFC 3261, Section 7.1')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsInbounds.setDescription('This object reflects the total number of requests received by the SIP entity. Retransmissions are counted separately and are not reflected in this counter. A Management Station can detect discontinuities in this counter by monitoring the sipCommonMethodStatsDisconTime object in the same row.')
sip_common_method_stats_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 4, 1, 1, 4), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonMethodStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonMethodStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the method statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 5, 1))
if mibBuilder.loadTexts:
sipCommonStatusCodeTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeTable.setDescription('This table contains the list of SIP status codes that each SIP entity in this system has been requested to monitor. It is the mechanism by which specific status codes are monitored. Entries created in this table must not persist across reboots.')
sip_common_status_code_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonStatusCodeMethod'), (0, 'SIP-COMMON-MIB', 'sipCommonStatusCodeValue'))
if mibBuilder.loadTexts:
sipCommonStatusCodeEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeEntry.setDescription('This row contains information on a particular SIP status code that the SIP entity has been requested to monitor. Entries created in this table must not persist across reboots. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_status_code_method = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonStatusCodeMethod.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeMethod.setDescription('This object uniquely identifies a conceptual row in the table.')
sip_common_status_code_value = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(100, 999)))
if mibBuilder.loadTexts:
sipCommonStatusCodeValue.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeValue.setDescription('This object contains a SIP status code value that the SIP entity has been requested to monitor. All of the other information in the row is related to this value.')
sip_common_status_code_ins = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeIns.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeIns.setDescription('This object reflects the total number of response messages received by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sip_common_status_code_outs = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeOuts.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeOuts.setDescription('This object reflects the total number of response messages sent by the SIP entity with the status code value contained in the sipCommonStatusCodeValue column. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service, or when the monitoring of the Status code is temporarily disabled. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatusCodeDisconTime object in the same row.')
sip_common_status_code_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
sipCommonStatusCodeRowStatus.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeRowStatus.setDescription("The row augmentation in sipCommonStatusCodeNotifTable will be governed by the value of this RowStatus. The values 'createAndGo' and 'destroy' are the only valid values allowed for this object. If a row exists, it will reflect a status of 'active' when queried.")
sip_common_status_code_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 1, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatusCodeDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeDisconTime.setDescription('The value of the sysUpTime object when the counters for the status code statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_notif_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 5, 2))
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTable.setDescription('This table contains objects to control notifications related to particular status codes that each SIP entity in this system has been requested to monitor. There is an entry in this table corresponding to each entry in sipCommonStatusCodeTable. Therefore, this table augments sipCommonStatusCodeTable and utilizes the same index methodology. The objects in this table are not included directly in the sipCommonStatusCodeTable simply to keep the status code notification control objects separate from the actual status code statistics.')
sip_common_status_code_notif_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1))
sipCommonStatusCodeEntry.registerAugmentions(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifEntry'))
sipCommonStatusCodeNotifEntry.setIndexNames(*sipCommonStatusCodeEntry.getIndexNames())
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEntry.setDescription('This row contains information controlling notifications for a particular SIP status code that the SIP entity has been requested to monitor.')
sip_common_status_code_notif_send = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 1), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifSend.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifSend.setDescription("This object controls whether a sipCommonStatusCodeNotif is emitted when the status code value specified by sipCommonStatusCodeValue is sent or received. If the value of this object is 'true', then a notification is sent. If it is 'false', no notification is sent. Note well that a notification MAY be emitted for every message sent or received that contains the particular status code. Depending on the status code involved, this can cause a significant number of notification emissions that could be detrimental to network performance. Managers are forewarned to be prudent in the use of this object to enable notifications. Look to sipCommonStatusCodeNotifEmitMode for alternative controls for sipCommonStatusCodeNotif emissions.")
sip_common_status_code_notif_emit_mode = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('normal', 1), ('oneShot', 2), ('triggered', 3))).clone('oneShot')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEmitMode.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifEmitMode.setDescription("The object sipCommonStatusCodeNotifSend MUST be set to 'true' for the values of this object to have any effect. It is RECOMMENDED that the desired emit mode be established by this object prior to setting sipCommonStatusCodeNotifSend to 'true'. This object and the sipCommonStatusCodeNotifSend object can obviously be set independently, but their respective values will have a dependency on each other and the resulting notifications. This object specifies the mode for emissions of sipCommonStatusCodeNotif notifications. normal : sipCommonStatusCodeNotif notifications will be emitted by the system for each SIP response message sent or received that contains the desired status code. oneShot : Only one sipCommonStatusCodeNotif notification will be emitted. It will be the next SIP response message sent or received that contains the desired status code. No more notifications are emitted until this object is set to 'oneShot' again or set to 'normal'. This option is provided as a means of quelling the potential promiscuous behavior that can be associated with the sipCommonStatusCodeNotif. triggered : This value is only readable and cannot be set. It reflects that the 'oneShot' case has occurred, and indicates that the mode needs to be reset to get further notifications. The mode is reset by setting this object to 'oneShot' or 'normal'.")
sip_common_status_code_notif_thresh = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 3), unsigned32().clone(500)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifThresh.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifThresh.setDescription('This object specifies the number of response messages sent or received by this system that are considered excessive. Based on crossing that threshold, a sipCommonStatusCodeThreshExceededInNotif notification or a sipCommonStatusCodeThreshExceededOutNotif will be sent. The sipCommonStatusCodeThreshExceededInNotif and sipCommonStatusCodeThreshExceededOutNotif notifications can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sip_common_status_code_notif_interval = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 5, 2, 1, 4), unsigned32().clone(60)).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifInterval.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifInterval.setDescription('This object specifies the time interval over which, if sipCommonStatusCodeThresh is exceeded with respect to sent or received messages, a sipCommonStatusCodeThreshExceededInNotif or sipCommonStatusCodeThreshExceededOutNotif notification will be sent. Note that the configuration applied by this object will be applied equally to inbound and outbound response messages.')
sip_common_trans_current_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 6, 1))
if mibBuilder.loadTexts:
sipCommonTransCurrentTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentTable.setDescription('This table contains information on the transactions currently awaiting definitive responses by each SIP entity in this system. This table does not apply to transaction stateless Proxy Servers.')
sip_common_trans_current_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonTransCurrentEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentEntry.setDescription("Information on a particular SIP entity's current transactions. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sip_common_trans_currentactions = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 6, 1, 1, 1), gauge32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonTransCurrentactions.setStatus('current')
if mibBuilder.loadTexts:
sipCommonTransCurrentactions.setDescription('This object contains the number of transactions awaiting definitive (non-1xx) response. In the case of a forked request, each branch counts as a single transaction corresponding to the entity identified by applIndex.')
sip_common_stats_retry_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 7, 1))
if mibBuilder.loadTexts:
sipCommonStatsRetryTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryTable.setDescription('This table contains retry statistics objects applicable to each SIP entity in this system.')
sip_common_stats_retry_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'), (0, 'SIP-COMMON-MIB', 'sipCommonStatsRetryMethod'))
if mibBuilder.loadTexts:
sipCommonStatsRetryEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryEntry.setDescription('A row of retry statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).')
sip_common_stats_retry_method = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 1), sip_tc_method_name())
if mibBuilder.loadTexts:
sipCommonStatsRetryMethod.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryMethod.setDescription('This object uniquely identifies the SIP method related to the objects in a row.')
sip_common_stats_retries = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetries.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetries.setDescription('This object reflects the total number of request retransmissions that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_final_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryFinalResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryFinalResponses.setDescription('This object reflects the total number of Final Response retries that have been sent by the SIP entity. Note that there could be multiple retransmissions per request. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_non_final_responses = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryNonFinalResponses.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryNonFinalResponses.setDescription('This object reflects the total number of non-Final Response retries that have been sent by the SIP entity. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonStatsRetryDisconTime object in the same row.')
sip_common_stats_retry_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 7, 1, 1, 5), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonStatsRetryDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryDisconTime.setDescription('The value of the sysUpTime object when the counters for the retry statistics objects in this row last experienced a discontinuity.')
sip_common_other_stats_table = mib_table((1, 3, 6, 1, 2, 1, 149, 1, 8, 1))
if mibBuilder.loadTexts:
sipCommonOtherStatsTable.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsTable.setDescription('This table contains other common statistics supported by each SIP entity in this system.')
sip_common_other_stats_entry = mib_table_row((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipCommonOtherStatsEntry.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsEntry.setDescription("Information on a particular SIP entity's other common statistics. Each row represents those objects for a particular SIP entity present in this system. applIndex is used to uniquely identify these instances of SIP entities and correlate them through the common framework of the NETWORK-SERVICES-MIB (RFC 2788).")
sip_common_other_stats_num_unsupported_uris = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedUris.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedUris.setDescription('Number of RequestURIs received with an unsupported scheme. A server normally responds to such requests with a 400 Bad Request status code. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_num_unsupported_methods = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedMethods.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsNumUnsupportedMethods.setDescription('Number of SIP requests received with unsupported methods. A server normally responds to such requests with a 501 (Not Implemented) or 405 (Method Not Allowed). Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_otherwise_discarded_msgs = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsOtherwiseDiscardedMsgs.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsOtherwiseDiscardedMsgs.setDescription('Number of SIP messages received that, for any number of reasons, was discarded without a response. Discontinuities in the value of this counter can occur at re-initialization of the SIP entity or service. A Management Station can detect discontinuities in this counter by monitoring the sipCommonOtherStatsDisconTime object in the same row.')
sip_common_other_stats_discon_time = mib_table_column((1, 3, 6, 1, 2, 1, 149, 1, 8, 1, 1, 4), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipCommonOtherStatsDisconTime.setStatus('current')
if mibBuilder.loadTexts:
sipCommonOtherStatsDisconTime.setDescription('The value of the sysUpTime object when the counters for the statistics objects in this row last experienced a discontinuity.')
sip_common_status_code_notif_to = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 1), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTo.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifTo.setDescription("This object contains the value of the To header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'To: Watson '.")
sip_common_status_code_notif_from = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 2), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifFrom.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifFrom.setDescription("This object contains the value of the From header in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'From: Watson '.")
sip_common_status_code_notif_call_id = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 3), snmp_admin_string()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCallId.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCallId.setDescription("This object contains the value of the Call-ID in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'Call-ID: 5551212@example.com'.")
sip_common_status_code_notif_c_seq = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 4), unsigned32()).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCSeq.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifCSeq.setDescription("This object contains the CSeq value in the message containing the status code that caused the notification. The header name will be part of this object value. For example, 'CSeq: 1722 INVITE'.")
sip_common_notif_appl_index = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonNotifApplIndex.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifApplIndex.setDescription('This object contains the applIndex as described in RFC 2788. This object is created in order to allow a variable binding containing a value of applIndex in a notification.')
sip_common_notif_sequence_number = mib_scalar((1, 3, 6, 1, 2, 1, 149, 1, 9, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
sipCommonNotifSequenceNumber.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifSequenceNumber.setDescription('This object contains a sequence number for each notification generated by this SIP entity. Each notification SHOULD have a unique sequence number. A network manager can use this information to determine whether notifications from a particular SIP entity have been missed. The value of this object MUST start at 1 and increase by 1 with each generated notification. If a system restarts, the sequence number MAY start again from 1.')
sip_common_status_code_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifTo'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifFrom'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCallId'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCSeq'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'))
if mibBuilder.loadTexts:
sipCommonStatusCodeNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotif.setDescription('Signifies that a specific status code has been sent or received by the system.')
sip_common_status_code_thresh_exceeded_in_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 2)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'))
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededInNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededInNotif.setDescription('Signifies that a specific status code was found to have been received by the system frequently enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sip_common_status_code_thresh_exceeded_out_notif = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 3)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'))
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededOutNotif.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeThreshExceededOutNotif.setDescription('Signifies that a specific status code was found to have been sent by the system enough to exceed the configured threshold. This notification can be used as an early warning mechanism in lieu of using sipCommonStatusCodeNotif.')
sip_common_service_cold_start = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 4)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceStartTime'))
if mibBuilder.loadTexts:
sipCommonServiceColdStart.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceColdStart.setDescription("Signifies that the SIP service has reinitialized itself or started for the first time. This SHOULD result from a hard 'down' to 'up' administrative status change. The configuration or behavior of the service MAY be altered.")
sip_common_service_warm_start = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 5)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'))
if mibBuilder.loadTexts:
sipCommonServiceWarmStart.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceWarmStart.setDescription("Signifies that the SIP service has reinitialized itself and is restarting after an administrative 'reset'. The configuration or behavior of the service MAY be altered.")
sip_common_service_status_changed = notification_type((1, 3, 6, 1, 2, 1, 149, 0, 6)).setObjects(('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceOperStatus'))
if mibBuilder.loadTexts:
sipCommonServiceStatusChanged.setStatus('current')
if mibBuilder.loadTexts:
sipCommonServiceStatusChanged.setDescription('Signifies that the SIP service operational status has changed.')
sip_common_mib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2, 1))
sip_common_mib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 149, 2, 2))
sip_common_compliance = module_compliance((1, 3, 6, 1, 2, 1, 149, 2, 1, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonConfigGroup'), ('SIP-COMMON-MIB', 'sipCommonStatsGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_compliance = sipCommonCompliance.setStatus('current')
if mibBuilder.loadTexts:
sipCommonCompliance.setDescription('The compliance statement for SIP entities.')
sip_common_config_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 1)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgProtocolVersion'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceOperStatus'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceStartTime'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceLastChange'), ('SIP-COMMON-MIB', 'sipCommonPortTransportRcv'), ('SIP-COMMON-MIB', 'sipCommonOptionTag'), ('SIP-COMMON-MIB', 'sipCommonOptionTagHeaderField'), ('SIP-COMMON-MIB', 'sipCommonCfgMaxTransactions'), ('SIP-COMMON-MIB', 'sipCommonCfgServiceNotifEnable'), ('SIP-COMMON-MIB', 'sipCommonCfgEntityType'), ('SIP-COMMON-MIB', 'sipCommonMethodSupportedName'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_config_group = sipCommonConfigGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonConfigGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sip_common_informational_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 2)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgOrganization'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_informational_group = sipCommonInformationalGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonInformationalGroup.setDescription('A collection of objects providing configuration common to all SIP entities.')
sip_common_config_timer_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 3)).setObjects(('SIP-COMMON-MIB', 'sipCommonCfgTimerA'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerB'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerC'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerD'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerE'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerF'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerG'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerH'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerI'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerJ'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerK'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT1'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT2'), ('SIP-COMMON-MIB', 'sipCommonCfgTimerT4'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_config_timer_group = sipCommonConfigTimerGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonConfigTimerGroup.setDescription('A collection of objects providing timer configuration common to all SIP entities.')
sip_common_stats_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 4)).setObjects(('SIP-COMMON-MIB', 'sipCommonSummaryInRequests'), ('SIP-COMMON-MIB', 'sipCommonSummaryOutRequests'), ('SIP-COMMON-MIB', 'sipCommonSummaryInResponses'), ('SIP-COMMON-MIB', 'sipCommonSummaryOutResponses'), ('SIP-COMMON-MIB', 'sipCommonSummaryTotalTransactions'), ('SIP-COMMON-MIB', 'sipCommonSummaryDisconTime'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsOutbounds'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsInbounds'), ('SIP-COMMON-MIB', 'sipCommonMethodStatsDisconTime'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeIns'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeOuts'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeRowStatus'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeDisconTime'), ('SIP-COMMON-MIB', 'sipCommonTransCurrentactions'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsNumUnsupportedUris'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsNumUnsupportedMethods'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsOtherwiseDiscardedMsgs'), ('SIP-COMMON-MIB', 'sipCommonOtherStatsDisconTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_stats_group = sipCommonStatsGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsGroup.setDescription('A collection of objects providing statistics common to all SIP entities.')
sip_common_stats_retry_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 5)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatsRetries'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryFinalResponses'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryNonFinalResponses'), ('SIP-COMMON-MIB', 'sipCommonStatsRetryDisconTime'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_stats_retry_group = sipCommonStatsRetryGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatsRetryGroup.setDescription('A collection of objects providing retry statistics.')
sip_common_notif_group = notification_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 6)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotif'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeThreshExceededInNotif'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeThreshExceededOutNotif'), ('SIP-COMMON-MIB', 'sipCommonServiceColdStart'), ('SIP-COMMON-MIB', 'sipCommonServiceWarmStart'), ('SIP-COMMON-MIB', 'sipCommonServiceStatusChanged'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_notif_group = sipCommonNotifGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifGroup.setDescription('A collection of notifications common to all SIP entities.')
sip_common_status_code_notif_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 7)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifSend'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifEmitMode'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifThresh'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifInterval'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_status_code_notif_group = sipCommonStatusCodeNotifGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonStatusCodeNotifGroup.setDescription('A collection of objects related to the control and attribution of notifications common to all SIP entities.')
sip_common_notif_objects_group = object_group((1, 3, 6, 1, 2, 1, 149, 2, 2, 8)).setObjects(('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifTo'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifFrom'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCallId'), ('SIP-COMMON-MIB', 'sipCommonStatusCodeNotifCSeq'), ('SIP-COMMON-MIB', 'sipCommonNotifApplIndex'), ('SIP-COMMON-MIB', 'sipCommonNotifSequenceNumber'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
sip_common_notif_objects_group = sipCommonNotifObjectsGroup.setStatus('current')
if mibBuilder.loadTexts:
sipCommonNotifObjectsGroup.setDescription('A collection of accessible-for-notify objects related to the notification defined in this MIB module.')
mibBuilder.exportSymbols('SIP-COMMON-MIB', sipCommonStatusCodeNotifTable=sipCommonStatusCodeNotifTable, sipCommonStatsRetryNonFinalResponses=sipCommonStatsRetryNonFinalResponses, sipCommonStatusCodeValue=sipCommonStatusCodeValue, sipCommonMIBConformance=sipCommonMIBConformance, sipCommonPortTable=sipCommonPortTable, sipCommonMethodStats=sipCommonMethodStats, sipCommonCfgTimer=sipCommonCfgTimer, sipCommonOptionTagTable=sipCommonOptionTagTable, sipCommonCfgServiceLastChange=sipCommonCfgServiceLastChange, sipCommonNotifObjectsGroup=sipCommonNotifObjectsGroup, sipCommonMIBObjects=sipCommonMIBObjects, sipCommonCfgTimerG=sipCommonCfgTimerG, sipCommonSummaryInResponses=sipCommonSummaryInResponses, sipCommonCompliance=sipCommonCompliance, sipCommonSummaryDisconTime=sipCommonSummaryDisconTime, sipCommonStatusCode=sipCommonStatusCode, sipCommonCfgEntityType=sipCommonCfgEntityType, sipCommonCfgTimerB=sipCommonCfgTimerB, sipCommonStatusCodeNotifTo=sipCommonStatusCodeNotifTo, sipCommonStatsRetryGroup=sipCommonStatsRetryGroup, sipCommonNotifSequenceNumber=sipCommonNotifSequenceNumber, sipCommonNotifObjects=sipCommonNotifObjects, sipCommonStatsRetryDisconTime=sipCommonStatsRetryDisconTime, sipCommonPort=sipCommonPort, sipCommonMethodStatsEntry=sipCommonMethodStatsEntry, sipCommonStatsRetryTable=sipCommonStatsRetryTable, sipCommonStatusCodeNotifInterval=sipCommonStatusCodeNotifInterval, sipCommonStatusCodeRowStatus=sipCommonStatusCodeRowStatus, sipCommonCfgTimerD=sipCommonCfgTimerD, sipCommonSummaryOutResponses=sipCommonSummaryOutResponses, sipCommonCfgServiceStartTime=sipCommonCfgServiceStartTime, sipCommonCfgTimerA=sipCommonCfgTimerA, sipCommonConfigTimerGroup=sipCommonConfigTimerGroup, sipCommonCfgTimerT4=sipCommonCfgTimerT4, sipCommonMethodSupportedIndex=sipCommonMethodSupportedIndex, sipCommonNotifGroup=sipCommonNotifGroup, sipCommonStatusCodeNotifEmitMode=sipCommonStatusCodeNotifEmitMode, sipCommonMethodStatsInbounds=sipCommonMethodStatsInbounds, sipCommonConfigGroup=sipCommonConfigGroup, sipCommonNotifApplIndex=sipCommonNotifApplIndex, sipCommonMIB=sipCommonMIB, sipCommonCfgTimerTable=sipCommonCfgTimerTable, sipCommonStatusCodeDisconTime=sipCommonStatusCodeDisconTime, sipCommonInformationalGroup=sipCommonInformationalGroup, sipCommonMethodStatsDisconTime=sipCommonMethodStatsDisconTime, sipCommonCfgTimerT1=sipCommonCfgTimerT1, sipCommonCfgOrganization=sipCommonCfgOrganization, sipCommonOtherStatsNumUnsupportedUris=sipCommonOtherStatsNumUnsupportedUris, sipCommonServiceWarmStart=sipCommonServiceWarmStart, sipCommonCfgTimerI=sipCommonCfgTimerI, sipCommonCfgTimerK=sipCommonCfgTimerK, sipCommonStatusCodeNotifSend=sipCommonStatusCodeNotifSend, sipCommonOtherStatsTable=sipCommonOtherStatsTable, sipCommonMIBNotifications=sipCommonMIBNotifications, sipCommonStatusCodeThreshExceededOutNotif=sipCommonStatusCodeThreshExceededOutNotif, sipCommonStatusCodeNotifCSeq=sipCommonStatusCodeNotifCSeq, sipCommonStatsRetryMethod=sipCommonStatsRetryMethod, sipCommonStatusCodeNotifGroup=sipCommonStatusCodeNotifGroup, sipCommonMIBGroups=sipCommonMIBGroups, sipCommonOtherStatsOtherwiseDiscardedMsgs=sipCommonOtherStatsOtherwiseDiscardedMsgs, sipCommonTransCurrentEntry=sipCommonTransCurrentEntry, sipCommonCfgEntry=sipCommonCfgEntry, sipCommonStatsTrans=sipCommonStatsTrans, sipCommonCfgServiceOperStatus=sipCommonCfgServiceOperStatus, sipCommonOtherStatsNumUnsupportedMethods=sipCommonOtherStatsNumUnsupportedMethods, sipCommonOptionTagIndex=sipCommonOptionTagIndex, sipCommonMethodStatsTable=sipCommonMethodStatsTable, sipCommonCfgTimerJ=sipCommonCfgTimerJ, sipCommonStatusCodeNotifThresh=sipCommonStatusCodeNotifThresh, sipCommonCfgTable=sipCommonCfgTable, sipCommonStatsRetries=sipCommonStatsRetries, sipCommonStatusCodeEntry=sipCommonStatusCodeEntry, sipCommonServiceColdStart=sipCommonServiceColdStart, sipCommonStatusCodeNotifFrom=sipCommonStatusCodeNotifFrom, sipCommonCfgTimerEntry=sipCommonCfgTimerEntry, sipCommonCfgTimerH=sipCommonCfgTimerH, sipCommonOtherStats=sipCommonOtherStats, sipCommonPortEntry=sipCommonPortEntry, sipCommonStatsRetry=sipCommonStatsRetry, sipCommonStatusCodeNotif=sipCommonStatusCodeNotif, sipCommonMethodStatsOutbounds=sipCommonMethodStatsOutbounds, sipCommonTransCurrentTable=sipCommonTransCurrentTable, sipCommonSummaryStatsTable=sipCommonSummaryStatsTable, sipCommonStatusCodeThreshExceededInNotif=sipCommonStatusCodeThreshExceededInNotif, sipCommonPortTransportRcv=sipCommonPortTransportRcv, sipCommonSummaryStatsEntry=sipCommonSummaryStatsEntry, sipCommonStatusCodeMethod=sipCommonStatusCodeMethod, sipCommonOtherStatsDisconTime=sipCommonOtherStatsDisconTime, sipCommonSummaryStats=sipCommonSummaryStats, sipCommonOptionTagHeaderField=sipCommonOptionTagHeaderField, sipCommonCfgTimerT2=sipCommonCfgTimerT2, sipCommonOtherStatsEntry=sipCommonOtherStatsEntry, sipCommonSummaryTotalTransactions=sipCommonSummaryTotalTransactions, sipCommonCfgTimerC=sipCommonCfgTimerC, sipCommonCfgMaxTransactions=sipCommonCfgMaxTransactions, sipCommonStatusCodeOuts=sipCommonStatusCodeOuts, sipCommonMethodSupportedTable=sipCommonMethodSupportedTable, sipCommonCfgProtocolVersion=sipCommonCfgProtocolVersion, sipCommonStatusCodeIns=sipCommonStatusCodeIns, sipCommonServiceStatusChanged=sipCommonServiceStatusChanged, sipCommonCfgTimerF=sipCommonCfgTimerF, sipCommonCfgBase=sipCommonCfgBase, sipCommonSummaryInRequests=sipCommonSummaryInRequests, sipCommonOptionTagEntry=sipCommonOptionTagEntry, sipCommonStatsGroup=sipCommonStatsGroup, sipCommonStatsRetryFinalResponses=sipCommonStatsRetryFinalResponses, sipCommonTransCurrentactions=sipCommonTransCurrentactions, PYSNMP_MODULE_ID=sipCommonMIB, sipCommonOptionTag=sipCommonOptionTag, sipCommonStatusCodeTable=sipCommonStatusCodeTable, sipCommonMethodSupportedEntry=sipCommonMethodSupportedEntry, sipCommonSummaryOutRequests=sipCommonSummaryOutRequests, sipCommonCfgServiceNotifEnable=sipCommonCfgServiceNotifEnable, sipCommonStatsRetryEntry=sipCommonStatsRetryEntry, sipCommonMethodSupportedName=sipCommonMethodSupportedName, sipCommonStatusCodeNotifEntry=sipCommonStatusCodeNotifEntry, sipCommonStatusCodeNotifCallId=sipCommonStatusCodeNotifCallId, sipCommonCfgTimerE=sipCommonCfgTimerE, sipCommonMIBCompliances=sipCommonMIBCompliances, sipCommonMethodStatsName=sipCommonMethodStatsName) |
if 3 > 4 or 5 < 10: # true
pass
if 3 > 4 or 5 > 10: # false
pass
| if 3 > 4 or 5 < 10:
pass
if 3 > 4 or 5 > 10:
pass |
"""
j is the index to insert when a "new" number are found.
For each iteration, nums[:j] is the output result we currently have.
So nums[i] should check with nums[j-1] and nums[j-2].
"""
class Solution(object):
def removeDuplicates(self, nums):
j = 2
for i in xrange(2, len(nums)):
if not (nums[i]==nums[j-1] and nums[i]==nums[j-2]):
nums[j] = nums[i]
j += 1
return j | """
j is the index to insert when a "new" number are found.
For each iteration, nums[:j] is the output result we currently have.
So nums[i] should check with nums[j-1] and nums[j-2].
"""
class Solution(object):
def remove_duplicates(self, nums):
j = 2
for i in xrange(2, len(nums)):
if not (nums[i] == nums[j - 1] and nums[i] == nums[j - 2]):
nums[j] = nums[i]
j += 1
return j |
class Solution:
# Runtime: 36 ms
# Memory Usage: 16.3 MB
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
if node.left is not None:
depth_left = self.search(node.left, depth)
if node.right is not None:
depth_right = self.search(node.right, depth)
if depth_right < depth_left:
return depth_left
else:
return depth_right | class Solution:
def max_depth(self, root: TreeNode) -> int:
if root is None:
return 0
return self.search(root, 0)
def search(self, node, depth):
depth += 1
depth_left = depth
depth_right = depth
if node.left is not None:
depth_left = self.search(node.left, depth)
if node.right is not None:
depth_right = self.search(node.right, depth)
if depth_right < depth_left:
return depth_left
else:
return depth_right |
# Write a program that uses a for loop to print the numbers 8, 11, 14, 17, 20, ..., 83, 86, 89.
for i in range(8, 90, 3):
print(i)
| for i in range(8, 90, 3):
print(i) |
puzzle_input = "359282-820401"
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0] , pwd_interval[1]+1)
# Part 1
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i+1]:
double = True
elif str_code[i] > str_code[i+1]:
increase = False
break
return double and increase
valid_passwords_1 = []
for code in pwd_range:
if is_valid_pwd(code):
valid_passwords_1.append(code)
print(len(valid_passwords_1))
# Part 2
def is_only_two_adjacents_digits(code):
str_code = str(code)
adjacent = 1
for i in range(5):
if str_code[i] == str_code[i+1]:
adjacent += 1
elif adjacent == 2:
return True
else:
adjacent = 1
return adjacent == 2
valid_passwords_2 = []
for code in valid_passwords_1:
if is_only_two_adjacents_digits(code):
valid_passwords_2.append(code)
print(len(valid_passwords_2))
| puzzle_input = '359282-820401'
pwd_interval = [int(a) for a in puzzle_input.split('-')]
pwd_range = range(pwd_interval[0], pwd_interval[1] + 1)
def is_valid_pwd(code):
str_code = str(code)
double = False
increase = True
for i in range(5):
if str_code[i] == str_code[i + 1]:
double = True
elif str_code[i] > str_code[i + 1]:
increase = False
break
return double and increase
valid_passwords_1 = []
for code in pwd_range:
if is_valid_pwd(code):
valid_passwords_1.append(code)
print(len(valid_passwords_1))
def is_only_two_adjacents_digits(code):
str_code = str(code)
adjacent = 1
for i in range(5):
if str_code[i] == str_code[i + 1]:
adjacent += 1
elif adjacent == 2:
return True
else:
adjacent = 1
return adjacent == 2
valid_passwords_2 = []
for code in valid_passwords_1:
if is_only_two_adjacents_digits(code):
valid_passwords_2.append(code)
print(len(valid_passwords_2)) |
# Write a program which accepts a sequence of comma-separated numbers from console
# and generate a list and a tuple which contains every number.Given the input:
# 34,67,55,33,12,98
# Then, the output should be:
# ['34', '67', '55', '33', '12', '98']
# ('34', '67', '55', '33', '12', '98')
str = input("Enter list: ")
res = str.split(',')
print(res)
str = tuple(map(int,str.split(',')))
print(str)
| str = input('Enter list: ')
res = str.split(',')
print(res)
str = tuple(map(int, str.split(',')))
print(str) |
file = open('noTimeForATaxiCab_input.txt', 'r')
lines_read = file.readlines()
instructions = lines_read[0]
steps = instructions.split(", ")
x_blocks = 0
y_blocks = 0
# together, is_on_y_axis and is_facing_forward give you the cardinal direction you are facing
# North: is_on_y_axis = True, is_facing_forward = True
# South: True, False
# East: False, True
# West: False, False
is_on_y_axis = True
is_facing_forward = True
for step in steps:
direction = step[0]
blocks = int(step[1:])
is_right_turn = direction == "R"
is_now_facing_forward = (is_on_y_axis == is_right_turn)
if is_facing_forward:
is_facing_forward = is_now_facing_forward
else:
is_facing_forward = not is_now_facing_forward
# turning always switches which axis you are on
is_on_y_axis = not is_on_y_axis
if not is_facing_forward:
blocks = -blocks
if is_on_y_axis:
y_blocks += blocks
else:
x_blocks += blocks
print(abs(x_blocks) + abs(y_blocks)) | file = open('noTimeForATaxiCab_input.txt', 'r')
lines_read = file.readlines()
instructions = lines_read[0]
steps = instructions.split(', ')
x_blocks = 0
y_blocks = 0
is_on_y_axis = True
is_facing_forward = True
for step in steps:
direction = step[0]
blocks = int(step[1:])
is_right_turn = direction == 'R'
is_now_facing_forward = is_on_y_axis == is_right_turn
if is_facing_forward:
is_facing_forward = is_now_facing_forward
else:
is_facing_forward = not is_now_facing_forward
is_on_y_axis = not is_on_y_axis
if not is_facing_forward:
blocks = -blocks
if is_on_y_axis:
y_blocks += blocks
else:
x_blocks += blocks
print(abs(x_blocks) + abs(y_blocks)) |
def factorial(num):
fact = 0
if num == 0:
return 1
else:
fact = num * factorial(num-1)
return fact
num = 5
print("Factorial of",num,"is:",factorial(num))
| def factorial(num):
fact = 0
if num == 0:
return 1
else:
fact = num * factorial(num - 1)
return fact
num = 5
print('Factorial of', num, 'is:', factorial(num)) |
# Copyright (C) 2015 UCSC Computational Genomics Lab
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version = '1.6.2a1'
required_versions = {'pyyaml': '>=5.1',
'tsv': '==1.2',
'scikit-learn': '==0.22.1',
'pyvcf': '==0.6.8',
'futures': '==3.1.1'}
dependency_links = []
| version = '1.6.2a1'
required_versions = {'pyyaml': '>=5.1', 'tsv': '==1.2', 'scikit-learn': '==0.22.1', 'pyvcf': '==0.6.8', 'futures': '==3.1.1'}
dependency_links = [] |
class Role(object):
id = None
name = None
color = None
managed = None
hoist = None
position = None
permissions = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, role_data):
self.name = role_data.get('name', self.name)
self.color = int(role_data.get('color', self.color))
self.managed = bool(role_data.get('managed', self.managed))
self.hoist = bool(role_data.get('hoist', self.hoist))
self.position = int(role_data.get('position', self.position))
self.permissions = int(role_data.get('permissions', self.permissions))
class Member(object):
deaf = None
mute = None
joined_at = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, member_data):
self.deaf = bool(member_data.get('deaf', self.deaf))
self.mute = bool(member_data.get('mute', self.mute))
self.joined_at = member_data.get('joined_at', self.joined_at)
@property
def user(self):
return self._stores.users.with_id(self.id)
def __repr__(self):
return u'<GuildMember: %r>' % self.user
class Guild(object):
afk_channel_id = None
splash = None
roles = None
name = None
voice_states = None
large = None
verification_level = None
member_count = None
region = None
joined_at = None
icon = None
features = None
emojis = None
members = None
afk_timeout = None
channels = None
owner_id = None
presences = None
id = None
def __init__(self, id, channels, **kwargs):
self.id = int(id)
self.channels = channels
self.__dict__.update(kwargs)
@classmethod
def from_ready_packet(cls, stores, **kwargs):
kwargs['roles'] = Guild.parse_roles(stores, kwargs['roles'])
kwargs['channels'] = stores.channels.in_bulk(c['id'] for c in kwargs['channels'])
return Guild(**kwargs)
def __repr__(self):
return u'<Guild %s (%s)>' % (self.name, self.id)
@classmethod
def parse_members(cls, stores, roles, members):
member_dict = {}
users = stores.users
for member in members:
print(member['user']['id'])
member['user'] = users.with_id(member['user']['id'])
member['roles'] = filter(None, (roles.get(int(r)) for r in member['roles']))
member = Member(stores, member['user']['id'])
member_dict[member.id] = member
return member_dict
@classmethod
def parse_roles(cls, stores, roles):
role_dict = {}
for role_data in roles:
role = Role(stores, role_data['id'])
role.update(role_data)
role_dict[role.id] = role
return role_dict
| class Role(object):
id = None
name = None
color = None
managed = None
hoist = None
position = None
permissions = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, role_data):
self.name = role_data.get('name', self.name)
self.color = int(role_data.get('color', self.color))
self.managed = bool(role_data.get('managed', self.managed))
self.hoist = bool(role_data.get('hoist', self.hoist))
self.position = int(role_data.get('position', self.position))
self.permissions = int(role_data.get('permissions', self.permissions))
class Member(object):
deaf = None
mute = None
joined_at = None
def __init__(self, stores, id):
self._stores = stores
self.id = int(id)
def update(self, member_data):
self.deaf = bool(member_data.get('deaf', self.deaf))
self.mute = bool(member_data.get('mute', self.mute))
self.joined_at = member_data.get('joined_at', self.joined_at)
@property
def user(self):
return self._stores.users.with_id(self.id)
def __repr__(self):
return u'<GuildMember: %r>' % self.user
class Guild(object):
afk_channel_id = None
splash = None
roles = None
name = None
voice_states = None
large = None
verification_level = None
member_count = None
region = None
joined_at = None
icon = None
features = None
emojis = None
members = None
afk_timeout = None
channels = None
owner_id = None
presences = None
id = None
def __init__(self, id, channels, **kwargs):
self.id = int(id)
self.channels = channels
self.__dict__.update(kwargs)
@classmethod
def from_ready_packet(cls, stores, **kwargs):
kwargs['roles'] = Guild.parse_roles(stores, kwargs['roles'])
kwargs['channels'] = stores.channels.in_bulk((c['id'] for c in kwargs['channels']))
return guild(**kwargs)
def __repr__(self):
return u'<Guild %s (%s)>' % (self.name, self.id)
@classmethod
def parse_members(cls, stores, roles, members):
member_dict = {}
users = stores.users
for member in members:
print(member['user']['id'])
member['user'] = users.with_id(member['user']['id'])
member['roles'] = filter(None, (roles.get(int(r)) for r in member['roles']))
member = member(stores, member['user']['id'])
member_dict[member.id] = member
return member_dict
@classmethod
def parse_roles(cls, stores, roles):
role_dict = {}
for role_data in roles:
role = role(stores, role_data['id'])
role.update(role_data)
role_dict[role.id] = role
return role_dict |
class Command:
def __init__(self, callback, *args, **kwargs):
self.callback = callback
self.args = args
self.kwargs = kwargs
def __call__(self):
return apply(self.callback, self.args, self.kwargs)
| class Command:
def __init__(self, callback, *args, **kwargs):
self.callback = callback
self.args = args
self.kwargs = kwargs
def __call__(self):
return apply(self.callback, self.args, self.kwargs) |
class Solution(object):
def XXX(self, n):
"""
:type n: int
:rtype: str
"""
dp = {1:'1'}
for i in range(2, n+1):
if not i in dp:
dp[i] = self.say(dp[i-1])
return dp[n]
def say(self, numstr):
res = ''
tmp = ''
i = 0
while i < len(numstr):
if numstr[i] in tmp or not tmp:
tmp += numstr[i]
elif not numstr[i]==tmp[0]:
res += str(len(tmp)) + tmp[0]
tmp = numstr[i]
i += 1
if tmp: res += str(len(tmp)) + tmp[0]
return res
| class Solution(object):
def xxx(self, n):
"""
:type n: int
:rtype: str
"""
dp = {1: '1'}
for i in range(2, n + 1):
if not i in dp:
dp[i] = self.say(dp[i - 1])
return dp[n]
def say(self, numstr):
res = ''
tmp = ''
i = 0
while i < len(numstr):
if numstr[i] in tmp or not tmp:
tmp += numstr[i]
elif not numstr[i] == tmp[0]:
res += str(len(tmp)) + tmp[0]
tmp = numstr[i]
i += 1
if tmp:
res += str(len(tmp)) + tmp[0]
return res |
def main():
s = input()
le = len(s)
l = list(zip(s, range(le)))
l = sorted(l, key = lambda x: (x[0], -x[1]), reverse=True)
s = l[0][0]
current_index = l[0][1]
for i in l[1:]:
if i[1]>current_index:
s += i[0]
current_index = i[1]
print(s)
if __name__=='__main__':
main()
| def main():
s = input()
le = len(s)
l = list(zip(s, range(le)))
l = sorted(l, key=lambda x: (x[0], -x[1]), reverse=True)
s = l[0][0]
current_index = l[0][1]
for i in l[1:]:
if i[1] > current_index:
s += i[0]
current_index = i[1]
print(s)
if __name__ == '__main__':
main() |
"""
algoritmos primitivos para a elaboracao de um score
para avaliar um dado tabuleiro
"""
sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0],
[6, 0, 0, 1, 9, 5, 0, 0, 0],
[0 ,9 ,8, 0, 0, 0, 0, 6, 0],
[8, 0, 0, 0, 6, 0, 0, 0, 3],
[4, 0, 0, 8, 0, 3, 0, 0, 1],
[7, 0, 0, 0, 2, 0, 0, 0, 6],
[0, 6, 0, 0, 0, 0, 2, 8, 0],
[0, 0, 0, 4, 1, 9, 0, 0, 5],
[0, 0, 0, 0, 8, 0, 0, 7, 9]]
def view_sudoku(sudoku):
for row in sudoku:
print(" ".join([str(value) for value in row]))
def check_rows(sudoku):
ok_rows = 0
for index, row in enumerate(sudoku):
if len(set(row)) == len(sudoku[index]):
ok_rows += 1
return ok_rows
def check_cols(sudoku):
ok_cols = 0
for row in list(zip(*sudoku)):
if len(set(row)) == len(sudoku):
ok_cols += 1
return ok_cols
def check_diagonals(sudoku):
diag_1 = ""; diag_2 = ""
for index, row in enumerate(sudoku):
for index_aux, value in enumerate(row):
if index == index_aux: diag_1 += str(value)
diag_2 += str(row[len(row)-index-1])
ok_diags = 0
if len(set(diag_1)) == len(sudoku[0]): ok_diags += 1
if len(set(diag_2)) == len(sudoku[0]): ok_diags += 1
return ok_diags
def avaliar_sudoku(sudoku):
return (check_rows(sudoku) + check_cols(sudoku) + check_diagonals(sudoku))/(len(sudoku) + len(sudoku[0]) + 2) * 10
| """
algoritmos primitivos para a elaboracao de um score
para avaliar um dado tabuleiro
"""
sudoku = [[5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, 9, 0, 0, 5], [0, 0, 0, 0, 8, 0, 0, 7, 9]]
def view_sudoku(sudoku):
for row in sudoku:
print(' '.join([str(value) for value in row]))
def check_rows(sudoku):
ok_rows = 0
for (index, row) in enumerate(sudoku):
if len(set(row)) == len(sudoku[index]):
ok_rows += 1
return ok_rows
def check_cols(sudoku):
ok_cols = 0
for row in list(zip(*sudoku)):
if len(set(row)) == len(sudoku):
ok_cols += 1
return ok_cols
def check_diagonals(sudoku):
diag_1 = ''
diag_2 = ''
for (index, row) in enumerate(sudoku):
for (index_aux, value) in enumerate(row):
if index == index_aux:
diag_1 += str(value)
diag_2 += str(row[len(row) - index - 1])
ok_diags = 0
if len(set(diag_1)) == len(sudoku[0]):
ok_diags += 1
if len(set(diag_2)) == len(sudoku[0]):
ok_diags += 1
return ok_diags
def avaliar_sudoku(sudoku):
return (check_rows(sudoku) + check_cols(sudoku) + check_diagonals(sudoku)) / (len(sudoku) + len(sudoku[0]) + 2) * 10 |
#
# Exam Link: https://www.interviewbit.com/problems/implement-power-function/
#
# Question:
#
# Implement pow(x, n) % d.
#
# In other words, given x, n and d,
#
# find (xn % d)
#
# Note that remainders on division cannot be negative.
# In other words, make sure the answer you return is non negative.
#
# Input : x = 2, n = 3, d = 3
# Output : 2
#
# 2^3 % 3 = 8 % 3 = 2.
#
# Algorithm:
# Written By: Devesh Kumar
# Submission Details in Image: Power_function.png
#
class Solution:
# @param x : integer
# @param n : integer
# @param d : integer
# @return an integer
def pow(self, x, n, d):
res = 1
base = x%d
while n>0:
if n%2 ==1:
res = (res*base)%d
n = n>>1
base = (base*base)%d
return res%d
| class Solution:
def pow(self, x, n, d):
res = 1
base = x % d
while n > 0:
if n % 2 == 1:
res = res * base % d
n = n >> 1
base = base * base % d
return res % d |
# Define
list = [1, 2, 3]
# Insertion
val = 4
list.append(val)
# Deletion
index = 0
del list[index]
# Access
print(list[index])
| list = [1, 2, 3]
val = 4
list.append(val)
index = 0
del list[index]
print(list[index]) |
print("Enter the no of rows and starting number respectively: ")
n, i = map(int, input().split())
b = n
for j in range(0, n):
for k in range(b, 0, -1):
print(i, end=" ")
i = i - 1
b = b - 1
print() | print('Enter the no of rows and starting number respectively: ')
(n, i) = map(int, input().split())
b = n
for j in range(0, n):
for k in range(b, 0, -1):
print(i, end=' ')
i = i - 1
b = b - 1
print() |
#a very useless function
def hi():
return "Hello World!"
| def hi():
return 'Hello World!' |
x = 1.10
y = 1.0
z = -35.59
print(type(x))
print(type(y))
print(type(z))
| x = 1.1
y = 1.0
z = -35.59
print(type(x))
print(type(y))
print(type(z)) |
BN_MOMENTUM = 0.95
BN_RENORM = False
L2_REG = 1.25e-5
DROPOUT = 0.25
ACTIVATION = "relu"
KERNEL_INIT = "he_uniform" | bn_momentum = 0.95
bn_renorm = False
l2_reg = 1.25e-05
dropout = 0.25
activation = 'relu'
kernel_init = 'he_uniform' |
class InputItem:
def __init__(self, id_list, index_list, data=None, label=None, receipt_time=0):
self.query_id_list = id_list
self.sample_index_list = index_list
self.data = data
self.label = label
self.receipt_time = receipt_time
| class Inputitem:
def __init__(self, id_list, index_list, data=None, label=None, receipt_time=0):
self.query_id_list = id_list
self.sample_index_list = index_list
self.data = data
self.label = label
self.receipt_time = receipt_time |
class Something:
pass
# No book version will cause an error.
| class Something:
pass |
#
# PySNMP MIB module A3Com-Filter-r5-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-FILTER-R5-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:03:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection")
MacAddress, = mibBuilder.importSymbols("RFC1286-MIB", "MacAddress")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, NotificationType, Unsigned32, iso, Integer32, Counter32, Gauge32, Counter64, IpAddress, MibIdentifier, TimeTicks, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "NotificationType", "Unsigned32", "iso", "Integer32", "Counter32", "Gauge32", "Counter64", "IpAddress", "MibIdentifier", "TimeTicks", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "enterprises")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
a3Com = MibIdentifier((1, 3, 6, 1, 4, 1, 43))
brouterMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 2))
a3ComFilter = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 2, 10))
a3ComFilterCtl = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 2, 10, 1))
class RowStatus(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))
namedValues = NamedValues(("active", 1), ("notInService", 2), ("notReady", 3), ("createAndGo", 4), ("createAndWait", 5), ("destroy", 6))
a3filterControl = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enableMatchOne", 1), ("enableCheckAll", 2), ("disable", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterControl.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterControl.setDescription('This object enables/disables the filtering function. If this object is set to disable (2), filtering is turned off for all protocols. If the control is set to enableMatchOne (1) or enableCheckAll (2), then filtering is performed on protocols that are selected via the a3filter*Select objects and those for which at least one policy is configured. If a packet matches the Masks defined for more than one Policy and this object is set to enableMatchOne, only the action associated with the first satisfied Policy is performed. If this object is set to enableCheckAll (2), however, the actions associated with each satisfied Policy is performed.')
a3filterDefaultAction = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("discard", 1), ("forward", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterDefaultAction.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterDefaultAction.setDescription('This object specifies the action applied to a packet if it does not match any of the policies configured or if two conflicting policies are specified and the the packet meets criteria associated with both.')
a3filterBridgeSelect = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filter", 1), ("noFilter", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterBridgeSelect.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBridgeSelect.setDescription('This object determines whether the filter function will be invoked for the Bridge (or datalink) protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filterIpSelect = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filter", 1), ("noFilter", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterIpSelect.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterIpSelect.setDescription('This object determines whether the filter function will be invoked for the IP protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filterIpxSelect = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filter", 1), ("noFilter", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterIpxSelect.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterIpxSelect.setDescription('This object determines whether the filter function will be invoked for the IPX protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filterAppleTalkSelect = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filter", 1), ("noFilter", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterAppleTalkSelect.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterAppleTalkSelect.setDescription('This object determines whether the filter function will be invoked for the Apple Talk protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filterDecSelect = MibScalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("filter", 1), ("noFilter", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterDecSelect.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterDecSelect.setDescription('This object determines whether the filter function will be invoked for the DECnet protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filterUserMaskTable = MibTable((1, 3, 6, 1, 4, 1, 43, 2, 10, 2), )
if mibBuilder.loadTexts: a3filterUserMaskTable.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskTable.setDescription('A table containing User configured Masks that are used to identify specific classes of packets. These masks are used by the policy table to define actions to take on these classes of packets.')
a3filterUserMaskEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1), ).setIndexNames((0, "A3Com-Filter-r5-MIB", "a3filterUserMaskIndex"))
if mibBuilder.loadTexts: a3filterUserMaskEntry.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskEntry.setDescription('The definition of a single Mask.')
a3filterUserMaskIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterUserMaskIndex.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskIndex.setDescription('An index identifying a specific Mask. All user configured masks must have an index between 1 and 64.')
a3filterUserMaskName = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskName.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskName.setDescription('A text string used to help identify a specific Mask. Each entry must have a unique name.')
a3filterUserMaskLocType = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("protocolFieldSemantics", 1), ("offsetLengthSemantics", 2), ("dataLinkOffsetLengthSemantics", 3), ("ipOffsetLengthSemantics", 4), ("ipxOffsetLengthSemantics", 5), ("appleTalkOffsetLengthSemantics", 6), ("decNetOffsetLengthSemantics", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskLocType.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskLocType.setDescription('This object determines if this table entry specifies packet location via the mnemonic, protocol.field semantics or via the numerical offset.length semantics. If this object is set to protocolFieldSemantics (1), then the value of a3filterUserMaskLocField is used to identify the packet location where the mask is applied. If this object is set to offsetLengthSemantics(2), then the offset and lengths identified by a3filterUserMaskLocOffset and a3filterUserMaskLocLength are measured from the start of the datalink layer. If this object is set to dataLinkOffsetLengthSemantics(3), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the data link protocol layer. If this object is set to ipOffsetLengthSemantics(4), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the IP protocol layer. If this object is set to appleTalkOffsetLengthSemantics(5), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the AppleTalk protocol layer. Similar semantics apply to the remaining enumerations for this object.')
a3filterUserMaskLocField = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47))).clone(namedValues=NamedValues(("dlDestinationAddress", 1), ("dlSourceAddress", 2), ("dlAddress", 3), ("dlProtocol", 4), ("dlLength", 5), ("dlDSAP", 6), ("dlSSAP", 7), ("dlLSAP", 8), ("dlOUI", 9), ("dlLanID", 10), ("ipDestAddress", 11), ("ipSourceAddress", 12), ("ipAddress", 13), ("ipProtocol", 14), ("ipDestinationPort", 15), ("ipSourcePort", 16), ("ipPort", 17), ("ipOptions", 18), ("ipTOS", 19), ("ipxDestNetwork", 20), ("ipxSourceNetwork", 21), ("ipxNetwork", 22), ("ipxDestAddress", 23), ("ipxSourceAddress", 24), ("ipxAddress", 25), ("ipxDestSocket", 26), ("ipxSourceSocket", 27), ("ipxSocket", 28), ("atDestinationNetwork", 29), ("atSourceNetwork", 30), ("atNetwork", 31), ("atDestinationNodeID", 32), ("atSourceNodeID", 33), ("atNodeID", 34), ("atDestinationSocket", 35), ("atSourceSocket", 36), ("atSocket", 37), ("atDDPType", 38), ("decDestinationArea", 39), ("decSourceArea", 40), ("decArea", 41), ("decDestAddress", 42), ("decSourceAddress", 43), ("decAddress", 44), ("ipxPktLength", 45), ("ipxPktType", 46), ("ipxTransportCtl", 47)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskLocField.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskLocField.setDescription('This object specifies the location in the packet where the operation should take place. This object takes effect only when a3filterUserMaskLocationType has the value protocolFieldSemantics(1). Otherwise, this object is ignored.')
a3filterUserMaskLocOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskLocOffset.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskLocOffset.setDescription('When specifying a packet location via the offsetLength semantics, this parameters indicates the offset from the beginning of the portion of the protocol layer identified by a3filterUserMaskLocationType that is used in the Mask.')
a3filterUserMaskLocLength = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("one", 1), ("two", 2), ("reserved", 3), ("four", 4), ("rsvd", 5), ("six", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskLocLength.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskLocLength.setDescription('When specifying a packet location via the offsetLength semantics, this parameter indicates the length of the bit field used in the Mask. Only the values one(1), two(2), four(4), and six(6) are allowed. If the length is not specified, the agent will automatically determine the proper length based on either the operand (a3filterUserMaskOperand) or the matching values (a3filterUserMaskMatchType).')
a3filterUserMaskOperator = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("or", 2), ("and", 3), ("xor", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskOperator.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskOperator.setDescription('This object, together with a3filterUserMaskOperand, cause bit operations to be performed on the bit field identified by a3filterUserMaskLocation. The output of this operation is compared, according to a3filterUserMaskComparison, to the value specified by a3filterUserMaskMatch.')
a3filterUserMaskOperand = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 4))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskOperand.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskOperand.setDescription('This object, together with a3filterUserMaskOperator, cause bit operations to be performed on the bit field identified by a3filterUserMaskLocation. The output of this operation is compared, according to a3filterUserMaskComparison, to the value specified by a3filterUserMaskMatchType and a3filterUserMaskMatchBits, a3filterUserMaskMatchValue1, and/or a3filterUserMaskMatchValue2 (depending on the value of a3filterUserMaskMatchType. ie, the value of a3filterUserMaskMatchType determines which of the other objects are relevant).')
a3filterUserMaskComparison = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("equal", 1), ("notEqual", 2), ("greaterThan", 3), ("greaterThanOrEqual", 4), ("lessThan", 5), ("lessThanOrEqual", 6), ("inclusiveRange", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskComparison.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskComparison.setDescription('This object specifies the type of comparison to make between the output of the operation specified by a3filterUserMaskLocation, a3filterUserMaskOperator, a3filterUserMaskOperand, and a3filterUserMaskMatch.')
a3filterUserMaskMatchType = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("all", 1), ("bits", 2), ("value", 3), ("valueRange", 4), ("userGroup", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskMatchType.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskMatchType.setDescription('This object specifies the type of data that is being matched. The value of this object determines which column(s) are relevant for this entry. If this object is set to all(1), any value is considered as matching, and the values of the following columns are ignored: a3filterUserMaskMatchBits, a3filterUserMaskMatchValue1, and a3filterUserMaskMatchValue2. If this object is set to bits(2), then the packet location identified by the *Loc* columns (and after the indicated bit operations) is compared to the bits identified by a3filterUserMaskMatchBits. The values of a3filterUserMaskMatchValue1 and a3filterUserMaskMatchValue2 are ignored in this case. If this object is set to value(3), then the value contained in the specified packet location is compared to the value specified by a3filterUserMaskMatchValue1. The values of a3filterUserMaskMatchBits and a3filterUserMaskMatchValue2 are ignored in this case. If this object is set to valueRange(4), then the value contained in the specified packet location is compared to the range of values specified by a3filterUserMaskMatchValue1 and a3filterUserMaskMatchValue2. The value of a3filterUserMaskMatchBits is ignored in this case. Finally, if this object is set to userGroup(5), then the MAC address contained in the specified packet location is compared to the members of the User Group identified by a3filterUserMaskMatchValue1. In this case, the value of a3filterUserMaskMatchValue1 identifies one or more entries in a3filterUserGrpAddrTable. The values of a3filterUserMaskMatchBits and a3filterUserMaskMatchValue2 are ignored.')
a3filterUserMaskMatchBits = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 6))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskMatchBits.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskMatchBits.setDescription('A string of bits that is compared against the data at the specified location in the packet. This object is relevant only if a3filterUserMaskMatchType is (2).')
a3filterUserMaskMatchValue1 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 12), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskMatchValue1.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskMatchValue1.setDescription('The value used to compare against the data at the specified location in the packet. This object is relevant only if the value of a3filterUserMaskMatchType is (3), (4), or (5).')
a3filterUserMaskMatchValue2 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 13), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskMatchValue2.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskMatchValue2.setDescription('The value used to compare against the data at the specified location in the packet. This object is used along with a3filterUserMaskMatchValue1 to specify a range of values. This object is relevant only if a3filterUserMaskMatchType is (4).')
a3filterUserMaskStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 14), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserMaskStatus.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserMaskStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB. Note, if this mask entry is being used by an active Policy entry, it can not be removed.')
a3filterBuiltInMaskTable = MibTable((1, 3, 6, 1, 4, 1, 43, 2, 10, 3), )
if mibBuilder.loadTexts: a3filterBuiltInMaskTable.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBuiltInMaskTable.setDescription('A table containing Built In Masks that are used to identify specific classes of packets. These masks may be used by the policy table to define actions to take on these classes of packets.')
a3filterBuiltInMaskEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1), ).setIndexNames((0, "A3Com-Filter-r5-MIB", "a3filterBuiltInMaskIndex"))
if mibBuilder.loadTexts: a3filterBuiltInMaskEntry.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBuiltInMaskEntry.setDescription('The definition of a single Built In Mask.')
a3filterBuiltInMaskIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(257, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterBuiltInMaskIndex.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBuiltInMaskIndex.setDescription('This object uniquely identifies a Built In Mask. This index is also used by the Policy Table to identify Masks, both Built In and User Defined.')
a3filterBuiltInMaskName = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterBuiltInMaskName.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBuiltInMaskName.setDescription('The name assigned to a Built In Mask. Each name is unique and applies when referring to the Mask from the User Interface.')
a3filterBuiltInMaskFieldValue = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60))).clone(namedValues=NamedValues(("dlBroadCast", 1), ("dlMultiCast", 2), ("appleTalkII", 3), ("aarp", 4), ("arp", 5), ("clnp", 6), ("decPhaseIV", 7), ("dlTest", 8), ("ip", 9), ("ipx", 10), ("lat", 11), ("ipNetMap", 12), ("xnsNetMap", 13), ("stp", 14), ("vip", 15), ("xns", 16), ("specificRoute", 17), ("singleRouteExp", 18), ("allRouteExp", 19), ("allRouteType", 20), ("icmp", 21), ("tcp", 22), ("udp", 23), ("dns", 24), ("finger", 25), ("ftp", 26), ("whois", 27), ("simpleMailTrans", 28), ("snmp", 29), ("sunRPC", 30), ("telnet", 31), ("tftp", 32), ("x400", 33), ("zero", 34), ("one", 35), ("two", 36), ("three", 37), ("four", 38), ("five", 39), ("six", 40), ("seven", 41), ("ipxBroadCast", 42), ("fileServicePkt", 43), ("sap", 44), ("rip", 45), ("netBIOS", 46), ("diag", 47), ("rtmps", 48), ("nis", 49), ("zis", 50), ("rtmprs", 51), ("nbp", 52), ("atp", 53), ("aep", 54), ("rtmprq", 55), ("zip", 56), ("adsp", 57), ("ipxTraceRt", 58), ("ipxPing", 59), ("ipxNwSec", 60)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterBuiltInMaskFieldValue.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterBuiltInMaskFieldValue.setDescription('This object identifies the value that this Built In Mask looks for as well as the protocol field. Note, the way this table defines a Mask is different from the semantics of the User Mask table. In that table, Masks look for specific values in specific protocol fields. Built In Masks, however, are different. For example, one Built In Mask looks for the value ip(9) in the field dataLinkProtocol(2). Besides looking in the dataLinkProtocol field, the code that implements this mask also looks for IP in the proper SNAP field when the dataLinkProtocol field indicates SNAP.')
a3filterUserGrpTable = MibTable((1, 3, 6, 1, 4, 1, 43, 2, 10, 4), )
if mibBuilder.loadTexts: a3filterUserGrpTable.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpTable.setDescription('A table containing User Group entries. Each entry identifies a set of entries in the a3filterUserGrpAddrTable which can contain several station Addresses. These addresses are physical layer addresses. This table is used to associate a single User Group index with a name.')
a3filterUserGrpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1), ).setIndexNames((0, "A3Com-Filter-r5-MIB", "a3filterUserGrpIndex"))
if mibBuilder.loadTexts: a3filterUserGrpEntry.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpEntry.setDescription('Each entry in this table identifies a group of station addresses.')
a3filterUserGrpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterUserGrpIndex.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpIndex.setDescription('Each entry in this table identifies a group of station addresses.')
a3filterUserGrpName = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserGrpName.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpName.setDescription('The name given to this group of station addresses.')
a3filterUserGrpStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 3), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserGrpStatus.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filterUserGrpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 43, 2, 10, 5), )
if mibBuilder.loadTexts: a3filterUserGrpAddrTable.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpAddrTable.setDescription('A table containing User Group addresses. Each entry can contain several station Addresses. These addresses are physical layer addresses. Note, this table applies only to filtering based on the Data Link layer. Since only bridged packets are filtered at this layer, this table only applies to bridged traffic.')
a3filterUserGrpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1), ).setIndexNames((0, "A3Com-Filter-r5-MIB", "a3filterUserGrpAddrIndex"), (0, "A3Com-Filter-r5-MIB", "a3filterUserGrpAddress"))
if mibBuilder.loadTexts: a3filterUserGrpAddrEntry.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpAddrEntry.setDescription('Each entry in this table identifies a single station address.')
a3filterUserGrpAddrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterUserGrpAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpAddrIndex.setDescription('This is used to identify a group of station addresses. This object has the same value as a3filterUserGrpIndex.')
a3filterUserGrpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterUserGrpAddress.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpAddress.setDescription('A single station physical address.')
a3filterUserGrpAddrStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 3), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterUserGrpAddrStatus.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterUserGrpAddrStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filterPolicyTable = MibTable((1, 3, 6, 1, 4, 1, 43, 2, 10, 6), )
if mibBuilder.loadTexts: a3filterPolicyTable.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyTable.setDescription('A table containing filtering Policy. Each Policy applies a set of selection criteria (Masks) to a context (in terms of ports or station groups) and associates an action with that application.')
a3filterPolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1), ).setIndexNames((0, "A3Com-Filter-r5-MIB", "a3filterPolicyIndex"))
if mibBuilder.loadTexts: a3filterPolicyEntry.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyEntry.setDescription('The definition of a single Policy.')
a3filterPolicyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterPolicyIndex.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyIndex.setDescription('The index used to identify a filter policy entry.')
a3filterPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyName.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyName.setDescription('A textual name used to help identify a filter policy entry. Each entry must have a unique name.')
a3filterPolicyAction = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("discard", 1), ("forward", 2), ("count", 3), ("sequence", 4), ("prioritizeHigh", 5), ("prioritizeMed", 6), ("prioritizeLow", 7), ("doddiscard", 8), ("x25ProfId", 9)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyAction.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyAction.setDescription("The action taken when a packet matches all the masks (applied in the proper context) identified in this policy entry. If this object has the value discard(1), then all packets that match the masks and context of this entry are discarded. If this object has the value forward(2), then all packets that match the masks and context of this entry are forwarded. If this object has the value count(3), then all packets that match the masks and context of this entry are counted. The actual counts can be obtained by requesting the values of a3filterPolicyPackets and a3filterPolicyBytes. If this object has the value sequence(4), then all bridged packets destined for a port with multiple serial paths that match the masks and context of this entry are forwarded in sequence. If this object has the value prioritze, then all packets destined for a port supported by one or more serial paths that match the masks and context of this entry are given higher priority. If this object has the value doddiscard(8), then all packets that match the masks and context of this entry will be subjected to the 'DODdiscard' action; ie, those packets will be discarded and will not raise a DOD path if the path is down, or if the path is UP, those packets will be forwarded but will not keep the path up. If this object has the value x25ProfId(9), then all packets that match the masks and context of this entry will use the X25 Profile identified by a3filterPolicyX25ProfId when passing those packets over an X25 network.")
a3filterPolicyMask1 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyMask1.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyMask1.setDescription('This object identifies an entry in either of the Mask Tables. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filterPolicyMask2 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyMask2.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyMask2.setDescription('This object identifies an entry in either of the Mask Tables. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filterPolicyMask3 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyMask3.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyMask3.setDescription('This object identifies an entry in the Mask Table. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filterPolicyMask4 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyMask4.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyMask4.setDescription('This object identifies an entry in the Mask Table. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filterPolicyContext = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("all", 1), ("atPorts1", 2), ("fromPorts1", 3), ("fromPorts1ToPorts2", 4), ("toPorts1", 5), ("betweenPorts1AndPorts2", 6), ("amongPorts1", 7))).clone('all')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyContext.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyContext.setDescription('Supplies conditions on when to apply the masks to a packet. These conditions relate to the source and destination ports of a packet. All (1) means apply the action in all contexts. AT (2) means apply the action if the packet is received from or distined to the ports specified by a3filterPolicyPorts1. TO (3) means apply the action if the packet is destined to those ports. FROM (4) means apply the action if the packet is received from one of those specified ports. FROM ports1 TO ports2 (5) means apply the action if the packet is received from the ports defined by a3filterPolicyPorts1 and destined to the port defined by a3filterPolicyPorts2. BETWEEN ports1 AND ports2 (6) means apply the action if the packet is received from one of the ports defined by a3filterPolicyPorts1 and destined for one of the ports defined by a3filterPolicyPorts2 or if the packet is received from one of the ports defined by a3filterPolicyPorts2 and destined for one of the ports defined by a3filterPolicyPorts1. Finally AMONG (7) means apply the action if the packet is received from and destined to one of the ports specified by a3filterPolicyPorts1')
a3filterPolicyPorts1 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 9), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyPorts1.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyPorts1.setDescription("This object identifies one or more ports. These ports are used to help identify in what contexts masks are applied. This is used in conjunction with a3filterPolicyContext. Each octet within the value of this object specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'. (Note that the setting of the bit corresponding to the port from which a frame is received is irrelevant.)")
a3filterPolicyPorts2 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 10), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyPorts2.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyPorts2.setDescription("This object identifies one or more ports. These ports are used to help identify in what contexts masks are applied. This is used in conjunction with a3filterPolicyContext. Each octet within the value of this object specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'. (Note that the setting of the bit corresponding to the port from which a frame is received is irrelevant.) Note, this object only applies if a3filterPolicyContext has the value fromPorts1ToPorts2 (5) or betweenPorts1AndPorts2 (6) or amongPorts1(7).")
a3filterPolicyPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterPolicyPackets.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyPackets.setDescription('The number of packets that match the policy defined by this entry.')
a3filterPolicyBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3filterPolicyBytes.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyBytes.setDescription('The total number of bytes in the packets that match the policy defined by this entry.')
a3filterPolicyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 13), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyStatus.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filterPolicyX25ProfId = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 14), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3filterPolicyX25ProfId.setStatus('mandatory')
if mibBuilder.loadTexts: a3filterPolicyX25ProfId.setDescription('The index used to identify the X25 Profile ID if a3filterPolicyAction is set to X25ProfId.')
mibBuilder.exportSymbols("A3Com-Filter-r5-MIB", a3filterUserMaskLocType=a3filterUserMaskLocType, a3filterUserGrpTable=a3filterUserGrpTable, a3filterUserGrpIndex=a3filterUserGrpIndex, a3ComFilter=a3ComFilter, a3filterUserGrpAddress=a3filterUserGrpAddress, a3filterPolicyPorts2=a3filterPolicyPorts2, a3filterUserMaskComparison=a3filterUserMaskComparison, brouterMIB=brouterMIB, a3filterUserGrpAddrStatus=a3filterUserGrpAddrStatus, a3filterUserMaskLocField=a3filterUserMaskLocField, a3filterIpxSelect=a3filterIpxSelect, a3filterUserMaskEntry=a3filterUserMaskEntry, RowStatus=RowStatus, a3filterUserMaskLocLength=a3filterUserMaskLocLength, a3filterPolicyBytes=a3filterPolicyBytes, a3filterUserMaskName=a3filterUserMaskName, a3filterPolicyMask2=a3filterPolicyMask2, a3filterAppleTalkSelect=a3filterAppleTalkSelect, a3filterPolicyMask1=a3filterPolicyMask1, a3filterPolicyPackets=a3filterPolicyPackets, a3filterPolicyContext=a3filterPolicyContext, a3filterControl=a3filterControl, a3filterUserMaskMatchValue1=a3filterUserMaskMatchValue1, a3Com=a3Com, a3filterUserMaskMatchBits=a3filterUserMaskMatchBits, a3filterUserMaskIndex=a3filterUserMaskIndex, a3filterUserGrpAddrIndex=a3filterUserGrpAddrIndex, a3filterIpSelect=a3filterIpSelect, a3filterUserMaskOperand=a3filterUserMaskOperand, a3filterBuiltInMaskName=a3filterBuiltInMaskName, a3filterUserGrpName=a3filterUserGrpName, a3filterPolicyMask4=a3filterPolicyMask4, a3filterUserMaskLocOffset=a3filterUserMaskLocOffset, a3filterUserMaskMatchType=a3filterUserMaskMatchType, a3filterUserGrpAddrEntry=a3filterUserGrpAddrEntry, a3filterUserGrpAddrTable=a3filterUserGrpAddrTable, a3filterBuiltInMaskFieldValue=a3filterBuiltInMaskFieldValue, a3filterPolicyEntry=a3filterPolicyEntry, a3filterBuiltInMaskEntry=a3filterBuiltInMaskEntry, a3filterUserMaskTable=a3filterUserMaskTable, a3filterBridgeSelect=a3filterBridgeSelect, a3filterUserMaskOperator=a3filterUserMaskOperator, a3filterPolicyStatus=a3filterPolicyStatus, a3ComFilterCtl=a3ComFilterCtl, a3filterPolicyIndex=a3filterPolicyIndex, a3filterUserGrpEntry=a3filterUserGrpEntry, a3filterUserGrpStatus=a3filterUserGrpStatus, a3filterDefaultAction=a3filterDefaultAction, a3filterPolicyPorts1=a3filterPolicyPorts1, a3filterUserMaskStatus=a3filterUserMaskStatus, a3filterBuiltInMaskIndex=a3filterBuiltInMaskIndex, a3filterPolicyTable=a3filterPolicyTable, a3filterDecSelect=a3filterDecSelect, a3filterPolicyName=a3filterPolicyName, a3filterPolicyAction=a3filterPolicyAction, a3filterPolicyX25ProfId=a3filterPolicyX25ProfId, a3filterBuiltInMaskTable=a3filterBuiltInMaskTable, a3filterPolicyMask3=a3filterPolicyMask3, a3filterUserMaskMatchValue2=a3filterUserMaskMatchValue2)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection')
(mac_address,) = mibBuilder.importSymbols('RFC1286-MIB', 'MacAddress')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(object_identity, notification_type, unsigned32, iso, integer32, counter32, gauge32, counter64, ip_address, mib_identifier, time_ticks, bits, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, enterprises) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'NotificationType', 'Unsigned32', 'iso', 'Integer32', 'Counter32', 'Gauge32', 'Counter64', 'IpAddress', 'MibIdentifier', 'TimeTicks', 'Bits', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'enterprises')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
a3_com = mib_identifier((1, 3, 6, 1, 4, 1, 43))
brouter_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 2))
a3_com_filter = mib_identifier((1, 3, 6, 1, 4, 1, 43, 2, 10))
a3_com_filter_ctl = mib_identifier((1, 3, 6, 1, 4, 1, 43, 2, 10, 1))
class Rowstatus(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))
named_values = named_values(('active', 1), ('notInService', 2), ('notReady', 3), ('createAndGo', 4), ('createAndWait', 5), ('destroy', 6))
a3filter_control = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('enableMatchOne', 1), ('enableCheckAll', 2), ('disable', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterControl.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterControl.setDescription('This object enables/disables the filtering function. If this object is set to disable (2), filtering is turned off for all protocols. If the control is set to enableMatchOne (1) or enableCheckAll (2), then filtering is performed on protocols that are selected via the a3filter*Select objects and those for which at least one policy is configured. If a packet matches the Masks defined for more than one Policy and this object is set to enableMatchOne, only the action associated with the first satisfied Policy is performed. If this object is set to enableCheckAll (2), however, the actions associated with each satisfied Policy is performed.')
a3filter_default_action = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('discard', 1), ('forward', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterDefaultAction.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterDefaultAction.setDescription('This object specifies the action applied to a packet if it does not match any of the policies configured or if two conflicting policies are specified and the the packet meets criteria associated with both.')
a3filter_bridge_select = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filter', 1), ('noFilter', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterBridgeSelect.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBridgeSelect.setDescription('This object determines whether the filter function will be invoked for the Bridge (or datalink) protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filter_ip_select = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filter', 1), ('noFilter', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterIpSelect.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterIpSelect.setDescription('This object determines whether the filter function will be invoked for the IP protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filter_ipx_select = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filter', 1), ('noFilter', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterIpxSelect.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterIpxSelect.setDescription('This object determines whether the filter function will be invoked for the IPX protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filter_apple_talk_select = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filter', 1), ('noFilter', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterAppleTalkSelect.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterAppleTalkSelect.setDescription('This object determines whether the filter function will be invoked for the Apple Talk protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filter_dec_select = mib_scalar((1, 3, 6, 1, 4, 1, 43, 2, 10, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('filter', 1), ('noFilter', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterDecSelect.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterDecSelect.setDescription('This object determines whether the filter function will be invoked for the DECnet protocol layer. This provides a mechanism for deselecting filtering for this protocol layer while retaining the policies and masks configured for this protocol.')
a3filter_user_mask_table = mib_table((1, 3, 6, 1, 4, 1, 43, 2, 10, 2))
if mibBuilder.loadTexts:
a3filterUserMaskTable.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskTable.setDescription('A table containing User configured Masks that are used to identify specific classes of packets. These masks are used by the policy table to define actions to take on these classes of packets.')
a3filter_user_mask_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1)).setIndexNames((0, 'A3Com-Filter-r5-MIB', 'a3filterUserMaskIndex'))
if mibBuilder.loadTexts:
a3filterUserMaskEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskEntry.setDescription('The definition of a single Mask.')
a3filter_user_mask_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterUserMaskIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskIndex.setDescription('An index identifying a specific Mask. All user configured masks must have an index between 1 and 64.')
a3filter_user_mask_name = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskName.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskName.setDescription('A text string used to help identify a specific Mask. Each entry must have a unique name.')
a3filter_user_mask_loc_type = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('protocolFieldSemantics', 1), ('offsetLengthSemantics', 2), ('dataLinkOffsetLengthSemantics', 3), ('ipOffsetLengthSemantics', 4), ('ipxOffsetLengthSemantics', 5), ('appleTalkOffsetLengthSemantics', 6), ('decNetOffsetLengthSemantics', 7)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskLocType.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskLocType.setDescription('This object determines if this table entry specifies packet location via the mnemonic, protocol.field semantics or via the numerical offset.length semantics. If this object is set to protocolFieldSemantics (1), then the value of a3filterUserMaskLocField is used to identify the packet location where the mask is applied. If this object is set to offsetLengthSemantics(2), then the offset and lengths identified by a3filterUserMaskLocOffset and a3filterUserMaskLocLength are measured from the start of the datalink layer. If this object is set to dataLinkOffsetLengthSemantics(3), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the data link protocol layer. If this object is set to ipOffsetLengthSemantics(4), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the IP protocol layer. If this object is set to appleTalkOffsetLengthSemantics(5), then the value of a3filterUserMaskLocOffset and a3filterUserMaskLocLength are used to determine where the mask is applied. The offset and length are measured starting from the data field of the AppleTalk protocol layer. Similar semantics apply to the remaining enumerations for this object.')
a3filter_user_mask_loc_field = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47))).clone(namedValues=named_values(('dlDestinationAddress', 1), ('dlSourceAddress', 2), ('dlAddress', 3), ('dlProtocol', 4), ('dlLength', 5), ('dlDSAP', 6), ('dlSSAP', 7), ('dlLSAP', 8), ('dlOUI', 9), ('dlLanID', 10), ('ipDestAddress', 11), ('ipSourceAddress', 12), ('ipAddress', 13), ('ipProtocol', 14), ('ipDestinationPort', 15), ('ipSourcePort', 16), ('ipPort', 17), ('ipOptions', 18), ('ipTOS', 19), ('ipxDestNetwork', 20), ('ipxSourceNetwork', 21), ('ipxNetwork', 22), ('ipxDestAddress', 23), ('ipxSourceAddress', 24), ('ipxAddress', 25), ('ipxDestSocket', 26), ('ipxSourceSocket', 27), ('ipxSocket', 28), ('atDestinationNetwork', 29), ('atSourceNetwork', 30), ('atNetwork', 31), ('atDestinationNodeID', 32), ('atSourceNodeID', 33), ('atNodeID', 34), ('atDestinationSocket', 35), ('atSourceSocket', 36), ('atSocket', 37), ('atDDPType', 38), ('decDestinationArea', 39), ('decSourceArea', 40), ('decArea', 41), ('decDestAddress', 42), ('decSourceAddress', 43), ('decAddress', 44), ('ipxPktLength', 45), ('ipxPktType', 46), ('ipxTransportCtl', 47)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskLocField.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskLocField.setDescription('This object specifies the location in the packet where the operation should take place. This object takes effect only when a3filterUserMaskLocationType has the value protocolFieldSemantics(1). Otherwise, this object is ignored.')
a3filter_user_mask_loc_offset = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 5), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskLocOffset.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskLocOffset.setDescription('When specifying a packet location via the offsetLength semantics, this parameters indicates the offset from the beginning of the portion of the protocol layer identified by a3filterUserMaskLocationType that is used in the Mask.')
a3filter_user_mask_loc_length = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('one', 1), ('two', 2), ('reserved', 3), ('four', 4), ('rsvd', 5), ('six', 6)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskLocLength.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskLocLength.setDescription('When specifying a packet location via the offsetLength semantics, this parameter indicates the length of the bit field used in the Mask. Only the values one(1), two(2), four(4), and six(6) are allowed. If the length is not specified, the agent will automatically determine the proper length based on either the operand (a3filterUserMaskOperand) or the matching values (a3filterUserMaskMatchType).')
a3filter_user_mask_operator = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('or', 2), ('and', 3), ('xor', 4)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskOperator.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskOperator.setDescription('This object, together with a3filterUserMaskOperand, cause bit operations to be performed on the bit field identified by a3filterUserMaskLocation. The output of this operation is compared, according to a3filterUserMaskComparison, to the value specified by a3filterUserMaskMatch.')
a3filter_user_mask_operand = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 8), octet_string().subtype(subtypeSpec=value_size_constraint(0, 4))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskOperand.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskOperand.setDescription('This object, together with a3filterUserMaskOperator, cause bit operations to be performed on the bit field identified by a3filterUserMaskLocation. The output of this operation is compared, according to a3filterUserMaskComparison, to the value specified by a3filterUserMaskMatchType and a3filterUserMaskMatchBits, a3filterUserMaskMatchValue1, and/or a3filterUserMaskMatchValue2 (depending on the value of a3filterUserMaskMatchType. ie, the value of a3filterUserMaskMatchType determines which of the other objects are relevant).')
a3filter_user_mask_comparison = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('equal', 1), ('notEqual', 2), ('greaterThan', 3), ('greaterThanOrEqual', 4), ('lessThan', 5), ('lessThanOrEqual', 6), ('inclusiveRange', 7)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskComparison.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskComparison.setDescription('This object specifies the type of comparison to make between the output of the operation specified by a3filterUserMaskLocation, a3filterUserMaskOperator, a3filterUserMaskOperand, and a3filterUserMaskMatch.')
a3filter_user_mask_match_type = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('all', 1), ('bits', 2), ('value', 3), ('valueRange', 4), ('userGroup', 5)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskMatchType.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskMatchType.setDescription('This object specifies the type of data that is being matched. The value of this object determines which column(s) are relevant for this entry. If this object is set to all(1), any value is considered as matching, and the values of the following columns are ignored: a3filterUserMaskMatchBits, a3filterUserMaskMatchValue1, and a3filterUserMaskMatchValue2. If this object is set to bits(2), then the packet location identified by the *Loc* columns (and after the indicated bit operations) is compared to the bits identified by a3filterUserMaskMatchBits. The values of a3filterUserMaskMatchValue1 and a3filterUserMaskMatchValue2 are ignored in this case. If this object is set to value(3), then the value contained in the specified packet location is compared to the value specified by a3filterUserMaskMatchValue1. The values of a3filterUserMaskMatchBits and a3filterUserMaskMatchValue2 are ignored in this case. If this object is set to valueRange(4), then the value contained in the specified packet location is compared to the range of values specified by a3filterUserMaskMatchValue1 and a3filterUserMaskMatchValue2. The value of a3filterUserMaskMatchBits is ignored in this case. Finally, if this object is set to userGroup(5), then the MAC address contained in the specified packet location is compared to the members of the User Group identified by a3filterUserMaskMatchValue1. In this case, the value of a3filterUserMaskMatchValue1 identifies one or more entries in a3filterUserGrpAddrTable. The values of a3filterUserMaskMatchBits and a3filterUserMaskMatchValue2 are ignored.')
a3filter_user_mask_match_bits = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 11), octet_string().subtype(subtypeSpec=value_size_constraint(0, 6))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskMatchBits.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskMatchBits.setDescription('A string of bits that is compared against the data at the specified location in the packet. This object is relevant only if a3filterUserMaskMatchType is (2).')
a3filter_user_mask_match_value1 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 12), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskMatchValue1.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskMatchValue1.setDescription('The value used to compare against the data at the specified location in the packet. This object is relevant only if the value of a3filterUserMaskMatchType is (3), (4), or (5).')
a3filter_user_mask_match_value2 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 13), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskMatchValue2.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskMatchValue2.setDescription('The value used to compare against the data at the specified location in the packet. This object is used along with a3filterUserMaskMatchValue1 to specify a range of values. This object is relevant only if a3filterUserMaskMatchType is (4).')
a3filter_user_mask_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 2, 1, 14), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserMaskStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserMaskStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB. Note, if this mask entry is being used by an active Policy entry, it can not be removed.')
a3filter_built_in_mask_table = mib_table((1, 3, 6, 1, 4, 1, 43, 2, 10, 3))
if mibBuilder.loadTexts:
a3filterBuiltInMaskTable.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBuiltInMaskTable.setDescription('A table containing Built In Masks that are used to identify specific classes of packets. These masks may be used by the policy table to define actions to take on these classes of packets.')
a3filter_built_in_mask_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1)).setIndexNames((0, 'A3Com-Filter-r5-MIB', 'a3filterBuiltInMaskIndex'))
if mibBuilder.loadTexts:
a3filterBuiltInMaskEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBuiltInMaskEntry.setDescription('The definition of a single Built In Mask.')
a3filter_built_in_mask_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(257, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterBuiltInMaskIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBuiltInMaskIndex.setDescription('This object uniquely identifies a Built In Mask. This index is also used by the Policy Table to identify Masks, both Built In and User Defined.')
a3filter_built_in_mask_name = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterBuiltInMaskName.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBuiltInMaskName.setDescription('The name assigned to a Built In Mask. Each name is unique and applies when referring to the Mask from the User Interface.')
a3filter_built_in_mask_field_value = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 3, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60))).clone(namedValues=named_values(('dlBroadCast', 1), ('dlMultiCast', 2), ('appleTalkII', 3), ('aarp', 4), ('arp', 5), ('clnp', 6), ('decPhaseIV', 7), ('dlTest', 8), ('ip', 9), ('ipx', 10), ('lat', 11), ('ipNetMap', 12), ('xnsNetMap', 13), ('stp', 14), ('vip', 15), ('xns', 16), ('specificRoute', 17), ('singleRouteExp', 18), ('allRouteExp', 19), ('allRouteType', 20), ('icmp', 21), ('tcp', 22), ('udp', 23), ('dns', 24), ('finger', 25), ('ftp', 26), ('whois', 27), ('simpleMailTrans', 28), ('snmp', 29), ('sunRPC', 30), ('telnet', 31), ('tftp', 32), ('x400', 33), ('zero', 34), ('one', 35), ('two', 36), ('three', 37), ('four', 38), ('five', 39), ('six', 40), ('seven', 41), ('ipxBroadCast', 42), ('fileServicePkt', 43), ('sap', 44), ('rip', 45), ('netBIOS', 46), ('diag', 47), ('rtmps', 48), ('nis', 49), ('zis', 50), ('rtmprs', 51), ('nbp', 52), ('atp', 53), ('aep', 54), ('rtmprq', 55), ('zip', 56), ('adsp', 57), ('ipxTraceRt', 58), ('ipxPing', 59), ('ipxNwSec', 60)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterBuiltInMaskFieldValue.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterBuiltInMaskFieldValue.setDescription('This object identifies the value that this Built In Mask looks for as well as the protocol field. Note, the way this table defines a Mask is different from the semantics of the User Mask table. In that table, Masks look for specific values in specific protocol fields. Built In Masks, however, are different. For example, one Built In Mask looks for the value ip(9) in the field dataLinkProtocol(2). Besides looking in the dataLinkProtocol field, the code that implements this mask also looks for IP in the proper SNAP field when the dataLinkProtocol field indicates SNAP.')
a3filter_user_grp_table = mib_table((1, 3, 6, 1, 4, 1, 43, 2, 10, 4))
if mibBuilder.loadTexts:
a3filterUserGrpTable.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpTable.setDescription('A table containing User Group entries. Each entry identifies a set of entries in the a3filterUserGrpAddrTable which can contain several station Addresses. These addresses are physical layer addresses. This table is used to associate a single User Group index with a name.')
a3filter_user_grp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1)).setIndexNames((0, 'A3Com-Filter-r5-MIB', 'a3filterUserGrpIndex'))
if mibBuilder.loadTexts:
a3filterUserGrpEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpEntry.setDescription('Each entry in this table identifies a group of station addresses.')
a3filter_user_grp_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 16))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterUserGrpIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpIndex.setDescription('Each entry in this table identifies a group of station addresses.')
a3filter_user_grp_name = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserGrpName.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpName.setDescription('The name given to this group of station addresses.')
a3filter_user_grp_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 4, 1, 3), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserGrpStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filter_user_grp_addr_table = mib_table((1, 3, 6, 1, 4, 1, 43, 2, 10, 5))
if mibBuilder.loadTexts:
a3filterUserGrpAddrTable.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpAddrTable.setDescription('A table containing User Group addresses. Each entry can contain several station Addresses. These addresses are physical layer addresses. Note, this table applies only to filtering based on the Data Link layer. Since only bridged packets are filtered at this layer, this table only applies to bridged traffic.')
a3filter_user_grp_addr_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1)).setIndexNames((0, 'A3Com-Filter-r5-MIB', 'a3filterUserGrpAddrIndex'), (0, 'A3Com-Filter-r5-MIB', 'a3filterUserGrpAddress'))
if mibBuilder.loadTexts:
a3filterUserGrpAddrEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpAddrEntry.setDescription('Each entry in this table identifies a single station address.')
a3filter_user_grp_addr_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 16))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterUserGrpAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpAddrIndex.setDescription('This is used to identify a group of station addresses. This object has the same value as a3filterUserGrpIndex.')
a3filter_user_grp_address = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterUserGrpAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpAddress.setDescription('A single station physical address.')
a3filter_user_grp_addr_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 5, 1, 3), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterUserGrpAddrStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterUserGrpAddrStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filter_policy_table = mib_table((1, 3, 6, 1, 4, 1, 43, 2, 10, 6))
if mibBuilder.loadTexts:
a3filterPolicyTable.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyTable.setDescription('A table containing filtering Policy. Each Policy applies a set of selection criteria (Masks) to a context (in terms of ports or station groups) and associates an action with that application.')
a3filter_policy_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1)).setIndexNames((0, 'A3Com-Filter-r5-MIB', 'a3filterPolicyIndex'))
if mibBuilder.loadTexts:
a3filterPolicyEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyEntry.setDescription('The definition of a single Policy.')
a3filter_policy_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterPolicyIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyIndex.setDescription('The index used to identify a filter policy entry.')
a3filter_policy_name = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyName.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyName.setDescription('A textual name used to help identify a filter policy entry. Each entry must have a unique name.')
a3filter_policy_action = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('discard', 1), ('forward', 2), ('count', 3), ('sequence', 4), ('prioritizeHigh', 5), ('prioritizeMed', 6), ('prioritizeLow', 7), ('doddiscard', 8), ('x25ProfId', 9)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyAction.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyAction.setDescription("The action taken when a packet matches all the masks (applied in the proper context) identified in this policy entry. If this object has the value discard(1), then all packets that match the masks and context of this entry are discarded. If this object has the value forward(2), then all packets that match the masks and context of this entry are forwarded. If this object has the value count(3), then all packets that match the masks and context of this entry are counted. The actual counts can be obtained by requesting the values of a3filterPolicyPackets and a3filterPolicyBytes. If this object has the value sequence(4), then all bridged packets destined for a port with multiple serial paths that match the masks and context of this entry are forwarded in sequence. If this object has the value prioritze, then all packets destined for a port supported by one or more serial paths that match the masks and context of this entry are given higher priority. If this object has the value doddiscard(8), then all packets that match the masks and context of this entry will be subjected to the 'DODdiscard' action; ie, those packets will be discarded and will not raise a DOD path if the path is down, or if the path is UP, those packets will be forwarded but will not keep the path up. If this object has the value x25ProfId(9), then all packets that match the masks and context of this entry will use the X25 Profile identified by a3filterPolicyX25ProfId when passing those packets over an X25 network.")
a3filter_policy_mask1 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyMask1.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyMask1.setDescription('This object identifies an entry in either of the Mask Tables. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filter_policy_mask2 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 5), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyMask2.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyMask2.setDescription('This object identifies an entry in either of the Mask Tables. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filter_policy_mask3 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 6), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyMask3.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyMask3.setDescription('This object identifies an entry in the Mask Table. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filter_policy_mask4 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 7), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyMask4.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyMask4.setDescription('This object identifies an entry in the Mask Table. Each filter policy entry identifies up to four separate masks. An entry of zero for this object identifies a null mask.')
a3filter_policy_context = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('all', 1), ('atPorts1', 2), ('fromPorts1', 3), ('fromPorts1ToPorts2', 4), ('toPorts1', 5), ('betweenPorts1AndPorts2', 6), ('amongPorts1', 7))).clone('all')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyContext.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyContext.setDescription('Supplies conditions on when to apply the masks to a packet. These conditions relate to the source and destination ports of a packet. All (1) means apply the action in all contexts. AT (2) means apply the action if the packet is received from or distined to the ports specified by a3filterPolicyPorts1. TO (3) means apply the action if the packet is destined to those ports. FROM (4) means apply the action if the packet is received from one of those specified ports. FROM ports1 TO ports2 (5) means apply the action if the packet is received from the ports defined by a3filterPolicyPorts1 and destined to the port defined by a3filterPolicyPorts2. BETWEEN ports1 AND ports2 (6) means apply the action if the packet is received from one of the ports defined by a3filterPolicyPorts1 and destined for one of the ports defined by a3filterPolicyPorts2 or if the packet is received from one of the ports defined by a3filterPolicyPorts2 and destined for one of the ports defined by a3filterPolicyPorts1. Finally AMONG (7) means apply the action if the packet is received from and destined to one of the ports specified by a3filterPolicyPorts1')
a3filter_policy_ports1 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 9), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyPorts1.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyPorts1.setDescription("This object identifies one or more ports. These ports are used to help identify in what contexts masks are applied. This is used in conjunction with a3filterPolicyContext. Each octet within the value of this object specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'. (Note that the setting of the bit corresponding to the port from which a frame is received is irrelevant.)")
a3filter_policy_ports2 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 10), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyPorts2.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyPorts2.setDescription("This object identifies one or more ports. These ports are used to help identify in what contexts masks are applied. This is used in conjunction with a3filterPolicyContext. Each octet within the value of this object specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'. (Note that the setting of the bit corresponding to the port from which a frame is received is irrelevant.) Note, this object only applies if a3filterPolicyContext has the value fromPorts1ToPorts2 (5) or betweenPorts1AndPorts2 (6) or amongPorts1(7).")
a3filter_policy_packets = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterPolicyPackets.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyPackets.setDescription('The number of packets that match the policy defined by this entry.')
a3filter_policy_bytes = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3filterPolicyBytes.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyBytes.setDescription('The total number of bytes in the packets that match the policy defined by this entry.')
a3filter_policy_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 13), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyStatus.setDescription('This object is used to add and delete entries in this table. See the notes describing RowStatus at the beginning of this MIB.')
a3filter_policy_x25_prof_id = mib_table_column((1, 3, 6, 1, 4, 1, 43, 2, 10, 6, 1, 14), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3filterPolicyX25ProfId.setStatus('mandatory')
if mibBuilder.loadTexts:
a3filterPolicyX25ProfId.setDescription('The index used to identify the X25 Profile ID if a3filterPolicyAction is set to X25ProfId.')
mibBuilder.exportSymbols('A3Com-Filter-r5-MIB', a3filterUserMaskLocType=a3filterUserMaskLocType, a3filterUserGrpTable=a3filterUserGrpTable, a3filterUserGrpIndex=a3filterUserGrpIndex, a3ComFilter=a3ComFilter, a3filterUserGrpAddress=a3filterUserGrpAddress, a3filterPolicyPorts2=a3filterPolicyPorts2, a3filterUserMaskComparison=a3filterUserMaskComparison, brouterMIB=brouterMIB, a3filterUserGrpAddrStatus=a3filterUserGrpAddrStatus, a3filterUserMaskLocField=a3filterUserMaskLocField, a3filterIpxSelect=a3filterIpxSelect, a3filterUserMaskEntry=a3filterUserMaskEntry, RowStatus=RowStatus, a3filterUserMaskLocLength=a3filterUserMaskLocLength, a3filterPolicyBytes=a3filterPolicyBytes, a3filterUserMaskName=a3filterUserMaskName, a3filterPolicyMask2=a3filterPolicyMask2, a3filterAppleTalkSelect=a3filterAppleTalkSelect, a3filterPolicyMask1=a3filterPolicyMask1, a3filterPolicyPackets=a3filterPolicyPackets, a3filterPolicyContext=a3filterPolicyContext, a3filterControl=a3filterControl, a3filterUserMaskMatchValue1=a3filterUserMaskMatchValue1, a3Com=a3Com, a3filterUserMaskMatchBits=a3filterUserMaskMatchBits, a3filterUserMaskIndex=a3filterUserMaskIndex, a3filterUserGrpAddrIndex=a3filterUserGrpAddrIndex, a3filterIpSelect=a3filterIpSelect, a3filterUserMaskOperand=a3filterUserMaskOperand, a3filterBuiltInMaskName=a3filterBuiltInMaskName, a3filterUserGrpName=a3filterUserGrpName, a3filterPolicyMask4=a3filterPolicyMask4, a3filterUserMaskLocOffset=a3filterUserMaskLocOffset, a3filterUserMaskMatchType=a3filterUserMaskMatchType, a3filterUserGrpAddrEntry=a3filterUserGrpAddrEntry, a3filterUserGrpAddrTable=a3filterUserGrpAddrTable, a3filterBuiltInMaskFieldValue=a3filterBuiltInMaskFieldValue, a3filterPolicyEntry=a3filterPolicyEntry, a3filterBuiltInMaskEntry=a3filterBuiltInMaskEntry, a3filterUserMaskTable=a3filterUserMaskTable, a3filterBridgeSelect=a3filterBridgeSelect, a3filterUserMaskOperator=a3filterUserMaskOperator, a3filterPolicyStatus=a3filterPolicyStatus, a3ComFilterCtl=a3ComFilterCtl, a3filterPolicyIndex=a3filterPolicyIndex, a3filterUserGrpEntry=a3filterUserGrpEntry, a3filterUserGrpStatus=a3filterUserGrpStatus, a3filterDefaultAction=a3filterDefaultAction, a3filterPolicyPorts1=a3filterPolicyPorts1, a3filterUserMaskStatus=a3filterUserMaskStatus, a3filterBuiltInMaskIndex=a3filterBuiltInMaskIndex, a3filterPolicyTable=a3filterPolicyTable, a3filterDecSelect=a3filterDecSelect, a3filterPolicyName=a3filterPolicyName, a3filterPolicyAction=a3filterPolicyAction, a3filterPolicyX25ProfId=a3filterPolicyX25ProfId, a3filterBuiltInMaskTable=a3filterBuiltInMaskTable, a3filterPolicyMask3=a3filterPolicyMask3, a3filterUserMaskMatchValue2=a3filterUserMaskMatchValue2) |
# Copyright 2016 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FLAVORS = [
{
'name': 'Micro',
'ram': 1024,
'cores': 1
},
{
'name': 'Small',
'ram': 2048,
'cores': 1
},
{
'name': 'Medium',
'ram': 4096,
'cores': 2
},
{
'name': 'Large',
'ram': 7168,
'cores': 4
},
{
'name': 'ExtraLarge',
'ram': 14336,
'cores': 8
},
{
'name': 'MemoryIntensiveSmall',
'ram': 16384,
'cores': 2
},
{
'name': 'MemoryIntensiveMedium',
'ram': 28672,
'cores': 2
},
{
'name': 'MemoryIntensiveLarge',
'ram': 57344,
'cores': 2
},
]
| flavors = [{'name': 'Micro', 'ram': 1024, 'cores': 1}, {'name': 'Small', 'ram': 2048, 'cores': 1}, {'name': 'Medium', 'ram': 4096, 'cores': 2}, {'name': 'Large', 'ram': 7168, 'cores': 4}, {'name': 'ExtraLarge', 'ram': 14336, 'cores': 8}, {'name': 'MemoryIntensiveSmall', 'ram': 16384, 'cores': 2}, {'name': 'MemoryIntensiveMedium', 'ram': 28672, 'cores': 2}, {'name': 'MemoryIntensiveLarge', 'ram': 57344, 'cores': 2}] |
class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = []
p = 1
for i in range(len(nums)):
res.append(p)
p *= nums[i]
p = 1
for i in range(len(nums) - 1, -1, -1):
res[i] *= p
p *= nums[i]
return res
def test_product_except_self():
assert [24, 12, 8, 6] == Solution().productExceptSelf([1, 2, 3, 4])
| class Solution(object):
def product_except_self(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = []
p = 1
for i in range(len(nums)):
res.append(p)
p *= nums[i]
p = 1
for i in range(len(nums) - 1, -1, -1):
res[i] *= p
p *= nums[i]
return res
def test_product_except_self():
assert [24, 12, 8, 6] == solution().productExceptSelf([1, 2, 3, 4]) |
__all__ = [
'ALPHABET',
'DIGITS',
'LOWERCASE',
'UPPERCASE',
]
DIGITS = '0123456789'
ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
LOWERCASE = 'abcdefghijklmnopqrstuvwxyz'
UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
| __all__ = ['ALPHABET', 'DIGITS', 'LOWERCASE', 'UPPERCASE']
digits = '0123456789'
alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowercase = 'abcdefghijklmnopqrstuvwxyz'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
BOT_NAME = 'councilman_scraper'
SPIDER_MODULES = ['councilman.spiders.spider']
NEWSPIDER_MODULE = 'councilman.spiders'
LOG_ENABLED = True
ITEM_PIPELINES = {
'councilman.pipelines.CouncilmanPipeline': 300,
}
| bot_name = 'councilman_scraper'
spider_modules = ['councilman.spiders.spider']
newspider_module = 'councilman.spiders'
log_enabled = True
item_pipelines = {'councilman.pipelines.CouncilmanPipeline': 300} |
def string_contains(string: str, substr: str) -> bool:
"""Determines whether substring is part of string or not
>>> string_contains("hello", "he")
True
>>> string_contains("hello", "wo")
False
"""
return substr in string
def string_begins_with(string: str, substr: str) -> bool:
"""Determines whether string starts with substring or not
>>> string_begins_with("hello", "he")
True
>>> string_begins_with("hello", "wo")
False
"""
return string.startswith(substr)
| def string_contains(string: str, substr: str) -> bool:
"""Determines whether substring is part of string or not
>>> string_contains("hello", "he")
True
>>> string_contains("hello", "wo")
False
"""
return substr in string
def string_begins_with(string: str, substr: str) -> bool:
"""Determines whether string starts with substring or not
>>> string_begins_with("hello", "he")
True
>>> string_begins_with("hello", "wo")
False
"""
return string.startswith(substr) |
def finder(data): ## define the finder argument (data)
return finder_rec(data, len(data)-1) ## return the answer
def finder_rec(data, x): ## define the finder_recursive argument as data and x
if x == 0: ## compares if x is equal to 0, then true
return data[x] ## return the answer
v1 = data[x] ## v1 equals the highest value in the range
v2 = finder_rec(data, x-1) ## v2 equals the lowest value in the range
if v1 > v2: ## if v1 is greater then v2
return v1 ## then return v1
else:
return v2 ## if not, return v2
print(finder([0, -247, 341, 1001, 741, 22])) ## print the answer from the data ranged passed in | def finder(data):
return finder_rec(data, len(data) - 1)
def finder_rec(data, x):
if x == 0:
return data[x]
v1 = data[x]
v2 = finder_rec(data, x - 1)
if v1 > v2:
return v1
else:
return v2
print(finder([0, -247, 341, 1001, 741, 22])) |
#coding: utf-8
def merge_sort(array):
if len(array) < 2:
return;
mid = len(array) / 2;
left = array[:mid];
right = array[mid:];
leftI = 0;
rightI = 0;
arrayI = 0;
while leftI < len(left) and rightI < len(right):
if left[leftI] < right[rightI]:
array[arrayI] = left[leftI];
leftI += 1;
else:
array[arrayI] = right[rightI];
rightI += 1;
arrayI += 1;
while leftI < len(left):
array[arrayI] = left[leftI];
leftI += 1;
arrayI += 1;
while rightI < len(right):
array[arrayI] = right[rightI];
rightI += 1;
arrayI += 1;
| def merge_sort(array):
if len(array) < 2:
return
mid = len(array) / 2
left = array[:mid]
right = array[mid:]
left_i = 0
right_i = 0
array_i = 0
while leftI < len(left) and rightI < len(right):
if left[leftI] < right[rightI]:
array[arrayI] = left[leftI]
left_i += 1
else:
array[arrayI] = right[rightI]
right_i += 1
array_i += 1
while leftI < len(left):
array[arrayI] = left[leftI]
left_i += 1
array_i += 1
while rightI < len(right):
array[arrayI] = right[rightI]
right_i += 1
array_i += 1 |
class ClientConfig(object):
PUBLIC_KEY = 'coGBxfv6BmRyw3TuucG2Awds5gRlk5fwxiDwAIIQ5v4'
APP_NAME = 'frumentarii'
COMPANY_NAME = 'JackEaston'
HTTP_TIMEOUT = 30
MAX_DOWNLOAD_RETRIES = 3
UPDATE_URLS = ['https://github.com/perseusnova/Frumentarii-Python']
| class Clientconfig(object):
public_key = 'coGBxfv6BmRyw3TuucG2Awds5gRlk5fwxiDwAIIQ5v4'
app_name = 'frumentarii'
company_name = 'JackEaston'
http_timeout = 30
max_download_retries = 3
update_urls = ['https://github.com/perseusnova/Frumentarii-Python'] |
# Tai Sakuma <tai.sakuma@gmail.com>
##__________________________________________________________________||
class ProgressReport(object):
"""A progress report
Args:
name (str): the name of the task. if ``taskid`` is ``None``, used to identify the task
done (int): the number of the iterations done so far
total (int): the total iterations to be done
taskid (immutable, optional): if given, used to identify the task. useful if multiple tasks have the same name
"""
def __init__(self, name, done, total, taskid = None):
self.taskid = taskid if taskid is not None else name
self.name = name
self.done = done
self.total = total
self.misc_str = ""
def __repr__(self):
name_value_pairs = (
('taskid', self.taskid),
('name', self.name),
('done', self.done),
('total', self.total),
)
return '{}({})'.format(
self.__class__.__name__,
', '.join(['{} = {!r}'.format(n, v) for n, v in name_value_pairs]),
)
def last(self):
return self.done >= self.total
def first(self):
return self.done == 0
##__________________________________________________________________||
| class Progressreport(object):
"""A progress report
Args:
name (str): the name of the task. if ``taskid`` is ``None``, used to identify the task
done (int): the number of the iterations done so far
total (int): the total iterations to be done
taskid (immutable, optional): if given, used to identify the task. useful if multiple tasks have the same name
"""
def __init__(self, name, done, total, taskid=None):
self.taskid = taskid if taskid is not None else name
self.name = name
self.done = done
self.total = total
self.misc_str = ''
def __repr__(self):
name_value_pairs = (('taskid', self.taskid), ('name', self.name), ('done', self.done), ('total', self.total))
return '{}({})'.format(self.__class__.__name__, ', '.join(['{} = {!r}'.format(n, v) for (n, v) in name_value_pairs]))
def last(self):
return self.done >= self.total
def first(self):
return self.done == 0 |
_base_ = [
'../_base_/datasets/waymo_cars_and_peds.py',
'../_base_/models/pointnet2_seg.py',
'../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py'
]
# data settings
data = dict(samples_per_gpu=16)
evaluation = dict(interval=50)
# runtime settings
checkpoint_config = dict(interval=50)
# PointNet2-MSG needs longer training time than PointNet2-SSG
runner = dict(type='EpochBasedRunner', max_epochs=500)
#resume_from = 'work_dirs/pointnet2_waymo_cars_and_peds_gap01/latest.pth'
shared_args=dict(
gap=0.1,
train_interval=97,
maximum_samples=dict(Car=1000, Pedestrian=1000),
)
data = dict(
train=dict(
load_interval=1,
**shared_args),
val=dict(
load_interval=97,
**shared_args),
test=dict(
load_interval=97,
**shared_args)
)
| _base_ = ['../_base_/datasets/waymo_cars_and_peds.py', '../_base_/models/pointnet2_seg.py', '../_base_/schedules/cyclic_20e.py', '../_base_/default_runtime.py']
data = dict(samples_per_gpu=16)
evaluation = dict(interval=50)
checkpoint_config = dict(interval=50)
runner = dict(type='EpochBasedRunner', max_epochs=500)
shared_args = dict(gap=0.1, train_interval=97, maximum_samples=dict(Car=1000, Pedestrian=1000))
data = dict(train=dict(load_interval=1, **shared_args), val=dict(load_interval=97, **shared_args), test=dict(load_interval=97, **shared_args)) |
# -*- coding: utf-8 -*-
'''
Created on 20.12.2012
@author: 802300
'''
c_cycle_dark = (32,88,103)
c_cycle = (49,133,155)
c_cycle_light = (139,202,218)
c_cycle_alt = (146,208,80)
c_due = (192,0,0)
c_due_later = (255,86,30)
c_sub = (255,238,87)
c_sub_alt = (255,192,0)
c_sub2 = (66,191,89)
c_vorlauf = c_sub_alt
c_submission = c_cycle_dark
c_mahn = c_cycle_alt
c_mahn_light = (179,222,131)
c_mahn_extra_light = (217,237,188) | """
Created on 20.12.2012
@author: 802300
"""
c_cycle_dark = (32, 88, 103)
c_cycle = (49, 133, 155)
c_cycle_light = (139, 202, 218)
c_cycle_alt = (146, 208, 80)
c_due = (192, 0, 0)
c_due_later = (255, 86, 30)
c_sub = (255, 238, 87)
c_sub_alt = (255, 192, 0)
c_sub2 = (66, 191, 89)
c_vorlauf = c_sub_alt
c_submission = c_cycle_dark
c_mahn = c_cycle_alt
c_mahn_light = (179, 222, 131)
c_mahn_extra_light = (217, 237, 188) |
with open("program") as file:
initialProgram = file.readlines()[0]
initialProgram = initialProgram.split(",")
def executeProgram(program):
pointer = 0
result = 0
while 1:
arg1 = program[pointer+1]
arg2 = program[pointer+2]
if program[pointer] == 1:
result = program[arg1]+program[arg2]
elif program[pointer] == 2:
result = program[arg1]*program[arg2]
elif program[pointer] == 99:
break
else:
print("ERROR: bad opcode ("+str(program[pointer])+") at position: "+str(pointer))
program[program[pointer+3]] = result
pointer += 4
return program[0]
for noun in range(99):
for verb in range(99):
program=list(map(int, initialProgram))
program[1]=noun
program[2]=verb
if executeProgram(program) == 19690720:
print(noun*100+verb)
break | with open('program') as file:
initial_program = file.readlines()[0]
initial_program = initialProgram.split(',')
def execute_program(program):
pointer = 0
result = 0
while 1:
arg1 = program[pointer + 1]
arg2 = program[pointer + 2]
if program[pointer] == 1:
result = program[arg1] + program[arg2]
elif program[pointer] == 2:
result = program[arg1] * program[arg2]
elif program[pointer] == 99:
break
else:
print('ERROR: bad opcode (' + str(program[pointer]) + ') at position: ' + str(pointer))
program[program[pointer + 3]] = result
pointer += 4
return program[0]
for noun in range(99):
for verb in range(99):
program = list(map(int, initialProgram))
program[1] = noun
program[2] = verb
if execute_program(program) == 19690720:
print(noun * 100 + verb)
break |
#######################################
#########Variaveis de mails############
#######################################
ADMIN_MAIL = "admin@mtgchance.com"
SITE_NAME = "MTG CHANCE"
SITE_LOCATION = "www.mtgchance.com"
#######################################
##########PAISES ADMITIDOS#############
#######################################
ALLOWED_COUNTRIES = ['Portugal','Brasil']
#######################################
##########VALOR DAS CARTAS#############
#######################################
VALUE_OF_COMMON_CARD = 2
VALUE_OF_UNCOMMON_CARD = 8
VALUE_OF_RARE_CARD = 30
#######################################
#######BY IMPORTANCE OF CARDS##########
#######################################
NUMBER_CARDS_TO_TAKE_OUT_BY_IMPORTANCE = 3
NUMBER_OF_COMMON_UNCOMMON_TO_TAKE = 6
NUMBER_OF_RARE_TO_TAKE = 5
NUMBER_OF_MYTIC_TO_TAKE = 1
#######################################
#######MOEDA USADA PELO SITE###########
#######################################
MOEDA_DA_PAGINA = "Créditos"
# 1 credito = euros....
VALOR_MOEDA_DO_SITE_PORTUGAL = "0.01 € = 1 crédito"
VALOR_MOEDA_DO_SITE_BRASIL = "0.03 Real = 1 crédito"
MULTIPLICADOR_CREDITOS_PORTUGAL = 0.01
MULTIPLICADOR_CREDITOS_BRASIL = 0.03
#######################################
##########PRECOS DO CORREIO############
#######################################
CORREIO_NORMAL = 3
CORREIO_AZUL = 70
CORREIO_REGISTADO = 250
CORREIO_INTERNACIONAL = 250
CORREIO_INTERNACIONAL_COM_RASTREIO = 450
#######################################
################Custos#################
#######################################
CUSTO_TRANSFERENCIA_ENTRE_USERS = 8
CUSTO_TRANSFERENCIA_ENTRE_USERS_PARA_PARCEIROS = 0
EXCEPCOES_NOS_CUSTOS_DE_TRANSFERENCIAS=['munhanha@gmail.com']
#######################################
#############Vencedores################
#######################################
WINNERS_ACTIVE = False
WINNER_VALUE = 25
NUMBER_OCCURRENCES = 50
#######################################
#########CLEAN CLICKS RARIDADE#########
#######################################
RESET_CLICKS_COMMON = 150
RESET_CLICKS_UNCOMMON = 150
RESET_CLICKS_RARE = 100
#######################################
########USER SEARCH NUMBER#############
#######################################
USER_SEARCH_COUNT = 20
USER_SEARCH_COUNT_WITH_COLOUR_EDITION = 100
#######################################
#######MAX NUMBER CARDS PER USER#######
#######################################
MAX_NUMBER_CARDS_PER_USER = 4
#######################################
#Allowed colours for user card search##
#######################################
ALLOWED_COLOURS_USER_CARD_SEARCH = ['','B','W','R','G','U','Lnd','Gld','Art']
| admin_mail = 'admin@mtgchance.com'
site_name = 'MTG CHANCE'
site_location = 'www.mtgchance.com'
allowed_countries = ['Portugal', 'Brasil']
value_of_common_card = 2
value_of_uncommon_card = 8
value_of_rare_card = 30
number_cards_to_take_out_by_importance = 3
number_of_common_uncommon_to_take = 6
number_of_rare_to_take = 5
number_of_mytic_to_take = 1
moeda_da_pagina = 'Créditos'
valor_moeda_do_site_portugal = '0.01 € = 1 crédito'
valor_moeda_do_site_brasil = '0.03 Real = 1 crédito'
multiplicador_creditos_portugal = 0.01
multiplicador_creditos_brasil = 0.03
correio_normal = 3
correio_azul = 70
correio_registado = 250
correio_internacional = 250
correio_internacional_com_rastreio = 450
custo_transferencia_entre_users = 8
custo_transferencia_entre_users_para_parceiros = 0
excepcoes_nos_custos_de_transferencias = ['munhanha@gmail.com']
winners_active = False
winner_value = 25
number_occurrences = 50
reset_clicks_common = 150
reset_clicks_uncommon = 150
reset_clicks_rare = 100
user_search_count = 20
user_search_count_with_colour_edition = 100
max_number_cards_per_user = 4
allowed_colours_user_card_search = ['', 'B', 'W', 'R', 'G', 'U', 'Lnd', 'Gld', 'Art'] |
"""
This scripts shows how to train a POS tagger using trapper. However,
intentionally, the dependency injection mechanism is not used, instead the
objects are instantiated directly from concrete classes suitable for the job.
Although we recommended config file based training using the trapper CLI instead,
you can use this file to create a custom training script for your needs.
"""
| """
This scripts shows how to train a POS tagger using trapper. However,
intentionally, the dependency injection mechanism is not used, instead the
objects are instantiated directly from concrete classes suitable for the job.
Although we recommended config file based training using the trapper CLI instead,
you can use this file to create a custom training script for your needs.
""" |
"""
Contains configuration data for interacting with the source_data folder.
These are hardcoded here as this is meant to be a dumping
ground. Source_data is not actually user configurable.
For customized data loading, use mhwdata.io directly.
"""
supported_ranks = ('LR', 'HR')
"A mapping of all translations"
all_languages = {
'en': "English",
'ja': "Japanese"
}
"A list of languages that require complete translations. Used in validation"
required_languages = ('en',)
"A list of languages that can be exported"
supported_languages = ('en', 'ja')
"Languages that are designated as potentially incomplete"
incomplete_languages = ('ja',)
"List of all possible armor parts"
armor_parts = ('head', 'chest', 'arms', 'waist', 'legs')
"Maximum number of items in a recipe"
max_recipe_item_count = 4
"Maximum number of skills in an armor piece/weapon"
max_skill_count = 2
"A list of all melee weapon types"
weapon_types_melee = ('great-sword', 'long-sword', 'sword-and-shield', 'dual-blades',
'hammer', 'hunting-horn', 'lance', 'gunlance', 'switch-axe', 'charge-blade',
'insect-glaive')
"A list of all ranged weapon types"
weapon_types_ranged = ('light-bowgun', 'heavy-bowgun', 'bow')
"A list of all weapon types"
weapon_types = (*weapon_types_melee, *weapon_types_ranged)
"Valid possible kinsect boosts"
valid_kinsects = ('sever', 'blunt', 'speed', 'element', 'health', 'stamina')
"Valid possible phial types (switchaxe and chargeblade)"
valid_phials = ('power', 'power element', 'dragon', 'poison', 'paralysis', 'exhaust', 'impact')
"Valid gunlance shelling types"
valid_shellings = ('normal', 'wide', 'long')
icon_colors = [
"Gray", "White", "Lime", "Green", "Cyan", "Blue", "Violet", "Orange",
"Pink", "Red", "DarkRed", "LightBeige", "Beige", "DarkBeige", "Yellow",
"Gold", "DarkGreen", "DarkPurple"
] | """
Contains configuration data for interacting with the source_data folder.
These are hardcoded here as this is meant to be a dumping
ground. Source_data is not actually user configurable.
For customized data loading, use mhwdata.io directly.
"""
supported_ranks = ('LR', 'HR')
'A mapping of all translations'
all_languages = {'en': 'English', 'ja': 'Japanese'}
'A list of languages that require complete translations. Used in validation'
required_languages = ('en',)
'A list of languages that can be exported'
supported_languages = ('en', 'ja')
'Languages that are designated as potentially incomplete'
incomplete_languages = ('ja',)
'List of all possible armor parts'
armor_parts = ('head', 'chest', 'arms', 'waist', 'legs')
'Maximum number of items in a recipe'
max_recipe_item_count = 4
'Maximum number of skills in an armor piece/weapon'
max_skill_count = 2
'A list of all melee weapon types'
weapon_types_melee = ('great-sword', 'long-sword', 'sword-and-shield', 'dual-blades', 'hammer', 'hunting-horn', 'lance', 'gunlance', 'switch-axe', 'charge-blade', 'insect-glaive')
'A list of all ranged weapon types'
weapon_types_ranged = ('light-bowgun', 'heavy-bowgun', 'bow')
'A list of all weapon types'
weapon_types = (*weapon_types_melee, *weapon_types_ranged)
'Valid possible kinsect boosts'
valid_kinsects = ('sever', 'blunt', 'speed', 'element', 'health', 'stamina')
'Valid possible phial types (switchaxe and chargeblade)'
valid_phials = ('power', 'power element', 'dragon', 'poison', 'paralysis', 'exhaust', 'impact')
'Valid gunlance shelling types'
valid_shellings = ('normal', 'wide', 'long')
icon_colors = ['Gray', 'White', 'Lime', 'Green', 'Cyan', 'Blue', 'Violet', 'Orange', 'Pink', 'Red', 'DarkRed', 'LightBeige', 'Beige', 'DarkBeige', 'Yellow', 'Gold', 'DarkGreen', 'DarkPurple'] |
def distance(strand1, strand2):
count = 0
for x, y in zip(strand1, strand2):
if x != y:
count += 1
return count
| def distance(strand1, strand2):
count = 0
for (x, y) in zip(strand1, strand2):
if x != y:
count += 1
return count |
"""
NOTE: This is a future consensus test not yet ready to merge
Let the work below be a point of reference for testing
import os
import pathlib
from mapmerge.constants import FREE, OCCUPIED, UNKNOWN
from mapmerge.merge_utils import augment_map, combine_aligned_maps, detect_fault, load_mercer_map, acceptance_index, pad_maps, resize_map
from mapmerge.service import mapmerge_pipeline
from mapmerge.keypoint_merge import sift_mapmerge, orb_mapmerge
from mapmerge.hough_merge import hough_mapmerge
from mapmerge.ros_utils import pgm_to_numpy
import numpy as np
import matplotlib.pyplot as plt
TEST_DIR = pathlib.Path(__file__).parent.absolute()
# load 'difficult' map with curved walls and intricate details
PATH_TO_INTEL_TEST_MAP = os.path.join(TEST_DIR, 'test_data', 'intel.txt')
INTEL_TEST_MAP = load_mercer_map(PATH_TO_INTEL_TEST_MAP)
def generate_n_maps(n=4, map=INTEL_TEST_MAP):
robot_maps = [INTEL_TEST_MAP]
x_size, y_size = int(map.shape[0]//(n/2)), int(map.shape[1]//(n/2))
print(x_size)
for i in range(n-1):
map_aug, _ = augment_map(map, shift_limit=0, rotate_limit=5)
# mask out quadrants of the map
robot_maps.append(map_aug)
# mask out quadrants of the map
robot_maps[0][:x_size, :y_size] = UNKNOWN
robot_maps[1][:x_size, y_size::] = UNKNOWN
robot_maps[2][x_size::, :y_size] = UNKNOWN
robot_maps[3][x_size::, y_size::] = UNKNOWN
fig, axes = plt.subplots(1, 5)
axes[0].imshow(map, cmap="gray")
axes[1].imshow(robot_maps[0], cmap="gray")
axes[2].imshow(robot_maps[1], cmap="gray")
axes[3].imshow(robot_maps[2], cmap="gray")
axes[4].imshow(robot_maps[3], cmap="gray")
plt.show()
if __name__ == "__main__":
generate_n_maps()
""" | """
NOTE: This is a future consensus test not yet ready to merge
Let the work below be a point of reference for testing
import os
import pathlib
from mapmerge.constants import FREE, OCCUPIED, UNKNOWN
from mapmerge.merge_utils import augment_map, combine_aligned_maps, detect_fault, load_mercer_map, acceptance_index, pad_maps, resize_map
from mapmerge.service import mapmerge_pipeline
from mapmerge.keypoint_merge import sift_mapmerge, orb_mapmerge
from mapmerge.hough_merge import hough_mapmerge
from mapmerge.ros_utils import pgm_to_numpy
import numpy as np
import matplotlib.pyplot as plt
TEST_DIR = pathlib.Path(__file__).parent.absolute()
# load 'difficult' map with curved walls and intricate details
PATH_TO_INTEL_TEST_MAP = os.path.join(TEST_DIR, 'test_data', 'intel.txt')
INTEL_TEST_MAP = load_mercer_map(PATH_TO_INTEL_TEST_MAP)
def generate_n_maps(n=4, map=INTEL_TEST_MAP):
robot_maps = [INTEL_TEST_MAP]
x_size, y_size = int(map.shape[0]//(n/2)), int(map.shape[1]//(n/2))
print(x_size)
for i in range(n-1):
map_aug, _ = augment_map(map, shift_limit=0, rotate_limit=5)
# mask out quadrants of the map
robot_maps.append(map_aug)
# mask out quadrants of the map
robot_maps[0][:x_size, :y_size] = UNKNOWN
robot_maps[1][:x_size, y_size::] = UNKNOWN
robot_maps[2][x_size::, :y_size] = UNKNOWN
robot_maps[3][x_size::, y_size::] = UNKNOWN
fig, axes = plt.subplots(1, 5)
axes[0].imshow(map, cmap="gray")
axes[1].imshow(robot_maps[0], cmap="gray")
axes[2].imshow(robot_maps[1], cmap="gray")
axes[3].imshow(robot_maps[2], cmap="gray")
axes[4].imshow(robot_maps[3], cmap="gray")
plt.show()
if __name__ == "__main__":
generate_n_maps()
""" |
class Mapper():
prg_banks = 0
chr_banks = 0
def __init__(self, prg_banks, chr_banks): pass
def cpuMapRead(self, addr): pass
def cpuMapWrite(self, addr): pass
def ppuMapRead(self, addr): pass
def ppuMapWrite(self, addr): pass
def reset(self): pass
| class Mapper:
prg_banks = 0
chr_banks = 0
def __init__(self, prg_banks, chr_banks):
pass
def cpu_map_read(self, addr):
pass
def cpu_map_write(self, addr):
pass
def ppu_map_read(self, addr):
pass
def ppu_map_write(self, addr):
pass
def reset(self):
pass |
HOST = "127.0.0.1"
PORT = 1337
COMMAND_START = "docker start minecraft-server"
COMMAND_STOP = "docker stop minecraft-server"
MCSTATUS_COMMAND = "docker exec minecraft-server mcstatus localhost status"
# Time to wait for the port to become available
STARTUP_DELAY = 1
# Time to wait for the player to join
STARTUP_TIMER = 90
# Time to wait for the server being empty
SHUTDOWN_TIMER = 300
# Change the motd to the start time
EDIT_MOTD = False
| host = '127.0.0.1'
port = 1337
command_start = 'docker start minecraft-server'
command_stop = 'docker stop minecraft-server'
mcstatus_command = 'docker exec minecraft-server mcstatus localhost status'
startup_delay = 1
startup_timer = 90
shutdown_timer = 300
edit_motd = False |
# FIRST CLASS FUNCTIONS:
# a programming language is said to have first class functions if it treats functions as first class citizens.
# FIRST CLASS CITIZEN (PROGRAMMING):
# a first class citizen (sometimes called first class object) in a programming language is an entity
# which supports all the operations generally available to other entities. These operations typically
# include being passed as an arguement, returned from a function and assigned to a variable.
# it actually mean we should be able to treat functions just like any other object or variable.
# ASSIGNED A FUNCTION TO A VARIABLE:
# what does it mean to assign a function to a variable?
# this doen't mean that we are assigning the result of the function.
def square(x):
return x**2
f=square(5)
print(square)
print(f)
# but we can remove those parenthesis and treat "f" as our square function. Because parenthesis means execute the function.
# we dont want to execute it, we want to "f" equal to square function.
f=square
print(square)
print(f)
# now we can use "f" just like our square function.
print(f(5))
# WHAT IS A HIGHER ORDER FUNCTION?
# if a function accepts other functions as arguement or return function as their results that is called a "Higher Order Function".
# A FUNCTION BEING PASSED BY AN ARGUEMENT:
# very common scenario of this type function is "map" function.
# lets create a map function
def my_map(func,arg_list):
r_list=[]
for i in arg_list:
r_list.append(func(i))
return r_list
def cube(x):
return x**3
cubes=my_map(cube,[1,2,3,4,5,6,7]) # here we don't use parenthesis after cube as we are not executing it.
print(cubes)
# default map function
cubes2=list(map(cube,[1,2,3,4,5,6,7]))
print(cubes2)
# RETURN A FUNCTION FROM A FUNCTION:
# this is most complicated and confusing among previous examples.
def logger(msg):
def log_message():
print("log:",msg)
return log_message
log_hi=logger("hi")
log_hi()# it has remembered our initial message that we have passed in the initial logger function.
# why this first class functions are useful?
# lets see some practical examples.
def html_tag(tag):
def wrap_text(msg):
print("<{0}>{1}</{0}>".format(tag,msg))
return wrap_text
print_h1=html_tag("h1")
print_h1("Test Headline")# it has print our wrap text function and has remembered initial tag.
print_h1("Another Headline")
print_p=html_tag("p")
print_p("Test Paragraph")
# we can also use this type of functions for logging and python decorator.
| def square(x):
return x ** 2
f = square(5)
print(square)
print(f)
f = square
print(square)
print(f)
print(f(5))
def my_map(func, arg_list):
r_list = []
for i in arg_list:
r_list.append(func(i))
return r_list
def cube(x):
return x ** 3
cubes = my_map(cube, [1, 2, 3, 4, 5, 6, 7])
print(cubes)
cubes2 = list(map(cube, [1, 2, 3, 4, 5, 6, 7]))
print(cubes2)
def logger(msg):
def log_message():
print('log:', msg)
return log_message
log_hi = logger('hi')
log_hi()
def html_tag(tag):
def wrap_text(msg):
print('<{0}>{1}</{0}>'.format(tag, msg))
return wrap_text
print_h1 = html_tag('h1')
print_h1('Test Headline')
print_h1('Another Headline')
print_p = html_tag('p')
print_p('Test Paragraph') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.