content stringlengths 7 1.05M |
|---|
""" ______ __
____ ____/ / __/ ____ ____ ____ ___ _________ _/ /_____ _____
/ __ \/ __ / /_ / __ `/ _ \/ __ \/ _ \/ ___/ __ `/ __/ __ \/ ___/
/ /_/ / /_/ / __/ / /_/ / __/ / / / __/ / / /_/ / /_/ /_/ / /
/ .___/\__,_/_/_____\__, /\___/_/ /_/\___/_/ \__,_/\__/\____/_/
/_/ /_____/____/
"""
__title__ = 'PDF Generator'
__version__ = '0.1.3'
__author__ = 'Charles TISSIER'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 Charles TISSIER'
# Version synonym
VERSION = __version__
default_app_config = 'pdf_generator.apps.PdfGeneratorConfig' |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def getMinimumDifference(self, root: TreeNode) -> int:
def dfs(root):
if not root:
return
dfs(root.left)
nums.append(root.val)
dfs(root.right)
nums = []
dfs(root)
res = float('inf')
for i in range(1, len(nums)):
res = min(res, nums[i] - nums[i - 1])
return res
|
# -*- coding: utf-8 -*-
__author__ = 'Andile Jaden Mbele'
__email__ = 'andilembele020@gmail.com'
__github__ = 'https://github.com/xeroxzen/genuine-fake'
__package__ = 'genuine-fake'
__version__ = '1.2.20'
|
"""
You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable.
You are also given some queries, where queries[j] = [Cj, Dj] represents the jth query where you must find the answer for Cj / Dj = ?.
Return the answers to all queries. If a single answer cannot be determined, return -1.0.
Note: The input is always valid. You may assume that evaluating the queries will not result in division by zero and that there is no contradiction.
Example 1:
Input: equations = [["a","b"],["b","c"]], values = [2.0,3.0], queries = [["a","c"],["b","a"],["a","e"],["a","a"],["x","x"]]
Output: [6.00000,0.50000,-1.00000,1.00000,-1.00000]
Explanation:
Given: a / b = 2.0, b / c = 3.0
queries are: a / c = ?, b / a = ?, a / e = ?, a / a = ?, x / x = ?
return: [6.0, 0.5, -1.0, 1.0, -1.0 ]
Example 2:
Input: equations = [["a","b"],["b","c"],["bc","cd"]], values = [1.5,2.5,5.0], queries = [["a","c"],["c","b"],["bc","cd"],["cd","bc"]]
Output: [3.75000,0.40000,5.00000,0.20000]
Example 3:
Input: equations = [["a","b"]], values = [0.5], queries = [["a","b"],["b","a"],["a","c"],["x","y"]]
Output: [0.50000,2.00000,-1.00000,-1.00000]
Constraints:
1 <= equations.length <= 20
equations[i].length == 2
1 <= Ai.length, Bi.length <= 5
values.length == equations.length
0.0 < values[i] <= 20.0
1 <= queries.length <= 20
queries[i].length == 2
1 <= Cj.length, Dj.length <= 5
Ai, Bi, Cj, Dj consist of lower case English letters and digits.
"""
class Solution:
def calcEquation(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]:
def search_for_div(n1, n2, neighbors):
if n1 not in neighbors:
return -1.0
stack = [(n1, 1.0)]
visited = set()
while stack:
curr, val = stack.pop()
if curr in visited:
continue
visited.add(curr)
if curr != n1:
neighbors[n1][curr] = val
if curr == n2:
return val
for ne, val2 in neighbors.get(curr, {}).items():
if ne in visited:
continue
stack.append((ne, val * val2))
return -1.0
neighbors = {}
for (n1, n2), res in zip(equations, values):
if n1 not in neighbors:
neighbors[n1] = {}
if n2 not in neighbors:
neighbors[n2] = {}
neighbors[n1][n2] = res
if res != 0.0:
neighbors[n2][n1] = 1 / res
ret = []
for n1, n2 in queries:
if neighbors.get(n1, {}).get(n2) is not None:
ret.append(neighbors[n1][n2])
continue
ret.append(search_for_div(n1, n2, neighbors))
return ret |
def b2d(number):
decimal_number = 0
i = 0
while number > 0:
decimal_number += number % 10*(2**i)
number = int(number / 10)
i += 1
return decimal_number
def d2b(number):
binary_number = 0
i = 0
while number > 0:
binary_number += number % 2*(10**i)
number = int(number / 2)
i += 1
return binary_number
if __name__ == '__main__':
choice = ''
while not (choice == '1' or choice == '2'):
choice = input("1 - decimal to binary\n2 - binary to decimal\nEnter your choice : ")
if choice == '1':
decimal_number = int(input('Enter a decimal number: '))
print(f'your binary conversion is {d2b(decimal_number)}')
elif choice == '2':
binary_number = int(input('Enter a binary number: '))
print(f'your deciml conversion is {b2d(binary_number)}')
else:
print('Enter a valid choice.')
|
'''
06 - Treating duplicates
In the last exercise, you were able to verify that the new update
feeding into ride_sharing contains a bug generating both complete
and incomplete duplicated rows for some values of the ride_id column,
with occasional discrepant values for the user_birth_year and duration
columns.
In this exercise, you will be treating those duplicated rows by first
dropping complete duplicates, and then merging the incomplete duplicate
rows into one while keeping the average duration, and the minimum
user_birth_year for each set of incomplete duplicate rows.
Instructions
- Drop complete duplicates in ride_sharing and store the results in ride_dup.
- Create the statistics dictionary which holds minimum aggregation for
user_birth_year and mean aggregation for duration.
- Drop incomplete duplicates by grouping by ride_id and applying the aggregation
in statistics.
- Find duplicates again and run the assert statement to verify de-duplication.
'''
# Drop complete duplicates from ride_sharing
ride_dup = ride_sharing.drop_duplicates()
# Create statistics dictionary for aggregation function
statistics = {'user_birth_year': 'min', 'duration': 'mean'}
# Group by ride_id and compute new statistics
ride_unique = ride_dup.groupby('ride_id').agg(statistics).reset_index()
# Find duplicated values again
duplicates = ride_unique.duplicated(subset='ride_id', keep=False)
duplicated_rides = ride_unique[duplicates == True]
# Assert duplicates are processed
assert duplicated_rides.shape[0] == 0
|
{
"name": """Website login background""",
"summary": """Random background image to your taste at the website login page""",
"category": "Website",
"images": ["images/5.png"],
"version": "14.0.1.0.3",
"author": "IT-Projects LLC",
"support": "help@itpp.dev",
"website": "https://twitter.com/OdooFree",
"license": "Other OSI approved licence", # MIT
"depends": ["web_login_background", "website"],
"external_dependencies": {"python": [], "bin": []},
"data": ["templates.xml"],
"demo": ["demo/demo.xml"],
"installable": True,
"auto_install": True,
}
|
"""
This file will host global variables of config strings for the sims.
We will only be varying one or two parameters, but we will need to write several copies of the all the parameters we
have to specify. I believe this is the easiest way to do that.
"""
# NOTE with the class python wrapper this one is not necessary.
class_config = """
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
* CLASS input parameter file *
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
> This example of input file does not include all CLASS possibilities, but only the most useful ones for running in the basic LambdaCDM framework. For all possibilities, look at the longer 'explanatory.ini' file.
> You can use an even more concise version, in which only the arguments in which you are interested would appear.
> Only lines containing an equal sign not preceded by a sharp sign "#" are considered by the code. Hence, do not write an equal sign within a comment, the whole line would be interpreted as relevant input.
> Input files must have an extension ".ini".
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
* UATU notes *
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
> This has been copied from the lcdm.ini file in class. It will replace the values of Omega_c, A_s, and input/output
> locations for use with Uatu mPk's. All others will be left as defaults.
----------------------------
----> background parameters:
----------------------------
1) Hubble parameter : either 'H0' in km/s/Mpc or 'h' (default: 'h' set to 0.704)
#H0 = 72.
h =0.7
2) photon density: either 'T_cmb' in K or 'Omega_g' or 'omega_g' (default: 'T_cmb' set to 2.726)
T_cmb = 2.726
#Omega_g = 5.050601e-05
#omega_g = 2.47479449e-5
3) baryon density: either 'Omega_b' or 'omega_b' (default: 'omega_b' set to 0.02253)
Omega_b = 0.022
#omega_b = 0.0266691
4) ultra-relativistic species / massless neutrino density: either 'N_eff' or 'Omega_ur' or 'omega_ur' (default: 'N_eff' set to 3.04)
N_eff = 3.04
#Omega_ur = 3.4869665e-05
#omega_ur = 1.70861334e-5
5) density of cdm (cold dark matter): 'Omega_cdm' or 'omega_cdm' (default: 'omega_cdm' set to 0.1122)
Omega_cdm = {ocdm:f}
#omega_cdm = 0.110616
6) cosmological constant / fluid with constant w and sound speed (can be used to model simple dark energy models): enter one parameter out of 'Omega_Lambda' or 'Omega_fld', the other one is inferred by the code in such way that (sum_i Omega_i) equals (1 + Omega_k) (default: 'Omega_fld' set to 0 and 'Omega_Lambda' to (1+Omega_k-Omega_tot))
# Omega_Lambda = 0.7
Omega_fld = 0
7) equation of state parameter (p/rho equal to w0+wa(1-a0/a) ) and sound speed of the fluid (this is the sound speed defined in the frame comoving with the fluid, i.e. obeying to the most sensible physical definition)
w0_fld = -1.0
#w0_fld = -0.9
wa_fld = 0.
cs2_fld = 1
--------------------------------
----> thermodynamics parameters:
--------------------------------
1) primordial Helium fraction 'YHe' (default: set to 0.25)
YHe = 0.25
2) enter one of 'z_reio' or 'tau_reio' (default: 'z_reio' set to 10.3)
z_reio = 10.
#tau_reio = 0.084522
----------------------------------------------------
----> define which perturbations should be computed:
----------------------------------------------------
1) list of output spectra requested ('tCl' for temperature Cls, 'pCl' for polarization CLs, 'lCl' for lensing potential Cls, , 'dCl' for matter density Cls, 'mPk' for total matter power spectrum P(k) infered from gravitational potential, 'mTk' for matter transfer functions for of each species). Can be attached or separated by arbitrary characters. Given this list, all non-zero auto-correlation and cross-correlation spectra will be automatically computed. Can be left blank if you do not want to evolve cosmological perturbations at all. (default: set to blanck, no perturbation calculation)
#output = tCl,pCl,lCl
#output = tCl,pCl,lCl,mPk
output = mPk
2) relevant only if you ask for scalars, temperature or polarisation Cls, and 'lCl': if you want the spectrum of lensed Cls, enter a word containing the letter 'y' or 'Y' (default: no lensed Cls)
lensing = no
---------------------------------------------
----> define primordial perturbation spectra:
---------------------------------------------
1) pivot scale in Mpc-1 (default: set to 0.002)
k_pivot = 0.05
2) scalar adiabatic perturbations: curvature power spectrum value at pivot scale, tilt at the same scale, and tilt running (default: set 'A_s' to 2.42e-9, 'n_s' to 0.967, 'alpha_s' to 0)
A_s = {A_s:f}
n_s = 0.96
alpha_s = 0.
-------------------------------------
----> define format of final spectra:
-------------------------------------
1) maximum l 'l_max_scalars', 'l_max_tensors' in Cls for scalars/tensors (default: set 'l_max_scalars' to 2500, 'l_max_tensors' to 500)
l_max_scalars = 3000
l_max_tensors = 500
2) maximum k in P(k), 'P_k_max_h/Mpc' in units of h/Mpc or 'P_k_max_1/Mpc' in units of 1/Mpc. If scalar Cls are also requested, a minimum value is automatically imposed (the same as in scalar Cls computation) (default: set to 0.1h/Mpc)
P_k_max_h/Mpc = 10.
#P_k_max_1/Mpc = 0.7
3) value(s) 'z_pk' of redshift(s) for P(k,z) output file(s); can be ordered arbitrarily, but must be separated by comas (default: set 'z_pk' to 0)
z_pk = 20.
#z_pk = 0., 1.2, 3.5
4) if you need Cls for the matter density autocorrelation or cross density-temperature correlation (option 'dCl'), enter here a description of the selection functions W(z) of each redshift bin; selection can be set to 'gaussian', then pass a list of N mean redshifts in growing order separated by comas, and finally 1 or N widths separated by comas (default: set to 'gaussian',1,0.1)
selection=gaussian
selection_mean = 1.
selection_width = 0.5
5) file name root 'root' for all output files (default: set 'root' to 'output/') (if Cl requested, written to '<root>cl.dat'; if P(k) requested, written to '<root>pk.dat'; plus similar files for scalars, tensors, pairs of initial conditions, etc.; if file with input parameters requested, written to '<root>parameters.ini')
root = {output_root}
6) do you want headers at the beginning of each output file (giving precisions on the output units/ format) ? If 'headers' set to something containing the letter 'y' or 'Y', headers written, otherwise not written (default: written)
headers = no
7) in all output files, do you want columns to be normalized and ordered with the default CLASS definitions or with the CAMB definitions (often idential to the CMBFAST one) ? Set 'format' to either 'class', 'CLASS', 'camb' or 'CAMB' (default: 'class')
format = camb
8) if 'bessel file' set to something containing the letters 'y' or 'Y', the code tries to read bessel functions in a file; if the file is absent or not adequate, bessel functions are computed and written in a file. The file name is set by defaut to 'bessels.dat' but can be changed together with precision parameters: just set 'bessel_file_name' to '<name>' either here or in the precision parameter file. (defaut: 'bessel file' set to 'no' and bessel functions are always recomputed)
bessel file = no
9) Do you want to have all input/precision parameters which have been read written in file '<root>parameters.ini', and those not written in file '<root>unused_parameters' ? If 'write parameters' set to something containing the letter 'y' or 'Y', file written, otherwise not written (default: not written)
write parameters = yeap
----------------------------------------------------
----> amount of information sent to standard output:
----------------------------------------------------
Increase integer values to make each module more talkative (default: all set to 0)
background_verbose = 1
thermodynamics_verbose = 0
perturbations_verbose = 1
bessels_verbose = 0
transfer_verbose = 0
primordial_verbose = 1
spectra_verbose = 0
nonlinear_verbose = 1
lensing_verbose = 0
output_verbose = 1
"""
# TODO have to fix the baryon numbers, they're wrong!!!
picola_config = """
% =============================== %
% This is the run parameters file %
% =============================== %
% Simulation outputs
% ==================
OutputDir {outputdir} % Directory for output.
FileBase {file_base} % Base-filename of output files (appropriate additions are appended on at runtime)
OutputRedshiftFile {outputdir}/output_redshifts.dat % The file containing the redshifts that we want snapshots for
NumFilesWrittenInParallel 4 % limits the number of files that are written in parallel when outputting.
% Simulation Specifications
% =========================
UseCOLA 1 % Whether or not to use the COLA method (1=true, 0=false).
Buffer 1.3 % The amount of extra memory to reserve for particles moving between tasks during runtime.
Nmesh 512 % This is the size of the FFT grid used to compute the displacement field and gravitational forces.
Nsample 512 % This sets the total number of particles in the simulation, such that Ntot = Nsample^3.
Box 512.0 % The Periodic box size of simulation.
Init_Redshift 20.0 % The redshift to begin timestepping from (redshift = 9 works well for COLA)
Seed {seed} % Seed for IC-generator
SphereMode 0 % If "1" only modes with |k| < k_Nyquist are used to generate initial conditions (i.e. a sphere in k-space),
% otherwise modes with |k_x|,|k_y|,|k_z| < k_Nyquist are used (i.e. a cube in k-space).
WhichSpectrum 1 % "0" - Use transfer function, not power spectrum
% "1" - Use a tabulated power spectrum in the file 'FileWithInputSpectrum'
% otherwise, Eisenstein and Hu (1998) parametrization is used
% Non-Gaussian case requires "0" and that we use the transfer function
WhichTransfer 0 % "0" - Use power spectrum, not transfer function
% "1" - Use a tabulated transfer function in the file 'FileWithInputTransfer'
% otherwise, Eisenstein and Hu (1998) parameterization used
% For Non-Gaussian models this is required (rather than the power spectrum)
FileWithInputSpectrum {outputdir}/class_pk.dat % filename of tabulated input spectrum (if used)
% expecting k and Pk
FileWithInputTransfer /home/users/swmclau2/picola/l-picola/files/input_transfer.dat % filename of tabulated transfer function (if used)
% expecting k and T (unnormalized)
% Cosmological Parameters
% =======================
Omega {ocdm:.2f} % Total matter density (CDM + Baryons at z=0).
OmegaBaryon {ob:.2f} % Baryon density (at z=0).
OmegaLambda {olambda:.2f} % Dark Energy density (at z=0)
HubbleParam 0.7 % Hubble parameter, 'little h' (only used for power spectrum parameterization).
Sigma8 {sigma8:.2f} % Power spectrum normalization (power spectrum may already be normalized correctly).
PrimordialIndex 0.96 % Used to tilt the power spectrum for non-tabulated power spectra (if != 1.0 and nongaussian, generic flag required)
% Timestepping Options
% ====================
StepDist 0 % The timestep spacing (0 for linear in a, 1 for logarithmic in a)
DeltaA 0 % The type of timestepping: "0" - Use modified COLA timestepping for Kick and Drift. Please choose a value for nLPT.
% The type of timestepping: "1" - Use modified COLA timestepping for Kick and standard Quinn timestepping for Drift. Please choose a value for nLPT.
% The type of timestepping: "2" - Use standard Quinn timestepping for Kick and Drift
% The type of timestepping: "3" - Use non-integral timestepping for Kick and Drift
nLPT -2.5 % The value of nLPT to use for modified COLA timestepping
% Units
% =====
UnitLength_in_cm 3.085678e24 % defines length unit of output (in cm/h)
UnitMass_in_g 1.989e43 % defines mass unit of output (in g/h)
UnitVelocity_in_cm_per_s 1e5 % defines velocity unit of output (in cm/sec)
InputSpectrum_UnitLength_in_cm 3.085678e24 % defines length unit of tabulated input spectrum in cm/h.
% Note: This can be chosen different from UnitLength_in_cm
% ================================================== %
% Optional extras (must comment out if not required) %
% ================================================== %
% Non-Gaussianity
% ===============
%Fnl -400 % The value of Fnl.
%Fnl_Redshift 49.0 % The redshift to apply the nongaussian potential
%FileWithInputKernel /files/input_kernel_ortog.txt % the input kernel for generic non-gaussianity (only needed for GENERIC_FNL)
% Lightcone simulations
% =====================
Origin_x 0.0 % The position of the lightcone origin in the x-axis
Origin_y 0.0 % The position of the lightcone origin in the y-axis
Origin_z 0.0 % The position of the lightcone origin in the z-axis
Nrep_neg_x 0 % The maximum number of box replicates in the negative x-direction
Nrep_pos_x 0 % The maximum number of box replicates in the positive x-direction
Nrep_neg_y 0 % The maximum number of box replicates in the negative y-direction
Nrep_pos_y 0 % The maximum number of box replicates in the positive y-direction
Nrep_neg_z 0 % The maximum number of box replicates in the negative z-direction
Nrep_pos_z 0 % The maximum number of box replicates in the positive z-direction
"""
|
""" impyute.util.errors """
class BadInputError(Exception):
"Error thrown when input args don't match spec"
pass
|
print("Welcome to RollerCoaster")
height = int(input("Enter your height in cm : "))
bill = 0
# Comparison operators are used more > , <= , == , > , >= , !=
if height >= 120 :
print("You can ride the RollerCoaster")
age = int(input("Enter your age : "))
if age < 12 :
bill = 5
print("Childeren tickets are $5")
elif age <= 18 :
bill = 7
print("youth tickets are $7")
elif age >= 45 and age <=55 :
bill = 0
print("Have a free ride")
else :
bill = 12
print("Adult tickets are $12")
photo = input("Do you want photo (y or n) : ")
if photo == 'y' :
bill += 3
print(f"your total bill : {bill}")
else :
print("Sorry, you have to grow taller before you can ride")
|
class Revoked(Exception):
pass
class MintingNotAllowed(Exception):
pass
|
class Time:
def __init__(self):
self.hours=0
self.minutes=0
self.seconds=0
def input_values(self):
self.hours=int(input('Enter the hours: '))
self.minutes=int(input('Enter the minutes: '))
self.seconds=int(input('Enter the seconds: '))
def print_details(self):
print(self.hours,':',self.minutes,':',self.seconds)
def __add__(self,other):
t=Time()
t.seconds=self.seconds+other.seconds
t.minutes=self.minutes+other.minutes+t.seconds//60
t.seconds=t.seconds%60
t.hours=self.hours+other.hours+t.minutes//60
t.minutes=t.minutes%60
t.hours=t.hours%24
t.print_details()
return t
def __sub__(self,other):
t=Time()
t.hours=self.hours-other.hours
t.minutes=self.minutes-other.minutes
if(t.minutes<0):
t.minutes=t.minutes+60
t.hours=t.hours-1
t.seconds=self.seconds-other.seconds
if(t.seconds<0):
t.seconds=t.seconds+60
t.minutes=t.minutes-1
t.print_details()
return t
t1=Time()
print('Enter the time 1')
t1.input_values()
t1.print_details()
t2=Time()
print('Enter the time 2')
t2.input_values()
t2.print_details()
print('Added time')
t3=t1+t2
print('Subtracted time')
t3=t1-t2
|
#!/usr/bin/env python
# encoding: utf-8
"""
__init__.py
Creating models for testing. See ticket for more detail.
http://code.djangoproject.com/ticket/7835
"""
|
#!/usr/bin/python
# -*- coding : utf-8 -*-
"""
pattern:
Factory method:
Define an interface for creating an object,
but let subclasses decide which class to
instantiate.Factory Method lets a class defer
instantiation to subclasses.
AbstractProduct1 < = > AbstractProduct2
| | | |
ProductA1 ProductB1 ProductA2 ProductB2
AbstractFactory
| |
FactoryA FactoryB
(for ProductA1 and A2) (for ProductB1 and B2)
***************************************************************
MaleAnimal < = > FemaleAnimal
| | | |
MaleLion MaleTiger FemaleLion FemaleTiger
;
AnimalFactory
| |
LionFactory TigerFactory
(for MaleLion and FemaleLion) (for MaleTiger and FemaleTiger)
"""
##########################################
# AbstractProduct1
class MaleAnimal:
def __init__(self):
self.boundary = 'MaleAnimal'
self.state = self.boundary
def __str__(self):
return self.state
# ProductA1
class MaleLion(MaleAnimal):
def __init__(self):
super(MaleLion, self).__init__();
self.state = self.boundary + ' - MaleLion'
def __str__(self):
return self.state
# ProductB1
class MaleTiger(MaleAnimal):
def __init__(self):
super(MaleTiger, self).__init__();
self.state = self.boundary + ' - MaleTiger'
def __str__(self):
return self.state
##########################################
# AbstractProduct2
class FemaleAnimal:
def __init__(self):
self.boundary = 'FemaleAnimal'
self.state = self.boundary
def __str__(self):
return self.state
# ProductA2
class FemaleLion(FemaleAnimal):
def __init__(self):
super(FemaleLion, self).__init__();
self.state = self.boundary + ' - FemaleLion'
def __str__(self):
return self.state
# ProductB2
class FemaleTiger(FemaleAnimal):
def __init__(self):
super(FemaleTiger, self).__init__();
self.state = self.boundary + ' - FemaleTiger'
def __str__(self):
return self.state
##########################################
# AbstractFactory
class AnimalFactory():
def create_male_animal(self):
pass
def create_female_animal(self):
pass
# FactoryA
class LionFactory(AnimalFactory):
def __init__(self):
print('Initialize LionFactory.')
def create_male_animal(self):
return MaleLion()
def create_female_animal(self):
return FemaleLion()
# FactoryB
class TigerFactory(AnimalFactory):
def __init__(self):
print('Initialize TigerFactory.')
def create_male_animal(self):
return MaleTiger()
def create_female_animal(self):
return FemaleTiger()
if __name__ == '__main__':
lion_factory = LionFactory()
tiger_factory = TigerFactory()
obj_a1 = lion_factory.create_male_animal()
obj_a2 = lion_factory.create_female_animal()
obj_b1 = tiger_factory.create_male_animal()
obj_b2 = tiger_factory.create_female_animal()
print('obj_a1: {0}'.format(obj_a1))
print('obj_a2: {0}'.format(obj_a2))
print('obj_b1: {0}'.format(obj_b1))
print('obj_b2: {0}'.format(obj_b2)) |
# Shape of number 2 using fucntions
def for_2():
""" *'s printed in the shape of number 2 """
for row in range(9):
for col in range(9):
if row ==8 or row+col ==8 and row !=0 or row ==0 and col%8 !=0 or row ==1 and col ==0 or row ==2 and col ==0:
print('*',end =' ')
else:
print(' ',end=' ')
print()
def while_2():
""" *'s printed in the shape of number 2 """
row =0
while row<9:
col =0
while col <9:
if row ==8 or row+col ==8 and row !=0 or row ==0 and col%8 !=0 or row ==1 and col ==0 or row ==2 and col ==0:
print('*',end =' ')
else:
print(' ',end=' ')
col+=1
print()
row += 1
|
""" Ex - 055 - Faça um programa que leia o peso de cinco pessoas. No final, mostre qual foi o
maior e o menor pesos lidos."""
# Como eu fiz
# Cabeçalho:
print(f'{"":=^40}')
print(f'{"> MAIOR PESO LIDO <":=^40}')
print(f'{"":=^40}')
# Var:
maior_peso = 0
menor_peso = 1000
# Laço de repetição:
for pess in range(1, 6):
peso = float(input('Qual o peso da {}° pessoa? (Kg) '.format(pess)))
if peso > maior_peso:
maior_peso = peso
if peso < menor_peso:
menor_peso = peso
print('A pessoa com MAIOR PESO tem {:.1f}Kg'.format(maior_peso))
print('A pessoa com MENOR PESO tem {:.1f}Kg'.format(menor_peso))
# Como o Professor Guanabara Fez
maior = 0
menor = 0
for p in range(1, 6):
peso = float(int('Peso da {}° pessoa: '.format(p)))
if p == 1:
maior == peso
menor == peso
else:
if peso > maior:
maior = peso
if peso < menor:
menor < peso
print('O mairo peso lido foi de {}Kg'.format(maior))
print('O menor peso lido foi de {}Kg'.format(menor)) |
""" You are given an array of intervals, where intervals[i] = [starti, endi] and
each starti is unique. The right interval for an interval i is an interval j
such that startj >= endi and startj is minimized. Return an array of right
interval indices for each interval i. If no right interval exists for
interval i, then put -1 at index i.
Example 1: Input: intervals = [[1,2]]
Output: [-1] Explanation: There is only one interval in the collection, so it
outputs -1.
Example 2: Input: intervals = [[3,4],[2,3],[1,2]] Output:
[-1,0,1] Explanation: There is no right interval for [3,4]. The right
interval for [2,3] is [3,4] since start0 = 3 is the smallest start that is >=
end1 = 3. The right interval for [1,2] is [2,3] since start1 = 2 is the
smallest start that is >= end2 = 2.
IDEA:
"""
class Solution436:
pass
|
class Solution:
def wiggleSort(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
nums.sort()
ans = nums[:]
for i in range(1, len(nums), 2):
nums[i] = ans.pop()
for i in range(0, len(nums), 2):
nums[i] = ans.pop()
|
PANEL_GROUP = 'default'
PANEL_DASHBOARD = 'billing'
PANEL = 'billing_invoices'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'astutedashboard.dashboards.billing.invoices.panel.BillingInvoices'
|
def isPrime(n):
if n <= 1: return False
for i in range(2,int(n**.5)+1):
if n % i == 0: return False
return True
def findPrime(n):
k=1
for i in range(n):
if isPrime(i):
if(k>=10001):return i
k+=1
print(findPrime(300000))
|
dict={'A': ['B', 'CB', 'D', 'E', 'F', 'GD', 'H', 'IE'],
'B': ['A', 'C', 'D', 'E', 'F', 'G', 'HE', 'I'],
'C': ['AB', 'GE', 'D', 'E', 'F', 'B', 'H', 'IF'],
'D': ['A', 'B', 'C', 'E', 'FE', 'G', 'H', 'I'],
'E': ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'I'],
'F': ['A', 'B', 'C', 'DE', 'E', 'G', 'H', 'I'],
'G': ['AD', 'B', 'CE', 'D', 'E', 'F', 'H', 'IH'],
'H': ['A', 'BE', 'C', 'D', 'E', 'F', 'G', 'I'],
'I': ['AE', 'B', 'F', 'D', 'E', 'CF', 'GH', 'H']}
def count_patterns_from(firstPoint, length):
if length<=1 or length>9:
return 1 if length==1 else 0
return helper(firstPoint, length, {firstPoint}, {"":0}, 1, [firstPoint])
def helper(cur, target, went, res, n, order):
if n>=target:
if n==target==len(order):
res[""]+=1
return
length=len(went)
for i in dict[cur]:
comp=went|{i[0]} if len(i)==1 else went|{i[0], i[1]}
diff=len(comp)-length
if (diff==1 and i[0] not in went) or diff==2:
helper(i[0], target, comp, res, n+diff, order+[i[0]])
return res[""] |
test = { 'name': 'q4c',
'points': 10,
'suites': [ { 'cases': [ { 'code': '>>> len(prophet_forecast) == '
'5863\n'
'True',
'hidden': False,
'locked': False},
{ 'code': '>>> '
'len(prophet_forecast_holidays) '
'== 5863\n'
'True',
'hidden': False,
'locked': False}],
'scored': True,
'setup': '',
'teardown': '',
'type': 'doctest'}]}
|
def solve_discrete_logarithm(g: int, y: int, m: int) -> int:
"""find x >= 0 s.t. g^x≡y (mod m) by baby-step giant-step
"""
if m == 1:
return 0
if y == 1:
return 0
if g == 0 and y == 0:
return 1
sqrt_m = int(pow(m, 0.5) + 100)
# Baby-step
memo = {}
baby = 1
for b in range(sqrt_m):
if baby == y:
return b
memo[baby * y % m] = b
baby = baby * g % m
# Giant-step
giant = 1
for a in range(1, sqrt_m + 3):
giant = giant * baby % m
b = memo.get(giant, -1)
if b >= 0:
x = a * sqrt_m - b
return x if pow(g, x, m) == y else -1
return -1
|
def read_blob(blob, bucket):
return bucket.blob(blob).download_as_string().decode("utf-8", errors="ignore")
def download_blob(blob, file_obj, bucket):
return bucket.blob(blob).download_to_file(file_obj)
def write_blob(key, file_obj, bucket):
return bucket.blob(key).upload_from_file(file_obj)
|
'''
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
You may return any answer array that satisfies this condition.
Example 1:
Input: [3,1,2,4]
Output: [2,4,3,1]
The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be accepted.
Note:
1 <= A.length <= 5000
0 <= A[i] <= 5000
'''
class Solution(object):
def sortArrayByParity(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
B = list()
for num in A:
if num % 2 == 0:
B.append(num)
for num in A:
if num % 2 != 0:
B.append(num)
return B
mysolution = Solution()
array = [3,1,2,4]
print(mysolution.sortArrayByParity(array)) |
# https://www.hackerrank.com/challenges/compare-the-triplets/problem?h_r=internal-search
A = input().split()
B = input().split()
def compare(a, b):
alice = 0
bob = 0
x = len(a)
for i in range(x):
if int(a[i]) > int(b[i]):
alice += 1
elif int(a[i]) < int(b[i]):
bob += 1
elif a[i] == b[i]:
alice += 0
bob += 0
pass
return [alice, bob]
total = compare(A, B)
print(total)
"""
Examples
17 28 30
99 16 8
output => 2, 1
5 6 7
3 6 10
output => 1, 1
""" |
class Attachment:
def __init__(
self,
fallback: str,
color: str = None,
pretext: str = None,
text: str = None,
author_name: str = None,
author_link: str = None,
author_icon: str = None,
title: str = None,
title_link: str = None,
fields: list = None,
image_url: str = None,
thumb_url: str = None,
):
self.fallback = fallback
self.color = color
self.pretext = pretext
self.text = text
self.author_name = author_name
self.author_link = author_link
self.author_icon = author_icon
self.title = title
self.title_link = title_link
self.fields = fields
self.image_url = image_url
self.thumb_url = thumb_url
payload = {"fallback": self.fallback}
if self.color:
payload["color"] = self.color
if self.pretext:
payload["pretext"] = self.pretext
if self.text:
payload["text"] = self.text
if self.author_name:
payload["author_name"] = self.author_name
if self.author_link:
payload["author_link"] = self.author_link
if self.author_icon:
payload["author_icon"] = self.author_icon
if self.title:
payload["title"] = self.title
if self.title_link:
payload["title_link"] = self.title_link
if self.fields:
payload["fields"] = self.fields
if self.image_url:
payload["image_url"] = self.image_url
if self.thumb_url:
payload["thumb_url"] = self.thumb_url
self.payload = payload
|
infile = open("sud3_results.csv","r")
outfile = open("sud4_results.csv","w")
keywords = infile.readline().strip().split(",")[1:]
outfile.write("%s, %s" % ("filename", ",".join("Environment+Social+Economic", "Environment+Social+Economic+Cultural", "Environment+Social+Economic+Cultural+Institutional")))
three_pillars_keywords = ["environmental", "housing", "energy", "water", "social", "local", "community", "public", "economic"]
four_pillars_keywords = three_pillars_keywords + ["cultural", "culture"]
five_pillar_keywords = four_pillars_keywords + ["urban", "planning"]
for line in infile.readlines():
data = line.split(",")
filename = data[0]
numerical = [int(entry) for entry in data[1:]] |
class EnvInfo(object):
def __init__(self, frame_id, time_stamp, road_path, obstacle_array):
# default params
self.frame_id = frame_id
self.time_stamp = time_stamp
self.road_path = road_path
self.obstacle_array = obstacle_array |
# Module for implementing gradients used in the autograd system
__all__ = ["GradFunc"]
def forward_grad(tensor):
## tensor here should be an AutogradTensor or a Tensor where we can set .grad
try:
grad_fn = tensor.grad_fn
except AttributeError:
return None
# If a tensor doesn't have a grad_fn already attached to it, that means
# it's a leaf of the graph and we want to accumulate the gradient
if grad_fn is None and tensor.requires_grad:
return Accumulate(tensor)
else:
return grad_fn
class GradFunc:
def __init__(self, *args):
# This part builds our graph. It takes grad functions (if they exist)
# from the input arguments and builds a tuple pointing to them. This way
# we can use .next_functions to traverse through the entire graph.
self.next_functions = tuple(
filter(lambda x: x is not None, [forward_grad(arg) for arg in args])
)
self.result = None
def gradient(self, grad):
raise NotImplementedError
def __setattr__(self, name, value):
# Doing this because we want to pass in AutogradTensors so we can update
# tensor.grad in Accumulate, but we also need native looking tensors for
# the gradient operations in GradFuncs.
try:
value = value.child
except AttributeError:
pass
object.__setattr__(self, name, value)
def __call__(self, grad):
return self.gradient(grad)
def __repr__(self):
return self.__class__.__name__
# Accumulate gradients at graph leafs
class Accumulate:
def __init__(self, tensor):
# Note that tensor here should be an AutogradTensor so we can update
# .grad appropriately
self.next_functions = []
self.tensor = tensor
def __call__(self, grad):
if self.tensor.grad is not None:
self.tensor.grad += grad
else:
self.tensor.grad = grad + 0
return ()
def __repr__(self):
return self.__class__.__name__
|
class KeywordsOnlyMeta(type):
def __call__(cls, *args, **kwargs):
if args:
raise TypeError("Constructor for class {!r} does not accept positional arguments.".format(cls))
return super().__call__(cls, **kwargs)
class ConstrainedToKeywords(metaclass=KeywordsOnlyMeta):
def __init__(self, *args, **kwargs):
print("args =", args)
print("kwargs = ", kwargs)
|
if __name__ == "__main__":
ans = ""
for n in range(2, 10):
for i in range(1, 10**(9 // n)):
s = "".join(str(i * j) for j in range(1, n + 1))
if "".join(sorted(s)) == "123456789":
ans = max(s, ans)
print(ans)
|
"""
The module identify push-down method refactoring opportunities in Java projects
"""
# Todo: Implementing a decent push-down method identification algorithm.
|
COLORS = {
'Black': u'\u001b[30m',
'Red': u'\u001b[31m',
'Green': u'\u001b[32m',
'Yellow': u'\u001b[33m',
'Blue': u'\u001b[34m',
'Magenta': u'\u001b[35m',
'Cyan': u'\u001b[36m',
'White': u'\u001b[37m',
'Reset': u'\u001b[0m',
}
|
def mmc(x, y):
if a == 0 or b == 0:
return 0
return a * b // mdc(a, b)
def mdc(a, b):
if b == 0:
return a
return mdc(b, a % b)
a, b = input().split()
a, b = int(a), int(b)
while a >= 0 and b >= 0:
print(mmc(a, b))
a, b = input().split()
a, b = int(a), int(b)
|
# Puzzle Input
with open('Day20_Input.txt') as puzzle_input:
tiles = puzzle_input.read().split('\n\n')
# Parse the tiles: Separate the ID and get the 4 sides:
parsed_tiles = []
tiles_IDs = []
for original_tile in tiles: # For every tile:
original_tile = original_tile.split('\n') # Split the original tile into rows
tiles_IDs += [int(original_tile[0][5:-1])] # Get the ID of the tile -> Tile: XXXX, XXXX starts at index 5
parsed_tiles += [[]] # Next parsed tile
left_side = ''
right_side = ''
for row in original_tile[1:]: # The left and right sides are the:
left_side += row[0] # Beginning of rows
right_side += row[-1] # End of rows
parsed_tiles[-1] += original_tile[1][:], right_side[:], original_tile[-1][:], left_side[:]
# Make connections between the tiles
connections = [[] for _ in range(len(tiles_IDs))] # Create an empty list of connections
for tile_index, tile in enumerate(parsed_tiles): # For every tile:
tile_id = tiles_IDs[tile_index] # Get it's ID
for other_tile_index, other_tile in enumerate(parsed_tiles): # Try to match it to every other tile
if other_tile_index == tile_index: # If they're the same tile, go to the next
continue
other_tile_id = tiles_IDs[other_tile_index] # Get the other tile's ID
if other_tile_id in connections[tile_index]: # The other tile has the connection, skip this
continue
for other_side in other_tile: # For every side in the other tile
if other_side in tile or other_side[::-1] in tile: # See if either the side currently matches
connections[tile_index] += [other_tile_id] # or if a rotated tile would match this tile
connections[other_tile_index] += [tile_id] # then, add the connections
# Get the product of the corners (the tiles that only have 2 connections)
total = 1
for ID, conn in zip(tiles_IDs, connections):
if len(conn) == 2:
total *= ID
# Show the result
print(total)
|
"""Contains the package version number
"""
__version__ = '0.1.0-dev'
|
# FLOYD TRIANGLE
limit = int(input("Enter the limit: "))
n = 1
for i in range(1, limit+1):
for j in range(1, i+1):
print(n, ' ', end='') # print on same line
n += 1
print('')
|
# 008: Make a program that reads a value in meter and convert to centimeter and millimeter
n = float(input('Write a number in meter: '))
print(f'{n} is: {n*100:.1f}cm and {n*1000:.1f}mm')
|
def restar(x,y):
resta = x-y
return resta
def multiplicar(x,y):
mult = x*y
return mult
def dividir(x,y):
div = x/y
return div
|
if 1:
print("1 is ")
else:
print("???")
|
print('''
_ _ _ _ _
| || | __ _ _ _ ___ | |_ (_) | |_
| __ | / _` | | '_| (_-< | ' \ | | | _|
|_||_| \__,_| |_| /__/ |_||_| |_| \__|
''')
print("IP \t Date time \t Request \t")
with open("website.log","r") as f:
lines= f.readlines()
with open("output.txt", 'w+') as nf:
for line in lines:
line = line.split(" ")
nf.write("{}\t {}\t {}\n" .format(line[0],line[3].replace('[',' '),line[5].replace('"',' ')))
|
sumTotal = 0
nameNum = ''
a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
g = 7
h = 8
i = 9
j = 10
k = 11
l = 12
m = 13
n = 14
o = 15
p = 16
q = 17
r = 18
s = 19
t = 20
u = 21
v = 22
w = 23
x = 24
y = 25
z = 26
A = '1'
B = '2'
C = '3'
D = '4'
E = '5'
F = '6'
G = '7'
H = '8'
I = '9'
J = '10'
K = '11'
L = '12'
M = '13'
N = '14'
O = '15'
P = '16'
Q = '17'
R = '18'
S = '19'
T = '20'
U = '21'
V = '22'
W = '23'
X = '24'
Y = '25'
Z = '26'
def letraA(sumTotal, nameNum):
sumTotal = sumTotal + a
nameNum = nameNum + A
return sumTotal, nameNum
def letraB(sumTotal, nameNum):
sumTotal = sumTotal + a
nameNum = nameNum + B
return sumTotal, nameNum
def letraC(sumTotal, nameNum):
sumTotal = sumTotal + a
nameNum = nameNum + C
return sumTotal, nameNum
def letraD(sumTotal, nameNum):
sumTotal = sumTotal + d
nameNum = nameNum + D
return sumTotal, nameNum
def letraE(sumTotal, nameNum):
sumTotal = sumTotal + e
nameNum = nameNum + E
return sumTotal, nameNum
def letraF(sumTotal, nameNum):
sumTotal = sumTotal + f
nameNum = nameNum + F
return sumTotal, nameNum
def letraG(sumTotal, nameNum):
sumTotal = sumTotal + g
nameNum = nameNum + G
return sumTotal, nameNum
def letraH(sumTotal, nameNum):
sumTotal = sumTotal + h
nameNum = nameNum + H
return sumTotal, nameNum
def letraI(sumTotal, nameNum):
sumTotal = sumTotal + i
nameNum = nameNum + I
return sumTotal, nameNum
def letraJ(sumTotal, nameNum):
sumTotal = sumTotal + j
nameNum = nameNum + J
return sumTotal, nameNum
def letraK(sumTotal, nameNum):
sumTotal = sumTotal + k
nameNum = nameNum + K
return sumTotal, nameNum
def letraL(sumTotal, nameNum):
sumTotal = sumTotal + l
nameNum = nameNum + L
return sumTotal, nameNum
def letraM(sumTotal, nameNum):
sumTotal = sumTotal + m
nameNum = nameNum + M
return sumTotal, nameNum
def letraN(sumTotal, nameNum):
sumTotal = sumTotal + n
nameNum = nameNum + N
return sumTotal, nameNum
def letraO(sumTotal, nameNum):
sumTotal = sumTotal + o
nameNum = nameNum + O
return sumTotal, nameNum
def letraP(sumTotal, nameNum):
sumTotal = sumTotal + p
nameNum = nameNum + P
return sumTotal, nameNum
def letraQ(sumTotal, nameNum):
sumTotal = sumTotal + q
nameNum = nameNum + Q
return sumTotal, nameNum
def letraR(sumTotal, nameNum):
sumTotal = sumTotal + r
nameNum = nameNum + R
return sumTotal, nameNum
def letraS(sumTotal, nameNum):
sumTotal = sumTotal + s
nameNum = nameNum + S
return sumTotal, nameNum
def letraT(sumTotal, nameNum):
sumTotal = sumTotal + t
nameNum = nameNum + T
return sumTotal, nameNum
def letraU(sumTotal, nameNum):
sumTotal = sumTotal + u
nameNum = nameNum + U
return sumTotal, nameNum
def letraV(sumTotal, nameNum):
sumTotal = sumTotal + v
nameNum = nameNum + V
return sumTotal, nameNum
def letraW(sumTotal, nameNum):
sumTotal = sumTotal + w
nameNum = nameNum + W
return sumTotal, nameNum
def letraX(sumTotal, nameNum):
sumTotal = sumTotal + x
nameNum = nameNum + X
return sumTotal, nameNum
def letraY(sumTotal, nameNum):
sumTotal = sumTotal + y
nameNum = nameNum + Y
return sumTotal, nameNum
def letraZ(sumTotal, nameNum):
sumTotal = sumTotal + z
nameNum = nameNum + Z
return sumTotal, nameNum
def nonLetra():
pass
def complete():
print("A soma de suas letras sao", sumTotal, "no total.")
print("Nome numerico sem soma de numeros:", nameNum) |
"""
Validate BST: Implement a function to check if a binary tree is a binary search tree.
"""
# idea: if BST, inorder traversal gives a nondecreasing sorted list
class BTNode:
def __init__(self, val: int, left=None, right=None):
self.val = val
self.left: BTNode = left
self.right: BTNode = right
def is_BST(node: BTNode):
# Space optimized O(log N) solution using inorder traversal
stack = []
"""nodes = []"""
prev_val = None
curr_val = None
curr = node
while True:
if curr is not None:
stack.append(curr)
curr = curr.left
elif stack:
popped = stack.pop()
if prev_val is None:
prev_val = popped.val
elif curr_val is None:
curr_val = popped.val
else:
prev_val = curr_val
curr_val = popped.val
if prev_val is not None and curr_val is not None and prev_val > curr_val:
return False
curr = popped.right
else:
break
return True
def test_solution():
real_BST = BTNode(8, BTNode(4, BTNode(2), BTNode(6)), BTNode(10, None, BTNode(20)))
not_BST = BTNode(8, BTNode(4, BTNode(2), BTNode(12)), BTNode(10, None, BTNode(20)))
assert is_BST(real_BST)
assert not is_BST(not_BST)
if __name__ == '__main__':
test_solution()
|
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and The Qt Company. For licensing terms
# and conditions see https://www.qt.io/terms-conditions. For further
# information use the contact form at https://www.qt.io/contact-us.
#
# GNU General Public License Usage
# Alternatively, this file may be used under the terms of the GNU
# General Public License version 3 as published by the Free Software
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
# included in the packaging of this file. Please review the following
# information to ensure the GNU General Public License requirements will
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
#
############################################################################
source("../../shared/qtcreator.py")
def main():
startApplication("qtcreator" + SettingsPath)
if not startedWithoutPluginError():
return
available = ["5.6"]
for qtVersion in available:
# using a temporary directory won't mess up a potentially existing
workingDir = tempDir()
projectName = createNewQtQuickUI(workingDir, qtVersion)
quick = "2.6"
qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(1, 0, workingDir, projectName, 11223, quick)
if qmlViewer!=None:
qmlViewerPath = os.path.dirname(qmlViewer)
qmlViewer = os.path.basename(qmlViewer)
result = addExecutableAsAttachableAUT(qmlViewer, 11223)
allowAppThroughWinFW(qmlViewerPath, qmlViewer, None)
if result:
result = runAndCloseApp(True, qmlViewer, 11223, sType=SubprocessType.QT_QUICK_UI, quickVersion=quick)
else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_UI)
removeExecutableAsAttachableAUT(qmlViewer, 11223)
deleteAppFromWinFW(qmlViewerPath, qmlViewer)
else:
result = runAndCloseApp(sType=SubprocessType.QT_QUICK_UI)
if result == None:
checkCompile()
else:
appOutput = logApplicationOutput()
test.verify(not ("untitled.qml" in appOutput or "MainForm.ui.qml" in appOutput),
"Does the Application Output indicate QML errors?")
invokeMenuItem("File", "Close All Projects and Editors")
invokeMenuItem("File", "Exit")
|
class MessageConfig:
"""
メッセージの設定
"""
class FontColors:
"""
標準出力の文字色
"""
RED: str = '\033[31m'
GREEN: str = '\033[32m'
YELLOW: str = '\033[33m'
RESET: str = '\033[0m'
@classmethod
def HOW_TO_START_RECORDING(cls) -> str:
return "録音を開始するにはEnterを入力してください。"
@classmethod
def HOW_TO_STOP_RECORDING(cls) -> str:
return"録音を終了するには再度Enterを入力してください。"
@classmethod
def START_RECORDING(cls) -> str:
return "録音を開始します。"
@classmethod
def STOP_RECORDING(cls) -> str:
return "録音を終了します。"
@classmethod
def SAVE_WAVE_FILE(cls, file_name: str) -> str:
return f"{cls.FontColors.YELLOW}{file_name}{cls.FontColors.RESET}に音声データを保存しました。"
@classmethod
def CLEAR_ALL_DATA(cls) -> str:
return f"{cls.FontColors.GREEN}音声データを全削除しました。{cls.FontColors.RESET}"
@classmethod
def INPUT_MESSAGE(cls) -> str:
return "メッセージを入力: "
@classmethod
def INPUT_WAVE_FILE_INDEX(cls, start: int, end: int) -> str:
return f"ファイルを選択 ({start}-{end}): "
@classmethod
def WAVE_FILE_WITH_INDEX(cls, index: int, file_name: str) -> str:
return f"{index}: {cls.FontColors.YELLOW}{file_name}{cls.FontColors.RESET}"
@classmethod
def SELECT_WAVE_FILE(cls) -> str:
return "ファイルを選択してください。"
@classmethod
def VALIDATION_ERROR_OF_INPUT_TEXT(cls) -> str:
return f"{cls.FontColors.RED}無効な値が入力されました。{cls.FontColors.RESET}"
@classmethod
def START_PROCESSING(cls) -> str:
return "処理を開始します。"
@classmethod
def COMPLETE_PROCESSING(cls) -> str:
return "処理が完了しました。"
@classmethod
def DETECT_MESSAGE(cls, message: str) -> str:
return f"検出されたメッセージ: {cls.FontColors.GREEN}{message}{cls.FontColors.RESET}"
@classmethod
def NOT_FOUND_WAVE_DATA(cls) -> str:
return f"{cls.FontColors.RED}音声データが見つかりません。{cls.FontColors.RESET}"
|
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.36
工具: python == 3.7.3
"""
"""
思路:
双指针
第一个指针负责遍历所有元素,当前元素等于目标值则跳过,不等于目标值则将其复制到第二个指针的位置
然后第二个指针向后移动一位,其最终位置即为非目标元素的个数
结果:
执行用时 : 44 ms, 在所有 Python3 提交中击败了96.19%的用户
内存消耗 : 13.1 MB, 在所有 Python3 提交中击败了67.95%的用户
"""
class Solution:
def removeElement(self, nums, val):
index = 0
for i in range(len(nums)):
if nums[i] != val:
nums[index] = nums[i]
index += 1
return index
if __name__ == "__main__":
nums = [3,2,2,3]
val = 3
answer = Solution().removeElement(nums, val)
print(answer) |
#State Codes
area_codes = [("Alabama",[205, 251, 256, 334, 659, 938]),
("Alaska",[907]),
("Arizona",[480, 520, 602, 623, 928]),
("Arkansas",[327, 479, 501, 870]),
("California",[209, 213, 310, 323, 341, 369, 408, 415, 424, 442, 510, 530, 559, 562, 619, 626, 627, 628, 650, 657, 661, 669, 707, 714, 747, 760, 764, 805, 818, 831, 858, 909, 916, 925, 935, 949, 951 ]),
("Colorado",[303, 719, 720, 970 ]),
("Connecticut",[203, 475, 860, 959]),
("Delaware",[302]),
("District of Columbia",[202]),
("Florida",[239, 305, 321, 352, 386, 407, 561, 689, 727, 754, 772, 786, 813, 850, 863, 904, 927, 941, 954 ]),
("Georgia",[229, 404, 470, 478, 678, 706, 762, 770, 912 ]),
("Hawaii",[808]),
("Idaho",[208]),
("Illinois",[217, 224, 309, 312, 331, 447, 464, 618, 630, 708, 730, 773, 779, 815, 847, 872 ]),
("Indiana",[219, 260, 317, 574, 765, 812, 930]),
("Iowa",[319, 515, 563, 641, 712 ]),
("Kansas",[316, 620, 785, 913]),
("Kentucky",[270, 364, 502, 606, 859]),
("Louisiana",[225, 318, 337, 504, 985]),
("Maine",[207]),
("Maryland",[227, 240, 301, 410, 443, 667]),
("Massachusetts",[339, 351, 413, 508, 617, 774, 781, 857, 978 ]),
("Michigan",[231, 248, 269, 278, 313, 517, 586, 616, 679, 734, 810, 906, 947, 989 ]),
("Minnesota",[218, 320, 507, 612, 651, 763, 952]),
("Mississippi",[228, 601, 662, 769]),
("Missouri",[314, 417, 557, 573, 636, 660, 816, 975]),
("Montana",[406]),
("Nebraska",[308, 402, 531]),
("Nevada",[702, 725, 775]),
("New Hampshire",[603]),
("New Jersey",[201, 551, 609, 732, 848, 856, 862, 908, 973 ]),
("New Mexico",[505, 575]),
("New York",[212, 315, 347, 516, 518, 585, 607, 631, 646, 716, 718, 845, 914, 917, 929, 934 ]),
("North Carolina",[252, 336, 704, 743, 828, 910, 919, 980, 984 ]),
("North Dakota",[701]),
("Ohio",[216, 220, 234, 283, 330, 380, 419, 440, 513, 567, 614, 740, 937]),
("Oklahoma",[405, 539, 580, 918]),
("Oregon",[458, 503, 541, 971]),
("Pennsylvania",[215, 267, 272, 412, 484, 570, 582, 610, 717, 724, 814, 878 ]),
("Rhode Island",[401]),
("South Carolina",[803, 843, 854, 864]),
("South Dakota",[605]),
("Tennessee",[423, 615, 629, 731, 865, 901, 931]),
("Texas",[210, 214, 254, 281, 325, 346, 361, 409, 430, 432, 469, 512, 682, 713, 737, 806, 817, 830, 832, 903, 915, 936, 940, 956, 972, 979 ]),
("Utah",[385, 435, 801]),
("Vermont",[802]),
("Virginia",[276, 434, 540, 571, 703, 757, 804 ]),
("Washington",[206, 253, 360, 425, 509, 564]),
("West Virginia",[304, 681]),
("Wisconsin",[262, 274, 414, 534, 608, 715, 920]),
("Wyoming",[307])] |
#!/usr/bin/python
'''the -O turns off the assertions'''
def myFunc(a,b,c,d):
''' this is my function with
the formula
(2*a+b)/(c-d)
'''
assert c!=d, "c should not equal d"
return (2*a+b)/(c-d)
myFunc(1,2,3,3)
|
#
# PySNMP MIB module H3C-IKE-MONITOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IKE-MONITOR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:09:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
h3cCommon, = mibBuilder.importSymbols("HUAWEI-3COM-OID-MIB", "h3cCommon")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Gauge32, Bits, ObjectIdentity, Integer32, TimeTicks, ModuleIdentity, Counter32, Unsigned32, Counter64, NotificationType, MibIdentifier, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "Bits", "ObjectIdentity", "Integer32", "TimeTicks", "ModuleIdentity", "Counter32", "Unsigned32", "Counter64", "NotificationType", "MibIdentifier", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
h3cIKEMonitor = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30))
if mibBuilder.loadTexts: h3cIKEMonitor.setLastUpdated('200410260000Z')
if mibBuilder.loadTexts: h3cIKEMonitor.setOrganization('Huawei-3COM Technologies Co., Ltd.')
class H3cIKENegoMode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(2, 4, 32))
namedValues = NamedValues(("mainMode", 2), ("aggressiveMode", 4), ("quickMode", 32))
class H3cIKEAuthMethod(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 3))
namedValues = NamedValues(("preSharedKey", 1), ("rsaSignatures", 3))
class H3cDiffHellmanGrp(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 5, 14))
namedValues = NamedValues(("modp768", 1), ("modp1024", 2), ("modp1536", 5), ("modp2048", 14))
class H3cEncryptAlgo(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
namedValues = NamedValues(("none", 0), ("desCbc", 1), ("ideaCbc", 2), ("blowfishCbc", 3), ("rc5R16B64Cbc", 4), ("tripleDesCbc", 5), ("castCbc", 6), ("aesCbc", 7), ("aesCbc128", 8), ("aesCbc192", 9), ("aesCbc256", 10))
class H3cAuthAlgo(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2))
namedValues = NamedValues(("none", 0), ("md5", 1), ("sha", 2))
class H3cSaProtocol(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))
namedValues = NamedValues(("reserved", 0), ("isakmp", 1), ("ah", 2), ("esp", 3), ("ipcomp", 4))
class H3cTrapStatus(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("enabled", 1), ("disabled", 2))
class H3cIKEIDType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))
namedValues = NamedValues(("reserved", 0), ("ipv4Addr", 1), ("fqdn", 2), ("userFqdn", 3), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8), ("derAsn1Dn", 9), ("derAsn1Gn", 10), ("keyId", 11))
class H3cTrafficType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 4, 5, 6, 7, 8))
namedValues = NamedValues(("ipv4Addr", 1), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8))
class H3cIKETunnelState(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("active", 1), ("timeout", 2))
h3cIKEObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1))
h3cIKETunnelTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1), )
if mibBuilder.loadTexts: h3cIKETunnelTable.setStatus('current')
h3cIKETunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1), ).setIndexNames((0, "H3C-IKE-MONITOR-MIB", "h3cIKETunIndex"))
if mibBuilder.loadTexts: h3cIKETunnelEntry.setStatus('current')
h3cIKETunIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: h3cIKETunIndex.setStatus('current')
h3cIKETunLocalType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 2), H3cIKEIDType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunLocalType.setStatus('current')
h3cIKETunLocalValue1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunLocalValue1.setStatus('current')
h3cIKETunLocalValue2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunLocalValue2.setStatus('current')
h3cIKETunLocalAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunLocalAddr.setStatus('current')
h3cIKETunRemoteType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 6), H3cIKEIDType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunRemoteType.setStatus('current')
h3cIKETunRemoteValue1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunRemoteValue1.setStatus('current')
h3cIKETunRemoteValue2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunRemoteValue2.setStatus('current')
h3cIKETunRemoteAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 9), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunRemoteAddr.setStatus('current')
h3cIKETunInitiator = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("local", 1), ("remote", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInitiator.setStatus('current')
h3cIKETunNegoMode = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 11), H3cIKENegoMode()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunNegoMode.setStatus('current')
h3cIKETunDiffHellmanGrp = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 12), H3cDiffHellmanGrp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunDiffHellmanGrp.setStatus('current')
h3cIKETunEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 13), H3cEncryptAlgo()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunEncryptAlgo.setStatus('current')
h3cIKETunHashAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 14), H3cAuthAlgo()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunHashAlgo.setStatus('current')
h3cIKETunAuthMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 15), H3cIKEAuthMethod()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunAuthMethod.setStatus('current')
h3cIKETunLifeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunLifeTime.setStatus('current')
h3cIKETunActiveTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunActiveTime.setStatus('current')
h3cIKETunRemainTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunRemainTime.setStatus('current')
h3cIKETunTotalRefreshes = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunTotalRefreshes.setStatus('current')
h3cIKETunState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 20), H3cIKETunnelState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunState.setStatus('current')
h3cIKETunDpdIntervalTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 21), Integer32().clone(10)).setUnits('second').setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunDpdIntervalTime.setStatus('current')
h3cIKETunDpdTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 1, 1, 22), Integer32().clone(5)).setUnits('second').setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunDpdTimeOut.setStatus('current')
h3cIKETunnelStatTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2), )
if mibBuilder.loadTexts: h3cIKETunnelStatTable.setStatus('current')
h3cIKETunnelStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1), ).setIndexNames((0, "H3C-IKE-MONITOR-MIB", "h3cIKETunIndex"))
if mibBuilder.loadTexts: h3cIKETunnelStatEntry.setStatus('current')
h3cIKETunInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 1), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInOctets.setStatus('current')
h3cIKETunInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInPkts.setStatus('current')
h3cIKETunInDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInDropPkts.setStatus('current')
h3cIKETunInP2Exchgs = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInP2Exchgs.setStatus('current')
h3cIKETunInP2ExchgRejets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInP2ExchgRejets.setStatus('current')
h3cIKETunInP2SaDelRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 6), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInP2SaDelRequests.setStatus('current')
h3cIKETunInP1SaDelRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 7), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInP1SaDelRequests.setStatus('current')
h3cIKETunInNotifys = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunInNotifys.setStatus('current')
h3cIKETunOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 9), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutOctets.setStatus('current')
h3cIKETunOutPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 10), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutPkts.setStatus('current')
h3cIKETunOutDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 11), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutDropPkts.setStatus('current')
h3cIKETunOutP2Exchgs = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 12), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutP2Exchgs.setStatus('current')
h3cIKETunOutP2ExchgRejects = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 13), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutP2ExchgRejects.setStatus('current')
h3cIKETunOutP2SaDelRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 14), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutP2SaDelRequests.setStatus('current')
h3cIKETunOutP1SaDelRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 15), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutP1SaDelRequests.setStatus('current')
h3cIKETunOutNotifys = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKETunOutNotifys.setStatus('current')
h3cIKEGlobalStats = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3))
h3cIKEGlobalActiveTunnels = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalActiveTunnels.setStatus('current')
h3cIKEGlobalInOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInOctets.setStatus('current')
h3cIKEGlobalInPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInPkts.setStatus('current')
h3cIKEGlobalInDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInDropPkts.setStatus('current')
h3cIKEGlobalInP2Exchgs = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInP2Exchgs.setStatus('current')
h3cIKEGlobalInP2ExchgRejects = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 6), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInP2ExchgRejects.setStatus('current')
h3cIKEGlobalInP2SaDelRequests = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 7), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInP2SaDelRequests.setStatus('current')
h3cIKEGlobalInNotifys = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInNotifys.setStatus('current')
h3cIKEGlobalOutOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 9), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutOctets.setStatus('current')
h3cIKEGlobalOutPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 10), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutPkts.setStatus('current')
h3cIKEGlobalOutDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 11), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutDropPkts.setStatus('current')
h3cIKEGlobalOutP2Exchgs = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 12), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutP2Exchgs.setStatus('current')
h3cIKEGlobalOutP2ExchgRejects = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 13), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutP2ExchgRejects.setStatus('current')
h3cIKEGlobalOutP2SaDelRequests = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 14), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutP2SaDelRequests.setStatus('current')
h3cIKEGlobalOutNotifys = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalOutNotifys.setStatus('current')
h3cIKEGlobalInitTunnels = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInitTunnels.setStatus('current')
h3cIKEGlobalInitTunnelFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInitTunnelFails.setStatus('current')
h3cIKEGlobalRespTunnels = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalRespTunnels.setStatus('current')
h3cIKEGlobalRespTunnelFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalRespTunnelFails.setStatus('current')
h3cIKEGlobalAuthFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalAuthFails.setStatus('current')
h3cIKEGlobalNoSaFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalNoSaFails.setStatus('current')
h3cIKEGlobalInvalidCookieFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInvalidCookieFails.setStatus('current')
h3cIKEGlobalAttrNotSuppFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalAttrNotSuppFails.setStatus('current')
h3cIKEGlobalNoProposalChosenFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalNoProposalChosenFails.setStatus('current')
h3cIKEGlobalUnsportExchTypeFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalUnsportExchTypeFails.setStatus('current')
h3cIKEGlobalInvalidIdFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInvalidIdFails.setStatus('current')
h3cIKEGlobalInvalidProFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInvalidProFails.setStatus('current')
h3cIKEGlobalCertTypeUnsuppFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalCertTypeUnsuppFails.setStatus('current')
h3cIKEGlobalInvalidCertAuthFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 29), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInvalidCertAuthFails.setStatus('current')
h3cIKEGlobalInvalidSignFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 30), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalInvalidSignFails.setStatus('current')
h3cIKEGlobalCertUnavailableFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 3, 31), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: h3cIKEGlobalCertUnavailableFails.setStatus('current')
h3cIKETrapObject = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4))
h3cIKEProposalNumber = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4, 1), Integer32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: h3cIKEProposalNumber.setStatus('current')
h3cIKEProposalSize = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4, 2), Integer32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: h3cIKEProposalSize.setStatus('current')
h3cIKEIdInformation = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4, 3), DisplayString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: h3cIKEIdInformation.setStatus('current')
h3cIKEProtocolNum = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4, 4), Integer32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: h3cIKEProtocolNum.setStatus('current')
h3cIKECertInformation = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 4, 5), DisplayString()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: h3cIKECertInformation.setStatus('current')
h3cIKETrapCntl = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5))
h3cIKETrapGlobalCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 1), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKETrapGlobalCntl.setStatus('current')
h3cIKETunnelStartTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 2), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKETunnelStartTrapCntl.setStatus('current')
h3cIKETunnelStopTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 3), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKETunnelStopTrapCntl.setStatus('current')
h3cIKENoSaTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 4), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKENoSaTrapCntl.setStatus('current')
h3cIKEEncryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 5), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEEncryFailureTrapCntl.setStatus('current')
h3cIKEDecryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 6), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEDecryFailureTrapCntl.setStatus('current')
h3cIKEInvalidProposalTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 7), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidProposalTrapCntl.setStatus('current')
h3cIKEAuthFailTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 8), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEAuthFailTrapCntl.setStatus('current')
h3cIKEInvalidCookieTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 9), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidCookieTrapCntl.setStatus('current')
h3cIKEInvalidSpiTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 10), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidSpiTrapCntl.setStatus('current')
h3cIKEAttrNotSuppTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 11), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEAttrNotSuppTrapCntl.setStatus('current')
h3cIKEUnsportExchTypeTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 12), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEUnsportExchTypeTrapCntl.setStatus('current')
h3cIKEInvalidIdTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 13), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidIdTrapCntl.setStatus('current')
h3cIKEInvalidProtocolTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 14), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidProtocolTrapCntl.setStatus('current')
h3cIKECertTypeUnsuppTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 15), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKECertTypeUnsuppTrapCntl.setStatus('current')
h3cIKEInvalidCertAuthTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 16), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidCertAuthTrapCntl.setStatus('current')
h3cIKEInvalidSignTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 17), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEInvalidSignTrapCntl.setStatus('current')
h3cIKECertUnavailableTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 18), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKECertUnavailableTrapCntl.setStatus('current')
h3cIKEProposalAddTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 19), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEProposalAddTrapCntl.setStatus('current')
h3cIKEProposalDelTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 5, 20), H3cTrapStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: h3cIKEProposalDelTrapCntl.setStatus('current')
h3cIKETrap = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6))
h3cIKENotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1))
h3cIKETunnelStart = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 1)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunLifeTime"))
if mibBuilder.loadTexts: h3cIKETunnelStart.setStatus('current')
h3cIKETunnelStop = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 2)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunActiveTime"))
if mibBuilder.loadTexts: h3cIKETunnelStop.setStatus('current')
h3cIKENoSaFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 3)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKENoSaFailure.setStatus('current')
h3cIKEEncryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 4)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEEncryFailFailure.setStatus('current')
h3cIKEDecryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 5)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEDecryFailFailure.setStatus('current')
h3cIKEInvalidProposalFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 6)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEInvalidProposalFailure.setStatus('current')
h3cIKEAuthFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 7)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEAuthFailFailure.setStatus('current')
h3cIKEInvalidCookieFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 8)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEInvalidCookieFailure.setStatus('current')
h3cIKEAttrNotSuppFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 9)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEAttrNotSuppFailure.setStatus('current')
h3cIKEUnsportExchTypeFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 10)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"))
if mibBuilder.loadTexts: h3cIKEUnsportExchTypeFailure.setStatus('current')
h3cIKEInvalidIdFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 11)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKEIdInformation"))
if mibBuilder.loadTexts: h3cIKEInvalidIdFailure.setStatus('current')
h3cIKEInvalidProtocolFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 12)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProtocolNum"))
if mibBuilder.loadTexts: h3cIKEInvalidProtocolFailure.setStatus('current')
h3cIKECertTypeUnsuppFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 13)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertInformation"))
if mibBuilder.loadTexts: h3cIKECertTypeUnsuppFailure.setStatus('current')
h3cIKEInvalidCertAuthFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 14)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertInformation"))
if mibBuilder.loadTexts: h3cIKEInvalidCertAuthFailure.setStatus('current')
h3cIKElInvalidSignFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 15)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertInformation"))
if mibBuilder.loadTexts: h3cIKElInvalidSignFailure.setStatus('current')
h3cIKECertUnavailableFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 16)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertInformation"))
if mibBuilder.loadTexts: h3cIKECertUnavailableFailure.setStatus('current')
h3cIKEProposalAdd = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 17)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKEProposalNumber"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalSize"))
if mibBuilder.loadTexts: h3cIKEProposalAdd.setStatus('current')
h3cIKEProposalDel = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 1, 6, 1, 18)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKEProposalNumber"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalSize"))
if mibBuilder.loadTexts: h3cIKEProposalDel.setStatus('current')
h3cIKEConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2))
h3cIKECompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 1))
h3cIKEGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2))
h3cIKECompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 1, 1)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunnelTableGroup"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunnelStatTableGroup"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalStatsGroup"), ("H3C-IKE-MONITOR-MIB", "h3cIKETrapObjectGroup"), ("H3C-IKE-MONITOR-MIB", "h3cIKETrapCntlGroup"), ("H3C-IKE-MONITOR-MIB", "h3cIKETrapGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKECompliance = h3cIKECompliance.setStatus('current')
h3cIKETunnelTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 1)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalType"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalValue1"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalValue2"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunLocalAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteType"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteValue1"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteValue2"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemoteAddr"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInitiator"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunNegoMode"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunDiffHellmanGrp"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunEncryptAlgo"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunHashAlgo"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunAuthMethod"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunLifeTime"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunActiveTime"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunRemainTime"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunTotalRefreshes"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunState"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunDpdIntervalTime"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunDpdTimeOut"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKETunnelTableGroup = h3cIKETunnelTableGroup.setStatus('current')
h3cIKETunnelStatTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 2)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunInOctets"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInDropPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInP2Exchgs"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInP2ExchgRejets"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInP2SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInP1SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunInNotifys"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutOctets"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutDropPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutP2Exchgs"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutP2ExchgRejects"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutP2SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutP1SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunOutNotifys"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKETunnelStatTableGroup = h3cIKETunnelStatTableGroup.setStatus('current')
h3cIKEGlobalStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 3)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalActiveTunnels"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInOctets"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInDropPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInP2Exchgs"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInP2ExchgRejects"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInP2SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInNotifys"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutOctets"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutDropPkts"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutP2Exchgs"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutP2ExchgRejects"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutP2SaDelRequests"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalOutNotifys"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInitTunnels"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInitTunnelFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalRespTunnels"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalRespTunnelFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalAuthFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalNoSaFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInvalidCookieFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalAttrNotSuppFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalNoProposalChosenFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalUnsportExchTypeFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInvalidIdFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInvalidProFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalCertTypeUnsuppFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInvalidCertAuthFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalInvalidSignFails"), ("H3C-IKE-MONITOR-MIB", "h3cIKEGlobalCertUnavailableFails"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKEGlobalStatsGroup = h3cIKEGlobalStatsGroup.setStatus('current')
h3cIKETrapObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 4)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKEProposalNumber"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalSize"), ("H3C-IKE-MONITOR-MIB", "h3cIKEIdInformation"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProtocolNum"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertInformation"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKETrapObjectGroup = h3cIKETrapObjectGroup.setStatus('current')
h3cIKETrapCntlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 5)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETrapGlobalCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunnelStartTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunnelStopTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKENoSaTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEEncryFailureTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEDecryFailureTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidProposalTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEAuthFailTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidCookieTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidSpiTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEAttrNotSuppTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEUnsportExchTypeTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidIdTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidProtocolTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertTypeUnsuppTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidCertAuthTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidSignTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertUnavailableTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalAddTrapCntl"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalDelTrapCntl"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKETrapCntlGroup = h3cIKETrapCntlGroup.setStatus('current')
h3cIKETrapGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 30, 2, 2, 6)).setObjects(("H3C-IKE-MONITOR-MIB", "h3cIKETunnelStart"), ("H3C-IKE-MONITOR-MIB", "h3cIKETunnelStop"), ("H3C-IKE-MONITOR-MIB", "h3cIKENoSaFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEEncryFailFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEDecryFailFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidProposalFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEAuthFailFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidCookieFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEAttrNotSuppFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEUnsportExchTypeFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidIdFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidProtocolFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertTypeUnsuppFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEInvalidCertAuthFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKElInvalidSignFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKECertUnavailableFailure"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalAdd"), ("H3C-IKE-MONITOR-MIB", "h3cIKEProposalDel"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
h3cIKETrapGroup = h3cIKETrapGroup.setStatus('current')
mibBuilder.exportSymbols("H3C-IKE-MONITOR-MIB", h3cIKEGlobalInitTunnelFails=h3cIKEGlobalInitTunnelFails, h3cIKEAttrNotSuppFailure=h3cIKEAttrNotSuppFailure, h3cIKEGlobalCertUnavailableFails=h3cIKEGlobalCertUnavailableFails, h3cIKETunInitiator=h3cIKETunInitiator, h3cIKETunnelStatEntry=h3cIKETunnelStatEntry, h3cIKEGlobalOutDropPkts=h3cIKEGlobalOutDropPkts, h3cIKEGlobalInvalidCertAuthFails=h3cIKEGlobalInvalidCertAuthFails, h3cIKEProposalAddTrapCntl=h3cIKEProposalAddTrapCntl, h3cIKEInvalidProtocolTrapCntl=h3cIKEInvalidProtocolTrapCntl, h3cIKETunnelTable=h3cIKETunnelTable, h3cIKETunInPkts=h3cIKETunInPkts, h3cIKECertTypeUnsuppFailure=h3cIKECertTypeUnsuppFailure, h3cIKETrapCntlGroup=h3cIKETrapCntlGroup, h3cIKEGlobalInP2ExchgRejects=h3cIKEGlobalInP2ExchgRejects, h3cIKETunIndex=h3cIKETunIndex, H3cTrapStatus=H3cTrapStatus, h3cIKETunRemainTime=h3cIKETunRemainTime, h3cIKENoSaFailure=h3cIKENoSaFailure, h3cIKEGlobalAttrNotSuppFails=h3cIKEGlobalAttrNotSuppFails, h3cIKETunnelStop=h3cIKETunnelStop, H3cIKETunnelState=H3cIKETunnelState, H3cTrafficType=H3cTrafficType, h3cIKEConformance=h3cIKEConformance, h3cIKENotifications=h3cIKENotifications, h3cIKEGlobalOutOctets=h3cIKEGlobalOutOctets, h3cIKElInvalidSignFailure=h3cIKElInvalidSignFailure, PYSNMP_MODULE_ID=h3cIKEMonitor, h3cIKETunLocalValue2=h3cIKETunLocalValue2, h3cIKEInvalidCertAuthFailure=h3cIKEInvalidCertAuthFailure, h3cIKETunInP2SaDelRequests=h3cIKETunInP2SaDelRequests, h3cIKEGlobalInitTunnels=h3cIKEGlobalInitTunnels, h3cIKEProtocolNum=h3cIKEProtocolNum, h3cIKEInvalidProposalTrapCntl=h3cIKEInvalidProposalTrapCntl, h3cIKETunTotalRefreshes=h3cIKETunTotalRefreshes, h3cIKETunState=h3cIKETunState, h3cIKETrapCntl=h3cIKETrapCntl, h3cIKEAttrNotSuppTrapCntl=h3cIKEAttrNotSuppTrapCntl, h3cIKETrap=h3cIKETrap, h3cIKEGlobalInPkts=h3cIKEGlobalInPkts, h3cIKEInvalidCookieTrapCntl=h3cIKEInvalidCookieTrapCntl, h3cIKETunHashAlgo=h3cIKETunHashAlgo, h3cIKEUnsportExchTypeFailure=h3cIKEUnsportExchTypeFailure, H3cIKENegoMode=H3cIKENegoMode, h3cIKEInvalidProposalFailure=h3cIKEInvalidProposalFailure, h3cIKETunAuthMethod=h3cIKETunAuthMethod, h3cIKEGlobalRespTunnels=h3cIKEGlobalRespTunnels, h3cIKETunnelEntry=h3cIKETunnelEntry, h3cIKEProposalNumber=h3cIKEProposalNumber, h3cIKETrapObjectGroup=h3cIKETrapObjectGroup, H3cDiffHellmanGrp=H3cDiffHellmanGrp, h3cIKETunOutPkts=h3cIKETunOutPkts, h3cIKETunnelStart=h3cIKETunnelStart, h3cIKEInvalidSignTrapCntl=h3cIKEInvalidSignTrapCntl, h3cIKEInvalidCertAuthTrapCntl=h3cIKEInvalidCertAuthTrapCntl, h3cIKETunInNotifys=h3cIKETunInNotifys, h3cIKETrapGroup=h3cIKETrapGroup, h3cIKEGlobalStatsGroup=h3cIKEGlobalStatsGroup, h3cIKEGlobalActiveTunnels=h3cIKEGlobalActiveTunnels, h3cIKEGlobalOutPkts=h3cIKEGlobalOutPkts, h3cIKEMonitor=h3cIKEMonitor, h3cIKETunInOctets=h3cIKETunInOctets, h3cIKETunInDropPkts=h3cIKETunInDropPkts, h3cIKEAuthFailTrapCntl=h3cIKEAuthFailTrapCntl, h3cIKETunRemoteValue2=h3cIKETunRemoteValue2, h3cIKEProposalDelTrapCntl=h3cIKEProposalDelTrapCntl, h3cIKENoSaTrapCntl=h3cIKENoSaTrapCntl, h3cIKEGlobalNoSaFails=h3cIKEGlobalNoSaFails, h3cIKEGlobalOutP2SaDelRequests=h3cIKEGlobalOutP2SaDelRequests, h3cIKEGlobalStats=h3cIKEGlobalStats, h3cIKETunOutP1SaDelRequests=h3cIKETunOutP1SaDelRequests, h3cIKEProposalSize=h3cIKEProposalSize, h3cIKEEncryFailureTrapCntl=h3cIKEEncryFailureTrapCntl, h3cIKECertInformation=h3cIKECertInformation, h3cIKETrapObject=h3cIKETrapObject, h3cIKETunOutP2SaDelRequests=h3cIKETunOutP2SaDelRequests, h3cIKEDecryFailureTrapCntl=h3cIKEDecryFailureTrapCntl, h3cIKEProposalDel=h3cIKEProposalDel, h3cIKECertUnavailableFailure=h3cIKECertUnavailableFailure, h3cIKECertTypeUnsuppTrapCntl=h3cIKECertTypeUnsuppTrapCntl, h3cIKEObjects=h3cIKEObjects, h3cIKETunDpdTimeOut=h3cIKETunDpdTimeOut, h3cIKEGlobalAuthFails=h3cIKEGlobalAuthFails, h3cIKETunDpdIntervalTime=h3cIKETunDpdIntervalTime, h3cIKETunInP2ExchgRejets=h3cIKETunInP2ExchgRejets, h3cIKETunRemoteAddr=h3cIKETunRemoteAddr, h3cIKETunInP2Exchgs=h3cIKETunInP2Exchgs, h3cIKETunOutP2ExchgRejects=h3cIKETunOutP2ExchgRejects, h3cIKEGlobalNoProposalChosenFails=h3cIKEGlobalNoProposalChosenFails, h3cIKEEncryFailFailure=h3cIKEEncryFailFailure, h3cIKETunLocalType=h3cIKETunLocalType, H3cIKEAuthMethod=H3cIKEAuthMethod, h3cIKEInvalidCookieFailure=h3cIKEInvalidCookieFailure, h3cIKETunnelStatTable=h3cIKETunnelStatTable, h3cIKEDecryFailFailure=h3cIKEDecryFailFailure, h3cIKETunNegoMode=h3cIKETunNegoMode, h3cIKEGlobalInDropPkts=h3cIKEGlobalInDropPkts, H3cIKEIDType=H3cIKEIDType, H3cAuthAlgo=H3cAuthAlgo, h3cIKEInvalidIdTrapCntl=h3cIKEInvalidIdTrapCntl, h3cIKETunLocalValue1=h3cIKETunLocalValue1, h3cIKETunEncryptAlgo=h3cIKETunEncryptAlgo, h3cIKETunActiveTime=h3cIKETunActiveTime, h3cIKETunDiffHellmanGrp=h3cIKETunDiffHellmanGrp, h3cIKETunnelStatTableGroup=h3cIKETunnelStatTableGroup, h3cIKEGlobalRespTunnelFails=h3cIKEGlobalRespTunnelFails, h3cIKEGlobalInvalidCookieFails=h3cIKEGlobalInvalidCookieFails, h3cIKEIdInformation=h3cIKEIdInformation, h3cIKEInvalidSpiTrapCntl=h3cIKEInvalidSpiTrapCntl, h3cIKEGlobalOutP2Exchgs=h3cIKEGlobalOutP2Exchgs, h3cIKEGlobalInNotifys=h3cIKEGlobalInNotifys, h3cIKEGlobalOutP2ExchgRejects=h3cIKEGlobalOutP2ExchgRejects, h3cIKETunOutP2Exchgs=h3cIKETunOutP2Exchgs, h3cIKEGlobalInvalidProFails=h3cIKEGlobalInvalidProFails, h3cIKEProposalAdd=h3cIKEProposalAdd, h3cIKETunRemoteType=h3cIKETunRemoteType, h3cIKETunOutOctets=h3cIKETunOutOctets, h3cIKETunOutDropPkts=h3cIKETunOutDropPkts, h3cIKEInvalidProtocolFailure=h3cIKEInvalidProtocolFailure, H3cEncryptAlgo=H3cEncryptAlgo, h3cIKECertUnavailableTrapCntl=h3cIKECertUnavailableTrapCntl, h3cIKEUnsportExchTypeTrapCntl=h3cIKEUnsportExchTypeTrapCntl, H3cSaProtocol=H3cSaProtocol, h3cIKETunInP1SaDelRequests=h3cIKETunInP1SaDelRequests, h3cIKEInvalidIdFailure=h3cIKEInvalidIdFailure, h3cIKEGlobalInOctets=h3cIKEGlobalInOctets, h3cIKEGlobalInP2SaDelRequests=h3cIKEGlobalInP2SaDelRequests, h3cIKETrapGlobalCntl=h3cIKETrapGlobalCntl, h3cIKETunOutNotifys=h3cIKETunOutNotifys, h3cIKECompliance=h3cIKECompliance, h3cIKEGlobalUnsportExchTypeFails=h3cIKEGlobalUnsportExchTypeFails, h3cIKETunnelTableGroup=h3cIKETunnelTableGroup, h3cIKETunnelStartTrapCntl=h3cIKETunnelStartTrapCntl, h3cIKETunLocalAddr=h3cIKETunLocalAddr, h3cIKETunRemoteValue1=h3cIKETunRemoteValue1, h3cIKEGlobalInP2Exchgs=h3cIKEGlobalInP2Exchgs, h3cIKETunnelStopTrapCntl=h3cIKETunnelStopTrapCntl, h3cIKEGroups=h3cIKEGroups, h3cIKEAuthFailFailure=h3cIKEAuthFailFailure, h3cIKEGlobalOutNotifys=h3cIKEGlobalOutNotifys, h3cIKECompliances=h3cIKECompliances, h3cIKETunLifeTime=h3cIKETunLifeTime, h3cIKEGlobalInvalidSignFails=h3cIKEGlobalInvalidSignFails, h3cIKEGlobalCertTypeUnsuppFails=h3cIKEGlobalCertTypeUnsuppFails, h3cIKEGlobalInvalidIdFails=h3cIKEGlobalInvalidIdFails)
|
"""Perform any setup needed here.
"""
__author__ = 'dmontemayor'
|
print("Hello World")
print("Hello again.\n")
print("Hello BCC!")
print("My name is Andy.\n")
print("single 'quotes' <-- in double quotes")
print('double "quotes" <-- in single quotes\n')
print("Python docs @ --> https://docs/python.org/3")
print("Type --> python3 ex1.py <-- in terminal to run this program.\n")
# print("If you're reading this, it's because I un-commented the line.") |
#
# PySNMP MIB module Wellfleet-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-QOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:41:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
TimeTicks, Integer32, MibIdentifier, ModuleIdentity, iso, ObjectIdentity, Counter64, NotificationType, Gauge32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Counter32, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Integer32", "MibIdentifier", "ModuleIdentity", "iso", "ObjectIdentity", "Counter64", "NotificationType", "Gauge32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Counter32", "Bits")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
wfServicePkgGroup, = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfServicePkgGroup")
wfQosServPkgTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1), )
if mibBuilder.loadTexts: wfQosServPkgTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgTable.setDescription('This file describes the MIBS for managing Qos Templates')
wfQosServPkgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1), ).setIndexNames((0, "Wellfleet-QOS-MIB", "wfQosServPkgIndex"))
if mibBuilder.loadTexts: wfQosServPkgEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgEntry.setDescription('An entry in the Qos Base table')
wfQosServPkgDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgDelete.setDescription('Create/Delete parameter')
wfQosServPkgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgIndex.setDescription('Instance ID, filled in by driver')
wfQosServPkgServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgServiceName.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgServiceName.setDescription('Service Name given to this template')
wfQosServPkgScheduling = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("round-robin", 1), ("strict-priority", 2))).clone('round-robin')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgScheduling.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgScheduling.setDescription('Selects the scheduling method, Round Robbin or Strict Priority, to service the Tx Queues. In Round Robbin, each Queue is serviced according to the weights applied in the Queue Mib. In Strict Priority, the highest priority Queue with data is serviced.')
wfQosServPkgNumQueues = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgNumQueues.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgNumQueues.setDescription('Number of queues configured for this queue package')
wfQosServPkgNumLines = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgNumLines.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgNumLines.setDescription('Number of lines using this queue package')
wfQosServPkgQueCfgTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2), )
if mibBuilder.loadTexts: wfQosServPkgQueCfgTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgTable.setDescription('This file describes the MIBS for managing Qos Templates')
wfQosServPkgQueCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1), ).setIndexNames((0, "Wellfleet-QOS-MIB", "wfQosServPkgQueCfgServiceIndex"), (0, "Wellfleet-QOS-MIB", "wfQosServPkgQueCfgQueueIndex"))
if mibBuilder.loadTexts: wfQosServPkgQueCfgEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgEntry.setDescription('An entry in the Qos Base table')
wfQosServPkgQueCfgDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgDelete.setDescription('Create/Delete parameter')
wfQosServPkgQueCfgServiceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgQueCfgServiceIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgServiceIndex.setDescription('Instance Service ID, filled in by driver')
wfQosServPkgQueCfgQueueIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgQueCfgQueueIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgQueueIndex.setDescription('Instance Queue ID, filled in by driver')
wfQosServPkgQueCfgQueueName = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 4), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgQueueName.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgQueueName.setDescription('Queue Name given to this template')
wfQosServPkgQueCfgState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("waitPkg", 2), ("misCfg", 3))).clone('waitPkg')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgQueCfgState.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgState.setDescription('State of this Queue, either Up, Waiting for a Service Package, or Misconfigured.')
wfQosServPkgQueCfgClass = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7)).clone(7)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgClass.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgClass.setDescription('Class level for this queue, 0=highest, 7=lowest')
wfQosServPkgQueCfgAcctRule = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgAcctRule.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgAcctRule.setDescription('Accounting Rule Template Index.')
wfQosServPkgQueCfgRxCommitInfoRate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1536))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxCommitInfoRate.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxCommitInfoRate.setDescription('Commit Info Rate (CIR), in Kbits per second, configured for this template')
wfQosServPkgQueCfgRxBurstRate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1536))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstRate.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstRate.setDescription('Burst Rate (BR), in Kbits per second, configured for this template')
wfQosServPkgQueCfgRxBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 10), Integer32().clone(8000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstSize.setDescription('Burst Size, in bytes, configured for this template')
wfQosServPkgQueCfgRxBurstAction = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("downgrade", 2), ("mark", 3), ("mark-downgrade", 4))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstAction.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgRxBurstAction.setDescription('Action when Burst Rate is exceeded')
wfQosServPkgQueCfgTxDropThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("percent-83", 2), ("percent-66", 3), ("percent-50", 4))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxDropThresh.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxDropThresh.setDescription('Hardware Threshold in percent to start dropping Output Packets for this queue. When set to none, all packets are accepted until the Queue Fills 100 percent.')
wfQosServPkgQueCfgTxWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 13), Integer32().clone(100)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxWeight.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxWeight.setDescription('Weight in percentage for the Tx Queue when set to Round Robbin Priority Type.')
wfQosServPkgQueCfgTxActualWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 2, 1, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxActualWeight.setStatus('mandatory')
if mibBuilder.loadTexts: wfQosServPkgQueCfgTxActualWeight.setDescription('Actual Weight, in percentage, given to this Tx Queue within its Service Package when set to Round Robbin Scheduling.')
wfQueueStatTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3), )
if mibBuilder.loadTexts: wfQueueStatTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatTable.setDescription('This file describes the MIBS for getting Queues Stats')
wfQueueStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1), ).setIndexNames((0, "Wellfleet-QOS-MIB", "wfQueueStatPortLineNumber"), (0, "Wellfleet-QOS-MIB", "wfQueueStatLineIndex"), (0, "Wellfleet-QOS-MIB", "wfQueueStatQueueIndex"))
if mibBuilder.loadTexts: wfQueueStatEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatEntry.setDescription('An entry in the Queue Base table')
wfQueueStatPortLineNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatPortLineNumber.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatPortLineNumber.setDescription('Instance ID PortLineNumber')
wfQueueStatLineIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatLineIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatLineIndex.setDescription('Instance Line Number')
wfQueueStatQueueIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatQueueIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatQueueIndex.setDescription('Queue Index, matches that of wfQosServPkgQueCfgQueueIndex')
wfQueueStatTxOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatTxOctets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatTxOctets.setDescription('Number of Transmit Octets received without error')
wfQueueStatTxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatTxPackets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatTxPackets.setDescription('Number of Transmit Packets received without error')
wfQueueStatTxDrops = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatTxDrops.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatTxDrops.setDescription('Number of Transmit Packets Dropped')
wfQueueStatRxBelowCirOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxBelowCirOctets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxBelowCirOctets.setDescription('The number of octets received which were below the committed information rate (CIR).')
wfQueueStatRxBelowCirPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxBelowCirPackets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxBelowCirPackets.setDescription('The number of packets received which were below the committed information rate (CIR).')
wfQueueStatRxAboveCirOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxAboveCirOctets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxAboveCirOctets.setDescription('The number of octets received which exceeded the committed information rate, but which were within the allocated burst rate (BR).')
wfQueueStatRxAboveCirPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxAboveCirPackets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxAboveCirPackets.setDescription('The number of packets received which exceeded the committed information rate, but which were within the allocated burst rate (BR).')
wfQueueStatRxAboveBrOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxAboveBrOctets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxAboveBrOctets.setDescription('The number of octets received which exceeded the allocated burst rate (BR).')
wfQueueStatRxAboveBrPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 23, 1, 3, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfQueueStatRxAboveBrPackets.setStatus('mandatory')
if mibBuilder.loadTexts: wfQueueStatRxAboveBrPackets.setDescription('The number of packets received which exceeded the allocated burst rate (BR).')
mibBuilder.exportSymbols("Wellfleet-QOS-MIB", wfQosServPkgNumLines=wfQosServPkgNumLines, wfQosServPkgQueCfgTxActualWeight=wfQosServPkgQueCfgTxActualWeight, wfQueueStatTxDrops=wfQueueStatTxDrops, wfQueueStatTxOctets=wfQueueStatTxOctets, wfQosServPkgQueCfgRxBurstRate=wfQosServPkgQueCfgRxBurstRate, wfQosServPkgServiceName=wfQosServPkgServiceName, wfQosServPkgQueCfgQueueName=wfQosServPkgQueCfgQueueName, wfQosServPkgTable=wfQosServPkgTable, wfQosServPkgQueCfgTable=wfQosServPkgQueCfgTable, wfQosServPkgQueCfgTxDropThresh=wfQosServPkgQueCfgTxDropThresh, wfQosServPkgQueCfgAcctRule=wfQosServPkgQueCfgAcctRule, wfQosServPkgQueCfgRxBurstAction=wfQosServPkgQueCfgRxBurstAction, wfQueueStatEntry=wfQueueStatEntry, wfQueueStatRxBelowCirOctets=wfQueueStatRxBelowCirOctets, wfQueueStatRxBelowCirPackets=wfQueueStatRxBelowCirPackets, wfQueueStatRxAboveBrOctets=wfQueueStatRxAboveBrOctets, wfQueueStatTxPackets=wfQueueStatTxPackets, wfQosServPkgEntry=wfQosServPkgEntry, wfQosServPkgQueCfgRxBurstSize=wfQosServPkgQueCfgRxBurstSize, wfQosServPkgQueCfgState=wfQosServPkgQueCfgState, wfQosServPkgQueCfgTxWeight=wfQosServPkgQueCfgTxWeight, wfQosServPkgQueCfgServiceIndex=wfQosServPkgQueCfgServiceIndex, wfQosServPkgScheduling=wfQosServPkgScheduling, wfQosServPkgIndex=wfQosServPkgIndex, wfQueueStatRxAboveCirOctets=wfQueueStatRxAboveCirOctets, wfQosServPkgQueCfgClass=wfQosServPkgQueCfgClass, wfQueueStatLineIndex=wfQueueStatLineIndex, wfQueueStatRxAboveBrPackets=wfQueueStatRxAboveBrPackets, wfQueueStatQueueIndex=wfQueueStatQueueIndex, wfQosServPkgQueCfgDelete=wfQosServPkgQueCfgDelete, wfQosServPkgQueCfgQueueIndex=wfQosServPkgQueCfgQueueIndex, wfQueueStatPortLineNumber=wfQueueStatPortLineNumber, wfQosServPkgQueCfgEntry=wfQosServPkgQueCfgEntry, wfQosServPkgQueCfgRxCommitInfoRate=wfQosServPkgQueCfgRxCommitInfoRate, wfQosServPkgNumQueues=wfQosServPkgNumQueues, wfQueueStatRxAboveCirPackets=wfQueueStatRxAboveCirPackets, wfQueueStatTable=wfQueueStatTable, wfQosServPkgDelete=wfQosServPkgDelete)
|
class Solution:
"""
@param: nums: a list of integers
@return: find a majority number
"""
def majorityNumber(self, nums):
# write your code here
length = len(nums)
for i in range(int(length / 2) + 1):
count = 1
for j in range(i + 1, length):
if nums[i] == nums[j]:
count += 1
if count > length / 2:
return nums[i]
|
def main():
n = int(input('Number to count to: '))
fizzbuzz(n)
def fizzbuzz(n):
for number in range(1, n + 1):
if number % 5 == 0:
if number % 3 == 0:
print('FizzBuzz')
if number % 3 == 0:
print('Fizz')
elif number % 5 == 0:
print('Buzz')
else:
print(number)
if __name__ == "__main__":
main()
|
## setup MQTT
MQTT_BROKER = "" # Ip adress of the MQTT Broker
MQTT_USERNAME = "" # Username
MQTT_PASSWD = "" # Password
MQTT_TOPIC = "" # MQTT Topic
## setup RGB
NUMBER_OF_LEDS= 100 #int
|
# Copyright 2021 Nate Gay
#
# 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.
"rules_kustomize"
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@io_bazel_rules_docker//container:providers.bzl", "PushInfo")
# https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/images/
ImageInfo = provider(
doc = "Image modification information",
fields = {
"partial": "A yaml file containing kustomize image replacement info",
},
)
def _impl(ctx):
image_name = '{}/{}'.format(ctx.attr.image_details[PushInfo].registry, ctx.attr.image_details[PushInfo].repository)
output = '\n'.join([
'\\055 name: {}'.format(image_name if ctx.attr.image_name == '' else ctx.attr.image_name),
' newName: {}'.format(image_name),
' digest: $(cat {})'.format(ctx.attr.image_details[PushInfo].digest.path),
])
ctx.actions.run_shell(
inputs = [ctx.attr.image_details[PushInfo].digest],
outputs = [ctx.outputs.partial],
arguments = [],
command = 'printf "{}\n" > "{}"'.format(output, ctx.outputs.partial.path),
)
return [ImageInfo(partial = ctx.outputs.partial)]
kustomize_image_ = rule(
attrs = dicts.add({
"image_details": attr.label(
doc = "A label containing the container_push output for an image.",
cfg = "host",
mandatory = True,
allow_files = True,
providers = [PushInfo]
),
"image_name": attr.string(
mandatory = False,
default = "",
doc = "The name of the image to be modified.",
),
}),
implementation = _impl,
outputs = {
"partial": "%{name}.yaml.partial",
},
)
def kustomize_image(**kwargs):
kustomize_image_(**kwargs)
|
def parseFileTypes(rawTypes):
out = []
for rtype in rawTypes:
if isinstance(rtype, str):
out.append({'name': rtype, 'ext': rtype})
else:
assert 'name' in rtype
assert 'ext' in rtype
out.append({'name': rtype['name'], 'ext': rtype['ext']})
return out
|
class Solution(object):
def threeConsecutiveOdds(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
# Runtime: 32 ms
# Memory: 13.4 MB
for idx in range(len(arr) - 2):
if arr[idx] % 2 == 1 and arr[idx + 1] % 2 == 1 and arr[idx + 2] % 2 == 1:
return True
return False
|
def _syswrite(fh, scalar, length=None, offset=0):
"""Implementation of perl syswrite"""
if length is None and hasattr(scalar, 'len'):
length = len(scalar)-offset
if isinstance(scalar, str):
return os.write(fh.fileno(), scalar[offset:length+offset].encode())
elif isinstance(scalar, bytes):
return os.write(fh.fileno(), scalar[offset:length+offset])
else:
return os.write(fh.fileno(), str(scalar).encode())
|
keycode = {
'up': 72,
'down': 80,
'left': 75,
'right': 77,
'P': 25
} |
'''
Given two strings, determine if they share a common substring. A
substring may be as small as one character.
For example, the words "a", "and", "art" share the common substring .
The words "be" and "cat" do not share a substring.
'''
#this has the best runtime out of initial coding varieties
def twoStrings(s1, s2):
s1 = list(set(s1))
cache = {}
for i in s1:
cache[i] = 1
for i in s2:
if i in cache.keys():
return 'YES'
else:
pass
return 'NO' |
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
ans = 0
for i in range(0, len(S)):
if(J.find(S[i])!=-1):
ans += 1
return ans |
# This is an Adventure Game about The Digital Sweet Shop
# The program was written by Dr. Aung Win Htut
# Date: 04-03-2022
# Green Hackers Online Traing Courses
# 0-robot.py, 1-adgame3.py, 2-entershop.py, 3-ifelse2.py, 4-input.py, 5-ad62.py, 6-ad63.py
# The next few lines give the introduction
# Greetings my friend. if you want to go to the Digital Sweet Shop you must walk across
# the long street and turn left at the traffic lights. There is a large shopping centre
# on the corner. Turn left here and you will see the Digital Sweet Shop beside the flower
# shop. The flowershop owner has a dog called Biscuit who barks all the time. Be careful
# he can bite!
playerlives = 3
chocolate = 2
bonus = 0
numbercorrect = 0
print()
print()
print()
print(" Game Intro")
print(" ===========")
print("Greetings my friend. if you want to go to the Digital Sweet Shop you must walk across")
print("the long street and turn left at the traffic lights. There is a large shopping centre")
print("on the corner. Turn left here and you will see the Digital Sweet Shop beside the flower")
print("shop. The flowershop owner has a dog called Biscuit who barks all the time. Be careful")
print("he can bite!")
print()
print(" Welcome to the Digital Sweet Shop")
print()
print("You have been invited to take part in a competition in the shop.")
print("You must find the cholote room where you will be asked a question")
print("If you get it right you will receive letters which are part of a password and a clue.")
print()
print()
print("At the end you must figure out the password and use it to open the ")
print("treasure chest wich contains a year's supply of all your favourite sweets. ")
print("You will meet two people - one is the sweet owner who wants to steal the password so he can keep the sweets ")
print(" W E L C O M E T O T H E D I G I T A L S W E E T S H O P ")
print()
playername = input('What is your name: ')
playerage = int(input('How old are you: '))
print('Your name is ' + playername)
print('Your age is ' + str(playerage))
print()
if playerage >= 8 and playerage <= 12:
print("You can play the game!")
print()
print()
print("You can give the two people in the story names ")
ownername = input("Please enter owner name: ")
robotname = input("Please enter robot name: ")
print()
print()
# Enter the shop??
print("You walk up the steps to the shop....you open the door. There is nobody there")
print("and the shop looks to be in bad repair. ")
enterroom = input("Will you enter the room? : ")
if enterroom == "Y" or enterroom == "y":
print()
print()
print("You have reached the top of the stairs and you can go right or left")
direction = input("Left or Right? : ")
if direction == "R" or direction == "r":
print()
print()
print("You have fallen through the hole in the floor and lost a life - ")
print(" you must start again! GameOver")
elif direction == "L" or direction == "l":
print()
print()
print("You are standing at the door of the Chocolate room!")
print()
print()
print("-----------------------------------------------------------------")
print(
"The door opens and someone is standing there. It is the robot " + robotname)
print(
"He tells you that you cannot enter unless you show that you know all about secure passwords.")
print("He asks you a question")
print()
print()
print("Hello " + playername +
" Which of the following would be a good strong password?")
print("If you answer correctly he will give two bars of chocolate")
print("1 DigitalSweetShop, 2 Botty, 3 N*123MGx*")
print()
# enter a print statement which will tell the user to enter a number between 1 and 3
playerchoice = input("Please enter your choice: ")
# enter an if statement to check if playeranswer is equal to 3
if playerchoice == "3":
# enter an assignment statement to increase chocolate by 2
chocolate = chocolate + 2
# enter a print statement to say "You have got two bars of chocolate, open the wrappers to see the two letters"
print()
print()
print(
"You have got two bars of chocolate, open the wrappers to see the two letters")
# enter another print statement to say "You have letters A and R - memorise these"
print("You have letters A and R - memorise these")
# MEETING THE OWNER
print()
print()
print(
"Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is " + ownername)
print("You must answer this question.")
print()
# add an input statement to ask the question on the next line and store the response in a variable called answer
# "Which of the following could be used as a good password"
# "1. Your pet's name. 2. Password123 3. A random collection of numbers and letters?"
# HINT : User answer = int(input(.......))
print("Which of the following could be used as a good password")
print(
"1. Your pet's name. 2. Password123 3. A random collection of numbers and letters?")
print()
answer = int(input("Please Choose 1,2,3: "))
if answer == 3:
chocolatebar = int(
input("Do you want chocolate bar 1 or 2? "))
if chocolatebar == 1:
print()
print()
print(
"Hard luck, you lOse a life and there is no information in the wrapper. GameOver")
playerlives = playerlives - 1
# add code to check if the chocolate bar is equal to 1
# ---> add code to print this message to the user "Hard luck, you lse a life and there is no information in the wrapper"
# ---> add code to subtract 1 from the player lives
elif chocolatebar == 2:
print()
print()
print(
"OK - you can have the chocolate bar and the letter in the wrapper is T")
# the player must try to guess the password
print("Now you must enter each letter that you remember ")
print("You will be given 3 times")
# add code here for a while loop using that counts from 1 to 3, so player has 3 guesses:
i = 0
while i < 3:
i = i + 1
letter = input("Try number " + str(i)+" : ")
if letter == "A" or letter == "R" or letter == "T" or letter == "a" or letter == "r" or letter == "t":
numbercorrect = numbercorrect + 1
print("CORRECT - welldone")
else:
print("Wrong - sorry")
print()
print()
guess = input(
"NOW try and guess the password **** - the clue is in this line four times. Use the letters you were gives to help : ")
if guess == "star":
print()
print()
print(
"You are a star - you have opened the treasure chest of sweets and earned 1000 points")
bonus = 1000
score = (chocolate * 50) + (playerlives * 60) + bonus
# add code here to output playername
# add code here to output the number of bars of chocolate the player has
# add code here to output number of lives he player has
# add code here to output number of bonus points the player has
# add code here to output the player's score
print("Finally you won the game!!!")
print()
print()
print("Game Data")
print("----------")
print("Player Name : " + playername)
print("Total Chocolate Bar = " + str(chocolate))
print("Playerlives = " + str(playerlives))
print("Bonus point = " + str(bonus))
print("Player's Score = " + str(score))
# you won the game !!!!
# end
else:
print(
"Wrong answer - you lose a life and all of your chocolate and GameOver")
chocolate = 0
playerlives = playerlives - 1
# add code to set the chocolate value to 0
# add code to subtract 1 from player lives
# enter else:
else:
# enter a print statement to say "You have not guessed correctly so you have lost a life"
print("You have not guessed correctly so you have lost a life")
playerlives = playerlives - 1
elif direction == "S" or direction == "s":
print("wrong room!")
else:
print("You are a coward!!!...Goodbye, GameOver")
else:
print(playername+"You are not the correct age to play this game!!! Sorry !! ")
|
class Solution(object):
def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
counter = 1
for i in range(len(nums)-1):
counter -= 1
counter = max(counter,nums[i])
if counter <= 0:
return False
return True |
# @Title: 两两交换链表中的节点 (Swap Nodes in Pairs)
# @Author: KivenC
# @Date: 2019-01-27 18:19:05
# @Runtime: 44 ms
# @Memory: 6.5 MB
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
pre = None
cur = head
count = 1
while cur:
if count % 2 == 1:
temp = cur
else:
if pre is None:
head = cur
else:
pre.next = cur
temp.next = cur.next
cur.next = temp
pre = temp
count += 1
cur = temp.next
return head
|
class Solution:
def longestPalindrome(self, s: 'str') -> 'str':
if len(s) <= 1:
return s
start = end = 0
length = len(s)
for i in range(length):
max_len_1 = self.get_max_len(s, i, i + 1)
max_len_2 = self.get_max_len(s, i, i)
max_len = max(max_len_1, max_len_2)
if max_len > end - start:
start = i - (max_len - 1) // 2
end = i + max_len // 2
return s[start: end+1]
def get_max_len(self, s: 'list', left: 'int', right: 'int') -> 'int':
length = len(s)
while left >= 0 and right < length and s[left] == s[right]:
left -= 1
right += 1
return right - left - 1
|
class Patient:
def __init__(self, pathology, gender, weight, height, images):
self.pathology = pathology
self.gender = gender
self.weight = weight
self.height = height
self.images = images |
class Solution(object):
def numSpecialEquivGroups(self, A):
"""
:type A: List[str]
:rtype: int
"""
st = set()
for s in A:
lstA = []
lstB = []
for i in range(len(s)):
if i % 2 == 0:
lstA.append(s[i])
else:
lstB.append(s[i])
lstA = sorted(lstA)
lstB = sorted(lstB)
st.add(''.join(lstA) + ':' + ''.join(lstB))
return len(st)
|
def determinant_recursive(A, total=0):
# Store indices in list for row referencing
indices = list(range(len(A)))
# When at 2x2, submatrices recursive calls end
if len(A) == 2 and len(A[0]) == 2:
val = A[0][0] * A[1][1] - A[1][0] * A[0][1]
return val
# Define submatrix for focus column and call this function
for fc in indices:
As = A
As = As[1:]
height = len(As)
for i in range(height):
As[i] = As[i][0:fc] + As[i][fc+1:]
sign = (-1) ** (fc % 2)
# Recursive Call for matrix without the focus column
sub_det = determinant_recursive(As)
# All returns from recursion
total += sign * A[0][fc] * sub_det
return total
R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))
matrix = []
print("Enter the entries rowwise:")
for i in range(R): # A for loop for row entries
a = []
for j in range(C): # A for loop for column entries
a.append(int(input()))
matrix.append(a)
if R==C:
print(determinant_recursive(matrix))
else:
print("Try Again!")
|
__all__ = [
"_is_ltag",
"_is_not_ltag",
"_is_rtag",
"_is_not_rtag",
"_is_tag",
"_is_not_tag",
"_is_ltag_of",
"_is_not_ltag_of",
"_is_rtag_of",
"_is_not_rtag_of",
"_is_pair_of",
"_is_not_pair_of",
"_is_not_ltag_and_not_rtag_of"
]
####
def _is_ltag(tag,tag_pairs):
cond = (tag in tag_pairs)
return(cond)
def _is_not_ltag(tag,tag_pairs):
return(not(_is_ltag(tag,tag_pairs)))
def _is_rtag(tag,tag_pairs):
cond = (tag in list(tag_pairs.values()))
return(cond)
def _is_not_rtag(tag,tag_pairs):
return(not(_is_rtag(tag,tag_pairs)))
def _is_tag(tag,tag_pairs):
cond1 = (tag in tag_pairs)
cond2 = (tag in list(tag_pairs.values()))
return((cond1 or cond2))
def _is_not_tag(tag,tag_pairs):
return(not(_is_tag(tag,tag_pairs)))
def _is_ltag_of(tag1,tag2,tag_pairs):
cond = (tag_pairs[tag1] == tag2)
return(cond)
def _is_not_ltag_of(tag1,tag2,tag_pairs):
return(not(is_ltag_of(tag1,tag2,tag_pairs)))
def _is_rtag_of(tag1,tag2,tag_pairs):
cond = (tag_pairs[tag2] == tag1)
return(cond)
def _is_not_rtag_of(tag1,tag2,tag_pairs):
return(not(_is_rtag_of(tag1,tag2,tag_pairs)))
def _is_pair_of(tag1,tag2,tag_pairs):
cond1 = _is_ltag_of(tag1,tag2,tag_pairs)
cond2 = _is_rtag_of(tag1,tag2,tag_pairs)
return((cond1 or cond2))
def _is_not_pair_of(tag1,tag2,tag_pairs):
return(not(_is_pair_of(tag1,tag2,tag_pairs)))
#####
def _is_not_ltag_and_not_rtag_of(tag1,tag2,tag_pairs):
cond1 = _is_not_ltag(tag1,tag_pairs)
cond2 = _is_not_rtag_of(tag1,tag2,tag_pairs)
return((cond1 and cond2))
#####
|
int_const = 5
bool_const = True
string_const = 'abc'
unicode_const = u'abc'
float_const = 1.23 |
class Foo:
"""docstring"""
@property
def prop1(self) -> int:
"""docstring"""
@classmethod
@property
def prop2(self) -> int:
"""docstring"""
|
a, b = input().split()
new_a = ''
new_b = ''
new_a += a[2]
new_a += a[1]
new_a += a[0]
new_b += b[2]
new_b += b[1]
new_b += b[0]
if int(new_a) > int(new_b):
print(int(new_a))
else:
print(int(new_b))
# 거꾸로 뒤집기
# print(a[::-1])
# print("".join(reversed(a))) |
# 面试题 17.10. 主要元素
# 数组中占比超过一半的元素称之为主要元素。给你一个 整数 数组,找出其中的主要元素。若没有,返回 -1 。请设计时间复杂度为 O(N) 、空间复杂度为 O(1) 的解决方案。
# 示例 1:
# 输入:[1,2,5,9,5,9,5,5,5]
# 输出:5
# 示例 2:
# 输入:[3,2]
# 输出:-1
# 示例 3:
# 输入:[2,2,1,1,1,2,2]
# 输出:2
# 通过次数56,453提交次数99,866
def majorityElement(nums):
candidate = -1
count = 0
for num in nums:
if count == 0:
candidate = num
count += 1
if num == candidate:
count += 1
else:
count -= 1
count = 0
n = len(nums)
for num in nums:
if num == candidate:
count += 1
return candidate if count > n//2 else -1
if __name__ == "__main__":
nums = [1,2,5,9,5,9,5,5,5]
print(majorityElement(nums)) |
#Даны цифры двух десятичных целых чисел: трехзначного и двузначного , где а1 и в1 – число единиц, а2 и в2 – число десятков,а3 – число сотен. Получить цифры числа, равного сумме заданных чисел (известно, что это число трехзначное). Числа-слагаемые и число-результат не определять; условный оператор не использовать.
a1 = int(input('a1-число единиц='))
a2 = int(input('a2-число десятков='))
a3 = int(input('a3-число сотен'))
b1 = int(input('b1-число единиц= '))
b2 = int(input('b2-число десятков='))
a = a1 / 100
b = b2 / 10
c = a3 % 100 % 10
s = a + b + c
print('Полученные цифры числа',s)
|
'''
https://practice.geeksforgeeks.org/problems/subarray-with-given-sum/0/?ref=self
Given an unsorted array of non-negative integers, find a
continuous sub-array which adds to a given number.
Input:
The first line of input contains an integer T denoting the number of test cases.
Then T test cases follow. Each test case consists of two lines.
The first line of each test case is N and S, where N is the size of array and S is the sum.
The second line of each test case contains N space separated integers denoting the array
elements
'''
def find_contiguous_adds_to(A, s):
if len(A) == 0:
return -1
elif len(A) == 1:
return (0,0) if A[0] == s else -1
curSum = A[0]
start = 0
end = 1
while start <= end and curSum <= s and end < len(A):
if curSum + A[end] < s:
curSum += A[end]
end += 1
elif curSum + A[end] == s:
curSum += A[end]
return start + 1, end + 1
else:
curSum -= A[start]
start += 1
return -1
def find_contiguous_posneg_adds_to(A, s):
if len(A) == 0:
return -1
elif len(A) == 1:
return (0,0) if A[0] == s else -1
sumMap = dict()
curSum = 0
for i, num in enumerate(A):
curSum += num
if curSum == s:
return (0, i)
elif sumMap.get(curSum - s, None) is not None:
return sumMap.get(curSum - s) + 1, i
#if value of difference between current sum and s is in map, exclude that value (subtract it)
#and return index of solution as 1+ index of subarray from 0..A[sumMap[curSum - s]]
sumMap[curSum] = i
if __name__ == '__main__':
A = [1,2,-3, 3, 3, 7,5]
s = 12
#print(find_contiguous_adds_to(A,s))
print(find_contiguous_posneg_adds_to(A,s))
|
"""
Given a string, compute recursively (no loops) the number of lowercase 'x' chars in the string.
countX("xxhixx") → 4
countX("xhixhix") → 3
countX("hi") → 0
"""
def countX_for(s):
if len(s):
for i in range (0, len(s)):
if s[i] == 'x':
return 1 + countX(s[i + 1:])
return 0
else:
return 0
def countX(s):
if len(s) == 0:
return 0
else:
if s[0] == 'x':
return 1 + countX(s[1:])
else:
return 0 + countX(s[1:])
print(countX("xxx"), countX("xxhixx"), countX("xhixhix"), countX("hi")) |
class Solution(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and not (n & (n - 1))
class Solution2(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and (2 ** 30) % n == 0
class Solution3(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
if n <= 0:
return False
number = n
while number > 1:
if number & 1 == 1:
break
number >>= 1
return number == 1
|
messageResources = {}
messageResources['it'] = {
'browse':'Sfoglia',
'play':'Play',
'open.file':'Apri file',
'file':'File',
'edit':'Modifica',
'audio':'Audio',
'video':'Video',
'open':'Apri...',
'quit':'Esci',
'clear.file.list':'Cancella la lista dei file',
'output.audio':'Uscita audio',
'hdmi':'HDMI',
'local':'Locale',
'both':'Entrambe',
'adjust.framerate':'Regola framerate/risoluzione allo schermo',
'background.black':'Imposta lo sfondo nero',
}
messageResources['en'] = {
'browse':'Browse',
'play':'Play',
'open.file':'Open file',
'file':'File',
'edit':'Edit',
'audio':'Audio',
'video':'Video',
'open':'Open',
'quit':'Quit',
'clear.file.list':'Clear file list',
'output.audio':'Output audio',
'hdmi':'HDMI',
'local':'local',
'both':'both',
'adjust.framerate':'Adjust framerate/resolution to video',
'background.black':'Set background to black',
} |
def simple(request):
return {
'simple': {
'boolean': True,
'list': [1, 2, 3],
}
}
def is_authenticated(request):
is_authenticated = request.user and request.user.is_authenticated
if callable(is_authenticated):
is_authenticated = is_authenticated()
return {
'is_authenticated': is_authenticated,
}
|
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
def nome_e_atributos_de_classe(cls):
return f'{cls} - olhos {cls.olhos}'
if __name__ == '__main__':
weber = Pessoa(nome='weber')
luciano = Pessoa(weber, nome='luciano', idade=40)
print(Pessoa.cumprimentar(weber))
print(id(weber))
print(weber.cumprimentar())
print(weber.nome)
print(luciano.nome)
print(weber.idade)
for filho in luciano.filhos:
print(filho.nome)
weber.sobrenome= 'de paula'
del luciano.filhos
print(luciano.__dict__)
print(weber.__dict__)
Pessoa.olhos = 3
print(luciano.olhos)
print(weber.olhos)
print(id(Pessoa.olhos), id(luciano.olhos), id(weber.olhos))
print(Pessoa.metodo_estatico(), luciano.metodo_estatico())
print(Pessoa.nome_e_atributos_de_classe(), luciano.nome_e_atributos_de_classe())
|
class Generating:
def __init__(self, node):
self._node = node
def generatetoaddress(self, nblocks, address, maxtries=1): # 01
return self._node._rpc.call("generatetoaddress", nblocks, address, maxtries)
|
"""Tools
"""
def _create_dirtree(a,chunksize=2):
"""create a directory tree from a single, long name
e.g. "12345" --> ["1", "23", "45"]
"""
b = a[::-1] # reverse
i = 0
l = []
while i < len(b):
l.append(b[i:i+chunksize])
i += chunksize
return [e[::-1] for e in l[::-1]]
def _short(name, value):
'''Output short string representation of parameter and value.
Used for automatic folder name generation.'''
# Store the param value as a string
# Remove the plus sign in front of exponent
# Remove directory slashes, periods and trailing .nc from string values
value = "%s" % (value)
if "+" in value: value = value.replace('+','')
if "/" in value: value = value.replace('/','')
if ".." in value: value = value.replace('..','')
if ".nc" in value: value = value.replace('.nc','')
# Remove all vowels and underscores from parameter name
name = name
for letter in ['a','e','i','o','u','A','E','I','O','U','_']:
name = name[0] + name[1:].replace(letter, '')
return ".".join([name,value])
def autofolder(params):
'''Given a list of (name, value) tuples,
generate an appropriate folder name.
'''
parts = []
for p in params:
parts.append( _short(*p) )
return '.'.join(parts)
|
"""Project metadata."""
package = "humilis_secrets_vault"
project = "humilis-secrets-vault"
version = '0.2.4'
description = "Humilis layer that deploys a secrets vault"
authors = ["German Gomez-Herrero"]
authors_string = ', '.join(authors)
emails = ["german@findhotel.net"]
license = "MIT"
copyright = "2016 FindHotel BV"
url = 'http://github.com/humilis/humilis-secrets-vault'
|
##
# \namespace cross3d.classes.valuerange
#
# \remarks This module holds the ValueRange class to handle value ranges.
#
# \author douglas
# \author Blur Studio
# \date 02/17/16
#
#------------------------------------------------------------------------------------------------------------------------
class ValueRange(list):
def __init__(self, *args):
"""
\remarks Initialize the class.
"""
args = list(args)
if not len(args) == 2:
raise TypeError('ValueRange object takes two floats. You provided {} arguments.'.format(len(args)))
try:
args[0] = float(args[0])
args[1] = float(args[1])
except ValueError:
raise TypeError('ValueRange object takes two floats.')
super(ValueRange, self).__init__(args)
def __repr__(self):
"""
\remarks Affects the class representation.
"""
return 'cross3d.ValueRange( %s, %s )' % (self[0], self[1])
def __eq__(self, other):
if isinstance(other, ValueRange):
return self[0] == other[0] and self[1] == other[1]
return False
def __mult__(self, other):
if isinstance(other, (float, int)):
return ValueRange(self[0] * other, self[1] * other)
raise ValueError('Unable to multiply a ValueRange by {}.'.format(str(type(other))))
def __nonzero__(self):
return bool(self.duration())
def round(self):
self[0] = round(self[0])
self[1] = round(self[1])
def rounded(self):
return ValueRange(round(self[0]), round(self[1]))
def string(self, separator='-'):
"""
\remarks Returns the range in its string form.
\param separator <string>
"""
return '%i%s%i' % (self[0], separator, self[1])
def start(self):
return self[0]
def end(self):
return self[1]
def duration(self):
return self[1] - self[0] + 1
def isWithin(self, valueRange):
if self[0] >= valueRange[0] and self[1] <= valueRange[1]:
return True
return False
def contains(self, valueRange):
if self[0] <= valueRange[0] and self[1] >= valueRange[1]:
return True
return False
def offsets(self, valueRange):
return ValueRange((valueRange[0] - self[0]), (valueRange[1] - self[1]))
def overlaps(self, valueRange, tolerance=0):
"""
\remarks Returns weather the ranges overlaps.
\param separator <string>
"""
if self[0] + tolerance >= valueRange[1] or self[1] - tolerance <= valueRange[0]:
return False
return True
def extends(self, valueRange):
"""
\remarks Returns weather the range includes additional frames.
"""
return self[0] < valueRange[0] or self[1] > valueRange[1]
def overlap(self, valueRange):
"""
\remarks Returns the overlaping range if any.
"""
if self.overlaps(valueRange):
if self[0] < valueRange[0]:
start = valueRange[0]
else:
start = self[0]
if self[1] > valueRange[1]:
end = valueRange[1]
else:
end = self[1]
return ValueRange(start, end)
else:
None
def multiplied(self, multiplier):
return ValueRange(self[0] * multiplier, self[1] * multiplier)
def merged(self, valueRange):
"""
\remarks Returns a range that covers both framerange.
"""
return ValueRange(min(self[0], valueRange[0]), max(self[1], valueRange[1]))
def padded(self, padding):
"""
\remarks Returns the padded range.
"""
if isinstance(padding, (list, tuple)) and len(padding) >= 2:
return ValueRange(self[0] - padding[0], self[1] + padding[1])
return ValueRange(self[0] - padding, self[1] + padding)
def offseted(self, offset):
"""
\remarks Returns the offset range.
"""
return ValueRange(self[0] + offset, self[1] + offset)
|
def draw_line(tick_length, tick_label=''):
"""Draw one line with given tick length (followed by optional label)"""
line = '-' * tick_length
if tick_label:
line += ' ' + tick_label
print(line)
def draw_interval(center_length):
"""Draw tick interval based upon a central tick length"""
if center_length > 0: # stop when length drops to 0
draw_interval(center_length - 1) # recursively draw top ticks
# print("Top ticks", center_length)
draw_line(center_length) # draw center tick
# print("Bottom ticks", center_length)
draw_interval(center_length - 1) # recursively draw bottom ticks
def draw_ruler(num_inches, major_length):
"""Draw English ruler with given number of inches, major tick length"""
draw_line(major_length, '0') # draw inch 0 line
for j in range(1, 1 + num_inches):
draw_interval(major_length - 1) # draw interior ticks for inch
draw_line(major_length, str(j)) # draw inch j line and label
draw_ruler(1, 3)
"""
Another interesting question is how many dashes are printed during that process.
Prove by induction that the number of dashes printed by draw_interval(c) is (2^c+1) − c − 2.
Proporcionamos una prueba formal de esta afirmación por inducción (consulte la Sección 3.4.3). De hecho,
la inducción es una técnica matemática natural para demostrar la exactitud y eficiencia de un proceso recursivo.
En el caso de la regla, observamos que una aplicación del draw_interval(0) no genera salida y que 2 ^ 0−1 = 1−1 = 0.
Esto sirve como un caso base para nuestra afirmación.
De manera más general, el número de líneas impresas por draw_interval(c) es uno más del doble del número
generado por una llamada a draw_interval(c-1), ya que se imprime una línea central entre dos llamadas recursivas de este tipo.
Por inducción, tenemos que el número de líneas es entonces 1 + 2 * (2 ^ c − 1 - 1) = 1 + 2 ^ c - 2 = 2 ^ c - 1.
""" |
# -*- coding: utf-8 -*-
"""Top-level package for ebr-trackerbot."""
__project__ = "ebr-trackerbot"
__author__ = "Milan Hradil"
__email__ = "milan.hradil@tomtom.com"
__version__ = "0.1.5-dev"
|
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 12 01:33:53 2019
@author: Caio
"""
#Taxa Selic
taxaselic=(5.5/36500) # ( 5.5/100 ) 365 para transformar de ano para dia
#Tabela regressiva do IR
IR1=22.5/100
IR2=20/100
IR3=17.5/100
IR4=15/100
IOF=1
Valoraplicado=float(input('Insira o valor aplicado'))
tempoaplicadoemdias=int(input('Insira o número de dias que o valor ficou aplicado'))
#Estrutura condicional para estabelecer o cálculo do IR
#para os dias que o valor ficou rendendo na SELIC
if ((tempoaplicadoemdias)<180):
valorfinal = Valoraplicado + (Valoraplicado * tempoaplicadoemdias * IR1 * taxaselic)
print(valorfinal)
if ((tempoaplicadoemdias)>180 and (tempoaplicadoemdias)<360):
valorfinal = Valoraplicado + (Valoraplicado * tempoaplicadoemdias * IR2 * taxaselic)
print(valorfinal)
if ((tempoaplicadoemdias)>180 and (tempoaplicadoemdias)<720):
valorfinal = Valoraplicado + (Valoraplicado * tempoaplicadoemdias * IR3 * taxaselic)
print(valorfinal)
if ((tempoaplicadoemdias)>(720)):
valorfinal = Valoraplicado + (Valoraplicado * tempoaplicadoemdias * IR4 * taxaselic)
print(valorfinal)
|
n_h1=100
n_h2=100
n_h3=100
batch_size=20
|
class URI:
prefix = {
'dbpedia': 'http://dbpedia.org/page/',
'dbr': 'http://dbpedia.org/resource/',
'dbo': 'http://dbpedia.org/ontology/',
'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',
'xsd': 'http://www.w3.org/2001/XMLSchema#',
'dt': 'http://dbpedia.org/datatype/',
}
def __init__(self, prefix, suffix):
if prefix in URI.prefix:
self.prefix = prefix
else:
raise Exception('Unknown prefix "{:s}"!'.format(prefix))
self.suffix = suffix
@classmethod
def parse(cls, uri, fallback_prefix=None):
if uri.startswith('http://'):
for prefix_short, prefix_long in URI.prefix.items():
if uri.startswith(prefix_long):
suffix = uri.replace(prefix_long, '')
return URI(prefix_short, suffix)
else:
raise Exception('Unknown prefix in "{:s}"!'.format(uri))
else:
if ':' in uri:
prefix, suffix = uri.split(':', 1)
if prefix in URI.prefix:
return URI(prefix, suffix)
if fallback_prefix is None:
raise Exception('Ambiguous URI "{:s}"!'.format(uri))
else:
return URI(fallback_prefix, uri)
def __str__(self):
return self.short()
def short(self):
return '{:s}:{:s}'.format(self.prefix, self.suffix)
def long(self):
return '{:s}{:s}'.format(
URI.prefix[self.prefix], self.suffix
)
|
class Solution:
def myPow(self, x: float, n: int) -> float:
if n < 0:
val = 1 / self._myPow(x, -n)
else:
val = self._myPow(x, n)
return val
def _myPow(self, x: float, n: int) -> float:
if n == 1:
return x
if n == 0:
return 1
else:
half = n // 2
remainder = n - 2 * half
val = self._myPow(x, half)
val *= val
if remainder > 0:
val *= x
return val
|
#1. Idea is we use a stack, where each element in the stack is a list, the list contains the current string and current repeat value, we know it is the current string because we have not yet hit a closed bracket because once we hit the closed bracket we pop off.
#2. Initialize a stack which contains an empty string and int 1. This is just our final element in the stack which we need to return.
#3. Iterate through the string, we do k * 10 + int(i) because in this would be the best way to get values numerical values greater than 1 digit.
#4. Next we see if we have a open bracket, if we do that means we start a new list and we will build the string in this list until we hit a closing bracket, we also add the k value, remember to reset the k value at this step also for each new list.
#5. Finally, if we hit a closing bracket we assign two variables, one wil hold the string the other will hold the numerical value we will then mutliply that string and add it to our previous stack list element, this is how we continously build our string but adding the previous lists strings in the stack.
#6. If we have simple character then just add it onto the current string portion of the list at the top of the stack.
#7. Return the string portion of the last element in the stack which will hold the decoded list.
def decodeString(self, s):
stack = [["", 1]]
k = 0
for i in s:
if i.isdigit():
k = k * 10 + int(i)
elif i == '[':
stack.append(["", k])
k = 0
elif i == ']':
char_string, repeat_val = stack.pop()
stack[-1][0] += char_string * repeat_val
else:
stack[-1][0] += i
return stack[-1][0] |
T = int(input())
for _ in range(T):
h = 1
for i in range(int(input())):
if i % 2 == 0:
h *= 2
else:
h += 1
print(h)
|
class Queue(object):
def __init__(self):
self.queue = []
self.size = 0
def isEmpty(self):
return self.queue == []
def enqueue(self, item):
self.queue.insert(0, item)
self.size += 1
def dequeu(self):
if not self.isEmpty():
self.size -= 1
return self.queue.pop()
else:
return "The queue is already empty"
def queue_size(self):
return self.size |
class HttpListenerTimeoutManager(object):
# no doc
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return HttpListenerTimeoutManager()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
DrainEntityBody=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: DrainEntityBody(self: HttpListenerTimeoutManager) -> TimeSpan
Set: DrainEntityBody(self: HttpListenerTimeoutManager)=value
"""
EntityBody=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: EntityBody(self: HttpListenerTimeoutManager) -> TimeSpan
Set: EntityBody(self: HttpListenerTimeoutManager)=value
"""
HeaderWait=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: HeaderWait(self: HttpListenerTimeoutManager) -> TimeSpan
Set: HeaderWait(self: HttpListenerTimeoutManager)=value
"""
IdleConnection=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IdleConnection(self: HttpListenerTimeoutManager) -> TimeSpan
Set: IdleConnection(self: HttpListenerTimeoutManager)=value
"""
MinSendBytesPerSecond=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: MinSendBytesPerSecond(self: HttpListenerTimeoutManager) -> Int64
Set: MinSendBytesPerSecond(self: HttpListenerTimeoutManager)=value
"""
RequestQueue=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: RequestQueue(self: HttpListenerTimeoutManager) -> TimeSpan
Set: RequestQueue(self: HttpListenerTimeoutManager)=value
"""
|
#!/usr/bin/env python
ord_numbers = []
for i in range(1,50):
ord_numbers.append(i)
print(ord_numbers)
for j in ord_numbers:
if j == 13:
continue
elif j > 39:
break
else:
print(j)
|
doc(title="PaddlePaddle Use-Cases",
underline_char="=",
entries=[
"resnet50/paddle-resnet50.rst",
"ssd/paddle-ssd.rst",
"tsm/paddle-tsm.rst",
])
|
def generate_worklist(n, n_process, generate_mode="random", time_weights=None):
works_type = {}
works = []
if generate_mode == "random":
minimum_time = 10
maximum_time = 300
reset_time_weights_prob = 0.05
time_weights = [random.randint(minimum_time, maximum_time) for i in range(n_process)]
type_name = time.time()
works_type[type_name] = {"time":time_weights, "sort":[[] for np in range(N_PROCESS-1)]}
for i in range(n):
work = {}
work["type"] = type_name
work["time"] = []
for tw in time_weights:
tmp = np.random.normal(tw, np.log(tw))
if tmp < 0:
tmp = 0
work["time"].append(tmp)
if random.random() < reset_time_weights_prob:
time_weights = [random.randint(minimum_time, maximum_time) for i in range(n_process)]
type_name = time.time()
works_type[type_name] = {"time":time_weights, "sort":[[] for np in range(N_PROCESS-1)]}
works.append(work)
return works, works_type
def get_conveyor(works):
n_work, n_process_seq = works.shape
conveyor = np.zeros((n_work, n_process_seq+(n_work-1)))
conveyor_mask = np.zeros((n_work, n_process_seq+(n_work-1)))
index = np.zeros((n_work, n_process_seq)).astype(np.int32)
index_process_seq = np.arange(n_process_seq)
index_work = np.arange(n_work)
index += index_process_seq
index += index_work.reshape(-1, 1)
conveyor[index_work.reshape(-1,1), index] += works
conveyor_mask[index_work.reshape(-1, 1), index] += 1
return conveyor, conveyor_mask
def cal_conveyor_time(conveyor):
return sum(np.amax(conveyor, axis=0))
def cal_works_time(works):
return cal_conveyor_time(get_conveyor(works))
|
class Node:
def __init__(self, item):
self.item = item
self.left = None
self.right = None
class BinaryTree:
def __init__(self, root):
self.root = root
def insert(self, root, node):
if node.item < root.item:
if not root.left:
root.left = node
else:
self.insert(root.left, node)
else:
if not root.right:
root.right = node
else:
self.insert(root.right, node)
def visit(self, node):
print(node.item)
def inorder(self, root):
if root.left:
self.inorder(root.left)
self.visit(root)
if root.right:
self.inorder(root.right)
def max_depth(self, root):
# leaf node
if not root:
return 0
return 1 + max(self.max_depth(root.left), self.max_depth(root.right))
t = BinaryTree(Node(10))
t.insert(t.root, Node(11))
t.insert(t.root, Node(2))
t.insert(t.root, Node(-1))
t.insert(t.root, Node(7))
t.insert(t.root, Node(17))
t.inorder(t.root)
print(t.max_depth(t.root))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.