content stringlengths 7 1.05M |
|---|
if __name__ == '__main__':
x = 1
y = [2]
x, = y
print(x)
|
class Decoder:
def __init__(self, alphabet, symbol):
self._alphabet = alphabet
self._symbol = symbol
self._reconstructed_extended_dict = {
int(symbol): letter for letter, symbol in self._alphabet.copy().items()
}
def decode(self, encoded_input):
output = ""
last_decoded_symbol = ""
for current_decoded_symbol in self._decoded_symbols(encoded_input):
if current_decoded_symbol is None:
value_to_add = last_decoded_symbol + last_decoded_symbol[0]
current_decoded_symbol = value_to_add
else:
value_to_add = last_decoded_symbol + current_decoded_symbol[0]
output += current_decoded_symbol
last_decoded_symbol = current_decoded_symbol
self._update_dict(value_to_add)
return output
def _decoded_symbols(self, encoded_input):
i = 0
while i < len(encoded_input):
symbol_length = self._symbol.next_bit_length
current_symbol = encoded_input[i : i + symbol_length]
current_int_symbol = int(current_symbol)
current_decoded_symbol = self._reconstructed_extended_dict.get(
current_int_symbol
)
i += symbol_length
yield current_decoded_symbol
def _update_dict(self, value_to_add):
if value_to_add not in self._reconstructed_extended_dict.values():
self._reconstructed_extended_dict[int(next(self._symbol))] = value_to_add
|
listanum = [[],[]] #Primeiro colchete numeros pares e segundo colchete numeros impares
valor = 0
for cont in range(1,8):
valor = int(input("Digite um valor: "))
if valor % 2 ==0:
listanum[0].append(valor)
else:
listanum[1].append(valor)
listanum[0].sort()
listanum[1].sort()
print(f"Os numeros pares digitados foram {listanum[0]}")
print(f"Os numeros impares digitados foram {listanum[1]}")
|
""" --- Day 3: Toboggan Trajectory ---
With the toboggan login problems resolved, you set off toward the airport. While travel by toboggan might be easy, it's certainly not safe: there's very minimal steering and the area is covered in trees. You'll need to see which angles will take you near the fewest trees.
Due to the local geology, trees in this area only grow on exact integer coordinates in a grid. You make a map (your puzzle input) of the open squares (.) and trees (#) you can see. For example:
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#
These aren't the only trees, though; due to something you read about once involving arboreal genetics and biome stability, the same pattern repeats to the right many times:
..##.........##.........##.........##.........##.........##....... --->
#...#...#..#...#...#..#...#...#..#...#...#..#...#...#..#...#...#..
.#....#..#..#....#..#..#....#..#..#....#..#..#....#..#..#....#..#.
..#.#...#.#..#.#...#.#..#.#...#.#..#.#...#.#..#.#...#.#..#.#...#.#
.#...##..#..#...##..#..#...##..#..#...##..#..#...##..#..#...##..#.
..#.##.......#.##.......#.##.......#.##.......#.##.......#.##..... --->
.#.#.#....#.#.#.#....#.#.#.#....#.#.#.#....#.#.#.#....#.#.#.#....#
.#........#.#........#.#........#.#........#.#........#.#........#
#.##...#...#.##...#...#.##...#...#.##...#...#.##...#...#.##...#...
#...##....##...##....##...##....##...##....##...##....##...##....#
.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.#.#..#...#.# --->
You start on the open square (.) in the top-left corner and need to reach the bottom (below the bottom-most row on your map).
The toboggan can only follow a few specific slopes (you opted for a cheaper model that prefers rational numbers); start by counting all the trees you would encounter for the slope right 3, down 1:
From your starting position at the top-left, check the position that is right 3 and down 1. Then, check the position that is right 3 and down 1 from there, and so on until you go past the bottom of the map.
The locations you'd check in the above example are marked here with O where there was an open square and X where there was a tree:
..##.........##.........##.........##.........##.........##....... --->
#..O#...#..#...#...#..#...#...#..#...#...#..#...#...#..#...#...#..
.#....X..#..#....#..#..#....#..#..#....#..#..#....#..#..#....#..#.
..#.#...#O#..#.#...#.#..#.#...#.#..#.#...#.#..#.#...#.#..#.#...#.#
.#...##..#..X...##..#..#...##..#..#...##..#..#...##..#..#...##..#.
..#.##.......#.X#.......#.##.......#.##.......#.##.......#.##..... --->
.#.#.#....#.#.#.#.O..#.#.#.#....#.#.#.#....#.#.#.#....#.#.#.#....#
.#........#.#........X.#........#.#........#.#........#.#........#
#.##...#...#.##...#...#.X#...#...#.##...#...#.##...#...#.##...#...
#...##....##...##....##...#X....##...##....##...##....##...##....#
.#..#...#.#.#..#...#.#.#..#...X.#.#..#...#.#.#..#...#.#.#..#...#.# --->
In this example, traversing the map using this slope would cause you to encounter 7 trees.
Starting at the top-left corner of your map and following a slope of right 3 and down 1, how many trees would you encounter? """
""" --- Part Two ---
Time to check the rest of the slopes - you need to minimize the probability of a sudden arboreal stop, after all.
Determine the number of trees you would encounter if, for each of the following slopes, you start at the top-left corner and traverse the map all the way to the bottom:
Right 1, down 1.
Right 3, down 1. (This is the slope you already checked.)
Right 5, down 1.
Right 7, down 1.
Right 1, down 2.
In the above example, these slopes would find 2, 7, 3, 4, and 2 tree(s) respectively; multiplied together, these produce the answer 336.
What do you get if you multiply together the number of trees encountered on each of the listed slopes? """
# Initialize variables
d03_input = []
# Read the input, stripping newlines from the end of each line and saving each line as an item in a list
with open('d03/d03_input.txt') as f:
d03_input = [(line.rstrip()) for line in f]
f.close()
print(d03_input)
path = d03_input
num_trees = 0
i = 0
j = 0
num_trees_1_1 = 0
i_1_1 = 0
j_1_1 = 0
num_trees_1_5 = 0
i_1_5 = 0
j_1_5 = 0
num_trees_1_7 = 0
i_1_7 = 0
j_1_7 = 0
num_trees_2_1 = 0
i_2_1 = 0
j_2_1 = 0
for line in path:
if i < len(path):
if j >= len(line):
j-=(len(line))
if line[j] == '#':
num_trees+=1
print(i, len(line), j, line[j], num_trees)
i+=1
j+=3
if i_1_1 < len(path):
if j_1_1 >= len(line):
j_1_1-=(len(line))
if line[j_1_1] == '#':
num_trees_1_1+=1
print(i_1_1, len(line), j_1_1, line[j_1_1], num_trees_1_1)
i_1_1+=1
j_1_1+=1
if i_1_5 < len(path):
if j_1_5 >= len(line):
j_1_5-=(len(line))
if line[j_1_5] == '#':
num_trees_1_5+=1
print(i_1_5, len(line), j_1_5, line[j_1_5], num_trees_1_5)
i_1_5+=1
j_1_5+=5
if i_1_7 < len(path):
if j_1_7 >= len(line):
j_1_7-=(len(line))
if line[j_1_7] == '#':
num_trees_1_7+=1
print(i_1_7, len(line), j_1_7, line[j_1_7], num_trees_1_7)
i_1_7+=1
j_1_7+=7
if i_2_1 < len(path):
if (i_2_1) % 2 == 0:
if j_2_1 >= len(line):
j_2_1-=(len(line))
if line[j_2_1] == '#':
num_trees_2_1+=1
print(i_2_1, len(line), j_2_1, line[j_2_1], num_trees_2_1)
i_2_1+=1
j_2_1+=1
print(num_trees, num_trees_1_1, num_trees_1_5, num_trees_1_7, num_trees_2_1)
print(num_trees * num_trees_1_1 * num_trees_1_5 * num_trees_1_7 * num_trees_2_1)
|
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This module has different wrappers for the data structures."""
class PaginationResult:
"""PaginationResult wraps a data about a certain page in pagination."""
def __init__(self, model_class, items, pagination):
self.model_class = model_class
self.items = items
self.pagination = pagination
self.total = items.count()
def make_api_structure(self):
"""Makes API structure, converatable to JSON."""
if self.pagination["all"]:
return self.response_all()
return self.response_paginated()
def response_all(self):
return {
"total": self.total,
"per_page": self.total,
"page": 1,
"items": list(self.modelize(self.items))
}
def response_paginated(self):
items = self.items
page_items_before = self.pagination["per_page"] \
* (self.pagination["page"] - 1)
if page_items_before:
items = items.skip(page_items_before)
items = items.limit(self.pagination["per_page"])
return {
"items": list(self.modelize(items)),
"page": self.pagination["page"],
"per_page": self.pagination["per_page"],
"total": self.total
}
def modelize(self, items):
for item in items:
model = self.model_class()
model.update_from_db_document(item)
yield model
|
path = "../data/stockfish_norm.csv"
scores = open( path)
last_scores = open( "last_scores.fea", "w")
for row in scores:
last_scores.write( row.rsplit(" ", 1)[1])
scores.close()
last_scores.close() |
"""
noop.py: An event filter that does nothing to the input.
"""
def main(event):
return event
|
class MudCommand:
"""
This is the base class for all commands in the MUD.
"""
def __init__(self):
self.info = {}
self.info['cmdName'] = ''
self.info['helpText'] = ''
self.info['useExample'] = ''
def setType(self, type):
self.info['actiontype'] = type
def getName(self):
return self.info['cmdName']
def getHelpText(self):
return self.info['helpText']
def getUseExample(self):
return self.info['useExample'] |
def get_human_readable_time(seconds: float) -> str:
"""Convert seconds into a human-readable string.
Args:
seconds: number of seconds
Returns:
String that displays time in Days Hours, Minutes, Seconds format
"""
prefix = "-" if seconds < 0 else ""
seconds = abs(seconds)
int_seconds = int(seconds)
days, int_seconds = divmod(int_seconds, 86400)
hours, int_seconds = divmod(int_seconds, 3600)
minutes, int_seconds = divmod(int_seconds, 60)
if days > 0:
time_string = f"{days}d{hours}h{minutes}m{int_seconds}s"
elif hours > 0:
time_string = f"{hours}h{minutes}m{int_seconds}s"
elif minutes > 0:
time_string = f"{minutes}m{int_seconds}s"
else:
time_string = f"{seconds:.3f}s"
return prefix + time_string
|
def mutation(word_list):
if all(i in word_list[0].lower() for i in word_list[1].lower()):
return True
return False
print(mutation(["hello", "Hello"]))
print(mutation(["hello", "hey"]))
print(mutation(["Alien", "line"]))
|
"""Kata url: https://www.codewars.com/kata/5556282156230d0e5e000089."""
def dna_to_rna(dna: str) -> str:
return dna.replace('T', 'U')
|
def index(req):
req.content_type = "text/html"
req.add_common_vars()
env_vars = req.subprocess_env.copy()
req.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
req.write('<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">')
req.write('<head><title>mod_python.publisher</title></head>')
req.write('<body>')
req.write('<h1>Environment Variables</h1>')
req.write('<table border="1">')
for key in env_vars:
req.write('<tr><td>%s</td><td>%s</td></tr>' % (key, env_vars[key]))
req.write('</table>')
req.write('</body>')
req.write('</html>')
|
# coding=utf-8
"""
A basic rules engine, as well as a set of standard predicates and transformers.
* Predicates are the equivalent of a conditional. They take the comparable
given in the rule on the left and compare it to the value being tested
on the right, returning a boolean.
* Transformers can be considered a form of result. If a rule is matched, the
transformer is run.
See each module below for more information on how everything works.
Submodules
==========
.. currentmodule:: ultros.core.rules
.. autosummary::
:toctree: rules
constants
engine
predicates
transformers
"""
__author__ = "Gareth Coles"
|
class Vehicle:
name = ""
kind = "car"
color = ""
value = 00.00
def description (self):
desc ="%s is a %s %s worth $%.2f." % (self.name,self.color,self.kind,self.value)
return desc
car1 = Vehicle()
car1.name = "Fuso"
car1.color = "grey"
car1.kind = "lorry"
car1.value = 1000
car2 = Vehicle()
car2.name = "ferrari"
car2.color = "Red"
car2.kind = "convertible"
car2.value = 5000
print (car1.description())
print (car2.description()) |
class ContactHelper:
def __init__(self, app):
self.app = app
def create(self, contact):
wd = self.app.wd
# init contact creation
wd.find_element_by_link_text("add new").click()
# foll contact form
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by_name("firstname").send_keys(contact.firstname)
wd.find_element_by_name("lastname").click()
wd.find_element_by_name("lastname").clear()
wd.find_element_by_name("lastname").send_keys(contact.lastname)
wd.find_element_by_name("address").click()
wd.find_element_by_name("address").clear()
wd.find_element_by_name("address").send_keys(contact.address)
wd.find_element_by_name("mobile").click()
wd.find_element_by_name("mobile").clear()
wd.find_element_by_name("mobile").send_keys(contact.mobile)
wd.find_element_by_xpath("//div[@id='content']/form/input[21]").click()
self.return_to_contacts_page()
def return_to_contacts_page(self):
wd = self.app.wd
wd.find_element_by_link_text("home").click() |
class Solution(object):
def arrayNesting(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
dict = {}
ans = 0
for i in nums:
if i in dict:
continue
label = nums.index(i)
dict[label] = 1
x = i
tot = 1
while (x != label):
dict[x] = 1
tot += 1
x = nums[x]
if tot > ans :
ans = tot
#print(tot)
return ans
s = Solution()
print(s.arrayNesting([5,4,0,3,1,6,2])) |
#
# Copyright (c) 2017 Amit Green. All rights reserved.
#
@gem('Gem.Codec')
def gem():
require_gem('Gem.Import')
PythonCodec = import_module('codecs')
python_encode_ascii = PythonCodec.getencoder('ascii')
@export
def encode_ascii(s):
return python_encode_ascii(s)[0]
|
num1 = 1.5
num2 = 6.3
sum = num1 + num2
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
|
"""
875. 爱吃香蕉的珂珂
https://leetcode-cn.com/problems/koko-eating-bananas/
"""
# n根香蕉以speed吃完需要的时间
def timeof(n, speed):
return (n // speed) + (1 if n % speed > 0 else 0)
# piles堆香蕉,以speed的速度,H小时内能否吃完
def canFinish(piles, speed, H):
# 累加吃每堆香蕉的时间
time = 0
for n in piles:
time += timeof(n, speed)
return time <= H
# 每堆香蕉根数的最大值
def getMax(piles):
maxValue = 0
for n in piles:
maxValue = max(n, maxValue)
return maxValue
def minEatingSpeed(piles, H):
# 套用二分搜索左侧边界的算法框架
left = 1; right = getMax(piles) + 1
while left < right:
mid = left + (right - left) // 2
if canFinish(piles, mid, H):
right = mid
else:
left = mid + 1
return left
if __name__ == '__main__':
H = 8
piles = [3,6,7,11]
print(minEatingSpeed(piles, H)) |
"""This problem was asked by Palantir.
In academia, the h-index is a metric used to calculate the impact of a researcher's papers.
It is calculated as follows:
A researcher has index h if at least h of her N papers have h citations each.
If there are multiple h satisfying this formula, the maximum is chosen.
For example, suppose N = 5, and the respective citations of each paper are [4, 3, 0, 1, 5].
Then the h-index would be 3, since the researcher has 3 papers with at least 3 citations.
Given a list of paper citations of a researcher, calculate their h-index.
""" |
a = []
while True:
k = 0
resposta = str(input('digite uma expressao qualquer:')).strip()
for itens in resposta:
if itens == '(':
a.append(resposta)
elif itens == ')':
if len(a) == 0:
print('expressao invalida')
k = 1
break
elif len(a) != 0:
a.pop()
if len(a) > 0:
print('''Expressao invalida
Tente novamente!!''')
elif len(a) == 0 and resposta[0] != ')' and resposta.count('(') == resposta.count(')') and k == 0:
print('Expressao valida!!')
print(a)
while True:
c = str(input('deseja continuar ? [S/N] ')).strip().upper()
if c == 'S' or c == 'N':
break
if c == 'N':
break
|
# -*- coding: utf-8 -*-
"""XML Utilities.
XML scripts in Python.
* ppx: pretty print XML source in human readable form.
* xp: use XPath expression to select nodes in XML source.
* validate: validate XML source with XSD or DTD.
* transform: transform XML source with XSLT.
"""
# Xul version.
__version_info__ = ('2', '4', '0')
__version__ = '.'.join(__version_info__)
|
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
spar = mai = scol = 0
for linha in range (0, 3):
for coluna in range(0, 3):
matriz[linha][coluna] = int(input(f'Digite um valor para [{linha}, {coluna}]: '))
print("-"*30)
for linha in range(0,3):
for coluna in range(0,3):
print(f'[{matriz [linha] [coluna]:^5}]', end='')
if matriz[linha][coluna] % 2 == 0:
spar += matriz[linha][coluna]
print()
print('=' * 30)
print(f'A soma de pares {spar} ')
for linha in range (0, 3):
scol += matriz[linha][2]
print(f'A soma dos valores da 3º Coluna {scol}')
for coluna in range(0, 3):
if coluna == 0:
mai = matriz[1][coluna]
elif matriz [1][coluna] > mai:
mai = matriz[1][coluna]
print(f'O maior da 2º linha {mai}')
|
def number(year):
for i in range(2010,2021):
if i % 4 == 0 and i % 100 != 0 or i % 400 ==0:
print(str(i)+"年共有366天哦!!!")
else:
print(str(i)+"年共有365天哦!!!")
def start():
number(2010)
start() |
# Copyright (c) 2019 Damian Grzywna
# Licensed under the zlib/libpng License
# http://opensource.org/licenses/zlib/
__all__ = ('__title__', '__summary__', '__uri__', '__version_info__',
'__version__', '__author__', '__maintainer__', '__email__',
'__copyright__', '__license__')
__title__ = "aptiv.digitRecognizer"
__summary__ = "Small application to recognize handwritten digits on the image using machine learning algorithm."
__uri__ = "https://github.com/dawis96/digitRecognizer"
__version_info__ = type("version_info", (), dict(serial=0,
major=0, minor=1, micro=0, releaselevel="alpha"))
__version__ = "{0.major}.{0.minor}.{0.micro}{1}{2}".format(__version_info__,
dict(final="", alpha="a", beta="b", rc="rc")[__version_info__.releaselevel],
"" if __version_info__.releaselevel == "final" else __version_info__.serial)
__author__ = "Damian Grzywna"
__maintainer__ = "Damian Grzywna"
__email__ = "dawis996@gmail.com"
__copyright__ = "Copyright (c) 2019, {0}".format(__author__)
__license__ = "zlib/libpng License ; {0}".format(
"http://opensource.org/licenses/zlib/")
|
class Array:
n = 0
arr = []
def print_array(self):
print(self.arr)
def get_user_input(self):
self.n = int(input('Enter the size of array: '))
print('Enter the elements of array in next line (space separated)')
self.arr = list(map(int, input().split()))
|
#!/usr/bin/env python3
"""
Xtremeloader reloaded...
Lookup for lx products
sample curl calls:
curl -d 'state=productlist&substate=categorized&category=Cellphone+EPINs' -X POST 'https://loadxtreme.ph/cgi-bin/ajax.cgi'
(refer to xtremeloader repo)
List of cat:
[Cellphone EPINs]
[Internet / Broadband] - Internet / Broadband </option>
[Landline] - Landline </option>
[Online Entertainment] - Online Entertainment </option>
[Online Games] - Online Games </option>
[Over-The-Air (OTA)] - Over-The-Air (OTA) </option>
[Satellite / Cable TV] - Satellite / Cable TV </option>
[Utilities] - Utilities </option>
[myLIFE] - myLIFE </option>
"""
if __name__ == '__main__':
print("Hello, World!") |
def hello(name):
print("hello", name, "!")
hello("xxcfun") |
# def fun(num):
# if num>5:
# return True
# else:
# return False
fun=lambda x: x>5
l=[1,2,3,4,45,35,43,523]
print(list(filter(fun,l))) |
# DFS
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
# 存储每种课的依赖的所有课程
# 根据课程的依赖关系建立的图结构
graphic = [[] for _ in range(numCourses)]
for pre in prerequisites:
graphic[pre[0]].append(pre[1])
# 存储每个课程的调查状态
# 0表示还没有调查,初始状态
# 1表示不清楚调查结果
# 2表示没有构成环,遇到没有构成环的点,就不需要在继续探索了
status = [0] * numCourses
for i in range(numCourses):
if self.exist_cycle(status, graphic, i):
# 如果检测到环了,就无法结束所有的课程了
return False
return True
def exist_cycle(self, status, graphic, cur_node):
# 如果遇到了一个正在调查的点,说明已经遇到一个环
if status[cur_node] == 1:
return True
if status[cur_node] == 2:
return False
# 标志该课程为1,表示正在调查该课程
status[cur_node] = 1
# 遍历学习该课程前需要学习的课程
for next_node in graphic[cur_node]:
if self.exist_cycle(status, graphic, next_node):
# 如果发现有一个环,说明当前这个图有环
return True
# 走出循环,说明已经遍历了所有预备课程,没有形成环
status[cur_node] = 2
return False
|
class Node:
def __init__(self, value):
self.value = value
self.next = None
self.previous = None
def remove_node(self):
if self.next:
self.next.previous = self.previous
if self.previous:
self.previous.next = self.next
self.next = None
self.previous = None |
path = "./Inputs/day5.txt"
# path = "./Inputs/day5Test.txt"
def part1():
seats = getSeats()
highestSeat = max(seats)
print("Part 1:")
print(highestSeat)
def part2():
seats = getSeats()
# get the missing seat
difference = sorted(set(range(seats[0], seats[-1] + 1)).difference(seats))
print("Part 2:")
print(difference[0])
def getSeats():
seats = []
with open(path) as file:
for line in file.readlines():
rows = list(range(128))
cols = list(range(8))
letters = list(line.rstrip('\n'))
for letter in letters:
if(letter == 'F' or letter == 'B'):
rows = splitList(rows, letter)
elif(letter == 'L' or letter == 'R'):
cols = splitList(cols, letter)
row = rows[0]
col = cols[0]
seat = row * 8 + col
seats.append(seat)
return seats
def splitList(origList, part):
if (part == 'F' or part == 'L'):
# take first half
new_list = origList[:len(origList)//2]
else:
# take second half
new_list = origList[len(origList)//2:]
return new_list
part1()
part2()
|
def max(*args):
if len(args) == 0:
return 'no numbers given'
m = args[0]
for arg in args:
if arg > m:
m = arg
return m
print(max())
print(max(5, 12, 3, 6, 7, 10, 9))
|
def solution(N):
n = 0; current = 1; nex = 1
while n <N-1:
current, nex = nex, current+nex
n +=1
return 2*(current+nex)
|
a = [2012, 2013, 2014]
print (a)
print (a[0])
print (a[1])
print (a[2])
b = 2012
c = [b, 2015, 20.1, "Hello", "Hi"]
print (c[1:4])
|
# SB1 may have terrible calibration (is 2x as faint, and wasn't appropriately
# statwt'd b/c it didn't go through the pipeline)
vis = [#'16B-202.sb32532587.eb32875589.57663.07622001157.ms',
'16B-202.sb32957824.eb33105444.57748.63243916667.ms',
'16B-202.sb32957824.eb33142274.57752.64119381944.ms',
'16B-202.sb32957824.eb33234671.57760.62953023148.ms',
]
contspw = '2,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,22,23,24,25,26,28,29,30,31,32,34,35,36,37,39,42,44,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,62,63,64'
"""
Normal, shallow tclean imaging of both fields
"""
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
"""
nterms=2, spectral slope cleaning
"""
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_2terms_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
deconvolver='mtmfs',
outframe='LSRK',
savemodel='none',
nterms=2,
selectdata=True)
impbcor(imagename=myimagebase+'.image.tt0', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.tt0.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.tt0.pbcor', fitsimage=myimagebase+'.image.tt0.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_2terms_robust0_wproj'
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=0.0,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
deconvolver='mtmfs',
outframe='LSRK',
savemodel='none',
nterms=2,
selectdata=True)
impbcor(imagename=myimagebase+'.image.tt0', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.tt0.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.tt0.pbcor', fitsimage=myimagebase+'.image.tt0.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51e5_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51e2w,W51 North',
phasecenter="J2000 19h23m41.858 +14d30m56.674",
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[2560,2560],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51North_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51 North',
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for robust,suffix in [(-2,'uniform'), (0,'robust0'), (2,'natural')]:
output = myimagebase = imagename = 'W51e2w_QbandAarray_cont_spws_continuum_cal_clean_{0}_wproj'.format(suffix)
tclean(vis=vis,
imagename=imagename,
field='W51e2w',
spw=contspw,
weighting='briggs',
robust=robust,
imsize=[5120,5120],
cell=['0.01 arcsec'],
threshold='1.0 mJy',
niter=10000,
gridder='wproject',
wprojplanes=32,
specmode='mfs',
outframe='LSRK',
savemodel='none',
selectdata=True)
impbcor(imagename=myimagebase+'.image', pbimage=myimagebase+'.pb', outfile=myimagebase+'.image.pbcor', overwrite=True)
exportfits(imagename=myimagebase+'.image.pbcor', fitsimage=myimagebase+'.image.pbcor.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.pb', fitsimage=myimagebase+'.pb.fits', overwrite=True, dropdeg=True)
exportfits(imagename=myimagebase+'.residual', fitsimage=myimagebase+'.residual.fits', overwrite=True, dropdeg=True)
for suffix in ('pb', 'weight', 'sumwt', 'psf', 'model', 'mask',
'image', 'residual'):
os.system('rm -rf {0}.{1}'.format(output, suffix))
|
class Solution:
def _breakIntoLines(self, words: List[str], maxWidth: int) -> List[List[str]]:
allLines = []
charCount = 0
# list of strings for easy append
currLine = []
for word in words:
wordLen = len(word)
if wordLen + charCount > maxWidth:
# start a new line
allLines.append(currLine)
charCount = 0
currLine = []
currLine.append(word)
charCount += (wordLen+1)
allLines.append(currLine)
return allLines
def _generateSpaces(self, line: List[str], idx: int, numLines: int, maxWidth: int) -> List[str]:
spaces = maxWidth - sum([len(word) for word in line])
numWords = len(line)
countSpaces = numWords - 1
# if not both these cases, then need left justification
if numWords > 1 and idx != numLines-1:
minSpace = spaces // countSpaces
remainingSpaces = spaces - (minSpace * countSpaces)
spacesToFill = [minSpace for _ in range(countSpaces)]
for x in range(remainingSpaces):
spacesToFill[x] += 1
# for the last word
spacesToFill.append(0)
else:
# left justified cases
extraSpace = spaces - countSpaces
spacesToFill = [1 for _ in range(countSpaces)]
# for the last word, fill remaining width with space
spacesToFill.append(extraSpace)
return spacesToFill
def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:
allLines = self._breakIntoLines(words, maxWidth)
numLines = len(allLines)
for idx, line in enumerate(allLines):
spacesToFill = self._generateSpaces(line, idx, numLines, maxWidth)
newLine = []
for j, word in enumerate(line):
newLine.append(word)
newLine.append(' ' * spacesToFill[j])
allLines[idx] = newLine
return list(map(lambda x: ''.join(x), allLines)) |
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '\xc2\xce\xc6\x9e\xff\xa7\x1b:\xc7O\x919\xdf=}d'
_lr_action_items = {'TAG':([20,25,32,44,45,],[-21,-19,39,-22,-20,]),'LBRACE':([10,13,15,24,],[-9,17,20,-10,]),'RPAREN':([14,18,19,26,31,],[-11,-12,24,34,-13,]),'RBRACE':([17,20,22,25,32,35,41,42,44,45,],[-14,-21,27,-19,38,-17,-15,-16,-22,-20,]),'FIELD_HIGH':([17,22,35,41,42,],[-14,30,-17,-15,-16,]),'MASK':([20,25,44,],[-21,33,-22,]),'PADDING':([17,22,35,41,42,],[-14,28,-17,-15,-16,]),'FIELD':([17,22,35,41,42,],[-14,29,-17,-15,-16,]),'BASE':([0,2,5,7,8,9,27,34,38,],[-2,3,-3,-5,-4,-6,-8,-7,-18,]),'COMMA':([14,16,18,19,31,],[-11,21,-12,23,-13,]),'LPAREN':([9,10,],[12,14,]),'INTLIT':([3,12,21,28,33,36,37,40,43,],[9,16,26,35,40,41,42,44,45,]),'IDENTIFIER':([4,6,11,14,23,29,30,39,],[10,11,15,18,31,36,37,43,]),'TAGGED_UNION':([0,2,5,7,8,9,27,34,38,],[-2,6,-3,-5,-4,-6,-8,-7,-18,]),'BLOCK':([0,2,5,7,8,9,27,34,38,],[-2,4,-3,-5,-4,-6,-8,-7,-18,]),'$end':([0,1,2,5,7,8,9,27,34,38,],[-2,0,-1,-3,-5,-4,-6,-8,-7,-18,]),}
_lr_action = { }
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = { }
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'entity_list':([0,],[2,]),'fields':([17,],[22,]),'opt_visible_order_spec':([10,],[13,]),'masks':([20,],[25,]),'start':([0,],[1,]),'base':([2,],[5,]),'visible_order_spec':([14,],[19,]),'tags':([25,],[32,]),'tagged_union':([2,],[7,]),'block':([2,],[8,]),}
_lr_goto = { }
for _k, _v in _lr_goto_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_goto: _lr_goto[_x] = { }
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> start","S'",1,None,None,None),
('start -> entity_list','start',1,'p_start','bitfield_gen.py',93),
('entity_list -> <empty>','entity_list',0,'p_entity_list_empty','bitfield_gen.py',97),
('entity_list -> entity_list base','entity_list',2,'p_entity_list_base','bitfield_gen.py',101),
('entity_list -> entity_list block','entity_list',2,'p_entity_list_block','bitfield_gen.py',108),
('entity_list -> entity_list tagged_union','entity_list',2,'p_entity_list_union','bitfield_gen.py',114),
('base -> BASE INTLIT','base',2,'p_base_simple','bitfield_gen.py',120),
('base -> BASE INTLIT LPAREN INTLIT COMMA INTLIT RPAREN','base',7,'p_base_mask','bitfield_gen.py',124),
('block -> BLOCK IDENTIFIER opt_visible_order_spec LBRACE fields RBRACE','block',6,'p_block','bitfield_gen.py',128),
('opt_visible_order_spec -> <empty>','opt_visible_order_spec',0,'p_opt_visible_order_spec_empty','bitfield_gen.py',133),
('opt_visible_order_spec -> LPAREN visible_order_spec RPAREN','opt_visible_order_spec',3,'p_opt_visible_order_spec','bitfield_gen.py',137),
('visible_order_spec -> <empty>','visible_order_spec',0,'p_visible_order_spec_empty','bitfield_gen.py',141),
('visible_order_spec -> IDENTIFIER','visible_order_spec',1,'p_visible_order_spec_single','bitfield_gen.py',145),
('visible_order_spec -> visible_order_spec COMMA IDENTIFIER','visible_order_spec',3,'p_visible_order_spec','bitfield_gen.py',149),
('fields -> <empty>','fields',0,'p_fields_empty','bitfield_gen.py',153),
('fields -> fields FIELD IDENTIFIER INTLIT','fields',4,'p_fields_field','bitfield_gen.py',157),
('fields -> fields FIELD_HIGH IDENTIFIER INTLIT','fields',4,'p_fields_field_high','bitfield_gen.py',161),
('fields -> fields PADDING INTLIT','fields',3,'p_fields_padding','bitfield_gen.py',165),
('tagged_union -> TAGGED_UNION IDENTIFIER IDENTIFIER LBRACE masks tags RBRACE','tagged_union',7,'p_tagged_union','bitfield_gen.py',169),
('tags -> <empty>','tags',0,'p_tags_empty','bitfield_gen.py',174),
('tags -> tags TAG IDENTIFIER INTLIT','tags',4,'p_tags','bitfield_gen.py',178),
('masks -> <empty>','masks',0,'p_masks_empty','bitfield_gen.py',182),
('masks -> masks MASK INTLIT INTLIT','masks',4,'p_masks','bitfield_gen.py',186),
]
|
class Solution:
def romanToInt(self, s: str) -> int:
symbol_map = {
"I": (0, 1),
"V": (1, 5),
"X": (2, 10),
"L": (3, 50),
"C": (4, 100),
"D": (5, 500),
"M": (6, 1000)
}
position = 0
value = 0
for symbol in reversed(s):
if symbol_map[symbol][0] < position:
value -= symbol_map[symbol][1]
else:
value += symbol_map[symbol][1]
position = symbol_map[symbol][0]
return value
print(Solution().romanToInt("III")) # 3
print(Solution().romanToInt("LVIII")) # 58
print(Solution().romanToInt("MCMXCIV")) # 1994
|
class Error():
def __init__(self, error):
self.code = error
self.get_name()
def get_name(self, *args, **kwargs):
if self.code == 'UP_001':
self.name = 'File not allowed'
self.name_ger = 'Datei nicht erlaubt'
self.description = 'Der Dateityp ist nicht zulässig.'
if self.code == 'UP_002':
self.name = 'Incorrect Coding'
self.name_ger = 'Datei falsch codiert'
self.description = 'Der Dateicodierungstyp ist nicht zulässig. CSV Datein müssen nach UTF-8 codiert sein'
if self.code == 'UP_003':
self.name = 'Not Null Constraint'
self.name_ger = 'Pflichtfeldangabe fehlt'
self.description = 'Die Fahrgestellnummer muss beim Import von Fahrzeugen angegeben werden'
if self.code == 'UP_004':
self.name = 'Not Null Constraint'
self.name_ger = 'Pflichtfeldangabe fehlt'
self.description = 'Fahrgestellnummer, Rückrufcode und Werkstatt müssen beim Import der Fahrzeughistorie angegeben werden'
if self.code == 'UP_005':
self.name = 'PK Error'
self.name_ger = 'Fahrgestellnummer unbekannt'
self.description = 'Die Fahrgestellnummer ist unbekannt. Der Datensatz wurde nicht importiert. Aktualisieren Sie ggf. die Fahrzeugliste'
if self.code == 'UP_006':
self.name = 'PK Error'
self.name_ger = 'Rückrufcode unbekannt'
self.description = 'Der angegebene Rückrufcode ist unbekannt. Der Datensatz wurde nicht importiert. Legen Sie ggf. einen neuen Rückruf an.'
if self.code == 'UP_007':
self.name = 'PK Error'
self.name_ger = 'WerkstattID unbekannt'
self.description = 'Die angegebene Werkstatt ist unbekannt. Der Datensatz wurde nicht importiert. Aktualisieren Sie ggf. die Werkstattliste.'
if self.code == 'UP_008':
self.name = 'Unexpected error'
self.name_ger = 'Unerwarteter Fehler'
self.description = 'Keine Fehlerbeschreibung verfügbar.' |
class PolicyNetwork(ModelBase):
def __init__(self,
preprocessor,
input_size=80*80,
hidden_size=200,
gamma=0.99): # Reward discounting factor
super(PolicyNetwork, self).__init__()
self.preprocessor = preprocessor
self.input_size = input_size
self.hidden_size = hidden_size
self.gamma = gamma
self.add_param('w1', (hidden_size, input_size))
self.add_param('w2', (1, hidden_size))
def forward(self, X):
"""Forward pass to obtain the action probabilities for each observation in `X`."""
a = np.dot(self.params['w1'], X.T)
h = np.maximum(0, a)
logits = np.dot(h.T, self.params['w2'].T)
p = 1.0 / (1.0 + np.exp(-logits))
return p
def choose_action(self, p):
"""Return an action `a` and corresponding label `y` using the probability float `p`."""
a = 2 if numpy.random.uniform() < p else 3
y = 1 if a == 2 else 0
return a, y
|
# coding:utf-8
def request_parameter_checker(check_rules, force_ajax=False):
'''
用于校验request中的参数是否符合check_rules中的设定
check_rules - 参数校验规则,为一个list,每条规则如下
{'p_name':'para_1', 'method':'GET/POST', 'regex':'*', 'must': True, 'desc':u'描述信息'}
force_ajax - 当参数校验出错时,无论request是否是ajax, 返回数据均按照ajax方式处理
'''
def decorator(func):
@wraps(func, assigned=available_attrs(func))
def inner(request, *args, **kwargs):
pass
return inner
return decorator
|
#!/bin/python
#This script is made to remove ID's from a file that contains every ID of every contig.
def file_opener(of_file):
with open(of_file, 'r') as f:
return f.readlines()
def filter(all, matched):
filterd = []
for a in matched:
if a not in matched:
filterd.append(a)
return filterd
def file_writer(data, of_file):
content = ""
for line in data:
content += line + "\n"
file = open(of_file, "w")
file.write(content)
file.close()
def main():
all_ids = file_opener('/home/richard.wissels/Foram-assembly/data/contig_ids.txt')
matched_ids = file_opener('/home/richard.wissels/Foram-assembly/results/uniq_1e-43_contig_matches.txt')
filterd_ids = filter(all_ids, matched_ids)
file_writer(filterd_ids, '/home/richard.wissels/Foram-assembly/results/non_matched_contig_ids.txt')
main()
|
''' © 2014 Richard A. Benson <richardbenson91477@protonmail.com> '''
class Path:
# curves, curves_n
def __init__ (self):
self.curves = []
self.curves_n = 0
def curve_eval (self, t):
# NOTE: returns ints
if not self.curves_n:
return
curve_c = int(t)
t2 = t - float(curve_c)
t2p3 = t2 ** 3
t2p2 = t2 ** 2
c1 = -1 * t2p3 + 3 * t2p2 + -3 * t2 + 1
c2 = 3 * t2p3 + -6 * t2p2 + 3 * t2
c3 = -3 * t2p3 + 3 * t2p2
c4 = t2p3
return (
int(c1 * self.curves[curve_c][0][0] +\
c2 * self.curves[curve_c][1][0] +\
c3 * self.curves[curve_c][2][0] +\
c4 * self.curves[curve_c][3][0]),
int(c1 * self.curves[curve_c][0][1] +\
c2 * self.curves[curve_c][1][1] +\
c3 * self.curves[curve_c][2][1] +\
c4 * self.curves[curve_c][3][1]))
def curve_add (self, p1, p2, p3, p4):
self.curves.append([p1, p2, p3, p4])
self.curves_n += 1
|
"""
백준 16199번 : 나이 계산하기
"""
by, bm, bd = map(int, input().split())
ny, nm, nd = map(int, input().split())
print(ny-by if nm > bm or (nm == bm and nd >= bd) else ny - by - 1)
print(ny-by+1)
print(ny-by) |
"""
You are given a binary tree and you need to write a function that can determine if it is height-balanced.
A height-balanced tree can be defined as a binary tree in which the left and right subtrees of every node differ in height by a maximum of 1.
"""
#
# Binary trees are already defined with this interface:
# class Tree(object):
# def __init__(self, x):
# self.value = x
# self.left = None
# self.right = None
def get_height(root):
if root is None:
return 0
return 1 + max(get_height(root.left), get_height(root.right))
def balancedBinaryTree(root):
if root is None:
return True
return balancedBinaryTree(root.right) and balancedBinaryTree(root.left) and abs(get_height(root.left) - get_height(root.right)) <= 1
|
# This is to write an escape function to escape text at the MarkdownV2 style.
#
# **NOTE**
# The [1]'s content provides some notes on how strings should be escaped,
# but let the user deal with it himself; there are such things as "the string
# ___italic underline___ should be changed to ___italic underline_\r__,
# where \r is a character with code 13", but this program's aim is not being a
# perfect text parser/a perfect escaper of symbols at text.
#
# References:
# -----------
#
# [1]: https://core.telegram.org/bots/api#markdownv2-style
#
# Bot API version: 5.3
# import re
_special_symbols = {
'_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{',
'}', '.', '!'
}
def escape(string: str) -> str:
for symbol in _special_symbols:
# Escape each special symbol
string = string.replace(symbol, '\\' + symbol)
# Mind that such sequences, being replaced, do not intersect.
# Replacement order is not important.
return string
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
def node2num(node):
val = 0
while node:
val = val * 10 + node.val
node = node.next
return val
if l1 == None:
return l2
if l2 == None:
return l1
res = node2num(l1) + node2num(l2)
dummyNode = ListNode(0)
startNode = dummyNode
for i in str(res):
startNode.next = ListNode(int(i))
startNode = startNode.next
return dummyNode.next
|
#generator2.py
class Week:
def __init__(self):
self.days = {1:'Monday', 2: "Tuesday",
3:"Wednesday", 4: "Thursday",
5:"Friday", 6:"Saturday", 7:"Sunday"}
def week_gen(self):
for x in self.days:
yield self.days[x]
if(__name__ == "__main__"):
wk = Week()
iter1 = wk.week_gen()
iter2 = iter(wk.week_gen())
print(iter1.__next__())
print(iter2.__next__())
print(next(iter1))
print(next(iter2)) |
s1 = '854'
print(s1.isnumeric()) # -- ISN1
s2 = '\u00B2368'
print(s2.isnumeric()) # -- ISN2
s3 = '\u00BC'
print(s3.isnumeric()) # -- ISN3
s4='python895'
print(s4.isnumeric()) # -- ISN4
s5='100m2'
print(s5.isnumeric()) # -- ISN5
|
# class LLNode:
# def __init__(self, val, next=None):
# self.val = val
# self.next = next
class Solution:
def solve(self, node, k):
# Write your code here
n = 0
curr = node
while curr:
curr = curr.next
n += 1
if k%n==0:
return node
if k>n:
k = k%n
curr = node
k1 = n-k-1
while k1!=0:
curr = curr.next
k1 -= 1
replace = curr
head = curr.next
while curr.next:
curr = curr.next
curr.next = node
replace.next = None
return head
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def nextLargerNodes(self, head: ListNode) -> List[int]:
if not head:
return [0]
node = head
# this stack will contain the elements that we don't know its next greater node
# alongside its index, to insert in correct place
stack = [(0, node.val)]
node = node.next
# starts the array with one element and increase it as we start iterating over the nodes
result = [0]
i = 1
while node: # iterate over the linked list
# do this until we find an element that is not greater that current node
# or stack is empry
while stack and node.val > stack[-1][-1]:
pos, val = stack.pop() # get index and value of top of stack
result[pos] = node.val # update the greater element it the given index
stack.append((i, node.val))
node = node.next
i += 1
result.append(0) # increase by 1 each new visited node
# any element in the stack does not have a greater element
while stack:
pos, val = stack.pop()
result[pos] = 0
return result |
class Config():
API_KEY = '9b680a8b-22d4-4069-b0e6-f6cc97cd9d71'
API_URL = 'https://api.demo.11b.io'
API_ACCOUNT = 'A00-000-030'
config = Config() |
'''
One cool aspect of using an outer join is that, because it returns all rows from both merged tables and null where they do not match, you can use it to find rows that do not have a match in the other table. To try for yourself, you have been given two tables with a list of actors from two popular movies: Iron Man 1 and Iron Man 2. Most of the actors played in both movies. Use an outer join to find actors who did not act in both movies.
The Iron Man 1 table is called iron_1_actors, and Iron Man 2 table is called iron_2_actors. Both tables have been loaded for you and a few rows printed so you can see the structure.
'''
# Merge iron_1_actors to iron_2_actors on id with outer join using suffixes
iron_1_and_2 = iron_1_actors.merge(iron_2_actors,
on='id',
how='outer',
suffixes=('_1', '_2'))
# Create an index that returns true if name_1 or name_2 are null
m = ((iron_1_and_2['name_1'].isnull()) |
(iron_1_and_2['name_2'].isnull()))
# Print the first few rows of iron_1_and_2
print(iron_1_and_2[m].head()) |
#
# PySNMP MIB module CISCO-ANNOUNCEMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ANNOUNCEMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:50:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion")
cmgwIndex, = mibBuilder.importSymbols("CISCO-MEDIA-GATEWAY-MIB", "cmgwIndex")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Counter64, Bits, iso, Counter32, Gauge32, Integer32, Unsigned32, ObjectIdentity, ModuleIdentity, MibIdentifier, NotificationType, TimeTicks, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Bits", "iso", "Counter32", "Gauge32", "Integer32", "Unsigned32", "ObjectIdentity", "ModuleIdentity", "MibIdentifier", "NotificationType", "TimeTicks", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
RowStatus, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "DisplayString")
ciscoAnnouncementMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 8888))
ciscoAnnouncementMIB.setRevisions(('2003-03-25 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoAnnouncementMIB.setRevisionsDescriptions(('Initial version of the MIB.',))
if mibBuilder.loadTexts: ciscoAnnouncementMIB.setLastUpdated('200303250000Z')
if mibBuilder.loadTexts: ciscoAnnouncementMIB.setOrganization('Cisco Systems, Inc.')
if mibBuilder.loadTexts: ciscoAnnouncementMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-voice-gateway@cisco.com')
if mibBuilder.loadTexts: ciscoAnnouncementMIB.setDescription('This MIB defines the objects for announcement system supported on media gateway. With announcement system setup, media gateway will have the capability to play pre-recorded audio files. The audio files can be played in either direction over existing connections (calls) or towards the Time Division Multiplexed (TDM) network on a TDM endpoint that is terminated on the media gateway. ')
ciscoAnnouncementMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 0))
ciscoAnnouncementMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1))
ciscoAnnouncementMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2))
cannoGeneric = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1))
cannoControlConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1))
cannoAudioFileConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2))
cannoControlTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1), )
if mibBuilder.loadTexts: cannoControlTable.setStatus('current')
if mibBuilder.loadTexts: cannoControlTable.setDescription('The MIB objects in this table are used to control the announcement system of media gateway. ')
cannoControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-MEDIA-GATEWAY-MIB", "cmgwIndex"))
if mibBuilder.loadTexts: cannoControlEntry.setStatus('current')
if mibBuilder.loadTexts: cannoControlEntry.setDescription('An entry in this table contains the control parameters of the announcement system on media gateway. ')
cannoAudioFileServerName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 1), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoAudioFileServerName.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileServerName.setDescription('This object specifies the domain name of an announcement file server that resides in an IP network and is reachable from the media gateway. The default value of this object is NULL string(size is 0). Before using any object in this table, this object should be configured to non NULL. ')
cannoDnResolution = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("internalOnly", 1), ("externalOnly", 2))).clone('internalOnly')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoDnResolution.setStatus('current')
if mibBuilder.loadTexts: cannoDnResolution.setDescription('This object specifies the domain name resolution for the domain name of the Announcement File server which is specified by the cannoAudioFileServerName object. If this object is set to internalOnly(1), the IP address associated with the file server (cannoAudioFileServerName) will be determined by the cannoIpAddress object. ')
cannoIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 3), InetAddressType().clone('ipv4')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoIpAddressType.setStatus('current')
if mibBuilder.loadTexts: cannoIpAddressType.setDescription('This object specifies the IP address type of cannoIpAddress. This object is not applicable when cannoDnResolution is set to externalOnly(2). ')
cannoIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 4), InetAddress().clone(hexValue="00000000")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoIpAddress.setStatus('current')
if mibBuilder.loadTexts: cannoIpAddress.setDescription('This object specifies the IP address associated with the cannoAudioFileServerName. This object is not applicable when cannoDnResolution is set to externalOnly(2). ')
cannoAgeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(10080)).setUnits('minutes').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoAgeTime.setStatus('current')
if mibBuilder.loadTexts: cannoAgeTime.setDescription("This object specifies the maximum life-span(in minutes) of the dynamic announcement files in the cache. A dynamic announcement file starts aging as soon as it is brought into the cache from the file server. When a dynamic file age crosses the 'cannoAgeTime' threshold, the file will be removed from the cache. The value zero time specifies that 'cannoAgeTime' is disabled. ")
cannoSubDirPath = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoSubDirPath.setStatus('current')
if mibBuilder.loadTexts: cannoSubDirPath.setDescription('This object specifies the directory path under the default TFTP directory in the Announcement File server for announcement files. The individual characters in cannoSubDirPath may be alphanumeric characters, forward slashes, backward slashes, periods, dashes, and underscores, but no embedded spaces. The last character of cannoSubDirPath must not be a dash. ')
cannoReqTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 50)).clone(5)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoReqTimeout.setStatus('current')
if mibBuilder.loadTexts: cannoReqTimeout.setDescription("This object specifies the time for a play announcement request to be serviced. The cannoReqTimeout is the time within which an announcement must start playing after receiving announcement request. If the announcement system cannot start playing the announcement within cannoReqTimeout seconds since the request was received, the play request will be aborted. The value zero time specifies that 'cannoReqTimeout' is disabled. ")
cannoMaxPermanent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 1, 1, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 500)).clone(41)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cannoMaxPermanent.setStatus('current')
if mibBuilder.loadTexts: cannoMaxPermanent.setDescription('This object specifies the maximum number of permanent announcement files that can be added to the media gateway. The space on media gateway cache is reserved for the cannoMaxPermanent number of permanent announcement files and the permanent announcement files should be stored on media gateway cache forever until to be deleted. The value zero specifies that media gateway only support dynamic announcement file. ')
cannoAudioFileTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1), )
if mibBuilder.loadTexts: cannoAudioFileTable.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileTable.setDescription('The MIB objects in this table contain information to manage audio announcement files. ')
cannoAudioFileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-MEDIA-GATEWAY-MIB", "cmgwIndex"), (0, "CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileNumber"))
if mibBuilder.loadTexts: cannoAudioFileEntry.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileEntry.setDescription('Each entry in the cannoAudioFileTable consists of management information for a specific announcement file, which include file descriptor, name, type, age, duration, number of cycles, status. ')
cannoAudioFileNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 9999)))
if mibBuilder.loadTexts: cannoAudioFileNumber.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileNumber.setDescription('A unique index to identify announcement file to be used in media gateway. ')
cannoAudioFileDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileDescr.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileDescr.setDescription('A textual string containing information about the audio file. User can store any information to this object such as which customer using this audio file, usage of the audio file, etc.. ')
cannoAudioFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileName.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileName.setDescription('This object specifies the name of a valid announcement file which has been stored in cannoAudioFileTable. This file name may include path or subdirectory information. The individual characters in this name may be alphanumeric characters, forward slashes, backward slashes, periods, dashes, and underscores, but no embedded spaces. The last character of the name must not be a dash or a forward slash. ')
cannoAudioFileStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("cached", 1), ("loading", 2), ("invalidFile", 3), ("loadFailed", 4), ("notCached", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cannoAudioFileStatus.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileStatus.setDescription("This object indicates the status of the the audio file: cached (1): the file successfully downloaded to media gateway cache cache is the memory on media gateway which is used to store announcement files. loading (2): the file in process of downloading invalidFile(3): the file on Announcement File server is too large or corrupted loadFailed (4): timeout when trying to download the file notCached (5): the file is not in cache Note: The cache is the memory on media gateway which is used to store announcement files. Some of space on the cache is reserved for the permanent announcement files (refer to 'cannoMaxPermanent'), the rest of cache is for the dynamic announcement files. The 'notCached' is applicable only for the dynamic announcement files in the following cases: 1. The dynamic file age reaches to 'cannoAgeTime', the status of the file will be changed from 'cached' to 'notCached'. 2. If the cache is full for the dynamic files, and if user try to add a new dynamic file, the one of the dynamic files on cache will be removed by LRU algorithm. The status of that file will be changed from 'cached' to 'notCached'. 3. If there is no space for the dynamic files (whole cache is reserved for the permanent file), the status of the dynamic files is set to 'notCached'. ")
cannoAudioFileOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("inPlaying", 1), ("notPlaying", 2), ("delPending", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cannoAudioFileOperStatus.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileOperStatus.setDescription('This object indicates the current operational status of the entry: inPlaying (1): the file is in playing notPlaying (2): the file is not in playing delPending (3): deletion is pending because the file is in playing ')
cannoAudioFilePlayNoc = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFilePlayNoc.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFilePlayNoc.setDescription("This object specifies number of cycles the announcement file is played. This object is used only when the Play Announcement signal from the MGC does not include a 'cannoAudioFilePlayNoc' parameter. The value zero is used to represent an announcement that continuously plays or loops. ")
cannoAudioFileDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setUnits('10 milliseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileDuration.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileDuration.setDescription("This object indicates the duration to play the announcement for one cycle, it is applicable only for the fixed announcement play. This object is used only when the Play Announcement signal from the MGC does not include a 'cannoAudioFileDuration' parameter. For the fixed announcement play, the 'cannoAudioFilePlayNoc' and the 'cannoAudioFileDuration' are used together to determine how long the announcement is to be played. The value zero indicates that this is a variable announcement play and only the 'cannoAudioFilePlayNoc' is used to determine the play time. ")
cannoAudioFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dynamic", 1), ("permanent", 2))).clone('dynamic')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileType.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileType.setDescription('This object specifies announcement file type. dynamic(1) : Dynamic file can be removed from cache if file age(cannoAudioFileAge) reaches cannoAgeTime or according to LRU algorithm when cache is full permanent(2): Permanent file should be stored on cache forever except to be deleted. The max number of permanent file can be stored on cache is determined by cannoMaxPermanent. ')
cannoAudioFileAge = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setUnits('minutes').setMaxAccess("readonly")
if mibBuilder.loadTexts: cannoAudioFileAge.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileAge.setDescription("This object indicates that announcement file age in cache, it is only for dynamic file. A dynamic announcement file starts aging as soon as it is brought into the cache from the Announcement File server. When the 'cannoAudioFileAge' reach to 'cannoAgeTime', then the file will be removed from cache. This object is not applicable for two cases: (1)For the permanent files, because the the permanent files should be stored on cache forever except to be deleted. (2)The 'cannoAgeTime' is set to zero which means the cannoAgeTime is infinite and 'cannoAudioFileAge' can never reach the cannoAgeTime. ")
cannoAudioFileAdminDeletion = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("gracefully", 1), ("forcefully", 2))).clone('gracefully')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileAdminDeletion.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileAdminDeletion.setDescription('This object specifies entry deletion behavior: gracefully(1): gateway will not stop the current announcement file playing (till it completes) while deleting this entry. forcefully(2): gateway will immediately stop current announcement file playing while deleting this entry ')
cannoAudioFileRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 8888, 1, 1, 2, 1, 1, 11), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cannoAudioFileRowStatus.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileRowStatus.setDescription("This object is used to create or delete an entry. The mandatory objects for creating an entry in this table: 'cannoAudioFileName' The following objects are not allowed to be modified after the entry to be added: 'cannoAudioFileName' 'cannoAudioFileType' ")
cannoMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2, 1))
cannoMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2, 2))
cannoMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2, 1, 1)).setObjects(("CISCO-ANNOUNCEMENT-MIB", "cannoControlGroup"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cannoMIBCompliance = cannoMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: cannoMIBCompliance.setDescription(' The compliance statement for Announcement File')
cannoControlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2, 2, 1)).setObjects(("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileServerName"), ("CISCO-ANNOUNCEMENT-MIB", "cannoDnResolution"), ("CISCO-ANNOUNCEMENT-MIB", "cannoIpAddressType"), ("CISCO-ANNOUNCEMENT-MIB", "cannoIpAddress"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAgeTime"), ("CISCO-ANNOUNCEMENT-MIB", "cannoSubDirPath"), ("CISCO-ANNOUNCEMENT-MIB", "cannoReqTimeout"), ("CISCO-ANNOUNCEMENT-MIB", "cannoMaxPermanent"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cannoControlGroup = cannoControlGroup.setStatus('current')
if mibBuilder.loadTexts: cannoControlGroup.setDescription('This group contains objects related to announcement system control on media gateway. ')
cannoAudioFileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 8888, 2, 2, 2)).setObjects(("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileDescr"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileName"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileStatus"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileOperStatus"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFilePlayNoc"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileDuration"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileType"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileAge"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileAdminDeletion"), ("CISCO-ANNOUNCEMENT-MIB", "cannoAudioFileRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cannoAudioFileGroup = cannoAudioFileGroup.setStatus('current')
if mibBuilder.loadTexts: cannoAudioFileGroup.setDescription('This group contains objects related to announcement files on media gateway. ')
mibBuilder.exportSymbols("CISCO-ANNOUNCEMENT-MIB", cannoAudioFileDescr=cannoAudioFileDescr, ciscoAnnouncementMIBConformance=ciscoAnnouncementMIBConformance, cannoMaxPermanent=cannoMaxPermanent, ciscoAnnouncementMIB=ciscoAnnouncementMIB, cannoControlTable=cannoControlTable, cannoAudioFilePlayNoc=cannoAudioFilePlayNoc, cannoIpAddressType=cannoIpAddressType, cannoAudioFileName=cannoAudioFileName, cannoAgeTime=cannoAgeTime, cannoAudioFileOperStatus=cannoAudioFileOperStatus, cannoAudioFileGroup=cannoAudioFileGroup, cannoMIBCompliance=cannoMIBCompliance, cannoDnResolution=cannoDnResolution, PYSNMP_MODULE_ID=ciscoAnnouncementMIB, cannoAudioFileStatus=cannoAudioFileStatus, cannoAudioFileConfig=cannoAudioFileConfig, cannoAudioFileAge=cannoAudioFileAge, cannoControlEntry=cannoControlEntry, cannoAudioFileNumber=cannoAudioFileNumber, cannoGeneric=cannoGeneric, cannoSubDirPath=cannoSubDirPath, cannoControlGroup=cannoControlGroup, cannoAudioFileTable=cannoAudioFileTable, cannoMIBCompliances=cannoMIBCompliances, cannoControlConfig=cannoControlConfig, cannoIpAddress=cannoIpAddress, cannoAudioFileAdminDeletion=cannoAudioFileAdminDeletion, cannoAudioFileEntry=cannoAudioFileEntry, cannoAudioFileType=cannoAudioFileType, ciscoAnnouncementMIBObjects=ciscoAnnouncementMIBObjects, cannoMIBGroups=cannoMIBGroups, cannoAudioFileServerName=cannoAudioFileServerName, cannoAudioFileRowStatus=cannoAudioFileRowStatus, cannoAudioFileDuration=cannoAudioFileDuration, cannoReqTimeout=cannoReqTimeout, ciscoAnnouncementMIBNotifs=ciscoAnnouncementMIBNotifs)
|
# Will you make it?
def zero_fuel(distance_to_pump, mpg, fuel_left):
if ( distance_to_pump - mpg*fuel_left )>0:
result = False
else:
result = True
return result
|
"""
So we gonna need a way to check quest progress.
This might be as simple as checking if Admiral has a Ship or we might have to check if he completed 1-1 4 times while jumping in one leg
I have no idea.
At first I intended to write a simple function for each Quest, but the Admiral can activate and deactivate stuff at will, so we have to
make it persistent somehow.
So my idea is to have a column in the AdmiralQuest table that saves a JSON with quest data and then the function reads and interprets this.
Please look forward for the chaos that ensues.
"""
|
def fib(n, calc):
if n == 0 or n == 1:
if len(calc) < 2:
calc.append(n)
return calc[n], calc
elif len(calc)-1 >= n:
return calc[n], calc
elif n >= 2:
res1, c = fib(n-1, calc)
res2, c = fib(n-2, calc)
res = res1 + res2
calc.append(res)
return res, calc
else:
return calc[n], calc
a = int(input())
res = ''
calc = []
for num in range(0, a):
n, calc = fib(num, calc)
res += str(n) + ' '
print(res.strip())
|
def urandom(n):
# """urandom(n) -> str
# Return a string of n random bytes suitable for cryptographic use.
# """
#try:
# _urandomfd = open("/dev/urandom", O_RDONLY)
#except (OSError, IOError):
# raise NotImplementedError("/dev/urandom (or equivalent) not found")
#try:
# bs = b""
# while n - len(bs) >= 1:
# bs += read(_urandomfd, n - len(bs))
#finally:
# close(_urandomfd)
raise NotImplementedError("/dev/urandom (or equivalent) not found")
return bs
|
#!/usr/bin/env python
"""List of hedge funds/institution names **for educational purposes only. MIT License"""
__author__ = "Aneesh Panoli"
__copyright__ = "MIT License"
def institutions():
keywords = ["Natixis", "TIAA", "Deutsche", "Invesco", "Franklin", "Rowe", "AXA", "Legg", "Sumitomo"\
, "UBS", "Affiliated", "Mitsubishi", "Insight", "BNP", "New", "Allianz", "Columbia", "AllianceBernstein"\
, "Schroder", "APG", "Generali", "Aberdeen", "Aviva", "HSBC", "MFS", "Morgan"\
, "Dimensional", "Principal", "Aegon", "Standard", "M&G", "Federated", "Mellon"\
, "Wells", "Natixis", "Macquarie", "Nomura", "Credit", "Eaton", "Manulife", "Robeco"\
, "Eurizon", "Union", "RBC", "MEAG", "Fidelity", "SEI", "Dodge", "Pioneer"\
, "Neuberger", "DekaBank", "BNY", "Babson", "BMO", "Loomis", "Voya", "Nordea", "NN"\
, "SEB", "Guggenheim", "PGGM", "Nuveen", "Swiss", "Baillie", "TCW", "Caisse"\
, "Janus", "Santander", "Lazard", "Russell", "La Banque", "Nikko", "Standish"\
, "Pictet", "Putnam", "Bridgewater", "Bank", "DIAM", "AQR", "First", "American"\
, "Itau", "Talanx", "Eastspring", "Swedbank", "Helaba", "MN", "Lyxor", "Lord,"\
, "Royal", "Zurcher", "Harris", "Henderson", "GAM", "Kohlberg", "Danske", "AMP"\
, "Achmea", "GE", "Union", "BBVA", "KBC", "Artisan", "Sumitomo", "Investec"\
, "SURA", "Hartford", "Candriam", "GMO", "Harvest", "Groupama", "Bram", "Covea"\
, "Oaktree", "BMO", "CIBC", "Vontobel", "Payden", "Ares", "First", "MacKay"\
, "CBRE", "Barrow", "Conning", "Hines", "PineBridge", "LSV", "Kames", "CI"\
, "Man", "Mirae", "Mediolanum", "OP", "Anima", "BayernInvest", "OFI", "Metzler"\
, "Newton", "Mesirow", "Acadian", "CM", "Storebrand", "LBBW", "DNB", "Erste"\
, "Arrowstreet", "Handelsbanken", "Prologis", "Walter", "BBH", "LaSalle", "William"\
, "Edmond", "La", "BlueBay", "Irish", "QIC", "Mondrian", "Actiam", "Carmignac"\
, "Delta", "Warburg", "M", "Rothschild", "Thornburg", "Degroof", "LGT", "Record"\
, "Marathon", "Jupiter", "Cohen", "Sal", "Brown", "Daiwa", "Hauck", "Partners"\
, "Oddo", "Caixabank", "Cornerstone", "GCM", "Ashmore", "Tokio", "Lombard"\
, "CVC", "KLP", "Joh", "Coronation", "THEAM", "Fischer", "Epoch", "CPR", "Stone"\
, "HarbourVest", "Quilvest", "Schroder", "Columbia", "Principal", "Manulife"\
, "APG", "Robeco", "Barings", "Dekabank", "Nordea", "Loomis", "Baillie", "Lazard"\
, "Russell", "Bram", "China", "Nikko", "Bridgewater", "Pictet", "Standish"\
, "Zurcher", "John", "Talanx", "Helaba", "Eastspring", "Lyxor", "Henderson"\
, "ClearBridge", "IGM", "Harvest", "Harris", "Conning", "Candriam", "KBC", "Payden"\
, "Danske", "CIBC", "Groupama", "Sumitomo", "Vontobel", "Hartford", "Covea"\
, "LSV", "Hines", "Ares", "New", "MacKay", "Galliard", "Mirae", "CI", "Boston"\
, "Fiera", "CBRE", "Man", "Metzler", "Anima", "BayernInvest", "Acadian", "Mediolanum"\
, "Arrowstreet", "OFI", "KLP", "Irish", "Mesirow", "CM", "Storebrand", "Prologis"\
, "LBBW", "Newton", "Brandywine", "William", "Hauck", "La Francaise", "Kames"\
, "Delta", "Carmignac", "DNB", "Erste", "Edmond", "Handelsbanken", "Mondrian"\
, "Walter", "LaSalle", "Actiam", "QIC", "Cohen", "Partners", "M", "Rothschild"\
, "Record", "Colony", "Pavilion", "LGT", "BBH", "Victory", "Degroof", "Tokio"\
, "CapitaLand", "Brown", "Marathon", "Caixabank", "ASR", "Ashmore", "Sal", "Kempen"\
, "BlueBay", "Jupiter", "Daiwa", "Thornburg", "GCM", "W", "Starwood", "HarbourVest"\
, "Oddo", "Pathway", "Lombard", "Clarion", "Old", "Joh", "PanAgora", "Epoch"\
, "Northill", "CPR", "Coronation", "Tishman", "Hamilton", "THEAM", "The", "Quilvest"\
, "Harding", "Heitman", "Stone", "Fischer", "Logan", "Hermes", "Fisher", "Colchester"\
, "CVC", "Pantheon", "Shinhan", "Eagle", "GW", "Arca", "Raiffeisen", "Bentall", "J"\
, "Artemis", "Gothaer", "Alcentra", "HFT", "Winton", "Adams", "Universal"\
, "Mirabaud", "VidaCaixa", "Muzinich", "Brandes", "Quoniam", "AEW", "Seix", "Davis"\
, "Beutel", "AGF", "Genesis", "Axeltis", "Capital", "TKP", "Managed", "Intermediate"\
, "Comgest", "First", "KGAL", "AEW", "Nykredit", "Kutxabank", "BlueMountain"\
, "SPF", "Banco", "DNCA", "Unigestion", "EnTrust", "Assenagon", "Patrizia"\
, "Southeastern", "BankInvest", "Calamos", "Lendlease", "Calamos", "Westwood"\
, "Jyske", "Tweedy", "Savills", "Royce", "QS", "ValueAct", "Frankfurt", "Allianz"\
, "Syz", "Majedie", "Yacktman", "TimesSquare", "Landmark", "PAG", "Veritas"\
, "Brookfield", "Kepler", "Seeyond", "Scor", "Siemens", "Semper", "Highland"\
, "Martin", "EIG", "CamGestion", "The", "Millennium", "Bankia", "Millennium", "GNB"\
, "C", "Theodoor", "Sydbank", "Frontier", "Patron", "Alfred", "CQS", "H2O"\
, "Veritable", "Siguler", "DJE", "Gateway", "HQ", "McDonnell", "BPI", "Evli"\
, "Vaughan", "EFG", "Sparinvest", "T", "Aktia", "Glenview", "RWC", "Systematica"\
, "LocalTapiola", "Capital", "DTZ", "Chicago", "Baring", "Pacific", "TwentyFour"\
, "Pyrford", "KBI", "Skagen", "Fisch", "Arion", "Bantleon", "Maj", "Lupus", "Setanta"\
, "Maple", "Adrian", "Trilogy", "Bouwinvest", "Edinburgh", "Sparx", "CenterSquare"\
, "Hayfin", "Kairos", "Foyston", "Ecofi", "IDFC", "Tristan", "Caser", "Rockspring"\
, "Renta", "Orchard", "Driehaus", "Access", "La", "TOBAM", "Jacobs", "Investa"\
, "DDJ", "Liontrust", "River", "Cromwell", "Abbott", "Adveq", "Bankia", "Sentinel"\
, "Sberbank", "Sentinel", "Mirova", "March", "myCIO", "IPM", "Ibercaja", "AlphaSimplex"\
, "Perennial", "Impax", "LumX", "texas", "california"]
uniqueKw = list(set(keywords))
return uniqueKw
|
#
# @lc app=leetcode id=114 lang=python3
#
# [114] Flatten Binary Tree to Linked List
#
# https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/
#
# algorithms
# Medium (51.57%)
# Likes: 4378
# Dislikes: 411
# Total Accepted: 451.1K
# Total Submissions: 847.4K
# Testcase Example: '[1,2,5,3,4,null,6]'
#
# Given the root of a binary tree, flatten the tree into a "linked list":
#
#
# The "linked list" should use the same TreeNode class where the right child
# pointer points to the next node in the list and the left child pointer is
# always null.
# The "linked list" should be in the same order as a pre-order traversal of the
# binary tree.
#
#
#
# Example 1:
#
#
# Input: root = [1,2,5,3,4,null,6]
# Output: [1,null,2,null,3,null,4,null,5,null,6]
#
#
# Example 2:
#
#
# Input: root = []
# Output: []
#
#
# Example 3:
#
#
# Input: root = [0]
# Output: [0]
#
#
#
# Constraints:
#
#
# The number of nodes in the tree is in the range [0, 2000].
# -100 <= Node.val <= 100
#
#
#
# Follow up: Can you flatten the tree in-place (with O(1) extra space)?
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def flatten(self, root: TreeNode) -> None:
"""
Do not return anything, modify root in-place instead.
"""
if root is None:
return None
self.flatten(root.left)
self.flatten(root.right)
if root.left is None:
return None
node = root.left
while node.right is not None:
node = node.right
node.right = root.right
root.right = root.left
root.left = None
# @lc code=end
|
def clone_runoob(li1):
li_copy = li1[:]
# li_copy = []
# li_copy.extend(li1)
# li_copy = list(li1)
return li_copy
li1 = [4, 8, 2, 10, 15, 18]
li2 = clone_runoob(li1)
li1[0] = 5
print("原始列表:", li1)
print("复制后列表:", li2)
|
def Tproduct(arg0, *args):
p = arg0
for arg in args:
p *= arg
return p
|
mylist = input('Enter your list: ')
mylist = [int(x) for x in mylist.split(' ')]
points = [0,15,10,10,25,15,15,20,10,25,20,25,25,5,20,30,20,15,10,5,5,15,20,20,20,20,15,15,20,25,15,20,20,20,15,40,15,30,35,20,25,15,20,15,25,20,25,20,25,20,10]
total = 0
for index in mylist:
total += points[index]
print (total) |
"""Pipelines for features generation."""
__all__ = [
"base",
"lgb_pipeline",
"image_pipeline",
"linear_pipeline",
"text_pipeline",
"wb_pipeline",
]
|
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
def batch_check_layer_availability(registryId=None, repositoryName=None, layerDigests=None):
"""
Check the availability of multiple image layers in a specified registry and repository.
See also: AWS API Documentation
:example: response = client.batch_check_layer_availability(
registryId='string',
repositoryName='string',
layerDigests=[
'string',
]
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the image layers to check. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository that is associated with the image layers to check.
:type layerDigests: list
:param layerDigests: [REQUIRED]
The digests of the image layers to check.
(string) --
:rtype: dict
:return: {
'layers': [
{
'layerDigest': 'string',
'layerAvailability': 'AVAILABLE'|'UNAVAILABLE',
'layerSize': 123,
'mediaType': 'string'
},
],
'failures': [
{
'layerDigest': 'string',
'failureCode': 'InvalidLayerDigest'|'MissingLayerDigest',
'failureReason': 'string'
},
]
}
"""
pass
def batch_delete_image(registryId=None, repositoryName=None, imageIds=None):
"""
Deletes a list of specified images within a specified repository. Images are specified with either imageTag or imageDigest .
You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository.
You can completely delete an image (and all of its tags) by specifying the image's digest in your request.
See also: AWS API Documentation
Examples
This example deletes images with the tags precise and trusty in a repository called ubuntu in the default registry for an account.
Expected Output:
:example: response = client.batch_delete_image(
registryId='string',
repositoryName='string',
imageIds=[
{
'imageDigest': 'string',
'imageTag': 'string'
},
]
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the image to delete. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The repository that contains the image to delete.
:type imageIds: list
:param imageIds: [REQUIRED]
A list of image ID references that correspond to images to delete. The format of the imageIds reference is imageTag=tag or imageDigest=digest .
(dict) --An object with identifying information for an Amazon ECR image.
imageDigest (string) --The sha256 digest of the image manifest.
imageTag (string) --The tag used for the image.
:rtype: dict
:return: {
'imageIds': [
{
'imageDigest': 'string',
'imageTag': 'string'
},
],
'failures': [
{
'imageId': {
'imageDigest': 'string',
'imageTag': 'string'
},
'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag',
'failureReason': 'string'
},
]
}
"""
pass
def batch_get_image(registryId=None, repositoryName=None, imageIds=None, acceptedMediaTypes=None):
"""
Gets detailed information for specified images within a specified repository. Images are specified with either imageTag or imageDigest .
See also: AWS API Documentation
Examples
This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the current account.
Expected Output:
:example: response = client.batch_get_image(
registryId='string',
repositoryName='string',
imageIds=[
{
'imageDigest': 'string',
'imageTag': 'string'
},
],
acceptedMediaTypes=[
'string',
]
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the images to describe. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The repository that contains the images to describe.
:type imageIds: list
:param imageIds: [REQUIRED]
A list of image ID references that correspond to images to describe. The format of the imageIds reference is imageTag=tag or imageDigest=digest .
(dict) --An object with identifying information for an Amazon ECR image.
imageDigest (string) --The sha256 digest of the image manifest.
imageTag (string) --The tag used for the image.
:type acceptedMediaTypes: list
:param acceptedMediaTypes: The accepted media types for the request.
Valid values: application/vnd.docker.distribution.manifest.v1+json | application/vnd.docker.distribution.manifest.v2+json | application/vnd.oci.image.manifest.v1+json
(string) --
:rtype: dict
:return: {
'images': [
{
'registryId': 'string',
'repositoryName': 'string',
'imageId': {
'imageDigest': 'string',
'imageTag': 'string'
},
'imageManifest': 'string'
},
],
'failures': [
{
'imageId': {
'imageDigest': 'string',
'imageTag': 'string'
},
'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag',
'failureReason': 'string'
},
]
}
"""
pass
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you'd normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator('create_foo').
"""
pass
def complete_layer_upload(registryId=None, repositoryName=None, uploadId=None, layerDigests=None):
"""
Inform Amazon ECR that the image layer upload for a specified registry, repository name, and upload ID, has completed. You can optionally provide a sha256 digest of the image layer for data validation purposes.
See also: AWS API Documentation
:example: response = client.complete_layer_upload(
registryId='string',
repositoryName='string',
uploadId='string',
layerDigests=[
'string',
]
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry to which to upload layers. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository to associate with the image layer.
:type uploadId: string
:param uploadId: [REQUIRED]
The upload ID from a previous InitiateLayerUpload operation to associate with the image layer.
:type layerDigests: list
:param layerDigests: [REQUIRED]
The sha256 digest of the image layer.
(string) --
:rtype: dict
:return: {
'registryId': 'string',
'repositoryName': 'string',
'uploadId': 'string',
'layerDigest': 'string'
}
"""
pass
def create_repository(repositoryName=None):
"""
Creates an image repository.
See also: AWS API Documentation
Examples
This example creates a repository called nginx-web-app inside the project-a namespace in the default registry for an account.
Expected Output:
:example: response = client.create_repository(
repositoryName='string'
)
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name to use for the repository. The repository name may be specified on its own (such as nginx-web-app ) or it can be prepended with a namespace to group the repository into a category (such as project-a/nginx-web-app ).
:rtype: dict
:return: {
'repository': {
'repositoryArn': 'string',
'registryId': 'string',
'repositoryName': 'string',
'repositoryUri': 'string',
'createdAt': datetime(2015, 1, 1)
}
}
"""
pass
def delete_repository(registryId=None, repositoryName=None, force=None):
"""
Deletes an existing image repository. If a repository contains images, you must use the force option to delete it.
See also: AWS API Documentation
Examples
This example force deletes a repository named ubuntu in the default registry for an account. The force parameter is required if the repository contains images.
Expected Output:
:example: response = client.delete_repository(
registryId='string',
repositoryName='string',
force=True|False
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository to delete. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository to delete.
:type force: boolean
:param force: Force the deletion of the repository if it contains images.
:rtype: dict
:return: {
'repository': {
'repositoryArn': 'string',
'registryId': 'string',
'repositoryName': 'string',
'repositoryUri': 'string',
'createdAt': datetime(2015, 1, 1)
}
}
"""
pass
def delete_repository_policy(registryId=None, repositoryName=None):
"""
Deletes the repository policy from a specified repository.
See also: AWS API Documentation
Examples
This example deletes the policy associated with the repository named ubuntu in the current account.
Expected Output:
:example: response = client.delete_repository_policy(
registryId='string',
repositoryName='string'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository policy to delete. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository that is associated with the repository policy to delete.
:rtype: dict
:return: {
'registryId': 'string',
'repositoryName': 'string',
'policyText': 'string'
}
"""
pass
def describe_images(registryId=None, repositoryName=None, imageIds=None, nextToken=None, maxResults=None, filter=None):
"""
Returns metadata about the images in a repository, including image size, image tags, and creation date.
See also: AWS API Documentation
:example: response = client.describe_images(
registryId='string',
repositoryName='string',
imageIds=[
{
'imageDigest': 'string',
'imageTag': 'string'
},
],
nextToken='string',
maxResults=123,
filter={
'tagStatus': 'TAGGED'|'UNTAGGED'
}
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository in which to describe images. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described.
:type imageIds: list
:param imageIds: The list of image IDs for the requested repository.
(dict) --An object with identifying information for an Amazon ECR image.
imageDigest (string) --The sha256 digest of the image manifest.
imageTag (string) --The tag used for the image.
:type nextToken: string
:param nextToken: The nextToken value returned from a previous paginated DescribeImages request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.
:type maxResults: integer
:param maxResults: The maximum number of repository results returned by DescribeImages in paginated output. When this parameter is used, DescribeImages only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeImages request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then DescribeImages returns up to 100 results and a nextToken value, if applicable.
:type filter: dict
:param filter: The filter key and value with which to filter your DescribeImages results.
tagStatus (string) --The tag status with which to filter your DescribeImages results. You can filter results based on whether they are TAGGED or UNTAGGED .
:rtype: dict
:return: {
'imageDetails': [
{
'registryId': 'string',
'repositoryName': 'string',
'imageDigest': 'string',
'imageTags': [
'string',
],
'imageSizeInBytes': 123,
'imagePushedAt': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
:returns:
(string) --
"""
pass
def describe_repositories(registryId=None, repositoryNames=None, nextToken=None, maxResults=None):
"""
Describes image repositories in a registry.
See also: AWS API Documentation
Examples
The following example obtains a list and description of all repositories in the default registry to which the current user has access.
Expected Output:
:example: response = client.describe_repositories(
registryId='string',
repositoryNames=[
'string',
],
nextToken='string',
maxResults=123
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repositories to be described. If you do not specify a registry, the default registry is assumed.
:type repositoryNames: list
:param repositoryNames: A list of repositories to describe. If this parameter is omitted, then all repositories in a registry are described.
(string) --
:type nextToken: string
:param nextToken: The nextToken value returned from a previous paginated DescribeRepositories request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.
Note
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
:type maxResults: integer
:param maxResults: The maximum number of repository results returned by DescribeRepositories in paginated output. When this parameter is used, DescribeRepositories only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another DescribeRepositories request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then DescribeRepositories returns up to 100 results and a nextToken value, if applicable.
:rtype: dict
:return: {
'repositories': [
{
'repositoryArn': 'string',
'registryId': 'string',
'repositoryName': 'string',
'repositoryUri': 'string',
'createdAt': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to
ClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid
for. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By
default, the http method is whatever is used in the method's model.
"""
pass
def get_authorization_token(registryIds=None):
"""
Retrieves a token that is valid for a specified registry for 12 hours. This command allows you to use the docker CLI to push and pull images with Amazon ECR. If you do not specify a registry, the default registry is assumed.
The authorizationToken returned for each registry specified is a base64 encoded string that can be decoded and used in a docker login command to authenticate to a registry. The AWS CLI offers an aws ecr get-login command that simplifies the login process.
See also: AWS API Documentation
Examples
This example gets an authorization token for your default registry.
Expected Output:
:example: response = client.get_authorization_token(
registryIds=[
'string',
]
)
:type registryIds: list
:param registryIds: A list of AWS account IDs that are associated with the registries for which to get authorization tokens. If you do not specify a registry, the default registry is assumed.
(string) --
:rtype: dict
:return: {
'authorizationData': [
{
'authorizationToken': 'string',
'expiresAt': datetime(2015, 1, 1),
'proxyEndpoint': 'string'
},
]
}
"""
pass
def get_download_url_for_layer(registryId=None, repositoryName=None, layerDigest=None):
"""
Retrieves the pre-signed Amazon S3 download URL corresponding to an image layer. You can only get URLs for image layers that are referenced in an image.
See also: AWS API Documentation
:example: response = client.get_download_url_for_layer(
registryId='string',
repositoryName='string',
layerDigest='string'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the image layer to download. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository that is associated with the image layer to download.
:type layerDigest: string
:param layerDigest: [REQUIRED]
The digest of the image layer to download.
:rtype: dict
:return: {
'downloadUrl': 'string',
'layerDigest': 'string'
}
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you'd normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
"""
pass
def get_repository_policy(registryId=None, repositoryName=None):
"""
Retrieves the repository policy for a specified repository.
See also: AWS API Documentation
Examples
This example obtains the repository policy for the repository named ubuntu.
Expected Output:
:example: response = client.get_repository_policy(
registryId='string',
repositoryName='string'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository whose policy you want to retrieve.
:rtype: dict
:return: {
'registryId': 'string',
'repositoryName': 'string',
'policyText': 'string'
}
"""
pass
def get_waiter():
"""
"""
pass
def initiate_layer_upload(registryId=None, repositoryName=None):
"""
Notify Amazon ECR that you intend to upload an image layer.
See also: AWS API Documentation
:example: response = client.initiate_layer_upload(
registryId='string',
repositoryName='string'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that you intend to upload layers to. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository that you intend to upload layers to.
:rtype: dict
:return: {
'uploadId': 'string',
'partSize': 123
}
"""
pass
def list_images(registryId=None, repositoryName=None, nextToken=None, maxResults=None, filter=None):
"""
Lists all the image IDs for a given repository.
You can filter images based on whether or not they are tagged by setting the tagStatus parameter to TAGGED or UNTAGGED . For example, you can filter your results to return only UNTAGGED images and then pipe that result to a BatchDeleteImage operation to delete them. Or, you can filter your results to return only TAGGED images to list all of the tags in your repository.
See also: AWS API Documentation
Examples
This example lists all of the images in the repository named ubuntu in the default registry in the current account.
Expected Output:
:example: response = client.list_images(
registryId='string',
repositoryName='string',
nextToken='string',
maxResults=123,
filter={
'tagStatus': 'TAGGED'|'UNTAGGED'
}
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository to list images in. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The repository whose image IDs are to be listed.
:type nextToken: string
:param nextToken: The nextToken value returned from a previous paginated ListImages request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.
Note
This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.
:type maxResults: integer
:param maxResults: The maximum number of image results returned by ListImages in paginated output. When this parameter is used, ListImages only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListImages request with the returned nextToken value. This value can be between 1 and 100. If this parameter is not used, then ListImages returns up to 100 results and a nextToken value, if applicable.
:type filter: dict
:param filter: The filter key and value with which to filter your ListImages results.
tagStatus (string) --The tag status with which to filter your ListImages results. You can filter results based on whether they are TAGGED or UNTAGGED .
:rtype: dict
:return: {
'imageIds': [
{
'imageDigest': 'string',
'imageTag': 'string'
},
],
'nextToken': 'string'
}
"""
pass
def put_image(registryId=None, repositoryName=None, imageManifest=None, imageTag=None):
"""
Creates or updates the image manifest and tags associated with an image.
See also: AWS API Documentation
:example: response = client.put_image(
registryId='string',
repositoryName='string',
imageManifest='string',
imageTag='string'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository in which to put the image. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository in which to put the image.
:type imageManifest: string
:param imageManifest: [REQUIRED]
The image manifest corresponding to the image to be uploaded.
:type imageTag: string
:param imageTag: The tag to associate with the image. This parameter is required for images that use the Docker Image Manifest V2 Schema 2 or OCI formats.
:rtype: dict
:return: {
'image': {
'registryId': 'string',
'repositoryName': 'string',
'imageId': {
'imageDigest': 'string',
'imageTag': 'string'
},
'imageManifest': 'string'
}
}
"""
pass
def set_repository_policy(registryId=None, repositoryName=None, policyText=None, force=None):
"""
Applies a repository policy on a specified repository to control access permissions.
See also: AWS API Documentation
:example: response = client.set_repository_policy(
registryId='string',
repositoryName='string',
policyText='string',
force=True|False
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that contains the repository. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository to receive the policy.
:type policyText: string
:param policyText: [REQUIRED]
The JSON repository policy text to apply to the repository.
:type force: boolean
:param force: If the policy you are attempting to set on a repository policy would prevent you from setting another policy in the future, you must force the SetRepositoryPolicy operation. This is intended to prevent accidental repository lock outs.
:rtype: dict
:return: {
'registryId': 'string',
'repositoryName': 'string',
'policyText': 'string'
}
"""
pass
def upload_layer_part(registryId=None, repositoryName=None, uploadId=None, partFirstByte=None, partLastByte=None, layerPartBlob=None):
"""
Uploads an image layer part to Amazon ECR.
See also: AWS API Documentation
:example: response = client.upload_layer_part(
registryId='string',
repositoryName='string',
uploadId='string',
partFirstByte=123,
partLastByte=123,
layerPartBlob=b'bytes'
)
:type registryId: string
:param registryId: The AWS account ID associated with the registry that you are uploading layer parts to. If you do not specify a registry, the default registry is assumed.
:type repositoryName: string
:param repositoryName: [REQUIRED]
The name of the repository that you are uploading layer parts to.
:type uploadId: string
:param uploadId: [REQUIRED]
The upload ID from a previous InitiateLayerUpload operation to associate with the layer part upload.
:type partFirstByte: integer
:param partFirstByte: [REQUIRED]
The integer value of the first byte of the layer part.
:type partLastByte: integer
:param partLastByte: [REQUIRED]
The integer value of the last byte of the layer part.
:type layerPartBlob: bytes
:param layerPartBlob: [REQUIRED]
The base64-encoded layer part payload.
:rtype: dict
:return: {
'registryId': 'string',
'repositoryName': 'string',
'uploadId': 'string',
'lastByteReceived': 123
}
"""
pass
|
catalog = "fichier.html"
# The function write in HTML the title which has a level 1 title
def h1(title_lv1):
with open(catalog , "a") as htm_file:
sorting = title_lv1
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h1>"
matter.append("</h1>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
# The function write in HTML the title which has a level 2 title
def h2(title_lv2):
with open("fichier.html" , "a") as htm_file:
sorting = title_lv2
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h2>"
matter.append("</h2>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
# The function write in HTML the title which has a level 3 title
def h3(title_lv3):
with open("fichier.html" , "a") as htm_file:
sorting = title_lv3
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h3>"
matter.append("</h3>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
# The function write in HTML the title which has a level 4 title
def h4(title_lv4):
with open("fichier.html" , "a") as htm_file:
sorting = title_lv4
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h4>"
matter.append("</h4>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
# The function write in HTML the title which has a level 5 title
def h5(title_lv5):
with open("fichier.html" , "a") as htm_file:
sorting = title_lv5
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h5>"
matter.append("</h5>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
# The function write in HTML the title which has a level 6 title
def h6(title_lv6):
with open("fichier.html" , "a") as htm_file:
sorting = title_lv6
cont = sorting.split("#")
useless = "".join(cont)
matter = useless.split("\n")
matter[1] = matter[0]
matter[0] = "<h6>"
matter.append("</h6>")
matter.append("\n")
tenor = "".join(matter)
htm_file.write(tenor)
def italic(italic_sentence , sep):
with open("fichier.html" , "a") as htm_file:
sorting = italic_sentence
cont = sorting.split(sep)
cont[0] = "<i>"
cont.append(cont[2])
cont[2] = "</i>"
matter = "".join(cont)
htm_file.write(matter)
def bold(bold_sentence , sep):
with open("fichier.html" , "a") as htm_file:
sorting = bold_sentence
cont = sorting.split(sep)
cont[0] = "<strong>"
cont.append(cont[2])
cont[2] = "</strong>"
matter = "".join(cont)
htm_file.write(matter)
def link(connection):
with open("fichier.html" , "a") as htm_file:
sorting = connection
cont_lab1 = sorting.split("[")
useless1 = "".join(cont_lab1)
cont_lab2 = useless1.split("]")
useless2 = "°".join(cont_lab2)
cont_link1 = useless2.split("(")
useless3 = "".join(cont_link1)
cont_link2 = useless3.split(")")
useless4 = "".join(cont_link2)
matter = useless4.split("°")
label = matter[0]
the_link = matter[1]
form_list = ['<a href="' , the_link , '">' , label , '</a>']
final_form = "".join(form_list)
htm_file.write(final_form)
def ul_li(roster):
with open("fichier.html" , "a") as htm_file:
sorting = roster
cont = sorting.split("-")
init = ['0']*6
ul = cont + init
# if
# cont[0] = "<li>"
# cont.append("</li>")
print(init)
print(cont)
print(ul)
# with open("fichier.html" , "a") as htm_file:
# sorting = title_lv5
# cont = sorting.split("#")
# useless = "".join(cont)
# matter = useless.split("\n")
# matter[1] = matter[0]
# matter[0] = "<h5>"
# matter.append("</h5>")
# matter.append("\n")
# tenor = "".join(matter)
# htm_file.write(tenor)
#<ul>\n
# <li>Blue cheese</li>\n
# <li>Feta</li>\n
#</ul> |
'''
对链表进行插入排序。
插入排序的动画演示如上。从第一个元素开始,该链表可以被认为已经部分排序(用黑色表示)。
每次迭代时,从输入数据中移除一个元素(用红色表示),并原地将其插入到已排好序的链表中。
插入排序算法:
插入排序是迭代的,每次只移动一个元素,直到所有元素可以形成一个有序的输出列表。
每次迭代中,插入排序只从输入数据中移除一个待排序的元素,找到它在序列中适当的位置,并将其插入。
重复直到所有输入数据插入完为止。
示例 1:
输入: 4->2->1->3
输出: 1->2->3->4
示例 2:
输入: -1->5->3->4->0
输出: -1->0->3->4->5
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/insertion-sort-list
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def insertionSortList(self, head: ListNode) -> ListNode:
dummy = ListNode(float('-inf'))
pre = dummy
tail = dummy
cur = head
while cur:
if tail.val < cur.val:
tail.next = cur
tail = cur
cur = cur.next
else:
tmp = cur.next
tail.next = tmp
while pre.next and pre.next.val < cur.val:
pre = pre.next
cur.next = pre.next
pre.next = cur
pre = dummy
cur = tmp
return dummy.next
|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011-2015 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
"""
These values determine how the end of opened sub-paths are rendered in a
stroke.
FT_STROKER_LINECAP_BUTT
The end of lines is rendered as a full stop on the last point itself.
FT_STROKER_LINECAP_ROUND
The end of lines is rendered as a half-circle around the last point.
FT_STROKER_LINECAP_SQUARE
The end of lines is rendered as a square around the last point.
"""
FT_STROKER_LINECAPS = { 'FT_STROKER_LINECAP_BUTT' : 0,
'FT_STROKER_LINECAP_ROUND' : 1,
'FT_STROKER_LINECAP_SQUARE' : 2}
globals().update(FT_STROKER_LINECAPS)
|
INPUT_FILE = "../../input/01.txt"
def parse_input() -> list[int]:
"""
Parses the input and returns a list of depth measurements.
"""
with open(INPUT_FILE, "r") as f:
return [int(line) for line in f]
def count_increases(measurements: list[int]) -> int:
"""
Counts the number of times a measurement increases from the previous measurement.
"""
return sum(1 for a, b in zip(measurements[:-1], measurements[1:]) if a < b)
def get_sliding_windows(depths: list[int]) -> list[int]:
"""
Calculates the three-measurement sliding windows.
"""
return [a + b + c for a, b, c in zip(depths[:-2], depths[1:-1], depths[2:])]
if __name__ == "__main__":
depths = parse_input()
part1 = count_increases(depths)
sliding_windows = get_sliding_windows(depths)
part2 = count_increases(sliding_windows)
print(part1)
print(part2)
|
URLS = 'app.urls'
POSTGRESQL_DATABASE_URI = ""
DEBUG = True
BASE_HOSTNAME = 'http://192.168.30.101:8080'
HOST = '0.0.0.0'
USERNAME = 'user'
PASSWORD = 'pass'
|
class ModelMetrics:
def __init__(self, model_name, model_version, metric_by_feature):
self.model_name = model_name
self.model_version = model_version
self.metrics_by_feature = metric_by_feature
|
{
"name": "Attachment Url",
"summary": """Use attachment URL and upload data to external storage""",
"category": "Tools",
"images": [],
"version": "13.0.2.1.0",
"application": False,
"author": "IT-Projects LLC, Ildar Nasyrov",
"website": "https://apps.odoo.com/apps/modules/13.0/ir_attachment_url/",
"license": "LGPL-3",
"depends": ["web"],
"external_dependencies": {"python": [], "bin": []},
"data": ["views/ir_attachment.xml"],
"qweb": [],
"demo": [],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"auto_install": False,
"installable": True,
}
|
class Sample:
"""A representation of a sample obtained from IRIDA"""
def __init__(self, name, paired_path, unpaired_path):
"""
Initialize a sample instance
:type name: str
:param name: the name of the sample
:type path: str
:param path: the URI to obtain the sample from IRIDA
"""
self.name = name
self.paired_path = paired_path
self.unpaired_path = unpaired_path
self._sample_reads = [] # A list of SampleFile/SamplePair objects
def __repr__(self):
num_files = 0
for item in self.get_files():
try:
for _file in item:
num_files += 1
except TypeError:
num_files += 1
return_string = self.name + ":\n"
return_string += "\tPaired path: " + self.paired_path + "\n"
return_string += "\tSingles path: " + self.unpaired_path + "\n"
return_string += "\tNumber of files: " + str(num_files) + "\n"
return return_string
def add_file(self, new_file):
self._sample_reads.append(new_file)
def add_pair(self, pair):
self.add_file(pair)
def get_reads(self):
return self._sample_reads
|
class QuotesType:
""" Checks whether quotation marks are double or single in source file. """
NEED_TO_USE_SINGLE_QUOTES = 'need_to_use_single_quotes'
NEED_TO_USE_DOUBLE_QUOTES = 'need_to_use_double_quotes'
discrete_groups = [
{ 'name': 'single_quotes' },
{ 'name': 'double_quotes' },
]
inspections = {
NEED_TO_USE_SINGLE_QUOTES: 'Mostly single quotes are used in the source code, '
'maybe you need to change double quotes here.',
NEED_TO_USE_DOUBLE_QUOTES: 'Mostly double quotes are used in the source code, '
'maybe you need to change single quotes here.',
}
def count(self, file, verbose=False):
# Count all quotes that are single or double
with open(file) as f:
single_quotes_count = 0
double_quotes_count = 0
single_quotes_lines = []
double_quotes_lines = []
line_number = 0
for line in f.readlines():
line_number += 1
is_single = False
is_double = False
for i in range(len(line)):
if i > 0 and line[i - 1] == '\\':
continue
if line[i] == '\'':
if is_double:
continue
if is_single:
single_quotes_count += 1
single_quotes_lines.append(line_number)
is_single = False
else:
is_single = True
if line[i] == '\"':
if is_single:
continue
if is_double:
double_quotes_count += 1
double_quotes_lines.append(line_number)
is_double = False
else:
is_double = True
single_quotes_lines.sort()
unique_single_quotes_lines = []
for i in range(len(single_quotes_lines) - 1):
if i == 0 or single_quotes_lines[i] != single_quotes_lines[i-1]:
unique_single_quotes_lines.append(single_quotes_lines[i])
# Getting unique values for lines
double_quotes_lines.sort()
unique_double_quotes_lines = []
for i in range(len(double_quotes_lines) - 1):
if i == 0 or double_quotes_lines[i] != double_quotes_lines[i - 1]:
unique_double_quotes_lines.append(double_quotes_lines[i])
# Form result
result = {
'single_quotes': single_quotes_count,
'double_quotes': double_quotes_count,
}
if verbose:
result['single_quotes'] = {
'count': single_quotes_count,
'lines': unique_single_quotes_lines,
}
result['double_quotes'] = {
'count': double_quotes_count,
'lines': unique_double_quotes_lines,
}
return result
def discretize(self, values):
discrete_values = {}
sum = 0.0
# Set initial values for groups to 0
for group in self.discrete_groups:
discrete_values[group['name']] = 0
# Sum values for each group
for group, count in values.items():
discrete_values[group] = count
sum += count
# Normalize
for group, count in discrete_values.items():
if sum != 0:
discrete_values[group] = count / sum
return discrete_values
def inspect(self, discrete, values):
for_discretization = {}
for key, value in values.items():
for_discretization[key] = value['count']
file_discrete = self.discretize(for_discretization)
# Check if single or double quotes are prevailing
is_single_quote = False
if discrete['single_quotes'] > discrete['double_quotes']:
is_single_quote = True
inspections = {}
# Issue messages for all double quotes if single quotes prevail (or overwise)
if is_single_quote and file_discrete['double_quotes'] > 0.0:
inspections[self.NEED_TO_USE_SINGLE_QUOTES] = {
'message': self.inspections[self.NEED_TO_USE_SINGLE_QUOTES].format(discrete['single_quotes'] * 100),
'lines': values['double_quotes']['lines'][:],
}
elif not is_single_quote and file_discrete['single_quotes'] > 0.0:
inspections[self.NEED_TO_USE_DOUBLE_QUOTES] = {
'message': self.inspections[self.NEED_TO_USE_DOUBLE_QUOTES].format(discrete['double_quotes'] * 100),
'lines': values['single_quotes']['lines'][:],
}
return inspections
|
def get_xoutput_ref(self):
"""Return the reference XOutput (or Output) either from xoutput_ref or output_list
Parameters
----------
self : XOutput
A XOutput object
Returns
-------
xoutput_ref: XOutput
reference XOutput (or Output) (if defined)
"""
if self.xoutput_ref_index is not None:
return self.output_list[self.xoutput_ref_index]
else:
return self.xoutput_ref
|
def constraint_in_set(_set = range(0,128)):
def f(context):
note, seq, tick = context
if seq.to_pitch_set() == {}:
return False
return seq.to_pitch_set().issubset(_set)
return f
def constraint_no_repeated_adjacent_notes():
def f(context):
note, seq, tick = context
return seq[0].pitches[0] != context["previous"][-1].pitches[0]
return f
def constraint_limit_shared_pitches(max_shared=1):
def f(context):
note, seq, tick = context
intersection = set(seq.pitches).intersection(set(context["previous"].pitches))
return len(intersection) <= max_shared
return f
def constraint_enforce_shared_pitches(min_shared=1):
def f(context):
note, seq, tick = context
intersection = set(seq.pitches).intersection(set(context["previous"].pitches))
return len(intersection) >= min_shared
return f
def constraint_no_leaps_more_than(max_int):
def f(context):
note, seq, tick = context
previous_pitch = seq.events[-2].pitches[0]
delta = note - previous_pitch
return abs(delta) <= max_int
return f
def constraint_note_is(tick=0,pitch=0):
def f(context):
event, seq, _tick = context
if _tick != tick:
return True
return event.pitches[0] == pitch
return f
def constraint_voice2_is_lower_than(voice1):
def f(context):
event, seq, tick = context
#print(tick, voice1[tick], note, voice1[tick] >= note)
return voice1[tick].pitches[0] >= event.pitches[0]
return f |
#!/usr/bin/env LANG=en_UK.UTF-8 /usr/local/bin/python3
'''
Multiple language title article splitting script
Takes arguments of full title, and title language in ISO Country Code alpha-2
Handles the potential for title entries to be upper case or lower case.
Loads TITLE_ARTICLES dictionary, which returns a list of title articles relevant to supplied language
Script matches title article (if present) to language key's value list,
if not returns original title and empty string.
Joanna White 2021
'''
# Dictionary of ISO country codes and title articles for each language
# These contents may have first originated from AACR2 documentation, with additions from BFI staff through the years
TITLE_ARTICLES = {'af': ["Die ", "'N "],
'sq': ["Nji ", "Një "],
'ar': ["El-", "Ad-", "Ag-", "Ak-", "An-", "Ar-", "As-", "At-", "Az-"],
'da': ["Den ", "Det ", "De ", "En ", "Et "],
'nl': ["De ", "Het ", "'S ", "Een ", "Eene ", "'N "],
'en': ["The ", "A ", "An "],
'fr': ["Le ", "La ", "L'", "Les ", "Un ", "Une "],
'de': ["Der ", "Die ", "Das ", "Ein ", "Eine "],
'el': ["Ho ", "He ", "To ", "Hoi ", "Hai ", "Ta ", "Henas ", "Heis ", "Mia ", "Hena "],
'he': ["Ha-" , "Ho-"],
'hu': ["A ", "Az ", "Egy "],
'is': ["Hinn ", "Hin ", "Hid ", "Hinir ", "Hinar "],
'it': ["Il ", "La ", "Lo ", "I ", "Gli ", "Gl'", "Le ", "L'", "Un ", "Uno ", "Una ", "Un'"],
'nb': ["Den ", "Det ", "De ", "En ", "Et "],
'nn': ["Dent ", "Det ", "Dei ", "Ein ", "Ei ", "Eit "],
'pt': ["O ", "A ", "Os ", "As ", "Um ", "Uma "],
'ro': ["Un ", "Una ", "O "],
'es': ["El ", "La ", "Lo ", "Los ", "Las ", "Un ", "Una "],
'sv': ["Den ", "Det ", "De ", "En ", "Ett "],
'tr': ["Bir "],
'cy': ["Y ", "Yr "],
'yi': ["Der ", "Di ", "Die ", "Dos ", "Das ", "A ", "An ", "Eyn ", "Eyne "]
}
def splitter(title_supplied, language):
# Refresh variables
title = ''
title_art = ''
# Manage title appearing all upper case
if title_supplied.isupper():
title_supplied = title_supplied.title()
# Counts words in the supplied title
title_strip = title_supplied.strip()
count = 1 + title_strip.count(" ")
# For single word titles, splits into title and title_art
# where articles are attached to first word of title
language = language.lower()
if count == 1:
if 'ar' in language or 'he' in language:
title_supplied = title_supplied.capitalize()
# Split here on the first word - hyphen
if title_supplied.startswith(("El-", "Ad-", "Ag-", "Ak-", "An-", "Ar-", "As-", "At-", "Az-", "Ha-", "Ho-")):
title_art_split = title_supplied.split("-")
title_art = title_art_split[0]
title = "{}".format(title_art_split[1])
elif 'it' in language or 'fr' in language:
title_supplied = title_supplied.capitalize()
# Split on the first word apostrophe where present
if title_supplied.startswith(("L'", "Un'", "Gl'")):
title_art_split = title_supplied.split("'")
title_art = "{}'".format(title_art_split[0])
title = "{}".format(title_art_split[1])
else:
title = title_supplied
title_art = ''
# For multiple word titles, splits into title and title_art
# where articles are attached to first word of title
# and where articles are separately spaced
elif count > 1:
ttl = []
title_split = title_supplied.split()
title_art_split = title_split[0]
title_art_split = title_art_split.capitalize()
if 'ar' in language or 'he' in language:
# Split here on the first word - hyphen
if title_art_split.startswith(("El-", "Ad-", "Ag-", "Ak-", "An-", "Ar-", "As-", "At-", "Az-", "Ha-", "Ho-")):
article_split = title_art_split.split("-")
title_art = str(article_split[0])
ttl.append(article_split[1])
ttl += title_split[1:]
title = ' '.join(ttl)
elif 'it' in language or 'fr' in language:
# Split on the first word apostrophe where present
if title_art_split.startswith(("L'", "Un'", "Gl'")):
article_split = title_art_split.split("'")
title_art = "{}'".format(article_split[0])
ttl.append(article_split[1])
ttl += title_split[1:]
title_join = ' '.join(ttl)
title = title_join.strip()
else:
ttl = title_split[1:]
title_art = title_split[0]
title = ' '.join(ttl)
else:
ttl = title_split[1:]
title_art = title_split[0]
title = ' '.join(ttl)
# Searches through keys for language match
for key in TITLE_ARTICLES.keys():
if language == str(key):
lst = []
lst = TITLE_ARTICLES[language]
# Looks to match title_art with values in language key match
# and return title, title_art where this is the case
for item in zip(lst):
if len(title_art) > 0:
title_art = title_art.capitalize()
if title_art in str(item):
title_art = title_art.title()
title = title[0].upper() + title[1:]
if title.isupper():
title = title.title()
return title, title_art
else:
return title, title_art
# Returns titles as they are where no article language matches
for key in TITLE_ARTICLES.keys():
if language != str(key):
return title_supplied, ''
|
load("@rules_scala_annex//rules:providers.bzl", "LabeledJars")
def labeled_jars_implementation(target, ctx):
if JavaInfo not in target:
return []
deps_labeled_jars = [dep[LabeledJars] for dep in getattr(ctx.rule.attr, "deps", []) if LabeledJars in dep]
java_info = target[JavaInfo]
return [
LabeledJars(
values = depset(
[struct(label = ctx.label, jars = depset(transitive = [java_info.compile_jars, java_info.full_compile_jars]))],
order = "preorder",
transitive = [labeled_jars.values for labeled_jars in deps_labeled_jars],
),
),
]
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.html
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class TableJoiner:
def __init__(self, hive_context, query):
self.query = query
self.hive_context = hive_context
def join_tables(self):
df = self.hive_context.sql(self.query)
return df
|
def check_for_wildcard(policy):
"""
Checks for wildcards in policy statements
"""
# Make sure Statement is a list
if type(policy.policy_json['Statement']) is dict:
policy.policy_json['Statement'] = [ policy.policy_json['Statement'] ]
for sid in policy.policy_json['Statement']:
if 'Action' in sid:
# Action should be a list for easy iteration
if type(sid['Action']) is str:
sid['Action'] = [ sid['Action'] ]
# Check each action in the list if it has a wildcard, add finding if so.
for action in sid['Action']:
if '*' in action:
policy.add_finding('Action_Wildcard', location={"action": action}) |
# Exercício 030 - Par ou Ímpar?
x = int(input('Me diga um número qualquer: '))
resultado = 'PAR' if x % 2 == 0 else 'ÍMPAR'
print(f'O número {x} é {resultado}')
|
def main():
print(("강한친구 대한육군" + "\n") * 2)
if __name__ == "__main__":
main()
|
# -*- coding: utf-8 -*-
FILTER_RULE = (
(-1, u'发送'),
(1, u'接收'),
)
RULE_LOGIC = (
("all", u'满足所有条件'),
("one", u'满足一条即可'),
)
DISABLED_STATUS = (
(-1, u'启用'),
(1, u'禁用'),
)
COND_LOGIC = (
("all", u'满足所有'),
("one", u'满足任意'),
)
####################################################
ALL_CONDITION_OPTION = (
("header", u'邮件头'),
("extra", u'其他'),
)
ALL_CONDITION_SUBOPTION = (
("all_mail", u'所有邮件'),
("has_attach", u'有附件'),
("attachments", u'附件名'),
("sender", u'发信人'),
("cc", u'抄送人'),
("recipient", u'收信人'),
("sender_dept", u'发信人部门'),
("cc_dept", u'抄送人部门'),
("rcpt_dept", u'收信人部门'),
# ("header", u'邮件头'),
("subject", u'主题'),
("body", u'邮件内容'),
("mail_size", u'邮件大小'),
("header_received", u'邮件头Received'),
#("header_from", u'邮件头From'),
)
ALL_CONDITION_ACTION = (
("contains", u'包含'),
("not_contains", u'不包含'),
("==", u'等于'),
(">=", u'大于等于'),
("<=", u'小于等于'),
("in", u'属于'),
("not_in", u'不属于'),
)
####################################################
#
ALL_CONDITION_OPTION_HEADER = (
("sender", u'发信人'),
("cc", u'抄送人'),
("recipient", u'收信人'),
("sender_dept", u'发信人部门'),
("cc_dept", u'抄送人部门'),
("rcpt_dept", u'收信人部门'),
("subject", u'主题'),
("header_received", u'邮件头Received'),
#("header_from", u'邮件头From'),
("attachments", u'附件名'),
# ("header", u'邮件头'),
)
ALL_CONDITION_OPTION_EXTRA = (
("all_mail", u'所有邮件'),
("has_attach", u'有附件'),
("mail_size", u'邮件大小'),
("body", u'邮件内容'),
)
ALL_CONDITION_OPTION_HEADER_VALUE = ("sender", "cc", "recipient", "sender_dept", "cc_dept",
"rcpt_dept", "subject", "header_received", "header_from", "attachments")
COND_OPTION_OTHER = ("all_mail", "has_attach", "mail_size", "body", )
### 条件 和 动作 分组 GROUP
# 1. 可以为 not_in , in 的 option
G_COND_OPTION_IN_T = (
("sender_dept", u'发信人部门'),
("cc_dept", u'抄送人部门'),
("rcpt_dept", u'收信人部门'),
)
G_COND_ACTION_IN_T = (
("in", u'属于'),
("not_in", u'不属于'),
)
G_COND_OPTION_IN = ("sender_dept", "cc_dept", "rcpt_dept") # 部门下拉选择
G_COND_ACTION_IN = ("not_in", "in")
# 可以为 >= , <= 的 option
G_COND_OPTION_GTE_T = (
("mail_size", u'邮件大小')
)
G_COND_ACTION_GTE_T = (
(">=", u'大于等于'),
("<=", u'小于等于'),
)
G_COND_OPTION_GTE = ("mail_size", ) # 整型输入框
G_COND_ACTION_GTE = (">=", "<=")
# 特殊设置的 option 只能为 ==
G_COND_OPTION_EQ_T = (
("all_mail", u'所有邮件'),
("has_attach", u'有附件'),
)
G_COND_ACTION_EQ_T = (
("==", u'等于'),
)
G_COND_OPTION_EQ = ("all_mail", "has_attach") # 值 1 -1 下拉选择
G_COND_ACTION_EQ = ("==", )
G_COND_ACTION_EQ_VALUE = (
("-1", u'否'),
("1", u'是'),
)
# 通用
G_COND_OPTION_OTHER_T = (
("sender", u'发信人'),
("cc", u'抄送人'),
("recipient", u'收信人'),
("subject", u'主题'),
("body", u'邮件内容'),
("header_received", u'邮件头Received'),
("header_from", u'邮件头From'),
("attachments", u'附件名'),
)
G_COND_ACTION_OTHER_T = (
("contains", u'包含'),
("not_contains", u'不包含'),
("==", u'等于'),
)
G_COND_OPTION_OTHER = ("sender", "cc", "recipient", "subject", "body", "header_received", "header_from", "attachments") # 字符串输入框
G_COND_ACTION_OTHER = ("contains", "not_contains", "==")
G_COND_OPTION_ALL = ("sender", "cc", "recipient", "subject", "body", "header_received",
"all_mail", "has_attach", "sender_dept", "cc_dept", "rcpt_dept", "mail_size",
"attachments", "header_from", )
####################################################
CFILTER_ACTION_SELECT_VALUE = (
("Spam", u"垃圾箱"),
("Trash", u"废件箱"),
("Inbox", u"收件箱"),
("Sent", u"发件箱"),
)
## 动作
ALL_ACTION = (
("break", u'中断执行规则'),
("jump_to", u'跳过后面N个规则'),
("flag", u'设置旗帜'),
#("label", u'设置标签'), webmail 尚未实现
("delete", u'删除邮件'),
("sequester", u'隔离邮件'),
("move_to", u'移动邮件至文件夹'),
("copy_to", u'复制邮件至文件夹'),
("forward", u'转发'),
("delete_header", u'删除邮件头'),
("append_header", u'追加头部'),
("append_body", u'追加邮件内容'),
("mail", u'发送邮件'),
("smtptransfer", u'SMTP转发'),
("replace_subject", u'邮件主题替换'),
("replace_body", u'邮件正文替换'),
# break 中断执行规则
# jump_to 跳过后面N个规则
# flag 设置旗帜
# label 设置标签
# delete 删除邮件
# sequester 隔离邮件
# move_to 移动邮件至文件夹
# copy_to 复制邮件至文件夹
# forward 转发
# delete_header 删除邮件头
# append_header 追加头部
# append_body 追加邮件内容
# mail 发送邮件
# replace_subject 邮件主题替换
# replace_body 邮件正文替换
#---------------------------------------------------------------
# break value = null
# jump_to value = { "value":int }
# delete value = null
# sequester value = null
# move_to value = { 'value':前端存入的文件夹名称 }
# copy_to value = { 'value':前端存入的文件夹名称 }
# forward value = { 'value':前端存入的邮箱,以','分隔 }
# delete_header value = { 'field':邮件头字段 }
# append_header value = { 'field':邮件头字段, 'value':前端存入的值 }
# append_body value = { 'value':前端存入的值 }
# replace_subject value = { 'field':邮件头字段, 'value':前端存入的值 }
# replace_body value = { 'field':邮件头字段, 'value':前端存入的值 }
# mail value = { 'sender':发信人,'recipient':收信人,'subject':主题,'content':内容,'content_type':plain or html }
# smtptransfer value = { 'account':登录帐号,'server':服务器,'ssl':是否SSL,'auth':是否验证,'password':base64_encode(password) }
)
ACCOUNT_TRANSFER_DEL = (
('1', u'是'),
('-1', u'否'),
)
ACCOUNT_TRANSFER_STATUS = (
('wait', u'等待处理'),
('transfering', u'正在传输'),
('transfered', u'传输完毕'),
('deleting', u'正在删除'),
('deleted', u'删除完毕'),
('finished', u'全部结束'),
)
ACCOUNT_TRANSFER_DISABLE = (
('1', u'停止'),
('-1', u'开始'),
)
ACCOUNT_IMAPMOVING_STATUS = (
('wait', u'等待处理'),
('moving', u'迁移中'),
('abort', u'异常中断'),
('done', u'迁移完毕'),
)
ACCOUNT_IMAPMOVING_DISABLE = (
('1', u'停止'),
('-1', u'开始'),
)
ACCOUNT_IMAPMOVING_FOLDER = (
('all', u'全部'),
('INBOX', u'收件箱'),
)
ACCOUNT_IMAPMOVING_SETFROM = (
('file', u'文件导入'),
('admin', u'管理员'),
)
ACCOUNT_IMAPMOVING_SSL = (
('1', u'启用'),
('-1', u'不启用'),
)
ACCOUNT_IMAPMOVING_PROTO = (
('pop3', u'pop3'),
('imap', u'imap'),
)
MAIL_TRANSFER_DISABLE = (
('1', u'禁用'),
('-1', u'激活'),
)
MAIL_TRANSFER_SSL = (
('1', u'启用'),
('-1', u'不启用'),
)
MAIL_TRANSFER_AUTH = (
('1', u'是'),
('-1', u'否'),
)
|
#Escreva um programa que leia a velocidade de um carro.
velocidade = float(input('Velocidade: '))
# Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado
if velocidade > 80:
print(f'Passou a {velocidade} numa pista de 80 !!! \nVai pagar R${((velocidade-80)*30):.2f} de multa')
#A multa vai custar R$7,00 por cada Km acima do limite.
else:
print(f'{velocidade}Km. Voce estava dentro do limite de 80Km') |
# This is the version string assigned to the entire egg post
# setup.py install
__version__ = "0.0.9"
# Ownership and Copyright Information.
__author__ = "Colin Bell <colin.bell@uwaterloo.ca>"
__copyright__ = "Copyright 2011-2014, University of Waterloo"
__license__ = "BSD-new"
|
#This file was created by Diego Saldana
TITLE = " SUPREME JUMP "
TITLE2 = " GAME OVER FOO :( "
# screen dims
WIDTH = 480
HEIGHT = 600
# frames per second
FPS = 60
# player settings
PLAYER_ACC = 0.5
PLAYER_FRICTION = -0.12
PLAYER_GRAV = 0.8
PLAYER_JUMP = 100
FONT_NAME = 'arcade'
# platform settings
PLATFORM_LIST = [(0, HEIGHT - 40, WIDTH, 40),
(65, HEIGHT - 300, WIDTH-400, 40),
(20, HEIGHT - 350, WIDTH-300, 40),
(200, HEIGHT - 150, WIDTH-350, 40),
(200, HEIGHT - 450, WIDTH-350, 40)]
#colors
WHITE = (255, 255, 255)
GREY = (205,201,201)
BLUE = (175,238,238)
BLACK = (0,0,0)
RED = (178,34,34) |
#
# PySNMP MIB module XYLAN-HEALTH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-HEALTH-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:38:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Integer32, ModuleIdentity, iso, MibIdentifier, Counter64, NotificationType, Counter32, Bits, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, Gauge32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "ModuleIdentity", "iso", "MibIdentifier", "Counter64", "NotificationType", "Counter32", "Bits", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "Gauge32", "TimeTicks")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
xylanHealthArch, = mibBuilder.importSymbols("XYLAN-BASE-MIB", "xylanHealthArch")
healthDeviceInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 1))
healthModuleInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 2))
healthPortInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 3))
healthGroupInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 4))
healthControlInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 5))
healthThreshInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 6))
health2DeviceInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 7))
health2ModuleInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 8))
health2PortInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18, 9))
healthDeviceRxData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceRxData.setStatus('mandatory')
healthDeviceRxTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceRxTimeDelta.setStatus('mandatory')
healthDeviceRxTxData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceRxTxData.setStatus('mandatory')
healthDeviceRxTxTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceRxTxTimeDelta.setStatus('mandatory')
healthDeviceBackplaneData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceBackplaneData.setStatus('mandatory')
healthDeviceBackplaneTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceBackplaneTimeDelta.setStatus('mandatory')
healthDeviceCamData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(12, 12)).setFixedLength(12)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceCamData.setStatus('mandatory')
healthDeviceCamTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceCamTimeDelta.setStatus('mandatory')
healthDeviceMemoryData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(12, 12)).setFixedLength(12)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMemoryData.setStatus('mandatory')
healthDeviceMemoryTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMemoryTimeDelta.setStatus('mandatory')
healthDeviceCpuData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 11), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceCpuData.setStatus('mandatory')
healthDeviceCpuTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceCpuTimeDelta.setStatus('mandatory')
healthDeviceNumCpus = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceNumCpus.setStatus('mandatory')
healthDeviceMemoryTotal = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMemoryTotal.setStatus('mandatory')
healthDeviceMemoryFree = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMemoryFree.setStatus('mandatory')
healthDeviceMpmCamTotal = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMpmCamTotal.setStatus('mandatory')
healthDeviceMpmCamFree = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMpmCamFree.setStatus('mandatory')
healthDeviceHreCamTotal = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceHreCamTotal.setStatus('mandatory')
healthDeviceHreCamFree = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 19), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceHreCamFree.setStatus('mandatory')
healthDeviceTemp = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 20), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceTemp.setStatus('mandatory')
healthDeviceIPRouteCacheFlushCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceIPRouteCacheFlushCount.setStatus('mandatory')
healthDeviceIPXRouteCacheFlushCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 22), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceIPXRouteCacheFlushCount.setStatus('mandatory')
healthDeviceMpmRxOverrunCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 23), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMpmRxOverrunCount.setStatus('mandatory')
healthDeviceMpmTxOverrunCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 24), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceMpmTxOverrunCount.setStatus('mandatory')
healthDeviceVccData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 25), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceVccData.setStatus('mandatory')
healthDeviceVccTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 26), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceVccTimeDelta.setStatus('mandatory')
healthDeviceTemperatureData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 27), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceTemperatureData.setStatus('mandatory')
healthDeviceTemperatureTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 28), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceTemperatureTimeDelta.setStatus('mandatory')
healthDeviceVpData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 29), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceVpData.setStatus('mandatory')
healthDeviceVpTimeDelta = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 30), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceVpTimeDelta.setStatus('mandatory')
healthDeviceHreCollisionTotal = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 31), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceHreCollisionTotal.setStatus('mandatory')
healthDeviceHreCollisionFree = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 1, 32), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthDeviceHreCollisionFree.setStatus('mandatory')
healthModuleTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1), )
if mibBuilder.loadTexts: healthModuleTable.setStatus('mandatory')
healthModuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "healthModuleSlot"))
if mibBuilder.loadTexts: healthModuleEntry.setStatus('mandatory')
healthModuleSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleSlot.setStatus('mandatory')
healthModuleRxData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleRxData.setStatus('mandatory')
healthModuleRxTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleRxTimeDelta.setStatus('mandatory')
healthModuleRxTxData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleRxTxData.setStatus('mandatory')
healthModuleRxTxTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleRxTxTimeDelta.setStatus('mandatory')
healthModuleBackplaneData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleBackplaneData.setStatus('mandatory')
healthModuleBackplaneTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleBackplaneTimeDelta.setStatus('mandatory')
healthModuleCamData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamData.setStatus('mandatory')
healthModuleCamTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamTimeDelta.setStatus('mandatory')
healthModuleCamNumInstalled = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamNumInstalled.setStatus('mandatory')
healthModuleCamConfigured = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamConfigured.setStatus('mandatory')
healthModuleCamAvail = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamAvail.setStatus('mandatory')
healthModuleCamAvailNonIntern = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamAvailNonIntern.setStatus('mandatory')
healthModuleCamFree = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleCamFree.setStatus('mandatory')
healthModuleVccData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleVccData.setStatus('mandatory')
healthModuleVccTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 2, 1, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthModuleVccTimeDelta.setStatus('mandatory')
healthSamplingInterval = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 5, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthSamplingInterval.setStatus('mandatory')
healthSamplingReset = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 5, 2), Integer32()).setMaxAccess("writeonly")
if mibBuilder.loadTexts: healthSamplingReset.setStatus('mandatory')
healthThreshDeviceRxLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceRxLimit.setStatus('mandatory')
healthThreshDeviceRxTxLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceRxTxLimit.setStatus('mandatory')
healthThreshDeviceBackplaneLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceBackplaneLimit.setStatus('mandatory')
healthThreshDeviceCamLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceCamLimit.setStatus('mandatory')
healthThreshDeviceMemoryLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceMemoryLimit.setStatus('mandatory')
healthThreshDeviceCpuLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceCpuLimit.setStatus('mandatory')
healthThreshDeviceSummary = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(27, 27)).setFixedLength(27)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshDeviceSummary.setStatus('mandatory')
healthThreshModuleSummaryTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 8), )
if mibBuilder.loadTexts: healthThreshModuleSummaryTable.setStatus('mandatory')
healthThreshModuleSummaryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 8, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "healthThreshModuleSummarySlot"))
if mibBuilder.loadTexts: healthThreshModuleSummaryEntry.setStatus('mandatory')
healthThreshModuleSummarySlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 8, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshModuleSummarySlot.setStatus('mandatory')
healthThreshModuleSummaryData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 8, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshModuleSummaryData.setStatus('mandatory')
healthThreshDevTrapData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 21)))
if mibBuilder.loadTexts: healthThreshDevTrapData.setStatus('mandatory')
healthThreshModTrapCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 10), Integer32())
if mibBuilder.loadTexts: healthThreshModTrapCount.setStatus('mandatory')
healthThreshModTrapData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128)))
if mibBuilder.loadTexts: healthThreshModTrapData.setStatus('mandatory')
healthThreshPortSummaryTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 12), )
if mibBuilder.loadTexts: healthThreshPortSummaryTable.setStatus('mandatory')
healthThreshPortSummaryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 12, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "healthThreshPortSummarySlot"), (0, "XYLAN-HEALTH-MIB", "healthThreshPortSummaryIF"))
if mibBuilder.loadTexts: healthThreshPortSummaryEntry.setStatus('mandatory')
healthThreshPortSummarySlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshPortSummarySlot.setStatus('mandatory')
healthThreshPortSummaryIF = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 12, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshPortSummaryIF.setStatus('mandatory')
healthThreshPortSummaryData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 12, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(13, 13)).setFixedLength(13)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthThreshPortSummaryData.setStatus('mandatory')
healthThreshPortTrapSlot = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 13), Integer32())
if mibBuilder.loadTexts: healthThreshPortTrapSlot.setStatus('mandatory')
healthThreshPortTrapCount = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 14), Integer32())
if mibBuilder.loadTexts: healthThreshPortTrapCount.setStatus('mandatory')
healthThreshPortTrapData = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255)))
if mibBuilder.loadTexts: healthThreshPortTrapData.setStatus('mandatory')
healthThreshDeviceVccLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceVccLimit.setStatus('mandatory')
healthThreshDeviceTemperatureLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceTemperatureLimit.setStatus('mandatory')
healthThreshDeviceVpLimit = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 6, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: healthThreshDeviceVpLimit.setStatus('mandatory')
healthPortMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(21, 21)).setFixedLength(21)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortMax.setStatus('mandatory')
class HealthPortUpDownStatus(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("healthPortDn", 1), ("healthPortUp", 2))
healthPortTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2), )
if mibBuilder.loadTexts: healthPortTable.setStatus('mandatory')
healthPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "healthPortSlot"), (0, "XYLAN-HEALTH-MIB", "healthPortIF"))
if mibBuilder.loadTexts: healthPortEntry.setStatus('mandatory')
healthPortSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortSlot.setStatus('mandatory')
healthPortIF = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortIF.setStatus('mandatory')
healthPortUpDn = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 3), HealthPortUpDownStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortUpDn.setStatus('mandatory')
healthPortRxData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortRxData.setStatus('mandatory')
healthPortRxTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortRxTimeDelta.setStatus('mandatory')
healthPortRxTxData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortRxTxData.setStatus('mandatory')
healthPortRxTxTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortRxTxTimeDelta.setStatus('mandatory')
healthPortBackplaneData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortBackplaneData.setStatus('mandatory')
healthPortBackplaneTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortBackplaneTimeDelta.setStatus('mandatory')
healthPortVccData = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortVccData.setStatus('mandatory')
healthPortVccTimeDelta = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 3, 2, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: healthPortVccTimeDelta.setStatus('mandatory')
health2DeviceRxLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRxLatest.setStatus('mandatory')
health2DeviceRx1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRx1MinAvg.setStatus('mandatory')
health2DeviceRx1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRx1HrAvg.setStatus('mandatory')
health2DeviceRx1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRx1HrMax.setStatus('mandatory')
health2DeviceRxTxLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRxTxLatest.setStatus('mandatory')
health2DeviceRxTx1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRxTx1MinAvg.setStatus('mandatory')
health2DeviceRxTx1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRxTx1HrAvg.setStatus('mandatory')
health2DeviceRxTx1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceRxTx1HrMax.setStatus('mandatory')
health2DeviceBackplaneLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceBackplaneLatest.setStatus('mandatory')
health2DeviceBackplane1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceBackplane1MinAvg.setStatus('mandatory')
health2DeviceBackplane1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceBackplane1HrAvg.setStatus('mandatory')
health2DeviceBackplane1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceBackplane1HrMax.setStatus('mandatory')
health2DeviceMpmCamLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMpmCamLatest.setStatus('mandatory')
health2DeviceMpmCam1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMpmCam1MinAvg.setStatus('mandatory')
health2DeviceMpmCam1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMpmCam1HrAvg.setStatus('mandatory')
health2DeviceMpmCam1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMpmCam1HrMax.setStatus('mandatory')
health2DeviceHreCamLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCamLatest.setStatus('mandatory')
health2DeviceHreCam1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCam1MinAvg.setStatus('mandatory')
health2DeviceHreCam1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCam1HrAvg.setStatus('mandatory')
health2DeviceHreCam1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCam1HrMax.setStatus('mandatory')
health2DeviceMemoryLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMemoryLatest.setStatus('mandatory')
health2DeviceMemory1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 22), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMemory1MinAvg.setStatus('mandatory')
health2DeviceMemory1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMemory1HrAvg.setStatus('mandatory')
health2DeviceMemory1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceMemory1HrMax.setStatus('mandatory')
health2DeviceNumCpus = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 25), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceNumCpus.setStatus('mandatory')
health2DeviceCpuTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26), )
if mibBuilder.loadTexts: health2DeviceCpuTable.setStatus('mandatory')
health2DeviceCpuEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "health2DeviceCpuNum"))
if mibBuilder.loadTexts: health2DeviceCpuEntry.setStatus('mandatory')
health2DeviceCpuNum = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceCpuNum.setStatus('mandatory')
health2DeviceCpuLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceCpuLatest.setStatus('mandatory')
health2DeviceCpu1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceCpu1MinAvg.setStatus('mandatory')
health2DeviceCpu1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceCpu1HrAvg.setStatus('mandatory')
health2DeviceCpu1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 26, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceCpu1HrMax.setStatus('mandatory')
health2DeviceVccLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVccLatest.setStatus('mandatory')
health2DeviceVcc1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 28), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVcc1MinAvg.setStatus('mandatory')
health2DeviceVcc1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVcc1HrAvg.setStatus('mandatory')
health2DeviceVcc1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVcc1HrMax.setStatus('mandatory')
health2DeviceTemperatureLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 31), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceTemperatureLatest.setStatus('mandatory')
health2DeviceTemperature1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 32), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceTemperature1MinAvg.setStatus('mandatory')
health2DeviceTemperature1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 33), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceTemperature1HrAvg.setStatus('mandatory')
health2DeviceTemperature1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceTemperature1HrMax.setStatus('mandatory')
health2DeviceVpLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 35), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVpLatest.setStatus('mandatory')
health2DeviceVp1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVp1MinAvg.setStatus('mandatory')
health2DeviceVp1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 37), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVp1HrAvg.setStatus('mandatory')
health2DeviceVp1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 38), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceVp1HrMax.setStatus('mandatory')
health2DeviceHreCollisionLatest = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 39), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCollisionLatest.setStatus('mandatory')
health2DeviceHreCollision1MinAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCollision1MinAvg.setStatus('mandatory')
health2DeviceHreCollision1HrAvg = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 41), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCollision1HrAvg.setStatus('mandatory')
health2DeviceHreCollision1HrMax = MibScalar((1, 3, 6, 1, 4, 1, 800, 2, 18, 7, 42), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2DeviceHreCollision1HrMax.setStatus('mandatory')
health2ModuleTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1), )
if mibBuilder.loadTexts: health2ModuleTable.setStatus('mandatory')
health2ModuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "health2ModuleSlot"))
if mibBuilder.loadTexts: health2ModuleEntry.setStatus('mandatory')
health2ModuleSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleSlot.setStatus('mandatory')
health2ModuleRxLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRxLatest.setStatus('mandatory')
health2ModuleRx1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRx1MinAvg.setStatus('mandatory')
health2ModuleRx1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRx1HrAvg.setStatus('mandatory')
health2ModuleRx1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRx1HrMax.setStatus('mandatory')
health2ModuleRxTxLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRxTxLatest.setStatus('mandatory')
health2ModuleRxTx1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRxTx1MinAvg.setStatus('mandatory')
health2ModuleRxTx1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRxTx1HrAvg.setStatus('mandatory')
health2ModuleRxTx1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleRxTx1HrMax.setStatus('mandatory')
health2ModuleBackplaneLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleBackplaneLatest.setStatus('mandatory')
health2ModuleBackplane1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleBackplane1MinAvg.setStatus('mandatory')
health2ModuleBackplane1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleBackplane1HrAvg.setStatus('mandatory')
health2ModuleBackplane1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleBackplane1HrMax.setStatus('mandatory')
health2ModuleCamLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleCamLatest.setStatus('mandatory')
health2ModuleCam1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleCam1MinAvg.setStatus('mandatory')
health2ModuleCam1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleCam1HrAvg.setStatus('mandatory')
health2ModuleCam1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleCam1HrMax.setStatus('mandatory')
health2ModuleVccLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleVccLatest.setStatus('mandatory')
health2ModuleVcc1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleVcc1MinAvg.setStatus('mandatory')
health2ModuleVcc1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleVcc1HrAvg.setStatus('mandatory')
health2ModuleVcc1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 8, 1, 1, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2ModuleVcc1HrMax.setStatus('mandatory')
health2PortTable = MibTable((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1), )
if mibBuilder.loadTexts: health2PortTable.setStatus('mandatory')
health2PortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1), ).setIndexNames((0, "XYLAN-HEALTH-MIB", "health2PortSlot"), (0, "XYLAN-HEALTH-MIB", "health2PortIF"))
if mibBuilder.loadTexts: health2PortEntry.setStatus('mandatory')
health2PortSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortSlot.setStatus('mandatory')
health2PortIF = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortIF.setStatus('mandatory')
health2PortRxLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRxLatest.setStatus('mandatory')
health2PortRx1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRx1MinAvg.setStatus('mandatory')
health2PortRx1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRx1HrAvg.setStatus('mandatory')
health2PortRx1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRx1HrMax.setStatus('mandatory')
health2PortRxTxLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRxTxLatest.setStatus('mandatory')
health2PortRxTx1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRxTx1MinAvg.setStatus('mandatory')
health2PortRxTx1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRxTx1HrAvg.setStatus('mandatory')
health2PortRxTx1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortRxTx1HrMax.setStatus('mandatory')
health2PortBackplaneLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortBackplaneLatest.setStatus('mandatory')
health2PortBackplane1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortBackplane1MinAvg.setStatus('mandatory')
health2PortBackplane1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortBackplane1HrAvg.setStatus('mandatory')
health2PortBackplane1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortBackplane1HrMax.setStatus('mandatory')
health2PortVccLatest = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortVccLatest.setStatus('mandatory')
health2PortVcc1MinAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortVcc1MinAvg.setStatus('mandatory')
health2PortVcc1HrAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortVcc1HrAvg.setStatus('mandatory')
health2PortVcc1HrMax = MibTableColumn((1, 3, 6, 1, 4, 1, 800, 2, 18, 9, 1, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: health2PortVcc1HrMax.setStatus('mandatory')
mibBuilder.exportSymbols("XYLAN-HEALTH-MIB", healthThreshPortSummaryIF=healthThreshPortSummaryIF, healthDeviceTemp=healthDeviceTemp, healthDeviceMpmRxOverrunCount=healthDeviceMpmRxOverrunCount, healthThreshDeviceRxLimit=healthThreshDeviceRxLimit, healthDeviceRxTxData=healthDeviceRxTxData, healthPortRxTxTimeDelta=healthPortRxTxTimeDelta, health2PortSlot=health2PortSlot, health2DeviceHreCamLatest=health2DeviceHreCamLatest, health2DeviceBackplaneLatest=health2DeviceBackplaneLatest, health2ModuleVcc1MinAvg=health2ModuleVcc1MinAvg, healthPortRxData=healthPortRxData, health2DeviceCpu1MinAvg=health2DeviceCpu1MinAvg, health2DeviceHreCam1HrMax=health2DeviceHreCam1HrMax, health2ModuleRx1HrMax=health2ModuleRx1HrMax, healthThreshModTrapCount=healthThreshModTrapCount, healthPortVccTimeDelta=healthPortVccTimeDelta, health2ModuleSlot=health2ModuleSlot, healthDeviceHreCamTotal=healthDeviceHreCamTotal, healthDeviceTemperatureTimeDelta=healthDeviceTemperatureTimeDelta, health2PortBackplaneLatest=health2PortBackplaneLatest, health2DeviceVcc1HrMax=health2DeviceVcc1HrMax, health2DeviceHreCollision1HrMax=health2DeviceHreCollision1HrMax, healthPortIF=healthPortIF, health2DeviceCpu1HrMax=health2DeviceCpu1HrMax, healthThreshDeviceBackplaneLimit=healthThreshDeviceBackplaneLimit, healthDeviceVpTimeDelta=healthDeviceVpTimeDelta, health2DeviceHreCollision1MinAvg=health2DeviceHreCollision1MinAvg, health2DeviceInfo=health2DeviceInfo, healthThreshDeviceVpLimit=healthThreshDeviceVpLimit, healthDeviceVccData=healthDeviceVccData, healthDeviceTemperatureData=healthDeviceTemperatureData, healthPortEntry=healthPortEntry, healthThreshPortSummarySlot=healthThreshPortSummarySlot, health2PortRxLatest=health2PortRxLatest, healthThreshDeviceSummary=healthThreshDeviceSummary, healthDeviceCpuTimeDelta=healthDeviceCpuTimeDelta, health2DeviceRxTx1HrAvg=health2DeviceRxTx1HrAvg, healthModuleRxData=healthModuleRxData, health2DeviceCpuNum=health2DeviceCpuNum, healthDeviceMpmCamFree=healthDeviceMpmCamFree, healthThreshDeviceMemoryLimit=healthThreshDeviceMemoryLimit, health2ModuleCam1HrMax=health2ModuleCam1HrMax, health2DeviceTemperature1HrAvg=health2DeviceTemperature1HrAvg, health2ModuleCam1MinAvg=health2ModuleCam1MinAvg, healthThreshPortTrapCount=healthThreshPortTrapCount, health2ModuleInfo=health2ModuleInfo, health2ModuleBackplaneLatest=health2ModuleBackplaneLatest, health2PortRxTxLatest=health2PortRxTxLatest, health2ModuleRx1HrAvg=health2ModuleRx1HrAvg, HealthPortUpDownStatus=HealthPortUpDownStatus, healthDeviceRxTimeDelta=healthDeviceRxTimeDelta, health2DeviceRx1MinAvg=health2DeviceRx1MinAvg, health2DeviceHreCam1MinAvg=health2DeviceHreCam1MinAvg, healthPortSlot=healthPortSlot, health2ModuleBackplane1MinAvg=health2ModuleBackplane1MinAvg, healthControlInfo=healthControlInfo, healthThreshDeviceVccLimit=healthThreshDeviceVccLimit, health2DeviceVp1HrMax=health2DeviceVp1HrMax, health2ModuleCam1HrAvg=health2ModuleCam1HrAvg, healthThreshModuleSummaryEntry=healthThreshModuleSummaryEntry, health2PortBackplane1HrAvg=health2PortBackplane1HrAvg, health2PortVcc1HrAvg=health2PortVcc1HrAvg, health2ModuleEntry=health2ModuleEntry, health2PortRx1MinAvg=health2PortRx1MinAvg, healthModuleCamConfigured=healthModuleCamConfigured, health2DeviceNumCpus=health2DeviceNumCpus, healthDeviceBackplaneTimeDelta=healthDeviceBackplaneTimeDelta, health2ModuleRxTx1HrAvg=health2ModuleRxTx1HrAvg, healthDeviceBackplaneData=healthDeviceBackplaneData, healthPortRxTxData=healthPortRxTxData, healthDeviceMemoryTimeDelta=healthDeviceMemoryTimeDelta, healthDeviceHreCamFree=healthDeviceHreCamFree, healthThreshPortSummaryEntry=healthThreshPortSummaryEntry, health2DeviceMpmCam1HrAvg=health2DeviceMpmCam1HrAvg, health2DeviceRx1HrMax=health2DeviceRx1HrMax, healthModuleInfo=healthModuleInfo, health2ModuleBackplane1HrAvg=health2ModuleBackplane1HrAvg, health2ModuleCamLatest=health2ModuleCamLatest, healthDeviceRxTxTimeDelta=healthDeviceRxTxTimeDelta, health2DeviceRxLatest=health2DeviceRxLatest, health2PortEntry=health2PortEntry, healthModuleRxTxData=healthModuleRxTxData, healthModuleVccTimeDelta=healthModuleVccTimeDelta, health2DeviceMpmCam1HrMax=health2DeviceMpmCam1HrMax, healthDeviceVccTimeDelta=healthDeviceVccTimeDelta, health2DeviceMemoryLatest=health2DeviceMemoryLatest, health2DeviceMpmCam1MinAvg=health2DeviceMpmCam1MinAvg, health2ModuleRxTx1HrMax=health2ModuleRxTx1HrMax, health2DeviceVpLatest=health2DeviceVpLatest, healthThreshDeviceCamLimit=healthThreshDeviceCamLimit, healthDeviceRxData=healthDeviceRxData, healthThreshInfo=healthThreshInfo, healthModuleVccData=healthModuleVccData, health2DeviceCpuTable=health2DeviceCpuTable, healthDeviceIPXRouteCacheFlushCount=healthDeviceIPXRouteCacheFlushCount, health2PortRx1HrMax=health2PortRx1HrMax, healthPortUpDn=healthPortUpDn, healthPortBackplaneData=healthPortBackplaneData, health2DeviceCpuEntry=health2DeviceCpuEntry, healthDeviceMemoryFree=healthDeviceMemoryFree, healthPortRxTimeDelta=healthPortRxTimeDelta, healthModuleRxTxTimeDelta=healthModuleRxTxTimeDelta, health2ModuleRxTxLatest=health2ModuleRxTxLatest, healthSamplingInterval=healthSamplingInterval, healthPortVccData=healthPortVccData, healthModuleCamData=healthModuleCamData, health2DeviceVccLatest=health2DeviceVccLatest, healthThreshDeviceCpuLimit=healthThreshDeviceCpuLimit, health2DeviceTemperature1HrMax=health2DeviceTemperature1HrMax, healthDeviceMpmTxOverrunCount=healthDeviceMpmTxOverrunCount, health2DeviceBackplane1HrAvg=health2DeviceBackplane1HrAvg, health2PortBackplane1HrMax=health2PortBackplane1HrMax, health2PortVcc1MinAvg=health2PortVcc1MinAvg, health2PortInfo=health2PortInfo, healthPortBackplaneTimeDelta=healthPortBackplaneTimeDelta, health2PortRx1HrAvg=health2PortRx1HrAvg, health2PortTable=health2PortTable, healthThreshModTrapData=healthThreshModTrapData, healthModuleCamNumInstalled=healthModuleCamNumInstalled, health2DeviceMpmCamLatest=health2DeviceMpmCamLatest, health2DeviceHreCam1HrAvg=health2DeviceHreCam1HrAvg, healthDeviceIPRouteCacheFlushCount=healthDeviceIPRouteCacheFlushCount, healthDeviceMemoryTotal=healthDeviceMemoryTotal, healthDeviceHreCollisionTotal=healthDeviceHreCollisionTotal, healthModuleBackplaneTimeDelta=healthModuleBackplaneTimeDelta, healthPortMax=healthPortMax, health2ModuleVcc1HrMax=health2ModuleVcc1HrMax, health2ModuleBackplane1HrMax=health2ModuleBackplane1HrMax, health2PortBackplane1MinAvg=health2PortBackplane1MinAvg, health2DeviceTemperature1MinAvg=health2DeviceTemperature1MinAvg, health2DeviceVcc1MinAvg=health2DeviceVcc1MinAvg, healthThreshModuleSummaryData=healthThreshModuleSummaryData, healthThreshModuleSummarySlot=healthThreshModuleSummarySlot, health2ModuleRxTx1MinAvg=health2ModuleRxTx1MinAvg, health2DeviceBackplane1HrMax=health2DeviceBackplane1HrMax, healthDeviceNumCpus=healthDeviceNumCpus, healthDeviceInfo=healthDeviceInfo, healthDeviceMemoryData=healthDeviceMemoryData, health2DeviceHreCollision1HrAvg=health2DeviceHreCollision1HrAvg, healthModuleCamFree=healthModuleCamFree, healthModuleRxTimeDelta=healthModuleRxTimeDelta, healthDeviceHreCollisionFree=healthDeviceHreCollisionFree, healthModuleTable=healthModuleTable, healthPortInfo=healthPortInfo, healthThreshPortSummaryData=healthThreshPortSummaryData, health2DeviceBackplane1MinAvg=health2DeviceBackplane1MinAvg, healthThreshPortTrapData=healthThreshPortTrapData, health2PortVccLatest=health2PortVccLatest, healthThreshModuleSummaryTable=healthThreshModuleSummaryTable, healthThreshPortTrapSlot=healthThreshPortTrapSlot, healthGroupInfo=healthGroupInfo, health2PortRxTx1MinAvg=health2PortRxTx1MinAvg, healthModuleBackplaneData=healthModuleBackplaneData, health2DeviceTemperatureLatest=health2DeviceTemperatureLatest, healthModuleCamAvailNonIntern=healthModuleCamAvailNonIntern, healthSamplingReset=healthSamplingReset, health2PortIF=health2PortIF, health2PortVcc1HrMax=health2PortVcc1HrMax, health2DeviceVp1MinAvg=health2DeviceVp1MinAvg, healthDeviceVpData=healthDeviceVpData, health2DeviceMemory1HrMax=health2DeviceMemory1HrMax, health2DeviceCpu1HrAvg=health2DeviceCpu1HrAvg, healthModuleCamTimeDelta=healthModuleCamTimeDelta, health2DeviceCpuLatest=health2DeviceCpuLatest, health2DeviceHreCollisionLatest=health2DeviceHreCollisionLatest, healthDeviceMpmCamTotal=healthDeviceMpmCamTotal, health2ModuleRx1MinAvg=health2ModuleRx1MinAvg, healthDeviceCamData=healthDeviceCamData, health2DeviceVp1HrAvg=health2DeviceVp1HrAvg, healthModuleEntry=healthModuleEntry, healthPortTable=healthPortTable, health2DeviceRxTx1MinAvg=health2DeviceRxTx1MinAvg, health2ModuleVcc1HrAvg=health2ModuleVcc1HrAvg, healthDeviceCpuData=healthDeviceCpuData, health2DeviceVcc1HrAvg=health2DeviceVcc1HrAvg, health2PortRxTx1HrAvg=health2PortRxTx1HrAvg, health2DeviceRx1HrAvg=health2DeviceRx1HrAvg, healthThreshDeviceTemperatureLimit=healthThreshDeviceTemperatureLimit, health2ModuleVccLatest=health2ModuleVccLatest, healthModuleCamAvail=healthModuleCamAvail, health2DeviceMemory1MinAvg=health2DeviceMemory1MinAvg, healthThreshDeviceRxTxLimit=healthThreshDeviceRxTxLimit, health2DeviceMemory1HrAvg=health2DeviceMemory1HrAvg, health2PortRxTx1HrMax=health2PortRxTx1HrMax, healthThreshDevTrapData=healthThreshDevTrapData, healthDeviceCamTimeDelta=healthDeviceCamTimeDelta, health2DeviceRxTxLatest=health2DeviceRxTxLatest, health2DeviceRxTx1HrMax=health2DeviceRxTx1HrMax, health2ModuleRxLatest=health2ModuleRxLatest, health2ModuleTable=health2ModuleTable, healthThreshPortSummaryTable=healthThreshPortSummaryTable, healthModuleSlot=healthModuleSlot)
|
# parrot = "Norwegian Blue"
#
# for character in parrot:
# print(character)
number = '9,223;372:036 854,775;807'
seperators = ""
for char in number:
if not char.isnumeric():
seperators = seperators + char
print(seperators)
things = ["bed", "computer", "red", "desk"]
space = ""
for i in things:
if not "ed" in i:
space = space + i + " "
print(space)
print()
quote = """Alright, but apart from the Sanitation, the Medicine, Education, Wine,
Public Order, Irrigation, Roads, the Fresh-Water System,
and Public Health, what have the Romans ever done for us?"""
capitals = ""
for i in quote:
if i.isupper():
capitals = capitals + i
print(capitals)
upperCase = ""
for i in quote:
if i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
upperCase = upperCase + i
print(upperCase)
|
""" Settings for running tests. """
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = '8ij$(7l2!w0f8kggntbv=+$bd=^2xs$cl+3v^_##qjw@2py9_3'
INSTALLED_APPS = ('django.contrib.admin', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.staticfiles',
'django_zip_stream', 'django_nose')
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', )
# Use nose to run all tests
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--with-coverage',
'--cover-package=django_zip_stream',
'--cover-branches',
'--cover-erase',
]
|
expected_output = {
'vll': {
'MY-UNTAGGED-VLL': {
'vcid': 3566,
'vll_index': 37,
'local': {
'type': 'untagged',
'interface': 'ethernet2/8',
'state': 'Up',
'mct_state': 'None',
'ifl_id': '--',
'vc_type': 'tag',
'mtu': 9190,
'cos': '--',
'extended_counters': True
},
'peer': {
'ip': '192.168.1.2',
'state': 'UP',
'vc_type': 'tag',
'mtu': 9190,
'local_label': 851974,
'remote_label': 852059,
'local_group_id': 0,
'remote_group_id': 0,
'tunnel_lsp': {
'name': 'my_untagged-lsp',
'tunnel_interface': 'tnl32'
},
'lsps_assigned': 'No LSPs assigned'
}
}
}
}
|
#
# @lc app=leetcode id=72 lang=python3
#
# [72] Edit Distance
#
# https://leetcode.com/problems/edit-distance/description/
#
# algorithms
# Hard (40.50%)
# Likes: 2795
# Dislikes: 44
# Total Accepted: 213.4K
# Total Submissions: 526.3K
# Testcase Example: '"horse"\n"ros"'
#
# Given two words word1 and word2, find the minimum number of operations
# required to convert word1 to word2.
#
# You have the following 3 operations permitted on a word:
#
#
# Insert a character
# Delete a character
# Replace a character
#
#
# Example 1:
#
#
# Input: word1 = "horse", word2 = "ros"
# Output: 3
# Explanation:
# horse -> rorse (replace 'h' with 'r')
# rorse -> rose (remove 'r')
# rose -> ros (remove 'e')
#
#
# Example 2:
#
#
# Input: word1 = "intention", word2 = "execution"
# Output: 5
# Explanation:
# intention -> inention (remove 't')
# inention -> enention (replace 'i' with 'e')
# enention -> exention (replace 'n' with 'x')
# exention -> exection (replace 'n' with 'c')
# exection -> execution (insert 'u')
#
#
#
# @lc code=start
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
return self.dp_bottom_up(word1, word2)
def dp_bottom_up(self, word1: str, word2: str) -> int:
"""
dp bottom up solution
"""
memo = [[0] * (len(word2) + 1) for _ in range(len(word1) + 1)]
for i in range(len(word1) + 1):
memo[i][0] = i
for j in range(len(word2) + 1):
memo[0][j] = j
for i in range(1, len(word1) + 1):
for j in range(1, len(word2) + 1):
if word1[i - 1] == word2[j - 1]:
memo[i][j] = memo[i - 1][j - 1]
else:
memo[i][j] = 1 + min(memo[i - 1][j],
memo[i][j - 1],
memo[i - 1][j - 1])
return memo[-1][-1]
def dp_memoize(self, word1: str, word2: str) -> int:
"""
dp memoized solution
"""
memo = [[None] * len(word2) for _ in range(len(word1))]
def helper(i: int, j: int) -> int:
if i >= len(word1) and j >= len(word2):
return 0
if i >= len(word1) or j >= len(word2):
return max(len(word1) - i, len(word2) - j)
if word1[i:] == word2[j:]:
return 0
if memo[i][j] is None:
if word1[i] == word2[j]:
return helper(i + 1, j + 1)
insert = helper(i + 1, j)
remove = helper(i, j + 1)
replace = helper(i + 1, j + 1)
res = 1 + min(insert, remove, replace)
memo[i][j] = res
return memo[i][j]
return helper(0, 0)
def dp_recursive(self, word1: str, word2: str) -> int:
"""
DP recursive Solution
Let P(word1, word2) := min number of moves to match word 1 and word 2
P(word1, word2) =
1. 0 if word1 == word2
2. 1 + min(A, B, C)
where A = insert a char, B = remove a char, C = replace a char
"""
def helper(word1: str, word2: str) -> int:
if word1 == word2:
return 0
if word1 == "" or word2 == "":
return max(len(word1), len(word2))
if word1[0] == word2[0]:
return helper(word1[1:], word2[1:])
insert = helper(word1[1:], word2)
remove = helper(word1, word2[1:])
replace = helper(word1[1:], word2[1:])
return 1 + min(insert, remove, replace)
return helper(word1, word2)
# @lc code=end
if __name__ == "__main__":
print(Solution().minDistance("horse", "ros"), 3)
|
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
ans = 0
# 再帰で書くと遅い
# def bin_search(li_sorted, val):
# global ans
# m = len(li_sorted)
# l = int(m / 2)
# if val == li_sorted[l]:
# ans += 1
# elif m > 1:
# li_left = li_sorted[:l]
# li_right = li_sorted[l:]
# bin_search(li_left, val)
# bin_search(li_right, val)
# for i in range(q):
# bin_search(S, T[i])
for i in range(q):
val = T[i]
left = 0
right = n
while left < right:
mid = (left + right)//2
if S[mid] == val:
ans += 1
break
elif S[mid] < val:
left = mid + 1
else:
right = mid
print(ans)
|
"""
Reverse Words in a String III
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Note: In the string, each word is separated by single space and there will not be any extra space in the string.
"""
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
if not s:
return s
words=s.split()
reversed_words=[word[::-1] for word in words]
return ' '.join(reversed_words)
# s = s[::-1]
#return " ".join(s.split(" ")[::-1]) |
class User:
def __init__(self, id = None, email = None, name = None, surname = None, password = None, wallet = 0.00, disability = False, active_account = False, id_user_category = 2): # id_user_category = 2 -> Student
self._id = id
self._email = email
self._name = name
self._surname = surname
self._password = password
self._wallet = wallet
self._disability = disability
self._active_account = active_account
self._id_user_category = id_user_category
def set_id(self, id):
self._id = id
# def set_email(self, email):
# self._email = email
# def set_name(self, name):
# self._name = name
# def set_surname(self, surname):
# self._surname = surname
def set_password(self, password):
self._password = password
def set_wallet(self, wallet):
self._wallet = wallet
def set_disability(self, disability):
self._disability = disability
def set_active_account(self, active_account):
self._active_account = active_account
# def set_id_user_category(self, id_user_category):
# self._id_user_category = id_user_category
def get_id(self):
return self._id
def get_email(self):
return self._email
def get_name(self):
return self._name
def get_surname(self):
return self._surname
def get_password(self):
return self._password
def get_wallet(self):
return self._wallet
def get_disability(self):
return self._disability
def get_active_account(self):
return self._active_account
def get_id_user_category(self):
return self._id_user_category
def __eq__(self, other):
if isinstance(other, User):
return self._id == other._id
return NotImplemented
def __str__(self):
user_info = (f"User Id: {self._id}, email: {self._email}, name: {self._name}, surname: {self._surname}, "
f"password: {self._password}, wallet: {self._wallet}, disability: {self._disability}, active accont: {self._active_account}, "
f"id_user_category: {self._id_user_category}")
return user_info
|
n1=int(input('primerio número: '))
n2=int(input('segundo número: '))
if n1 > n2:
print('o primeiro é maior.')
elif n2 > n1:
print('o segundo é maior.')
else:
print('os dois são iguais.')
|
# 487. Max Consecutive Ones II
# Runtime: 420 ms, faster than 12.98% of Python3 online submissions for Max Consecutive Ones II.
# Memory Usage: 14.5 MB, less than 11.06% of Python3 online submissions for Max Consecutive Ones II.
class Solution:
_FLIP_COUNT = 1
# Sliding Window
def findMaxConsecutiveOnes(self, nums: list[int]) -> int:
assert Solution._FLIP_COUNT > 0
max_count = 0
left = 0
zero_idx = []
for right in range(len(nums)):
if nums[right] == 0:
zero_idx.append(right)
if len(zero_idx) > Solution._FLIP_COUNT:
left = zero_idx[0] + 1
del zero_idx[0]
max_count = max(max_count, right - left + 1)
return max_count |
# -*- coding:utf-8 -*-
# ---------------------------------------------
# @file options
# @description options
# @author WcJun
# @date 2021/08/02
# ---------------------------------------------
class RequestOptions(object):
def __init__(self, url, method='post',
body=None, parameters=None, headers=None, ssl=False, mock_enabled=False, mock_response=None):
"""
get-post-put-patch-delete
:param url:
:param method:
"""
self.url = url
self.method = method
self.body = body
self.headers = headers
self.parameters = parameters
self.ssl = ssl
self.mock = False
self.mock_enabled = mock_enabled
self.mock_response = mock_response
|
def simple_separator():
print('**********')
return simple_separator
simple_separator()
print('Привет всем!')
def long_separator(count):
print('*' * count)
return long_separator
long_separator(10)
def long_separator(simbol, count):
print(simbol * count)
return long_separator
long_separator('$', 10)
print('Привет всем!')
long_separator('$', 10)
def simple_separator_2():
print('##########')
return simple_separator_2
def hello_world():
print('*************')
print('')
print('Hello World!')
print('')
print('###############')
return hello_world
hello_world()
def hello_who(name):
if name is None:
name = 'World'
print('*************')
print('')
print('Hello', name)
print('')
print('###############')
print(hello_who('Max'))
def pow_many(power, *args):
result = sum(args) ** power
return result
print(pow_many(2, 1, 2, 3, 4))
def print_key_val(**kwargs):
for k, v in kwargs.items():
print(k, '->', v)
print(print_key_val(name='Max', age=21))
# numbers = input('Введите последовательность чисел: ')
def my_filter(iterable, function):
result = []
for item in iterable:
if function(item):
result.append(item)
return result
print(my_filter([1, 2, 3, 4, 5], lambda x: x > 3) == [4, 5]) # True , почему выдает False?
print(my_filter([1, 2, 3, 4, 5], lambda x: x == 2) == [2]) # True
print(my_filter([1, 2, 3, 4, 5], lambda x: x != 3) == [1, 2, 4, 5]) # True почему выдает False?
print(my_filter(['a', 'b', 'c', 'd'], lambda x: x in 'abba') == ['a', 'b']) # True почему выдает False?
|
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
ans = []
for i in range(2):
dx, dy = -dy, dx
x2 += dx
y2 += dy
ans.append(x2)
ans.append(y2)
print(*ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.