content
stringlengths 7
1.05M
|
---|
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
list = []
num = int(input('check wich number is smaller than : '))
for x in a:
if x < num:
list.append(x)
# print(x)
print(list)
|
# Write a function named combine_sort that has two parameters named lst1 and lst2.
# The function should combine these two lists into one new list and sort the result. Return the new sorted list.
#print(combine_sort([4, 10, 2, 5], [-10, 2, 5, 10]))
def combine_sort(lst1, lst2):
new_lst = lst1 + lst2
return sorted(new_lst)
print(combine_sort([4, 10, 2, 5], [-10, 2, 5, 10]))
|
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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.
#
# NOTE: This class is auto generated by the jdcloud code generator program.
class TranscodeInfo(object):
def __init__(self, videoCodec=None, videoCodeRate=None, videoFrameRate=None, width=None, height=None, template=None, templateName=None, audioCodec=None, audioFormat=None, audioSampleRate=None, audioChannel=None, audioCodeRate=None, jdchd=None, audioComfort=None):
"""
:param videoCodec: (Optional) 视频编码格式
- 取值:h264,h265,默认h264
:param videoCodeRate: (Optional) 转码输出的码率值:
- 取值: [128,15000]
- 单位: kpbs
:param videoFrameRate: (Optional) 转码输出的帧率值:
- 取值:[1,30]
:param width: (Optional) 转码输出视频宽度:
- 取值: [128,4096]
- 等比: 如果只填写一个参数,则按参数比例调节输出转码视频
- 随源: 如果两个参数都不填写,则按照源比例输出转码视频
:param height: (Optional) 转码输出视频高度:
- 取值: [128,4096]
- 等比: 如果只填写一个参数,则按参数比例调节输出转码视频
- 随源: 如果两个参数都不填写,则按照源比例输出转码视频
:param template: (Optional) 转码模板自定义名称:
- 自定义模板: 枚举类型校验,忽略大小写,自动删除空格,
取值要求:数字、大小写字母或短横线("-"),
首尾不能有特殊字符("-")
- 注意: 不能与标准的转码模板和已定义命名重复
:param templateName: (Optional) 转码模板名称
:param audioCodec: (Optional) 转码输出音频编码格式:
- 取值: aac、mp3
- 不区分大小写
:param audioFormat: (Optional) 转码输出音频格式:
- 取值: aac_lc,aac_low,aac_he,aac_he_v2
- 不区分大小写
:param audioSampleRate: (Optional) 转码输出音频采样率:
- 取值: [44100,48000]
:param audioChannel: (Optional) 转码输出音频通道数:
- 1 单声道
- 2 双声道
:param audioCodeRate: (Optional) 转码输出音频码率:
- 取值: [16,128]
- 单位: kbps
:param jdchd: (Optional) 京享超清
- 取值: jdchd-1.0,off
:param audioComfort: (Optional) 舒适音频
- 取值: on,off
"""
self.videoCodec = videoCodec
self.videoCodeRate = videoCodeRate
self.videoFrameRate = videoFrameRate
self.width = width
self.height = height
self.template = template
self.templateName = templateName
self.audioCodec = audioCodec
self.audioFormat = audioFormat
self.audioSampleRate = audioSampleRate
self.audioChannel = audioChannel
self.audioCodeRate = audioCodeRate
self.jdchd = jdchd
self.audioComfort = audioComfort
|
input_line_number = 0
lines = []
def input():
global input_line_number
input_line_number += 1
return lines[input_line_number - 1]
def solution():
# Solution starts here
number_of_lines = int(input())
for i in range(0, number_of_lines):
full_name = input()
# Find the location of the first space so we can differentiate first and last name
space_index = full_name.index(" ")
first_name = full_name[:space_index]
last_name = full_name[space_index + 1:].replace(' ', '') # Replace spaces by nothing == removing all spaces
print('{}{}'.format(first_name[0].lower(), last_name[:4].lower()))
""" REMARK: You can take a substring with an index that is larger than the string's length """
# Solution ends here
if __name__ == '__main__':
with open('resources/input_username.txt') as file:
lines = file.readlines()
lines = [line.rstrip() for line in lines]
solution()
|
#Faça um Programa que peça uma data no formato dd/mm/aaaa e determine se a mesma é uma data válida.
dia = int(input("Digite o dia [dd]: "))
mes = int(input("Digite o mês [mm]: "))
ano = int(input("Digite o ano [aaaa]: "))
meses_com_trinta_dias = [2,4,6,9,11]
#data começa como True e vai passando por validações
data_valida = True
#validações - qualquer condição destas invalida a data
if dia > 31:
data_valida = False
if mes > 12:
data_valida = False
if dia < 1 or mes < 1:
data_valida = False
if dia >30 and mes in meses_com_trinta_dias:
data_valida = False
if ano < 0:
data_valida = False
if data_valida:
print(f"A data {dia}/{mes}/{ano} é válida")
else:
print(f"A data {dia}/{mes}/{ano} NÃO é válida")
|
# 104. Maximum Depth of Binary Tree
"""
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def maxDepth(self, root: Optional[TreeNode]) -> int:
def helper(value):
if not value:
return 0
else:
return 1 + (max(helper(value.left), helper(value.right)))
return helper(root)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 20:46:03 2018
@author: daniel
cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and
last element of that pair. For example, car(cons(3, 4)) returns 3,
and cdr(cons(3, 4)) returns 4.
Given this implementation of cons:
def cons(a, b):
def pair(f):
return f(a, b)
return pair
Implement car and cdr.
"""
def cons(a, b):
def pair(f):
return f(a, b)
return pair
def car(pair):
def f(a, b):
return a
return pair(f)
def cdr(pair):
def f(a, b):
return b
return pair(f)
assert car(cons(3, 4)) == 3
assert cdr(cons(3, 4)) == 4
print('all fine')
|
# Allows for easier debugging and unit testing. For example in dev mode functions don't expect a Flask request input.
DEV_MODE = False
KEYFILE = 'keyfile.json'
|
class BrokenLinkWarning(UserWarning):
"""
Raised when a group has a key with a None value.
"""
pass
|
L = []
def get_num(n):
while n > 0:
L.insert(0, n % 10)
n = n // 10
while True:
temp = input('Input a num: ')
if temp.isdigit():
get_num(int(temp))
break
else:
print('', end='')
# while True:
# try:
# temp = input("Input a num: ")
# get_num(int(temp))
# break
# except ValueError:
# print('', end='')
print(L)
strA = input("Input the Int:")
order = []
for i in strA:
order.append(i)
print(order)
order.reverse() # 将列表反转
print(''.join(order)) # 将list转换成字符串
|
class MacroError(Exception):
def __init__(self, msg: str, filepath: str, ctx=None):
super().__init__()
if ctx:
self.line = ctx.start.line # 错误出现位置
self.column = ctx.start.column
else:
self.line = 0
self.column = 0
self.filepath = filepath
self.msg = msg
def __str__(self):
return 'MacroError ({}): line {}, column {}, {}'.format(self.filepath, self.line, self.column, self.msg)
|
elements = [23, 14, 56, 12, 19, 9, 15, 25, 31, 42, 43]
l=len(elements)
i=0
sum_even=0
sum_odd=0
average_even=0
average_odd=0
while i<l:
if elements[i]%2==0:
sum_even=sum_even+elements[i]
average_even+=1
else:
sum_odd=sum_odd+elements[i]
average_odd+=1
i+=1
print(sum_even//average_even)
print(sum_odd//average_odd)
|
"""
Session related utilities
"""
def session(self):
"""
Simple function that will be bound to the current request object to make
the session retrievable inside a handler
"""
# Returns a session using the default cookie key.
return self.session_store.get_session()
|
# for local
# It's probably helpful for us to demonstrate what the URL should be, etc.
SECRET_KEY = b'keycloak'
# http, not https for some reason
SERVER_URL = "http://keycloak-idp:8080/auth/"
ADMIN_USERNAME = "admin"
ADMIN_PASS = "admin"
REALM_NAME = "master"
# created in keycloak per https://github.com/keycloak/keycloak-documentation/blob/main/securing_apps/topics/client-registration/client-registration-cli.adoc
CLIENT_ID = "keycloak-flask"
# set access-type to confidential, save, reload, will see a credentials tab where you can set this
CLIENT_SECRET = "2da4a9a4-f6f0-48d9-82f6-12012402f03a"
# You'll probably have to tell docker this is OK on a Mac
INGRESS_HOST = "http://www.google.com/"
|
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(iname):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {iname}') # Press Ctrl+F8 to toggle the breakpoint.
print_hi("hi pycharm")
def days_to_hour(num_of_days):
calc_to_units = 24
name_of_units = 'hours'
return f"{num_of_days} days to {name_of_units} are {num_of_days*calc_to_units} {name_of_units}"
def validate_user_input():
try:
user_input_days = int(user_input)
if user_input_days > 0:
results = days_to_hour(user_input_days)
print(results)
elif user_input_days == 0:
print("please enter valid positive number, 0 can not be converted")
else:
print("negative number not allowed")
except ValueError:
print("your input is not a valid number")
user_input = ""
while user_input != 'exit':
user_input = (input("provide number of day to convert!\n"))
validate_user_input()
# Press the green button in the gutter to run the script.
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
"""Consts for the integration."""
DOMAIN = "sleep_as_android"
DEVICE_MACRO: str = "%%%device%%%"
DEFAULT_NAME = "SleepAsAndroid"
DEFAULT_TOPIC_TEMPLATE = "SleepAsAndroid/%s" % DEVICE_MACRO
DEFAULT_QOS = 0
DEFAULT_ALARM_LABEL = ""
CONF_ALARMS = "alarms"
CONF_ALARM_TIME_FMT = "%H:%M"
CONF_ALARM_DATE_FMT = "%Y-%m-%d"
CONF_ALARM_LABEL = "label"
CONF_ALARM_TIME = "time"
CONF_ALARM_DATE = "date"
CONF_ALARM_REPEAT = "repeat"
CONF_ALARM_ADD_ANOTHER = "add_another"
|
pi=22/7
r=float(input("enter radius of circle"))
Area=pi*r*r
print("Area of circle:%f",Area)
|
def upload(task_id, file_id, remote_path):
global responses
remote_path = remote_path.replace("\\", "")
upload = {
'action': "upload",
'file_id': file_id,
'chunk_size': 512000,
'chunk_num': 1,
'full_path': "",
'task_id': task_id,
}
res = send(upload, agent.get_UUID())
res = res['chunk_data']
response_bytes = res.encode('utf-8')
response_decode = base64.b64decode(response_bytes)
code = response_decode.decode('utf-8')
f = open(remote_path, "w")
f.write(code)
f.close()
response = {
'task_id': task_id,
"user_output": "File Uploaded",
'completed': True
}
responses.append(response)
print("\t- Upload Done")
return
|
#!/usr/bin/env python
def constructCDS(features, coordinates):
exonCoordinates = [coordinates[featureIndex] for featureIndex in range(len(features)) if features[featureIndex][1] == "e"]
cdsMap = {}
cdsStart = 1
for exonCoord in exonCoordinates:
exonStart, exonEnd = exonCoord
cdsEnd = cdsStart + (exonEnd - exonStart)
cdsMap[(exonStart, exonEnd)] = (cdsStart,cdsEnd)
cdsStart = cdsEnd + 1
return cdsMap
def transformPos(pos_orig, cdsMap, sum_deletes_before, sum_inserts_before, sum_cds_deletes_before, sum_cds_inserts_before):
pos = pos_orig - sum_deletes_before
cdsRegions = list(cdsMap.keys())
cdsRegions.sort()
for region in cdsRegions:
if (pos >= region[0]) and (pos <= region[1]):
newRegion = cdsMap[region]
newPosition = newRegion[0] + (pos - region[0]) - sum_cds_inserts_before + sum_cds_deletes_before
codonIndex = newPosition / 3 # codon length = 3
return (newPosition, codonIndex)
return (pos_orig - sum_inserts_before, None)
def changeToImgtCoords(features, coordinates, differences, utr5Length = 0):
cdsMap = constructCDS(features, coordinates)
imgtDifferences = {}
imgtCoordinates = []
for key in ["deletionPositions", "insertionPositions", "mismatchPositions"]:
imgtDifferences[key] = []
utr5Index = features.index("utr5")
utr5Start, utr5End = coordinates[utr5Index][0], coordinates[utr5Index][1]
utr5Length = utr5End - utr5Start + 1
for featureIndex in range(len(features)):
feature = features[featureIndex]
if feature == "utr5":
ft_start = coordinates[featureIndex][0] - (utr5Length + 1)
ft_end = coordinates[featureIndex][1] - (utr5Length + 1)
else:
ft_start = coordinates[featureIndex][0] - utr5Length
ft_end = coordinates[featureIndex][1] - utr5Length
imgtCoordinates.append((ft_start, ft_end))
# shift positions for preceding inDels:
ins_in_cds = []
del_in_cds = []
for key in ["deletionPositions", "insertionPositions", "mismatchPositions"]:
imgtDifferences[key] = []
new_diff = []
for pos in differences[key]:
sum_deletes_before = sum([1 for posx in differences["deletionPositions"] if posx < pos])
sum_cds_deletes_before = sum([1 for posx in differences["deletionPositions"] if posx < pos and posx in del_in_cds])
sum_inserts_before = sum([1 for posx in differences["insertionPositions"] if posx < pos])
sum_cds_inserts_before = sum([1 for posx in differences["insertionPositions"] if posx < pos and posx in ins_in_cds])
newpos = transformPos(pos, cdsMap, sum_deletes_before, sum_inserts_before, sum_cds_deletes_before, sum_cds_inserts_before)
imgtDifferences[key].append(newpos)
# print(key, pos, sum_inserts_before, sum_deletes_before, sum_cds_deletes_before, sum_cds_inserts_before, newpos)
# adjust differences[key] for preceding insertions:
if newpos[1]: # if change located in CDS
new_diff.append(pos)
if key == "insertionPositions":
ins_in_cds.append(pos)
elif key == "deletionPositions":
del_in_cds.append(pos)
else:
new_diff.append(newpos[0])
differences[key] = new_diff
for key in ["mismatches", "insertions", "deletions"]:
imgtDifferences[key] = differences[key]
return (imgtCoordinates, imgtDifferences, cdsMap)
|
class CodeParser():
#Parsing variables
SPEED = 0
ANGLE = 0
lineNum = 0
#Parsing libraries (or "keywords")
PORTS = ["THROTTLE", "TURN"]
#Initialize the CodeParser
def __init__(self, path):
self.SPEED = 0
self.ANGLE = 0
#Open racer file
racer = open(path, "r")
#Read lines in
self.code = racer.readlines()
racer.close()
#Remove whitespace from file
line = 0
while line < len(self.code):
terms = self.code[line].split()
if len(terms) == 0:
self.code.pop(line)
else:
line += 1
#Analyze
def analyzer(self):
#Keep reading lines until you run out of lines
while self.lineNum < len(self.code):
#Split code line into terms
terms = self.code[self.lineNum].split()
#Go to add function
if terms[0] == "add":
self.addPort(terms)
elif terms[0] == "sub":
self.subPort(terms)
elif terms[0] == "mpy":
self.mpyPort(terms)
elif terms[0] == "div":
self.divPort(terms)
elif terms[0] == "set":
self.setPort(terms)
elif terms[0] == "jmp":
self.jump(terms)
elif terms[0] == "lst":
self.lstJump(terms)
elif terms[0] == "lte":
self.lteJump(terms)
elif terms[0] == "grt":
self.grtJump(terms)
elif terms[0] == "gte":
self.gteJump(terms)
elif terms[0] == "eqt":
self.eqtJump(terms)
elif terms[0] == "nte":
self.nteJump(terms)
#Print speed and angle after each line read
#print("Speed:", self.SPEED)
#print("Angle:", self.ANGLE)
self.lineNum += 1
#Function to add number to port
def addPort(self, terms):
if terms[1] == "THROTTLE":
self.SPEED = self.SPEED + int(terms[2])
elif terms[1] == "TURN":
self.ANGLE = self.ANGLE + int(terms[2])
#Function to subtract number from port
def subPort(self, terms):
if terms[1] == "THROTTLE":
self.SPEED = self.SPEED - int(terms[2])
elif terms[1] == "TURN":
self.ANGLE = self.ANGLE - int(terms[2])
#Function to multply port by number
def mpyPort(self, terms):
if terms[1] == "THROTTLE":
self.SPEED = self.SPEED * int(terms[2])
elif terms[1] == "TURN":
self.ANGLE = self.ANGLE * int(terms[2])
#Function to divide port by number
def divPort(self, terms):
if terms[1] == "THROTTLE":
self.SPEED = self.SPEED / int(terms[2])
elif terms[1] == "TURN":
self.ANGLE = self.ANGLE / int(terms[2])
#Function to set port to number
def setPort(self, terms):
if terms[1] == "THROTTLE":
self.SPEED = int(terms[2])
elif terms[1] == "TURN":
self.ANGLE = int(terms[2])
#Function to jump to spcific line
def jump(self, terms):
#Find the function to jump to and then set lineNum to where it is in the txt file
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[1]:
self.lineNum = num
return
#Function to change port to number
def portToNum(self, terms):
for i, _ in enumerate(terms):
if terms[i] == "THROTTLE":
terms[i] = self.SPEED
if terms[i] == "TURN":
terms[i] = self.ANGLE
#Function to jump if comparison is less than
def lstJump(self, terms):
self.portToNum(terms)
if int(terms[1]) < int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#Function to jump if comparison is less than or equal to
def lteJump(self, terms):
self.portToNum(terms)
if int(terms[1]) <= int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#Function to jump if comparison is greater than
def grtJump(self, terms):
self.portToNum(terms)
if int(terms[1]) > int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#Function to jump if comparison is less than or equal to
def gteJump(self, terms):
self.portToNum(terms)
if int(terms[1]) >= int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#Function to jump if comparison is equal to
def eqtJump(self, terms):
self.portToNum(terms)
if int(terms[1]) == int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#Function to jump if comparison is not equal to
def nteJump(self, terms):
self.portToNum(terms)
if int(terms[1]) != int(terms[2]):
for num, i in enumerate(self.code):
i = self.code[num].split()
if i[0] == terms[4]:
self.lineNum = num
return
#This is just for testing and running the code
#CodeParser.analyze()
|
# If we want to find the shortest path or any path between 2 nodes
# BFS works better
# Breadth-First search needs a Queue
class Node:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __str__(self):
return "Node: {} Left: {} Right:{}".format(self.val, self.left, self.right)
def visit(self):
print(self.val, end='')
# Time: O(n) Space: O(n)
# where n == number of nodes
def breadth_first_traversal(root):
queue = [root]
while len(queue) > 0:
curr = queue.pop(0)
curr.visit()
if curr.left is not None:
queue.append(curr.left)
if curr.right is not None:
queue.append(curr.right)
# Time: O(n) Space: O(n)
# where n == number of nodes
def breadth_first_search(root, target):
queue = [root]
while len(queue) > 0:
curr = queue.pop(0)
# curr.visit()
if curr.val == target:
return True
if curr.left is not None:
queue.append(curr.left)
if curr.right is not None:
queue.append(curr.right)
return False
#
# a
# / \
# b c
# / \ \
# d e f
a = Node('a')
b = Node('b')
c = Node('c')
d = Node('d')
e = Node('e')
f = Node('f')
a.left = b
a.right = c
b.left = d
b.right = e
c.right = f
breadth_first_traversal(a)
print("Does the tree contein 'e'? ", end='')
print(breadth_first_search(a, 'e'))
print("Does the tree contein 'z'? ", end='')
print(breadth_first_search(a, 'z'))
|
testcases = int(input().strip())
for test in range(testcases):
string = input().strip()
length = len(string)
half_length = length // 2
if length % 2:
print(-1)
continue
letters1 = [0] * 26
letters2 = [0] * 26
ascii_a = ord('a')
ascii_string = [ord(c) - ascii_a for c in string]
for i in range(half_length):
letters1[ascii_string[i]] += 1
letters2[ascii_string[half_length + i]] += 1
counter = 0
for i in range(26):
if letters1[i] > letters2[i]:
counter += letters1[i] - letters2[i]
print(counter)
|
w, h, k = list(map(int, input().split()))
c=0
for i in range(k):
c = c+ ( (h-4*i)*2 +( w - 2-4*i)*2)
print(c)
|
"""
TEMAS:
- IDE
- Estructura básica de un programa.
Main
Procedural
Función print
- Variables y constantes
Variables
Constantes
Tipos de datos
Función type
"""
def main():
# Variables y constantes
# Esta es una variable
edad_alumno = 20
# Esta es una constante
NOMBRE_ALUMNO = "Roberto"
print(edad_alumno)
print(NOMBRE_ALUMNO)
# Tipos de datos
NUMERO_PI = 3.1416
numero_a = -4 #int
numero_b = 10.2 #float
texto = "mensaje de texto" #string
print("Tipo numero_a: ", type(numero_a))
print("Tipo numero_b: ", type(numero_b))
print("Tipo texto: ", type(texto))
if __name__ == '__main__':
main()
|
t = int(input())
h = (t // 3600) % 24
m1 = t // 60 % 60 // 10
m2 = t // 60 % 60 % 10
s1 = t % 60 // 10
s2 = t % 10
print(h, ":", m1, m2, ":", s1, s2, sep="")
|
class Solution:
def sumRootToLeaf(self, root: TreeNode) -> int:
def sumRootToLeaf(r, s):
li, x = [n for n in [r.left, r.right] if n], (s << 1) + r.val
return x if not li else sum(sumRootToLeaf(n, x) for n in li)
return sumRootToLeaf(root, 0)
|
class SymbolTable:
def __init__(self):
self.table = {'SP': 0, 'LCL': 1, 'ARG': 2, 'THIS': 3, 'THAT': 4, 'R0': 0,
'R1': 1, 'R2': 2, 'R3': 3, 'R4': 4, 'R5': 5, 'R6': 6, 'R7': 7,
'R8': 8, 'R9': 9, 'R10': 10, 'R11': 11, 'R12': 12, 'R13': 13, 'R14': 14,
'R15': 15, 'SCREEN': 16384, 'KBD': 24576}
def addEntry(self, symbol, address):
self.table[symbol] = address
def contains(self, symbol):
return symbol in self.table
def getAddress(self, symbol):
return self.table[symbol]
|
"""
stormdrain events
SD_bounds_updated
Bounds have changed. Typically this happens in response to axes limits
changing on a plot, or filtering criteria on a dataset changing.
SD_reflow_start and SD_reflow_done
These events, which often should follow a SD_bounds_updated event, is used to
trigger a reflow of datasets down their pipelines. After all workers using
this event complete, SD_reflow_done is sent to indicate that subsequent
actions using the data can complete. For instance, a plot could do a final
draw, since all artists should have received their updated data at this stage.
"""
SD_exchanges = {
'SD_bounds_updated':"Bounds instance has been updated",
'SD_reflow_start':"Global data reflow, often follows bounds change",
'SD_reflow_done':"Signals that data reflow is complete; should follows SD_reflow_start",
}
|
A,B = map(int, input().split())
#A,B = 4, 10
if A > B :
print('>')
elif A < B :
print('<')
else:
print('==')
|
# @Time: 2022/4/13 11:29
# @Author: chang liu
# @Email: [email protected]
# @File:LFU.py
class Node:
def __init__(self, key=None, val=None):
self.val = val
self.key = key
self.f = 1
self.left = None
self.right = None
class DLL:
def __init__(self):
self.size = 0
self.head = Node()
self.tail = Node()
self.head.left = self.tail
self.tail.right = self.head
def remove_node(self, node):
node.left.right = node.right
node.right.left = node.left
self.size -= 1
def add_head(self, node):
self.head.left.right = node
node.left = self.head.left
self.head.left = node
node.right = self.head
self.size += 1
def remove_tail(self):
tail = self.tail.right
self.remove_node(tail)
return tail
class LFUCache:
'''
referring to discuss board,
thanks, stranger
'''
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = {}
self.freq_map = {}
self.min_freq = None
def get(self, key: object) -> object:
# print(self.cache)
# print(self.freq_map)
if key not in self.cache:
return -1
val = self.cache[key].val
self.update(key, val)
return val
def put(self, key: int, value: object) -> None:
# print(self.freq_map)
if self.capacity == 0:
return
if key in self.cache:
self.update(key, value)
else:
if len(self.cache) == self.capacity:
removed = self.freq_map[self.min_freq].remove_tail()
del self.cache[removed.key]
self.min_freq = 1
new = Node(key, value)
if 1 not in self.freq_map:
self.freq_map[1] = DLL()
self.cache[key] = new
self.freq_map[1].add_head(new)
def update(self, key, val):
ptr = self.cache[key]
ptr.val = val
f = ptr.f
ptr.f += 1
if f + 1 not in self.freq_map:
self.freq_map[f + 1] = DLL()
self.freq_map[f].remove_node(ptr)
self.freq_map[f + 1].add_head(ptr)
if self.freq_map[f].size == 0 and self.min_freq == f:
self.min_freq += 1
# Your LFUCache object will be instantiated and called as such:
# obj = LFUCache(capacity)
# param_1 = obj.get(key)
# obj.put(key,value)
class MyObj:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
if __name__ == "__main__":
x, y, z = MyObj("x"), MyObj("y"), MyObj("z")
assert x is not y and y is not z
lfu = LFUCache(2)
print(lfu.get(1))
lfu.put(1, x)
lfu.put(2, y)
print(lfu.get(1))
print(lfu.get(2))
lfu.put(3, z)
print(lfu.get(1))
print(lfu.get(3))
|
# -*- coding: utf-8 -*-
# @Time: 2020/7/16 11:36
# @Author: GraceKoo
# @File: interview_7.py
# @Desc: https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3?tpId=13&rp=1&ru=%2Fta%2Fcoding-interviews&qr
# u=%2Fta%2Fcoding-interviews%2Fquestion-ranking
class Solution:
def fib(self, N: int) -> int:
if N <= 1:
return N
f_dict = {0: 0, 1: 1}
for i in range(2, N):
f_dict[i] = f_dict[i - 1] + f_dict[i - 2]
return f_dict[N - 1]
so = Solution()
print(so.fib(4))
|
#!/usr/bin/python3
def square_matrix_simple(matrix=[]):
if matrix:
new = []
for rows in matrix:
new.append([n ** 2 for n in rows])
return new
|
# Adaptive Card Design Schema for a sample form.
# To learn more about designing and working with buttons and cards,
# checkout https://developer.webex.com/docs/api/guides/cards
BUSY_CARD_CONTENT = {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 1,
"items": [
{
"type": "Image",
"url": "https://i.postimg.cc/2jMv5kqt/AS89975.jpg",
"size": "Stretch"
}
]
},
{
"type": "Column",
"width": 1,
"items": [
{
"type": "TextBlock",
"text": "Working on it....",
"color": "Dark",
"weight": "Bolder",
"wrap": True,
"size": "default",
"horizontalAlignment": "Center"
},
{
"type": "TextBlock",
"text": "I am busy working on your request. Please continue to look busy while I do your work.",
"color": "Dark",
"height": "stretch",
"wrap": True
}
]
}
]
}
]
}
|
"""
This Module is not yet correct!!
"""
class TypedCollectionCreator(object):
"""
Class enforcing that the iterable only contains elements of the given type (or subclasses) at initialisation.
That is, checks in the __new__ function that only elements of the given dtype are contained in the given sequence.
It also stores the dtype in the dtype property.
**Note:** This class is designed to be used in multiple inheritance in the form: 'class X(TypedCollectionCreator, some_builtin_collection)'
"""
#__slots__ = ('_dtype',)
def __new__(cls, dtype: type, sequence=()):
if not isinstance(dtype, type):
raise TypeError("t must be a type but was "+repr(dtype))
if not all((isinstance(e, dtype) for e in sequence)):
raise TypeError("All elements must be instance of {}".format(dtype))
inst = super().__new__(cls, sequence)
inst._dtype = dtype
return inst
@property
def dtype(self):
return self._dtype
def __repr__(self):
return '{name}{dtype}({elems})'.format(name=self.__class__.__name__, dtype=repr(self.dtype), elems=', '.join(repr(e) for e in self))
class TypedMutableCollectionCreator(TypedCollectionCreator):
"""
Class calling the super __init__ with the given sequence argument.
"""
__slots__ = ()
def __init__(self, dtype: type, sequence=()):
super().__init__(sequence)
class TypedFrozenSet(TypedCollectionCreator, frozenset):
"""frozenset containing only elements of a given type
>>> TypedFrozenSet(int, (1, 3, 4))
TypedFrozenSet<class 'int'>(1, 3, 4)
>>> TypedFrozenSet(int, (1, 3, 4, 's'))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> TypedFrozenSet(int, (1, 3, 4)) | TypedFrozenSet(int, (5, 6, 7))
TypedFrozenSet<class 'int'>(1, 3, 4, 5, 6, 7)
>>> TypedFrozenSet(int, (1, 3, 4)).union( TypedFrozenSet(int, (5, 6, 7)))
TypedFrozenSet<class 'int'>(1, 3, 4, 5, 6, 7)
"""
__slots__ = ()
class TypedSet(TypedMutableCollectionCreator, set):
"""(mutable) set containing only elements of the given type
>>> TypedSet(int, (1, 3, 4))
TypedSet<class 'int'>(1, 3, 4)
>>> TypedSet(int, (1, 3, 4, 's'))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> TypedSet(int, (1, 2, 4)).difference(TypedSet(int, (1, 3, 4, 5)))
TypedSet<class 'int'>(2)
>>> TypedSet(int, (1, 3, 4)).difference(TypedSet(str, ('a', 'b', 'd')))
TypedSet<class 'int'>(1, 3, 4)
>>> TypedSet(int, (1, 3, 4)).intersection(TypedSet(int, (1, 3, 4, 5)))
TypedSet<class 'int'>(1, 3, 4)
>>> TypedSet(int, (1, 3, 4)).intersection(TypedSet(str, ('a', 'b', 'd')))
TypedSet<class 'int'>()
>>> TypedSet(int, (1, 3, 4)).symmetric_difference(TypedSet(int, (1, 3, 4, 5)))
TypedSet<class 'int'>(5)
>>> TypedSet(int, (1, 3, 4)).symmetric_difference(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> TypedSet(int, (1, 3, 4)).union(TypedSet(int, (1, 3, 4, 5)))
TypedSet<class 'int'>(1, 3, 4, 5)
>>> TypedSet(int, (1, 3, 4)).union(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> TypedSet(int, (1, 3, 4)).update(TypedSet(int, (1, 3, 4, 5)))
>>> TypedSet(int, (1, 3, 4)).update(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: Operation only permitted with a TypedSet of the same type (<class 'int'>)
>>> TypedSet(int, (1, 3, 4)).intersection_update(TypedSet(int, (1, 3, 4, 5)))
>>> TypedSet(int, (1, 3, 4)).intersection_update(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: Operation only permitted with a TypedSet of the same type (<class 'int'>)
>>> TypedSet(int, (1, 3, 4)).difference_update(TypedSet(int, (1, 3, 4, 5)))
>>> TypedSet(int, (1, 3, 4)).difference_update(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: Operation only permitted with a TypedSet of the same type (<class 'int'>)
>>> TypedSet(int, (1, 3, 4)).symmetric_difference_update(TypedSet(int, (1, 3, 4, 5)))
>>> TypedSet(int, (1, 3, 4)).symmetric_difference_update(TypedSet(str, ('a', 'b', 'd')))
Traceback (most recent call last):
...
TypeError: Operation only permitted with a TypedSet of the same type (<class 'int'>)
>>> TypedSet(int, (1, 3, 4)).add(5)
>>> TypedSet(int, (1, 3, 4)).add('d')
Traceback (most recent call last):
...
TypeError: elem must be of type <class 'int'>
"""
__slots__ = ()
def difference(self, *others):
sup = super().difference(*others)
return TypedSet(self._dtype, sup)
def intersection(self, *others):
sup = super().intersection(*others)
return TypedSet(self._dtype, sup)
def symmetric_difference(self, other):
sup = super().symmetric_difference(other)
return TypedSet(self._dtype, sup)
def union(self, *others):
sup = super().union(*others)
return TypedSet(self._dtype, sup)
def _check_same_type(self, *others):
if not all((isinstance(o, TypedSet) and o.dtype == self.dtype for o in others)):
raise TypeError("Operation only permitted with a TypedSet of the same type ({})".format(self._dtype))
return True
def update(self, *others):
self._check_same_type(*others)
return super().update(*others)
def intersection_update(self, *others):
self._check_same_type(*others)
return super().intersection_update(*others)
def difference_update(self, *others):
self._check_same_type(*others)
return super().difference_update(*others)
def symmetric_difference_update(self, other):
self._check_same_type(other)
return super().symmetric_difference_update(other)
def add(self, elem):
if not isinstance(elem, self._dtype):
raise TypeError("elem must be of type {}".format(self._dtype))
return super().add(elem)
class TypedTuple(TypedCollectionCreator, tuple):
"""tuple containing only elements of a given type
>>> TypedTuple(int, (1, 3, 4))
TypedTuple<class 'int'>(1, 3, 4)
>>> TypedTuple(int, (1, 3, 4, 's'))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> TypedTuple(int, (1, 3, 4)) + TypedTuple(int, (1, 3, 4))
TypedTuple<class 'int'>(1, 3, 4, 1, 3, 4)
"""
__slots__ = ()
class TypedList(TypedMutableCollectionCreator, list):
"""
>>> TypedList(int, (1, 3, 4))
TypedList([1, 3, 4])
>>> TypedList(int, (1, 3, 4, 's'))
Traceback (most recent call last):
...
TypeError: All elements must be instance of <class 'int'>
>>> tl = TypedList(int, (1, 2, 4))
>>> tl.append(3)
>>> tl
TypedList([1, 2, 4, 3])
>>> TypedList(int, (1, 3, 4)).append('a')
Traceback (most recent call last):
...
TypeError: elem must be of type <class 'int'>, but was <class 'str'>
>>> TypedList(int, (1, 2, 4))[0]
1
>>> tl = TypedList(int, (1, 3, 4))
>>> tl[2] = 10
>>> tl[2] == 10
True
>>> tl = TypedList(int, (1, 3, 4))
>>> tl[2] = 'a'
Traceback (most recent call last):
...
TypeError: value must be of type <class 'int'>
>>> TypedList(int, (1, 3, 4)) + TypedList(int, (1, 3, 4))
TypedList([1, 3, 4, 1, 3, 4])
"""
__slots__ = ()
def append(self, elem):
if not isinstance(elem, self._dtype):
raise TypeError("elem must be of type {}, but was {}".format(self._dtype, elem.__class__))
return super().append(elem)
def __setitem__(self, key, value):
if not isinstance(value, self._dtype):
raise TypeError("value must be of type {}".format(self._dtype))
return super().__setitem__(key, value)
|
# Map by afffsdd
# A map with four corners, with bots spawning in each of them.
# flake8: noqa
# TODO: Format this file.
{'spawn': [(1, 1), (14, 1), (15, 1), (16, 1), (17, 1), (1, 2), (1, 3), (1, 4), (17, 14), (17, 15), (17, 16), (1, 17), (2, 17), (3, 17), (4, 17), (17, 17)], 'obstacle': [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0), (9, 0), (10, 0), (11, 0), (12, 0), (13, 0), (14, 0), (15, 0), (16, 0), (17, 0), (18, 0), (0, 1), (13, 1), (18, 1), (0, 2), (13, 2), (18, 2), (0, 3), (13, 3), (18, 3), (0, 4), (13, 4), (18, 4), (0, 5), (1, 5), (2, 5), (3, 5), (4, 5), (18, 5), (0, 6), (18, 6), (0, 7), (18, 7), (0, 8), (18, 8), (0, 9), (18, 9), (0, 10), (18, 10), (0, 11), (18, 11), (0, 12), (18, 12), (0, 13), (14, 13), (15, 13), (16, 13), (17, 13), (18, 13), (0, 14), (5, 14), (18, 14), (0, 15), (5, 15), (18, 15), (0, 16), (5, 16), (18, 16), (0, 17), (5, 17), (18, 17), (0, 18), (1, 18), (2, 18), (3, 18), (4, 18), (5, 18), (6, 18), (7, 18), (8, 18), (9, 18), (10, 18), (11, 18), (12, 18), (13, 18), (14, 18), (15, 18), (16, 18), (17, 18), (18, 18)]}
|
class Node(object):
"""docstring for Node"""
def __init__(self, item, left, right):
super(Node, self).__init__()
self.item = item
self.left = left
self.right = right
def getChild(self, direction):
if (direction > 0):
return self.left
else:
return self.right
def getItem(self):
return self.item
def getLeft(self):
return self.left
def getRight(self):
return self.right
def isLeaf(self):
return (self.left is None) and (self.right is None)
def setChild(self, direction, child):
if (direction > 0):
self.left = child
else:
self.right = child
def setItem(self, item):
self.item = item
def setLeft(self, left):
self.left = left
def setRight(self, right):
self.right = right
def toStringInorder(self):
result = ""
if (self.left != None):
result += "\n" + self.left.toStringInorder()
result += self.item + "\n"
if (self.right != None):
result += "\n" + self.right.toStringInorder()
return result
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def cudasolve(A, b, tol=1e-3, normal=False, regA = 1.0, regI = 0.0):
""" Conjugate gradient solver for dense system of linear equations.
Ax = b
Returns: x = A^(-1)b
If the system is normal, then it solves
(regA*A'A +regI*I)x= b
Returns: x = (A'A +reg*I)^(-1)b
"""
N = len(b)
b = b.reshape((N,1))
b_norm = culinalg.norm(b)
x = b.copy()
if not normal:
r = b - culinalg.dot(A,x)
else:
r = b - regA*culinalg.dot(A,culinalg.dot(A,x), transa='T') - regI*x
p = r.copy()
rsold = culinalg.dot(r,r, transa='T')[0][0].get()
for i in range(N):
if not normal:
Ap = culinalg.dot(A,p)
else:
Ap = regA*culinalg.dot(A,culinalg.dot(A,p), transa='T') + regI*p
pAp = culinalg.dot(p, Ap, transa='T')[0][0].get()
alpha = rsold / pAp
x += alpha*p
r -= alpha*Ap
rsnew = culinalg.dot(r,r, transa='T')[0][0].get()
if math.sqrt(rsnew)/b_norm < tol:
break
else:
p = r + (rsnew/rsold)*p
rsold = rsnew
return x.reshape(N)
|
# MACRO - calculate precision and recall for every class,
# then take their weigted sum and calculate ONE f1 score
# MICRO - calculate f1 scores for each class and take their weighted sum
def f1_score(precision, recall):
f = 0 if precision + recall == 0 \
else 2 * precision * recall / (precision + recall)
return f
def main(k, confusion_matrix):
num_samples = [sum(confusion_matrix[idx]) for idx in range(k)]
weights = [s / sum(num_samples) for s in num_samples]
precisions = []
recalls = []
for cls_idx in range(k):
tp = confusion_matrix[cls_idx][cls_idx]
fp = sum([confusion_matrix[idx][cls_idx] for idx in range(k)]) - tp
fn = sum([confusion_matrix[cls_idx][idx] for idx in range(k)]) - tp
precision = 0 if tp + fp == 0 else tp / (tp + fp)
recall = 0 if tp + fn == 0 else tp / (tp + fn)
precisions.append(precision)
recalls.append(recall)
weighted_precision = sum([
weights[idx] * precisions[idx] for idx in range(k)
])
weighted_recall = sum([
weights[idx] * recalls[idx] for idx in range(k)
])
macro_f1 = f1_score(weighted_precision, weighted_recall)
f1_scores = [f1_score(precisions[idx], recalls[idx]) for idx in range(k)]
micro_f1 = sum([
weights[idx] * f1_scores[idx] for idx in range(k)
])
print(macro_f1)
print(micro_f1)
if __name__ == '__main__':
k = int(input())
confusion_matrix = []
for _ in range(k):
values = list(map(int, input().split()))
confusion_matrix.append(values)
main(k, confusion_matrix)
|
"""
pyPasswordValidator.
Password validator
"""
__version__ = "0.1.3.1"
__author__ = 'Jon Duarte'
__credits__ = 'iHeart Media'
|
name = "harry"
print(name[0])
# List
names = ["Harry", "Ron", "Hermione"]
print(names[0])
# Tuples
coordinateX = 10.0
coordinateY = 20.0
coordinate = (10.0,20.0)
print(coordinate)
|
#!/usr/bin/env python
print (' ')
nome = input('Digite seu nome: ')
#Mensagem
print (' ')
print (f'Seja bem-vindo Sr(a) {nome}, Obrigado por vir!')
print (' ')
|
# 폰켓몬
def solution(nums):
n = -1
cnt = 0
nums.sort()
for i in range(len(nums)):
if n != nums[i]:
n = nums[i]
cnt += 1
if cnt == len(nums) // 2:
break
return cnt
|
#latin square
num=int(input("Enter the number of rows:="))
for i in range(1,num+1):
r=i #set the first roew element
for j in range(1,num+1):
print(r,end='\t')
if r==num:
r=1
else:
r=r+1
print()
|
if (isWindVpDefined == 1):
evapoTranspiration = evapoTranspirationPenman
else:
evapoTranspiration = evapoTranspirationPriestlyTaylor
|
#!/usr/bin/env python
class ShapeGrid(object):
"""
Generic shape grid interface. Should be subclassed by specific shapes.
"""
def __init__(self):
pass
def create_grid(self, layer, extent, num_across=10):
raise NotImplementedError('Provided by each subclass of ShapeGrid.')
|
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 10 22:57:00 2021
@author: Dragneel
"""
#%% Tree structure
'''
The following Family Tree will be used
P1
--
/ \
--- \
/ \
P11 P12 + P13
--- ---------
/ | \ / \
/ | \ / \
P20 + P21 P22 P23 P24 P25 + P26
--------- --- --- --- ---------
\ | / | / | \
\ | / | / | \
P31 P32 P33 P34 P35 P36 P37
'''
#%% Relation Variables
parentList = [('child', 'P11', 'P1'), ('child', 'P12', 'P1'),
('child', 'P21', 'P11'), ('child', 'P22', 'P11'), ('child', 'P23', 'P11'),
('child', 'P24', 'P12'), ('child', 'P25', 'P12'), ('child', 'P24', 'P13'), ('child', 'P25', 'P13'),
('child', 'P31', 'P20'), ('child', 'P31', 'P21'), ('child', 'P32', 'P22'),
('child', 'P33', 'P24'), ('child', 'P34', 'P24'),
('child', 'P35', 'P25'), ('child', 'P36', 'P25'), ('child', 'P37', 'P25'),
('child', 'P35', 'P26'), ('child', 'P36', 'P26'), ('child', 'P37', 'P26')]
maleList = [ 'P1', 'P11', 'P13', 'P20', 'P25', 'P31', 'P32', 'P33', 'P34']
femaleList = [ 'P12', 'P21', 'P22', 'P23', 'P24', 'P26', 'P35', 'P36', 'P37']
#%% Functions for work
def brother(X):
i = 0
while(i < len(parentList)):
if parentList[i][1] == X:
for j in range(len(parentList)):
if parentList[i][2] == parentList[j][2] and parentList[i][1] != parentList[j][1] and parentList[j][1] in maleList:
print(parentList[j][2], end=' ')
i += 1
def sister(X):
i = 0
while(i < len(parentList)):
if parentList[i][1] == X:
for j in range(len(parentList)):
if parentList[i][2] == parentList[j][2] and parentList[i][1] != parentList[j][1] and parentList[j][1] in femaleList:
print(parentList[j][2], end=' ')
i += 1
def uncle(X):
i = 0
while(i < len(parentList)):
if parentList[i][1] == X:
for j in range(len(parentList)):
if parentList[j][1] == parentList[i][2]:
for k in range(len(parentList)):
if parentList[k][2] == parentList[j][2] and parentList[k][1] != parentList[j][1] and parentList[k][1] in maleList:
print(parentList[k][1])
i += 1
def aunt(X):
i = 0
while(i < len(parentList)):
if parentList[i][1] == X:
for j in range(len(parentList)):
if parentList[j][1] == parentList[i][2]:
for k in range(len(parentList)):
if parentList[k][2] == parentList[j][2] and parentList[k][1] != parentList[j][1] and parentList[k][1] in femaleList:
print(parentList[k][1])
i += 1
#%% Exercise Code
X = str(input('Name: '))
Y = str(input('Relation: '))
print(Y, end=' ')
if Y == 'Brother':
brother(X)
elif Y == 'Sister':
sister(X)
elif Y == 'Uncle':
uncle(X)
elif Y == 'Aunt':
aunt(X)
else:
print('Relation is not defined')
|
def add_time(start: str, duration: str, day: str = None) -> str:
days = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')
start_lst = list(map(int, start[:-3].split(':')))
duration_lst = list(map(int, duration.split(':')))
total_min = start_lst[1] + duration_lst[1]
extra_hours = total_min // 60
total_hours = start_lst[0] + duration_lst[0] + extra_hours
if 'PM' in start:
total_hours += 12
ans_minutes = total_min % 60
ans_hours = total_hours % 12
num_of_days = total_hours // 24
ans_minutes = str(ans_minutes).rjust(2, '0')
ans_hours = '12' if ans_hours == 0 else str(ans_hours)
period = 'AM' if (total_hours % 24) < 12 else 'PM'
new_time = f'{ans_hours}:{ans_minutes} {period}'
if day is not None:
day = day.lower().capitalize()
days = days[days.index(day):] + days[:days.index(day)] # from what day to start
new_time += f', {days[num_of_days % 7]}'
if num_of_days == 1:
new_time += ' (next day)'
elif num_of_days > 1:
new_time += f' ({num_of_days} days later)'
return new_time
|
#! /usr/bin/env python3
# Type of variable: Number
a, b = 5, 10
print(a, b)
a, b = b, a
print(a, b)
# Type of variable: List
myList = [1, 2, 3, 4, 5]
print("Initial Array :", myList)
myList[0], myList[1] = myList[1], myList[0]
print("Swapped Array :", myList)
|
def up_egcd(m,n):
#Assume m>n
if n>m:
m,n=n,m
if m%n==0:
return n
else:
return up_egcd(n,m%n)
print(up_egcd(int(input('Number 1\n')),int(input('Number 2\n'))))
|
class AbstractRecurrentNeuralNetworkBuilder(object):
"""Build a recurrent neural network
according to specified the input/output
dimensions and number of unrolled steps.
"""
DEFAULT_VARIABLE_SCOPE = "recurrent_neural_network"
def __init__(self,
tensors,
mixture_density_output,
feature_builder=None,
variable_scope=None):
"""
"""
self.tensors = tensors
self.mixture_density_output = mixture_density_output
self.feature_builder = feature_builder
self.variable_scope = AbstractRecurrentNeuralNetworkBuilder.DEFAULT_VARIABLE_SCOPE \
if variable_scope is None \
else variable_scope
def get_sequence_tensors(self):
"""Get sequence unrolled sequence unrolled tensors.
"""
raise NotImplementedError
def build_lstm(self):
"""Build lstm model by unrolling the lstm layer(s).
Output the unrolled tensors that could be used for
either generating sequences or training.
"""
raise NotImplementedError
def _get_current_samples(self,
current_output,
current_time):
"""Sample activity types, duration, travel time,
next activity start time, and etc from current lstm
output.
Args:
current_output(tf.tensor): the transformed output
from rnn. Should have shape
[batch_size, output_dimension]
current_time(tf.tensor): the current time of each
element in the batch. Should have shape
[batch_size, 1]
"""
raise NotImplementedError
def _get_next_input(self,
current_time,
activity_type,
context_variables):
"""Get next lstm input features from sampled
activity of previous step.
"""
raise NotImplementedError
def _save_model(self, file_path):
"""Save model weights to a file with location
of file_path.
Args:
file_path(str): the file path string.
"""
raise NotImplementedError
def _load_model(self):
"""Load model weights to a file with location
of file_path.
Args:
file_path(str): the file path string.
"""
raise NotImplementedError
|
inp = open('input.txt').read().split(", ") # Reading file
coord = (0, 0) # Setting original coordinates
p_dir = 0 # Setting original direction (north)
seen = set()
for instr in inp:
dir = instr[0]
step = int(instr[1:])
if dir == "R":
p_dir = p_dir + 1
if p_dir == 4:
p_dir = 0
elif dir == "L":
if p_dir == 0:
p_dir = 4
p_dir = p_dir - 1
for step in range(step):
if p_dir == 0:
coord = (coord[0], coord[1] + 1)
elif p_dir == 1:
coord = (coord[0] + 1, coord[1])
elif p_dir == 2:
coord = (coord[0], coord[1] - 1)
elif p_dir == 3:
coord = (coord[0] - 1, coord[1])
if coord in seen:
dist = abs(coord[0]) + abs(coord[1])
print(dist)
exit()
seen.add(coord)
|
# Problem : https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/submissions/
# Ref : https://youtu.be/wuzTpONbd-0
# 2 transactions only
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
n = len(prices)
# Calc dp - left -> Max profit so far - Buy before and sell today / before
# Similar to one transaction buy sell stock problem
max_profit_till_today = 0
min_so_far = prices[0]
dp_left = [0]*n
for i in range(1 , n):
# Calculate best buying day -> min before the current selling day
min_so_far = min(min_so_far , prices[i])
# Calc profit for current day
max_profit_till_today = prices[i] - min_so_far
# Update the global max profit possible uptil today
dp_left[i] = max(dp_left[i-1] , max_profit_till_today )
print(dp_left)
# Cal dp - right -> Max profit so far - Buy today/later and sell later
max_profit_from_today = 0
max_from_today = prices[n-1]
dp_right = [0]*n
for i in range(n-2 , -1 , -1 ):
# Calculate best selling day -> max from today - current buying day
max_from_today = max(max_from_today , prices[i])
# Calc profit for today
max_profit_from_today = max_from_today - prices[i]
# Update the global profit possible from today
dp_right[i] = max(dp_right[i+1] , max_profit_from_today)
# Calc max( dp-right + dp-left )
max_profit = 0
for i in range(0 , n):
sum_of_2 = dp_right[i] + dp_left[i]
max_profit = max(sum_of_2 , max_profit)
return max_profit
|
def test_it(binbb, repos_cfg):
"""Test just the first one"""
expected_words = ("Fields Values Branch Name Author"
" TimeStamp Commit ID Message").split()
for account_name, rep_cfg in repos_cfg.items():
for repo_name in rep_cfg.keys():
bbcmd = ["repo", "branch", "-a", account_name, "-r", repo_name]
# Expecting the call to succeed
res = binbb.sysexec(*bbcmd)
# Make simple test if the output is as expected
for word in expected_words:
assert word in res
lines = res.strip().splitlines()
assert len(lines) >= 8
# Stop testing with first repository
return
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
功能实现:将一个整数转换为它的罗马数字表示形式。接受1到3999之间的值(包括两个值)。
解读:
创建一个以(罗马值,整数)的形式包含元组的查找列表。
使用for循环在查找时遍历值。
使用divmod()用余数更新num,将罗马数字表示形式添加到结果中。
"""
def to_roman_numeral(num):
lookup = [
(1000, 'M'),
(900, 'CM'),
(500, 'D'),
(400, 'CD'),
(100, 'C'),
(90, 'XC'),
(50, 'L'),
(40, 'XL'),
(10, 'X'),
(9, 'IX'),
(5, 'V'),
(4, 'IV'),
(1, 'I'),
]
res = ''
for (n, roman) in lookup:
(d, num) = divmod(num, n)
res += roman * d
return res
# Examples
print(to_roman_numeral(3))
print(to_roman_numeral(11))
print(to_roman_numeral(1998))
# output:
# III
# XI
# MCMXCVIII
|
"""Rotate a matrix by 90 degrees."""
def rotate_in_place(matrix):
"""
Modify and return the original matrix.
rotated 90 degrees clockwise in place.
"""
try:
n = len(matrix)
m = len(matrix[0])
for i in range(n//2):
for j in range(i, m-1-i):
ii, jj = i, j
hold = matrix[ii][jj]
for _ in range(3):
matrix[ii][jj] = matrix[n-1-jj][ii]
ii, jj = n-1-jj, ii
matrix[ii][jj] = hold
except IndexError:
return matrix
return matrix
|
# @Title: 1比特与2比特字符 (1-bit and 2-bit Characters)
# @Author: KivenC
# @Date: 2018-07-12 21:25:38
# @Runtime: 32 ms
# @Memory: N/A
class Solution(object):
def isOneBitCharacter(self, bits):
"""
:type bits: List[int]
:rtype: bool
"""
k = 0
while k < len(bits)-1:
if bits[k] == 1:
k += 2
else:
k += 1
if k == len(bits)-1 and bits[k] == 0:
return True
else:
return False
|
class Human(object):
def __init__(self, world=None, age=20):
self.maxAge = 50
self.age = age
self.alive = True
self.world = world
def update(self):
self.age += 1
if self.age > self.maxAge:
self.alive = False
def get_age(self):
return self.age
def is_alive(self):
return self.alive
|
def import_class(path):
"""
Import a class from a dot-delimited module path. Accepts both dot and
colon seperators for the class portion of the path.
ex::
import_class('package.module.ClassName')
or
import_class('package.module:ClassName')
"""
if ':' in path:
module_path, class_name = str(path).split(':')
else:
module_path, class_name = str(path).rsplit('.', 1)
module = __import__(module_path, fromlist=[class_name], level=0)
return getattr(module, class_name)
|
answerDict = {
"New York" : "albany",
"California" : "sacramento",
"Alabama" : "montgomery",
"Ohio": "columbus",
"Utah": "salt lake city"
}
def checkAnswer(answer):
resultsDict = {}
for k,v in answer.items():
if answerDict[k] == v:
resultsDict[k] = True
else:
resultsDict[k] = False
return resultsDict
#print(checkAnswer({"New York": "albany","Utah": "salt lake city"}))
|
# this will create a 60 GB dummy asset file for testing the upload via
# the admin GUI.
LARGE_FILE_SIZE = 60 * 1024**3 # this is 60 GB
with open("xxxxxxl_asset_file.zip", "wb") as dummy_file:
dummy_file.seek(int(LARGE_FILE_SIZE) - 1)
dummy_file.write(b"\0")
|
#!/usr/bin/python
# Afficher les valeurs contenues dans le tableau
def affiche_tab(tab):
for i in range(len(tab)):
print(tab[i], ' | ', sep='', end='')
tab = [12, 18.5, 13.2, 8.75, 16, 15, 13.5, 12, 17]
# print(tab) # I ❤ Python
affiche_tab(tab)
|
class Solution:
def calculate(self, s: str) -> int:
stack = []
zero = ord('0')
operand = 0
res = 0
sign = 1
for ch in s:
if ch.isdigit():
operand = operand * 10 + ord(ch) - zero
elif ch == '+':
res += sign * operand
sign = 1
operand = 0
elif ch == '-':
res += sign * operand
sign = -1
operand = 0
elif ch == '(':
stack.append((sign, res))
sign = 1
res = 0
elif ch == ')':
prev_sign, prev_res = stack.pop()
res = prev_sign * (res + sign * operand) + prev_res
operand = 0
return res + sign * operand
|
#Replace all ‘0’ with ‘5’ in an input Integer
def get_number(no):
old=0
count=0
while(no!=0):
numb=no%10
no /=10
if(numb==0):
numb=5
old += numb * pow(10,count)
count += 1
print(old)
get_number(10120)
|
class libro:
def __init__(self, titulo, autor, editor, ISBN, año):
self.titulo= titulo
self.autor= autor
self.editor= editor
self.ISBN=ISBN
self.año= año
def setTitulo(self,titulo):
self.titulo=titulo
def setAutor(self,autor):
self.autor=autor
def setEditor(self,editor):
self.editor=editor
def setISBN(self,ISBN):
self.ISBN= ISBN
def setAño(self,año):
self.año=año
def getTitulo(self):
return self.titulo
def getAutor(self):
return self.autor
def getEditor(self):
return self.editor
def getISBN(self):
return self.ISBN
def getAño(self):
return self.año
|
"""Assorted class utilities and tools"""
class AttrDisplay:
def __repr__(self):
"""
Get representation object.
Returns
-------
str
Object representation.
"""
return "{}".format({key: value for key, value in self.__dict__.items() if not key.startswith('_') and value is not None})
if __name__ == "__main__":
pass
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Requires python 3.6+
#######################################################################################################################
# Global variables
# Can be reassigned by the settings from the configuration file
#######################################################################################################################
CONFIG_PATH = 'gitmon.conf' # main configuration file
DATA_PATH = 'data.json' # where to save data
UPDATE_INTERVAL = 0 # data check interval in minutes. '0' == one time only
GITHUB_BASE_URL = 'https://api.github.com/repos' # github base url
APP_LOGS_TYPE = 'console' # app logs type: none, file, console
APP_LOGS_FILE = 'gitmon.log' # app logs file
LOGGER = None # logger object. See setup.setup_log()
OPTIONS = {} # options, loaded from configuration file
|
def swap(i, j, arr):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def quicksort(arr, low, high):
if(low < high):
p = partition(arr, low, high);
quicksort(arr, low, p-1);
quicksort(arr, p+1, high);
def partition(arr, low, high):
pivot = arr[low]
i = low
j = high
while(i < j):
while(arr[i] <= pivot and i < high):
i += 1
while(arr[j] > pivot):
j -= 1
if i < j:
swap(i, j, arr)
swap(low, j, arr)
return j
arr = [65, 70, 75, 80, 85, 60, 55, 50, 45]
quicksort(arr, 0, len(arr)-1)
print(arr)
|
"""
© https://sudipghimire.com.np
create a classes Rectangle, Circle and Box and add respective attributes eg.: radius, length, width, height
for Rectangle, create methods to find out:
perimeter
area
length of diagonal
for Circle, create methods to find out:
circumference
area
diameter
for Box, create methods to find out:
surface area
volume
"""
# answer
|
expected_output = {
"system_auth_control": False,
"version": 3,
"interfaces": {
"Ethernet1/2": {
"interface": "Ethernet1/2",
"pae": "authenticator",
"port_control": "not auto",
"host_mode": "double host",
"re_authentication": False,
"timeout": {
"quiet_period": 59,
"server_timeout": 29,
"supp_timeout": 29,
"tx_period": 29,
"ratelimit_period": 1,
"re_auth_period": 59,
"time_to_next_reauth": 16,
},
"re_auth_max": 1,
"max_req": 2,
"mac-auth-bypass": True,
"clients": {
"53:ab:de:ff:e5:e5": {
"client": "53:ab:de:ff:e5:e5",
"session": {
"auth_sm_state": "authenticated",
"auth_bend_sm_state": "idle",
"auth_by": "remote",
"reauth_action": "reauthenticate",
},
"auth_method": "eap",
}
},
"port_status": "authorized",
}
},
}
|
# -*- coding: utf-8 -*-
# From http://www.w3.org/WAI/ER/IG/ert/iso639.htm
# ISO 639: 2-letter codes
languages = {
'aa': 'afar',
'ab': 'abkhazian',
'af': 'afrikaans',
'am': 'amharic',
'ar': 'arabic',
'as': 'assamese',
'ay': 'aymara',
'az': 'azerbaijani',
'ba': 'bashkir',
'be': 'byelorussian',
'bg': 'bulgarian',
'bh': 'bihari',
'bi': 'bislama',
'bn': 'bengali',
'bo': 'tibetan',
'br': 'breton',
'ca': 'catalan',
'co': 'corsican',
'cs': 'czech',
'cy': 'welsh',
'da': 'danish',
'de': 'german',
'dz': 'bhutani',
'el': 'greek',
'en': 'english',
'eo': 'esperanto',
'es': 'spanish',
'et': 'estonian',
'eu': 'basque',
'fa': 'persian',
'fi': 'finnish',
'fj': 'fiji',
'fo': 'faeroese',
'fr': 'french',
'fy': 'frisian',
'ga': 'irish',
'gd': 'gaelic',
'gl': 'galician',
'gn': 'guarani',
'gu': 'gujarati',
'ha': 'hausa',
'hi': 'hindi',
'hr': 'croatian',
'hu': 'hungarian',
'hy': 'armenian',
'ia': 'interlingua',
'ie': 'interlingue',
'ik': 'inupiak',
'in': 'indonesian',
'is': 'icelandic',
'it': 'italian',
'iw': 'hebrew',
'ja': 'japanese',
'ji': 'yiddish',
'jw': 'javanese',
'ka': 'georgian',
'kk': 'kazakh',
'kl': 'greenlandic',
'km': 'cambodian',
'kn': 'kannada',
'ko': 'korean',
'ks': 'kashmiri',
'ku': 'kurdish',
'ky': 'kirghiz',
'la': 'latin',
'ln': 'lingala',
'lo': 'laothian',
'lt': 'lithuanian',
'lv': 'latvian',
'mg': 'malagasy',
'mi': 'maori',
'mk': 'macedonian',
'ml': 'malayalam',
'mn': 'mongolian',
'mo': 'moldavian',
'mr': 'marathi',
'ms': 'malay',
'mt': 'maltese',
'my': 'burmese',
'na': 'nauru',
'ne': 'nepali',
'nl': 'dutch',
'no': 'norwegian',
'oc': 'occitan',
'om': 'oromo',
'or': 'oriya',
'pa': 'punjabi',
'pl': 'polish',
'ps': 'pushto',
'pt': 'portuguese',
'qu': 'quechua',
'rm': 'rhaeto-romance',
'rn': 'kirundi',
'ro': 'romanian',
'ru': 'russian',
'rw': 'kinyarwanda',
'sa': 'sanskrit',
'sd': 'sindhi',
'sg': 'sangro',
'sh': 'serbo-croatian',
'si': 'singhalese',
'sk': 'slovak',
'sl': 'slovenian',
'sm': 'samoan',
'sn': 'shona',
'so': 'somali',
'sq': 'albanian',
'sr': 'serbian',
'ss': 'siswati',
'st': 'sesotho',
'su': 'sudanese',
'sv': 'swedish',
'sw': 'swahili',
'ta': 'tamil',
'te': 'tegulu',
'tg': 'tajik',
'th': 'thai',
'ti': 'tigrinya',
'tk': 'turkmen',
'tl': 'tagalog',
'tn': 'setswana',
'to': 'tonga',
'tr': 'turkish',
'ts': 'tsonga',
'tt': 'tatar',
'tw': 'twi',
'uk': 'ukrainian',
'ur': 'urdu',
'uz': 'uzbek',
'vi': 'vietnamese',
'vo': 'volapuk',
'wo': 'wolof',
'xh': 'xhosa',
'yo': 'yoruba',
'zh': 'chinese',
'zu': 'zulu',
}
|
class EDGARQueryError(Exception):
"""
This error is thrown when a query receives a response that is not a 200 response.
"""
def __str__(self):
return "An error occured while making the query."
class EDGARFieldError(Exception):
"""
This error is thrown when an invalid field is given to an endpoint.
"""
def __init__(self, endpoint, field):
self.endpoint = endpoint
self.field = field
def __str__(self):
return "Field {field} not found in endpoint {endpoint}".format(
field=self.field, endpoint=self.endpoint
)
class CIKError(Exception):
"""
This error is thrown when an invalid CIK is given.
"""
def __init__(self, cik):
self.cik = cik
def __str__(self):
return "CIK {cik} not valid.".format(cik=self.cik)
class FilingTypeError(Exception):
"""This error is thrown when an invalid filing type is given. """
def __str__(self):
return "The filing type given is not valid. " \
"Filing type must be in valid filing type from FilingType class"
|
#FileExample2.py ----Writing data to file
#opening file in write mode
fp = open("info.dat",'w')
#Writing data to file
fp.write("Hello Suprit this is Python")
#Check message
print("Data Inserted to file Successfully!\nPlease Verify.")
|
class EnvVariableFile(object):
T_WORK = '/ade/kgurupra_dte8028/oracle/work/build_run_robot1/../'
VIEW_ROOT = '/ade/kgurupra_dte8028'
BROWSERTYPE = 'firefox' ########################For OID info################################################
OID_HOST = 'slc06xgk.us.oracle.com'
OID_PORT = '15635'
OID_SSL_PORT = '22718'
OID_ADMIN = 'cn=orcladmin'
OID_ADMIN_PASSWORD = 'welcome1'
# # ########################For OHS&WG info################################################
# OHS_HOST = 'idmr2ps3.us.oracle.com'
# OHS_INSTANCE_HOME = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2'
# OHS_COMPONENT_NAME = 'standal_ohs2'
# OHS_MW_HOME = '/scratch/amywork/ohs9743'
# OHS_WL_HOME = '/scratch/amywork/ohs9743/wlserver'
# OHS_COMMON_ORACLE_HOME = '/scratch/amywork/ohs9743/oracle_common'
# OHS_ADMIN_PORT = '1111'
# OHS_LISTEN_PORT = '23191'
# OHS_SSL_LISTEN_PORT = '3333'
# OHS_WLS_PWD = 'welcome1'
# WEBGATE_ID = 'oam_12wg149'
# OHS_WG_INST_HOME = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/config/fmwconfig/components/OHS/instances/standal_ohs2/webgate/config'
# OHS_INSTANCE_NM_START = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startNodeManager.sh'
# OHS_INSTANCE_NM_STOP = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopNodeManager.sh'
# OHS_INSTANCE_BIN_START = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh'
# OHS_INSTANCE_BIN_STOP = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh'
# OHS_INSTANCE_BIN_START_CMD = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh standal_ohs2'
# OHS_INSTANCE_BIN_STOP_CMD = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh standal_ohs2'
# RESOURCE_URL = 'http://slc03sfc.us.oracle.com:2222/index.html'
# RESOURCE_APPURL = 'http://slc03sfc.us.oracle.com:2222/app1/pages/Sample.jsp'
#
# ########################For OAM sever info################################################
OHS_HOST = 'den00rum.us.oracle.com'
OHS_INSTANCE_HOME = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2'
OHS_COMPONENT_NAME = 'standal_ohs2'
OHS_MW_HOME = '/scratch/kgurupra/A1/ohs3941'
OHS_WL_HOME = '/scratch/kgurupra/A1/ohs3941/wlserver'
OHS_COMMON_ORACLE_HOME = '/scratch/kgurupra/A1/ohs3941/oracle_common'
OHS_ADMIN_PORT = '1111'
OHS_LISTEN_PORT = '7777'
OHS_SSL_LISTEN_PORT = '3333'
OHS_WLS_PWD = 'welcome1'
WEBGATE_ID = 'oam_12wg3697'
OHS_WG_INST_HOME = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/config/fmwconfig/components/OHS/instances/standal_ohs2/webgate/config'
OHS_INSTANCE_NM_START = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/startNodeManager.sh'
OHS_INSTANCE_NM_STOP = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/stopNodeManager.sh'
OHS_INSTANCE_BIN_START = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh'
OHS_INSTANCE_BIN_STOP = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh'
OHS_INSTANCE_BIN_START_CMD = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh standal_ohs2'
OHS_INSTANCE_BIN_STOP_CMD = '/scratch/kgurupra/A1/ohs3941/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh standal_ohs2'
RESOURCE_URL = 'http://den02mpu.us.oracle.com:2222/index.html'
RESOURCE_APPURL = 'http://den02mpu.us.oracle.com:2222/app1/pages/Sample.jsp'
# ########################For OHS&WG info################################################
OAM_ADMSERVER_HOST = 'den00rum.us.oracle.com'
OAM_ADMSERVER_PORT = '7001'
OAM_ADMSERVER_SSLPORT = '23009'
OAM_MNGSERVER_PORT = '14100'
OAM_MNGSERVER_SSLPORT = '20261'
OAM_MNGSERVER_NAME = 'oam_server1'
OAM_ADMIN_USER = 'weblogic'
OAM_ADMIN_PWD = 'welcome1'
OAM_WLS_USER = 'weblogic'
OAM_WLS_PWD = 'welcome1'
OAM_MW_HOME = '/scratch/kgurupra/A1/mw5470'
OAM_ORACLE_HOME = '/scratch/kgurupra/A1/mw5470/idm'
OAM_DOMAIN_HOME = '/scratch/kgurupra/A1/mw5470/user_projects/domains/WLS_IDM'
OAM_WLS_HOME = '/scratch/kgurupra/A1/mw5470/wlserver'
JKSSTORE_PATH = '/scratch/kgurupra/A1/mw5470/wlserver/server/lib/DemoTrust.jks'
WLS_CONSOLE_URL = 'den02mpu.us.oracle.com/22456/console'
OAM_CONSOLE_URL = 'den02mpu.us.oracle.com/22456/oamconsole'
OAM_ID_STORE = 'UserIdentityStore1'
# OAM_ADMSERVER_HOST = 'den02mpu.us.oracle.com'
# OAM_ADMSERVER_PORT = '22456'
# OAM_ADMSERVER_SSLPORT = '17093'
# OAM_MNGSERVER_PORT = '18180'
# OAM_MNGSERVER_SSLPORT = '21645'
# OAM_MNGSERVER_NAME = 'oam_server1'
# OAM_ADMIN_USER = 'weblogic'
# OAM_ADMIN_PWD = 'weblogic1'
# OAM_WLS_USER = 'weblogic'
# OAM_WLS_PWD = 'weblogic1'
# OAM_MW_HOME = '/scratch/aime1/work/mw2501'
# OAM_ORACLE_HOME = '/scratch/aime1/work/mw2501/idm'
# OAM_DOMAIN_HOME = '/scratch/aime1/work/mw2501/user_projects/domains/WLS_IDM'
# OAM_WLS_HOME = '/scratch/aime1/work/mw2501/wlserver'
# JKSSTORE_PATH = '/scratch/aime1/work/mw2501/wlserver/server/lib/DemoTrust.jks'
# WLS_CONSOLE_URL = 'adc00sax.us.oracle.com/18196/console'
# OAM_CONSOLE_URL = 'adc00sax.us.oracle.com/18196/oamconsole'
# OAM_ID_STORE = 'UserIdentityStore1'
# OHS_HOST = 'slc03sfc.us.oracle.com'
# OHS_INSTANCE_HOME = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2'
# OHS_COMPONENT_NAME = 'standal_ohs2'
# OHS_MW_HOME = '/scratch/amywork/ohs9743'
# OHS_WL_HOME = '/scratch/amywork/ohs9743/wlserver'
# OHS_COMMON_ORACLE_HOME = '/scratch/amywork/ohs9743/oracle_common'
# OHS_ADMIN_PORT = '1111'
# OHS_LISTEN_PORT = '2222'
# OHS_SSL_LISTEN_PORT = '3333'
# OHS_WLS_PWD = 'welcome1'
# WEBGATE_ID = 'oam_12wg149'
# OHS_WG_INST_HOME = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/config/fmwconfig/components/OHS/instances/standal_ohs2/webgate/config'
# OHS_INSTANCE_NM_START = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startNodeManager.sh'
# OHS_INSTANCE_NM_STOP = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopNodeManager.sh'
# OHS_INSTANCE_BIN_START = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh'
# OHS_INSTANCE_BIN_STOP = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh'
# OHS_INSTANCE_BIN_START_CMD = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh standal_ohs2'
# OHS_INSTANCE_BIN_STOP_CMD = '/scratch/amywork/ohs9743/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh standal_ohs2'
# RESOURCE_URL = 'http://slc03sfc.us.oracle.com:2222/index.html'
# RESOURCE_APPURL = 'http://slc03sfc.us.oracle.com:2222/app1/pages/Sample.jsp'
# IDENTITYPROVIDER='IDSPROFILE-OUD_Amy'
#
# ########################For OAM sever info################################################
# OAM_ADMSERVER_HOST = 'slc03sfc.us.oracle.com'
# OAM_ADMSERVER_PORT = '17416'
# OAM_ADMSERVER_SSLPORT = '22290'
# OAM_MNGSERVER_PORT = '17647'
# OAM_MNGSERVER_SSLPORT = '17493'
# OAM_MNGSERVER_NAME = 'oam_server1'
# OAM_ADMIN_USER = 'oamAdmin'
# OAM_ADMIN_PWD = 'Welcome1'
# OAM_WLS_USER = 'oamAdmin'
# OAM_WLS_PWD = 'Welcome1'
# OAM_MW_HOME = '/scratch/amywork/mw8296'
# OAM_ORACLE_HOME = '/scratch/amywork/mw8296/idm'
# OAM_DOMAIN_HOME = '/scratch/amywork/mw8296/user_projects/domains/WLS_IDM'
# OAM_WLS_HOME = '/scratch/amywork/mw8296/wlserver'
# JKSSTORE_PATH = '/scratch/amywork/mw8296/wlserver/server/lib/DemoTrust.jks'
# WLS_CONSOLE_URL = 'slc03sfc.us.oracle.com/17416/console'
# OAM_CONSOLE_URL = 'slc03sfc.us.oracle.com/17416/oamconsole'
# ########################For OHS&WG info################################################
# OHS_HOST = 'slc07jgj.us.oracle.com'
# OHS_INSTANCE_HOME = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2'
# OHS_COMPONENT_NAME = 'standal_ohs2'
# OHS_MW_HOME = '/scratch/amywork/ohs8447'
# OHS_WL_HOME = '/scratch/amywork/ohs8447/wlserver'
# OHS_COMMON_ORACLE_HOME = '/scratch/amywork/ohs8447/oracle_common'
# OHS_ADMIN_PORT = '1111'
# OHS_LISTEN_PORT = '2222'
# OHS_SSL_LISTEN_PORT = '3333'
# OHS_WLS_PWD = 'welcome1'
# WEBGATE_ID = 'ThreeLeggedWG'
# OHS_WG_INST_HOME = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/config/fmwconfig/components/OHS/instances/standal_ohs2/webgate/config'
# OHS_INSTANCE_NM_START = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/startNodeManager.sh'
# OHS_INSTANCE_NM_STOP = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/stopNodeManager.sh'
# OHS_INSTANCE_BIN_START = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh'
# OHS_INSTANCE_BIN_STOP = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh'
# OHS_INSTANCE_BIN_START_CMD = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/startComponent.sh standal_ohs2'
# OHS_INSTANCE_BIN_STOP_CMD = '/scratch/amywork/ohs8447/user_projects/domains/OHSDomain_standa2/bin/stopComponent.sh standal_ohs2'
# RESOURCE_URL = 'http://slc07jgj.us.oracle.com:2222/index.html'
# RESOURCE_APPURL = 'http://slc07jgj.us.oracle.com:2222/app1/pages/Sample.jsp'
# #
# ########################For OAM sever info################################################
# OAM_ADMSERVER_HOST = 'slc07jgj.us.oracle.com'
# OAM_ADMSERVER_PORT = '20192'
# OAM_ADMSERVER_SSLPORT = '20981'
# OAM_MNGSERVER_PORT = '20053'
# OAM_MNGSERVER_SSLPORT = '21283'
# OAM_MNGSERVER_NAME = 'oam_server1'
# OAM_ADMIN_USER = 'oamAdmin'
# OAM_ADMIN_PWD = 'Welcome1'
# OAM_WLS_USER = 'oamAdmin'
# OAM_WLS_PWD = 'Welcome1'
# OAM_MW_HOME = '/scratch/amywork/mw7624'
# OAM_ORACLE_HOME = '/scratch/amywork/mw7624/idm'
# OAM_DOMAIN_HOME = '/scratch/amywork/mw7624/user_projects/domains/WLS_IDM'
# OAM_WLS_HOME = '/scratch/amywork/mw7624/wlserver'
# JKSSTORE_PATH = '/scratch/amywork/mw7624/wlserver/server/lib/DemoTrust.jks'
# WLS_CONSOLE_URL = 'slc07jgj.us.oracle.com/20192/console'
# OAM_CONSOLE_URL = 'slc07jgj.us.oracle.com/20192/oamconsole'
# ########################For OAM sever info################################################
#
# OAM_ADMSERVER_HOST = 'den02mpu.us.oracle.com'
# OAM_ADMSERVER_PORT = '24153'
# OAM_ADMSERVER_SSLPORT = '20139'
# OAM_MNGSERVER_PORT = '21010'
# OAM_MNGSERVER_SSLPORT = '18389'
# OAM_MNGSERVER_NAME = 'oam_server1'
# OAM_ADMIN_USER = 'oamAdminUser'
# OAM_ADMIN_PWD = 'welcome1'
# OAM_WLS_USER = 'oamAdminUser'
# OAM_WLS_PWD = 'welcome1'
# OAM_MW_HOME = '/scratch/kgurupra/A1/mw8368'
# OAM_ORACLE_HOME = '/scratch/kgurupra/A1/mw8368/idm'
# OAM_DOMAIN_HOME = '/scratch/kgurupra/A1/mw8368/user_projects/domains/WLS_IDM'
# OAM_WLS_HOME = '/scratch/kgurupra/A1/mw8368/wlserver'
# JKSSTORE_PATH = '/scratch/kgurupra/A1/mw8368/wlserver/server/lib/DemoTrust.jks'
# WLS_CONSOLE_URL = 'den02mpu.us.oracle.com/24153/console'
# OAM_CONSOLE_URL = 'den02mpu.us.oracle.com/24153/oamconsole'
########################For DATABASE################################################
DATABASE_HOST = 'slc06xgk.us.oracle.com'
DATABASE_SID = 'db2647'
DATABASE_PORT = '11236'
RCU_OIM = '%RCU_OIM%'
RCU_OIM_PASSWD = '%RCU_OIM_PASSWD%'
########################FOR OUD Config################################################
OUD_HOST = '%OUD_HOST%'
OUD_PORT = '%OUD_PORT%'
OUD_ADMIN_USER = '%OUD_ADMIN_USER%'
OUD_ADMIN_PWD = '%OUD_ADMIN_PWD%'
OUD_SSL_PORT = '%OUD_SSL_PORT%'
OUD_BASE_DN = '%OUD_BASE_DN%'
########################Others################################################
FIREFOX_BIN = '/ade/kgurupra_dte8028/oracle/work/INSTALL_FIREFOX14/../firefox/firefox'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
########################For HAPROXY LBR INFO################################################
DC1_HAPROXY_INSTALL_LOC = '/scratch/kgurupra/APR14/test_proxy1'
DC1_HAPROXY_LBR_HOST = 'slc12ldo.us.oracle.com'
DC1_HAPROXY_CONFIG_FILE = '/scratch/kgurupra/APR14/test_proxy1/haproxy/sbin/haproxy_single.cfg'
DC1_LBR_PORT = '17777'
DC1_OHS1_HOSTNAME = 'slc12ldo.us.oracle.com'
DC1_OHS1_PORT = '2222'
DC1_OHS2_HOSTNAME = 'slc09cor.us.oracle.com'
DC1_OHS2_PORT = '2222'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
########################For DATABASE BLOCK ################################################
DC1_DB_HOSTNAME = 'slc12ldo.us.oracle.com'
DC1_DB_ORACLE_HOME = '/scratch/kgurupra/APR14/db1246'
DC1_DB_ORACLE_SID = 'db1246'
DC1_DB_GLOBAL_DB_NAME = 'db1246.us.oracle.com'
DC1_DB_DB_PORT = '15581'
DC1_DB_SYS_PASSWORD = 'welcome1'
DC1_DB_CONNECTION_STRING = 'slc12ldo.us.oracle.com:15581:db1246'
########################For RCUPHASE BLOCK ################################################
DC1_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw5651/oracle_common'
DC1_DB_OAM_SCHEMANAME = 'db1246_OAM'
########################For IDM_NEXTGEN_CONFIG1 BLOCK ################################################
DC1_OAM_PROXYPORT = '5575'
DC1_WLS_USER = 'weblogic'
DC1_WLS_PWD = 'weblogic1'
DC1_WLS_DOMAIN_NAME = 'WLS_IDM'
DC1_MW_HOME = '/scratch/kgurupra/APR14/mw5651'
DC1_WL_HOME = '/scratch/kgurupra/APR14/mw5651/wlserver'
DC1_ORACLE_HOME = '/scratch/kgurupra/APR14/mw5651/idm'
DC1_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/mw5651/user_projects/domains/WLS_IDM'
DC1_WLS_CONSOLE_PORT = '17800'
DC1_WLS_CONSOLE_SSLPORT = '17978'
DC1_HOSTNAME = 'slc12ldo.us.oracle.com'
DC1_ADMIN_SERVER_NAME = 'AdminServer'
DC1_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw5651/oracle_common'
DC1_SHUTDOWN_SCRIPT = '/scratch/kgurupra/APR14/mw5651/idm/shutdown.csh'
DC1_OAM_MNGSERVER_NAME = 'oam_server1'
DC1_OAM_MNGSERVER_PORT = '15729'
DC1_OAM_MNGSERVER_SSL_PORT = '16137'
DC1_OAMPOL_MNGSERVER_NAME = 'oam_policy_mgr1'
DC1_OAMPOL_MNGSERVER_PORT = '16489'
DC1_OAMPOL_MNGSERVER_SSL_PORT = '24549'
########################For OID info################################################
########################For 11g OHS&WG info################################################
DC1_WEBT11g_WL_HOME = '/scratch/kgurupra/APR14/mw6608/wlserver_10.3'
DC1_WEBT11g_JDK_HOME = '/net/adcnas418/export/farm_fmwqa/java/linux64/jdk7u80'
########################For JRF_INSTALL ################################################
DC1_OHS12C_WGID = 'DC1WG'
DC1_WG_OHS_PORT = '2222'
DC1_OHS12C_HOSTNAME = 'slc12ldo.us.oracle.com'
DC1_RREG_OUTPUT =''
########################For JRF_INSTALL ################################################
DC1_JRF_INSTALL_JDK_HOME = '/ade_autofs/gd29_3rdparty/JDK8_MAIN_LINUX.X64.rdd/LATEST/jdk8/'
DC1_JRF_INSTALL_MW_HOME = '/scratch/kgurupra/APR14/mw4522/wlserver'
DC1_JRF_SHIPHOME = '/ade/kgurupra_dte2941/oracle/work/JRF_INSTALL/stage/fmw_12.2.1.3.0_infrastructure_generic.jar'
########################For FMW_OHS_INST1 ################################################
DC1_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs5082'
DC1_OHS12C_INSTALL_TYPE = 'STANDALONE'
########################For FMW_OHS_INST1 ################################################
DC1_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs5082'
DC1_OHS12C_INSTALL_TYPE = 'STANDALONE'
DC1_NODEMGR_PORT = '5556'
########################For Create_Standalone_Instance ################################################
DC1_OHS12C_WLS_USER = 'weblogic'
DC1_OHS12C_WLS_PWD = 'welcome1'
DC1_OHS12C_WLS_DOMAIN_NAME = 'OHSDomain_standa2'
DC1_OHS_INSTANCE_NAME = 'standal_ohs2'
DC1_OHS12C_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs5082/user_projects/domains/OHSDomain_standa2'
DC1_OHS12C_MW_HOME = '/scratch/kgurupra/APR14/ohs5082'
DC1_OHS12C_ADMIN_PORT = '1111'
DC1_OHS12C_LISTEN_PORT = '2222'
DC1_OHS12C_SSL_LISTEN_PORT = '3333'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
########################For DATABASE BLOCK ################################################
DC2_DB_HOSTNAME = 'slc09cor.us.oracle.com'
DC2_DB_ORACLE_HOME = '/scratch/kgurupra/APR14/db6075'
DC2_DB_ORACLE_SID = 'db6075'
DC2_DB_GLOBAL_DB_NAME = 'db6075.us.oracle.com'
DC2_DB_DB_PORT = '11378'
DC2_DB_SYS_PASSWORD = 'welcome1'
DC2_DB_CONNECTION_STRING = 'slc09cor.us.oracle.com:11378:db6075'
########################For RCUPHASE BLOCK ################################################
DC2_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/oracle_common'
DC2_DB_OAM_SCHEMANAME = 'db6075_OAM'
########################For IDM_NEXTGEN_CONFIG1 BLOCK ################################################
DC2_OAM_PROXYPORT = '5575'
DC2_WLS_USER = 'weblogic'
DC2_WLS_PWD = 'weblogic1'
DC2_WLS_DOMAIN_NAME = 'WLS_IDM'
DC2_MW_HOME = '/scratch/kgurupra/APR14/mw33'
DC2_WL_HOME = '/scratch/kgurupra/APR14/mw33/wlserver'
DC2_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/idm'
DC2_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/mw33/user_projects/domains/WLS_IDM'
DC2_WLS_CONSOLE_PORT = '21226'
DC2_WLS_CONSOLE_SSLPORT = '15458'
DC2_HOSTNAME = 'slc09cor.us.oracle.com'
DC2_ADMIN_SERVER_NAME = 'AdminServer'
DC2_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/oracle_common'
DC2_SHUTDOWN_SCRIPT = '/scratch/kgurupra/APR14/mw33/idm/shutdown.csh'
DC2_FRONT_END_PORT =''
DC2_FRONT_END_HOST =''
DC2_OAM_MNGSERVER_NAME = 'oam_server1'
DC2_OAM_MNGSERVER_PORT = '24618'
DC2_OAM_MNGSERVER_SSL_PORT = '15011'
DC2_OAMPOL_MNGSERVER_NAME = 'oam_policy_mgr1'
DC2_OAMPOL_MNGSERVER_PORT = '18230'
DC2_OAMPOL_MNGSERVER_SSL_PORT = '24786'
DC2_OAM_MNGSERVER2_NAME =''
DC2_OAM_MNGSERVER2_PORT =''
DC2_OAM_MNGSERVER2_SSL_PORT =''
DC2_OAMPOL_MNGSERVER2_NAME =''
DC2_OAMPOL_MNGSERVER2_PORT =''
DC2_OAMPOL_MNGSERVER2_SSL_PORT =''
########################For OID info################################################
DC2_OID_DOMAIN_HOME =''
DC2_OID_HOSTNAME =''
DC2_LDAP_SSL_PORT =''
DC2_LDAP_NONSSL_PORT =''
DC2_OID_INSTANCE_HOME =''
DC2_OID_ADMIN_PASSWORD =''
DC2_OID_USER =''
DC2_OID_NAMESPACE =''
########################For 11g OHS&WG info################################################
DC2_WEBT11g_WL_HOME = '/scratch/kgurupra/APR14/mw8133/wlserver_10.3'
DC2_WEBT11g_JDK_HOME = '/net/adcnas418/export/farm_fmwqa/java/linux64/jdk7u80'
########################For JRF_INSTALL ################################################
DC2_OHS12C_WGID = 'DC1WG'
DC2_WG_OHS_PORT = '2222'
DC2_OHS12C_HOSTNAME = 'slc09cor.us.oracle.com'
DC2_RREG_OUTPUT =''
########################For JRF_INSTALL ################################################
DC2_JRF_INSTALL_JDK_HOME = '/ade_autofs/gd29_3rdparty/JDK8_MAIN_LINUX.X64.rdd/LATEST/jdk8/'
DC2_JRF_INSTALL_MW_HOME = '/scratch/kgurupra/APR14/mw4522/wlserver'
DC2_JRF_SHIPHOME = '/ade/kgurupra_dte2941/oracle/work/JRF_INSTALL/stage/fmw_12.2.1.3.0_infrastructure_generic.jar'
########################For FMW_OHS_INST1 ################################################
DC2_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC2_OHS12C_INSTALL_TYPE = 'STANDALONE'
########################For FMW_OHS_INST1 ################################################
DC2_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC2_OHS12C_INSTALL_TYPE = 'STANDALONE'
DC2_NODEMGR_PORT = '5556'
########################For Create_Standalone_Instance ################################################
DC2_OHS12C_WLS_USER = 'weblogic'
DC2_OHS12C_WLS_PWD = 'welcome1'
DC2_OHS12C_WLS_DOMAIN_NAME = 'OHSDomain_standa2'
DC2_OHS_INSTANCE_NAME = 'standal_ohs2'
DC2_OHS12C_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs6725/user_projects/domains/OHSDomain_standa2'
DC2_OHS12C_MW_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC2_OHS12C_ADMIN_PORT = '1111'
DC2_OHS12C_LISTEN_PORT = '2222'
DC2_OHS12C_SSL_LISTEN_PORT = '3333'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
########################For DATABASE BLOCK ################################################
DC3_DB_HOSTNAME = 'slc09cor.us.oracle.com'
DC3_DB_ORACLE_HOME = '/scratch/kgurupra/APR14/db6075'
DC3_DB_ORACLE_SID = 'db6075'
DC3_DB_GLOBAL_DB_NAME = 'db6075.us.oracle.com'
DC3_DB_DB_PORT = '11378'
DC3_DB_SYS_PASSWORD = 'welcome1'
DC3_DB_CONNECTION_STRING = 'slc09cor.us.oracle.com:11378:db6075'
########################For RCUPHASE BLOCK ################################################
DC3_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/oracle_common'
DC3_DB_OAM_SCHEMANAME = 'db6075_OAM'
########################For IDM_NEXTGEN_CONFIG1 BLOCK ################################################
DC3_OAM_PROXYPORT = '5575'
DC3_WLS_USER = 'weblogic'
DC3_WLS_PWD = 'weblogic1'
DC3_WLS_DOMAIN_NAME = 'WLS_IDM'
DC3_MW_HOME = '/scratch/kgurupra/APR14/mw33'
DC3_WL_HOME = '/scratch/kgurupra/APR14/mw33/wlserver'
DC3_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/idm'
DC3_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/mw33/user_projects/domains/WLS_IDM'
DC3_WLS_CONSOLE_PORT = '21226'
DC3_WLS_CONSOLE_SSLPORT = '15458'
DC3_HOSTNAME = 'slc09cor.us.oracle.com'
DC3_ADMIN_SERVER_NAME = 'AdminServer'
DC3_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/mw33/oracle_common'
DC3_SHUTDOWN_SCRIPT = '/scratch/kgurupra/APR14/mw33/idm/shutdown.csh'
DC3_FRONT_END_PORT =''
DC3_FRONT_END_HOST =''
DC3_OAM_MNGSERVER_NAME = 'oam_server1'
DC3_OAM_MNGSERVER_PORT = '24618'
DC3_OAM_MNGSERVER_SSL_PORT = '15011'
DC3_OAMPOL_MNGSERVER_NAME = 'oam_policy_mgr1'
DC3_OAMPOL_MNGSERVER_PORT = '18230'
DC3_OAMPOL_MNGSERVER_SSL_PORT = '24786'
DC3_OAM_MNGSERVER2_NAME =''
DC3_OAM_MNGSERVER2_PORT =''
DC3_OAM_MNGSERVER2_SSL_PORT =''
DC3_OAMPOL_MNGSERVER2_NAME =''
DC3_OAMPOL_MNGSERVER2_PORT =''
DC3_OAMPOL_MNGSERVER2_SSL_PORT =''
########################For OID info################################################
DC3_OID_DOMAIN_HOME =''
DC3_OID_HOSTNAME =''
DC3_LDAP_SSL_PORT =''
DC3_LDAP_NONSSL_PORT =''
DC3_OID_INSTANCE_HOME =''
DC3_OID_ADMIN_PASSWORD =''
DC3_OID_USER =''
DC3_OID_NAMESPACE =''
########################For 11g OHS&WG info################################################
DC3_WEBT11g_WL_HOME = '/scratch/kgurupra/APR14/mw8133/wlserver_10.3'
DC3_WEBT11g_JDK_HOME = '/net/adcnas418/export/farm_fmwqa/java/linux64/jdk7u80'
########################For JRF_INSTALL ################################################
DC3_OHS12C_WGID = 'DC1WG'
DC3_WG_OHS_PORT = '2222'
DC3_OHS12C_HOSTNAME = 'slc09cor.us.oracle.com'
DC3_RREG_OUTPUT =''
########################For JRF_INSTALL ################################################
DC3_JRF_INSTALL_JDK_HOME = '/ade_autofs/gd29_3rdparty/JDK8_MAIN_LINUX.X64.rdd/LATEST/jdk8/'
DC3_JRF_INSTALL_MW_HOME = '/scratch/kgurupra/APR14/mw4522/wlserver'
DC3_JRF_SHIPHOME = '/ade/kgurupra_dte2941/oracle/work/JRF_INSTALL/stage/fmw_12.2.1.3.0_infrastructure_generic.jar'
########################For FMW_OHS_INST1 ################################################
DC3_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC3_OHS12C_INSTALL_TYPE = 'STANDALONE'
########################For FMW_OHS_INST1 ################################################
DC3_OHS12C_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC3_OHS12C_INSTALL_TYPE = 'STANDALONE'
DC3_NODEMGR_PORT = '5556'
########################For Create_Standalone_Instance ################################################
DC3_OHS12C_WLS_USER = 'weblogic'
DC3_OHS12C_WLS_PWD = 'welcome1'
DC3_OHS12C_WLS_DOMAIN_NAME = 'OHSDomain_standa2'
DC3_OHS_INSTANCE_NAME = 'standal_ohs2'
DC3_OHS12C_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs6725/user_projects/domains/OHSDomain_standa2'
DC3_OHS12C_MW_HOME = '/scratch/kgurupra/APR14/ohs6725'
DC3_OHS12C_ADMIN_PORT = '1111'
DC3_OHS12C_LISTEN_PORT = '2222'
DC3_OHS12C_SSL_LISTEN_PORT = '3333'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
######################## For FIAT ################################################
MDC_ATTR = '/ade/kgurupra_dte2941/oracle/work/config.properties'
########################For CFG_RESOURCE_WG ################################################
OHS_INSTANCE1_WLS_USER = 'weblogic'
RWG_NODEMGR_PORT = '5556'
OHS_INSTANCE1_WLS_PWD = 'welcome1'
RWG_WG1_HOSTNAME = 'slc12pcc.us.oracle.com'
RWG_WG2_HOSTNAME = 'slc12pcc.us.oracle.com'
RWG_WG3_HOSTNAME = 'slc12pcc.us.oracle.com'
RWG_WG4_HOSTNAME =''
OHS_INSTANCE1_WLS_DOMAIN_NAME = 'OHSDomain_rwg'
OHS_INSTANCE1_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs1932/user_projects/domains/OHSDomain_rwg'
OHS_INSTANCE1_MW_HOME = '/scratch/kgurupra/APR14/ohs1932'
OHS_INSTANCE1_WL_HOME = '/scratch/kgurupra/APR14/ohs1932/wlserver'
OHS_INSTANCE1_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs1932/oracle_common'
OHS_INSTANCE1_OHS_INSTANCE_NAME = 'rwg6222'
OHS_INSTANCE1_LISTEN_PORT = '6222'
OHS_INSTANCE1_SSL_LISTEN_PORT = '6223'
OHS_INSTANCE1_ADMIN_PORT = '6221'
OHS_INSTANCE1_WGID = 'WG6222'
OHS_INSTANCE1_WG_PORT = '6222'
OHS_INSTANCE2_WLS_USER = 'weblogic'
OHS_INSTANCE2_WLS_PWD = 'welcome1'
OHS_INSTANCE2_WLS_DOMAIN_NAME = 'OHSDomain_rwg'
OHS_INSTANCE2_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs1932/user_projects/domains/OHSDomain_rwg'
OHS_INSTANCE2_MW_HOME = '/scratch/kgurupra/APR14/ohs1932'
OHS_INSTANCE2_WL_HOME = '/scratch/kgurupra/APR14/ohs1932/wlserver'
OHS_INSTANCE2_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs1932/oracle_common'
OHS_INSTANCE2_OHS_INSTANCE_NAME = 'rwg7222'
OHS_INSTANCE2_LISTEN_PORT = '7222'
OHS_INSTANCE2_SSL_LISTEN_PORT = '7223'
OHS_INSTANCE2_ADMIN_PORT = '7221'
OHS_INSTANCE2_WGID = 'WG7222'
OHS_INSTANCE2_WG_PORT = '7222'
OHS_INSTANCE3_WLS_USER = 'weblogic'
OHS_INSTANCE3_WLS_PWD = 'welcome1'
OHS_INSTANCE3_WLS_DOMAIN_NAME = 'OHSDomain_rwg'
OHS_INSTANCE3_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs1932/user_projects/domains/OHSDomain_rwg'
OHS_INSTANCE3_MW_HOME = '/scratch/kgurupra/APR14/ohs1932'
OHS_INSTANCE3_WL_HOME = '/scratch/kgurupra/APR14/ohs1932/wlserver'
OHS_INSTANCE3_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs1932/oracle_common'
OHS_INSTANCE3_OHS_INSTANCE_NAME = 'rwg8222'
OHS_INSTANCE3_LISTEN_PORT = '8222'
OHS_INSTANCE3_SSL_LISTEN_PORT = '8223'
OHS_INSTANCE3_ADMIN_PORT = '8221'
OHS_INSTANCE3_WGID = 'WG8222'
OHS_INSTANCE3_WG_PORT = '8222'
OHS_INSTANCE4_WLS_USER = 'weblogic'
OHS_INSTANCE4_WLS_PWD = 'welcome1'
OHS_INSTANCE4_WLS_DOMAIN_NAME = 'OHSDomain_rwg'
OHS_INSTANCE4_WLS_DOMAIN_HOME = '/scratch/kgurupra/APR14/ohs1932/user_projects/domains/OHSDomain_rwg'
OHS_INSTANCE4_MW_HOME = '/scratch/kgurupra/APR14/ohs1932'
OHS_INSTANCE4_WL_HOME = '/scratch/kgurupra/APR14/ohs1932/wlserver'
OHS_INSTANCE4_COMMON_ORACLE_HOME = '/scratch/kgurupra/APR14/ohs1932/oracle_common'
OHS_INSTANCE4_OHS_INSTANCE_NAME = 'rwg9222'
OHS_INSTANCE4_LISTEN_PORT = '9222'
OHS_INSTANCE4_SSL_LISTEN_PORT = '9223'
OHS_INSTANCE4_ADMIN_PORT = '9221'
OHS_INSTANCE4_WGID = 'WG9222'
OHS_INSTANCE4_WG_PORT = '9222'
def __init__(self):
self.another_variable = 'another value'
|
List_of_numbers = [5,10,15,20,25]
for numbers in List_of_numbers:
print (numbers **10)
Values_list=[]
Values_list.append(numbers **10)
print(Values_list)
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isSymmetric(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
queue = []
queue.append(root)
queueFront, queueBack = 1, 0
while queueBack < queueFront:
increase = 0
while queueBack < queueFront:
node = queue[queueBack]
queueBack += 1
if node:
queue.append(node.left)
queue.append(node.right)
increase += 2
queueFront += increase
for index in range((queueFront-queueBack)/2):
first, last = queue[queueBack+index], queue[queueFront-index-1]
if (first and last and first.val != last.val) or ((not first) ^ (not last)):
return False
return True
|
q = 'a'
while(q != 'q'):
print("estou em looping")
q = input("Insira algo> ")
else:
print("fim")
|
# -*- coding: utf-8 -*-
"""Collection of useful http error for the Api"""
class GKJsonApiException(Exception):
"""Base exception class for unknown errors"""
title = 'Unknown error'
status = '500'
source = None
def __init__(self, detail, source=None, title=None, status=None, code=None, id_=None, links=None, meta=None):
"""Initialize a jsonapi exception
:param dict source: the source of the error
:param str detail: the detail of the error
"""
self.detail = detail
self.source = source
self.code = code
self.id = id_
self.links = links or {}
self.meta = meta or {}
if title is not None:
self.title = title
if status is not None:
self.status = status
def to_dict(self):
"""Return values of each fields of an jsonapi error"""
error_dict = {}
for field in ('status', 'source', 'title', 'detail', 'id', 'code', 'links', 'meta'):
if getattr(self, field, None):
error_dict.update({field: getattr(self, field)})
return error_dict
class GKUnprocessableEntity(GKJsonApiException):
title = "Unprocessable Entity"
status = '422'
|
# cnt = int(input())
# for i in range(cnt):
# rep = int(input())
# arr = list(str(input()))
# for j in range(len(arr)):
# prt = arr[j]
# for _ in range(rep):
# print(prt,end="")
# print()
cnt = int(input())
for i in range(cnt):
(rep,arr) = map(str,input().split())
arr = list(str(arr))
for j in range(len(arr)):
prt = arr[j]
for _ in range(int(rep)):
print(prt,end="")
print()
|
"""
This module holds the command class
"""
class Command():
"""
This class has static methods to handle the minimum commands
recommended by Telegram
"""
@staticmethod
def help():
"""
This static method returns the message for users '/help' call in chats
"""
return 'Para usar o bot é preciso apenas chama-lo em qualquer chat ut\
ilizando @RUfsc_bot e aguardar aparecer o menu de opções.'
@staticmethod
def start():
"""
This static method returns the message for users '/start' call in chats
"""
return 'Bot para remover a necessidade de acessar o site do RU para v\
er o cardápio todos os dias, coleta informações diretamente do site.'
@staticmethod
def settings():
"""
This static method returns the message for users
'/settings' call in chats
"""
pass
|
class SwapUser:
def __init__(self, exposure, collateral_perc, fee_perc):
self.exposure = exposure
self.collateral = collateral_perc
self.collateral_value = collateral_perc * exposure
self.fee = fee_perc * exposure
self.is_active = True
self.is_liquidated = False
self.quantity = 0
self.entered_on = 0
self.exited_on = 0
self.liquidated_on = 0
self.profit = 0
self.entry_price = 0
self.exit_price = 0
def enter_swap(self, unix, price):
self.quantity = self.exposure / price
self.entered_on = unix
self.entry_price = price
return self.entered_on
def close_swap(self, unix, price):
self.exited_on = unix
self.exit_price = price
self.profit = self.quantity * (self.exit_price - self.entry_price)
if -1 * self.profit >= self.collateral_value:
self.is_liquidated = True
self.treasury_profit = self.fee + (self.collateral_value + self.profit)
else:
self.treasury_profit = self.fee
|
"""HTML related constants.
"""
SCRIPT_START_TAG: str = '<script type="text/javascript">'
SCRIPT_END_TAG: str = '</script>'
|
class SquareGrid:
def __init__(self, width, height):
self.width = width
self.height = height
self.walls = []
def in_bounds(self, node_id):
(x, y) = node_id
return 0 <= x < self.width and 0 <= y < self.height
def passable(self, node_id):
return node_id not in self.walls
def neighbors(self, node_id):
(x, y) = node_id
results = [(x + 1, y), (x, y - 1), (x - 1, y), (x, y + 1)]
if (x + y) % 2 == 0:
results.reverse() # Aesthetics
results = filter(self.in_bounds, results)
results = filter(self.passable, results)
return results
class WeightedGrid(SquareGrid):
def __init__(self, width, height):
super().__init__(width, height)
self.weights = {}
def cost(self, from_node, to_node):
# Ignore from_node
return self.weights.get(to_node, 1)
|
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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.
"""
A collection of Web browser user agent strings.
Culled from actual apache log file.
"""
# The key value is a simplified name you use in scripts. The value is the
# actual user agent string.
USER_AGENTS = {
'atw_crawl': 'FAST-WebCrawler/3.6 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)',
'becomebot': 'Mozilla/5.0 (compatible; BecomeBot/3.0; MSIE 6.0 compatible; +http://www.become.com/site_owners.html)',
'cern': 'CERN-LineMode/2.15 libwww/2.17b3',
'chrome_mac': "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10",
'dfind': 'DFind',
'epiphany16': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060418 Epiphany/1.6.1 (Ubuntu) (Ubuntu package 1.0.8)',
'firefox10_fed': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060202 Fedora/1.0.7-1.2.fc4 Firefox/1.0.7',
'firefox10_ldeb': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20060424 Firefox/1.0.4 (Debian package 1.0.4-2sarge6)',
'firefox10_lmand': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050921 Firefox/1.0.7 Mandriva/1.0.6-15mdk (2006.0)',
'firefox10_w_de': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.7.10) Gecko/20050717 Firefox/1.0.6',
'firefox10_w': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7',
'firefox15_ldeb': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.3) Gecko/20060326 Firefox/1.5.0.3 (Debian-1.5.dfsg+1.5.0.3-2)',
'firefox15_l': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2',
'firefox15_lpango': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.2) Gecko/20060419 Fedora/1.5.0.2-1.2.fc5 Firefox/1.5.0.2 pango-text',
'firefox15_w_fr': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3',
'firefox15_w_gb': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3',
'firefox15_w_goog': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3; Google-TR-3) Gecko/20060426 Firefox/1.5.0.3',
'firefox15_w_it': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3',
'firefox15_w': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3',
'firefox15_w_ru': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3',
'firefox_36_64': "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101203 Gentoo Firefox/3.6.12",
'galeon1': 'Mozilla/5.0 Galeon/1.2.1 (X11; Linux i686; U;) Gecko/0',
'gecko': 'TinyBrowser/2.0 (TinyBrowser Comment) Gecko/20201231',
'gigabot': 'Gigabot/2.0; http://www.gigablast.com/spider.html',
'googlebot': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
'jeeves': 'Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)',
'konqueror1': 'Mozilla/5.0 (compatible; Konqueror/3.0; i686 Linux; 20020919)',
'konqueror2': 'Mozilla/5.0 (compatible; Konqueror/3.1-rc4; i686 Linux; 20020504)',
'konqueror3': 'Mozilla/5.0 (compatible; Konqueror/3.5; Linux; i686; en_US) KHTML/3.5.2 (like Gecko) (Debian)',
'konqueror': 'Mozilla/5.0 (compatible; Konqueror/3.0.0-10; Linux)',
'links': 'Links (2.0; Linux 2.4.18-6mdkenterprise i686; 80x36)',
'lwp': 'lwp-trivial/1.41',
'lynx': 'Lynx/2.8.5dev.3 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c',
'motorola': 'MOT-V600/0B.09.3AR MIB/2.2 Profile/MIDP-2.0 Configuration/CLDC-1.0',
'mozilla10': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0) Gecko/00200203',
'mozilla5_irix': 'Mozilla/5.25 Netscape/5.0 (X11; U; IRIX 6.3 IP32)',
'mozilla5': 'Mozilla/5.0',
'mozilla5_w': 'Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101',
'mozilla9': 'Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)',
'mozilla_mac': 'Mozilla/4.72 (Macintosh; I; PPC)',
'mozilla_w_de': 'Mozilla/5.0 (Windows; U; Win 9x 4.90; de-AT; rv:1.7.8) Gecko/20050511',
'mscontrol': 'Microsoft URL Control - 6.00.8862',
'msie4_w95': 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)',
'msie501_nt': 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
'msie501_w98': 'Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)',
'msie50_nt': 'Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0)',
'msie50_w98': 'Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)',
'msie51_mac': 'Mozilla/4.0 (compatible; MSIE 5.14; Mac_PowerPC)',
'msie55_nt': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)',
'msie5_w2k': 'Mozilla/5.0 (compatible; MSIE 5.01; Win2000)',
'msie6_2': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312469)',
'msie6_98': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)',
'msie6': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
'msie6_net2_sp1': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)',
'msie6_net_infopath': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.1.4322; InfoPath.1)',
'msie6_net': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
'msie6_net_mp': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MathPlayer 2.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)',
'msie6_net_sp1_2': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)',
'msie6_net_sp1_maxthon': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322)',
'msie6_net_sp1': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)',
'msie6_net_sp1_naver': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Naver Desktop Search)',
'msie6_net_ypc2': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YPC 3.2.0; FunWebProducts; .NET CLR 1.0.3705; yplus 5.1.02b)',
'msie6_net_ypc': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YPC 3.2.0; FunWebProducts; .NET CLR 1.0.3705)',
'msie6_nt': 'Mozilla/4.0 (compatible; MSIE 6.01; Windows NT 5.0)',
'msie6_sp1': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
'msie6_w98_crazy': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Crazy Browser 1.0.5)',
'msie6_w98': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)',
'msnbot': 'msnbot/1.0 (+http://search.msn.com/msnbot.htm)',
'mz5mac_ja': 'Mozilla/5.001 (Macintosh; N; PPC; ja) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)',
'netscape4_en': 'Mozilla/4.76 [en] (X11; U; Linux 2.4.17 i686)',
'netscape6_w': 'Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; VaioUSSum01) Gecko/20010131 Netscape6/6.01',
'netscape8_w': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060127 Netscape/8.1',
'nextgen1': 'NextGenSearchBot 1 (for information visit http://www.zoominfo.com/NextGenSearchBot)',
'opera6_l': 'Opera/6.0 (Linux 2.4.18-6mdk i686; U) [en]',
'opera6_w': 'Opera/6.04 (Windows XP; U) [en]',
'opera7_w': 'Opera/7.0 (Windows NT 5.1; U) [en]',
'python': 'Python/2.4 (X11; U; Linux i686; en-US)',
'safari_intel': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3',
'safari_ppc': 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.2',
'slurp': 'Mozilla/3.0 (Slurp/si; [email protected]; http://www.inktomi.com/slurp.html)',
'slysearch': 'SlySearch/1.3 (http://www.slysearch.com)',
'surveybot': 'SurveyBot/2.3 (Whois Source)',
'syntryx': 'Syntryx ANT Scout Chassis Pheromone; Mozilla/4.0 compatible crawler',
'wget_rh': 'Wget/1.10.2 (Red Hat modified)',
'wget': 'Wget/1.10.2',
'yahoo': 'Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)',
'zyborg': 'Mozilla/4.0 compatible ZyBorg/1.0 Dead Link Checker ([email protected]; http://www.WISEnutbot.com)',
}
def get_useragents():
"""Return a list of possible user-agent keywords."""
return sorted(USER_AGENTS.keys())
|
#
# PySNMP MIB module NETSCREEN-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-OSPF-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:10: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)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
netscreenVR, = mibBuilder.importSymbols("NETSCREEN-SMI", "netscreenVR")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Bits, Integer32, MibIdentifier, NotificationType, Unsigned32, Gauge32, ModuleIdentity, TimeTicks, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, mib_2, ObjectIdentity, IpAddress, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "MibIdentifier", "NotificationType", "Unsigned32", "Gauge32", "ModuleIdentity", "TimeTicks", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "mib-2", "ObjectIdentity", "IpAddress", "iso")
DisplayString, RowStatus, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "TruthValue")
nsOspf = ModuleIdentity((1, 3, 6, 1, 4, 1, 3224, 18, 2))
if mibBuilder.loadTexts: nsOspf.setLastUpdated('200506032022Z')
if mibBuilder.loadTexts: nsOspf.setOrganization('Juniper Networks, Inc.')
class AreaID(TextualConvention, IpAddress):
status = 'deprecated'
class RouterID(TextualConvention, IpAddress):
status = 'deprecated'
class Metric(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535)
class BigMetric(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 16777215)
class Status(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("enabled", 1), ("disabled", 2))
class PositiveInteger(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647)
class HelloRange(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 65535)
class UpToMaxAge(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 3600)
class InterfaceIndex(TextualConvention, Integer32):
status = 'deprecated'
class DesignatedRouterPriority(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 255)
class TOSType(TextualConvention, Integer32):
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 30)
nsOspfGeneralTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1), )
if mibBuilder.loadTexts: nsOspfGeneralTable.setStatus('deprecated')
nsOspfGeneralEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfGeneralVRID"))
if mibBuilder.loadTexts: nsOspfGeneralEntry.setStatus('deprecated')
nsOspfRouterId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 1), RouterID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfRouterId.setStatus('deprecated')
nsOspfAdminStat = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 2), Status()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAdminStat.setStatus('deprecated')
nsOspfVersionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2))).clone(namedValues=NamedValues(("version2", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVersionNumber.setStatus('deprecated')
nsOspfAreaBdrRtrStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 4), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaBdrRtrStatus.setStatus('deprecated')
nsOspfASBdrRtrStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 5), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfASBdrRtrStatus.setStatus('deprecated')
nsOspfExternLsaCount = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 6), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExternLsaCount.setStatus('deprecated')
nsOspfExternLsaCksumSum = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExternLsaCksumSum.setStatus('deprecated')
nsOspfTOSSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfTOSSupport.setStatus('deprecated')
nsOspfOriginateNewLsas = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfOriginateNewLsas.setStatus('deprecated')
nsOspfRxNewLsas = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfRxNewLsas.setStatus('deprecated')
nsOspfExtLsdbLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 2147483647)).clone(-1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbLimit.setStatus('deprecated')
nsOspfMulticastExtensions = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfMulticastExtensions.setStatus('deprecated')
nsOspfExitOverflowInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 13), PositiveInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExitOverflowInterval.setStatus('deprecated')
nsOspfDemandExtensions = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 14), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfDemandExtensions.setStatus('deprecated')
nsOspfGeneralVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfGeneralVRID.setStatus('deprecated')
nsOspfAreaTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2), )
if mibBuilder.loadTexts: nsOspfAreaTable.setStatus('deprecated')
nsOspfAreaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfAreaId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAreaVRID"))
if mibBuilder.loadTexts: nsOspfAreaEntry.setStatus('deprecated')
nsOspfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaId.setStatus('deprecated')
nsOspfImportAsExtern = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("importExternal", 1), ("importNoExternal", 2), ("importNssa", 3))).clone('importExternal')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfImportAsExtern.setStatus('deprecated')
nsOspfSpfRuns = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfSpfRuns.setStatus('deprecated')
nsOspfAreaBdrRtrCount = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 5), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaBdrRtrCount.setStatus('deprecated')
nsOspfAsBdrRtrCount = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 6), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAsBdrRtrCount.setStatus('deprecated')
nsOspfAreaLsaCount = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaLsaCount.setStatus('deprecated')
nsOspfAreaLsaCksumSum = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaLsaCksumSum.setStatus('deprecated')
nsOspfAreaSummary = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noAreaSummary", 1), ("sendAreaSummary", 2))).clone('noAreaSummary')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfAreaSummary.setStatus('deprecated')
nsOspfAreaStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfAreaStatus.setStatus('deprecated')
nsOspfAreaVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaVRID.setStatus('deprecated')
nsOspfStubAreaTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3), )
if mibBuilder.loadTexts: nsOspfStubAreaTable.setStatus('deprecated')
nsOspfStubAreaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfStubAreaId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfStubTOS"), (0, "NETSCREEN-OSPF-MIB", "nsOspfStubVRID"))
if mibBuilder.loadTexts: nsOspfStubAreaEntry.setStatus('deprecated')
nsOspfStubAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfStubAreaId.setStatus('deprecated')
nsOspfStubTOS = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 2), TOSType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfStubTOS.setStatus('deprecated')
nsOspfStubMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 3), BigMetric()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfStubMetric.setStatus('deprecated')
nsOspfStubStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfStubStatus.setStatus('deprecated')
nsOspfStubMetricType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("nsOspfMetric", 1), ("comparableCost", 2), ("nonComparable", 3))).clone('nsOspfMetric')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfStubMetricType.setStatus('deprecated')
nsOspfStubVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 3, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfStubVRID.setStatus('deprecated')
nsOspfLsdbTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4), )
if mibBuilder.loadTexts: nsOspfLsdbTable.setStatus('deprecated')
nsOspfLsdbEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfLsdbAreaId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfLsdbType"), (0, "NETSCREEN-OSPF-MIB", "nsOspfLsdbLsid"), (0, "NETSCREEN-OSPF-MIB", "nsOspfLsdbRouterId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfLsdbVRID"))
if mibBuilder.loadTexts: nsOspfLsdbEntry.setStatus('deprecated')
nsOspfLsdbAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbAreaId.setStatus('deprecated')
nsOspfLsdbType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("routerLink", 1), ("networkLink", 2), ("summaryLink", 3), ("asSummaryLink", 4), ("asExternalLink", 5), ("multicastLink", 6), ("nssaExternalLink", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbType.setStatus('deprecated')
nsOspfLsdbLsid = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbLsid.setStatus('deprecated')
nsOspfLsdbRouterId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 4), RouterID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbRouterId.setStatus('deprecated')
nsOspfLsdbSequence = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbSequence.setStatus('deprecated')
nsOspfLsdbAge = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbAge.setStatus('deprecated')
nsOspfLsdbChecksum = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbChecksum.setStatus('deprecated')
nsOspfLsdbAdvertisement = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbAdvertisement.setStatus('deprecated')
nsOspfLsdbVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 4, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfLsdbVRID.setStatus('deprecated')
nsOspfHostTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6), )
if mibBuilder.loadTexts: nsOspfHostTable.setStatus('deprecated')
nsOspfHostEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfHostIpAddress"), (0, "NETSCREEN-OSPF-MIB", "nsOspfHostTOS"), (0, "NETSCREEN-OSPF-MIB", "nsOspfHostVRID"))
if mibBuilder.loadTexts: nsOspfHostEntry.setStatus('deprecated')
nsOspfHostIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfHostIpAddress.setStatus('deprecated')
nsOspfHostTOS = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 2), TOSType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfHostTOS.setStatus('deprecated')
nsOspfHostMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 3), Metric()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfHostMetric.setStatus('deprecated')
nsOspfHostStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfHostStatus.setStatus('deprecated')
nsOspfHostAreaID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 5), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfHostAreaID.setStatus('deprecated')
nsOspfHostVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 6, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfHostVRID.setStatus('deprecated')
nsOspfIfTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7), )
if mibBuilder.loadTexts: nsOspfIfTable.setStatus('deprecated')
nsOspfIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfIfIpAddress"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAddressLessIf"), (0, "NETSCREEN-OSPF-MIB", "nsOspfIfVRID"))
if mibBuilder.loadTexts: nsOspfIfEntry.setStatus('deprecated')
nsOspfIfIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfIpAddress.setStatus('deprecated')
nsOspfAddressLessIf = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAddressLessIf.setStatus('deprecated')
nsOspfIfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 3), AreaID().clone(hexValue="00000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfAreaId.setStatus('deprecated')
nsOspfIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 5))).clone(namedValues=NamedValues(("broadcast", 1), ("nbma", 2), ("pointToPoint", 3), ("pointToMultipoint", 5)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfType.setStatus('deprecated')
nsOspfIfAdminStat = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 5), Status().clone('enabled')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfAdminStat.setStatus('deprecated')
nsOspfIfRtrPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 6), DesignatedRouterPriority().clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfRtrPriority.setStatus('deprecated')
nsOspfIfTransitDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 7), UpToMaxAge().clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfTransitDelay.setStatus('deprecated')
nsOspfIfRetransInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 8), UpToMaxAge().clone(5)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfRetransInterval.setStatus('deprecated')
nsOspfIfHelloInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 9), HelloRange().clone(10)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfHelloInterval.setStatus('deprecated')
nsOspfIfRtrDeadInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 10), PositiveInteger().clone(40)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfRtrDeadInterval.setStatus('deprecated')
nsOspfIfPollInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 11), PositiveInteger().clone(120)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfPollInterval.setStatus('deprecated')
nsOspfIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("down", 1), ("loopback", 2), ("waiting", 3), ("pointToPoint", 4), ("designatedRouter", 5), ("backupDesignatedRouter", 6), ("otherDesignatedRouter", 7))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfState.setStatus('deprecated')
nsOspfIfDesignatedRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 13), IpAddress().clone(hexValue="00000000")).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfDesignatedRouter.setStatus('deprecated')
nsOspfIfBackupDesignatedRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 14), IpAddress().clone(hexValue="00000000")).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfBackupDesignatedRouter.setStatus('deprecated')
nsOspfIfEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfEvents.setStatus('deprecated')
nsOspfIfAuthKey = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256)).clone(hexValue="0000000000000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfAuthKey.setStatus('deprecated')
nsOspfIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 17), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfStatus.setStatus('deprecated')
nsOspfIfMulticastForwarding = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("blocked", 1), ("multicast", 2), ("unicast", 3))).clone('blocked')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfMulticastForwarding.setStatus('deprecated')
nsOspfIfDemand = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 19), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfDemand.setStatus('deprecated')
nsOspfIfAuthType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfAuthType.setStatus('deprecated')
nsOspfIfVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 7, 1, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfVRID.setStatus('deprecated')
nsOspfIfMetricTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8), )
if mibBuilder.loadTexts: nsOspfIfMetricTable.setStatus('deprecated')
nsOspfIfMetricEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfIfMetricIpAddress"), (0, "NETSCREEN-OSPF-MIB", "nsOspfIfMetricAddressLessIf"), (0, "NETSCREEN-OSPF-MIB", "nsOspfIfMetricTOS"), (0, "NETSCREEN-OSPF-MIB", "nsOspfIfMetricVRID"))
if mibBuilder.loadTexts: nsOspfIfMetricEntry.setStatus('deprecated')
nsOspfIfMetricIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfMetricIpAddress.setStatus('deprecated')
nsOspfIfMetricAddressLessIf = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfMetricAddressLessIf.setStatus('deprecated')
nsOspfIfMetricTOS = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 3), TOSType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfMetricTOS.setStatus('deprecated')
nsOspfIfMetricValue = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 4), Metric()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfMetricValue.setStatus('deprecated')
nsOspfIfMetricStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfIfMetricStatus.setStatus('deprecated')
nsOspfIfMetricVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 8, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfIfMetricVRID.setStatus('deprecated')
nsOspfVirtIfTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9), )
if mibBuilder.loadTexts: nsOspfVirtIfTable.setStatus('deprecated')
nsOspfVirtIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfVirtIfAreaId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfVirtIfNeighbor"), (0, "NETSCREEN-OSPF-MIB", "nsOspfVirtIfVRID"))
if mibBuilder.loadTexts: nsOspfVirtIfEntry.setStatus('deprecated')
nsOspfVirtIfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtIfAreaId.setStatus('deprecated')
nsOspfVirtIfNeighbor = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 2), RouterID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtIfNeighbor.setStatus('deprecated')
nsOspfVirtIfTransitDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 3), UpToMaxAge().clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfTransitDelay.setStatus('deprecated')
nsOspfVirtIfRetransInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 4), UpToMaxAge().clone(5)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfRetransInterval.setStatus('deprecated')
nsOspfVirtIfHelloInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 5), HelloRange().clone(10)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfHelloInterval.setStatus('deprecated')
nsOspfVirtIfRtrDeadInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 6), PositiveInteger().clone(60)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfRtrDeadInterval.setStatus('deprecated')
nsOspfVirtIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 4))).clone(namedValues=NamedValues(("down", 1), ("pointToPoint", 4))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtIfState.setStatus('deprecated')
nsOspfVirtIfEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtIfEvents.setStatus('deprecated')
nsOspfVirtIfAuthKey = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256)).clone(hexValue="0000000000000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfAuthKey.setStatus('deprecated')
nsOspfVirtIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfStatus.setStatus('deprecated')
nsOspfVirtIfAuthType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfVirtIfAuthType.setStatus('deprecated')
nsOspfVirtIfVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 9, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtIfVRID.setStatus('deprecated')
nsOspfNbrTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10), )
if mibBuilder.loadTexts: nsOspfNbrTable.setStatus('deprecated')
nsOspfNbrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfNbrIpAddr"), (0, "NETSCREEN-OSPF-MIB", "nsOspfNbrAddressLessIndex"), (0, "NETSCREEN-OSPF-MIB", "nsOspfNbrVRID"))
if mibBuilder.loadTexts: nsOspfNbrEntry.setStatus('deprecated')
nsOspfNbrIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrIpAddr.setStatus('deprecated')
nsOspfNbrAddressLessIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 2), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrAddressLessIndex.setStatus('deprecated')
nsOspfNbrRtrId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 3), RouterID().clone(hexValue="00000000")).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrRtrId.setStatus('deprecated')
nsOspfNbrOptions = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrOptions.setStatus('deprecated')
nsOspfNbrPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 5), DesignatedRouterPriority().clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfNbrPriority.setStatus('deprecated')
nsOspfNbrState = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("down", 1), ("attempt", 2), ("init", 3), ("twoWay", 4), ("exchangeStart", 5), ("exchange", 6), ("loading", 7), ("full", 8))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrState.setStatus('deprecated')
nsOspfNbrEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrEvents.setStatus('deprecated')
nsOspfNbrLsRetransQLen = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 8), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrLsRetransQLen.setStatus('deprecated')
nsOspfNbmaNbrStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfNbmaNbrStatus.setStatus('deprecated')
nsOspfNbmaNbrPermanence = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dynamic", 1), ("permanent", 2))).clone('permanent')).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbmaNbrPermanence.setStatus('deprecated')
nsOspfNbrHelloSuppressed = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 11), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrHelloSuppressed.setStatus('deprecated')
nsOspfNbrVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 10, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfNbrVRID.setStatus('deprecated')
nsOspfVirtNbrTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11), )
if mibBuilder.loadTexts: nsOspfVirtNbrTable.setStatus('deprecated')
nsOspfVirtNbrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfVirtNbrArea"), (0, "NETSCREEN-OSPF-MIB", "nsOspfVirtNbrRtrId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfVirtNbrVRID"))
if mibBuilder.loadTexts: nsOspfVirtNbrEntry.setStatus('deprecated')
nsOspfVirtNbrArea = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrArea.setStatus('deprecated')
nsOspfVirtNbrRtrId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 2), RouterID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrRtrId.setStatus('deprecated')
nsOspfVirtNbrIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrIpAddr.setStatus('deprecated')
nsOspfVirtNbrOptions = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrOptions.setStatus('deprecated')
nsOspfVirtNbrState = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("down", 1), ("attempt", 2), ("init", 3), ("twoWay", 4), ("exchangeStart", 5), ("exchange", 6), ("loading", 7), ("full", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrState.setStatus('deprecated')
nsOspfVirtNbrEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrEvents.setStatus('deprecated')
nsOspfVirtNbrLsRetransQLen = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrLsRetransQLen.setStatus('deprecated')
nsOspfVirtNbrHelloSuppressed = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrHelloSuppressed.setStatus('deprecated')
nsOspfVirtNbrVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 11, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfVirtNbrVRID.setStatus('deprecated')
nsOspfExtLsdbTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12), )
if mibBuilder.loadTexts: nsOspfExtLsdbTable.setStatus('deprecated')
nsOspfExtLsdbEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfExtLsdbType"), (0, "NETSCREEN-OSPF-MIB", "nsOspfExtLsdbLsid"), (0, "NETSCREEN-OSPF-MIB", "nsOspfExtLsdbRouterId"), (0, "NETSCREEN-OSPF-MIB", "nsOspfExtLsdbVRID"))
if mibBuilder.loadTexts: nsOspfExtLsdbEntry.setStatus('deprecated')
nsOspfExtLsdbType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(5))).clone(namedValues=NamedValues(("asExternalLink", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbType.setStatus('deprecated')
nsOspfExtLsdbLsid = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbLsid.setStatus('deprecated')
nsOspfExtLsdbRouterId = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 3), RouterID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbRouterId.setStatus('deprecated')
nsOspfExtLsdbSequence = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbSequence.setStatus('deprecated')
nsOspfExtLsdbAge = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbAge.setStatus('deprecated')
nsOspfExtLsdbChecksum = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbChecksum.setStatus('deprecated')
nsOspfExtLsdbAdvertisement = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(36, 36)).setFixedLength(36)).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbAdvertisement.setStatus('deprecated')
nsOspfExtLsdbVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 12, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfExtLsdbVRID.setStatus('deprecated')
nsOspfAreaAggregateTable = MibTable((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14), )
if mibBuilder.loadTexts: nsOspfAreaAggregateTable.setStatus('deprecated')
nsOspfAreaAggregateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1), ).setIndexNames((0, "NETSCREEN-OSPF-MIB", "nsOspfAreaAggregateAreaID"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAreaAggregateLsdbType"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAreaAggregateNet"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAreaAggregateMask"), (0, "NETSCREEN-OSPF-MIB", "nsOspfAreaAggregateVRID"))
if mibBuilder.loadTexts: nsOspfAreaAggregateEntry.setStatus('deprecated')
nsOspfAreaAggregateAreaID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 1), AreaID()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaAggregateAreaID.setStatus('deprecated')
nsOspfAreaAggregateLsdbType = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(3, 7))).clone(namedValues=NamedValues(("summaryLink", 3), ("nssaExternalLink", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaAggregateLsdbType.setStatus('deprecated')
nsOspfAreaAggregateNet = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaAggregateNet.setStatus('deprecated')
nsOspfAreaAggregateMask = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaAggregateMask.setStatus('deprecated')
nsOspfAreaAggregateStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfAreaAggregateStatus.setStatus('deprecated')
nsOspfAreaAggregateEffect = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("advertiseMatching", 1), ("doNotAdvertiseMatching", 2))).clone('advertiseMatching')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: nsOspfAreaAggregateEffect.setStatus('deprecated')
nsOspfAreaAggregateVRID = MibTableColumn((1, 3, 6, 1, 4, 1, 3224, 18, 2, 14, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nsOspfAreaAggregateVRID.setStatus('deprecated')
mibBuilder.exportSymbols("NETSCREEN-OSPF-MIB", nsOspfLsdbLsid=nsOspfLsdbLsid, nsOspfHostStatus=nsOspfHostStatus, nsOspfVirtIfNeighbor=nsOspfVirtIfNeighbor, nsOspfVirtIfAuthType=nsOspfVirtIfAuthType, nsOspfExtLsdbChecksum=nsOspfExtLsdbChecksum, nsOspfHostAreaID=nsOspfHostAreaID, nsOspfAreaAggregateAreaID=nsOspfAreaAggregateAreaID, nsOspfSpfRuns=nsOspfSpfRuns, nsOspfIfAdminStat=nsOspfIfAdminStat, nsOspfVirtIfTable=nsOspfVirtIfTable, nsOspfIfType=nsOspfIfType, nsOspfVirtIfStatus=nsOspfVirtIfStatus, nsOspfAreaAggregateStatus=nsOspfAreaAggregateStatus, nsOspfNbrAddressLessIndex=nsOspfNbrAddressLessIndex, nsOspfHostEntry=nsOspfHostEntry, nsOspfNbrPriority=nsOspfNbrPriority, nsOspfAreaVRID=nsOspfAreaVRID, nsOspfHostTOS=nsOspfHostTOS, nsOspfLsdbAreaId=nsOspfLsdbAreaId, nsOspfIfMetricAddressLessIf=nsOspfIfMetricAddressLessIf, nsOspfStubAreaTable=nsOspfStubAreaTable, nsOspfStubStatus=nsOspfStubStatus, DesignatedRouterPriority=DesignatedRouterPriority, nsOspfIfDemand=nsOspfIfDemand, nsOspfIfMetricEntry=nsOspfIfMetricEntry, nsOspfAreaAggregateMask=nsOspfAreaAggregateMask, AreaID=AreaID, nsOspfAreaLsaCount=nsOspfAreaLsaCount, nsOspfNbrIpAddr=nsOspfNbrIpAddr, nsOspfGeneralVRID=nsOspfGeneralVRID, nsOspfLsdbTable=nsOspfLsdbTable, nsOspfAddressLessIf=nsOspfAddressLessIf, nsOspfIfIpAddress=nsOspfIfIpAddress, Metric=Metric, nsOspfIfVRID=nsOspfIfVRID, nsOspfExtLsdbAdvertisement=nsOspfExtLsdbAdvertisement, nsOspfIfMulticastForwarding=nsOspfIfMulticastForwarding, nsOspfHostIpAddress=nsOspfHostIpAddress, nsOspfAreaAggregateEntry=nsOspfAreaAggregateEntry, nsOspfTOSSupport=nsOspfTOSSupport, nsOspfAreaAggregateEffect=nsOspfAreaAggregateEffect, nsOspfAreaId=nsOspfAreaId, PYSNMP_MODULE_ID=nsOspf, nsOspfVirtIfState=nsOspfVirtIfState, HelloRange=HelloRange, nsOspfStubMetricType=nsOspfStubMetricType, nsOspfAreaAggregateLsdbType=nsOspfAreaAggregateLsdbType, nsOspfExternLsaCksumSum=nsOspfExternLsaCksumSum, nsOspfNbrOptions=nsOspfNbrOptions, nsOspfGeneralTable=nsOspfGeneralTable, nsOspfExtLsdbVRID=nsOspfExtLsdbVRID, nsOspfStubTOS=nsOspfStubTOS, nsOspfLsdbRouterId=nsOspfLsdbRouterId, nsOspfVirtIfEvents=nsOspfVirtIfEvents, nsOspfIfMetricVRID=nsOspfIfMetricVRID, nsOspfExtLsdbLsid=nsOspfExtLsdbLsid, nsOspfLsdbAdvertisement=nsOspfLsdbAdvertisement, nsOspfMulticastExtensions=nsOspfMulticastExtensions, PositiveInteger=PositiveInteger, nsOspfIfTable=nsOspfIfTable, nsOspfLsdbEntry=nsOspfLsdbEntry, nsOspfExternLsaCount=nsOspfExternLsaCount, nsOspfOriginateNewLsas=nsOspfOriginateNewLsas, nsOspfVirtNbrIpAddr=nsOspfVirtNbrIpAddr, nsOspfVirtNbrVRID=nsOspfVirtNbrVRID, nsOspfAreaBdrRtrCount=nsOspfAreaBdrRtrCount, nsOspfVirtNbrEntry=nsOspfVirtNbrEntry, nsOspfIfEntry=nsOspfIfEntry, nsOspfIfTransitDelay=nsOspfIfTransitDelay, nsOspfIfRtrPriority=nsOspfIfRtrPriority, nsOspfExtLsdbSequence=nsOspfExtLsdbSequence, nsOspfIfAuthKey=nsOspfIfAuthKey, nsOspfAdminStat=nsOspfAdminStat, nsOspfExtLsdbType=nsOspfExtLsdbType, nsOspfVirtIfRetransInterval=nsOspfVirtIfRetransInterval, nsOspfNbrRtrId=nsOspfNbrRtrId, nsOspfLsdbSequence=nsOspfLsdbSequence, nsOspfHostVRID=nsOspfHostVRID, nsOspfExtLsdbEntry=nsOspfExtLsdbEntry, nsOspfIfMetricTable=nsOspfIfMetricTable, nsOspf=nsOspf, nsOspfNbrEntry=nsOspfNbrEntry, nsOspfAreaAggregateTable=nsOspfAreaAggregateTable, nsOspfNbmaNbrPermanence=nsOspfNbmaNbrPermanence, nsOspfIfStatus=nsOspfIfStatus, nsOspfExtLsdbTable=nsOspfExtLsdbTable, nsOspfIfRetransInterval=nsOspfIfRetransInterval, nsOspfIfMetricValue=nsOspfIfMetricValue, nsOspfStubMetric=nsOspfStubMetric, nsOspfLsdbChecksum=nsOspfLsdbChecksum, nsOspfRxNewLsas=nsOspfRxNewLsas, nsOspfIfAreaId=nsOspfIfAreaId, nsOspfRouterId=nsOspfRouterId, nsOspfExtLsdbAge=nsOspfExtLsdbAge, nsOspfHostTable=nsOspfHostTable, nsOspfLsdbVRID=nsOspfLsdbVRID, nsOspfIfRtrDeadInterval=nsOspfIfRtrDeadInterval, nsOspfVirtNbrHelloSuppressed=nsOspfVirtNbrHelloSuppressed, Status=Status, nsOspfASBdrRtrStatus=nsOspfASBdrRtrStatus, nsOspfNbrTable=nsOspfNbrTable, nsOspfVirtNbrArea=nsOspfVirtNbrArea, nsOspfNbrHelloSuppressed=nsOspfNbrHelloSuppressed, nsOspfVirtNbrTable=nsOspfVirtNbrTable, nsOspfLsdbAge=nsOspfLsdbAge, nsOspfIfMetricStatus=nsOspfIfMetricStatus, nsOspfVirtNbrState=nsOspfVirtNbrState, BigMetric=BigMetric, nsOspfVirtNbrEvents=nsOspfVirtNbrEvents, nsOspfIfHelloInterval=nsOspfIfHelloInterval, nsOspfImportAsExtern=nsOspfImportAsExtern, nsOspfIfState=nsOspfIfState, nsOspfIfAuthType=nsOspfIfAuthType, nsOspfVirtIfTransitDelay=nsOspfVirtIfTransitDelay, nsOspfStubVRID=nsOspfStubVRID, nsOspfIfPollInterval=nsOspfIfPollInterval, nsOspfDemandExtensions=nsOspfDemandExtensions, nsOspfIfMetricTOS=nsOspfIfMetricTOS, nsOspfHostMetric=nsOspfHostMetric, TOSType=TOSType, nsOspfExtLsdbLimit=nsOspfExtLsdbLimit, nsOspfAreaEntry=nsOspfAreaEntry, nsOspfVirtIfVRID=nsOspfVirtIfVRID, UpToMaxAge=UpToMaxAge, nsOspfVirtNbrOptions=nsOspfVirtNbrOptions, nsOspfVirtNbrLsRetransQLen=nsOspfVirtNbrLsRetransQLen, nsOspfIfBackupDesignatedRouter=nsOspfIfBackupDesignatedRouter, nsOspfAreaLsaCksumSum=nsOspfAreaLsaCksumSum, nsOspfVirtIfEntry=nsOspfVirtIfEntry, nsOspfNbrVRID=nsOspfNbrVRID, nsOspfVirtIfAreaId=nsOspfVirtIfAreaId, nsOspfAreaStatus=nsOspfAreaStatus, nsOspfGeneralEntry=nsOspfGeneralEntry, nsOspfStubAreaEntry=nsOspfStubAreaEntry, nsOspfNbmaNbrStatus=nsOspfNbmaNbrStatus, InterfaceIndex=InterfaceIndex, nsOspfAreaSummary=nsOspfAreaSummary, nsOspfVirtIfHelloInterval=nsOspfVirtIfHelloInterval, nsOspfNbrLsRetransQLen=nsOspfNbrLsRetransQLen, nsOspfAreaAggregateVRID=nsOspfAreaAggregateVRID, nsOspfLsdbType=nsOspfLsdbType, nsOspfAreaTable=nsOspfAreaTable, nsOspfExtLsdbRouterId=nsOspfExtLsdbRouterId, nsOspfStubAreaId=nsOspfStubAreaId, nsOspfVersionNumber=nsOspfVersionNumber, nsOspfAreaBdrRtrStatus=nsOspfAreaBdrRtrStatus, nsOspfAsBdrRtrCount=nsOspfAsBdrRtrCount, nsOspfNbrEvents=nsOspfNbrEvents, nsOspfAreaAggregateNet=nsOspfAreaAggregateNet, nsOspfVirtNbrRtrId=nsOspfVirtNbrRtrId, nsOspfIfDesignatedRouter=nsOspfIfDesignatedRouter, nsOspfVirtIfRtrDeadInterval=nsOspfVirtIfRtrDeadInterval, nsOspfIfMetricIpAddress=nsOspfIfMetricIpAddress, nsOspfExitOverflowInterval=nsOspfExitOverflowInterval, RouterID=RouterID, nsOspfNbrState=nsOspfNbrState, nsOspfVirtIfAuthKey=nsOspfVirtIfAuthKey, nsOspfIfEvents=nsOspfIfEvents)
|
# Tara O'Kelly - G00322214
# Emerging Technologies, Year 4, Software Development, GMIT.
# Problem set: Python fundamentals
# 8. Write a function that merges two sorted lists into a new sorted list. [1,4,6],[2,3,5] → [1,2,3,4,5,6].
l1 = [1,4,6]
l2 = [2,3,5]
#https://docs.python.org/3/howto/sorting.html
print(sorted(l1 + l2))
|
"""配置文件"""
HELP = "help.txt" # 帮助文件地址
SQL = "sql.txt" # sql 文件保存地址
TITLE = "WP中文图片名修复工具" # 程序标题
SUCCESS_TITLE = "操作成功" # 成功标题
SUCCESS_MSG = "文件名已更改, 请在数据库中执行 {file} 中的语句".format(file=SQL) # 成功提示语
FAILED_TITLE = "操作失败" # 失败标题
FAILED_MSG = "更改失败, 请查看程序是否有该文件夹读取权限" # 失败提示语
INFO_TITLE = "提示" # 提示标题
INFO_MSG = "请检查选择的文件夹是否正确" # 提示语
|
test_dic = {
"SERVICETYPE": {
"SC": {
"SITEVERSION": {"T33L": "1"}
},
"EC": {
"SITEVERSION": {
"T33L": "1",
"T31L": {
"BROWSERVERSION": {
"9.1": "1",
"59.0": "1"
}
},
"T32L": "1"
}
},
"TC": {
"OSVERSION": {
"10.13": "1",
"Other": {
"BROWSERVERSION": {
"52.0": "1",
}
}
}
}
}
}
|
#
# @lc app=leetcode id=977 lang=python3
#
# [977] Squares of a Sorted Array
#
# @lc code=start
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
newls = [item * item for item in A]
return sorted(newls)
# @lc code=end
|
def get_firts_two_characters(string):
# 6.1.A
return string[:2]
def get_last_three_characters(string):
# 6.1.B
return string[-3:]
def print_every_two(string):
# 6.1.C
return string[::2]
def reverse(string):
# 6.1.D
return string[::-1]
def reverse_and_concact(string):
# 6.1.D
return string + reverse(string)
def str_insert_character(string, char):
# 6.2.A
new_string = ""
for i in string:
new_string += i + char
return new_string[:-1]
def str_delete_spacing(string, replace):
# 6.2.B
string = string.replace(" ", replace)
return string
def str_delete_numbers(string, char):
# 6.2.C
for i in "0123456789":
string = string.replace(i, char)
return string
def str_insert_character_every_three(string, char):
# 6.2.D
count = 0
str_format = ""
for i in string:
if (count == 3):
str_format += (char + i)
count = 0
else:
str_format += i
count += 1
return str_format
def str_delete_spacing_refactor(string, replace, max_replace):
# 6.3
string = string.replace(" ", replace, max_replace)
return string
|
#!/usr/bin/env python3
def stalinsort(x=[]):
if x == []:
return x
for i in range(len(x)-1):
if x[i] < x[i+1]:
continue
else:
x.pop(i+1)
return x
|
val = input('Digite algo para ver as informações: ')
print('O tipo do valor digitado é {}'.format(type(val)))
#Mostrando todas as opções
num = val.isnumeric()
alp = val.isalpha()
alpNum = val.isalnum()
low = val.islower()
up = val.isupper()
asc = val.isascii()
dec = val.isdecimal()
dig = val.isdigit()
idn = val.isidentifier()
ptn = val.isprintable()
spc = val.isspace()
tlt = val.istitle()
print('O valor digitado é um número? {}'.format(num))
print('O valor digitado é uma letra? {}'.format(alp))
print('O valor digitado é tanto um número quanto uma letra? {}'.format(alpNum))
print('O valor digitado está em minusculo? {}'.format(low))
print('O valor digitado está em maiusculo? {}'.format(up))
print('O valor digitado encontra-se na tabela ASCII? {}'.format(asc))
print('O valor digitado é um decimal? {}'.format(dec))
print('O valor digitado são todos digitos? {}'.format(dig))
print('O valor digitado é um identificador? {}'.format(idn))
print('O valor digitado é printavel? {}'.format(ptn))
print('O valor digitado é um espaço? {}'.format(spc))
print('O valor digitado está capitalizada? {}'.format(tlt))
"""
Funcionamento do código
A variavel val recebe um valor, sendo string seu tipo;
Depois usamos diversas funções próprias para verificar caracteristicas do val;
E depois é printado na tela cada função, com o .format()
"""
|
# -*- coding: utf-8 -*-
"""
Time penalties for Digiroad 2.0.
Created on Thu Apr 26 13:50:03 2018
@author: Henrikki Tenkanen
"""
penalties = {
# Rush hour penalties for different road types ('rt')
'r': {
'rt12' : 12.195 / 60,
'rt3' : 11.199 / 60,
'rt456': 10.633 / 60,
'median': 2.022762
},
# Midday penalties for different road types ('rt')
'm': {
'rt12' : 9.979 / 60,
'rt3' : 6.650 / 60,
'rt456': 7.752 / 60,
'median': 1.667750
},
# Average penalties for different road types ('rt')
'avg': {
'rt12' : 11.311 / 60,
'rt3' : 9.439 / 60,
'rt456': 9.362 / 60,
'median': 1.884662
},
}
|
# Author: thisHermit
ASCENDING = 1
DESCENDING = 0
N = 5
def main():
input_array = [5, 4, 3, 2, 5]
a = input_array.copy()
# sort the array
sort(a, N)
# test and show
assert a, sorted(input_array)
show(a, N)
def exchange(i, j, a, n):
a[i], a[j] = a[j], a[i]
def compare(i, j, dirr, a, n):
if dirr == (a[i] > a[j]):
exchange(i, j, a, n)
def bitonicMerge(lo, cnt, dirr, a, n):
if cnt > 1:
k = cnt // 2
for i in range(lo, lo + k):
compare(i, i+k, dirr, a, n)
bitonicMerge(lo, k, dirr, a, n)
bitonicMerge(lo + k, k, dirr, a, n)
def bitonicSort(lo, cnt, dirr, a, n):
if cnt > 1:
k = cnt // 2
# sort in ascending order
bitonicSort(lo, k, ASCENDING, a, n)
# sort in descending order
bitonicSort(lo + k, k, DESCENDING, a, n)
# Merge whole sequence in ascendin/ descending order depending on dirr
bitonicMerge(lo, cnt, dirr, a, n)
def sort(a, n):
bitonicSort(0, N, ASCENDING, a, n)
def show(a, n):
print(a)
if __name__ == '__main__':
main()
|
input_data = raw_input(">")
upper_case_letters = []
lower_case_letter = []
for x in input_data:
if str(x).isalpha() and str(x).isupper():
upper_case_letters.append(str(x))
elif str(x).isalpha() and str(x).islower():
lower_case_letter.append(str(x))
print("Upper case: " + str(len(upper_case_letters)))
print("Lower case: " + str(len(lower_case_letter)))
|
# Test for breakage in the co_lnotab decoder
locals()
dict
def foo():
locals()
"""
"""
locals()
|
"""
General config file for Bot Server
"""
token = '<YOUR-BOT-TOKEN>'
telegram_base_url = 'https://api.telegram.org/bot{}/'
timeout = 100
model_download_url = '<MODEL-DOWNLOAD-URL>'
model_zip = 'pipeline_models.zip'
model_folder = '/pipeline_models'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_BROKER_URL = 'redis://localhost:6379/0'
|
'''
While loop - it keeps looping while a given condition is valid
'''
name = "Kevin"
age = 24
letter_index = 0
while letter_index < len(name):
print(name[letter_index])
letter_index = letter_index + 1
else:
print("Finished with the while loop")
'''
line 4 - we define the name with a string "Kevin"
line 5 - we define letter_index as 0, given that we want the first character
line 6 - define the while loop, where letter_index is less than length(number)
of characters in name, you print it out. A number would do fine here, but an error would pop out
if the name changes, say from Kevin(5 characters) to Rob (3). So we use the len function
line 7 - From there, you print out name - relative to letter index, and then you redefine letter_index
by giving it an increment of 1.
line 8 - After that, the loop repeats itself until letter_index 6,
where there is no more character to print
So as long as the condition is met in line 6, the loop will keep running operations within the while loop
If all conditions are met, we can end it with the else statement
'''
counter = 0
while counter < 10:
print(counter)
counter = counter + 2
else:
print("counter while loop ended")
'''
Same thing as above, but this time, we define counter as a number 0, and the while loop will list out all numbers
lower than 10 at a step size of 2.
'''
|
# List
transports = ["airplane", "car", "ferry"]
modes = ["air", "ground", "water"]
# Lists contain simple data (index based item) and can be edited after being assigned.
# E.g. as transport types are not as limited as in this list, it can be updated by adding or removing.
# Let's create a couple of functions for adding and removing items, and use them.
print("\nLIST DATA TYPE")
print("--------------\n") # just for formatting the output in order to keep it clean
# Adding items to the list
def add_transport(): # first parameter is for the name, second one is for the mode of the transport
global transports
global modes
message = input("Do you want to ADD a new transport? [Type yes/no]: ").lower().strip()
# validating the input by lower-casing the letters and shrinking the spaces
if message == "yes":
name = input(" Insert the transport name: ")
if name in transports:
print("\n!!! This transport is already in the list\n")
add_transport()
else:
mode = input(" Insert the transportation mode: ")
transports.append(name) # append() method is used to add a new item
modes.append(mode)
print("\nSuccessfully added!")
print("--------------\n") # just for formatting the output in order to keep it clean
add_transport()
elif message == "no":
print("--------------\n") # just for formatting the output in order to keep it clean
return
else:
print("\n!!! Please, answer properly\n")
add_transport()
add_transport() # calling the function to add a new transport
# Removing items from the list
def remove_transport(): # receives an integer as an index
global transports
global modes
message = input("Do you want to REMOVE any transport? [Type yes/no]: ").lower().strip()
# validating the input by lower-casing the letters and shrinking the spaces
if message == "yes":
print("You have the transports below:")
for number, transport in enumerate(transports, 1): # looping the enumerated list to print the items
print("", str(number) + ")", transport)
removing_index = input("Insert the number of the transport you want to delete: ")
try: # trying to convert the input into integer
index = int(removing_index)
transports.pop(index - 1) # since enumeration has started with 1, we should subtract 1
modes.pop(index - 1)
print("\nSuccessfully removed!")
print("--------------\n") # just for formatting the output in order to keep it clean
remove_transport()
except ValueError:
print("\n!!! Please, insert only numbers\n")
remove_transport()
elif message == "no":
print("--------------\n") # just for formatting the output in order to keep it clean
return
else:
print("\n!!! Please, answer properly\n")
remove_transport()
remove_transport() # calling the function to remove an existing transport
# Check the type of the transport
# zip() can be used to merge relative items of two lists according to their index.
def check_transport():
global transports
global modes
message = input("Do you want to CHECK the mode of any transport? [Type yes/no]: ").lower().strip()
# validating the input by lower-casing the letters and shrinking the spaces
if message == "yes":
print("Choose a transport to check:")
for number, transport in enumerate(transports, 1):
print("", str(number) + ")", transport)
checking_index = input("Insert the number of the transport you want to check: ")
try:
index = int(checking_index)
print("\n", transports[index-1][0].upper() + transports[index-1][1:], "moves on the", modes[index-1] + ".")
print("--------------\n") # just for formatting the output in order to keep it clean
check_transport()
except ValueError:
print("\n!!! Please, insert only numbers!\n")
check_transport()
elif message == "no":
print("--------------\n") # just for formatting the output in order to keep it clean
print(" Thank you for using this app! Good bye!")
return
else:
print("\n!!! Please, answer properly!\n")
check_transport()
check_transport() # calling the function to check the mode af a transport
|
class WordDictionary:
def __init__(self):
self.list=set()
def add_word(self, word):
self.list.add(word)
def search(self, s):
if s in self.list:
return True
for i in self.list:
if len(i)!=len(s):
continue
flag=True
for index,j in enumerate(s):
if j==".":
continue
if j!=i[index]:
flag=False
break
if flag:
return True
return False
|
# Coastline harmonization with a landmask
def coastlineHarmonize(maskFile, ds, outmaskFile, outDEM, minimum, waterVal=0):
'''
This function is designed to take a coastline mask and harmonize elevation
values to it, such that no elevation values that are masked as water cells
will have elevation >0, and no land cells will have an elevation < minimum.
'''
tic1 = time.time()
# Read mask file for information
refDS = gdal.Open(maskFile, gdalconst.GA_ReadOnly)
target_ds = gdal.GetDriverByName(RasterDriver).Create(outmaskFile, ds.RasterXSize, ds.RasterYSize, 1, gdal.GDT_Byte)
DEM_ds = gdal.GetDriverByName(RasterDriver).Create(outDEM, ds.RasterXSize, ds.RasterYSize, 1, ds.GetRasterBand(1).DataType)
CopyDatasetInfo(ds, target_ds) # Copy information from input to output
CopyDatasetInfo(ds, DEM_ds) # Copy information from input to output
# Resample input to output
gdal.ReprojectImage(refDS, target_ds, refDS.GetProjection(), target_ds.GetProjection(), gdalconst.GRA_NearestNeighbour)
# Build numpy array of the mask grid and elevation grid
maskArr = BandReadAsArray(target_ds.GetRasterBand(1))
elevArr = BandReadAsArray(ds.GetRasterBand(1))
# Reassign values
ndv = ds.GetRasterBand(1).GetNoDataValue() # Obtain nodata value
mask = maskArr==1 # A boolean mask of True wherever LANDMASK=1
elevArr[elevArr==ndv] = 0 # Set Nodata cells to 0
elevArr[mask] += minimum # For all land cells, add minimum elevation
elevArr[~mask] = waterVal # ds.GetRasterBand(1).GetNoDataValue()
# Write to output
band = DEM_ds.GetRasterBand(1)
BandWriteArray(band, elevArr)
band.SetNoDataValue(ndv)
# Clean up
target_ds = refDS = DEM_ds = band = None
del maskArr, elevArr, ndv, mask
print(' DEM harmonized with landmask in %3.2f seconds.' %(time.time()-tic1))
def raster_extent(in_raster):
'''
Given a raster object, return the bounding extent [xMin, yMin, xMax, yMax]
'''
xMin, DX, xskew, yMax, yskew, DY = in_raster.GetGeoTransform()
Xsize = in_raster.RasterXSize
Ysize = in_raster.RasterYSize
xMax = xMin + (float(Xsize)*DX)
yMin = yMax + (float(Ysize)*DY)
del Xsize, Ysize, xskew, yskew, DX, DY
return [xMin, yMin, xMax, yMax]
def alter_GT(GT, regridFactor):
'''
This function will alter the resolution of a raster's affine transformation,
assuming that the extent and CRS remain unchanged.
'''
# Georeference geogrid file
GeoTransform = list(GT)
DX = GT[1]/float(regridFactor)
DY = GT[5]/float(regridFactor)
GeoTransform[1] = DX
GeoTransform[5] = DY
GeoTransformStr = ' '.join([str(item) for item in GeoTransform])
return GeoTransform, GeoTransformStr, DX, DY
# Function to reclassify values in a raster
def reclassifyRaster(array, thresholdDict):
'''
Apply a dictionary of thresholds to an array for reclassification.
This function may be made more complicated as necessary
'''
# Reclassify array using bounds and new classified values
new_arr = array.copy()
for newval, oldval in thresholdDict.iteritems():
mask = numpy.where(array==oldval)
new_arr[mask] = newval
del array
return new_arr
# Function to calculate statistics on a raster using gdalinfo command-line
def calcStats(inRaster):
print(' Calculating statistics on %s' %inRaster)
subprocess.call('gdalinfo -stats %s' %inRaster, shell=True)
def apply_threshold(array, thresholdDict):
'''
Apply a dictionary of thresholds to an array for reclassification.
This function may be made more complicated as necessary
'''
# Reclassify array using bounds and new classified values
for newval, bounds in thresholdDict.iteritems():
mask = numpy.where((array > bounds[0]) & (array <= bounds[1])) # All values between bounds[0] and bounds[1]
array[mask] = newval
return array
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.