content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
import numpy as np import tensorflow as tf from tensorflow.keras.callbacks import EarlyStopping from tensorflow.keras.layers import Dropout, Input from tensorflow.keras.models import Model from tensorflow.keras.regularizers import l2 from tensorflow.random import set_seed from spektral.transforms.layer_preprocess import LayerPreprocess from spektral.layers import GATConv from spektral.layers.pooling.global_pool import GlobalMaxPool, GlobalAvgPool, GlobalSumPool from tensorflow.keras.layers import Dense, LeakyReLU, BatchNormalization from tensorflow.keras.activations import tanh from tensorflow.sparse import SparseTensor hidden_states = 16 activation = LeakyReLU(alpha = 0.1)
[ 11748, 299, 32152, 355, 45941, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 6738, 11192, 273, 11125, 13, 6122, 292, 13, 13345, 10146, 1330, 12556, 1273, 33307, 198, 6738, 11192, 273, 11125, 13, 6122, 292, 13, 75, 6962, 1330, 14258, 4...
3.267943
209
from numpy import arcsin, exp from ....Classes.Segment import Segment from ....Classes.Arc1 import Arc1 from ....Classes.SurfLine import SurfLine def get_surface_active(self, alpha=0, delta=0): """Return the full winding surface Parameters ---------- self : SlotUD2 A SlotUD2 object alpha : float float number for rotation (Default value = 0) [rad] delta : complex complex number for translation (Default value = 0) Returns ------- surf_wind: Surface Surface corresponding to the Winding Area """ st = self.get_name_lam() surface = self.active_surf.copy() surface.label = "Wind_" + st + "_R0_T0_S0" # Apply transformation surface.rotate(alpha) surface.translate(delta) return surface
[ 6738, 299, 32152, 1330, 44606, 259, 11, 1033, 198, 198, 6738, 19424, 9487, 274, 13, 41030, 434, 1330, 1001, 5154, 198, 6738, 19424, 9487, 274, 13, 24021, 16, 1330, 10173, 16, 198, 6738, 19424, 9487, 274, 13, 14214, 69, 13949, 1330, 43...
2.75
288
# from https://gogul09.github.io/software/texture-recognition import cv2 import numpy as np import os import glob import mahotas as mt from sklearn.svm import LinearSVC from typing import List import matplotlib.pyplot as plt import pickle # load the training dataset train_path = "../inputs/for_texture_model/train" train_names = os.listdir(train_path) # empty list to hold feature vectors and train labels train_features = [] train_labels = []
[ 2, 422, 3740, 1378, 70, 519, 377, 2931, 13, 12567, 13, 952, 14, 43776, 14, 41293, 12, 26243, 653, 198, 11748, 269, 85, 17, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28686, 198, 11748, 15095, 198, 11748, 42768, 313, 292, 355, 4...
3.207143
140
# Copyright (C) 2019-2020, TomTom (http://tomtom.com). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Helper functions for API reference templates.""" from asciidoxy.generator import Context
[ 2, 15069, 357, 34, 8, 13130, 12, 42334, 11, 4186, 13787, 357, 4023, 1378, 39532, 39532, 13, 785, 737, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779,...
3.768817
186
import pyexlatex as pl import pyexlatex.table as lt import pyexlatex.presentation as lp import pyexlatex.graphics as lg import pyexlatex.layouts as ll
[ 11748, 12972, 1069, 17660, 87, 355, 458, 198, 11748, 12972, 1069, 17660, 87, 13, 11487, 355, 300, 83, 198, 11748, 12972, 1069, 17660, 87, 13, 25579, 341, 355, 300, 79, 198, 11748, 12972, 1069, 17660, 87, 13, 70, 11549, 355, 300, 70, ...
2.814815
54
# Hello python a = "Hello I m Robot Jai" print(a)
[ 2, 18435, 21015, 220, 198, 64, 796, 366, 15496, 314, 285, 16071, 449, 1872, 1, 198, 4798, 7, 64, 8, 198 ]
2.428571
21
from alfabeto import * from main import nameSur # Listas letras = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
[ 6738, 435, 69, 8380, 78, 1330, 1635, 198, 6738, 1388, 1330, 1438, 14214, 198, 198, 2, 7343, 292, 198, 1616, 8847, 796, 14631, 64, 1600, 366, 65, 1600, 366, 66, 1600, 366, 67, 1600, 366, 68, 1600, 366, 69, 1600, 366, 70, 1600, 366,...
1.752525
198
""" Device Base Package """ from __future__ import absolute_import, division, print_function import struct from binascii import hexlify from collections import deque, namedtuple import enum import socket from ...aid.sixing import * from ...aid.odicting import odict from ...aid.byting import bytify, unbytify, packify, unpackify from ...aid.eventing import eventify, tagify from ...aid import getConsole from .. import aioing from .protoing import MixIn console = getConsole()
[ 37811, 198, 24728, 7308, 15717, 198, 198, 37811, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 11, 7297, 11, 3601, 62, 8818, 198, 198, 11748, 2878, 198, 6738, 9874, 292, 979, 72, 1330, 17910, 75, 1958, 198, 6738, 17268, 1330, 3...
3.381944
144
# Copyright 2021 NVIDIA 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. # import numpy as np import legate.numpy as lg if __name__ == "__main__": test()
[ 2, 15069, 33448, 15127, 10501, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 73...
3.593583
187
# coding: utf-8 """ SQE API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from qumranica.configuration import Configuration def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, CatalogueMatchDTO): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, CatalogueMatchDTO): return True return self.to_dict() != other.to_dict()
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 37811, 198, 220, 220, 220, 49747, 36, 7824, 628, 220, 220, 220, 1400, 6764, 2810, 357, 27568, 416, 4946, 15042, 35986, 3740, 1378, 12567, 13, 785, 14, 9654, 499, 270, 10141, 14, 9654, 15042,...
2.587179
390
import numpy as np from nengo_spa.algebras.hrr_algebra import HrrAlgebra from nengo.utils.numpy import is_number
[ 11748, 299, 32152, 355, 45941, 198, 6738, 299, 1516, 78, 62, 2777, 64, 13, 282, 469, 1671, 292, 13, 11840, 81, 62, 282, 29230, 1330, 367, 21062, 2348, 29230, 198, 6738, 299, 1516, 78, 13, 26791, 13, 77, 32152, 1330, 318, 62, 17618 ]
2.604651
43
import socket from _thread import * import pickle from board import Board import time hostname = socket.gethostname() ipAddr = socket.gethostbyname(hostname) print(ipAddr) server = ipAddr port = 5556 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((server, port)) except socket.error as e: print(str(e)) s.listen(2) print("Waiting for a connection, Server Started") bo = Board() currentId = "b" connections = 0 while True: conn, addr = s.accept() print("Connected to:", addr) start_new_thread(threaded_client, (conn,))
[ 11748, 17802, 198, 6738, 4808, 16663, 1330, 1635, 198, 11748, 2298, 293, 198, 6738, 3096, 1330, 5926, 198, 11748, 640, 198, 198, 4774, 3672, 796, 17802, 13, 1136, 4774, 3672, 3419, 220, 220, 220, 220, 198, 541, 4550, 81, 796, 17802, 1...
2.633028
218
import wikihowunofficialapi as wha ra = wha.random_article() print(ra)
[ 11748, 47145, 4449, 322, 403, 16841, 15042, 355, 348, 64, 198, 198, 430, 796, 348, 64, 13, 25120, 62, 20205, 3419, 198, 4798, 7, 430, 8, 198 ]
2.666667
27
import numpy as np import pandas as pd from nilmtk import TimeFrame import datetime import matplotlib.pyplot as plt # transients['active transition'].cumsum().resample('2s', how='ffill').plot()
[ 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 220, 198, 6738, 18038, 16762, 74, 1330, 3862, 19778, 198, 11748, 4818, 8079, 198, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 2, 1007, 2334, 1...
2.941176
68
# Generated by Django 3.1.2 on 2020-10-14 07:15 import cloudinary.models from django.db import migrations import django.utils.timezone
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 17, 319, 12131, 12, 940, 12, 1415, 8753, 25, 1314, 198, 198, 11748, 6279, 3219, 13, 27530, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 198, 11748, 42625, 14208, 13, 26791, 13, 2435...
3.044444
45
import logging from threading import RLock from typing import Callable, Tuple, TypeVar import schedule import ts3 from ts3.query import TS3ServerConnection from bot.config import Config LOG = logging.getLogger(__name__) R = TypeVar('R') def default_exception_handler(ex): """ prints the trace and returns the exception for further inspection """ LOG.debug("Exception caught in default_exception_handler: ", exc_info=ex) return ex def signal_exception_handler(ex): """ returns the exception without printing it, useful for expected exceptions, signaling that an exception occurred """ return ex def ignore_exception_handler(ex): """ acts as if no exception was raised, equivalent to except: pass""" return None
[ 11748, 18931, 198, 6738, 4704, 278, 1330, 371, 25392, 198, 6738, 19720, 1330, 4889, 540, 11, 309, 29291, 11, 5994, 19852, 198, 198, 11748, 7269, 198, 11748, 40379, 18, 198, 6738, 40379, 18, 13, 22766, 1330, 26136, 18, 10697, 32048, 198,...
3.571429
210
"""Reachy submodule responsible for low-level IO.""" from .io import IO # noqa F401
[ 37811, 3041, 35586, 850, 21412, 4497, 329, 1877, 12, 5715, 24418, 526, 15931, 628, 198, 6738, 764, 952, 1330, 24418, 220, 1303, 645, 20402, 376, 21844, 198 ]
3.222222
27
import pandas as pd from context import * from cordis_search import wrapper as wr TEST_PROJECTS_FILE = pd.read_csv(RESOURCES_FOLDER+"fp7_test_projects.csv", sep=";") print(TEST_PROJECTS_FILE) test_summary()
[ 11748, 19798, 292, 355, 279, 67, 198, 198, 6738, 4732, 1330, 1635, 198, 6738, 15050, 271, 62, 12947, 1330, 29908, 355, 1319, 198, 198, 51, 6465, 62, 31190, 41, 2943, 4694, 62, 25664, 796, 279, 67, 13, 961, 62, 40664, 7, 19535, 2606,...
2.518072
83
import numpy as np from dpsniper.mechanisms.abstract import Mechanism
[ 11748, 299, 32152, 355, 45941, 198, 6738, 288, 862, 45554, 13, 1326, 3147, 6583, 13, 397, 8709, 1330, 13438, 1042, 628, 198 ]
3.272727
22
from ..core import OrthodoxCalendar from ..registry_tools import iso_register
[ 6738, 11485, 7295, 1330, 17650, 9771, 9239, 198, 6738, 11485, 2301, 4592, 62, 31391, 1330, 47279, 62, 30238, 628 ]
4.157895
19
import os from distutils.dir_util import copy_tree from invoke import task, run import shutil
[ 11748, 28686, 198, 6738, 1233, 26791, 13, 15908, 62, 22602, 1330, 4866, 62, 21048, 198, 6738, 26342, 1330, 4876, 11, 1057, 198, 11748, 4423, 346, 198 ]
3.615385
26
from typing import List if __name__ == "__main__": main()
[ 6738, 19720, 1330, 7343, 628, 220, 220, 220, 220, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1388, 3419, 628 ]
2.535714
28
import datetime as dt import numpy as np
[ 11748, 4818, 8079, 355, 288, 83, 198, 198, 11748, 299, 32152, 355, 45941, 628, 628, 198 ]
2.875
16
import FWCore.ParameterSet.Config as cms # TrackerTrajectoryBuilders from RecoTracker.CkfPattern.CkfTrajectoryBuilder_cff import * # TrajectoryCleaning from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import * # navigation school from RecoTracker.TkNavigation.NavigationSchoolESProducer_cff import * from RecoTracker.CkfPattern.CkfTrackCandidates_cfi import * # generate CTF track candidates ############ ckfTrackCandidatesNoOverlaps = ckfTrackCandidates.clone( TrajectoryBuilderPSet = dict(refToPSet_ = 'CkfTrajectoryBuilder') )
[ 11748, 48849, 14055, 13, 36301, 7248, 13, 16934, 355, 269, 907, 198, 198, 2, 26885, 15721, 752, 652, 15580, 364, 198, 6738, 3311, 78, 35694, 13, 34, 74, 69, 47546, 13, 34, 74, 69, 15721, 752, 652, 32875, 62, 66, 487, 1330, 1635, 1...
3.016216
185
""" Task 3 Write an application that allows you to calculate the cost of a trip. Implement a function called hotel_cost that takes one argument, nights, as input. The hotel costs 70 per night so return a suitable value. Implement a function called plane_ticket_cost that accepts a string, city, and a float, class, as inputs. The function should handle the following locations, returning their associated round trip costs that are multiplied by the class amount. New York: 2,000 Auckland: 790 Venice: 154 Glasgow: 65 The class multiplier starts at 1 for economy and goes up in .3 steps: 1.3 = premium economy, 1.6 = business class and 1.9 = first class. Then implement the rental_car_cost function with an argument called days. The function should calculate the cost of hiring a car with the following considerations: Every day of car hire costs 30 If you rent the car for more than 7 days, you get 50 off your total If you rent the car for more than 3 days, you get 30 off your total oThese two discounts cannot be applied at the same time. Define a function total_cost which accepts two arguments; city and days. It should call the other functions and return the sum of the cost of the trip. Save the file as the next numeric ex value and commit to GitHub. """ nights = int(input("how many number of nights stay?")) hotel_cost(nights) city=str(input("select your destination: New york, Auckland, Venice, Glasgow: ")) # the class multiplier starts at 1 for economy and goes up in 3 steps: 1.3 premium economy 1.6 = business class and 1.9 = first class. _class=float(input("Select your Travel Class: 1=Economy, 1.3=Premium Economy, 1.6=Business Class, 1.9=First Class: ")) if _class=='1': print("Economy Travel Class selected") elif _class=='1.3': print("Premium Economy Travel Class selected") elif _class=='1.6': print("Business Class Travel Class selected") elif _class=='1.9': print("First Class Travel Class selected") plane_ticket_cost(city, _class) days=float(input("enter how many number of days car hire required: ")) rental_car_cost(days) total_cost(city,days)
[ 37811, 201, 198, 25714, 513, 201, 198, 201, 198, 16594, 281, 3586, 326, 3578, 345, 284, 15284, 262, 1575, 286, 257, 5296, 13, 201, 198, 201, 198, 3546, 26908, 257, 2163, 1444, 7541, 62, 15805, 326, 2753, 530, 4578, 11, 12513, 11, 35...
3.214076
682
import pandas as pd import numpy as np import cv2 import os import math import pickle from matplotlib import pyplot as plt from PIL import Image from matplotlib.pyplot import imshow # %matplotlib inline def square(img): """ This function resize non square image to square one (height == width) :param img: input image as numpy array :return: numpy array """ # image after making height equal to width squared_image = img # Get image height and width h = img.shape[0] w = img.shape[1] # In case height superior than width if h > w: diff = h-w if diff % 2 == 0: x1 = np.zeros(shape=(h, diff//2)) x2 = x1 else: x1 = np.zeros(shape=(h, diff//2)) x2 = np.zeros(shape=(h, (diff//2)+1)) squared_image = np.concatenate((x1, img, x2), axis=1) # In case height inferior than width if h < w: diff = w-h if diff % 2 == 0: x1 = np.zeros(shape=(diff//2, w)) x2 = x1 else: x1 = np.zeros(shape=(diff//2, w)) x2 = np.zeros(shape=((diff//2)+1, w)) squared_image = np.concatenate((x1, img, x2), axis=0) return squared_image
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 269, 85, 17, 198, 11748, 28686, 198, 11748, 10688, 198, 11748, 2298, 293, 198, 6738, 2603, 29487, 8019, 1330, 12972, 29487, 355, 458, 83, 198, 6738, 350, ...
2.421769
441
multi = 0 list = (1 , 2 , 3) for i in list: multi = multi + i print (f'la multi total de 1 al 3 es {multi}')
[ 41684, 796, 657, 198, 198, 4868, 796, 357, 16, 837, 362, 837, 513, 8, 198, 198, 1640, 1312, 287, 1351, 25, 198, 220, 220, 220, 5021, 796, 5021, 1343, 1312, 198, 220, 220, 220, 220, 198, 220, 220, 220, 3601, 357, 69, 6, 5031, 502...
2.236364
55
# -*- coding: utf-8 -*- # pylint: disable=unused-import ############################################################################### # Copyright (c), Forschungszentrum Jlich GmbH, IAS-1/PGI-1, Germany. # # All rights reserved. # # This file is part of the aiida-jutools package. # # (AiiDA JuDFT tools) # # # # The code is hosted on GitHub at https://github.com/judftteam/aiida-jutools. # # For further information on the license, see the LICENSE.txt file. # # For further information please visit http://judft.de/. # # # ############################################################################### """AiiDA JuTools. We recommended to use this library with the import statement ``import aiida_jutools as jutools``. In your code, you can then call all available tools like so: ``jutools.package.tool()``. """ __version__ = "0.1.0-dev1" # Import all of the library's user packages. from . import code from . import computer from . import group from . import io from . import logging from . import meta from . import node from . import plugins from . import process from . import process_functions from . import submit from . import structure # # import all of the library's developer packages. from . import _dev # Potentially problematic imports: # - kkr: As soon as aiida-kkr becomes dependent on aiida-jutools, this import MIGHT introduce a circular # dependencies. A simple test (made aiida-kkr import aiida-jutools) had no such effect. But if it # occurs, here a few potential solutions: # - Decouple the kkr package = remove from import list above. Then all code using it must be updated # to import it separately, like from aiida_jutools import kkr as _jutools_kkr. Might break external code. # - Hide all aiida-kkr imports = in resp. module, move them inside the tools that use them. If it works, # this might be a solution that does not break external code. # # The potential problem and the solution stated above, if it becomes one, applies to other JuDFTTeam plugins as well, # should they start using aiida-jutools as common codebase (aiida-fleur, aiida-spirit, aiida-spex, ...).
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 279, 2645, 600, 25, 15560, 28, 403, 1484, 12, 11748, 198, 29113, 29113, 7804, 4242, 21017, 198, 2, 15069, 357, 66, 828, 27325, 354, 2150, 82, 89, 298, 6582, 449, ...
2.543679
973
import logging from pathlib import Path from sys import argv import var import telethon.utils from telethon import TelegramClient from telethon import events,Button import os from var import Var from . import beast from telethon.tl import functions from beastx.Configs import Config from telethon.tl.functions.messages import AddChatUserRequest from telethon.tl.functions.users import GetFullUserRequest from telethon.tl.functions.channels import LeaveChannelRequest from telethon.tl.functions.account import UpdateProfileRequest from telethon.tl.types import InputMessagesFilterDocument from resources.startup.sanskar import autobot,autopilot,customize from beastx.utils import load_module, start_assistant import asyncio from telethon.tl.functions.channels import InviteToChannelRequest from . import bot bot = beast sed = logging.getLogger("beastx") #rom . import semxx,semxxx ##################################### plugin_channel = "@BeastX_Plugins" ##################################### if Var.TG_BOT_TOKEN_BF_HER is None: try: print("BOT_TOKEN not Found") bot.loop.run_until_complete(autobot()) except BaseException as er: print(er) else: pass sur = Config.PRIVATE_GROUP_ID UL = Config.TG_BOT_USER_NAME_BF_HER VR = "Beast 0.1" chat_id = sur sed = logging.getLogger("beastx") # ! #--------------------- # #Assistant @{mm.username} #User @{om.username} #Version {VR} # #Do `.ping `or` /alive` for check userbot working #""" ''' await sedmrunal.send_message(sur, MSG, buttons=[ [Button.url("Updates", url="https://t.me/BeastX_Userbot")], [ Button.url("Support",url="https://t.me/BeastX_Support")] ]) except Exception as e: sed.info(str(e)) sed.info("---------------------------------------") sed.info("Bruh you forgot add assistant in log group") sed.info("---------------------------------------") ''' try: bot.tgbot = None if Var.TG_BOT_USER_NAME_BF_HER is not None: bot.tgbot = TelegramClient( "TG_BOT_TOKEN", api_id=Var.APP_ID, api_hash=Var.API_HASH ).start(bot_token=Var.TG_BOT_TOKEN_BF_HER) bot.loop.run_until_complete(add_bot(Var.TG_BOT_USER_NAME_BF_HER)) else: bot.start() except BaseException as er: sed.info(er) import glob logger_group = Var.PRIVATE_GROUP_ID if not str(logger_group).startswith("-100"): try: bot.loop.run_until_complete(autopilot()) except BaseException as er: print(er) else: pass bot.loop.run_until_complete(a()) path = "beastx/modules/*.py" files = glob.glob(path) for name in files: with open(name) as f: path1 = Path(f.name) shortname = path1.stem load_module(shortname.replace(".py", "")) if Config.ENABLE_ASSISTANTBOT == "ENABLE": path = "beastx/modules/assistant/*.py" files = glob.glob(path) for name in files: with open(name) as f: path1 = Path(f.name) shortname = path1.stem start_assistant(shortname.replace(".py", "")) sed.info("beastx And Assistant Bot Have Been Installed Successfully !") sed.info("---------------------------------------") sed.info("------------@BeastX_Userbot------------") sed.info("---------------------------------------") else: sed.info("beastx Has Been Installed Sucessfully !") sed.info("Hope you will enjoy") #await bot.send_message(chat_id,MSG) #else: # sed.info("your Get_Msg disable") bot.run_until_disconnected()
[ 11748, 18931, 201, 198, 6738, 3108, 8019, 1330, 10644, 201, 198, 6738, 25064, 1330, 1822, 85, 201, 198, 11748, 1401, 201, 198, 11748, 5735, 400, 261, 13, 26791, 201, 198, 6738, 5735, 400, 261, 1330, 50203, 11792, 201, 198, 6738, 5735, ...
2.280806
1,688
import unittest from solutions.day02.solution import ship_computer from tests.helpers import Puzzle
[ 11748, 555, 715, 395, 198, 198, 6738, 8136, 13, 820, 2999, 13, 82, 2122, 1330, 4074, 62, 33215, 198, 6738, 5254, 13, 16794, 364, 1330, 23966, 628 ]
3.777778
27
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import ode import FLC import pyprind from numpy.linalg import eig import pandas as pd def rough2(lenght): """Random road condition. Every 10 time sample a new random value is given. This simulates a car moving on a road at 36 km/h with roughness wide 1 cm. """ i = 0 Rough = [] while i < lenght/10: j = 0 sample = np.random.randn() # setting correct max height while j < 10: # add the same value for 10 time steps Rough.append(sample) j += 1 i += 1 return 0.1 * np.array(Rough) / np.max(Rough) / 2 def rough3(lenght): """Road condition defined by the ISO 8608 standard""" k = 3 # ISO road condition N = lenght + 1 # data points L = 10 # lenght of road profile B = L / N # sampling interval n0 = 0.1 dn = 1 / L # Frequency band n = np.arange(dn, N*dn, dn) # frequency band phi = 2 * np.pi * (np.random.rand(len(n))) Amp1 = np.sqrt(dn) * (2**k) * (1e-3) * n0/n x = np.arange(0, L-B, B) hx = np.zeros(len(x)) for i in np.arange(len(x)): hx[i] = np.sum(Amp1 * np.cos(2 * np.pi * n * x[i] + phi)) return 0.1 * hx / np.max(hx) def rough(): """Reading values from file Rough.txt""" f = open('Rough.txt','r') RoughList = [] for line in f: RoughList.append(float(line)) return np.array(RoughList) def RMS(array): """Calculates the root-mean-squared value of an array. """ return np.sqrt(array @ array / array.size) def derivate(array, step=100): """Calculates the first order derivative of an array. It differs from np.diff because this returns an array of the same lenght as the input one. It becomes useful for plotting. """ deriv = np.zeros_like(array) deriv[0] = array[1] - array[0] deriv[1:] = np.diff(array) return deriv * step # ============================================================================= # Importing values of PID # ============================================================================= StepPID = pd.read_excel('Scalino.xlsx') StepPID = np.asarray(StepPID) ImpulsePID = pd.read_excel('impulso.xlsx') ImpulsePID = np.asarray(ImpulsePID) BumpPID = pd.read_excel('BumpPID.xlsx') BumpPID = np.asarray(BumpPID) RoughPID = pd.read_excel('Rough.xlsx') RoughPID = np.asarray(RoughPID) # ============================================================================= # STATE SPACE REPRESENTATION # x1 = x_body # x2 = x_wheel # x3 = x_body' # x4 = x_wheel' # ============================================================================= # Main spring stiffness k_s = 15000 # N/m # Sprung mass m_b = 250 # kg # Viscous damper c_s = 1000 # N/(m/s) # Unsprung mass (wheel) m_w = 30 # kg # Tyre stiffness k_t = 150000 # N/m # Skyhook damping c_sky = 1000 # N/(m/s) # Different road simulations Impulse = impulse(1000) Step = step(1000) Bump = bump() Rough = rough() # ============================================================================= # ## ODE solution - fuzzy # ============================================================================= # Step solStep = ode(fuzzySuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solStep.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time = [] StepState = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Step') while solStep.successful() and solStep.t < tFin: solStep.set_f_params(Step[counter]) solStep.integrate(solStep.t + dt) StepState.append(solStep.y) Time.append(solStep.t) counter += 1 progress.update() Time = np.asarray(Time) StepState = np.asarray(StepState) # Impulse solImpulse = ode(fuzzySuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solImpulse.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time = [] ImpulseState = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Impulse') while solImpulse.successful() and solImpulse.t < tFin: solImpulse.set_f_params(Impulse[counter]) solImpulse.integrate(solImpulse.t + dt) ImpulseState.append(solImpulse.y) Time.append(solImpulse.t) counter += 1 progress.update() Time = np.asarray(Time) ImpulseState = np.asarray(ImpulseState) # Bump solBump = ode(fuzzySuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solBump.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time = [] BumpState = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Bump') while solBump.successful() and solBump.t < tFin: solBump.set_f_params(Bump[counter]) solBump.integrate(solBump.t + dt) BumpState.append(solBump.y) Time.append(solBump.t) counter += 1 progress.update() Time = np.asarray(Time) BumpState = np.asarray(BumpState) # Rough road solRough = ode(fuzzySuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solRough.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time = [] RoughState = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Rough') while solRough.successful() and solRough.t < tFin: solRough.set_f_params(Rough[counter]) solRough.integrate(solRough.t + dt) RoughState.append(solRough.y) Time.append(solRough.t) counter += 1 progress.update() Time = np.asarray(Time) RoughState = np.asarray(RoughState) # ============================================================================= # ## ODE solution - passive # ============================================================================= # Step solStep2 = ode(passiveSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solStep2.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time2 = [] StepState2 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Step') while solStep2.successful() and solStep2.t < tFin: solStep2.set_f_params(Step[counter]) solStep2.integrate(solStep2.t + dt) StepState2.append(solStep2.y) Time2.append(solStep2.t) counter += 1 progress.update() Time2 = np.asarray(Time2) StepState2 = np.asarray(StepState2) # Impulse solImpulse2 = ode(passiveSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solImpulse2.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time2 = [] ImpulseState2 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Impulse') while solImpulse2.successful() and solImpulse2.t < tFin: solImpulse2.set_f_params(Impulse[counter]) solImpulse2.integrate(solImpulse2.t + dt) ImpulseState2.append(solImpulse2.y) Time2.append(solImpulse2.t) counter += 1 progress.update() Time2 = np.asarray(Time2) ImpulseState2 = np.asarray(ImpulseState2) # Bump solBump2 = ode(passiveSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solBump2.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time2 = [] BumpState2 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Bump') while solBump2.successful() and solBump2.t < tFin: solBump2.set_f_params(Bump[counter]) solBump2.integrate(solBump2.t + dt) BumpState2.append(solBump2.y) Time2.append(solBump2.t) counter += 1 progress.update() Time2 = np.asarray(Time2) BumpState2 = np.asarray(BumpState2) # Rough road solRough2 = ode(passiveSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solRough2.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time2 = [] RoughState2 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Rough') while solRough2.successful() and solRough2.t < tFin: solRough2.set_f_params(Rough[counter]) solRough2.integrate(solRough2.t + dt) RoughState2.append(solRough2.y) Time2.append(solRough2.t) counter += 1 progress.update() Time2 = np.asarray(Time2) RoughState2 = np.asarray(RoughState2) # ============================================================================= # ## ODE solution - skyhook # ============================================================================= # Step solStep3 = ode(skyhookSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solStep3.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time3 = [] StepState3 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Step') while solStep3.successful() and solStep3.t < tFin: solStep3.set_f_params(Step[counter]) solStep3.integrate(solStep3.t + dt) StepState3.append(solStep3.y) Time3.append(solStep3.t) counter += 1 progress.update() Time3 = np.asarray(Time3) StepState3 = np.asarray(StepState3) # Impulse solImpulse3 = ode(skyhookSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solImpulse3.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time3 = [] ImpulseState3 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Impulse') while solImpulse3.successful() and solImpulse3.t < tFin: solImpulse3.set_f_params(Impulse[counter]) solImpulse3.integrate(solImpulse3.t + dt) ImpulseState3.append(solImpulse3.y) Time3.append(solImpulse3.t) counter += 1 progress.update() Time3 = np.asarray(Time3) ImpulseState3 = np.asarray(ImpulseState3) # Bump solBump3 = ode(skyhookSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solBump3.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time3 = [] BumpState3 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Bump') while solBump3.successful() and solBump3.t < tFin: solBump3.set_f_params(Bump[counter]) solBump3.integrate(solBump3.t + dt) BumpState3.append(solBump3.y) Time3.append(solBump3.t) counter += 1 progress.update() Time3 = np.asarray(Time3) BumpState3 = np.asarray(BumpState3) # Rough road solRough3 = ode(skyhookSuspensionModel).set_integrator('dopri5', atol=1e-6) state0 = [0, 0, 0, 0] solRough3.set_initial_value(state0) tFin = 10 - 0.01 dt = 0.01 Time3 = [] RoughState3 = [] counter = 0 progress = pyprind.ProgBar(1000, title='Processing: Rough') while solRough3.successful() and solRough3.t < tFin: solRough3.set_f_params(Rough[counter]) solRough3.integrate(solRough3.t + dt) RoughState3.append(solRough3.y) Time3.append(solRough3.t) counter += 1 progress.update() Time3 = np.asarray(Time3) RoughState3 = np.asarray(RoughState3) # ============================================================================= # ACCELERATION EVALUATION (AND FUZZY FORCE) # ============================================================================= # Step StepAcc = derivate(StepState[:, 2]) StepAcc2 = derivate(StepState2[:, 2]) StepAcc3 = derivate(StepState3[:, 2]) StepForce = (-k_s * StepState[:, 0] + k_s * StepState[:, 1] - c_s * StepState[:, 2] + c_s * StepState[:, 3] - StepAcc[:] * m_b) # Impulse ImpulseAcc = derivate(ImpulseState[:, 2]) ImpulseAcc2 = derivate(ImpulseState2[:, 2]) ImpulseAcc3 = derivate(ImpulseState3[:, 2]) ImpulseForce = (-k_s * ImpulseState[:, 0] + k_s * ImpulseState[:, 1] - c_s * ImpulseState[:, 2] + c_s * ImpulseState[:, 3] - ImpulseAcc[:] * m_b) # Bump BumpAcc = derivate(BumpState[:, 2]) BumpAcc2 = derivate(BumpState2[:, 2]) BumpAcc3 = derivate(BumpState3[:, 2]) BumpForce = (-k_s * BumpState[:, 0] + k_s * BumpState[:, 1] - c_s * BumpState[:, 2] + c_s * BumpState[:, 3] - BumpAcc[:] * m_b) # Rough RoughAcc = derivate(RoughState[:, 2]) RoughAcc2 = derivate(RoughState2[:, 2]) RoughAcc3 = derivate(RoughState3[:, 2]) RoughForce = (-k_s * RoughState[:, 0] + k_s * RoughState[:, 1] - c_s * RoughState[:, 2] + c_s * RoughState[:, 3] - RoughAcc[:] * m_b) # ============================================================================= # # PLOTTING # ============================================================================= # Step plt.figure(1) plt.plot(Time, 1e3 * StepState[:, 0], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * StepState2[:, 0], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * StepState3[:, 0], 'C3', label='Skyhook', linewidth=1) plt.plot(StepPID[:, 0], 1e3 * StepPID[:, 1], 'C4', label='PID', linewidth=1) plt.plot(Time, 1e3 * Step, 'C0', label='Road', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel('Body displacement [mm]') plt.legend() plt.figure(2) plt.plot(Time, 1e3 * StepState[:, 1], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * StepState2[:, 1], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * StepState3[:, 1], 'C3', label='Skyhook', linewidth=1) plt.plot(StepPID[:, 0], 1e3 * StepPID[:, 2], 'C4', label='PID', linewidth=1) plt.xlabel('Time [s]') plt.ylabel('Unsprung mass displacement [mm]') plt.legend() plt.figure(3) plt.plot(Time, StepAcc, 'C1', label='Fuzzy') plt.plot(Time2, StepAcc2, 'C2', label='Passive', linewidth=1) plt.plot(Time3, StepAcc3, 'C3', label='Skyhook', linewidth=1) plt.plot(StepPID[:, 0], StepPID[:, 3], 'C4', label='PID', linewidth=1) # plt.plot(Time, StepForce/m_b, 'C0', label='Force', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel(r'Body acceleration [m/${s^2}$]') plt.legend() # Impulse plt.figure(4) plt.plot(Time, 1e3 * ImpulseState[:, 0], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * ImpulseState2[:, 0], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * ImpulseState3[:, 0], 'C3', label='Skyhook', linewidth=1) plt.plot(ImpulsePID[:, 0], 1e3 * ImpulsePID[:, 1], 'C4', label='PID', linewidth=1) plt.plot(Time, 1e3 * Impulse, 'C0', label='Road', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel('Body displacement [mm]') plt.legend() plt.figure(5) plt.plot(Time, 1e3 * ImpulseState[:, 1], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * ImpulseState2[:, 1], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * ImpulseState3[:, 1], 'C3', label='Skyhook', linewidth=1) plt.plot(ImpulsePID[:, 0], 1e3 * ImpulsePID[:, 2], 'C4', label='PID', linewidth=1) plt.xlabel('Time [s]') plt.ylabel('Unsprung mass displacement [mm]') plt.legend() plt.figure(6) plt.plot(Time, ImpulseAcc, 'C1', label='Fuzzy') plt.plot(Time2, ImpulseAcc2, 'C2', label='Passive', linewidth=1) plt.plot(Time3, ImpulseAcc3, 'C3', label='Skyhook', linewidth=1) plt.plot(ImpulsePID[:, 0], ImpulsePID[:, 3], 'C4', label='PID', linewidth=1) # plt.plot(Time, ImpulseForce/m_b, 'C0', label='Force', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel(r'Body acceleration [m/${s^2}$]') plt.legend() # Bump plt.figure(7) plt.plot(Time, 1e3 * BumpState[:, 0], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * BumpState2[:, 0], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * BumpState3[:, 0], 'C3', label='Skyhook', linewidth=1) plt.plot(BumpPID[:, 0], 1e3 * BumpPID[:, 1], 'C4', label='PID', linewidth=1) plt.plot(Time, 1e3 * Bump, 'C0', label='Road', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel('Body displacement [mm]') plt.legend() plt.figure(8) plt.plot(Time, 1e3 * BumpState[:, 1], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * BumpState2[:, 1], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * BumpState3[:, 1], 'C3', label='Skyhook', linewidth=1) plt.plot(BumpPID[:, 0], 1e3 * BumpPID[:, 2], 'C4', label='PID', linewidth=1) plt.xlabel('Time [s]') plt.ylabel('Unsprung mass displacement [mm]') plt.legend() plt.figure(9) plt.plot(Time, BumpAcc, 'C1', label='Fuzzy') plt.plot(Time2, BumpAcc2, 'C2', label='Passive', linewidth=1) plt.plot(Time3, BumpAcc3, 'C3', label='Skyhook', linewidth=1) plt.plot(BumpPID[:, 0], BumpPID[:, 3], 'C4', label='PID', linewidth=1) # plt.plot(Time, BumpForce/m_b, 'C0', label='Force', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel(r'Body acceleration [m/${s^2}$]') plt.legend() # Rough plt.figure(10) plt.plot(Time, 1e3 * RoughState[:, 0], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * RoughState2[:, 0], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * RoughState3[:, 0], 'C3', label='Skyhook', linewidth=1) plt.plot(RoughPID[:, 0], 1e3 * RoughPID[:, 1], 'C4', label='PID', linewidth=1) plt.plot(Time, 1e3 * Rough, 'C0', label='Road', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel('Body displacement [mm]') plt.legend() plt.figure(11) plt.plot(Time, 1e3 * RoughState[:, 1], 'C1', label='Fuzzy') plt.plot(Time2, 1e3 * RoughState2[:, 1], 'C2', label='Passive', linewidth=1) plt.plot(Time3, 1e3 * RoughState3[:, 1], 'C3', label='Skyhook', linewidth=1) plt.plot(RoughPID[:, 0], 1e3 * RoughPID[:, 2], 'C4', label='PID', linewidth=1) plt.xlabel('Time [s]') plt.ylabel('Unsprung mass displacement [mm]') plt.legend() plt.figure(12) plt.plot(Time, RoughAcc, 'C1', label='Fuzzy') plt.plot(Time2, RoughAcc2, 'C2', label='Passive', linewidth=1) plt.plot(Time3, RoughAcc3, 'C3', label='Skyhook', linewidth=1) plt.plot(RoughPID[:, 0], RoughPID[:, 3], 'C4', label='PID', linewidth=1) # plt.plot(Time, RoughForce/m_b, 'C0', label='Force', linewidth=0.8) plt.xlabel('Time [s]') plt.ylabel(r'Body acceleration [m/${s^2}$]') plt.legend() # ============================================================================= # RESULTS # ============================================================================= # Calculation of RMS for: # (1) Body displacement # (2) Body accelaration # (3) Wheel hop (unsprung mass displacement) #StepFuzzyRMS = np.array([ # RMS(StepState[:, 0]), # RMS(StepAcc), # RMS(StepState[:, 1]) # ]) # #StepPassiveRMS = np.array([ # RMS(StepState2[:, 0]), # RMS(StepAcc2), # RMS(StepState2[:, 1]) # ]) # #StepSkyhookRMS = np.array([ # RMS(StepState3[:, 0]), # RMS(StepAcc3), # RMS(StepState3[:, 1]) # ]) # #StepResult = np.array([ # (StepFuzzyRMS - StepPassiveRMS) / StepPassiveRMS, # (StepSkyhookRMS - StepPassiveRMS) / StepPassiveRMS, # ]) * 100 # #ImpulseFuzzyRMS = np.array([ # RMS(ImpulseState[:, 0]), # RMS(ImpulseAcc), # RMS(ImpulseState[:, 1]) # ]) # #ImpulsePassiveRMS = np.array([ # RMS(ImpulseState2[:, 0]), # RMS(ImpulseAcc2), # RMS(ImpulseState2[:, 1]) # ]) # #ImpulseSkyhookRMS = np.array([ # RMS(ImpulseState3[:, 0]), # RMS(ImpulseAcc3), # RMS(ImpulseState3[:, 1]) # ]) # #ImpulseResult = np.array([ # (ImpulseFuzzyRMS - ImpulsePassiveRMS) / ImpulsePassiveRMS, # (ImpulseSkyhookRMS - ImpulsePassiveRMS) / ImpulsePassiveRMS # ]) * 100 # #BumpFuzzyRMS = np.array([ # RMS(BumpState[:, 0]), # RMS(BumpAcc), # RMS(BumpState[:, 1]) # ]) # #BumpPassiveRMS = np.array([ # RMS(BumpState2[:, 0]), # RMS(BumpAcc2), # RMS(BumpState2[:, 1]) # ]) # #BumpSkyhookRMS = np.array([ # RMS(BumpState3[:, 0]), # RMS(BumpAcc3), # RMS(BumpState3[:, 1]) # ]) # #BumpResult = np.array([ # (BumpFuzzyRMS - BumpPassiveRMS) / BumpPassiveRMS, # (BumpSkyhookRMS - BumpPassiveRMS) / BumpPassiveRMS # ]) * 100 RoughFuzzyRMS = np.array([ RMS(RoughState[:, 0] - Rough), RMS(RoughAcc), RMS(RoughState[:, 1] - Rough) ]) RoughPassiveRMS = np.array([ RMS(RoughState2[:, 0] - Rough), RMS(RoughAcc2), RMS(RoughState2[:, 1] - Rough) ]) RoughSkyhookRMS = np.array([ RMS(RoughState3[:, 0] - Rough), RMS(RoughAcc3), RMS(RoughState3[:, 1] - Rough) ]) RoughPIDRMS = np.array([ RMS(RoughPID[:, 1] - Rough[:-1]), RMS(RoughPID[:, 3]), RMS(RoughPID[:, 2] - Rough[:-1]) ]) RoughResult = np.array([ (RoughFuzzyRMS - RoughPassiveRMS) / RoughPassiveRMS, (RoughSkyhookRMS - RoughPassiveRMS) / RoughPassiveRMS, (RoughPIDRMS - RoughPassiveRMS) / RoughPassiveRMS ]) * 100 #RoughResult = np.array([ # (RoughFuzzyRMS - RMS(Rough)) / RMS(Rough), # (RoughSkyhookRMS - RMS(Rough)) / RMS(Rough), # (RoughPIDRMS - RMS(Rough)) / RMS(Rough) # ]) * 100 # ============================================================================= # FFT ANALYSIS # ============================================================================= label = ['Fuzzy', 'Passive', 'Skyhook', 'PID'] colors = ['C1', 'C2', 'C3', 'C4'] i = 0 for acc in [StepAcc, StepAcc2, StepAcc3, StepPID[:, 3]]: fft = np.fft.fft(acc) freq = np.fft.fftfreq(len(acc), 0.01) plt.figure(13) plt.loglog(np.abs(freq), np.abs(fft), colors[i], label=label[i], linewidth=1) i += 1 plt.legend() plt.xlabel('Frequency [Hz]') plt.ylabel('Acceleration') plt.title('Step') i = 0 for acc in [ImpulseAcc, ImpulseAcc2, ImpulseAcc3, ImpulsePID[:, 3]]: fft = np.fft.fft(acc) freq = np.fft.fftfreq(len(acc), 0.01) plt.figure(14) plt.loglog(np.abs(freq), np.abs(fft), colors[i], label=label[i], linewidth=1) i += 1 plt.legend() plt.xlabel('Frequency [Hz]') plt.ylabel('Acceleration') plt.title('Impulse') i = 0 for acc in [BumpAcc, BumpAcc2, BumpAcc3]: fft = np.fft.fft(acc) freq = np.fft.fftfreq(len(acc), 0.01) plt.figure(15) plt.loglog(np.abs(freq), np.abs(fft), colors[i], label=label[i], linewidth=1) i += 1 plt.legend() plt.xlabel('Frequency [Hz]') plt.ylabel('Acceleration') plt.title('Bump') i = 0 for acc in [RoughAcc, RoughAcc2, RoughAcc3]: fft = np.fft.fft(acc) freq = np.fft.fftfreq(len(acc), 0.01) plt.figure(16) plt.loglog(np.abs(freq), np.abs(fft),colors[i], label=label[i], linewidth=1) i += 1 plt.legend() plt.xlabel('Frequency [Hz]') plt.ylabel('Acceleration') plt.title('Rough')
[ 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 629, 541, 88, 13, 18908, 4873, 1330, 267, 2934, 198, 11748, 376, 5639, 198, 11748, 12972, 1050, 521, 198, 6738, 299, 32152, 13, 75...
2.117177
10,770
# pylint: disable=W0223 # Pylint cannot handle abstract subclasses of abstract base classes from abc import ABC import xarray as xr from pywatts.modules.wrappers.base_wrapper import BaseWrapper
[ 2, 279, 2645, 600, 25, 15560, 28, 54, 15, 22047, 198, 2, 350, 2645, 600, 2314, 5412, 12531, 850, 37724, 286, 12531, 2779, 6097, 198, 198, 6738, 450, 66, 1330, 9738, 198, 198, 11748, 2124, 18747, 355, 2124, 81, 198, 198, 6738, 12972,...
3.338983
59
import os,sys Nthread = 1 os.environ["OMP_NUM_THREADS"] = str(Nthread) # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = str(Nthread) # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = str(Nthread) # export MKL_NUM_THREADS=1 os.environ["VECLIB_MAXIMUM_THREADS"] = str(Nthread) # export VECLIB_MAXIMUM_THREADS=1 os.environ["NUMEXPR_NUM_THREADS"] = str(Nthread) # export NUMEXPR_NUM_THREADS=1 ## generate spectrum, which requires several simulations...using mip4py # test system will initially be a fabry-perot slab, since the spectrum is analytically determinable
[ 11748, 28686, 11, 17597, 198, 45, 16663, 796, 352, 198, 418, 13, 268, 2268, 14692, 2662, 47, 62, 41359, 62, 4221, 15675, 50, 8973, 796, 965, 7, 45, 16663, 8, 1303, 10784, 440, 7378, 62, 41359, 62, 4221, 15675, 50, 28, 16, 198, 418...
2.622222
225
import cv2 import glob import random import numpy as np emotions = ["neutral", "anger", "disgust", "happy", "surprise"] fishface = cv2.face.FisherFaceRecognizer_create() #Initialize fisher face classifier data = {} #Now run it metascore = [] for i in range(0,10): correct = run_recognizer() print "got", correct, "percent correct!" metascore.append(correct) print "\n\nend score:", np.mean(metascore), "percent correct!"
[ 11748, 269, 85, 17, 198, 11748, 15095, 198, 11748, 4738, 198, 11748, 299, 32152, 355, 45941, 198, 198, 368, 36083, 796, 14631, 29797, 1600, 366, 2564, 1600, 366, 6381, 70, 436, 1600, 366, 34191, 1600, 366, 11793, 7919, 8973, 198, 11084,...
2.911565
147
# python3 main.py import urllib.request import zipfile import os import shutil # @TODO change it # eg.: /var/www/blog OLD_WP_PATH = '' NEW_WP_PATH_TMP = '' if not (os.path.exists(OLD_WP_PATH)) or not (os.path.exists(NEW_WP_PATH_TMP)): os._exit(0) WP_URL = 'http://wordpress.org/latest.zip' EXTRACTED_NAME = 'wordpress' NEW_WP_PATH = os.path.join(NEW_WP_PATH_TMP, EXTRACTED_NAME) # Download the file from url, save it in a temporary directory and get the # path to it (e.g. '/tmp/tmpb43hma') in the `wp_archve` variable: wp_archive, headers = urllib.request.urlretrieve(WP_URL) with zipfile.ZipFile(wp_archive, 'r') as zf: zf.extractall(NEW_WP_PATH_TMP) os.remove(wp_archive) # Remove new files shutil.rmtree(os.path.join(NEW_WP_PATH, 'wp-content')) os.remove(os.path.join(NEW_WP_PATH, 'readme.html')) # Copy content to the new WP shutil.copy2(os.path.join(OLD_WP_PATH, 'wp-config.php'), NEW_WP_PATH) shutil.copytree(os.path.join(OLD_WP_PATH, 'wp-content'), os.path.join(NEW_WP_PATH, 'wp-content')) shutil.rmtree(OLD_WP_PATH) shutil.copytree(NEW_WP_PATH, OLD_WP_PATH) shutil.rmtree(NEW_WP_PATH)
[ 2, 21015, 18, 1388, 13, 9078, 198, 198, 11748, 2956, 297, 571, 13, 25927, 198, 11748, 19974, 7753, 198, 11748, 28686, 198, 11748, 4423, 346, 198, 198, 2, 2488, 51, 3727, 46, 1487, 340, 198, 2, 29206, 11207, 1220, 7785, 14, 2503, 14,...
2.364606
469
import requests import time from multiprocessing.dummy import Pool start = time.time() for i in range(100): query('https://baidu.com') end = time.time() print(f'100{end - start}') start = time.time() url_list = [] for i in range(100): url_list.append('https://baidu.com') pool = Pool(5) pool.map(query, url_list) end = time.time() print(f'5100{end - start}')
[ 11748, 7007, 198, 11748, 640, 198, 6738, 18540, 305, 919, 278, 13, 67, 13513, 1330, 19850, 628, 198, 9688, 796, 640, 13, 2435, 3419, 198, 1640, 1312, 287, 2837, 7, 3064, 2599, 198, 220, 220, 220, 12405, 10786, 5450, 1378, 65, 1698, ...
2.576389
144
# Generated by Django 3.1.5 on 2021-01-28 11:59 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 20, 319, 33448, 12, 486, 12, 2078, 1367, 25, 3270, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
# # Copyright (c) 2015-2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import abc import six
[ 2, 198, 2, 15069, 357, 66, 8, 1853, 12, 5304, 3086, 5866, 11998, 11, 3457, 13, 198, 2, 198, 2, 30628, 55, 12, 34156, 12, 33234, 7483, 25, 24843, 12, 17, 13, 15, 198, 2, 198, 11748, 450, 66, 198, 11748, 2237, 628 ]
2.744186
43
# DP; Time: O(n); Space: O(1) # Time: O(n); Space: O(1) # Test cases: print(max_subarray([-2, 1, -3, 4, -1, 2, 1, -5, 4]) == 6) print(max_subarray([1]) == 1) print(max_subarray([5, 4, -1, 7, 8]) == 23)
[ 2, 27704, 26, 3862, 25, 440, 7, 77, 1776, 4687, 25, 440, 7, 16, 8, 628, 198, 2, 3862, 25, 440, 7, 77, 1776, 4687, 25, 440, 7, 16, 8, 628, 198, 2, 6208, 2663, 25, 198, 4798, 7, 9806, 62, 7266, 18747, 26933, 12, 17, 11, 352,...
1.961905
105
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the License along with this library. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. from functools import reduce from typing import Iterable, List, Tuple from . import _ed25519, messages from .tools import expect # XXX, these could be NewType's, but that would infect users of the cosi module with these types as well. # Unsure if we want that. Ed25519PrivateKey = bytes Ed25519PublicPoint = bytes Ed25519Signature = bytes def combine_keys(pks: Iterable[Ed25519PublicPoint]) -> Ed25519PublicPoint: """Combine a list of Ed25519 points into a "global" CoSi key.""" P = [_ed25519.decodepoint(pk) for pk in pks] combine = reduce(_ed25519.edwards_add, P) return Ed25519PublicPoint(_ed25519.encodepoint(combine)) def combine_sig( global_R: Ed25519PublicPoint, sigs: Iterable[Ed25519Signature] ) -> Ed25519Signature: """Combine a list of signatures into a single CoSi signature.""" S = [_ed25519.decodeint(si) for si in sigs] s = sum(S) % _ed25519.l sig = global_R + _ed25519.encodeint(s) return Ed25519Signature(sig) def get_nonce( sk: Ed25519PrivateKey, data: bytes, ctr: int = 0 ) -> Tuple[int, Ed25519PublicPoint]: """Calculate CoSi nonces for given data. These differ from Ed25519 deterministic nonces in that there is a counter appended at end. Returns both the private point `r` and the partial signature `R`. `r` is returned for performance reasons: :func:`sign_with_privkey` takes it as its `nonce` argument so that it doesn't repeat the `get_nonce` call. `R` should be combined with other partial signatures through :func:`combine_keys` to obtain a "global commitment". """ # r = hash(hash(sk)[b .. 2b] + M + ctr) # R = rB h = _ed25519.H(sk) bytesize = _ed25519.b // 8 assert len(h) == bytesize * 2 r = _ed25519.Hint(h[bytesize:] + data + ctr.to_bytes(4, "big")) R = _ed25519.scalarmult(_ed25519.B, r) return r, Ed25519PublicPoint(_ed25519.encodepoint(R)) def verify( signature: Ed25519Signature, digest: bytes, pub_key: Ed25519PublicPoint ) -> None: """Verify Ed25519 signature. Raise exception if the signature is invalid.""" # XXX this *might* change to bool function _ed25519.checkvalid(signature, digest, pub_key) def pubkey_from_privkey(privkey: Ed25519PrivateKey) -> Ed25519PublicPoint: """Interpret 32 bytes of data as an Ed25519 private key. Calculate and return the corresponding public key. """ return Ed25519PublicPoint(_ed25519.publickey_unsafe(privkey)) def sign_with_privkey( digest: bytes, privkey: Ed25519PrivateKey, global_pubkey: Ed25519PublicPoint, nonce: int, global_commit: Ed25519PublicPoint, ) -> Ed25519Signature: """Create a CoSi signature of `digest` with the supplied private key. This function needs to know the global public key and global commitment. """ h = _ed25519.H(privkey) a = _ed25519.decodecoord(h) S = (nonce + _ed25519.Hint(global_commit + global_pubkey + digest) * a) % _ed25519.l return Ed25519Signature(_ed25519.encodeint(S)) # ====== Client functions ====== #
[ 2, 770, 2393, 318, 636, 286, 262, 4700, 89, 273, 1628, 13, 198, 2, 198, 2, 15069, 357, 34, 8, 2321, 12, 7908, 40824, 43, 8937, 290, 20420, 198, 2, 198, 2, 770, 5888, 318, 1479, 3788, 25, 345, 460, 17678, 4163, 340, 290, 14, 27...
2.859231
1,300
#!/usr/bin/env python3 """ Create new FastQC zip directory with a new sample name for multiQC.""" import os import sys import logging import zipfile import tempfile import argparse __version__ = '1.0.0' if __name__ == '__main__': args = parse_arguments() return_code = args.function(**vars(args)) logging.shutdown() sys.exit(return_code)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 37811, 13610, 649, 12549, 48, 34, 19974, 8619, 351, 257, 649, 6291, 1438, 329, 5021, 48, 34, 526, 15931, 198, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 18931, 198, 117...
2.806202
129
from circuits.elements import ele_C as C from circuits.elements import ele_L as L from circuits.elements import ele_Warburg as WB from circuits.elements import ele_Q as Q """ """ """ Define all the circuits used in this project Python a == (; b == )ab Circuit(ECM) No. CDC Function 0 R(CR) RaCRb, Simplified Randles Cell 0 R0aC0R1b 1 R(QR) RaQRb 1 R(QR) R0aQ0R1b 2 R(QR)(QR) RaQRbaQRb 2 R(QR)(QR) R0aQ0R1baQ1R2b 3 R(QR(LR)) RaQRaLRbb 3 R(QR(LR)) R0aQ0R1aL0R2bb 4 R(Q(RW)) RaQaRWbb 4 R(Q(RW)) R0aQ0aR1W0bb 5 R(QR)(QR)W RaQRbaQRbW 5 R(QR)(QR)W R0aQ0R1baQ1R2bW0 6 R(QR)(Q(RW)) RaQRbaQaRWbb 6 R(QR)(Q(RW)) R0aQ0R1baQ1aR2W0bb 7 R(QR)W RaQRbW 7 R(QR)W R0aQ0R1bW0 8 R(Q(RW))Q RaQaRWbbQ 8 R(Q(RW))Q R0aQ0aR1W0bbQ1 9 R(Q(R(QR))) RaQaRaQRbbb 9 R(Q(R(QR))) R0aQ0aR1aQ1R2bbb Q_pair = (q, n) or [q, n] q: CPE coefficient, Constant phase element [s^n/ohm] n: Constant phase elelment exponent [-] WB_sigma: warburg coefficient """ # ECM-0 R(CR) # ECM-0 R0(C0R1) # ECM-1 R(QR), already include ECM-0, when n = 1 # ECM-2 R(QR)(QR) # ECM-3 R(QR(LR)) # ECM-4 R(Q(RW)) # ECM-5 R(QR)(QR)W # ECM-6 R(QR)(Q(RW)) # ECM-7 R(QR)W # ECM-8 R(Q(RW))Q # ECM-9 R(Q(R(QR))) # ------------------ ECMs are not numbered ------------------ # DPFC: ECM-10 R0(C0R1)(C1(R2W0)) # DPFC: ECM-11 R0(C0R1(R2W0))(Q0R3) # ------------------ ECMs are not numbered ------------------ #NEW RULE: ecm_2(two element)_001(Sequence) #ecm_2_001 R0R1 #ecm_2_002 (R0R1) #ecm_2_003 R0L0 #ecm_2_004 (R0L0) #ecm_2_005 R0C0 #ecm_2_006 (R0C0) #ecm_3_001 R0R1R2 #ecm_3_002 R0(R1R2) #ecm_3_003 (R0R1R2) #ecm_3_004 R0R1L0 #ecm_3_005 R0(R1L0) #ecm_3_006 (R0R1)L0 #ecm_3_007 (R0R1L0) #ecm_3_008 R0L0L1 #ecm_3_009 R0(L0L1) #ecm_3_010 (R0L0L1) #ecm_3_011 (R0L0)L1 #ecm_3_012 R0R1C0 #ecm_3_013 (R0R1)C0 #ecm_3_014 R0(R1C0) #ecm_3_015 (R0R1C0) #ecm_3_016 R0C0C1 #ecm_3_017 (R0C0)C1 #ecm_3_018 R0(C0C1) #ecm_3_019 (R0C0C1) #ecm_3_020 R0R1Q0 #ecm_3_021 (R0R1)Q0 #ecm_3_022 R0(R1Q0) #ecm_3_023 (R0R1Q0) #ecm_3_024 RQ0Q1 #ecm_3_025 (R0Q0)Q1 #ecm_3_026 R(Q0Q1) #ecm_3_027 CCQ #ecm_3_028 C(CQ) #ecm_3_029 (CCQ) #ecm_3_030 (CC)Q #ecm_3_031 CQQ #ecm_3_032 C(QQ) #ecm_3_033 Q(CQ) #ecm_3_034 (CQQ) # ------------------ ECMs are not numbered ------------------
[ 6738, 24907, 13, 68, 3639, 1330, 9766, 62, 34, 355, 327, 198, 6738, 24907, 13, 68, 3639, 1330, 9766, 62, 43, 355, 406, 198, 6738, 24907, 13, 68, 3639, 1330, 9766, 62, 13195, 7423, 355, 36245, 198, 6738, 24907, 13, 68, 3639, 1330, ...
1.411019
2,051
# Copyright 2013-2015 ARM Limited # # 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 devlib.utils.misc import TimeoutError # NOQA pylint: disable=W0611
[ 2, 220, 220, 220, 15069, 2211, 12, 4626, 20359, 15302, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, ...
3.61413
184
# LAPACK optimization strategy for LU factorization. from chill import * source('lu.c') procedure('lu') loop(0) TJ = 64 original() tile(1, 3, TJ, 1) split(1, 2, 'L1-L2>=2') #t2-t4>=2 permute(3, 2, [2,4,3]) # mini-LU permute(1, 2, [3,4,2]) # other than mini-LU split(1, 2, 'L2>=L1-1') # seperate MM by t4 >= t2-1 # now optimize for TRSM TK1 = 256 TI1 = 256 TJ1 = 8 UI1 = 1 UJ1 = 1 tile(4, 2, TI1, 2) split(4, 3, 'L5<=L2-1') #split t10 <= t4-1 tile(4, 5, TK1, 3) tile(4, 5, TJ1, 4) datacopy([[4,1]], 4, false, 1) datacopy([[4,2]], 5) unroll(4, 5, UI1) unroll(4, 6, UJ1) datacopy([[5,1]], 3, false, 1) # now optimize for MM TK2 = 256 TI2 = 256 TJ2 = 8 UI2 = 1 UJ2 = 1 tile(1, 4, TK2, 2) tile(1, 3, TI2, 3) tile(1, 5, TJ2, 4) datacopy([[1,1]], 4, false, 1) datacopy([[1,2]], 5) unroll(1, 5, UI2) unroll(1, 6, UJ2) print_code()
[ 2, 406, 2969, 8120, 23989, 4811, 329, 50168, 5766, 1634, 13, 198, 198, 6738, 20493, 1330, 1635, 198, 198, 10459, 10786, 2290, 13, 66, 11537, 198, 1676, 771, 495, 10786, 2290, 11537, 198, 26268, 7, 15, 8, 198, 198, 51, 41, 796, 5598,...
1.805139
467
#!/usr/bin/env python # Copyright 2014 The University of Edinburgh # # 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 sys import os import curses import collections import argparse import datetime import logging logging.basicConfig() logger = logging.getLogger('DJREG_CLIENT') logger.setLevel(logging.INFO) from vercereg_lib import VerceRegManager if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 2, 15069, 1946, 383, 2059, 286, 23475, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 23...
3.52549
255
import json import pandas as pd import numpy as np from urllib.request import Request, urlopen from onemap_converter import OneMapConverter
[ 11748, 33918, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 2956, 297, 571, 13, 25927, 1330, 19390, 11, 19016, 9654, 198, 6738, 319, 368, 499, 62, 1102, 332, 353, 1330, 1881, 13912, 3103, 332, 35...
3.255814
43
"""SSEClient unit tests.""" import time import threading import pytest from splitio.push.sse import SSEClient, SSEEvent from tests.helpers.mockserver import SSEMockServer
[ 37811, 50, 5188, 11792, 4326, 5254, 526, 15931, 198, 198, 11748, 640, 198, 11748, 4704, 278, 198, 11748, 12972, 9288, 198, 6738, 6626, 952, 13, 14689, 13, 82, 325, 1330, 311, 5188, 11792, 11, 311, 5188, 9237, 198, 6738, 5254, 13, 1679...
3.264151
53
import os from mongo_config import questions_collection, client questions_collection.delete_many({}) # clears all questions in MongoDB question_objects = [] lines = [line[:-1] for line in open(get_relative_path('trivia.txt'), 'r').readlines()] + [''] for idx in range(0, len(lines), 6): question = lines[idx] correct_answer = lines[idx + 1] wrong_answers = lines[idx + 2 : idx + 5] choices = [correct_answer] + wrong_answers # not shuffled yet question_object = {'question': question, 'correct_answer': correct_answer, 'choices': choices} question_objects.append(question_object) questions_collection.insert_many(question_objects) # puts all questions from txt file into MongoDB client.close() print('Questions updated!')
[ 11748, 28686, 198, 6738, 285, 25162, 62, 11250, 1330, 2683, 62, 43681, 11, 5456, 198, 198, 6138, 507, 62, 43681, 13, 33678, 62, 21834, 15090, 30072, 220, 1303, 37526, 477, 2683, 287, 42591, 11012, 198, 198, 25652, 62, 48205, 796, 17635,...
3.048583
247
import numpy as np import random from plyfile import PlyData, PlyElement import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pyntcloud import PyntCloud import os import sys import re
[ 11748, 299, 32152, 355, 45941, 198, 11748, 4738, 198, 6738, 35960, 7753, 1330, 36526, 6601, 11, 36526, 20180, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 285, 489, 62, 25981, 74, 896, 13, 76, 29487, 18, 67...
3.166667
66
"""Encoder-decoder model.""" from typing import List, Tuple, Union import torch import torch.nn as nn from encoder import Encoder, VanillaEncoder from decoder import Decoder, VanillaDecoder T = torch.Tensor
[ 37811, 27195, 12342, 12, 12501, 12342, 2746, 526, 15931, 198, 198, 6738, 19720, 1330, 7343, 11, 309, 29291, 11, 4479, 198, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 198, 6738, 2207, 12342, 1330, 14711, 12342, 1...
3.34375
64
#!/usr/bin/env python # # Copyright 2019 Rickard Armiento # # This file is part of a Python candidate reference implementation of # the optimade API [https://www.optimade.org/] # # 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. import pymongo import threading
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 15069, 13130, 8759, 446, 7057, 1153, 78, 198, 2, 198, 2, 770, 2393, 318, 636, 286, 257, 11361, 4540, 4941, 7822, 286, 198, 2, 262, 6436, 671, 7824, 685, 5450, 1378, 2503...
3.747059
340
import functools import json as json_pkg # avoid conflict name with json argument employed for some function import os from distutils.version import LooseVersion from typing import TYPE_CHECKING from urllib.parse import urlparse import mock import requests import requests.exceptions from pyramid.httpexceptions import HTTPException from pyramid.testing import DummyRequest from pyramid.testing import setUp as PyramidSetUp from webtest.app import AppError, TestApp # noqa from webtest.response import TestResponse from cowbird.app import get_app from cowbird.constants import COWBIRD_ROOT, get_constant from cowbird.services.service import Service from cowbird.utils import ( CONTENT_TYPE_JSON, USE_TEST_CELERY_APP_CFG, SingletonMeta, get_header, get_settings_from_config_ini, is_null, null ) # employ example INI config for tests where needed to ensure that configurations are valid TEST_INI_FILE = os.path.join(COWBIRD_ROOT, "config/cowbird.example.ini") TEST_CFG_FILE = os.path.join(COWBIRD_ROOT, "config/config.example.yml") if TYPE_CHECKING: # pylint: disable=W0611,unused-import from typing import Any, Callable, Collection, Dict, Iterable, List, Optional, Type, Union from pyramid.request import Request from cowbird.typedefs import ( JSON, AnyCookiesType, AnyHeadersType, AnyResponseType, CookiesType, HeadersType, SettingsType ) from cowbird.utils import NullType # pylint: disable=C0103,invalid-name TestAppOrUrlType = Union[str, TestApp] AnyTestItemType = Union[TestAppOrUrlType, TestAppContainer] def clear_services_instances(): # Remove the service instances initialized with test specific config SingletonMeta._instances.clear() # pylint: disable=W0212 def config_setup_from_ini(config_ini_file_path): settings = get_settings_from_config_ini(config_ini_file_path) config = PyramidSetUp(settings=settings) return config def get_test_app(settings=None): # type: (Optional[SettingsType]) -> TestApp """ Instantiate a local test application. """ config = config_setup_from_ini(TEST_INI_FILE) config.registry.settings["cowbird.url"] = "http://localhost:80" config.registry.settings["cowbird.ini_file_path"] = TEST_INI_FILE config.registry.settings["cowbird.config_path"] = TEST_CFG_FILE config.registry.settings["mongo_uri"] = "mongodb://{host}:{port}/{db_name}".format( host=os.getenv("COWBIRD_TEST_DB_HOST", "127.0.0.1"), port=os.getenv("COWBIRD_TEST_DB_PORT", "27017"), db_name=os.getenv("COWBIRD_TEST_DB_NAME", "cowbird-test") ) # For test, we want to use the real Celery app which is properly mocked # By setting the internal setting USE_TEST_CELERY_APP_CFG to true, the pyramid celery app will not be used config.registry.settings[USE_TEST_CELERY_APP_CFG] = True if settings: config.registry.settings.update(settings) test_app = TestApp(get_app({}, **config.registry.settings)) return test_app def get_app_or_url(test_item): # type: (AnyTestItemType) -> TestAppOrUrlType """ Obtains the referenced test application, local application or remote URL from `Test Case` implementation. """ if isinstance(test_item, (TestApp, str)): return test_item test_app = getattr(test_item, "test_app", None) if test_app and isinstance(test_app, TestApp): return test_app app_or_url = getattr(test_item, "app", None) or getattr(test_item, "url", None) if not app_or_url: raise ValueError("Invalid test class, application or URL could not be found.") return app_or_url def get_hostname(test_item): # type: (AnyTestItemType) -> str """ Obtains stored hostname in the class implementation. """ app_or_url = get_app_or_url(test_item) if isinstance(app_or_url, TestApp): app_or_url = get_constant("COWBIRD_URL", app_or_url.app.registry) return urlparse(app_or_url).hostname def get_headers(app_or_url, header_dict): # type: (TestAppOrUrlType, AnyHeadersType) -> HeadersType """ Obtains stored headers in the class implementation. """ if isinstance(app_or_url, TestApp): return dict(header_dict.items()) # noqa return header_dict def get_response_content_types_list(response): # type: (AnyResponseType) -> List[str] """ Obtains the specified response Content-Type header(s) without additional formatting parameters. """ content_types = [] known_types = ["application", "audio", "font", "example", "image", "message", "model", "multipart", "text", "video"] for part in response.headers["Content-Type"].split(";"): for sub_type in part.strip().split(","): if "=" not in sub_type and sub_type.split("/")[0] in known_types: content_types.append(sub_type) return content_types def get_json_body(response): # type: (AnyResponseType) -> JSON """ Obtains the JSON payload of the response regardless of its class implementation. """ if isinstance(response, TestResponse): return response.json return response.json() def json_msg(json_body, msg=null): # type: (JSON, Optional[str]) -> str """ Generates a message string with formatted JSON body for display with easier readability. """ json_str = json_pkg.dumps(json_body, indent=4, ensure_ascii=False) if msg is not null: return "{}\n{}".format(msg, json_str) return json_str def mock_get_settings(test): """ Decorator to mock :func:`cowbird.utils.get_settings` to allow retrieval of settings from :class:`DummyRequest`. .. warning:: Only apply on test methods (not on class TestCase) to ensure that :mod:`pytest` can collect them correctly. """ from cowbird.utils import get_settings as real_get_settings return wrapped def mock_request(request_path_query="", # type: str method="GET", # type: str params=None, # type: Optional[Dict[str, str]] body="", # type: Union[str, JSON] content_type=None, # type: Optional[str] headers=None, # type: Optional[AnyHeadersType] cookies=None, # type: Optional[AnyCookiesType] settings=None, # type: SettingsType ): # type: (...) -> Request """ Generates a fake request with provided arguments. Can be employed by functions that expect a request object as input to retrieve details such as body content, the request path, or internal settings, but that no actual request needs to be accomplished. """ parts = request_path_query.split("?") path = parts[0] query = dict() if len(parts) > 1 and parts[1]: for part in parts[1].split("&"): kv = part.split("=") # handle trailing keyword query arguments without values if kv[0]: # handle invalid keyword missing query[kv[0]] = kv[1] if len(kv) > 1 else None elif params: query = params request = DummyRequest(path=path, params=query) request.path_qs = request_path_query request.method = method request.content_type = content_type request.headers = headers or {} request.cookies = cookies or {} request.matched_route = None # cornice method if content_type: request.headers["Content-Type"] = content_type request.body = body try: if body: # set missing DummyRequest.json attribute request.json = json_pkg.loads(body) # type: ignore except (TypeError, ValueError): pass request.registry.settings = settings or {} return request # noqa # fake type of what is normally expected just to avoid many 'noqa' def test_request(test_item, # type: AnyTestItemType method, # type: str path, # type: str data=None, # type: Optional[Union[JSON, str]] json=None, # type: Optional[Union[JSON, str]] body=None, # type: Optional[Union[JSON, str]] params=None, # type: Optional[Dict[str, str]] timeout=10, # type: int retries=3, # type: int allow_redirects=True, # type: bool content_type=None, # type: Optional[str] headers=None, # type: Optional[HeadersType] cookies=None, # type: Optional[CookiesType] **kwargs # type: Any ): # type: (...) -> AnyResponseType """ Calls the request using either a :class:`webtest.TestApp` instance or :class:`requests.Request` from a string URL. Keyword arguments :paramref:`json`, :paramref:`data` and :paramref:`body` are all looked for to obtain the data. Header ``Content-Type`` is set with respect to explicit :paramref:`json` or via provided :paramref:`headers` when available. Explicit :paramref:`content_type` can also be provided to override all of these. Request cookies are set according to :paramref:`cookies`, or can be interpreted from ``Set-Cookie`` header. .. warning:: When using :class:`TestApp`, some internal cookies can be stored from previous requests to retain the active user. Make sure to provide new set of cookies (or logout user explicitly) if different session must be used, otherwise they will be picked up automatically. For 'empty' cookies, provide an empty dictionary. :param test_item: one of `BaseTestCase`, `webtest.TestApp` or remote server URL to call with `requests` :param method: request method (GET, POST, PATCH, PUT, DELETE) :param path: test path starting at base path that will be appended to the application's endpoint. :param params: query parameters added to the request path. :param json: explicit JSON body content to use as request body. :param data: body content string to use as request body, can be JSON if matching ``Content-Type`` is identified. :param body: alias to :paramref:`data`. :param content_type: Enforce specific content-type of provided data body. Otherwise, attempt to retrieve it from request headers. Inferred JSON content-type when :paramref:`json` is employed, unless overridden explicitly. :param headers: Set of headers to send the request. Header ``Content-Type`` is looked for if not overridden. :param cookies: Cookies to provide to the request. :param timeout: passed down to :mod:`requests` when using URL, otherwise ignored (unsupported). :param retries: number of retry attempts in case the requested failed due to timeout (only when using URL). :param allow_redirects: Passed down to :mod:`requests` when using URL, handled manually for same behaviour when using :class:`TestApp`. :param kwargs: any additional keywords that will be forwarded to the request call. :return: response of the request """ method = method.upper() status = kwargs.pop("status", None) # obtain json body from any json/data/body kw and empty {} if not specified # reapply with the expected webtest/requests method kw afterward _body = json or data or body or {} app_or_url = get_app_or_url(test_item) if isinstance(app_or_url, TestApp): # set 'cookies' handled by the 'TestApp' instance if not present or different if cookies is not None: cookies = dict(cookies) # convert tuple-list as needed if not app_or_url.cookies or app_or_url.cookies != cookies: app_or_url.cookies.update(cookies) # obtain Content-Type header if specified to ensure it is properly applied kwargs["content_type"] = content_type if content_type else get_header("Content-Type", headers) # update path with query parameters since TestApp does not have an explicit argument when not using GET if params: path += "?" + "&".join("{!s}={!s}".format(k, v) for k, v in params.items() if v is not None) kwargs.update({ "params": _body, # TestApp uses 'params' for the body during POST (these are not the query parameters) "headers": dict(headers or {}), # adjust if none provided or specified as tuple list }) # convert JSON body as required if _body is not None and (json is not None or kwargs["content_type"] == CONTENT_TYPE_JSON): kwargs["params"] = json_pkg.dumps(_body, cls=json_pkg.JSONEncoder) kwargs["content_type"] = CONTENT_TYPE_JSON # enforce if only 'json' keyword provided kwargs["headers"]["Content-Length"] = str(len(kwargs["params"])) # need to fix with override JSON payload if status and status >= 300: kwargs["expect_errors"] = True err_code = None err_msg = None try: resp = app_or_url._gen_request(method, path, **kwargs) # pylint: disable=W0212 # noqa: W0212 except AppError as exc: err_code = exc err_msg = str(exc) except HTTPException as exc: err_code = exc.status_code err_msg = str(exc) + str(getattr(exc, "exception", "")) except Exception as exc: err_code = 500 err_msg = "Unknown: {!s}".format(exc) finally: if err_code: info = json_msg({"path": path, "method": method, "body": _body, "headers": kwargs["headers"]}) result = "Request raised unexpected error: {!s}\nError: {}\nRequest:\n{}" raise AssertionError(result.format(err_code, err_msg, info)) # automatically follow the redirect if any and evaluate its response max_redirect = kwargs.get("max_redirects", 5) while 300 <= resp.status_code < 400 and max_redirect > 0: # noqa resp = resp.follow() max_redirect -= 1 assert max_redirect >= 0, "Maximum follow redirects reached." # test status accordingly if specified assert resp.status_code == status or status is None, "Response not matching the expected status code." return resp kwargs.pop("expect_errors", None) # remove keyword specific to TestApp content_type = get_header("Content-Type", headers) if json or content_type == CONTENT_TYPE_JSON: kwargs["json"] = _body elif data or body: kwargs["data"] = _body url = "{url}{path}".format(url=app_or_url, path=path) while True: try: return requests.request(method, url, params=params, headers=headers, cookies=cookies, timeout=timeout, allow_redirects=allow_redirects, **kwargs) except requests.exceptions.ReadTimeout: if retries <= 0: raise retries -= 1 def check_all_equal(iter_val, iter_ref, msg=None, any_order=False): # type: (Collection[Any], Union[Collection[Any], NullType], Optional[str], bool) -> None """ :param iter_val: tested values. :param iter_ref: reference values. :param msg: override message to display if failing test. :param any_order: allow equal values to be provided in any order, otherwise order must match as well as values. :raises AssertionError: If all values in :paramref:`iter_val` are not equal to values within :paramref:`iter_ref`. If :paramref:`any_order` is ``False``, also raises if equal items are not in the same order. """ r_val = repr(iter_val) r_ref = repr(iter_ref) assert all_equal(iter_val, iter_ref, any_order), format_test_val_ref(r_val, r_ref, pre="All Equal Fail", msg=msg) def check_val_equal(val, ref, msg=None): # type: (Any, Union[Any, NullType], Optional[str]) -> None """:raises AssertionError: if :paramref:`val` is not equal to :paramref:`ref`.""" assert is_null(ref) or val == ref, format_test_val_ref(val, ref, pre="Equal Fail", msg=msg) def check_val_not_equal(val, ref, msg=None): # type: (Any, Union[Any, NullType], Optional[str]) -> None """:raises AssertionError: if :paramref:`val` is equal to :paramref:`ref`.""" assert is_null(ref) or val != ref, format_test_val_ref(val, ref, pre="Not Equal Fail", msg=msg) def check_val_is_in(val, ref, msg=None): # type: (Any, Union[Any, NullType], Optional[str]) -> None """:raises AssertionError: if :paramref:`val` is not in to :paramref:`ref`.""" assert is_null(ref) or val in ref, format_test_val_ref(val, ref, pre="Is In Fail", msg=msg) def check_val_not_in(val, ref, msg=None): # type: (Any, Union[Any, NullType], Optional[str]) -> None """:raises AssertionError: if :paramref:`val` is in to :paramref:`ref`.""" assert is_null(ref) or val not in ref, format_test_val_ref(val, ref, pre="Not In Fail", msg=msg) def check_val_type(val, ref, msg=None): # type: (Any, Union[Type[Any], NullType, Iterable[Type[Any]]], Optional[str]) -> None """:raises AssertionError: if :paramref:`val` is not an instanced of :paramref:`ref`.""" assert isinstance(val, ref), format_test_val_ref(val, repr(ref), pre="Type Fail", msg=msg) def check_raises(func, exception_type, msg=None): # type: (Callable[[], Any], Type[Exception], Optional[str]) -> Exception """ Calls the callable and verifies that the specific exception was raised. :raise AssertionError: on failing exception check or missing raised exception. :returns: raised exception of expected type if it was raised. """ msg = ": {}".format(msg) if msg else "." try: func() except Exception as exc: # pylint: disable=W0703 msg = "Wrong exception [{!s}] raised instead of [{!s}]{}" \ .format(type(exc).__name__, exception_type.__name__, msg) assert isinstance(exc, exception_type), msg return exc raise AssertionError("Exception [{!s}] was not raised{}".format(exception_type.__name__, msg)) def check_no_raise(func, msg=None): # type: (Callable[[], Any], Optional[str]) -> Any """ Calls the callable and verifies that no exception was raised. :raise AssertionError: on any raised exception. """ try: return func() except Exception as exc: # pylint: disable=W0703 msg = ": {}".format(msg) if msg else "." raise AssertionError("Exception [{!r}] was raised when none is expected{}".format(type(exc).__name__, msg)) def check_response_basic_info(response, # type: AnyResponseType expected_code=200, # type: int expected_type=CONTENT_TYPE_JSON, # type: str expected_method="GET", # type: str extra_message=None, # type: Optional[str] ): # type: (...) -> Union[JSON, str] """ Validates basic `Cowbird` API response metadata. For UI pages, employ :func:`check_ui_response_basic_info` instead. If the expected content-type is JSON, further validations are accomplished with specific metadata fields that are always expected in the response body. Otherwise, minimal validation of basic fields that can be validated regardless of content-type is done. :param response: response to validate. :param expected_code: status code to validate from the response. :param expected_type: Content-Type to validate from the response. :param expected_method: method 'GET', 'POST', etc. to validate from the response if an error. :param extra_message: additional message to append to every specific test message if provided. :return: json body of the response for convenience. """ check_val_is_in("Content-Type", dict(response.headers), msg=_("Response doesn't define 'Content-Type' header.")) content_types = get_response_content_types_list(response) check_val_is_in(expected_type, content_types, msg=_("Response doesn't match expected HTTP Content-Type header.")) code_message = "Response doesn't match expected HTTP status code." if expected_type == CONTENT_TYPE_JSON: # provide more details about mismatching code since to help debug cause of error code_message += "\nReason:\n{}".format(json_msg(get_json_body(response))) check_val_equal(response.status_code, expected_code, msg=_(code_message)) if expected_type == CONTENT_TYPE_JSON: body = get_json_body(response) check_val_is_in("code", body, msg=_("Parameter 'code' should be in response JSON body.")) check_val_is_in("type", body, msg=_("Parameter 'type' should be in response JSON body.")) check_val_is_in("detail", body, msg=_("Parameter 'detail' should be in response JSON body.")) check_val_equal(body["code"], expected_code, msg=_("Parameter 'code' should match HTTP status code.")) check_val_equal(body["type"], expected_type, msg=_("Parameter 'type' should match HTTP Content-Type header.")) check_val_not_equal(body["detail"], "", msg=_("Parameter 'detail' should not be empty.")) else: body = response.text if response.status_code >= 400: # error details available for any content-type, just in different format check_val_is_in("url", body, msg=_("Request URL missing from contents,")) check_val_is_in("path", body, msg=_("Request path missing from contents.")) check_val_is_in("method", body, msg=_("Request method missing from contents.")) if expected_type == CONTENT_TYPE_JSON: # explicitly check by dict-key if JSON check_val_equal(body["method"], expected_method, msg=_("Request method not matching expected value.")) return body def check_error_param_structure(body, # type: JSON param_value=null, # type: Optional[Any] param_name=null, # type: Optional[str] param_compare=null, # type: Optional[Any] is_param_value_literal_unicode=False, # type: bool param_name_exists=False, # type: bool param_compare_exists=False, # type: bool ): # type: (...) -> None """ Validates error response ``param`` information based on different Cowbird version formats. :param body: JSON body of the response to validate. :param param_value: Expected 'value' of param the parameter. Contained field value not verified if ``null``, only presence of the field. :param param_name: Expected 'name' of param. Ignored for older Cowbird version that did not provide this information. Contained field value not verified if ``null`` and ``param_name_exists`` is ``True`` (only its presence). If provided, automatically implies ``param_name_exists=True``. Skipped otherwise. :param param_compare: Expected 'compare'/'param_compare' value (filed name according to version) Contained field value not verified if ``null`` and ``param_compare_exists`` is ``True`` (only its presence). If provided, automatically implies ``param_compare_exists=True``. Skipped otherwise. :param is_param_value_literal_unicode: param value is represented as `u'{paramValue}'` for older Cowbird version. :param param_name_exists: verify that 'name' is in the body, not validating its value. :param param_compare_exists: verify that 'compare'/'param_compare' is in the body, not validating its value. :raises AssertionError: on any failing condition """ check_val_type(body, dict) check_val_is_in("param", body) check_val_type(body["param"], dict) check_val_is_in("value", body["param"]) if param_name_exists or param_name is not null: check_val_is_in("name", body["param"]) if param_name is not null: check_val_equal(body["param"]["name"], param_name) if param_value is not null: check_val_equal(body["param"]["value"], param_value) if param_compare_exists or param_compare is not null: check_val_is_in("compare", body["param"]) if param_compare is not null: check_val_equal(body["param"]["compare"], param_compare)
[ 11748, 1257, 310, 10141, 198, 11748, 33918, 355, 33918, 62, 35339, 220, 1303, 3368, 5358, 1438, 351, 33918, 4578, 9322, 329, 617, 2163, 198, 11748, 28686, 198, 6738, 1233, 26791, 13, 9641, 1330, 6706, 577, 14815, 198, 6738, 19720, 1330, ...
2.553864
9,719
from django.utils import timezone from django_extensions.management.jobs import BaseJob from ..models import Player, Guild
[ 6738, 42625, 14208, 13, 26791, 1330, 640, 11340, 198, 6738, 42625, 14208, 62, 2302, 5736, 13, 27604, 13, 43863, 1330, 7308, 33308, 198, 198, 6738, 11485, 27530, 1330, 7853, 11, 16446, 628, 198 ]
3.818182
33
import logging import secrets import string from typing import Awaitable, Callable, List from saleor_app.conf import get_settings from saleor_app.errors import InstallAppError from saleor_app.graphql import GraphQLError, get_executor, get_saleor_api_url from saleor_app.mutations import CREATE_WEBHOOK from saleor_app.schemas.core import AppToken, DomainName, Url, WebhookData logger = logging.getLogger(__name__)
[ 11748, 18931, 198, 11748, 13141, 198, 11748, 4731, 198, 6738, 19720, 1330, 5851, 4548, 540, 11, 4889, 540, 11, 7343, 198, 198, 6738, 5466, 273, 62, 1324, 13, 10414, 1330, 651, 62, 33692, 198, 6738, 5466, 273, 62, 1324, 13, 48277, 1330...
3.159091
132
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from . import outputs from ._inputs import * __all__ = ['OpenZfsFileSystemArgs', 'OpenZfsFileSystem'] class OpenZfsFileSystem(pulumi.CustomResource): def __init__(__self__, resource_name: str, *args, **kwargs): resource_args, opts = _utilities.get_resource_args_opts(OpenZfsFileSystemArgs, pulumi.ResourceOptions, *args, **kwargs) if resource_args is not None: __self__._internal_init(resource_name, opts, **resource_args.__dict__) else: __self__._internal_init(resource_name, *args, **kwargs) def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, automatic_backup_retention_days: Optional[pulumi.Input[int]] = None, backup_id: Optional[pulumi.Input[str]] = None, copy_tags_to_backups: Optional[pulumi.Input[bool]] = None, copy_tags_to_volumes: Optional[pulumi.Input[bool]] = None, daily_automatic_backup_start_time: Optional[pulumi.Input[str]] = None, deployment_type: Optional[pulumi.Input[str]] = None, disk_iops_configuration: Optional[pulumi.Input[pulumi.InputType['OpenZfsFileSystemDiskIopsConfigurationArgs']]] = None, kms_key_id: Optional[pulumi.Input[str]] = None, root_volume_configuration: Optional[pulumi.Input[pulumi.InputType['OpenZfsFileSystemRootVolumeConfigurationArgs']]] = None, security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, storage_capacity: Optional[pulumi.Input[int]] = None, storage_type: Optional[pulumi.Input[str]] = None, subnet_ids: Optional[pulumi.Input[str]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, tags_all: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, throughput_capacity: Optional[pulumi.Input[int]] = None, weekly_maintenance_start_time: Optional[pulumi.Input[str]] = None, __props__=None): if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = _utilities.get_version() if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = OpenZfsFileSystemArgs.__new__(OpenZfsFileSystemArgs) __props__.__dict__["automatic_backup_retention_days"] = automatic_backup_retention_days __props__.__dict__["backup_id"] = backup_id __props__.__dict__["copy_tags_to_backups"] = copy_tags_to_backups __props__.__dict__["copy_tags_to_volumes"] = copy_tags_to_volumes __props__.__dict__["daily_automatic_backup_start_time"] = daily_automatic_backup_start_time if deployment_type is None and not opts.urn: raise TypeError("Missing required property 'deployment_type'") __props__.__dict__["deployment_type"] = deployment_type __props__.__dict__["disk_iops_configuration"] = disk_iops_configuration __props__.__dict__["kms_key_id"] = kms_key_id __props__.__dict__["root_volume_configuration"] = root_volume_configuration __props__.__dict__["security_group_ids"] = security_group_ids __props__.__dict__["storage_capacity"] = storage_capacity __props__.__dict__["storage_type"] = storage_type if subnet_ids is None and not opts.urn: raise TypeError("Missing required property 'subnet_ids'") __props__.__dict__["subnet_ids"] = subnet_ids __props__.__dict__["tags"] = tags __props__.__dict__["tags_all"] = tags_all if throughput_capacity is None and not opts.urn: raise TypeError("Missing required property 'throughput_capacity'") __props__.__dict__["throughput_capacity"] = throughput_capacity __props__.__dict__["weekly_maintenance_start_time"] = weekly_maintenance_start_time __props__.__dict__["arn"] = None __props__.__dict__["dns_name"] = None __props__.__dict__["network_interface_ids"] = None __props__.__dict__["owner_id"] = None __props__.__dict__["root_volume_id"] = None __props__.__dict__["vpc_id"] = None super(OpenZfsFileSystem, __self__).__init__( 'aws:fsx/openZfsFileSystem:OpenZfsFileSystem', resource_name, __props__, opts)
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 17202, 39410, 25, 428, 2393, 373, 7560, 416, 262, 21624, 12994, 24118, 687, 10290, 357, 27110, 5235, 8, 16984, 13, 17202, 198, 2, 17202, 2141, 407, 4370, 416, 1021, 4556, 345, 821, 1728, 345, 760...
2.237993
2,332
#!/usr/bin/env python3 import random import time from scapy.all import IP, TCP, send from threading import Thread # Import modules for SYN flood import tools.randomData as randomData
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 4738, 198, 11748, 640, 198, 6738, 629, 12826, 13, 439, 1330, 6101, 11, 23633, 11, 3758, 198, 6738, 4704, 278, 1330, 14122, 198, 2, 17267, 13103, 329, 19704, 45, 6947, ...
3.538462
52
import time import datetime as dt from pathlib import Path from tkinter import messagebox import re import niq_misc import math import traceback from niq_misc import replace_entry def check_valid_vertex_file(gui): """ Checks user-provided vertex selection file (HTML) for issues that could cause errors with downstream processes. Returns: True if file passes all tests, else displays error message and returns False """ niq_misc.remove_curly(gui.vertex_file_E) vertex_path = Path(gui.vertex_file_E.get()) # Check if path is empty if vertex_path.name == "": messagebox.showerror("Vertex File Error", "Please provide a vertex file.") return False # Check if path has invalid path if vertex_path.suffix not in (".html", ""): messagebox.showerror("Vertex Selection Error", r'Vertex selection file must have ".html" extension.') return False # Check if path exists if not vertex_path.exists(): messagebox.showerror("Vertex Selection Error", "Provided vertex selection file not found.") return False with open(vertex_path, "r") as original_file: original_lines = original_file.readlines() # Remove extra table data lines if present cleaned_content = str() found = False for line in original_lines: if "<div class" in line: found = True if found: cleaned_content += line # Get datapoints tokens = re.finditer(r">([\d\.-]+)</span>", cleaned_content) token_num = 0 try: # Every other value in tokens will be temperature and so is ignored for counter, match in enumerate(tokens): token_num = counter if not (counter % 2) == 0: round(float(match.group(1))) except: messagebox.showerror(("Vertex File Error"), "Vertex file is unreadable. Please try another.") return False if token_num < 2: messagebox.showerror( "Vertex File Error", "No vertices detected in vertex file.\n\n" + 'When saving plots, ensure the file type option is set to \"Webpage, Complete\" not \"Webpage, HTML only\".' ) return False return True def check_valid_main(gui, first_in=True, check_output=True): """ Checks for valid configuration of all parameters housed on the Main tab. This includes extensive review of the input file provided. Args: first_in (bool): False if current file is second or later in a queue of multiple input files check_output (bool): if False, output file names are not examined """ def check_input_file(gui): """ Checks several aspects of the input file to ensure it is compatable with all downstream processing. Also displays warnings for less severe format violations. """ def check_datetime_intervals(): """ Sets time interval between temperature readings and checks for gaps in date/time column. """ delta_secs = (datetimes[-1] - datetimes[0]).total_seconds() interval = dt.timedelta(seconds=round(delta_secs / len(master_list))) if not gui.show_warns_BV.get(): return True # If interval is greater than or equal to one minute if interval.seconds >= 60: i = 1 while i < len(datetimes): if datetimes[i - 1] + interval != datetimes[i]: messagebox.showwarning( "Date/time Warning", f"{file_name_appendage}Discontinuous date/time found for data point {master_list[i][0]}." + "The run will continue, but this could cause inaccurate statistical output.", ) i += 1 return True # If interval is less than one minute # Identify first change in date/time i = 0 while datetimes[i] == datetimes[0]: i += 1 # Find least common denominator with one minute LCD = abs(interval.seconds*60) // math.gcd(interval.seconds, 60) dp_leap = int(LCD / interval.seconds) # There should be a whole number minute change after this many data points min_leap = dt.timedelta(minutes=int(LCD / 60)) # That whole number of minutes is this i += dp_leap while i < len(datetimes): if datetimes[i - dp_leap] + min_leap != datetimes[i]: messagebox.showwarning( "Date/time Warning", f"{file_name_appendage}Discontinuous date/time found for data point {master_list[i][0]}." + "The run will continue, but this could cause inaccurate statistical output.", ) i += dp_leap return True in_file_path = gui.active_input_path file_name_appendage = f"For file: {in_file_path.name} \n\n" datetimes = [] if in_file_path.name == "": messagebox.showerror("Input error (Main tab)", "No input file provided.") return False if not in_file_path.exists(): messagebox.showerror("Input File Error", "".join((file_name_appendage, "File with provided path could not be found."))) return False if in_file_path.suffix not in (".csv", ".html"): messagebox.showerror("Input File Error", f'{file_name_appendage} Input file must have "csv" or "html" extension.') return False try: # In the case of an HTML input, simply check for the presence of input file data if in_file_path.suffix == ".html": with open(in_file_path, "r") as f: content = f.read() if "NestIQ input data" in content: return True else: messagebox.showerror("Input File Error", f'{file_name_appendage} HTML file does not contain the necessary information for processing.') return False with open(in_file_path, "r") as f: lines = f.readlines() master_list = [line.strip().rstrip(",").split(",") for line in lines] pop_indices = [] # Remove lines not conforming to expected format (such as headers) for i in range(len(master_list[:-1])): # Cells in data point column must contain only numbers if not str(master_list[i][0]).isnumeric(): pop_indices.append(i) for pop_count, index in enumerate(pop_indices): master_list.pop(index - pop_count) master_list.pop(len(master_list) - 1) prev_line = master_list[0] if len(prev_line) < 3: gui.air_valid = False for line in master_list[1:]: line = line[:4] if gui.air_valid else line[:3] # Check if data points are continuous and sequential try: if not int(line[0]) == (int(prev_line[0]) + 1): raise ValueError except: messagebox.showerror( "Data Point Error", f"{file_name_appendage}Error after data point " + f"{prev_line[0]}. Data point number is not sequential with regard to previous data point.", ) return False # Test conversion of date/time string to datetime object try: datetimes.append(niq_misc.convert_to_datetime(line[1])) except ValueError: messagebox.showerror( "Date/Time Error", f"{file_name_appendage}Invalid date/time found for data point {line[0]}. Date/Time should be in MM/DD/YYYY HH:MM (:SS) format." ) return False # Check egg temperatures column try: float(line[2]) except: messagebox.showerror("Temperature Error", f"{file_name_appendage}Invalid temperature given for data point {line[0]}.") return False # Check air temperatures column if appropriate if gui.air_valid: try: float(line[3]) except (IndexError, ValueError): gui.air_valid = False if gui.show_warns_BV.get(): messagebox.showwarning( "Air Temperature Warning", f"{file_name_appendage}Invalid air temperature detected for data point " + f"{line[0]}. Air temperatures will not be plotted or included in statistical output.", ) prev_line = line # Lastly, check if date/times are continuous return check_datetime_intervals() except Exception as e: print(e) traceback.print_exc() messagebox.showerror( "Unknown Error", f"{file_name_appendage}There was an unidentifiable error with the provided input file. " + "This is sometimes the result of 'extra' cells in the input file.\n\n" + "Please reference the NestIQ manual for details regarding proper input file format." + " This can be accessed by clicking 'Help' in the top right.", ) return False def check_out_file(gui, entry, title): """ Checks if the name provided for a given output file is valid. This includes asking the user if they want to override if a file with the same name already exists. Args: entry (tk.Entry): entry box being examined title (string): how to reference the current entry box if error messeage is triggered """ if entry.get() == "": messagebox.showerror(f"{title} Error", "File name is empty.") return False entry_path = Path(entry.get()) if entry_path.is_dir(): messagebox.showerror(f"{title} Error", "Directory provided but no file name.") return False # Add extension if not present if entry == gui.plot_file_E: ext = ".html" elif entry == gui.stats_file_E or entry == gui.multi_in_stats_file_E: ext = ".csv" entry_path = Path(entry.get()).with_suffix(ext) # Default to "output_files" directory if only filename (no dir) provided if str(entry_path.parent) == ".": entry_path = gui.master_dir_path / "output_files" / entry_path replace_entry(entry, str(entry_path)) # Check if plot file already exists and if so, ask to override if entry_path.exists(): if gui.show_warns_BV.get(): if not messagebox.askyesno("Override?", f"The file '{entry.get()}' already exists. Do you want to override?"): return False try: entry_path.unlink() except PermissionError: messagebox.showerror(f"{title} Error", "File could not be overridden. Please ensure files are closed before overriding.") return False return True # Check time entry boxes for time_str in (gui.day_start_E.get(), gui.night_start_E.get()): try: time.strptime(time_str, "%H:%M") except ValueError: messagebox.showerror("Daytime Start/End Error", f"Provided value of {time_str} is invalid. Please provide times in 24 hr HH:MM (:SS) format.") return False # Check data smoothing box try: if not float(gui.smoothing_radius_E.get()).is_integer(): raise ValueError if int(gui.smoothing_radius_E.get()) < 0: messagebox.showerror("Data Smoothing Radius Error", "Data smoothing radius must be greater than or equal to zero.") return False except ValueError: messagebox.showerror("Data Smoothing Radius Error", "Data smoothing radius must be an integer.") return False # Check duration threshold box try: if int(float(gui.dur_thresh_E.get())) < 0: messagebox.showerror("Duration Threshold Error", "Duration threshold cannot be less than zero.") return False except ValueError: messagebox.showerror("Duration Threshold Error", "Invalid duration threshold (could not convert to integer).") return False if not check_input_file(gui): return False if check_output: if gui.make_plot_BV.get(): if not check_out_file(gui, gui.plot_file_E, "Plot File"): return False if gui.get_stats_BV.get(): if not check_out_file(gui, gui.stats_file_E, "Stats Output File"): return False if gui.multi_in_stats_BV.get() and first_in: if not check_out_file(gui, gui.multi_in_stats_file_E, "Compile Summary"): return False return True def check_valid_adv(gui): """ Checks for valid configuration of all parameters housed on the Advanced tab. """ def try_autofill(): """ Checks if all Markov model parameter boxes are empty and runs unsupervised learning if so. """ for entry in ( gui.init_off_E, gui.init_on_E, gui.off_off_trans_E, gui.off_on_trans_E, gui.on_on_trans_E, gui.on_off_trans_E, gui.off_mean_E, gui.on_mean_E, gui.off_stdev_E, gui.on_stdev_E, ): if entry.get() != "": return False gui.unsupervised_learning(auto_run=True) return True try: entries = (gui.init_off_E, gui.init_on_E, gui.off_off_trans_E, gui.off_on_trans_E, gui.on_on_trans_E, gui.on_off_trans_E) for entry in entries: if float(entry.get()) < 0: raise ValueError("Probability less than 0 provided.") except ValueError: if try_autofill(): return True messagebox.showerror("Parameter Error (Advanced tab)", "Probabilities must be real numbers greater than 0.") return False try: (float(mean) for mean in (gui.off_mean_E.get(), gui.on_mean_E.get())) except TypeError: messagebox.showerror("Parameter Error (Advanced tab)", "Means must be real numbers.") return False try: for stdev in (gui.off_stdev_E.get(), gui.on_stdev_E.get()): if float(stdev) <= 0: raise ValueError("Standard deviation less than 0 provided.") except: messagebox.showerror("Parameter Error (Advanced tab)", "Standard deviations must be real numbers greater than 0.") return False return True def check_valid_plot_ops(gui): """ Checks for valid configuration of all parameters housed on the Plot Options tab. """ # Check plot dimensions if gui.manual_plot_dims.get(): valid = True try: if int(gui.plot_dim_x_E.get()) < 1 or int(gui.plot_dim_y_E.get()) < 1: valid = False except: valid = False if not valid: messagebox.showwarning( "Plot Dimensions Warning", ("Provided plot dimensions are not valid; please provide positive integers. Automatic resolution detection will be used."), ) gui.manual_plot_dims.set(0) try: if float(gui.title_font_size_E.get()) < 0: raise ValueError("Provided plot title font size is less than 0") except ValueError: messagebox.showerror("Plot title Font Size Error (Plot Options tab)", "Invalid plot title font size was provided.") return False try: if float(gui.axis_title_font_size_E.get()) < 0: raise ValueError("Provided axis title font size is less than 0") except ValueError: messagebox.showerror("Axis Title Font Size Error (Plot Options tab)", "Invalid axis title font size was provided.") return False try: if float(gui.axis_label_font_size_E.get()) < 0: raise ValueError("Provided axis label font size is less than 0") except ValueError: messagebox.showerror("Axis Label Font Size Error (Plot Options tab)", "Invalid axis label font size was provided.") return False try: if int(gui.axis_tick_size_E.get()) < 0: raise ValueError("Provided axis tick size is less than 0") except ValueError: messagebox.showerror("Axis Tick Size Error (Plot Options tab)", "Invalid axis tick size was provided.") return False try: if float(gui.legend_font_size_E.get()) < 0: raise ValueError("Provided legend font size is less than 0") except ValueError: messagebox.showerror("Legend Font Size Error (Plot Options tab)", "Invalid legend font size was provided.") return False # Check plot element sizes/widths try: if float(gui.on_point_size_E.get()) < 0: raise ValueError("Provided on-bout point size is less than 0") except ValueError: messagebox.showerror("Point Size Error (Plot Options tab)", "Invalid on-bout point size was provided.") return False try: if float(gui.bout_line_width_E.get()) < 0: raise ValueError("Provided bout line width is less than 0") except ValueError: messagebox.showerror("Line Width Error (Plot Options tab)", "Invalid bout line width was provided.") return False try: if float(gui.air_line_width_E.get()) < 0: raise ValueError("Provided air line width is less than 0") except ValueError: messagebox.showerror("Line Width Error (Plot Options tab)", "Invalid air temperature line width was provided.") return False if gui.show_day_markers_BV.get(): try: if float(gui.day_marker_width_E.get()) < 0: raise ValueError("Provided day marker size is less than 0") except ValueError: messagebox.showerror("Day Marker Size Error (Plot Options tab)", "Invalid day marker size was provided.") return False return True def check_valid_stat_ops(gui): """ Checks for valid configuration of all parameters housed on the Stat Options tab. """ try: float(gui.time_above_temper_E.get()) except: messagebox.showerror("Custom Temperature Error (Stat Options tab)", 'Invalid "Time above" temperature.') return False try: float(gui.time_below_temper_E.get()) except: messagebox.showerror("Custom Temperature Error (Stat Options tab)", 'Invalid "Time below" temperature.') return False return True
[ 11748, 640, 198, 11748, 4818, 8079, 355, 288, 83, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 256, 74, 3849, 1330, 3275, 3524, 198, 11748, 302, 198, 11748, 299, 25011, 62, 44374, 198, 11748, 10688, 198, 11748, 12854, 1891, 198, 198, ...
2.244131
8,647
if __name__ == '__main__': from xrobot import launch as _xrobot_launch _xrobot_launch(_xrobot_get_connection_filename() or '')
[ 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 628, 220, 220, 220, 422, 2124, 305, 13645, 1330, 4219, 355, 4808, 87, 305, 13645, 62, 35681, 198, 220, 220, 220, 4808, 87, 305, 13645, 62, 35681, 28264, 87, 305, 13645, 62, 1...
2.615385
52
import itertools import numpy as np from . import common defaultInterpolator = Interpolator()
[ 11748, 340, 861, 10141, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 764, 1330, 2219, 628, 198, 198, 12286, 9492, 16104, 1352, 796, 4225, 16104, 1352, 3419, 628, 198 ]
3.258065
31
import os import json import datetime from easydict import EasyDict as edict from django.conf import settings from rando import logger from rando.core import classproperty class GeoJSONManager(JSONManager): class JSONModel(object): filepath = None manager_class = JSONManager _default_manager = objects class GeoJSONModel(JSONModel): manager_class = GeoJSONManager
[ 11748, 28686, 198, 11748, 33918, 198, 11748, 4818, 8079, 198, 198, 6738, 2562, 11600, 1330, 16789, 35, 713, 355, 1225, 713, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 198, 6738, 374, 25440, 1330, 49706, 198, 6738, 374, 25440, ...
3.438596
114
''' Dungeon object class created 2019-03-19 by NGnius ''' # import math import random DEFAULT_SIZE = 16 WIDTH = 42 ANIMATION_CHAR = '*' BLANK_CHAR = '.' PORTAL_CHAR = '0'
[ 7061, 6, 198, 30128, 6281, 2134, 1398, 198, 198, 25598, 13130, 12, 3070, 12, 1129, 416, 39058, 77, 3754, 705, 7061, 198, 2, 1330, 10688, 198, 11748, 4738, 198, 198, 7206, 38865, 62, 33489, 796, 1467, 198, 54, 2389, 4221, 796, 5433, ...
2.471429
70
# coding: utf-8 f = open("test.txt", mode="r+") f.write("hello world") f.flush() f.truncate(f.tell()) f.close()
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 69, 796, 1280, 7203, 9288, 13, 14116, 1600, 4235, 2625, 81, 10, 4943, 198, 69, 13, 13564, 7203, 31373, 995, 4943, 198, 69, 13, 25925, 3419, 198, 69, 13, 2213, 19524, 378, 7, 69, 13, 3333...
2.173077
52
# -*- coding: utf-8 -*- import unicodedata import json import arrow import scrapy from scrapyproject.showingspiders.showing_spider import ShowingSpider from scrapyproject.items import (ShowingLoader, init_show_booking_loader) from scrapyproject.utils import TohoUtil
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 28000, 9043, 1045, 198, 11748, 33918, 198, 11748, 15452, 198, 11748, 15881, 88, 198, 6738, 15881, 88, 16302, 13, 12860, 654, 79, 4157, 13, 1477, 7855, 62, 2777, 1...
3.228916
83
from invoke import task
[ 6738, 26342, 1330, 4876, 220, 201, 198, 201 ]
3.375
8
from aristotle_mdr.apps import AristotleExtensionBaseConfig
[ 6738, 28631, 23556, 62, 76, 7109, 13, 18211, 1330, 34067, 11627, 3004, 14881, 16934, 628 ]
4.066667
15
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .exponentiated_gradient import ExponentiatedGradient # noqa: F401 from .exponentiated_gradient import ExponentiatedGradientResult # noqa: F401 __all__ = [ "ExponentiatedGradient", "ExponentiatedGradientResult" ]
[ 2, 15069, 357, 66, 8, 5413, 10501, 13, 1439, 2489, 10395, 13, 198, 2, 49962, 739, 262, 17168, 13789, 13, 198, 198, 6738, 764, 11201, 3471, 12931, 62, 49607, 1330, 5518, 3471, 12931, 42731, 1153, 220, 1303, 645, 20402, 25, 376, 21844, ...
3.329897
97
# -*- coding: utf-8 -*- from akagi.contents import s3_content from akagi.contents import local_file_content from akagi.contents import spreadsheet_content from akagi.contents import url_content from akagi.contents.s3_content import S3Content from akagi.contents.local_file_content import LocalFileContent from akagi.contents.spreadsheet_content import SpreadsheetContent from akagi.contents.url_content import URLContent
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 47594, 18013, 13, 3642, 658, 1330, 264, 18, 62, 11299, 198, 6738, 47594, 18013, 13, 3642, 658, 1330, 1957, 62, 7753, 62, 11299, 198, 6738, 47594, 18013, 13, ...
3.357143
126
from collections import defaultdict from collections import deque from typing import Deque from typing import Dict from typing import Iterable from typing import List from advent.load import read_input def prepare_io(value: Iterable[int] = None, output=False) -> Deque[int]: if value is None: return deque() if not ( hasattr(value, "append" if output else "popleft") or isinstance(value, deque) ): return deque(value) return value def read_intcode(name=None) -> List[int]: return [int(x) for x in read_input(name, 2).split(",")]
[ 6738, 17268, 1330, 4277, 11600, 198, 6738, 17268, 1330, 390, 4188, 198, 6738, 19720, 1330, 1024, 4188, 198, 6738, 19720, 1330, 360, 713, 198, 6738, 19720, 1330, 40806, 540, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 19980, 13, 2220, ...
2.8867
203
num = int(input('Escreva um digito:')) soma=0 while num > 0 digito = num%10 # obtem algarismo unidades num = num // 10 # remove algarismo unidades if digito % 2 == 0: #par soma = soma + digito print(soma)
[ 22510, 796, 493, 7, 15414, 10786, 47051, 260, 6862, 23781, 3100, 10094, 32105, 4008, 198, 82, 6086, 28, 15, 198, 4514, 997, 1875, 657, 198, 220, 220, 220, 3100, 10094, 796, 997, 4, 940, 1303, 909, 11498, 435, 4563, 44126, 555, 312, ...
2.319588
97
from django.db import models # Create your models here.
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 198, 2, 13610, 534, 4981, 994, 13 ]
3.733333
15
#!/usr/bin/env python3 import os import sys import argparse import re import shutil import numpy as np from netCDF4 import Dataset """This script is useful for finding the best find from the `optimize.log` file, the getting the parameters for this fit from logged results""" # Parse the input arguments parser = argparse.ArgumentParser(description='Find the best parameters so find') parser.add_argument('--caldir', '-c', help='path to the calibration directory', default='./') parser.add_argument('--yearrange', '-yr', nargs=2, type=int, help='year range to run calibration for (inclusive)') parser.set_defaults(yearrange=[2009,2012]) args = parser.parse_args() cal_dir = args.caldir year_range = range(args.yearrange[0], args.yearrange[1]+1) # Open the optimize.log file and find the best fit by plucking the cost and run ID # from each line that begins with 'C' (Cost for...) with open(os.path.join(cal_dir, 'optimize.log')) as f: costs = [] ids = [] for line in f: if line[0] == 'C': split = re.split('Cost for |\: ', line) ids.append(split[1]) costs.append(float(split[2])) # Print the minimum cost and the corresponding run ID costs = np.array(costs) run_id = ids[costs.argmin()] print(f'Minimum cost: {costs.min()}') print(f'For run ID: {run_id}') # Now get the parameters that produced that cost params_f = np.load(os.path.join(cal_dir, 'results', f'{run_id}.npz')) params = params_f['params'] # Finally, we can recreate the NetCDF files used for this run param_names = ['resuspension_alpha', 'resuspension_beta', 'sediment_transport_a', 'sediment_transport_c', 'deposition_alpha', 'deposition_beta', 'bank_erosion_alpha', 'bank_erosion_beta'] # Get the template for the 2D array nc_subcatchment = Dataset(os.path.join(cal_dir, 'data', f'{args.yearrange[0]}_no-emissions.nc'), 'r') var = nc_subcatchment['flow_dir'][:,:] catchment_mask = var.mask catchment_shape = var.shape n_cells = var.count() # Make a copy of the template NetCDFs to add this iteration's params to for year in year_range: dst_path = os.path.join(cal_dir, f'data_cache/{year}_no-emissions_{run_id}.nc') shutil.copy(os.path.join(cal_dir, f'data/{year}_no-emissions.nc'), dst_path) # Pull out the 1D arrays for each parameter from the params variable, then # reshape to the correct grid shape and mask and add to NetCDF file for i, param in enumerate(param_names): param_1d = params[n_cells*i:n_cells*i+n_cells] param_2d = np.ma.masked_array(np.empty(catchment_shape), mask=catchment_mask) # Reshape into 2D arrays, taking into account the mask j = 0 for i, _ in np.ndenumerate(param_2d): if ~catchment_mask[i]: param_2d[i] = param_1d[j] j = j + 1 # Now add this variable to the NetCDF file, placing a copy in the cache for year in year_range: # Then create the new variables nc = Dataset(os.path.join(cal_dir, f'data_cache/{year}_no-emissions_{run_id}.nc'), 'r+') var = nc.createVariable(param, datatype=float, dimensions=('y','x')) var[:] = param_2d nc.close()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 1822, 29572, 198, 11748, 302, 198, 11748, 4423, 346, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 2010, 34, 8068, 19, 1330, 16092, 292,...
2.615578
1,194
import spotipy_twisted birdy_uri = 'spotify:artist:2WX2uTcsvV5OnS0inACecP' spotify = spotipy_twisted.Spotify() results = spotify.artist_albums(birdy_uri, album_type='album') albums = results['items'] while results['next']: results = spotify.next(results) albums.extend(results['items']) for album in albums: print(album['name'])
[ 11748, 4136, 541, 88, 62, 4246, 6347, 628, 198, 16944, 88, 62, 9900, 796, 705, 20485, 1958, 25, 49016, 25, 17, 54, 55, 17, 84, 51, 40664, 53, 20, 2202, 50, 15, 259, 2246, 721, 47, 6, 198, 198, 20485, 1958, 796, 4136, 541, 88, ...
2.551471
136
# # PySNMP MIB module CISCO-ATM-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:50:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") atmVclEntry, aal5VccEntry = mibBuilder.importSymbols("ATM-MIB", "atmVclEntry", "aal5VccEntry") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") Unsigned32, iso, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Counter32, NotificationType, IpAddress, Bits, ModuleIdentity, Gauge32, MibIdentifier, Counter64, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "iso", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Counter32", "NotificationType", "IpAddress", "Bits", "ModuleIdentity", "Gauge32", "MibIdentifier", "Counter64", "ObjectIdentity") DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "TruthValue") ciscoAtmExtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 88)) ciscoAtmExtMIB.setRevisions(('2003-01-06 00:00', '1997-06-20 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoAtmExtMIB.setRevisionsDescriptions(('Added ciscoAtmVclExtOamTable for OAM configuration and state information.', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoAtmExtMIB.setLastUpdated('200301060000Z') if mibBuilder.loadTexts: ciscoAtmExtMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoAtmExtMIB.setContactInfo(' Cisco Systems Customer Service Postal: 170 W. Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-atm@cisco.com') if mibBuilder.loadTexts: ciscoAtmExtMIB.setDescription('An extension to the Cisco ATM MIB module for managing ATM implementations. Acronyms and terms used in the MIB module: AAL5 -- ATM adaptation layer 5. AIS -- Alarm Indication Signal. CC -- Continuity Check. End-to-end -- End-to-end continuity checking. Monitoring occurs on the entire VC between two ATM end stations. F5 OAM -- OAM information flow between network elements (NEs) used within virtual connections to report degraded virtual channel performance. OAM -- Operations, Administration and Maintenance. RDI -- Remote Detection Indication. Segment -- Segment continuity checking. Monitoring occurs on a VC segment between a router and a first-hop ATM switch. VC -- Virtual Channel. VCC -- Virtual Channel Connection. VCL -- Virtual Channel Link.') ciscoAtmExtMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 1)) cAal5VccExtMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1)) catmxVcl = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2)) cAal5VccExtTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1), ) if mibBuilder.loadTexts: cAal5VccExtTable.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtTable.setDescription('This table contains AAL5 VCC performance parameters beyond that provided by cAal5VccEntry.') cAal5VccExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1, 1), ) aal5VccEntry.registerAugmentions(("CISCO-ATM-EXT-MIB", "cAal5VccExtEntry")) cAal5VccExtEntry.setIndexNames(*aal5VccEntry.getIndexNames()) if mibBuilder.loadTexts: cAal5VccExtEntry.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtEntry.setDescription('This list contains the additinal AAL5 VCC performance parameters beyond that provided by cAal5VccEntry.') cAal5VccExtCompEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cAal5VccExtCompEnabled.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtCompEnabled.setDescription('Boolean, if compression enabled for VCC.') cAal5VccExtVoice = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1, 1, 2), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cAal5VccExtVoice.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtVoice.setDescription('Boolean, TRUE if VCC is used to carry voice.') cAal5VccExtInF5OamCells = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cAal5VccExtInF5OamCells.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtInF5OamCells.setDescription('Number of OAM F5 end to end loopback cells received through the VCC.') cAal5VccExtOutF5OamCells = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cAal5VccExtOutF5OamCells.setStatus('current') if mibBuilder.loadTexts: cAal5VccExtOutF5OamCells.setDescription('Number of OAM F5 end to end loopback cells sent through the VCC.') catmxVclOamTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1), ) if mibBuilder.loadTexts: catmxVclOamTable.setStatus('current') if mibBuilder.loadTexts: catmxVclOamTable.setDescription('This table contains Virtual Channel Link (VCL) Oam configuration and state information. This table augments the atmVclTable.') catmxVclOamEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1), ) atmVclEntry.registerAugmentions(("CISCO-ATM-EXT-MIB", "catmxVclOamEntry")) catmxVclOamEntry.setIndexNames(*atmVclEntry.getIndexNames()) if mibBuilder.loadTexts: catmxVclOamEntry.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEntry.setDescription('This list contains Virtual Channel Link (VCL) configuration and state information beyond that provided by atmVclEntry.') catmxVclOamLoopbackFreq = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 1), Unsigned32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamLoopbackFreq.setStatus('current') if mibBuilder.loadTexts: catmxVclOamLoopbackFreq.setDescription('Specifies OAM loopback frequency.') catmxVclOamRetryFreq = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 2), Unsigned32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamRetryFreq.setStatus('current') if mibBuilder.loadTexts: catmxVclOamRetryFreq.setDescription('Specifies OAM retry polling frequency.') catmxVclOamUpRetryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 3), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamUpRetryCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamUpRetryCount.setDescription('Specifies OAM retry count before declaring a VC is up.') catmxVclOamDownRetryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 4), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamDownRetryCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamDownRetryCount.setDescription('Specifies OAM retry count before declaring a VC is down.') catmxVclOamEndCCActCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 5), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamEndCCActCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEndCCActCount.setDescription('Specifies OAM End-to-end Continuity check (CC) Activation retry count.') catmxVclOamEndCCDeActCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 6), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamEndCCDeActCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEndCCDeActCount.setDescription('Specifies OAM End-to-end Continuity check (CC) Deactivation retry count.') catmxVclOamEndCCRetryFreq = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 7), Unsigned32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamEndCCRetryFreq.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEndCCRetryFreq.setDescription('Specifies OAM End-to-end Continuity check (CC) Activation/Deactivation retry frequency.') catmxVclOamSegCCActCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 8), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamSegCCActCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamSegCCActCount.setDescription('Specifies OAM Segment Continuity check (CC) Activation retry count.') catmxVclOamSegCCDeActCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 9), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamSegCCDeActCount.setStatus('current') if mibBuilder.loadTexts: catmxVclOamSegCCDeActCount.setDescription('Specifies OAM Segment Continuity check (CC) Deactivation retry count.') catmxVclOamSegCCRetryFreq = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 10), Unsigned32()).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamSegCCRetryFreq.setStatus('current') if mibBuilder.loadTexts: catmxVclOamSegCCRetryFreq.setDescription('Specifies OAM Segment Continuity check (CC) Activation/Deactivation retry frequency.') catmxVclOamManage = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 11), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: catmxVclOamManage.setStatus('current') if mibBuilder.loadTexts: catmxVclOamManage.setDescription('Specifies OAM Enable/Disable on the VC. true(1) indicates that OAM is enabled on the VC. false(2) indicates that OAM is disabled on the VC.') catmxVclOamLoopBkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("disabled", 1), ("sent", 2), ("received", 3), ("failed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamLoopBkStatus.setStatus('current') if mibBuilder.loadTexts: catmxVclOamLoopBkStatus.setDescription('Indicates OAM loopback status of the VC. disabled(1) -- No OAMs on this VC. sent(2) -- OAM sent, waiting for echo. received(3) -- OAM received from target. failed(4) -- Last OAM did not return.') catmxVclOamVcState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("downRetry", 1), ("verified", 2), ("notVerified", 3), ("upRetry", 4), ("aisRDI", 5), ("aisOut", 6), ("notManaged", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamVcState.setStatus('current') if mibBuilder.loadTexts: catmxVclOamVcState.setDescription('Indicates the state of VC OAM. downRetry(1) -- Loopback failed. Retry sending loopbacks with retry frequency. VC is up. verified(2) -- Loopback is successful. notVerified(3) -- Not verified by loopback, AIS/RDI conditions are cleared. upRetry(4) -- Retry successive loopbacks. VC is down. aisRDI(5) -- Received AIS/RDI. Loopback are not sent in this state. aisOut(6) -- Sending AIS. Loopback and reply are not sent in this state. notManaged(7) -- VC is not managed by OAM.') catmxVclOamEndCCStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 14), OamCCStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamEndCCStatus.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEndCCStatus.setDescription('Indicates OAM End-to-end Continuity check (CC) status.') catmxVclOamSegCCStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 15), OamCCStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamSegCCStatus.setStatus('current') if mibBuilder.loadTexts: catmxVclOamSegCCStatus.setDescription('Indicates OAM Segment Continuity check (CC) status.') catmxVclOamEndCCVcState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 16), OamCCVcState()).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamEndCCVcState.setStatus('current') if mibBuilder.loadTexts: catmxVclOamEndCCVcState.setDescription('Indicates OAM End-to-end Continuity check (CC) VC state.') catmxVclOamSegCCVcState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 17), OamCCVcState()).setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamSegCCVcState.setStatus('current') if mibBuilder.loadTexts: catmxVclOamSegCCVcState.setDescription('Indicates OAM Segment Continuity check (CC) VC state.') catmxVclOamCellsReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 18), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamCellsReceived.setStatus('current') if mibBuilder.loadTexts: catmxVclOamCellsReceived.setDescription('Indicates the number of OAM cells received on this VC.') catmxVclOamCellsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 19), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamCellsSent.setStatus('current') if mibBuilder.loadTexts: catmxVclOamCellsSent.setDescription('Indicates the number of OAM cells sent on this VC.') catmxVclOamCellsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 20), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamCellsDropped.setStatus('current') if mibBuilder.loadTexts: catmxVclOamCellsDropped.setDescription('Indicates the number of OAM cells dropped on this VC.') catmxVclOamInF5ais = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 21), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamInF5ais.setStatus('current') if mibBuilder.loadTexts: catmxVclOamInF5ais.setDescription('Indicates the number of received OAM F5 Alarm Indication Signal (AIS) cells from the VC.') catmxVclOamOutF5ais = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 22), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamOutF5ais.setStatus('current') if mibBuilder.loadTexts: catmxVclOamOutF5ais.setDescription('Indicates the number of transmitted OAM F5 Alarm Indication Signal (AIS) cells to the VC.') catmxVclOamInF5rdi = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 23), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamInF5rdi.setStatus('current') if mibBuilder.loadTexts: catmxVclOamInF5rdi.setDescription('Indicates the number of received OAM F5 Remote Detection Indication (RDI) cells from the VC.') catmxVclOamOutF5rdi = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 88, 1, 2, 1, 1, 24), Counter32()).setUnits('cells').setMaxAccess("readonly") if mibBuilder.loadTexts: catmxVclOamOutF5rdi.setStatus('current') if mibBuilder.loadTexts: catmxVclOamOutF5rdi.setDescription('Indicates the number of transmitted OAM F5 Remote Detection Indication (RDI) cells to the VC.') ciscoAal5ExtMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 2)) ciscoAal5ExtMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 1)) ciscoAal5ExtMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 2)) ciscoAal5ExtMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 1, 1)).setObjects(("CISCO-ATM-EXT-MIB", "ciscoAal5ExtMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoAal5ExtMIBCompliance = ciscoAal5ExtMIBCompliance.setStatus('deprecated') if mibBuilder.loadTexts: ciscoAal5ExtMIBCompliance.setDescription('This compliance is deprecated in favour of ciscoAal5ExtMIBComplianceRev1. The compliance statement for entities which implement this Cisco AAL5 Extention MIB and support data compression or voice features.') ciscoAal5ExtMIBComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 1, 2)).setObjects(("CISCO-ATM-EXT-MIB", "ciscoAal5ExtMIBGroup"), ("CISCO-ATM-EXT-MIB", "ciscoAtmExtVclOamGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoAal5ExtMIBComplianceRev1 = ciscoAal5ExtMIBComplianceRev1.setStatus('current') if mibBuilder.loadTexts: ciscoAal5ExtMIBComplianceRev1.setDescription('The compliance statement for entities which implement CISCO-ATM-EXT-MIB.') ciscoAal5ExtMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 2, 1)).setObjects(("CISCO-ATM-EXT-MIB", "cAal5VccExtCompEnabled"), ("CISCO-ATM-EXT-MIB", "cAal5VccExtVoice"), ("CISCO-ATM-EXT-MIB", "cAal5VccExtInF5OamCells"), ("CISCO-ATM-EXT-MIB", "cAal5VccExtOutF5OamCells")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoAal5ExtMIBGroup = ciscoAal5ExtMIBGroup.setStatus('current') if mibBuilder.loadTexts: ciscoAal5ExtMIBGroup.setDescription('A collection of objects providing AAL5 related parameters.') ciscoAtmExtVclOamGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 88, 2, 2, 2)).setObjects(("CISCO-ATM-EXT-MIB", "catmxVclOamLoopbackFreq"), ("CISCO-ATM-EXT-MIB", "catmxVclOamRetryFreq"), ("CISCO-ATM-EXT-MIB", "catmxVclOamUpRetryCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamDownRetryCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamEndCCActCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamEndCCDeActCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamEndCCRetryFreq"), ("CISCO-ATM-EXT-MIB", "catmxVclOamSegCCActCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamSegCCDeActCount"), ("CISCO-ATM-EXT-MIB", "catmxVclOamSegCCRetryFreq"), ("CISCO-ATM-EXT-MIB", "catmxVclOamManage"), ("CISCO-ATM-EXT-MIB", "catmxVclOamLoopBkStatus"), ("CISCO-ATM-EXT-MIB", "catmxVclOamVcState"), ("CISCO-ATM-EXT-MIB", "catmxVclOamEndCCStatus"), ("CISCO-ATM-EXT-MIB", "catmxVclOamSegCCStatus"), ("CISCO-ATM-EXT-MIB", "catmxVclOamEndCCVcState"), ("CISCO-ATM-EXT-MIB", "catmxVclOamSegCCVcState"), ("CISCO-ATM-EXT-MIB", "catmxVclOamCellsReceived"), ("CISCO-ATM-EXT-MIB", "catmxVclOamCellsSent"), ("CISCO-ATM-EXT-MIB", "catmxVclOamCellsDropped"), ("CISCO-ATM-EXT-MIB", "catmxVclOamInF5ais"), ("CISCO-ATM-EXT-MIB", "catmxVclOamOutF5ais"), ("CISCO-ATM-EXT-MIB", "catmxVclOamInF5rdi"), ("CISCO-ATM-EXT-MIB", "catmxVclOamOutF5rdi")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoAtmExtVclOamGroup = ciscoAtmExtVclOamGroup.setStatus('current') if mibBuilder.loadTexts: ciscoAtmExtVclOamGroup.setDescription('A collection of objects providing Virtual Channel Link (VCL) OAM configuration and state information.') mibBuilder.exportSymbols("CISCO-ATM-EXT-MIB", catmxVclOamSegCCDeActCount=catmxVclOamSegCCDeActCount, catmxVclOamUpRetryCount=catmxVclOamUpRetryCount, cAal5VccExtVoice=cAal5VccExtVoice, catmxVclOamCellsDropped=catmxVclOamCellsDropped, ciscoAal5ExtMIBGroup=ciscoAal5ExtMIBGroup, catmxVclOamEndCCStatus=catmxVclOamEndCCStatus, catmxVclOamEndCCVcState=catmxVclOamEndCCVcState, catmxVclOamSegCCRetryFreq=catmxVclOamSegCCRetryFreq, ciscoAtmExtMIB=ciscoAtmExtMIB, catmxVclOamSegCCActCount=catmxVclOamSegCCActCount, catmxVclOamLoopBkStatus=catmxVclOamLoopBkStatus, catmxVclOamSegCCStatus=catmxVclOamSegCCStatus, cAal5VccExtTable=cAal5VccExtTable, ciscoAal5ExtMIBCompliance=ciscoAal5ExtMIBCompliance, PYSNMP_MODULE_ID=ciscoAtmExtMIB, cAal5VccExtEntry=cAal5VccExtEntry, catmxVclOamVcState=catmxVclOamVcState, ciscoAtmExtMIBObjects=ciscoAtmExtMIBObjects, catmxVclOamOutF5rdi=catmxVclOamOutF5rdi, ciscoAal5ExtMIBConformance=ciscoAal5ExtMIBConformance, OamCCStatus=OamCCStatus, catmxVclOamTable=catmxVclOamTable, catmxVclOamDownRetryCount=catmxVclOamDownRetryCount, catmxVclOamManage=catmxVclOamManage, catmxVclOamEndCCRetryFreq=catmxVclOamEndCCRetryFreq, ciscoAal5ExtMIBGroups=ciscoAal5ExtMIBGroups, catmxVclOamInF5ais=catmxVclOamInF5ais, cAal5VccExtCompEnabled=cAal5VccExtCompEnabled, OamCCVcState=OamCCVcState, catmxVclOamEndCCActCount=catmxVclOamEndCCActCount, catmxVclOamSegCCVcState=catmxVclOamSegCCVcState, catmxVclOamEntry=catmxVclOamEntry, catmxVclOamEndCCDeActCount=catmxVclOamEndCCDeActCount, catmxVcl=catmxVcl, cAal5VccExtInF5OamCells=cAal5VccExtInF5OamCells, cAal5VccExtOutF5OamCells=cAal5VccExtOutF5OamCells, catmxVclOamOutF5ais=catmxVclOamOutF5ais, ciscoAal5ExtMIBCompliances=ciscoAal5ExtMIBCompliances, catmxVclOamRetryFreq=catmxVclOamRetryFreq, catmxVclOamInF5rdi=catmxVclOamInF5rdi, catmxVclOamCellsReceived=catmxVclOamCellsReceived, catmxVclOamLoopbackFreq=catmxVclOamLoopbackFreq, cAal5VccExtMIBObjects=cAal5VccExtMIBObjects, catmxVclOamCellsSent=catmxVclOamCellsSent, ciscoAtmExtVclOamGroup=ciscoAtmExtVclOamGroup, ciscoAal5ExtMIBComplianceRev1=ciscoAal5ExtMIBComplianceRev1)
[ 2, 198, 2, 9485, 15571, 7378, 337, 9865, 8265, 36159, 8220, 12, 1404, 44, 12, 13918, 12, 8895, 33, 357, 4023, 1378, 16184, 76, 489, 8937, 13, 785, 14, 79, 893, 11632, 8, 198, 2, 7054, 45, 13, 16, 2723, 2393, 1378, 14, 14490, 14,...
2.53172
8,181
# ckwg +28 # Copyright 2018 by Kitware, 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: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # * 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. # # * Neither name of Kitware, Inc. nor the names of any 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 AUTHORS 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. from __future__ import division from __future__ import print_function from __future__ import absolute_import import six import warnings import numpy as np import torch try: import cv2 except ImportError: cv2 = None
[ 2, 269, 46265, 70, 1343, 2078, 198, 2, 15069, 2864, 416, 10897, 1574, 11, 3457, 13, 198, 2, 1439, 2489, 10395, 13, 198, 2, 198, 2, 2297, 396, 3890, 290, 779, 287, 2723, 290, 13934, 5107, 11, 351, 393, 1231, 198, 2, 17613, 11, 38...
3.50099
505
import math import numpy as np import scipy.constants as sp import copy import time X = 0 # Cartesian indices Y = 1 L = 0 # Lower U = 1 # Upper
[ 11748, 10688, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 629, 541, 88, 13, 9979, 1187, 355, 599, 198, 11748, 4866, 198, 11748, 640, 198, 198, 55, 796, 657, 1303, 13690, 35610, 36525, 198, 56, 796, 352, 198, 198, 43, 796, 657, 1...
2.9
50
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys, traceback import threading import time from PyQt4 import QtGui,QtCore from boardlet import Boardlet from modellet import Modellet
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 28686, 198, 11748, 25064, 11, 12854, 1891, 198, 11748, 4704, 278, 198, 11748, 640, 198, 198, 6738, 9485, 48, 83, ...
2.869565
69
# # PySNMP MIB module ASSETMANAGEMENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASSETMANAGEMENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:29:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint") InetPortNumber, InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetPortNumber", "InetAddress", "InetAddressType") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") sysName, sysLocation, sysContact = mibBuilder.importSymbols("SNMPv2-MIB", "sysName", "sysLocation", "sysContact") NotificationType, Gauge32, ModuleIdentity, MibIdentifier, Integer32, Counter64, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Counter32, Unsigned32, enterprises, ObjectIdentity, TimeTicks, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "Gauge32", "ModuleIdentity", "MibIdentifier", "Integer32", "Counter64", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Counter32", "Unsigned32", "enterprises", "ObjectIdentity", "TimeTicks", "Bits") DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TruthValue", "TextualConvention") raritan = ModuleIdentity((1, 3, 6, 1, 4, 1, 13742)) raritan.setRevisions(('2015-01-05 00:00', '2014-09-25 00:00', '2014-04-04 00:00', '2012-03-29 00:00', '2012-03-26 00:00', '2012-02-14 00:00', '2012-02-10 00:00', '2012-02-08 00:00', '2012-02-07 00:00', '2012-02-03 00:00', '2012-01-17 00:00', '2012-01-04 00:00', '2011-12-08 00:00', '2011-11-11 00:00', '2011-11-09 00:00', '2011-10-25 00:00', '2011-10-05 00:00', '2011-09-05 00:00', '2011-09-01 00:00', '2011-08-23 00:00', '2011-05-18 00:00', '2011-05-04 00:00', '2011-04-15 00:00', '2011-02-18 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: raritan.setRevisionsDescriptions(('The following changes were made. 1) Added agentInetPortNumber under trapInformation 2) Added agentInetPortNumber as a varbind to all traps ', 'The following changes were made. 1) added assetStripCascadePosition to the assetManagement table 2) added rackUnitRelativePosition to the assetManagement table. 3) added assetStripNumberOfRackUnits to the assetManagement table. 4) added assetStripType, assetStripCascadePosition, rackUnitRelativePosition, assetStripNumberOfRackUnits to the following traps. assetTagConnected assetTagDisconnected bladeExtensionConnected bladeExtensionDisconnected ', 'The following changes were made. 1) added bladeTagID to assetTagConnected and assetTagDisconnected traps 2) added rackUnitCount to the following traps. assetTagConnected assetTagDisconnected bladeExtensionConnected bladeExtensionDisconnected assetStripStateChange ', 'The following changes were made. 1) add logParentBladeID to AssetManagementLogEntryStruct ', 'The following changes were made. 1) clarify documentation of LED operation mode: setting ledMode, ledColor or ledColorStr automatically switches the ledOperationMode to manual. ', 'The following changes were made. 1) add logAssetStripState and extend logEventType with assetStripStateChange ', 'The following changes were made. 1) clarify documentation regarding logSlotNumber: it is 0 a) indicating a tag on the main strip b) in case no strip is connected or the value is not valid for a certain log entry ', 'The following changes were made. 1) added bladeExtensionSize to bladeExtensionConnected and bladeExtensionDisconnected traps ', 'The following changes were made. 1) added logSize, oldestLogID, newestLogID and logEventCount 2) added assetManagementLogTable and assetManagementLogEntry ', ' 1) Added assetStripDefaultLEDColorConnected, assetStripDefaultLEDColorConnectedStr, assetStripDefaultLEDColorDisconnected, assetStripDefaultLEDColorDisconnectedStr to AssetStripConfigurationEntryStruct 2) Deprecated defaultLEDColorConnected, defaultLEDColorConnectedStr, defaultLEDColorDisconnected, defaultLEDColorDisconnectedStr ', '1) add rackUnitPosition to the following traps: assetTagConnected, assetTagDisconnected, bladeExtensionConnected, bladeExtensionDisconnected, rackUnitConfigurationChanged 2) rackUnitNumber in the traps now always corresponds with rackUnitID, clarify documentation accordingly ', ' 1) extended AssetStripConfigurationEntryStruct by assetStripType and numberOfComponentAssetStrips 2) added compositeAssetStripCompositionChanged trap ', ' 1) removed bladeSlotNumberingMode from AssetManagementEntryStruct 2) removed BladeSlotNumberingModeEnumeration 3) removed bladeSlotNumberingMode from the rackUnitConfigurationChanged trap ', 'The following changes were made. 1) allow 0 in rackUnitPosition in case there is no strip connected 2) added none (nothing connected) and unknown (strip disconnected) to rackUnitType ', 'The following changes were made. 1) allow a 0 in bladeExtensionSize in case there is no blade extension connected or the asset strip is disconnected. ', 'The following changes were made. 1) added sysContact,sysName, sysLocation to all traps 2) added currentMainTagCount, currentBladeTagCount 3) added maxMainTagCount, maxBladeTagCount 4) added bladeExtensionOverflow 5) added traps bladeExtensionOverflowOccured, bladeExtensionOverflowCleared ', 'The following changes were made. 1) Added assetStripName to all traps ', '1) added rackUnitName ', ' 1) added bladeExtensionConnected, bladeExtensionDisconnected traps 2) in AssetManagementEntryStruct renamed rackUnitSize to bladeExtensionSize 3) added bladeSlotPosition to BladeExtensionEntryStruct 4) added bladeSlotNumberingMode to AssetManagementEntryStruct 5) added BladeSlotNumberingModeEnumeration 6) added bladeSlotNumberingMode to the rackUnitConfigurationChanged trap ', 'Support blade server extension segments: 1) added rackUnitType, rackUnitSize 2) added bladeExtensionTable and bladeExtensionEntry 3) added slotNumber to assetTagConnected and assetTagDisconnected traps ', 'The following changes were made. 1) Modified blinking speeds in AssetManagementLEDModeEnumeration to fastBlink, slowBlink ', 'The following changes were made. 1) Added ledOperationMode to the Tag Connected and Tag Disconnected Traps. 2) Modified the DESCRIPTION of rackUnitNumberingOffset. 3) Modified blinking speeds in AssetManagementLEDModeEnumeration to blinkFastest, blink2ndFastest ', 'The following changes were made. 1) Added DeviceConfigurationParameterEnumeration, RackUnitNumberingModeEnumeration, AssetStripOrientationEnumeration 2) Added deviceConfigurationChanged Trap 3) Added deviceUserName, deviceChangedParameter, changedParameterNewValue to trapInformationGroup 4) Added blinking2(4) to AssetManagementLEDModeEnumeration 5) Add led mode and led color information to the Tag Connected and Tag Disconnected Traps. 6) Added rackUnitNumberingMode, rackUnitNumberingOffset, assetStripOrientation to AssetStripConfigurationEntryStruct 7) Added rackUnitPosition to AssetManagementEntryStruct 8) Added rackUnitConfigurationChanged Trap ', 'The first version of the MIB.',)) if mibBuilder.loadTexts: raritan.setLastUpdated('201501050000Z') if mibBuilder.loadTexts: raritan.setOrganization('Raritan') if mibBuilder.loadTexts: raritan.setContactInfo(' Author: Raritan Americas, Inc. postal: Raritan Americas, Inc. 400 Cottontail Lane Somerset, NJ 08873 email: tech@raritan.com phone: +1 732 764 8886 ') if mibBuilder.loadTexts: raritan.setDescription('This MIB describes the SNMP functions of the asset management capable products from Raritan Computer.') assetManager = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7)) traps = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 0)) trapInformation = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0)) configuration = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 1)) conformance = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 2)) log = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 3)) assetStrip = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6)) assetManagement = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7)) compliances = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 2, 1)) groups = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2)) complianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 13742, 7, 2, 1, 1)).setObjects(("ASSETMANAGEMENT-MIB", "configGroup"), ("ASSETMANAGEMENT-MIB", "assetManagementGroup"), ("ASSETMANAGEMENT-MIB", "trapInformationGroup"), ("ASSETMANAGEMENT-MIB", "trapsGroup"), ("ASSETMANAGEMENT-MIB", "logGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): complianceRev1 = complianceRev1.setStatus('deprecated') if mibBuilder.loadTexts: complianceRev1.setDescription('The requirements for conformance to the ASSETMANAGEMENT-MIB. This is deprecated in favor of complianceRev2') complianceRev2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 13742, 7, 2, 1, 2)).setObjects(("ASSETMANAGEMENT-MIB", "configGroup2"), ("ASSETMANAGEMENT-MIB", "assetManagementGroup"), ("ASSETMANAGEMENT-MIB", "trapInformationGroup"), ("ASSETMANAGEMENT-MIB", "trapsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): complianceRev2 = complianceRev2.setStatus('current') if mibBuilder.loadTexts: complianceRev2.setDescription('The requirements for conformance to the ASSETMANAGEMENT-MIB.') configGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 1)).setObjects(("ASSETMANAGEMENT-MIB", "defaultLEDColorConnected"), ("ASSETMANAGEMENT-MIB", "defaultLEDColorConnectedStr"), ("ASSETMANAGEMENT-MIB", "defaultLEDColorDisconnected"), ("ASSETMANAGEMENT-MIB", "defaultLEDColorDisconnectedStr")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup = configGroup.setStatus('deprecated') if mibBuilder.loadTexts: configGroup.setDescription('A collection of objects representing configuration data. ') configGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 5)).setObjects(("ASSETMANAGEMENT-MIB", "assetStripCount"), ("ASSETMANAGEMENT-MIB", "assetStripState"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitCount"), ("ASSETMANAGEMENT-MIB", "rackUnitNumberingMode"), ("ASSETMANAGEMENT-MIB", "rackUnitNumberingOffset"), ("ASSETMANAGEMENT-MIB", "assetStripOrientation"), ("ASSETMANAGEMENT-MIB", "currentMainTagCount"), ("ASSETMANAGEMENT-MIB", "currentBladeTagCount"), ("ASSETMANAGEMENT-MIB", "maxMainTagCount"), ("ASSETMANAGEMENT-MIB", "maxBladeTagCount"), ("ASSETMANAGEMENT-MIB", "bladeExtensionOverflow"), ("ASSETMANAGEMENT-MIB", "assetStripType"), ("ASSETMANAGEMENT-MIB", "numberOfComponentAssetStrips"), ("ASSETMANAGEMENT-MIB", "assetStripDefaultLEDColorConnected"), ("ASSETMANAGEMENT-MIB", "assetStripDefaultLEDColorConnectedStr"), ("ASSETMANAGEMENT-MIB", "assetStripDefaultLEDColorDisconnected"), ("ASSETMANAGEMENT-MIB", "assetStripDefaultLEDColorDisconnectedStr")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup2 = configGroup2.setStatus('current') if mibBuilder.loadTexts: configGroup2.setDescription('A collection of objects representing configuration data.') assetManagementGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 2)).setObjects(("ASSETMANAGEMENT-MIB", "ledOperationMode"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledColorStr"), ("ASSETMANAGEMENT-MIB", "tagID"), ("ASSETMANAGEMENT-MIB", "bladeTagID"), ("ASSETMANAGEMENT-MIB", "tagFamily"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitType"), ("ASSETMANAGEMENT-MIB", "bladeExtensionSize"), ("ASSETMANAGEMENT-MIB", "bladeSlotPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "assetStripCascadePosition"), ("ASSETMANAGEMENT-MIB", "rackUnitRelativePosition"), ("ASSETMANAGEMENT-MIB", "assetStripNumberOfRackUnits")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): assetManagementGroup = assetManagementGroup.setStatus('current') if mibBuilder.loadTexts: assetManagementGroup.setDescription('A collection of objects providing the ability to control the asset management strip.') trapsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 3)).setObjects(("ASSETMANAGEMENT-MIB", "assetStripStateChange"), ("ASSETMANAGEMENT-MIB", "assetTagConnected"), ("ASSETMANAGEMENT-MIB", "assetTagDisconnected"), ("ASSETMANAGEMENT-MIB", "assetStripFirmwareUpdate"), ("ASSETMANAGEMENT-MIB", "deviceConfigurationChanged"), ("ASSETMANAGEMENT-MIB", "rackUnitConfigurationChanged"), ("ASSETMANAGEMENT-MIB", "bladeExtensionConnected"), ("ASSETMANAGEMENT-MIB", "bladeExtensionDisconnected"), ("ASSETMANAGEMENT-MIB", "bladeExtensionOverflowOccured"), ("ASSETMANAGEMENT-MIB", "bladeExtensionOverflowCleared"), ("ASSETMANAGEMENT-MIB", "compositeAssetStripCompositionChanged")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): trapsGroup = trapsGroup.setStatus('current') if mibBuilder.loadTexts: trapsGroup.setDescription('A collection of traps.') trapInformationGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 4)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "slotNumber"), ("ASSETMANAGEMENT-MIB", "assetStripFirmwareUpdateState"), ("ASSETMANAGEMENT-MIB", "deviceUserName"), ("ASSETMANAGEMENT-MIB", "deviceChangedParameter"), ("ASSETMANAGEMENT-MIB", "changedParameterNewValue"), ("ASSETMANAGEMENT-MIB", "oldNumberOfComponentAssetStrips"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): trapInformationGroup = trapInformationGroup.setStatus('current') if mibBuilder.loadTexts: trapInformationGroup.setDescription('A collection of objects providing information in the traps.') logGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 13742, 7, 2, 2, 6)).setObjects(("ASSETMANAGEMENT-MIB", "logSize"), ("ASSETMANAGEMENT-MIB", "oldestLogID"), ("ASSETMANAGEMENT-MIB", "newestLogID"), ("ASSETMANAGEMENT-MIB", "logEventCount"), ("ASSETMANAGEMENT-MIB", "logTimeStamp"), ("ASSETMANAGEMENT-MIB", "logEventType"), ("ASSETMANAGEMENT-MIB", "logAssetStripNumber"), ("ASSETMANAGEMENT-MIB", "logRackUnitNumber"), ("ASSETMANAGEMENT-MIB", "logRackUnitPosition"), ("ASSETMANAGEMENT-MIB", "logSlotNumber"), ("ASSETMANAGEMENT-MIB", "logTagID"), ("ASSETMANAGEMENT-MIB", "logAssetStripState"), ("ASSETMANAGEMENT-MIB", "logParentBladeID")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): logGroup = logGroup.setStatus('current') if mibBuilder.loadTexts: logGroup.setDescription('A collection of objects representing log data.') assetStripCount = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: assetStripCount.setStatus('current') if mibBuilder.loadTexts: assetStripCount.setDescription('The number of asset management strip units supported.') defaultLEDColorConnected = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 1, 2), RGBCOLOR()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultLEDColorConnected.setStatus('deprecated') if mibBuilder.loadTexts: defaultLEDColorConnected.setDescription('Default color of all LEDs (RGB) when a tag is connected during automatic operation; in binary format. This is deprecated in favor of assetStripDefaultLEDColorConnected For SET operations, the value will be applied to all asset strips For GET operations, the value returned will be the value corresponding to asset strip 1') defaultLEDColorConnectedStr = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultLEDColorConnectedStr.setStatus('deprecated') if mibBuilder.loadTexts: defaultLEDColorConnectedStr.setDescription('Default color of all LEDs (RGB) when a tag is connected during automatic operation; string with 3 hex octets This is deprecated in favor of assetStripDefaultLEDColorConnectedStr For SET operations, the value will be applied to all asset strips For GET operations, the value returned will be the value corresponding to asset strip 1') defaultLEDColorDisconnected = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 1, 4), RGBCOLOR()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultLEDColorDisconnected.setStatus('deprecated') if mibBuilder.loadTexts: defaultLEDColorDisconnected.setDescription('Default color of all LEDs (RGB) when no tag is connected during automatic operation; in binary format. This is deprecated in favor of assetStripDefaultLEDColorDisConnected For SET operations, the value will be applied to all asset strips For GET operations, the value returned will be the value corresponding to asset strip 1') defaultLEDColorDisconnectedStr = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 1, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: defaultLEDColorDisconnectedStr.setStatus('deprecated') if mibBuilder.loadTexts: defaultLEDColorDisconnectedStr.setDescription('Default color of all LEDs (RGB) when no tag is connected during automatic operation; string with 3 hex octets This is deprecated in favor of assetStripDefaultLEDColorDisconnectedStr For SET operations, the value will be applied to all asset strips For GET operations, the value returned will be the value corresponding to asset strip 1') assetStripConfigurationTable = MibTable((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1), ) if mibBuilder.loadTexts: assetStripConfigurationTable.setStatus('current') if mibBuilder.loadTexts: assetStripConfigurationTable.setDescription('A list of configuration entries. The number of entries is given by the value of assetStripCount.') assetStripConfigurationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1), ).setIndexNames((0, "ASSETMANAGEMENT-MIB", "assetStripID")) if mibBuilder.loadTexts: assetStripConfigurationEntry.setStatus('current') if mibBuilder.loadTexts: assetStripConfigurationEntry.setDescription('An entry containing configuration objects for a particular asset management strip unit.') assetStripID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))) if mibBuilder.loadTexts: assetStripID.setStatus('current') if mibBuilder.loadTexts: assetStripID.setDescription('A unique value for each asset strip. Its value ranges between 1 and the value of assetStripCount.') rackUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(8, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rackUnitCount.setStatus('current') if mibBuilder.loadTexts: rackUnitCount.setDescription('The number of rack-units for the asset management.') assetStripState = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 3), AssetStripStateEnumeration()).setMaxAccess("readonly") if mibBuilder.loadTexts: assetStripState.setStatus('current') if mibBuilder.loadTexts: assetStripState.setDescription('Asset management strip state.') assetStripName = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripName.setStatus('current') if mibBuilder.loadTexts: assetStripName.setDescription('Asset management strip name.') rackUnitNumberingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 5), RackUnitNumberingModeEnumeration()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rackUnitNumberingMode.setStatus('current') if mibBuilder.loadTexts: rackUnitNumberingMode.setDescription('The rack unit nmbering mode for this asset strip.') rackUnitNumberingOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rackUnitNumberingOffset.setStatus('current') if mibBuilder.loadTexts: rackUnitNumberingOffset.setDescription('The offset (starting value) for rack Unit Numbering; This takes care of the case in which the asset strip is monitoring not all the assets but a subset of it, starting from racknumberingOffset. For example, the asset strip may be monitoring assets from 10 through 26; default value is 1 ') assetStripOrientation = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 7), AssetStripOrientationEnumeration()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripOrientation.setStatus('current') if mibBuilder.loadTexts: assetStripOrientation.setDescription('Is the asset strip oriented such that the connector is at the top or the bottom? If the asset strip has a tilt sensor, then this varaible is read-only and an to set(write) it will result in an error. If the asset strip does not have a tilt sensor, then this variable is read-write ') currentMainTagCount = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentMainTagCount.setStatus('current') if mibBuilder.loadTexts: currentMainTagCount.setDescription('Number of tags currently connected to the main strip.') currentBladeTagCount = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: currentBladeTagCount.setStatus('current') if mibBuilder.loadTexts: currentBladeTagCount.setDescription('Number of tags currently connected to blade extensions. This may be larger than the maxBladeTagCount. In this case an overflow occured and all tags over maxBladeTagCount are not recognized.') maxMainTagCount = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: maxMainTagCount.setStatus('current') if mibBuilder.loadTexts: maxMainTagCount.setDescription('Maximum number of tags on the main asset strip.') maxBladeTagCount = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: maxBladeTagCount.setStatus('current') if mibBuilder.loadTexts: maxBladeTagCount.setDescription('Maximum number of blade tags supported.') bladeExtensionOverflow = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 12), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: bladeExtensionOverflow.setStatus('current') if mibBuilder.loadTexts: bladeExtensionOverflow.setDescription("Set if the maximum number of supported tags on blade extensions is reached. When this flag is set, new tags on blade extensions won't be discovered anymore until other tags on blade extensions are removed.") assetStripType = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 13), AssetStripTypeEnumeration()).setMaxAccess("readonly") if mibBuilder.loadTexts: assetStripType.setStatus('current') if mibBuilder.loadTexts: assetStripType.setDescription('The asset strip type.') numberOfComponentAssetStrips = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: numberOfComponentAssetStrips.setStatus('current') if mibBuilder.loadTexts: numberOfComponentAssetStrips.setDescription('The number of components building a composite asset strip.') assetStripDefaultLEDColorConnected = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 15), RGBCOLOR()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripDefaultLEDColorConnected.setStatus('current') if mibBuilder.loadTexts: assetStripDefaultLEDColorConnected.setDescription('Default color of all LEDs (RGB) when a tag is connected during automatic operation; in binary format.') assetStripDefaultLEDColorConnectedStr = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 16), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripDefaultLEDColorConnectedStr.setStatus('current') if mibBuilder.loadTexts: assetStripDefaultLEDColorConnectedStr.setDescription('Default color of all LEDs (RGB) when a tag is connected during automatic operation; string with 3 hex octets') assetStripDefaultLEDColorDisconnected = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 17), RGBCOLOR()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripDefaultLEDColorDisconnected.setStatus('current') if mibBuilder.loadTexts: assetStripDefaultLEDColorDisconnected.setDescription('Default color of all LEDs (RGB) when no tag is connected during automatic operation; in binary format.') assetStripDefaultLEDColorDisconnectedStr = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 6, 1, 1, 18), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: assetStripDefaultLEDColorDisconnectedStr.setStatus('current') if mibBuilder.loadTexts: assetStripDefaultLEDColorDisconnectedStr.setDescription('Default color of all LEDs (RGB) when no tag is connected during automatic operation; string with 3 hex octets') assetManagementTable = MibTable((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1), ) if mibBuilder.loadTexts: assetManagementTable.setStatus('current') if mibBuilder.loadTexts: assetManagementTable.setDescription('A list of asset management extries containing tag information and LED state. The number of entries is given by the value of rackUnitCount.') assetManagementEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1), ).setIndexNames((0, "ASSETMANAGEMENT-MIB", "assetStripID"), (0, "ASSETMANAGEMENT-MIB", "rackUnitID")) if mibBuilder.loadTexts: assetManagementEntry.setStatus('current') if mibBuilder.loadTexts: assetManagementEntry.setDescription('An entry containing tag information and LED state for a rack unit.') rackUnitID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))) if mibBuilder.loadTexts: rackUnitID.setStatus('current') if mibBuilder.loadTexts: rackUnitID.setDescription('A unique value for each rack unit. Its value ranges between 1 and the value of rackUnitCount.') ledOperationMode = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 2), AssetManagementLEDOperationModeEnumeration()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ledOperationMode.setStatus('current') if mibBuilder.loadTexts: ledOperationMode.setDescription('Operation mode of the LED (manual or automatic, based on tag connection).') ledMode = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 3), AssetManagementLEDModeEnumeration()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ledMode.setStatus('current') if mibBuilder.loadTexts: ledMode.setDescription('Mode of the LED (on, off, fastBlink,slowBlink). Setting this value automatically switches the ledOperationMode to manual.') ledColor = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 4), RGBCOLOR()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ledColor.setStatus('current') if mibBuilder.loadTexts: ledColor.setDescription('Color of the LED (RGB) in binary format. Setting this value automatically switches the ledOperationMode to manual.') ledColorStr = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ledColorStr.setStatus('current') if mibBuilder.loadTexts: ledColorStr.setDescription('Color of the LED (RGB) in string format. It contains 3 hex octets for the RGB colors. Setting this value automatically switches the ledOperationMode to manual.') tagID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: tagID.setStatus('current') if mibBuilder.loadTexts: tagID.setDescription('Asset management tag attached to the rack unit. Empty in case there is no tag attached.') tagFamily = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: tagFamily.setStatus('current') if mibBuilder.loadTexts: tagFamily.setDescription('Family of the asset management tag attached to the rack unit. Empty in case there is no tag attached.') rackUnitPosition = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: rackUnitPosition.setStatus('current') if mibBuilder.loadTexts: rackUnitPosition.setDescription('A number associated with each rack unit. Its value depends on the rack unit numbering mode. It ranges between 1 and the value of rackUnitCount. If the asset strip is disconnected, then the value is 0.') rackUnitType = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 9), RackUnitTypeEnumeration()).setMaxAccess("readonly") if mibBuilder.loadTexts: rackUnitType.setStatus('current') if mibBuilder.loadTexts: rackUnitType.setDescription('Type of the connected tag (single server or blade extension). If the asset strip is disconnected, then the value is unknown. If the asset tag is disconnected, then the value is none.') bladeExtensionSize = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: bladeExtensionSize.setStatus('current') if mibBuilder.loadTexts: bladeExtensionSize.setDescription('In case a blade extension is connected this returns the number of slots on the extension. If the asset strip is disconnected or no blade is connected, then the value is 0.') rackUnitName = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 12), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rackUnitName.setStatus('current') if mibBuilder.loadTexts: rackUnitName.setDescription('Name for a specific rackunit, may be feeely chosen.') assetStripCascadePosition = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99))).setMaxAccess("readonly") if mibBuilder.loadTexts: assetStripCascadePosition.setStatus('current') if mibBuilder.loadTexts: assetStripCascadePosition.setDescription('This is the position of the asset Strip in a cascaded chain. Numbered in ascending order starting with the asset strip connected to the device (EMX/PX). For non-cascaded asset strips, value = 1') rackUnitRelativePosition = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 99))).setMaxAccess("readonly") if mibBuilder.loadTexts: rackUnitRelativePosition.setStatus('current') if mibBuilder.loadTexts: rackUnitRelativePosition.setDescription('This is the relative position of the rackUnit within the assetStrip. For cascaded asset strips such as the AMS-M2-Z and AMS-M3-Z, it is numbered in ascending order starting with the rackunit closest to the asset strip edge with the connector. For non-cascaded asset strips, value = 1') assetStripNumberOfRackUnits = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: assetStripNumberOfRackUnits.setStatus('current') if mibBuilder.loadTexts: assetStripNumberOfRackUnits.setDescription(' For non-cascaded asset strips, value = rackUnitCount For cascaded asset strips, it is the number of rack units in the asset Strip. Examples: 2 forAMS-M2-Z, 3 for AMS-M3-Z. ') bladeExtensionTable = MibTable((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 2), ) if mibBuilder.loadTexts: bladeExtensionTable.setStatus('current') if mibBuilder.loadTexts: bladeExtensionTable.setDescription('A list of blade server extension entries containing tag information.') bladeExtensionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 2, 1), ).setIndexNames((0, "ASSETMANAGEMENT-MIB", "assetStripID"), (0, "ASSETMANAGEMENT-MIB", "rackUnitID"), (0, "ASSETMANAGEMENT-MIB", "bladeSlotID")) if mibBuilder.loadTexts: bladeExtensionEntry.setStatus('current') if mibBuilder.loadTexts: bladeExtensionEntry.setDescription('An entry containing tag information for a blade server extension.') bladeSlotID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))) if mibBuilder.loadTexts: bladeSlotID.setStatus('current') if mibBuilder.loadTexts: bladeSlotID.setDescription('A unique value for each slot on a blade extension.') bladeTagID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 2, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: bladeTagID.setStatus('current') if mibBuilder.loadTexts: bladeTagID.setDescription('Asset management tag attached to a blade extension at the rack unit. Empty in case there is no tag attached.') bladeSlotPosition = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 1, 7, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: bladeSlotPosition.setStatus('current') if mibBuilder.loadTexts: bladeSlotPosition.setDescription('A number associated with each blade slot. It ranges between 1 and the value of bladeExtensionSize.') logConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 13742, 7, 3, 1)) logSize = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: logSize.setStatus('current') if mibBuilder.loadTexts: logSize.setDescription('The number of entries in the asset management log table.') oldestLogID = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oldestLogID.setStatus('current') if mibBuilder.loadTexts: oldestLogID.setDescription('The index of the oldest entry in the log table.') newestLogID = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: newestLogID.setStatus('current') if mibBuilder.loadTexts: newestLogID.setDescription('The index of the newest entry in the log table.') logEventCount = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 3, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: logEventCount.setStatus('current') if mibBuilder.loadTexts: logEventCount.setDescription('The total number of logged events.') assetManagementLogTable = MibTable((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2), ) if mibBuilder.loadTexts: assetManagementLogTable.setStatus('current') if mibBuilder.loadTexts: assetManagementLogTable.setDescription('A ring buffer containing asset management events.') assetManagementLogEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1), ).setIndexNames((0, "ASSETMANAGEMENT-MIB", "logIndex")) if mibBuilder.loadTexts: assetManagementLogEntry.setStatus('current') if mibBuilder.loadTexts: assetManagementLogEntry.setDescription('An entry in the asset management log table.') logIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5000))) if mibBuilder.loadTexts: logIndex.setStatus('current') if mibBuilder.loadTexts: logIndex.setDescription('The index of an entry in the log ring buffer. Its value ranges between 1 and logSize.') logTimeStamp = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: logTimeStamp.setStatus('current') if mibBuilder.loadTexts: logTimeStamp.setDescription('The time of the log entry in seconds relative to January 1, 1970 00:00 UTC.') logEventType = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 3), LogEventTypeEnumeration()).setMaxAccess("readonly") if mibBuilder.loadTexts: logEventType.setStatus('current') if mibBuilder.loadTexts: logEventType.setDescription('The type of this log entry.') logAssetStripNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: logAssetStripNumber.setStatus('current') if mibBuilder.loadTexts: logAssetStripNumber.setDescription('A unique value for each asset strip. Its value ranges between 1 and the value of assetStripCount.') logRackUnitNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: logRackUnitNumber.setStatus('current') if mibBuilder.loadTexts: logRackUnitNumber.setDescription('A unique value for each rack unit. Its value ranges between 1 and the value of rackUnitCount. It corresponds with rackUnitID, the fixed ordinal index of each rack unit.') logRackUnitPosition = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 256))).setMaxAccess("readonly") if mibBuilder.loadTexts: logRackUnitPosition.setStatus('current') if mibBuilder.loadTexts: logRackUnitPosition.setDescription('A number associated with each rack unit. Its value depends on the rack unit numbering mode. It ranges between 1 and the value of rackUnitCount. If the asset strip is disconnected, then the value is 0.') logSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: logSlotNumber.setStatus('current') if mibBuilder.loadTexts: logSlotNumber.setDescription('A unique value for each slot on a blade extension. Value of 0 indicates a tag on the main strip. If the asset strip is disconnected, the value is 0 as well. Use logEventType to distinguish the validity.') logTagID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: logTagID.setStatus('current') if mibBuilder.loadTexts: logTagID.setDescription('Asset management tag attached to the rack unit. Empty in case there is no tag attached.') logAssetStripState = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 9), AssetStripStateEnumeration()).setMaxAccess("readonly") if mibBuilder.loadTexts: logAssetStripState.setStatus('current') if mibBuilder.loadTexts: logAssetStripState.setDescription('Asset management strip state.') logParentBladeID = MibTableColumn((1, 3, 6, 1, 4, 1, 13742, 7, 3, 2, 1, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: logParentBladeID.setStatus('current') if mibBuilder.loadTexts: logParentBladeID.setDescription('In case the tag is attached to a blade extension, this indicates the tagID of the extension. Empty in case there is no tag attached or the tag is attached on the main strip.') deviceName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceName.setStatus('current') if mibBuilder.loadTexts: deviceName.setDescription('The user-defined name for the Device.') deviceInetAddressType = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 2), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceInetAddressType.setStatus('current') if mibBuilder.loadTexts: deviceInetAddressType.setDescription('The type of address format') deviceInetIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 3), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceInetIPAddress.setStatus('current') if mibBuilder.loadTexts: deviceInetIPAddress.setDescription('The current IP address. A value of 0.0.0.0 indicates an error or an unset option.') assetStripNumber = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: assetStripNumber.setStatus('current') if mibBuilder.loadTexts: assetStripNumber.setDescription('A unique value for each asset strip. Its value ranges between 1 and the value of assetStripCount.') rackUnitNumber = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 256))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: rackUnitNumber.setStatus('current') if mibBuilder.loadTexts: rackUnitNumber.setDescription('A unique value for each rack unit. Its value ranges between 1 and the value of rackUnitCount. It corresponds with rackUnitID, the fixed ordinal index of each rack unit.') assetStripFirmwareUpdateState = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 6), AssetStripFirmwareUpdateStateEnumeration()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: assetStripFirmwareUpdateState.setStatus('current') if mibBuilder.loadTexts: assetStripFirmwareUpdateState.setDescription('The new asset strip firmware update state.') deviceUserName = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceUserName.setStatus('current') if mibBuilder.loadTexts: deviceUserName.setDescription('The user currently logged in.') deviceChangedParameter = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 8), DeviceConfigurationParameterEnumeration()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: deviceChangedParameter.setStatus('current') if mibBuilder.loadTexts: deviceChangedParameter.setDescription('Description of the parameter(s) that changed. ') changedParameterNewValue = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 9), DisplayString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: changedParameterNewValue.setStatus('current') if mibBuilder.loadTexts: changedParameterNewValue.setDescription('The new value of the changed parameter.') slotNumber = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: slotNumber.setStatus('current') if mibBuilder.loadTexts: slotNumber.setDescription('A unique value for each slot on a blade extension. Value of 0 indicates a tag on the main strip.') oldNumberOfComponentAssetStrips = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: oldNumberOfComponentAssetStrips.setStatus('current') if mibBuilder.loadTexts: oldNumberOfComponentAssetStrips.setDescription('The old number of components building a composite asset strip.') agentInetPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 13742, 7, 0, 0, 12), InetPortNumber()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: agentInetPortNumber.setStatus('current') if mibBuilder.loadTexts: agentInetPortNumber.setDescription('The UDP port number used for accessing the SNMP agent on the device. Examples: If the associated device MIB (PX2-MIB, EMD-MIB) has deviceCascadeType set to portForwarding, then master: 50500 slave 1:50501 slave 2: 50502 ...... If cascading mode is not portForwarding and default (Standard) ports are being used, then port: 161 ') assetTagConnected = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 1)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "slotNumber"), ("ASSETMANAGEMENT-MIB", "tagID"), ("ASSETMANAGEMENT-MIB", "bladeTagID"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledOperationMode"), ("ASSETMANAGEMENT-MIB", "rackUnitCount"), ("ASSETMANAGEMENT-MIB", "assetStripType"), ("ASSETMANAGEMENT-MIB", "assetStripCascadePosition"), ("ASSETMANAGEMENT-MIB", "rackUnitRelativePosition"), ("ASSETMANAGEMENT-MIB", "assetStripNumberOfRackUnits")) if mibBuilder.loadTexts: assetTagConnected.setStatus('current') if mibBuilder.loadTexts: assetTagConnected.setDescription('The asset tag of a rack unit was connected. bladeTagID is empty if the asset tag is not on a blade extension.') assetTagDisconnected = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 2)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "slotNumber"), ("ASSETMANAGEMENT-MIB", "tagID"), ("ASSETMANAGEMENT-MIB", "bladeTagID"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledOperationMode"), ("ASSETMANAGEMENT-MIB", "rackUnitCount"), ("ASSETMANAGEMENT-MIB", "assetStripType"), ("ASSETMANAGEMENT-MIB", "assetStripCascadePosition"), ("ASSETMANAGEMENT-MIB", "rackUnitRelativePosition"), ("ASSETMANAGEMENT-MIB", "assetStripNumberOfRackUnits")) if mibBuilder.loadTexts: assetTagDisconnected.setStatus('current') if mibBuilder.loadTexts: assetTagDisconnected.setDescription('The asset tag of a rack unit was disconnected. bladeTagID is empty if the asset tag is not on a blade extension.') assetStripStateChange = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 3)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "assetStripState"), ("ASSETMANAGEMENT-MIB", "rackUnitCount")) if mibBuilder.loadTexts: assetStripStateChange.setStatus('current') if mibBuilder.loadTexts: assetStripStateChange.setDescription('The asset strip unit changed its state.') assetStripFirmwareUpdate = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 4)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "assetStripFirmwareUpdateState")) if mibBuilder.loadTexts: assetStripFirmwareUpdate.setStatus('current') if mibBuilder.loadTexts: assetStripFirmwareUpdate.setDescription('Asset strip firmware update state change.') deviceConfigurationChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 5)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "deviceUserName"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "deviceChangedParameter"), ("ASSETMANAGEMENT-MIB", "changedParameterNewValue")) if mibBuilder.loadTexts: deviceConfigurationChanged.setStatus('current') if mibBuilder.loadTexts: deviceConfigurationChanged.setDescription('Assetstrip configuration has changed') rackUnitConfigurationChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 6)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "deviceUserName"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledOperationMode")) if mibBuilder.loadTexts: rackUnitConfigurationChanged.setStatus('current') if mibBuilder.loadTexts: rackUnitConfigurationChanged.setDescription('Assetstrip configuration has changed') bladeExtensionConnected = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 7)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "tagID"), ("ASSETMANAGEMENT-MIB", "bladeExtensionSize"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledOperationMode"), ("ASSETMANAGEMENT-MIB", "rackUnitCount"), ("ASSETMANAGEMENT-MIB", "assetStripType"), ("ASSETMANAGEMENT-MIB", "assetStripCascadePosition"), ("ASSETMANAGEMENT-MIB", "rackUnitRelativePosition"), ("ASSETMANAGEMENT-MIB", "assetStripNumberOfRackUnits")) if mibBuilder.loadTexts: bladeExtensionConnected.setStatus('current') if mibBuilder.loadTexts: bladeExtensionConnected.setDescription('A blade extension has been connected to the rackunit.') bladeExtensionDisconnected = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 8)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "rackUnitNumber"), ("ASSETMANAGEMENT-MIB", "rackUnitPosition"), ("ASSETMANAGEMENT-MIB", "rackUnitName"), ("ASSETMANAGEMENT-MIB", "tagID"), ("ASSETMANAGEMENT-MIB", "bladeExtensionSize"), ("ASSETMANAGEMENT-MIB", "ledColor"), ("ASSETMANAGEMENT-MIB", "ledMode"), ("ASSETMANAGEMENT-MIB", "ledOperationMode"), ("ASSETMANAGEMENT-MIB", "rackUnitCount"), ("ASSETMANAGEMENT-MIB", "assetStripType"), ("ASSETMANAGEMENT-MIB", "assetStripCascadePosition"), ("ASSETMANAGEMENT-MIB", "rackUnitRelativePosition"), ("ASSETMANAGEMENT-MIB", "assetStripNumberOfRackUnits")) if mibBuilder.loadTexts: bladeExtensionDisconnected.setStatus('current') if mibBuilder.loadTexts: bladeExtensionDisconnected.setDescription('A blade extension has been disconnected from the rackunit.') bladeExtensionOverflowOccured = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 9)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName")) if mibBuilder.loadTexts: bladeExtensionOverflowOccured.setStatus('current') if mibBuilder.loadTexts: bladeExtensionOverflowOccured.setDescription("Maximum number of supported tags on blade extension was reached. The asset strip won't detect any new tags on blade extensions until some are removed.") bladeExtensionOverflowCleared = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 10)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName")) if mibBuilder.loadTexts: bladeExtensionOverflowCleared.setStatus('current') if mibBuilder.loadTexts: bladeExtensionOverflowCleared.setDescription('Free space for new tags on blade extensions is available again.') compositeAssetStripCompositionChanged = NotificationType((1, 3, 6, 1, 4, 1, 13742, 7, 0, 11)).setObjects(("ASSETMANAGEMENT-MIB", "deviceName"), ("SNMPv2-MIB", "sysContact"), ("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("ASSETMANAGEMENT-MIB", "deviceInetAddressType"), ("ASSETMANAGEMENT-MIB", "deviceInetIPAddress"), ("ASSETMANAGEMENT-MIB", "agentInetPortNumber"), ("ASSETMANAGEMENT-MIB", "assetStripNumber"), ("ASSETMANAGEMENT-MIB", "assetStripName"), ("ASSETMANAGEMENT-MIB", "oldNumberOfComponentAssetStrips"), ("ASSETMANAGEMENT-MIB", "numberOfComponentAssetStrips")) if mibBuilder.loadTexts: compositeAssetStripCompositionChanged.setStatus('current') if mibBuilder.loadTexts: compositeAssetStripCompositionChanged.setDescription('The composition of an composite asset strip changed.') mibBuilder.exportSymbols("ASSETMANAGEMENT-MIB", bladeExtensionConnected=bladeExtensionConnected, logParentBladeID=logParentBladeID, assetManagement=assetManagement, assetStripFirmwareUpdate=assetStripFirmwareUpdate, assetStripDefaultLEDColorDisconnected=assetStripDefaultLEDColorDisconnected, deviceUserName=deviceUserName, compositeAssetStripCompositionChanged=compositeAssetStripCompositionChanged, compliances=compliances, assetStripConfigurationEntry=assetStripConfigurationEntry, logAssetStripNumber=logAssetStripNumber, rackUnitType=rackUnitType, rackUnitConfigurationChanged=rackUnitConfigurationChanged, assetStripDefaultLEDColorDisconnectedStr=assetStripDefaultLEDColorDisconnectedStr, logIndex=logIndex, assetManager=assetManager, assetStripNumberOfRackUnits=assetStripNumberOfRackUnits, assetStripName=assetStripName, defaultLEDColorDisconnectedStr=defaultLEDColorDisconnectedStr, AssetStripFirmwareUpdateStateEnumeration=AssetStripFirmwareUpdateStateEnumeration, rackUnitCount=rackUnitCount, numberOfComponentAssetStrips=numberOfComponentAssetStrips, assetTagConnected=assetTagConnected, configGroup2=configGroup2, traps=traps, LogEventTypeEnumeration=LogEventTypeEnumeration, oldestLogID=oldestLogID, logGroup=logGroup, rackUnitName=rackUnitName, ledMode=ledMode, assetManagementLogEntry=assetManagementLogEntry, trapInformationGroup=trapInformationGroup, complianceRev2=complianceRev2, currentMainTagCount=currentMainTagCount, currentBladeTagCount=currentBladeTagCount, bladeExtensionDisconnected=bladeExtensionDisconnected, logEventCount=logEventCount, conformance=conformance, maxMainTagCount=maxMainTagCount, bladeSlotID=bladeSlotID, logSize=logSize, bladeExtensionOverflow=bladeExtensionOverflow, defaultLEDColorConnectedStr=defaultLEDColorConnectedStr, raritan=raritan, assetManagementLogTable=assetManagementLogTable, ledOperationMode=ledOperationMode, assetManagementGroup=assetManagementGroup, AssetManagementLEDModeEnumeration=AssetManagementLEDModeEnumeration, RackUnitNumberingModeEnumeration=RackUnitNumberingModeEnumeration, bladeSlotPosition=bladeSlotPosition, configuration=configuration, assetStripStateChange=assetStripStateChange, defaultLEDColorConnected=defaultLEDColorConnected, assetStripID=assetStripID, assetStripType=assetStripType, tagFamily=tagFamily, logRackUnitNumber=logRackUnitNumber, deviceInetIPAddress=deviceInetIPAddress, rackUnitNumberingOffset=rackUnitNumberingOffset, assetStripConfigurationTable=assetStripConfigurationTable, assetStripState=assetStripState, assetManagementTable=assetManagementTable, assetTagDisconnected=assetTagDisconnected, configGroup=configGroup, assetStrip=assetStrip, slotNumber=slotNumber, log=log, assetStripDefaultLEDColorConnectedStr=assetStripDefaultLEDColorConnectedStr, logTimeStamp=logTimeStamp, deviceName=deviceName, logSlotNumber=logSlotNumber, RackUnitTypeEnumeration=RackUnitTypeEnumeration, trapsGroup=trapsGroup, AssetStripTypeEnumeration=AssetStripTypeEnumeration, assetStripDefaultLEDColorConnected=assetStripDefaultLEDColorConnected, tagID=tagID, logAssetStripState=logAssetStripState, PYSNMP_MODULE_ID=raritan, trapInformation=trapInformation, logEventType=logEventType, bladeTagID=bladeTagID, rackUnitID=rackUnitID, deviceInetAddressType=deviceInetAddressType, bladeExtensionEntry=bladeExtensionEntry, rackUnitNumberingMode=rackUnitNumberingMode, bladeExtensionSize=bladeExtensionSize, logConfiguration=logConfiguration, bladeExtensionOverflowOccured=bladeExtensionOverflowOccured, newestLogID=newestLogID, deviceConfigurationChanged=deviceConfigurationChanged, rackUnitRelativePosition=rackUnitRelativePosition, assetStripCascadePosition=assetStripCascadePosition, agentInetPortNumber=agentInetPortNumber, maxBladeTagCount=maxBladeTagCount, assetStripOrientation=assetStripOrientation, logTagID=logTagID, rackUnitNumber=rackUnitNumber, RGBCOLOR=RGBCOLOR, assetStripNumber=assetStripNumber, bladeExtensionTable=bladeExtensionTable, ledColor=ledColor, oldNumberOfComponentAssetStrips=oldNumberOfComponentAssetStrips, deviceChangedParameter=deviceChangedParameter, defaultLEDColorDisconnected=defaultLEDColorDisconnected, changedParameterNewValue=changedParameterNewValue, complianceRev1=complianceRev1, logRackUnitPosition=logRackUnitPosition, AssetStripOrientationEnumeration=AssetStripOrientationEnumeration, assetStripFirmwareUpdateState=assetStripFirmwareUpdateState, groups=groups, rackUnitPosition=rackUnitPosition, AssetManagementLEDOperationModeEnumeration=AssetManagementLEDOperationModeEnumeration, assetStripCount=assetStripCount, assetManagementEntry=assetManagementEntry, DeviceConfigurationParameterEnumeration=DeviceConfigurationParameterEnumeration, ledColorStr=ledColorStr, bladeExtensionOverflowCleared=bladeExtensionOverflowCleared, AssetStripStateEnumeration=AssetStripStateEnumeration)
[ 2, 198, 2, 9485, 15571, 7378, 337, 9865, 8265, 24994, 2767, 10725, 4760, 12529, 12, 8895, 33, 357, 4023, 1378, 16184, 76, 489, 8937, 13, 785, 14, 79, 893, 11632, 8, 198, 2, 7054, 45, 13, 16, 2723, 2393, 1378, 14, 14490, 14, 67, ...
3.148142
18,543
# Import the Secret Manager client library. from google.cloud import secretmanager # Create the Secret Manager client. secretmanager_client = secretmanager.SecretManagerServiceClient()
[ 2, 17267, 262, 3943, 9142, 5456, 5888, 13, 198, 6738, 23645, 13, 17721, 1330, 3200, 37153, 198, 198, 2, 13610, 262, 3943, 9142, 5456, 13, 198, 21078, 37153, 62, 16366, 796, 3200, 37153, 13, 23725, 13511, 16177, 11792, 3419 ]
4.74359
39
from imports import * ban_plugin = lightbulb.Plugin("moderation.ban") ban_plugin.add_checks( lightbulb.checks.guild_only, lightbulb.checks.bot_has_guild_permissions(hikari.Permissions.BAN_MEMBERS), lightbulb.checks.has_guild_permissions(hikari.Permissions.BAN_MEMBERS), )
[ 6738, 17944, 1330, 1635, 198, 198, 3820, 62, 33803, 796, 1657, 15065, 65, 13, 37233, 7203, 4666, 263, 341, 13, 3820, 4943, 198, 198, 3820, 62, 33803, 13, 2860, 62, 42116, 7, 198, 220, 220, 220, 1657, 15065, 65, 13, 42116, 13, 70, ...
2.416667
120
import unittest from trend_analyze.config import * from trend_analyze.src.model import * from trend_analyze.src.fetch_data_from_api import ApiTwitterFetcher if __name__ == '__main__': unittest.main()
[ 11748, 555, 715, 395, 198, 198, 6738, 5182, 62, 38200, 2736, 13, 11250, 1330, 1635, 198, 6738, 5182, 62, 38200, 2736, 13, 10677, 13, 19849, 1330, 1635, 198, 6738, 5182, 62, 38200, 2736, 13, 10677, 13, 69, 7569, 62, 7890, 62, 6738, 6...
2.773333
75
# https://leetcode.com/problems/compare-version-numbers/ # # Compare two version numbers version1 and version2. # If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. # # You may assume that the version strings are non-empty and contain only digits and the . character. # The . character does not represent a decimal point and is used to separate number sequences. # For instance, 2.5 is not "two and a half" or "half way to version three", # it is the fifth second-level revision of the second first-level revision. # # Here is an example of version numbers ordering: # 0.1 < 1.1 < 1.2 < 13.37 # # Credits: # Special thanks to @ts for adding this problem and creating all test cases.
[ 2, 3740, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14, 5589, 533, 12, 9641, 12, 77, 17024, 14, 198, 2, 198, 2, 27814, 734, 2196, 3146, 2196, 16, 290, 2196, 17, 13, 198, 2, 1002, 2196, 16, 1875, 2196, 17, 1441, 352, 11, 6...
3.631313
198
from datetime import datetime from config import CIDR_MAX_SUBNETS
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 6738, 4566, 1330, 327, 2389, 49, 62, 22921, 62, 50, 10526, 12884, 50, 628 ]
3.090909
22
"""Main module.""" from config import * import os import re from threading import Thread import requests from urllib.parse import unquote from bs4 import BeautifulSoup from m3u8downloader.main import M3u8Downloader from selenium import webdriver from selenium.webdriver.chrome.options import Options VIDEO_DICT = {} PATH = f'{PATH}{MODULE}/' if not os.path.exists(PATH): print('Creating directory at', PATH) os.makedirs(PATH) options = Options() if HEADLESS: options.add_argument("--headless") driver = webdriver.Chrome(PATH_TO_CHROMEDRIVER, options=options) if __name__ == '__main__': run()
[ 37811, 13383, 8265, 526, 15931, 198, 6738, 4566, 1330, 1635, 198, 198, 11748, 28686, 198, 11748, 302, 198, 6738, 4704, 278, 1330, 14122, 198, 198, 11748, 7007, 198, 6738, 2956, 297, 571, 13, 29572, 1330, 555, 22708, 198, 6738, 275, 82, ...
2.897674
215
# -*- coding: utf-8 -*- """ This module allows Python's logging module and Esri's ArcMap tools to play nicely together. Everything here works with the root logger, there is currently no functionality to work with multiple loggers. The standard logging.basicConfig() doesn't work out of the box in ArcMap tools, because the logging session lives throughout the ArcMap session, and isn't restarted with every tool invocation. init_logging() can be used instead of basicConfig(), and takes care of this issue by performing the necessary (re)initialisations. Furthermore, flush_and_close_logger() should be called at the end of each script, to ensure that all output is flushed when the script terminates. For the same reason mentioned above, some logging output may be delayed otherwise. Finally, the ArcPyLogHandler class (mostly adopted from http://gis.stackexchange.com/questions/135920/arcpy-logging-error-messages) allows the logging module to send output to ArcMap's tool output window, using arcpy.AddMessage(), etc. TODO: - ArcPyLogHandler currently creates an empty file as given in input. If it isn't used, it shouldn't be created. Created by: Hanne L. Petersen <halpe@sdfe.dk> Created on: 2016-08-26 """ import os import socket import logging import logging.handlers import arcpy def init_logging(filename="log.txt", level=logging.INFO, fmt="", datefmt='%d-%m-%Y %H:%M', mode='a'): """ Initialise a useful logging session. For ArcMap tools, logging.basicConfig probably won't do what you want... (details below) Use fmt="%(asctime)s %(message)s" to log without user and computer name. If filename is a relative path, it will be relative to C:\Windows\System32 for tools called from an ArcMap toolbox. So just use absolute paths... Note that if you're using the logging module from inside ArcMap, e.g. from a tool in a toolbox, your logging session will survive within the ArcMap session! In addition, the logging.basicConfig() function is intended to be run only once ("only the first call will actually do anything: subsequent calls are effectively no-ops", from https://docs.python.org/2/howto/logging.html#logging-advanced-tutorial) I.e., you may have two tools that write to different log files - this won't work if you run both tools from the same ArcMap session, and you do it the naive way. Or if you run a tool several times inside the same ArcMap session, calling basicConfig WILL DO NOTHING. I.e. debugging sucks big time. In ArcMap you probably want to run flush_and_close_logger() at the end of your script, otherwise output can sometimes be delayed. Other format placeholders can be found in https://docs.python.org/2/library/logging.html#logrecord-attributes TODO: The proper way for this module might be something with inheritance or subclassing... """ # Some useful snippets for copy-pasting when debugging: # import logging # root_logger = logging.getLogger() # h = root_logger.handlers[0] # root_logger.removeHandler(h) # print([h.baseFilename for h in root_logger.handlers]) if fmt == '': # Default format prepend user name and computer name. # http://stackoverflow.com/questions/799767/getting-name-of-windows-computer-running-python-script?answertab=active#tab-top fmt = "%(asctime)s {} {} %(message)s".format(os.getenv('USERNAME'), socket.gethostname().upper()) root_logger = logging.getLogger() # Need to run regular basicConfig first - seems like it does something we need... # Whatever logging level is set to a restrictive level here, it will persist throughout (looks like a bug). # If it's set to a low level here (or NOTSET), it seems to work fine, respecting what's set later. # The filename is replaced properly later. logging.basicConfig(level=logging.NOTSET) # Start by removing all existing handlers from the root logger # Remove from the back, to avoid the indexes going haywire for i in range(len(root_logger.handlers)-1, -1, -1): root_logger.removeHandler(root_logger.handlers[i]) # Then set up the new handler with appropriate formatter # https://docs.python.org/2/library/logging.handlers.html#logging.FileHandler add_handler(logging.FileHandler(filename, mode=mode, encoding=None, delay=False), level=level) def add_handler(h, level=logging.INFO, fmt="", datefmt='%d-%m-%Y %H:%M'): """Add a handler.""" root_logger = logging.getLogger() if fmt == '': fmt = "%(asctime)s {} {} %(message)s".format(os.getenv('USERNAME'), socket.gethostname().upper()) # Prep the Formatter, and add it # https://docs.python.org/2/library/logging.html#logging.Formatter f = logging.Formatter(fmt, datefmt) # Add the level and formatter to the handler # https://docs.python.org/2/library/logging.handlers.html#logging.FileHandler # https://docs.python.org/2/library/logging.html#handler-objects h.setLevel(level) h.setFormatter(f) root_logger.addHandler(h) def flush_and_close_logger(): """From ArcMap there seem to be some problems with flushing, and this seems to help...""" for h in logging.getLogger().handlers: h.flush() logging.shutdown() def _logging_is_active(): """Check if a logging session has been initiated (e.g. with logging.basicConfig()).""" # http://stackoverflow.com/questions/26017073/how-to-get-filename-from-a-python-logger return len(logging.getLogger().handlers) > 0 # end class ArcPyLogHandler
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 201, 198, 37811, 201, 198, 1212, 8265, 3578, 11361, 338, 18931, 8265, 290, 8678, 380, 338, 10173, 13912, 4899, 284, 711, 16576, 1978, 13, 201, 198, 201, 198, 19693, 994, 2499...
2.997353
1,889
import os import re import discord from dotenv import load_dotenv load_dotenv() TOKEN = os.getenv("DISCORD_TOKEN") RENAME_REGEX = re.compile(r"^[Ii]'m (\w+)$") if TOKEN is None: raise RuntimeError("Bot TOKEN not set") client = discord.Client() client.run(TOKEN)
[ 11748, 28686, 198, 11748, 302, 198, 198, 11748, 36446, 198, 6738, 16605, 24330, 1330, 3440, 62, 26518, 24330, 198, 198, 2220, 62, 26518, 24330, 3419, 198, 10468, 43959, 796, 28686, 13, 1136, 24330, 7203, 26288, 34, 12532, 62, 10468, 43959...
2.522936
109
from datetime import datetime from decimal import Decimal from django.conf import settings from django.contrib.auth import get_user_model from django.shortcuts import render, redirect from django.http import HttpResponseRedirect, HttpResponse from django.views.generic import View, ListView from django.urls import reverse from django.contrib import messages from django.contrib.auth.decorators import login_required from django.utils import timezone from django.utils.timezone import localtime from rest_framework.views import APIView from rest_framework.response import Response from .models import Company, CompanyCMPRecord, InvestmentRecord, Transaction from .forms import StockTransactionForm, CompanyChangeForm from stock_bridge.mixins import LoginRequiredMixin, CountNewsMixin, AdminRequiredMixin User = get_user_model() START_TIME = timezone.make_aware(getattr(settings, 'START_TIME')) STOP_TIME = timezone.make_aware(getattr(settings, 'STOP_TIME')) class CompanyAdminCompanyUpdateView(AdminRequiredMixin, View): """ View for admin to change company's CMP """ class CompanyCMPCreateView(View): class CompanySelectionView(LoginRequiredMixin, CountNewsMixin, View): class CompanyCMPChartData(APIView): # used django rest framework authentication_classes = [] permission_classes = [] class CompanyTransactionView(LoginRequiredMixin, CountNewsMixin, View): class UserTransactionHistoryView(LoginRequiredMixin, CountNewsMixin, ListView): template_name = 'market/user_transaction_history.html'
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 32465, 1330, 4280, 4402, 198, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 1330, 651, 62, 7220, 62, 19849, 198, 6738, 42625, 14208, 13,...
3.571096
429
# coding=utf8 import os from tkinter import messagebox from tkinter import ttk from tkinter import * import tkinter as tk import database from tkinter import filedialog databaseName = 'dataBase.db' who = 0 currentUserID = 0 currentTable = 0 root = tk.Tk() root.title("") root.geometry("1750x500") root.resizable(False, False) var1 = IntVar() var2 = IntVar() var3 = IntVar() # region tables frame = ttk.Treeview(root) frame.place(relx=0.15, rely=0.05, relwidth=0.33, relheight=0.89) frame2 = ttk.Treeview(root) frame2.place(relx=0.65, rely=0.05, relwidth=0.33, relheight=0.89) frame["columns"] = ("ID", "", "", " ", "-") frame.column("#0", width=0, stretch=tk.NO) frame.column("ID", width=40, stretch=tk.NO) frame.column("", width=200, stretch=tk.NO) frame.column("", width=200, stretch=tk.NO) frame.column(" ", width=80, stretch=tk.NO) frame.column("-", width=50, stretch=tk.NO) frame.heading("ID", text="ID", anchor=tk.W) frame.heading("", text="", anchor=tk.W) frame.heading("", text="", anchor=tk.W) frame.heading(" ", text=" ", anchor=tk.W) frame.heading("-", text="-", anchor=tk.W) frame2["columns"] = ("ID", "", "", " ", "") frame2.column("#0", width=0, stretch=tk.NO) frame2.column("ID", width=40, stretch=tk.NO) frame2.column("", width=200, stretch=tk.NO) frame2.column("", width=150, stretch=tk.NO) frame2.column(" ", width=80, stretch=tk.NO) frame2.column("", width=100, stretch=tk.NO) frame2.heading("ID", text="ID", anchor=tk.W) frame2.heading("", text="", anchor=tk.W) frame2.heading("", text="", anchor=tk.W) frame2.heading(" ", text=" ", anchor=tk.W) frame2.heading("", text="", anchor=tk.W) # endregion # region UI l_frame = LabelFrame(root, relief=FLAT) l_frame.place(relx=0.025, rely=0.85, relwidth=0.12, relheight=0.14) button_add = tk.Button(root, text="", bg='#BDBDBD', command=lambda: add_book(), state='disabled') button_add.place(relx=0.045, rely=0.40, relwidth=0.1, relheight=0.05) button_del = tk.Button(root, text="", bg='#BDBDBD', command=lambda: del_book(), state='disabled') button_del.place(relx=0.045, rely=0.46, relwidth=0.1, relheight=0.05) button_give = tk.Button(root, text="-> ->", bg='#BDBDBD', command=lambda: replace_book("Library"), state='disabled') button_give.place(relx=0.52, rely=0.05, relwidth=0.1, relheight=0.05) button_take = tk.Button(root, text="<- <-", bg='#BDBDBD', command=lambda: replace_book("NotInLibrary"), state='disabled') button_take.place(relx=0.52, rely=0.11, relwidth=0.1, relheight=0.05) button_middle = tk.Button(root, text=" ", bg='#BDBDBD', command=lambda: fill_middle_time(), state='disabled') button_middle.place(relx=0.52, rely=0.32, relwidth=0.1, relheight=0.05) button_frequency = tk.Button(root, text=" ", bg='#BDBDBD', command=lambda: fill_frequency(), state='disabled') button_frequency.place(relx=0.52, rely=0.38, relwidth=0.1, relheight=0.05) button_onHand = tk.Button(root, text=" ", bg='#BDBDBD', command=lambda: fill_on_hand_table(), state='disabled') button_onHand.place(relx=0.52, rely=0.44, relwidth=0.1, relheight=0.05) button_sortID = tk.Button(root, text="ID", bg='#BDBDBD', command=lambda: sort_frame("ID"), state='disabled') button_sortID.place(relx=0.22, rely=0.945, relwidth=0.03, relheight=0.05) button_sortName = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame("Name"), state='disabled') button_sortName.place(relx=0.255, rely=0.945, relwidth=0.05, relheight=0.05) button_sortAuthor = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame("Author"), state='disabled') button_sortAuthor.place(relx=0.31, rely=0.945, relwidth=0.05, relheight=0.05) button_sortYear = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame("Year"), state='disabled') button_sortYear.place(relx=0.365, rely=0.945, relwidth=0.05, relheight=0.05) button_sortCount = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame("Count"), state='disabled') button_sortCount.place(relx=0.42, rely=0.945, relwidth=0.05, relheight=0.05) button_sortID2 = tk.Button(root, text="ID", bg='#BDBDBD', command=lambda: sort_frame2("ID"), state='disabled') button_sortID2.place(relx=0.72, rely=0.945, relwidth=0.03, relheight=0.05) button_sortName2 = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame2("Name"), state='disabled') button_sortName2.place(relx=0.755, rely=0.945, relwidth=0.05, relheight=0.05) button_sortAuthor2 = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame2("Author"), state='disabled') button_sortAuthor2.place(relx=0.81, rely=0.945, relwidth=0.05, relheight=0.05) button_sortYear2 = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame2("Year"), state='disabled') button_sortYear2.place(relx=0.865, rely=0.945, relwidth=0.05, relheight=0.05) button_sortCount2 = tk.Button(root, text="", bg='#BDBDBD', command=lambda: sort_frame2("takeID"), state='disabled') button_sortCount2.place(relx=0.92, rely=0.945, relwidth=0.06, relheight=0.05) button_plusOne = tk.Button(root, text="+1", bg='#BDBDBD', command=lambda: add_count(1), state='disabled') button_plusOne.place(relx=0.52, rely=0.6, relwidth=0.03, relheight=0.05) button_plusTwo = tk.Button(root, text="+2", bg='#BDBDBD', command=lambda: add_count(2), state='disabled') button_plusTwo.place(relx=0.555, rely=0.6, relwidth=0.03, relheight=0.05) button_plusFive = tk.Button(root, text="+5", bg='#BDBDBD', command=lambda: add_count(5), state='disabled') button_plusFive.place(relx=0.59, rely=0.6, relwidth=0.03, relheight=0.05) button_plusTen = tk.Button(root, text="+10", bg='#BDBDBD', command=lambda: add_count(10), state='disabled') button_plusTen.place(relx=0.52, rely=0.665, relwidth=0.03, relheight=0.05) button_plusFT = tk.Button(root, text="+15", bg='#BDBDBD', command=lambda: add_count(15), state='disabled') button_plusFT.place(relx=0.555, rely=0.665, relwidth=0.03, relheight=0.05) button_plusTwenty = tk.Button(root, text="+20", bg='#BDBDBD', command=lambda: add_count(20), state='disabled') button_plusTwenty.place(relx=0.59, rely=0.665, relwidth=0.03, relheight=0.05) button_refresh = tk.Button(root, text=" ", bg='#BDBDBD', command=lambda: (Exit(), fill_LibTable(), fill_on_hand_table()), state='normal') button_refresh.place(relx=0.52, rely=0.8, relwidth=0.1, relheight=0.05) button_connect = tk.Button(root, text=" ", bg='#BDBDBD', command=lambda: connect_to_database(), state='normal') button_connect.place(relx=0.52, rely=0.86, relwidth=0.1, relheight=0.05) button_enter = tk.Button(l_frame, text="", bg='#BDBDBD', command=lambda: login()) button_enter.place(relx=0, rely=-0.1, relwidth=0.48, relheight=0.5) button_reg = tk.Button(l_frame, text="", bg='#BDBDBD', command=lambda: reg()) button_reg.place(relx=0, rely=0.46, relwidth=1, relheight=0.4) button_exit = tk.Button(l_frame, text="", bg='#BDBDBD', command=lambda: Exit(), state='disabled') button_exit.place(relx=0.52, rely=-0.1, relwidth=0.48, relheight=0.5) entry_id = tk.Entry(root, font=12) entry_id.place(relx=0.045, rely=0.05, relwidth=0.1, relheight=0.05) entry_userId = tk.Entry(root, font=12) entry_userId.place(relx=0.025, rely=0.6, relwidth=0.1, relheight=0.05) entry_pass = tk.Entry(root, font=12) entry_pass.place(relx=0.025, rely=0.66, relwidth=0.1, relheight=0.05) entry_title = tk.Entry(root, font=12) entry_title.place(relx=0.045, rely=0.12, relwidth=0.1, relheight=0.05) entry_author = tk.Entry(root, font=12) entry_author.place(relx=0.045, rely=0.19, relwidth=0.1, relheight=0.05) entry_year = tk.Entry(root, font=12) entry_year.place(relx=0.045, rely=0.26, relwidth=0.1, relheight=0.05) entry_count = tk.Entry(root, font=12) entry_count.place(relx=0.045, rely=0.33, relwidth=0.1, relheight=0.05) label_id = tk.Label(root, font=12, text="Id:", fg='black') label_id.place(relx=0.023, rely=0.05) label_title = tk.Label(root, font=12, text=":", fg='black') label_title.place(relx=0.01, rely=0.12) label_author = tk.Label(root, font=12, text=":", fg='black') label_author.place(relx=0.005, rely=0.19) label_year = tk.Label(root, font=12, text=":", fg='black') label_year.place(relx=0.015, rely=0.26) label_count = tk.Label(root, font=12, text="-:", fg='black') label_count.place(relx=0.005, rely=0.33) label_sort = tk.Label(root, font=12, text=" :", fg='black') label_sort.place(relx=0.148, rely=0.945) label_sort2 = tk.Label(root, font=12, text=" :", fg='black') label_sort2.place(relx=0.647, rely=0.945) label_fill = tk.Label(root, font=12, text="", fg='black') label_fill.place(relx=0.52, rely=0.55, relwidth=0.1, relheight=0.05) label_func = tk.Label(root, font=12, text=" ", fg='black') label_func.place(relx=0.52, rely=0.27, relwidth=0.1, relheight=0.05) label_func = tk.Label(root, font=12, text=" ", fg='black') label_func.place(relx=0.036, rely=0.55) user = Checkbutton(root, font=12, text="", fg='black', variable=var1) user.place(relx=0.011, rely=0.72, relwidth=0.1, relheight=0.05) lib_worker = Checkbutton(root, font=12, text="", fg='black', variable=var2) lib_worker.place(relx=0.01, rely=0.76, relwidth=0.1, relheight=0.05) admin = Checkbutton(root, font=12, text="", fg='black', variable=var3) admin.place(relx=0.0195, rely=0.8, relwidth=0.05, relheight=0.05) fill_LibTable() # endregion if __name__ == "__main__": root.mainloop()
[ 2, 19617, 28, 40477, 23, 198, 11748, 28686, 198, 6738, 256, 74, 3849, 1330, 3275, 3524, 198, 6738, 256, 74, 3849, 1330, 256, 30488, 198, 6738, 256, 74, 3849, 1330, 1635, 198, 11748, 256, 74, 3849, 355, 256, 74, 198, 11748, 6831, 198...
2.276996
4,195
from datetime import datetime import numpy as np def add_basis_element(W): """ Given a D x d orthonormal matrix W (with d << D), it computes a new vector v that is orthogonal to all d columns of W and add it as an additional column. Return : D x (d+1) orthonormal matrix [W v] """ dim = W.shape[1] d = W.shape[0] v = np.random.randn(d) v = v / np.linalg.norm(v) u = np.zeros(v.shape) for i in range(dim): u = u - np.sum(W[:, i] * v) * W[:, i] v = (v - u).reshape(-1, 1) v = v / np.linalg.norm(v) return np.hstack([W, v])
[ 6738, 4818, 8079, 1330, 4818, 8079, 220, 198, 11748, 299, 32152, 355, 45941, 220, 628, 198, 4299, 751, 62, 12093, 271, 62, 30854, 7, 54, 2599, 198, 197, 37811, 198, 197, 15056, 257, 360, 2124, 288, 29617, 261, 6636, 17593, 370, 357, ...
2.270833
240
import numpy as np import pandas as pd ######################################################################################################################## # Load data ######################################################################################################################## print("Adapt TCGA: Loading data. Might take some time...") # TCGA gene expression matrix data = pd.read_csv('Data/Downstream_Tasks/TcgaTargetGtex_rsem_gene_tpm', sep='\t') # Load Ensembl Id conversion table conversion_table = pd.read_csv('Data/Downstream_Tasks/ensembl_names.txt', sep='\t') # Get list of landmark genes gene_info = pd.read_csv("Data/L1000_PhaseI/GSE92742_Broad_LINCS/GSE92742_Broad_LINCS_gene_info.txt", sep="\t") ######################################################################################################################## # Build conversion map ######################################################################################################################## print("Adapt TCGA: build conversion map") # Build name to ensembl dictionary name_to_ensembl_dict = {} for l in conversion_table.iterrows(): name_to_ensembl_dict[l[1]['Approved symbol']] = l[1]['Ensembl gene ID'] # Manually add landmark genes that are not in the ensembl ID table not_matched_dict = {"EPRS": "ENSG00000136628", "AARS": "ENSG00000090861", "TOMM70A": "ENSG00000154174", "KIAA0196": "ENSG00000164961", "KIAA0907": "ENSG00000132680", "PAPD7": "ENSG00000112941", "IKBKAP": "ENSG00000070061", "HIST2H2BE": "ENSG00000184678", "WRB": "ENSG00000182093", "KIAA0355": "ENSG00000166398", "TMEM5": "ENSG00000118600", "HDGFRP3": "ENSG00000166503", "PRUNE": "ENSG00000143363", "HIST1H2BK": "ENSG00000197903", "HN1L": "ENSG00000206053", "H2AFV": "ENSG00000105968", "KIF1BP": "ENSG00000198954", "KIAA1033": "ENSG00000136051", "FAM69A": "ENSG00000154511", "TMEM110": "ENSG00000213533", "ATP5S": "ENSG00000125375", "SQRDL": "ENSG00000137767", "TMEM2": "ENSG00000135048", "ADCK3": "ENSG00000163050", "NARFL": "ENSG00000103245", "FAM57A": "ENSG00000167695", "LRRC16A": "ENSG00000079691", "FAM63A": "ENSG00000143409", "TSTA3": "ENSG00000104522"} name_to_ensembl_dict = {**name_to_ensembl_dict, **not_matched_dict} landmark_ensembl_dict = {name: name_to_ensembl_dict[name] for name in gene_info[gene_info['pr_is_lm'] == 1]['pr_gene_symbol']} landmark_ensembl_to_name_dict = {landmark_ensembl_dict[name]: name for name in landmark_ensembl_dict.keys()} ######################################################################################################################## # Retrieve part of TCGA matrix that corresponds to landmark genes ######################################################################################################################## print("Adapt TCGA: modify TCGA matrix") # Remove version of the ensembl ID in TCGA data data['ensembl'] = data['sample'].apply(lambda s: s.split('.')[0]) # Restrict to landmark genes data_lamdmark_genes = data[data['ensembl'].apply(lambda s: s in landmark_ensembl_dict.values())] data_lamdmark_genes = data_lamdmark_genes.drop(['sample'], axis=1) # Add gene names to the matrix data_lamdmark_genes['name'] = data_lamdmark_genes['ensembl'].apply(lambda s: landmark_ensembl_to_name_dict[s]) data_lamdmark_genes = data_lamdmark_genes.set_index('name') data_lamdmark_genes = data_lamdmark_genes.drop(['ensembl'], axis=1) # Save data_lamdmark_genes.to_csv("Data/Downstream_Tasks/tcga_landmark_genes.csv")
[ 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 29113, 29113, 29113, 14468, 7804, 198, 2, 8778, 1366, 198, 29113, 29113, 29113, 14468, 7804, 198, 198, 4798, 7203, 48003, 17283, 9273, 25, 12320, 1366, 13, 2...
2.316362
1,748
import pytest from app.share_resources.master_data.models import * # test company_type_category # test company_type_master # test work_place_category # test work_place_master # test job_type_category # test job_type_master # test school_info_master # test media # test Plan # test type_auto_reply_message
[ 11748, 12972, 9288, 198, 198, 6738, 598, 13, 20077, 62, 37540, 13, 9866, 62, 7890, 13, 27530, 1330, 1635, 628, 198, 2, 1332, 1664, 62, 4906, 62, 22872, 628, 198, 2, 1332, 1664, 62, 4906, 62, 9866, 628, 198, 2, 1332, 670, 62, 5372,...
3.134615
104
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import * from OpenGL.raw.GL import _errors from OpenGL.constant import Constant as _C import ctypes _EXTENSION_NAME = 'GL_ARB_get_program_binary' GL_NUM_PROGRAM_BINARY_FORMATS=_C('GL_NUM_PROGRAM_BINARY_FORMATS',0x87FE) GL_PROGRAM_BINARY_FORMATS=_C('GL_PROGRAM_BINARY_FORMATS',0x87FF) GL_PROGRAM_BINARY_LENGTH=_C('GL_PROGRAM_BINARY_LENGTH',0x8741) GL_PROGRAM_BINARY_RETRIEVABLE_HINT=_C('GL_PROGRAM_BINARY_RETRIEVABLE_HINT',0x8257)
[ 7061, 6, 16541, 519, 877, 515, 416, 35555, 62, 8612, 378, 4226, 11, 466, 407, 4370, 0, 7061, 6, 198, 6738, 30672, 1330, 3859, 355, 4808, 79, 11, 26515, 198, 2, 6127, 5270, 3544, 428, 198, 6738, 30672, 13, 1831, 13, 8763, 1330, 480...
2.421642
268
from os import path data_path = path.join(path.dirname(__file__), 'data') default_words = path.join(data_path, 'words.dat') default_verbs = path.join(data_path, 'verbs.dat')
[ 198, 6738, 28686, 1330, 3108, 198, 198, 7890, 62, 6978, 796, 3108, 13, 22179, 7, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 828, 705, 7890, 11537, 198, 12286, 62, 10879, 796, 3108, 13, 22179, 7, 7890, 62, 6978, 11, 705, 10879, 13, ...
2.75
64
import os from typing import Any, Optional import torch from parseridge.parser.modules.data_parallel import Module from parseridge.parser.training.callbacks.base_callback import Callback
[ 11748, 28686, 198, 6738, 19720, 1330, 4377, 11, 32233, 198, 198, 11748, 28034, 198, 198, 6738, 30751, 3130, 13, 48610, 13, 18170, 13, 7890, 62, 1845, 29363, 1330, 19937, 198, 6738, 30751, 3130, 13, 48610, 13, 34409, 13, 13345, 10146, 13...
3.958333
48
import massmodel,pylens,MassModels
[ 11748, 2347, 19849, 11, 79, 2645, 641, 11, 20273, 5841, 1424, 198 ]
2.916667
12
from contextlib import closing from tarfile import open as taropen from urllib2 import urlopen from conans import ConanFile
[ 6738, 4732, 8019, 1330, 9605, 198, 6738, 13422, 7753, 1330, 1280, 355, 13422, 9654, 198, 6738, 2956, 297, 571, 17, 1330, 19016, 9654, 198, 198, 6738, 369, 504, 1330, 31634, 8979, 628 ]
3.9375
32
# Generated by Django 3.1.1 on 2020-09-22 06:02 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 16, 319, 12131, 12, 2931, 12, 1828, 9130, 25, 2999, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
import asyncio import sys from typing import Any, Callable, List, Optional, Union from .commands import Command from .commands import CommandGroup as Group from .errors import *
[ 11748, 30351, 952, 198, 11748, 25064, 198, 6738, 19720, 1330, 4377, 11, 4889, 540, 11, 7343, 11, 32233, 11, 4479, 198, 198, 6738, 764, 9503, 1746, 1330, 9455, 198, 6738, 764, 9503, 1746, 1330, 9455, 13247, 355, 4912, 198, 6738, 764, 4...
4
45
from propertiesTemplate.Fields.BasicField import BasicField from propertiesTemplate.Fields.ConstField import ConstField
[ 6738, 6608, 30800, 13, 15878, 82, 13, 26416, 15878, 1330, 14392, 15878, 198, 6738, 6608, 30800, 13, 15878, 82, 13, 34184, 15878, 1330, 4757, 15878, 628 ]
4.653846
26
test = list(map(int,input().split(' '))) t = SelectionSort(test) print(t.result())
[ 198, 9288, 796, 1351, 7, 8899, 7, 600, 11, 15414, 22446, 35312, 10786, 705, 22305, 198, 83, 796, 29538, 42758, 7, 9288, 8, 198, 4798, 7, 83, 13, 20274, 28955, 198 ]
2.709677
31
from flask import Flask from flask_sqlalchemy import SQLAlchemy import openaq import requests # connects to the api api = openaq.OpenAQ() # initialize the app APP = Flask(__name__) # configure the database APP.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3' DB = SQLAlchemy(APP) # define a function that will return a list of date time and value tuples # Base route
[ 6738, 42903, 1330, 46947, 201, 198, 6738, 42903, 62, 25410, 282, 26599, 1330, 16363, 2348, 26599, 201, 198, 11748, 1280, 30188, 201, 198, 11748, 7007, 201, 198, 2, 20417, 284, 262, 40391, 201, 198, 15042, 796, 1280, 30188, 13, 11505, 32...
2.876812
138