hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
11 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
251
max_stars_repo_name
stringlengths
4
130
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
251
max_issues_repo_name
stringlengths
4
130
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
116k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
251
max_forks_repo_name
stringlengths
4
130
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
1
1.05M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.04M
alphanum_fraction
float64
0
1
8b827211c6d78c4e03e51a44190d8e3f1cffc3db
2,443
py
Python
legacy/models/GAT.py
astrockragh/IceCube
eba09e9f9a3c351dbf05496821bcd7d29ac0261c
[ "MIT" ]
null
null
null
legacy/models/GAT.py
astrockragh/IceCube
eba09e9f9a3c351dbf05496821bcd7d29ac0261c
[ "MIT" ]
null
null
null
legacy/models/GAT.py
astrockragh/IceCube
eba09e9f9a3c351dbf05496821bcd7d29ac0261c
[ "MIT" ]
2
2021-03-03T20:39:38.000Z
2021-06-09T11:58:00.000Z
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)
46.09434
164
0.669668
8b83777c4cdb8551be6cb2f0840e3a838be9ce71
792
py
Python
pyleecan/Methods/Slot/SlotUD2/get_surface_active.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
95
2019-01-23T04:19:45.000Z
2022-03-17T18:22:10.000Z
pyleecan/Methods/Slot/SlotUD2/get_surface_active.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
366
2019-02-20T07:15:08.000Z
2022-03-31T13:37:23.000Z
pyleecan/Methods/Slot/SlotUD2/get_surface_active.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
74
2019-01-24T01:47:31.000Z
2022-02-25T05:44:42.000Z
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
22.628571
59
0.64899
8b849ac15aeae749f8a20c70f9517f14b9a20eb1
3,402
py
Python
features/haralick.py
annaformaniuk/smoke-detection
217014e9a2a5b9861f4cda3d4c1abce4aca34773
[ "MIT" ]
7
2019-05-29T07:43:40.000Z
2022-02-10T07:44:11.000Z
features/haralick.py
annaformaniuk/smoke-detection
217014e9a2a5b9861f4cda3d4c1abce4aca34773
[ "MIT" ]
1
2020-06-07T10:50:50.000Z
2020-06-07T10:50:50.000Z
features/haralick.py
annaformaniuk/smoke-detection
217014e9a2a5b9861f4cda3d4c1abce4aca34773
[ "MIT" ]
4
2019-11-26T15:05:03.000Z
2021-05-10T13:41:15.000Z
# 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 = []
35.072165
77
0.581717
8b87afec28b6e06554c41af8512eee6c2652795a
4,441
py
Python
asciidoxy/templates/helpers.py
lurch/asciidoxy
9781ba696637fadbf62f1b7c5da843b0d292007d
[ "Apache-2.0" ]
null
null
null
asciidoxy/templates/helpers.py
lurch/asciidoxy
9781ba696637fadbf62f1b7c5da843b0d292007d
[ "Apache-2.0" ]
null
null
null
asciidoxy/templates/helpers.py
lurch/asciidoxy
9781ba696637fadbf62f1b7c5da843b0d292007d
[ "Apache-2.0" ]
null
null
null
# 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
33.390977
99
0.611124
8b88d9d29f78c551c398e16471317d51e96b8e76
2,511
py
Python
fin_model_course/pltemplates/graphics/model_structure.py
whoopnip/fin-model-course
e6c5ae313bba601c4aca0f334818b61cc0393118
[ "MIT" ]
5
2020-08-29T15:28:39.000Z
2021-12-01T16:53:25.000Z
fin_model_course/pltemplates/graphics/model_structure.py
whoopnip/fin-model-course
e6c5ae313bba601c4aca0f334818b61cc0393118
[ "MIT" ]
16
2020-02-26T16:03:47.000Z
2021-06-15T15:17:37.000Z
fin_model_course/pltemplates/graphics/model_structure.py
whoopnip/fin-model-course
e6c5ae313bba601c4aca0f334818b61cc0393118
[ "MIT" ]
3
2021-01-22T19:38:36.000Z
2021-09-28T08:14:00.000Z
import pyexlatex as pl import pyexlatex.table as lt import pyexlatex.presentation as lp import pyexlatex.graphics as lg import pyexlatex.layouts as ll
29.541176
112
0.560335
8b898fc8f9613f97a1b09d6b849378dd2047f47d
51
py
Python
index.py
JaidevstudioRobot/hackoctober2021
d5855ac4bc797d7abb85b76f8b4a28e4a0dafaea
[ "MIT" ]
null
null
null
index.py
JaidevstudioRobot/hackoctober2021
d5855ac4bc797d7abb85b76f8b4a28e4a0dafaea
[ "MIT" ]
null
null
null
index.py
JaidevstudioRobot/hackoctober2021
d5855ac4bc797d7abb85b76f8b4a28e4a0dafaea
[ "MIT" ]
1
2021-10-04T18:16:06.000Z
2021-10-04T18:16:06.000Z
# Hello python a = "Hello I m Robot Jai" print(a)
12.75
25
0.647059
8b89b607196b90b61199e59cb3a2c777f0b348f7
1,748
py
Python
calc.py
V-Perotto/Contador_NomeSobrenome_Decimal
1e625306254c3f48e4c722e6ad04601f65af4c3c
[ "CC0-1.0" ]
null
null
null
calc.py
V-Perotto/Contador_NomeSobrenome_Decimal
1e625306254c3f48e4c722e6ad04601f65af4c3c
[ "CC0-1.0" ]
null
null
null
calc.py
V-Perotto/Contador_NomeSobrenome_Decimal
1e625306254c3f48e4c722e6ad04601f65af4c3c
[ "CC0-1.0" ]
null
null
null
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"]
31.214286
119
0.371854
8b8bd5685a8cb00d4aca06f90e968e83f7055e18
10,174
py
Python
ioflo/aio/proto/devicing.py
BradyHammond/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
[ "ECL-2.0", "Apache-2.0", "MIT" ]
128
2015-01-14T12:26:56.000Z
2021-11-06T07:09:29.000Z
ioflo/aio/proto/devicing.py
BradyHammond/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
[ "ECL-2.0", "Apache-2.0", "MIT" ]
17
2015-01-28T18:26:50.000Z
2020-11-19T22:08:06.000Z
ioflo/aio/proto/devicing.py
BradyHammond/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
[ "ECL-2.0", "Apache-2.0", "MIT" ]
29
2015-01-27T23:28:31.000Z
2021-05-04T16:37:30.000Z
""" 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()
27.276139
91
0.548555
8b8fdfbcf9706a09172ee59fba63e07828a65599
2,492
py
Python
tests/array_creation.py
manopapad/legate.numpy
896f4fd9b32db445da6cdabf7b78d523fca96936
[ "Apache-2.0" ]
null
null
null
tests/array_creation.py
manopapad/legate.numpy
896f4fd9b32db445da6cdabf7b78d523fca96936
[ "Apache-2.0" ]
null
null
null
tests/array_creation.py
manopapad/legate.numpy
896f4fd9b32db445da6cdabf7b78d523fca96936
[ "Apache-2.0" ]
null
null
null
# 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()
25.428571
74
0.620385
8b90aeb5aec1b01857b6aa8b3d9934d4cfdd1543
29,250
py
Python
libs/python/qumranica/models/catalogue_match_dto.py
Scripta-Qumranica-Electronica/SQE_API_Connectors
aaa9b9eb8709d4257c32ea57321a179c6b1e041a
[ "MIT" ]
null
null
null
libs/python/qumranica/models/catalogue_match_dto.py
Scripta-Qumranica-Electronica/SQE_API_Connectors
aaa9b9eb8709d4257c32ea57321a179c6b1e041a
[ "MIT" ]
null
null
null
libs/python/qumranica/models/catalogue_match_dto.py
Scripta-Qumranica-Electronica/SQE_API_Connectors
aaa9b9eb8709d4257c32ea57321a179c6b1e041a
[ "MIT" ]
null
null
null
# 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()
32.79148
653
0.645675
8b914a0a6371ff8952db67b7eee682b5c44c059b
569
py
Python
nengo_ssp/hrr_algebra.py
nsdumont/nengo_ssp
9530a4618e213fb695b52887772c1309d0f07a0b
[ "MIT" ]
null
null
null
nengo_ssp/hrr_algebra.py
nsdumont/nengo_ssp
9530a4618e213fb695b52887772c1309d0f07a0b
[ "MIT" ]
null
null
null
nengo_ssp/hrr_algebra.py
nsdumont/nengo_ssp
9530a4618e213fb695b52887772c1309d0f07a0b
[ "MIT" ]
null
null
null
import numpy as np from nengo_spa.algebras.hrr_algebra import HrrAlgebra from nengo.utils.numpy import is_number
35.5625
62
0.620387
8b9247a613a137d9a893fcd8004929a037e3fffd
2,234
py
Python
server.py
Xinzhe-Qi/15112-Term-Project
07a4b78d23629478039667ed4c29287e5e781bf3
[ "MIT" ]
null
null
null
server.py
Xinzhe-Qi/15112-Term-Project
07a4b78d23629478039667ed4c29287e5e781bf3
[ "MIT" ]
null
null
null
server.py
Xinzhe-Qi/15112-Term-Project
07a4b78d23629478039667ed4c29287e5e781bf3
[ "MIT" ]
null
null
null
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,))
21.27619
86
0.499552
8b93ff57b731c6c33351b57dd2f1b5402cee9a07
72
py
Python
examples/random_article.py
yusufusta/wikiHowUnofficialAPI
e29ae96a2dcf893f5b587804b9dd37a412cdd561
[ "MIT" ]
5
2021-04-17T14:02:58.000Z
2022-03-06T02:18:16.000Z
examples/random_article.py
yusufusta/wikiHowUnofficialAPI
e29ae96a2dcf893f5b587804b9dd37a412cdd561
[ "MIT" ]
1
2021-07-09T12:28:27.000Z
2021-07-10T10:04:11.000Z
examples/random_article.py
yusufusta/wikiHowUnofficialAPI
e29ae96a2dcf893f5b587804b9dd37a412cdd561
[ "MIT" ]
4
2021-02-02T14:23:58.000Z
2021-11-15T04:38:10.000Z
import wikihowunofficialapi as wha ra = wha.random_article() print(ra)
14.4
34
0.791667
8b9488221b16161dd9b114f9406bbcd8771818fb
11,341
py
Python
nilmtk/simulate/gaussianstatemachines.py
BaluJr/energytk
e9b06bcb43a40010ccc40a534a7067ee520fb3a7
[ "Apache-2.0" ]
3
2018-11-09T16:13:32.000Z
2019-11-10T20:10:10.000Z
nilmtk/simulate/gaussianstatemachines.py
BaluJr/energytk
e9b06bcb43a40010ccc40a534a7067ee520fb3a7
[ "Apache-2.0" ]
null
null
null
nilmtk/simulate/gaussianstatemachines.py
BaluJr/energytk
e9b06bcb43a40010ccc40a534a7067ee520fb3a7
[ "Apache-2.0" ]
1
2018-10-24T10:28:52.000Z
2018-10-24T10:28:52.000Z
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()
49.308696
184
0.571907
8b95a94d3b25a23a56d3d3d661b084a44e828fab
543
py
Python
my_gallery/migrations/0006_photos_image.py
Abdihakim-Muhumed/gallery
bfdb58466503bedda6ac4b686afb42b69c055f0c
[ "Unlicense" ]
null
null
null
my_gallery/migrations/0006_photos_image.py
Abdihakim-Muhumed/gallery
bfdb58466503bedda6ac4b686afb42b69c055f0c
[ "Unlicense" ]
null
null
null
my_gallery/migrations/0006_photos_image.py
Abdihakim-Muhumed/gallery
bfdb58466503bedda6ac4b686afb42b69c055f0c
[ "Unlicense" ]
null
null
null
# Generated by Django 3.1.2 on 2020-10-14 07:15 import cloudinary.models from django.db import migrations import django.utils.timezone
24.681818
125
0.655617
8b98b8d35fd76526fa88fe1c8a30101c9a8baac3
9,713
py
Python
bot/ts/ThreadSafeTSConnection.py
Asnanon/ts-gw2-verifyBot
4da70450bc53631e61a42d18df36f5aef710cdbe
[ "MIT" ]
null
null
null
bot/ts/ThreadSafeTSConnection.py
Asnanon/ts-gw2-verifyBot
4da70450bc53631e61a42d18df36f5aef710cdbe
[ "MIT" ]
null
null
null
bot/ts/ThreadSafeTSConnection.py
Asnanon/ts-gw2-verifyBot
4da70450bc53631e61a42d18df36f5aef710cdbe
[ "MIT" ]
null
null
null
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
45.176744
171
0.601153
8b9915ff298534b2c620ead53ddd94b9a9c59202
87
py
Python
software/reachy/io/__init__.py
pollen-robotics/reachy-2.0
1721c2d93737e576e328bfdb78376d1b0163d3d6
[ "Apache-1.1" ]
167
2018-02-07T21:42:13.000Z
2021-03-06T08:25:45.000Z
software/reachy/io/__init__.py
pollen-robotics/reachy-2.0
1721c2d93737e576e328bfdb78376d1b0163d3d6
[ "Apache-1.1" ]
39
2019-11-27T13:11:59.000Z
2021-01-12T09:33:26.000Z
software/reachy/io/__init__.py
pollen-robotics/reachy-2.0
1721c2d93737e576e328bfdb78376d1b0163d3d6
[ "Apache-1.1" ]
47
2018-05-27T02:59:28.000Z
2021-03-07T14:56:10.000Z
"""Reachy submodule responsible for low-level IO.""" from .io import IO # noqa F401
17.4
52
0.701149
8ba05404268d52ee6b9dcf341a6f596fdbe8cb19
453
py
Python
test/unit/test_wrapper.py
Bowowzahoya/cordis_search
8766717fdd785b2768785b9147e63cac62dfbd43
[ "MIT" ]
null
null
null
test/unit/test_wrapper.py
Bowowzahoya/cordis_search
8766717fdd785b2768785b9147e63cac62dfbd43
[ "MIT" ]
null
null
null
test/unit/test_wrapper.py
Bowowzahoya/cordis_search
8766717fdd785b2768785b9147e63cac62dfbd43
[ "MIT" ]
null
null
null
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()
25.166667
83
0.766004
8ba0eaca96c9b2d167fd14d08ba774e477aea1cb
1,067
py
Python
dpsniper/mechanisms/noisy_hist.py
barryZZJ/dp-sniper
71a3fc06f3fc319b023bde9aad8f05b8c5a47a80
[ "MIT" ]
13
2021-03-30T15:39:35.000Z
2022-02-21T08:30:45.000Z
dpsniper/mechanisms/noisy_hist.py
barryZZJ/dp-sniper
71a3fc06f3fc319b023bde9aad8f05b8c5a47a80
[ "MIT" ]
null
null
null
dpsniper/mechanisms/noisy_hist.py
barryZZJ/dp-sniper
71a3fc06f3fc319b023bde9aad8f05b8c5a47a80
[ "MIT" ]
4
2021-06-30T08:37:45.000Z
2022-03-05T03:21:14.000Z
import numpy as np from dpsniper.mechanisms.abstract import Mechanism
26.02439
82
0.597938
8ba24d39fccf745cf193a9313e6f0347c33e72ba
1,122
py
Python
workalendar/europe/georgia.py
macharmi/workalendar
4f8644484d6ba56c66e4bb82c377aa19eccfc0dc
[ "MIT" ]
null
null
null
workalendar/europe/georgia.py
macharmi/workalendar
4f8644484d6ba56c66e4bb82c377aa19eccfc0dc
[ "MIT" ]
null
null
null
workalendar/europe/georgia.py
macharmi/workalendar
4f8644484d6ba56c66e4bb82c377aa19eccfc0dc
[ "MIT" ]
null
null
null
from ..core import OrthodoxCalendar from ..registry_tools import iso_register
30.324324
72
0.646168
8ba29d9fb01d60102507bf5db6c09210143677fa
3,471
py
Python
release/util/splunkbase_releaser.py
xynazog/amp4e_splunk_events_input
a5bb57cf82ca3e96fa9a444e5e5e9789eb16b70b
[ "BSD-2-Clause" ]
9
2017-07-31T16:13:51.000Z
2021-01-06T15:02:36.000Z
release/util/splunkbase_releaser.py
xynazog/amp4e_splunk_events_input
a5bb57cf82ca3e96fa9a444e5e5e9789eb16b70b
[ "BSD-2-Clause" ]
51
2017-10-24T17:25:44.000Z
2022-03-31T16:47:58.000Z
release/util/splunkbase_releaser.py
xynazog/amp4e_splunk_events_input
a5bb57cf82ca3e96fa9a444e5e5e9789eb16b70b
[ "BSD-2-Clause" ]
12
2017-08-01T08:59:39.000Z
2021-02-24T21:10:46.000Z
import os from distutils.dir_util import copy_tree from invoke import task, run import shutil
34.71
109
0.645923
8ba46c9ce685361335be0d77dfae9a2dd018991f
2,502
py
Python
sorts.py
zhangxl97/leetcode
aa94228eba86d761ce5c9b6bfb8b2015c1629074
[ "MIT" ]
1
2020-09-12T10:35:22.000Z
2020-09-12T10:35:22.000Z
sorts.py
zhangxl97/leetcode
aa94228eba86d761ce5c9b6bfb8b2015c1629074
[ "MIT" ]
null
null
null
sorts.py
zhangxl97/leetcode
aa94228eba86d761ce5c9b6bfb8b2015c1629074
[ "MIT" ]
null
null
null
from typing import List if __name__ == "__main__": main()
26.617021
68
0.406475
8ba6b11d7fb6854358fc0d437c22f1ff827b55c0
6,622
py
Python
energy_consumption_lstm/data/model.py
DiarmuidKelly/predictors
9087302ab3cc54463807b0777f341b575a8fcc90
[ "MIT" ]
null
null
null
energy_consumption_lstm/data/model.py
DiarmuidKelly/predictors
9087302ab3cc54463807b0777f341b575a8fcc90
[ "MIT" ]
null
null
null
energy_consumption_lstm/data/model.py
DiarmuidKelly/predictors
9087302ab3cc54463807b0777f341b575a8fcc90
[ "MIT" ]
null
null
null
import datetime as dt import numpy as np
43.854305
123
0.643914
8ba7da6d41b49d8a498bec0f19c0c437b815e955
558
py
Python
RecoTracker/CkfPattern/python/CkfTrackCandidatesNoOverlaps_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
RecoTracker/CkfPattern/python/CkfTrackCandidatesNoOverlaps_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
RecoTracker/CkfPattern/python/CkfTrackCandidatesNoOverlaps_cff.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
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') )
39.857143
80
0.844086
8ba816e0011648c0f031c8c0072d0e07ef644345
3,639
py
Python
python ex12.py
IMDCGP105-1819/portfolio-s184286
e5485f640f341090823bbcaabe287376a048b2c4
[ "MIT" ]
null
null
null
python ex12.py
IMDCGP105-1819/portfolio-s184286
e5485f640f341090823bbcaabe287376a048b2c4
[ "MIT" ]
null
null
null
python ex12.py
IMDCGP105-1819/portfolio-s184286
e5485f640f341090823bbcaabe287376a048b2c4
[ "MIT" ]
null
null
null
""" 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)
34.657143
183
0.687826
8ba86635b84461a1f0a395b2d0b3f48cfc499bf5
7,050
py
Python
segment_chars.py
indranildchandra/Automatic-Licence-Plate-Recognizer
12abcf40459f8e2d5d7491aedaed2ee3ea1eb1a7
[ "Apache-2.0" ]
1
2020-10-12T12:49:05.000Z
2020-10-12T12:49:05.000Z
segment_chars.py
indranildchandra/Automatic-Licence-Plate-Recognizer
12abcf40459f8e2d5d7491aedaed2ee3ea1eb1a7
[ "Apache-2.0" ]
null
null
null
segment_chars.py
indranildchandra/Automatic-Licence-Plate-Recognizer
12abcf40459f8e2d5d7491aedaed2ee3ea1eb1a7
[ "Apache-2.0" ]
null
null
null
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
31.61435
141
0.699433
8ba8b01b1342226dbfd45e390f34ba1e3c088e34
123
py
Python
clase1/multiplicadores.py
Munoz-Rojas-Adriana/Computacion_para_Ingenieria
4f695887966a94b6c422d100c2c4ec4a94d1e80e
[ "Apache-2.0" ]
null
null
null
clase1/multiplicadores.py
Munoz-Rojas-Adriana/Computacion_para_Ingenieria
4f695887966a94b6c422d100c2c4ec4a94d1e80e
[ "Apache-2.0" ]
null
null
null
clase1/multiplicadores.py
Munoz-Rojas-Adriana/Computacion_para_Ingenieria
4f695887966a94b6c422d100c2c4ec4a94d1e80e
[ "Apache-2.0" ]
null
null
null
multi = 0 list = (1 , 2 , 3) for i in list: multi = multi + i print (f'la multi total de 1 al 3 es {multi}')
15.375
50
0.528455
8ba8ed599cf94b78021c68a977f2d000df6dcd16
2,476
py
Python
aiida_jutools/__init__.py
PhilippRue/aiida-jutools
66070e7077cb454bcfd70dd3327b335499556a16
[ "MIT" ]
5
2020-12-11T13:32:09.000Z
2022-01-19T08:36:40.000Z
aiida_jutools/__init__.py
PhilippRue/aiida-jutools
66070e7077cb454bcfd70dd3327b335499556a16
[ "MIT" ]
7
2021-01-28T10:24:13.000Z
2021-08-18T13:42:47.000Z
aiida_jutools/__init__.py
PhilippRue/aiida-jutools
66070e7077cb454bcfd70dd3327b335499556a16
[ "MIT" ]
5
2020-12-07T17:13:38.000Z
2021-11-25T09:58:48.000Z
# -*- 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, ...).
51.583333
117
0.586026
8bab05cccc2b06bc0e17af38af464fd773e79545
5,358
py
Python
beastx/__main__.py
Mrunal1911/Beast-X
b7b13b3b5db754894a830569909c4b77aa1ff19d
[ "MIT" ]
null
null
null
beastx/__main__.py
Mrunal1911/Beast-X
b7b13b3b5db754894a830569909c4b77aa1ff19d
[ "MIT" ]
null
null
null
beastx/__main__.py
Mrunal1911/Beast-X
b7b13b3b5db754894a830569909c4b77aa1ff19d
[ "MIT" ]
null
null
null
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()
28.652406
140
0.58044
8bac89c0e7fe595c62cbe29b2411dd910e49d2c2
859
py
Python
tests/day02/test_day02.py
SebastiaanZ/aoc-2019
e1fe4630b0f375be0b79398e07e23b9c0196efbb
[ "MIT" ]
3
2019-12-02T19:38:14.000Z
2020-01-28T00:06:09.000Z
tests/day02/test_day02.py
SebastiaanZ/aoc-2019
e1fe4630b0f375be0b79398e07e23b9c0196efbb
[ "MIT" ]
6
2020-03-24T17:58:40.000Z
2022-03-12T00:18:45.000Z
tests/day02/test_day02.py
SebastiaanZ/aoc-2019
e1fe4630b0f375be0b79398e07e23b9c0196efbb
[ "MIT" ]
null
null
null
import unittest from solutions.day02.solution import ship_computer from tests.helpers import Puzzle
37.347826
99
0.641444
8bacb9d61c16b4122f25721e214182358d00a686
24,678
py
Python
ActiveSuspensions/2DOF Fuzzy Suspension.py
MarcoFerrari128/Portfolio
82cd81a4235dbd804cd13100b2304a04ca6771b5
[ "MIT" ]
null
null
null
ActiveSuspensions/2DOF Fuzzy Suspension.py
MarcoFerrari128/Portfolio
82cd81a4235dbd804cd13100b2304a04ca6771b5
[ "MIT" ]
null
null
null
ActiveSuspensions/2DOF Fuzzy Suspension.py
MarcoFerrari128/Portfolio
82cd81a4235dbd804cd13100b2304a04ca6771b5
[ "MIT" ]
null
null
null
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')
29.73253
82
0.56678
8bae7f55a261a7c3c248850c794f2efd73be536a
950
py
Python
pywatts/modules/wrappers/dl_wrapper.py
KIT-IAI/pyWATTS
68993bb51ff272c1a98add31e2b537b63e9d0848
[ "MIT" ]
30
2020-10-04T17:32:58.000Z
2022-03-18T15:06:39.000Z
pywatts/modules/wrappers/dl_wrapper.py
KIT-IAI/pyWATTS
68993bb51ff272c1a98add31e2b537b63e9d0848
[ "MIT" ]
123
2020-10-26T14:42:12.000Z
2022-03-31T09:15:55.000Z
pywatts/modules/wrappers/dl_wrapper.py
KIT-IAI/pyWATTS
68993bb51ff272c1a98add31e2b537b63e9d0848
[ "MIT" ]
7
2020-10-21T15:13:43.000Z
2022-03-07T15:47:49.000Z
# 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
26.388889
80
0.656842
8baf2837359bef97c791a3fa5aa72048d1181a43
590
py
Python
examples/parallel_spectra.py
zhaonat/py-maxwell-fd3d
bfa4fb826401b98371fdd9306c5fee2e74e7e545
[ "MIT" ]
3
2022-01-21T03:53:25.000Z
2022-01-23T04:54:43.000Z
examples/parallel_spectra.py
Guowu-Mcgill/py-maxwell-fd3d
bfa4fb826401b98371fdd9306c5fee2e74e7e545
[ "MIT" ]
null
null
null
examples/parallel_spectra.py
Guowu-Mcgill/py-maxwell-fd3d
bfa4fb826401b98371fdd9306c5fee2e74e7e545
[ "MIT" ]
1
2022-01-23T04:54:47.000Z
2022-01-23T04:54:47.000Z
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
59
99
0.798305
8bb10d5482f7eb91428767e4939740b77a7d3702
2,386
py
Python
Emotional-Recognition-Facial/create_training_classification_set.py
ductai199x/No-more-bad-days
ceb7da2d2464062ad4aea028cdfa98380661702c
[ "Apache-2.0" ]
1
2018-01-18T15:10:40.000Z
2018-01-18T15:10:40.000Z
Emotional-Recognition-Facial/create_training_classification_set.py
ductai199x/No-more-bad-days
ceb7da2d2464062ad4aea028cdfa98380661702c
[ "Apache-2.0" ]
null
null
null
Emotional-Recognition-Facial/create_training_classification_set.py
ductai199x/No-more-bad-days
ceb7da2d2464062ad4aea028cdfa98380661702c
[ "Apache-2.0" ]
null
null
null
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!"
33.605634
129
0.731769
8bb228a7e4380e3d2e78dff77a6e5e75257a88f3
1,109
py
Python
main.py
Zlobin/wp-updater
e10ebbb7ddd2a2398c7a660d134ce8598738fe7d
[ "MIT" ]
null
null
null
main.py
Zlobin/wp-updater
e10ebbb7ddd2a2398c7a660d134ce8598738fe7d
[ "MIT" ]
null
null
null
main.py
Zlobin/wp-updater
e10ebbb7ddd2a2398c7a660d134ce8598738fe7d
[ "MIT" ]
null
null
null
# 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)
27.04878
97
0.757439
8bb2c815f8cb9c7313bf196f810ccfc535e6256b
435
py
Python
第4章/program/Chapter_4_compare.py
kingname/SourceCodeOfBook
ab7275108994dca564905818b678bbd2f771c18e
[ "MIT" ]
274
2018-10-01T11:07:25.000Z
2022-03-17T13:48:45.000Z
第4章/program/Chapter_4_compare.py
kingname/SourceCodeOfBook
ab7275108994dca564905818b678bbd2f771c18e
[ "MIT" ]
6
2019-02-28T14:18:21.000Z
2022-03-02T14:57:39.000Z
第4章/program/Chapter_4_compare.py
kingname/SourceCodeOfBook
ab7275108994dca564905818b678bbd2f771c18e
[ "MIT" ]
110
2018-10-16T06:08:37.000Z
2022-03-16T08:19:29.000Z
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}')
18.125
40
0.682759
8bb336feea80faaae86bf909a42bb1e797a4c310
702
py
Python
hole/migrations/0008_auto_20210128_1959.py
kavinzhao/fduhole
508922cfa0558c58b95206dd8fbf51d10525fa1e
[ "Apache-2.0" ]
9
2021-04-14T12:08:38.000Z
2021-12-16T08:14:40.000Z
hole/migrations/0008_auto_20210128_1959.py
kavinzhao/fduhole
508922cfa0558c58b95206dd8fbf51d10525fa1e
[ "Apache-2.0" ]
9
2021-04-18T09:48:25.000Z
2021-11-26T07:43:22.000Z
hole/migrations/0008_auto_20210128_1959.py
kavinzhao/fduhole
508922cfa0558c58b95206dd8fbf51d10525fa1e
[ "Apache-2.0" ]
4
2021-07-15T02:10:42.000Z
2022-01-22T02:12:11.000Z
# Generated by Django 3.1.5 on 2021-01-28 11:59 from django.db import migrations, models
24.206897
73
0.566952
8bb369887e18a7fa4f7256d2ff77d3ccf9f84c6a
5,607
py
Python
nfv/nfv-vim/nfv_vim/nfvi/api/v1/_nfvi_network_api.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
2
2020-02-07T19:01:36.000Z
2022-02-23T01:41:46.000Z
nfv/nfv-vim/nfv_vim/nfvi/api/v1/_nfvi_network_api.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
1
2021-01-14T12:02:25.000Z
2021-01-14T12:02:25.000Z
nfv/nfv-vim/nfv_vim/nfvi/api/v1/_nfvi_network_api.py
SidneyAn/nfv
5f0262a5b6ea4be59f977b9c587c483cbe0e373d
[ "Apache-2.0" ]
2
2021-01-13T08:39:21.000Z
2022-02-09T00:21:55.000Z
# # Copyright (c) 2015-2016 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import abc import six
24.809735
85
0.574817
8bb4b5b36380f83dc59bb259a75e2877488cbe5c
750
py
Python
array/max_subarray.py
elenaborisova/LeetCode-Solutions
98376aab7fd150a724e316357ae5ea46988d9eac
[ "MIT" ]
null
null
null
array/max_subarray.py
elenaborisova/LeetCode-Solutions
98376aab7fd150a724e316357ae5ea46988d9eac
[ "MIT" ]
null
null
null
array/max_subarray.py
elenaborisova/LeetCode-Solutions
98376aab7fd150a724e316357ae5ea46988d9eac
[ "MIT" ]
null
null
null
# 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)
22.058824
57
0.52
8bb4f4ea88058eb0410caa3dc14fb32b876055fc
4,696
py
Python
python/trezorlib/cosi.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
null
null
null
python/trezorlib/cosi.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
1
2019-02-08T00:22:42.000Z
2019-02-13T09:41:54.000Z
python/trezorlib/cosi.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
2
2019-02-07T23:57:09.000Z
2020-10-21T07:07:27.000Z
# 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 ====== #
33.784173
105
0.70379
8bb52f491af72661c47a685434d4940a457e1a8b
2,881
py
Python
workflow/scripts/modifyFastQC.py
StephenRicher/RNA-Flow
57890772cb95beb390990618eb02f5d6e138312b
[ "MIT" ]
null
null
null
workflow/scripts/modifyFastQC.py
StephenRicher/RNA-Flow
57890772cb95beb390990618eb02f5d6e138312b
[ "MIT" ]
null
null
null
workflow/scripts/modifyFastQC.py
StephenRicher/RNA-Flow
57890772cb95beb390990618eb02f5d6e138312b
[ "MIT" ]
null
null
null
#!/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)
34.710843
94
0.637279
8bb63310aa365a92b778a469e0b31fbf329b889f
7,711
py
Python
v0/aia_eis_v0/circuits/circuit_pack_01.py
DreamBoatOve/aia_eis
458b4d29846669b10db4da1b3e86c0b394614ceb
[ "MIT" ]
1
2022-03-02T12:57:19.000Z
2022-03-02T12:57:19.000Z
v0/aia_eis_v0/circuits/circuit_pack_01.py
DreamBoatOve/aia_eis
458b4d29846669b10db4da1b3e86c0b394614ceb
[ "MIT" ]
null
null
null
v0/aia_eis_v0/circuits/circuit_pack_01.py
DreamBoatOve/aia_eis
458b4d29846669b10db4da1b3e86c0b394614ceb
[ "MIT" ]
null
null
null
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 ------------------
26.317406
126
0.489171
8bb6d2bd0e69ae1dc3728d097c16522641fbedbf
1,155
py
Python
devlib/exception.py
BayLibre/devlib
efa0ecdfe931caebc9a7dab16bb172b96c3f92cb
[ "Apache-2.0" ]
1
2021-06-19T09:32:50.000Z
2021-06-19T09:32:50.000Z
devlib/exception.py
BayLibre/devlib
efa0ecdfe931caebc9a7dab16bb172b96c3f92cb
[ "Apache-2.0" ]
1
2016-02-08T11:27:34.000Z
2016-02-08T11:27:34.000Z
devlib/exception.py
BayLibre/devlib
efa0ecdfe931caebc9a7dab16bb172b96c3f92cb
[ "Apache-2.0" ]
3
2015-12-15T11:28:06.000Z
2016-03-04T16:36:19.000Z
# 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
28.170732
101
0.732468
8bb84845a4e4ca234bb0e7dc0448fc8b70e6253a
843
py
Python
chill/examples/chill/testcases/lu.py
CompOpt4Apps/Artifact-DataDepSimplify
4fa1bf2bda2902fec50a54ee79ae405a554fc9f4
[ "MIT" ]
5
2019-05-20T03:35:41.000Z
2021-09-16T22:22:13.000Z
chill/examples/chill/testcases/lu.py
CompOpt4Apps/Artifact-DataDepSimplify
4fa1bf2bda2902fec50a54ee79ae405a554fc9f4
[ "MIT" ]
null
null
null
chill/examples/chill/testcases/lu.py
CompOpt4Apps/Artifact-DataDepSimplify
4fa1bf2bda2902fec50a54ee79ae405a554fc9f4
[ "MIT" ]
null
null
null
# 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()
17.204082
52
0.578885
8bb882a476b7069df7988169620b13ea93893010
2,204
py
Python
dj_vercereg/client/vercereg_client.py
davidath/dj-vercereg
d1ae1dba21cab93c759ecf79346bc60c2d88d7a8
[ "Apache-2.0" ]
null
null
null
dj_vercereg/client/vercereg_client.py
davidath/dj-vercereg
d1ae1dba21cab93c759ecf79346bc60c2d88d7a8
[ "Apache-2.0" ]
null
null
null
dj_vercereg/client/vercereg_client.py
davidath/dj-vercereg
d1ae1dba21cab93c759ecf79346bc60c2d88d7a8
[ "Apache-2.0" ]
1
2022-03-14T13:33:19.000Z
2022-03-14T13:33:19.000Z
#!/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()
32.895522
169
0.720054
8bb96428aea103e57829628f8aba75da646487e4
6,803
py
Python
scripts/DailyJob/api_data_fetcher.py
SamFangshan/CZ2006CarPark
663b0370e7d2e0cbe4d0a7391656a731fc7dac52
[ "MIT" ]
2
2020-02-26T03:28:02.000Z
2020-04-25T07:03:36.000Z
scripts/DailyJob/api_data_fetcher.py
SamFangshan/CZ2006CarPark
663b0370e7d2e0cbe4d0a7391656a731fc7dac52
[ "MIT" ]
null
null
null
scripts/DailyJob/api_data_fetcher.py
SamFangshan/CZ2006CarPark
663b0370e7d2e0cbe4d0a7391656a731fc7dac52
[ "MIT" ]
null
null
null
import json import pandas as pd import numpy as np from urllib.request import Request, urlopen from onemap_converter import OneMapConverter
58.646552
129
0.66456
8bba17146d82323f502dee13164e2dcf746f9322
4,108
py
Python
tests/push/test_sse.py
cfogg/python-client
40e6891c8240e6b2acd5df538e622e9f15de43d6
[ "Apache-2.0" ]
13
2017-03-17T15:15:20.000Z
2022-03-14T22:24:10.000Z
tests/push/test_sse.py
cfogg/python-client
40e6891c8240e6b2acd5df538e622e9f15de43d6
[ "Apache-2.0" ]
81
2017-01-12T23:06:48.000Z
2022-02-21T18:20:23.000Z
tests/push/test_sse.py
cfogg/python-client
40e6891c8240e6b2acd5df538e622e9f15de43d6
[ "Apache-2.0" ]
14
2017-05-25T10:49:13.000Z
2021-12-27T16:39:20.000Z
"""SSEClient unit tests.""" import time import threading import pytest from splitio.push.sse import SSEClient, SSEEvent from tests.helpers.mockserver import SSEMockServer
31.844961
73
0.547955
8bbca367e9908a584ebeb0ff48984d79eb8c67ba
859
py
Python
api_updater.py
jpes707/quiz-api
18af31b9cdba8927e4e7a38e0bd3623e938cf7dc
[ "MIT" ]
null
null
null
api_updater.py
jpes707/quiz-api
18af31b9cdba8927e4e7a38e0bd3623e938cf7dc
[ "MIT" ]
null
null
null
api_updater.py
jpes707/quiz-api
18af31b9cdba8927e4e7a38e0bd3623e938cf7dc
[ "MIT" ]
null
null
null
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!')
37.347826
99
0.733411
8bbcec0ab14f44786258536c11d18bbc453834f6
2,429
py
Python
util.py
AndreasWieg/PC-BIGAN
0738f9bf56bd30b43eb2db9765ce9bae25ca81f6
[ "MIT" ]
null
null
null
util.py
AndreasWieg/PC-BIGAN
0738f9bf56bd30b43eb2db9765ce9bae25ca81f6
[ "MIT" ]
null
null
null
util.py
AndreasWieg/PC-BIGAN
0738f9bf56bd30b43eb2db9765ce9bae25ca81f6
[ "MIT" ]
null
null
null
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
37.369231
107
0.691231
8bbd00b53513bf84f5c58a5ce90fbc7b1806da00
7,474
py
Python
seq_to_seq.py
jlibovicky/char-nmt-two-step-decoder
3fa90c38556f23568f6b88eb98e4bc2193f3b744
[ "BSD-3-Clause" ]
null
null
null
seq_to_seq.py
jlibovicky/char-nmt-two-step-decoder
3fa90c38556f23568f6b88eb98e4bc2193f3b744
[ "BSD-3-Clause" ]
null
null
null
seq_to_seq.py
jlibovicky/char-nmt-two-step-decoder
3fa90c38556f23568f6b88eb98e4bc2193f3b744
[ "BSD-3-Clause" ]
null
null
null
"""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
37.18408
77
0.596602
8bbe4c37ae3a9b71342799d82ae3b600239ac59b
2,638
py
Python
src/backends/example_mongodb/database.py
rartino/python-optimade-server
84457091c7ec0db52a7e034bb6a7cd4bcbdd4e57
[ "MIT" ]
null
null
null
src/backends/example_mongodb/database.py
rartino/python-optimade-server
84457091c7ec0db52a7e034bb6a7cd4bcbdd4e57
[ "MIT" ]
null
null
null
src/backends/example_mongodb/database.py
rartino/python-optimade-server
84457091c7ec0db52a7e034bb6a7cd4bcbdd4e57
[ "MIT" ]
null
null
null
#!/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
35.173333
97
0.674375
8bbe4fd060a6878adde13a88356535b7bfb0e331
29,288
py
Python
tests/utils.py
Ouranosinc/cowbird
108195ca6abbd58fd75b180f6fa7d40eab0f8ea5
[ "MIT" ]
1
2021-02-04T18:56:36.000Z
2021-02-04T18:56:36.000Z
tests/utils.py
Ouranosinc/cowbird
108195ca6abbd58fd75b180f6fa7d40eab0f8ea5
[ "MIT" ]
12
2021-02-05T22:01:10.000Z
2022-03-09T14:23:10.000Z
tests/utils.py
Ouranosinc/cowbird
108195ca6abbd58fd75b180f6fa7d40eab0f8ea5
[ "MIT" ]
null
null
null
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)
44.042105
120
0.651974
8bc1dc764cc3286fa9cb0c9dbac2a3360dc97788
764
py
Python
sqds/jobs/update_guilds.py
abey79/sqds
acab1d9c6d4a010fff9d8e89a5fdd9d94def7c89
[ "MIT" ]
null
null
null
sqds/jobs/update_guilds.py
abey79/sqds
acab1d9c6d4a010fff9d8e89a5fdd9d94def7c89
[ "MIT" ]
null
null
null
sqds/jobs/update_guilds.py
abey79/sqds
acab1d9c6d4a010fff9d8e89a5fdd9d94def7c89
[ "MIT" ]
null
null
null
from django.utils import timezone from django_extensions.management.jobs import BaseJob from ..models import Player, Guild
27.285714
70
0.704188
8bc3ea498abafb408b2345871e2adf30ac6a71a4
1,907
py
Python
src/saleor_app/install.py
przlada/saleor-app-framework-python
3a561c93bf586b4210e7b3c4d2db3408046a9599
[ "BSD-3-Clause" ]
20
2021-05-18T18:05:25.000Z
2022-03-02T00:39:15.000Z
src/saleor_app/install.py
przlada/saleor-app-framework-python
3a561c93bf586b4210e7b3c4d2db3408046a9599
[ "BSD-3-Clause" ]
13
2021-10-19T19:05:24.000Z
2022-03-22T13:17:55.000Z
src/saleor_app/install.py
przlada/saleor-app-framework-python
3a561c93bf586b4210e7b3c4d2db3408046a9599
[ "BSD-3-Clause" ]
11
2021-06-09T21:24:56.000Z
2022-03-12T17:33:30.000Z
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__)
31.783333
80
0.678553
8bc41c33e45aca9a963dba5e594b74e5dcb92d03
64,465
py
Python
sdk/python/pulumi_aws/fsx/open_zfs_file_system.py
chivandikwa/pulumi-aws
19c08bf9dcb90544450ffa4eec7bf6751058fde2
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_aws/fsx/open_zfs_file_system.py
chivandikwa/pulumi-aws
19c08bf9dcb90544450ffa4eec7bf6751058fde2
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_aws/fsx/open_zfs_file_system.py
chivandikwa/pulumi-aws
19c08bf9dcb90544450ffa4eec7bf6751058fde2
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
# 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)
56.30131
550
0.694982
8bc5033e6745dd8bddb7a355569fc61f7cd99932
1,410
py
Python
tools/other/syn.py
fengjixuchui/geospy
12ff83372a7e128babd8f16c357672d1495022c8
[ "MIT" ]
1
2019-11-12T05:53:25.000Z
2019-11-12T05:53:25.000Z
tools/other/syn.py
fengjixuchui/geospy
12ff83372a7e128babd8f16c357672d1495022c8
[ "MIT" ]
null
null
null
tools/other/syn.py
fengjixuchui/geospy
12ff83372a7e128babd8f16c357672d1495022c8
[ "MIT" ]
null
null
null
#!/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
23.114754
78
0.668085
8bc5c14508eaa101207214cbf9fa6cdfc7a9bf62
19,405
py
Python
NIQ_uncompiled/source_code/check_valid.py
wxhawkins/NestIQ
3a004d330e2c68b0c7eb0b0676bc4d044e52cbe4
[ "Apache-2.0" ]
null
null
null
NIQ_uncompiled/source_code/check_valid.py
wxhawkins/NestIQ
3a004d330e2c68b0c7eb0b0676bc4d044e52cbe4
[ "Apache-2.0" ]
null
null
null
NIQ_uncompiled/source_code/check_valid.py
wxhawkins/NestIQ
3a004d330e2c68b0c7eb0b0676bc4d044e52cbe4
[ "Apache-2.0" ]
null
null
null
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
38.198819
171
0.588199
8bca7c3ef84914924b0c15217d9b07d51210a502
395
py
Python
xrobot_launcher.py
martinRenou/xeus-robot-wheel
e14034c9e7c15417b9b125d3b03f660606df0b4e
[ "BSD-3-Clause" ]
null
null
null
xrobot_launcher.py
martinRenou/xeus-robot-wheel
e14034c9e7c15417b9b125d3b03f660606df0b4e
[ "BSD-3-Clause" ]
null
null
null
xrobot_launcher.py
martinRenou/xeus-robot-wheel
e14034c9e7c15417b9b125d3b03f660606df0b4e
[ "BSD-3-Clause" ]
null
null
null
if __name__ == '__main__': from xrobot import launch as _xrobot_launch _xrobot_launch(_xrobot_get_connection_filename() or '')
35.909091
76
0.701266
8bcfdd9c7b143588acd04d3d0910371718e911e3
2,977
py
Python
amodem/sampling.py
Matthew-MK/amodem
a75dda9ab0f7445589a036357e604703ccb34726
[ "MIT" ]
766
2015-01-14T15:48:07.000Z
2022-03-30T01:19:48.000Z
amodem/sampling.py
Matthew-MK/amodem
a75dda9ab0f7445589a036357e604703ccb34726
[ "MIT" ]
42
2015-01-02T18:50:11.000Z
2022-03-11T19:10:35.000Z
amodem/sampling.py
Matthew-MK/amodem
a75dda9ab0f7445589a036357e604703ccb34726
[ "MIT" ]
116
2015-01-14T20:43:52.000Z
2022-03-24T13:10:30.000Z
import itertools import numpy as np from . import common defaultInterpolator = Interpolator()
32.010753
75
0.555929
8bcfe7bd84165cc2d8ec0ab76054e252d5ad9337
2,913
py
Python
rando/core/models.py
camillemonchicourt/Geotrek-rando
df92c0f19ca37ea1750d934cedafcdb23325bc95
[ "BSD-2-Clause" ]
null
null
null
rando/core/models.py
camillemonchicourt/Geotrek-rando
df92c0f19ca37ea1750d934cedafcdb23325bc95
[ "BSD-2-Clause" ]
null
null
null
rando/core/models.py
camillemonchicourt/Geotrek-rando
df92c0f19ca37ea1750d934cedafcdb23325bc95
[ "BSD-2-Clause" ]
null
null
null
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
27.481132
93
0.632338
8bd1ed48c83c831815502fd8f24e3c648f5c81ee
3,741
py
Python
libs/dungeon.py
IdeaBot/explorer
2cd02cacb2a37f3da3308e79e88f8c26f4401b8e
[ "MIT" ]
null
null
null
libs/dungeon.py
IdeaBot/explorer
2cd02cacb2a37f3da3308e79e88f8c26f4401b8e
[ "MIT" ]
null
null
null
libs/dungeon.py
IdeaBot/explorer
2cd02cacb2a37f3da3308e79e88f8c26f4401b8e
[ "MIT" ]
null
null
null
''' 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'
35.971154
159
0.555199
8bd259e0e2d2b9af5c910c05de23636129ffb891
113
py
Python
01_Language/01_Functions/python/fflush.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
3
2020-06-28T07:42:51.000Z
2021-01-15T10:32:11.000Z
01_Language/01_Functions/python/fflush.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
9
2021-03-10T22:45:40.000Z
2022-02-27T06:53:20.000Z
01_Language/01_Functions/python/fflush.py
cliff363825/TwentyFour
09df59bd5d275e66463e343647f46027397d1233
[ "MIT" ]
1
2021-01-15T10:51:24.000Z
2021-01-15T10:51:24.000Z
# coding: utf-8 f = open("test.txt", mode="r+") f.write("hello world") f.flush() f.truncate(f.tell()) f.close()
14.125
31
0.610619
8bd2af77c54189a911eb6a57a33e86e0c8005dbd
10,917
py
Python
scrapyproject/showingspiders/toho_v2.py
gas1121/JapanCinemaStatusSpider
67c7b963914565589f64dd1bcf18839a4160ea34
[ "MIT" ]
2
2018-06-07T13:28:03.000Z
2018-12-10T14:04:53.000Z
scrapyproject/showingspiders/toho_v2.py
gas1121/JapanCinemaStatusSpider
67c7b963914565589f64dd1bcf18839a4160ea34
[ "MIT" ]
null
null
null
scrapyproject/showingspiders/toho_v2.py
gas1121/JapanCinemaStatusSpider
67c7b963914565589f64dd1bcf18839a4160ea34
[ "MIT" ]
null
null
null
# -*- 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
45.298755
79
0.646973
8bd49f53da7caa09d61a988bf0e05ae48ef80b17
947
py
Python
tasks.py
ggrbill/fortran-examples
a790462fa3956a65505d4f529556f81cd5b0de95
[ "MIT" ]
null
null
null
tasks.py
ggrbill/fortran-examples
a790462fa3956a65505d4f529556f81cd5b0de95
[ "MIT" ]
null
null
null
tasks.py
ggrbill/fortran-examples
a790462fa3956a65505d4f529556f81cd5b0de95
[ "MIT" ]
null
null
null
from invoke import task
18.211538
74
0.583949
8bd4b1d2130b763d822163e0d5fcb7c191a3f224
203
py
Python
aristotle_json_editor/apps.py
aristotle-mdr/json-metadata-editor
2d97bea85c822d2e7b59fc8d96ca3eaa3b1ed916
[ "MIT" ]
null
null
null
aristotle_json_editor/apps.py
aristotle-mdr/json-metadata-editor
2d97bea85c822d2e7b59fc8d96ca3eaa3b1ed916
[ "MIT" ]
1
2017-07-25T09:44:11.000Z
2017-07-25T09:44:11.000Z
aristotle_json_editor/apps.py
aristotle-mdr/json-metadata-editor
2d97bea85c822d2e7b59fc8d96ca3eaa3b1ed916
[ "MIT" ]
null
null
null
from aristotle_mdr.apps import AristotleExtensionBaseConfig
29
62
0.832512
8bd58dcecb3710fe85f09d22baab6422be4f4f1c
323
py
Python
fairlearn/reductions/_exponentiated_gradient/__init__.py
arita37/fairlearn
8f2cb25ca6a0c0aadcff90b927936de6d53ff5fa
[ "MIT" ]
2
2019-11-30T09:02:42.000Z
2019-12-02T10:24:29.000Z
fairlearn/reductions/_exponentiated_gradient/__init__.py
arita37/fairlearn
8f2cb25ca6a0c0aadcff90b927936de6d53ff5fa
[ "MIT" ]
null
null
null
fairlearn/reductions/_exponentiated_gradient/__init__.py
arita37/fairlearn
8f2cb25ca6a0c0aadcff90b927936de6d53ff5fa
[ "MIT" ]
null
null
null
# 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" ]
29.363636
77
0.79257
8bd6939b53a3043718695a488bbde929cd4e44d7
423
py
Python
akagi/contents/__init__.py
pauchan/akagi
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
[ "MIT" ]
26
2017-05-18T11:52:04.000Z
2018-08-25T22:03:07.000Z
akagi/contents/__init__.py
pauchan/akagi
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
[ "MIT" ]
325
2017-05-08T07:22:28.000Z
2022-03-31T15:43:18.000Z
akagi/contents/__init__.py
pauchan/akagi
7cf1f5a52b8f1ebfdc74a527bf6b26254f99343b
[ "MIT" ]
7
2017-05-02T02:06:15.000Z
2020-04-09T05:32:11.000Z
# -*- 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
35.25
65
0.858156
8bd769344a472b553f48b5163b0040a5e6c76aa3
4,313
py
Python
src/advent/year2019/intcode.py
davidism/advent
761756f179c3547f44ec035880f29f58d80903f8
[ "BSD-3-Clause" ]
5
2019-12-09T06:02:22.000Z
2021-12-03T18:02:49.000Z
src/advent/year2019/intcode.py
davidism/advent
761756f179c3547f44ec035880f29f58d80903f8
[ "BSD-3-Clause" ]
null
null
null
src/advent/year2019/intcode.py
davidism/advent
761756f179c3547f44ec035880f29f58d80903f8
[ "BSD-3-Clause" ]
2
2019-09-19T04:44:33.000Z
2021-05-09T14:39:58.000Z
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(",")]
23.828729
85
0.537909
8bd88ec45c6933abd1b51585d3a13a40674a382b
225
py
Python
exer/ex5-2.py
vitorsergiota/python
2cc95392a2a52a871e0582e4e900c0aa24a021a1
[ "MIT" ]
null
null
null
exer/ex5-2.py
vitorsergiota/python
2cc95392a2a52a871e0582e4e900c0aa24a021a1
[ "MIT" ]
null
null
null
exer/ex5-2.py
vitorsergiota/python
2cc95392a2a52a871e0582e4e900c0aa24a021a1
[ "MIT" ]
null
null
null
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)
25
47
0.622222
8bd97144b2dc03785cd1d725114cfe7c4ea6a97a
644
py
Python
story/models.py
sachink2010/DjangoTrial
8b78a31409b614959ed45380f2b8ee9f03fa9f90
[ "MIT" ]
null
null
null
story/models.py
sachink2010/DjangoTrial
8b78a31409b614959ed45380f2b8ee9f03fa9f90
[ "MIT" ]
null
null
null
story/models.py
sachink2010/DjangoTrial
8b78a31409b614959ed45380f2b8ee9f03fa9f90
[ "MIT" ]
null
null
null
from django.db import models # Create your models here.
40.25
75
0.768634
8bdc456df221aa9aaf1072900c707aafc646d202
3,123
py
Python
scripts/find_best_fit.py
NERC-CEH/nanofase-calibration
e45da5f0566e345504214018eb4b9c013bab4c57
[ "BSD-3-Clause" ]
null
null
null
scripts/find_best_fit.py
NERC-CEH/nanofase-calibration
e45da5f0566e345504214018eb4b9c013bab4c57
[ "BSD-3-Clause" ]
null
null
null
scripts/find_best_fit.py
NERC-CEH/nanofase-calibration
e45da5f0566e345504214018eb4b9c013bab4c57
[ "BSD-3-Clause" ]
null
null
null
#!/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()
42.780822
114
0.700288
8bde4876eb8d22e2a2bf6ea4f21056c49d4893b8
347
py
Python
examples/simple1.py
jimcortez/spotipy_twisted
49ff2a4a5a5a9b3184b22adbe068eb91a38f3102
[ "MIT" ]
null
null
null
examples/simple1.py
jimcortez/spotipy_twisted
49ff2a4a5a5a9b3184b22adbe068eb91a38f3102
[ "MIT" ]
null
null
null
examples/simple1.py
jimcortez/spotipy_twisted
49ff2a4a5a5a9b3184b22adbe068eb91a38f3102
[ "MIT" ]
null
null
null
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'])
20.411765
62
0.743516
8bde558284ee50c285e21e6e1f4a0e2c6265f5bf
21,737
py
Python
pysnmp-with-texts/CISCO-ATM-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/CISCO-ATM-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/CISCO-ATM-EXT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # 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)
134.179012
2,083
0.776096
8bdf0a8fc72d26035fdc4522645b4d01820727b6
4,905
py
Python
arrows/pytorch/seg_utils.py
neal-siekierski/kwiver
1c97ad72c8b6237cb4b9618665d042be16825005
[ "BSD-3-Clause" ]
null
null
null
arrows/pytorch/seg_utils.py
neal-siekierski/kwiver
1c97ad72c8b6237cb4b9618665d042be16825005
[ "BSD-3-Clause" ]
null
null
null
arrows/pytorch/seg_utils.py
neal-siekierski/kwiver
1c97ad72c8b6237cb4b9618665d042be16825005
[ "BSD-3-Clause" ]
null
null
null
# 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
33.367347
80
0.626504
8bdf61ec1b8d8328f9ce10467e5dc4c43240c500
6,421
py
Python
fdtd/2d/src/fdtd/solver.py
Elena-Torres-Lozano/MCFNL2021
b60ecda2dc35fe08ce6cf131c45acc0349dce29c
[ "BSD-3-Clause" ]
null
null
null
fdtd/2d/src/fdtd/solver.py
Elena-Torres-Lozano/MCFNL2021
b60ecda2dc35fe08ce6cf131c45acc0349dce29c
[ "BSD-3-Clause" ]
null
null
null
fdtd/2d/src/fdtd/solver.py
Elena-Torres-Lozano/MCFNL2021
b60ecda2dc35fe08ce6cf131c45acc0349dce29c
[ "BSD-3-Clause" ]
null
null
null
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
33.973545
79
0.454914
8bdfa2aafd82d2863e79980ee316f8cecf63acbc
2,505
py
Python
myticker.py
bitsanity/rateboard
f362505d6b9672d2f22bc6e6650975899d2ea127
[ "Apache-2.0" ]
3
2017-08-24T14:36:49.000Z
2018-11-21T21:14:06.000Z
myticker.py
bitsanity/rateboard
f362505d6b9672d2f22bc6e6650975899d2ea127
[ "Apache-2.0" ]
null
null
null
myticker.py
bitsanity/rateboard
f362505d6b9672d2f22bc6e6650975899d2ea127
[ "Apache-2.0" ]
null
null
null
#!/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
28.793103
76
0.64511
8bdfada5a195abb5fa1a5addc5ae23054f34a07f
62,005
py
Python
pysnmp-with-texts/ASSETMANAGEMENT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/ASSETMANAGEMENT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/ASSETMANAGEMENT-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # 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)
157.773537
5,190
0.784856
8be140e08c2dfb6a0ad53e343aaf11199164a255
487
py
Python
secret.py
yoyu777/Poll-Bot
db239b42c5c5e1af38a7c0a12b977c38949f0724
[ "MIT" ]
null
null
null
secret.py
yoyu777/Poll-Bot
db239b42c5c5e1af38a7c0a12b977c38949f0724
[ "MIT" ]
null
null
null
secret.py
yoyu777/Poll-Bot
db239b42c5c5e1af38a7c0a12b977c38949f0724
[ "MIT" ]
null
null
null
# Import the Secret Manager client library. from google.cloud import secretmanager # Create the Secret Manager client. secretmanager_client = secretmanager.SecretManagerServiceClient()
34.785714
74
0.804928
8be594b734f337508a46bc13ebf1d32d3f8e6f53
1,663
py
Python
Bot/extensions/moderation/ban.py
ChrissisCodeXD/Hikari-TestProject
236c8fc9081172d9edff6d629e5d11c5abe64205
[ "MIT" ]
null
null
null
Bot/extensions/moderation/ban.py
ChrissisCodeXD/Hikari-TestProject
236c8fc9081172d9edff6d629e5d11c5abe64205
[ "MIT" ]
null
null
null
Bot/extensions/moderation/ban.py
ChrissisCodeXD/Hikari-TestProject
236c8fc9081172d9edff6d629e5d11c5abe64205
[ "MIT" ]
null
null
null
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), )
33.938776
119
0.719784
8be59cb6314fe38c5f76d083bb061587be243807
2,043
py
Python
trend_analyze/test/test_fecth_data_from_api.py
popper2710/Trend_Analyze
0c98bcd7986bdb2d2b9bdc8022bfa08ddf0e7b0f
[ "MIT" ]
null
null
null
trend_analyze/test/test_fecth_data_from_api.py
popper2710/Trend_Analyze
0c98bcd7986bdb2d2b9bdc8022bfa08ddf0e7b0f
[ "MIT" ]
2
2020-09-26T14:58:33.000Z
2021-03-31T20:01:40.000Z
trend_analyze/test/test_fecth_data_from_api.py
popper2710/Trend_Analyze
0c98bcd7986bdb2d2b9bdc8022bfa08ddf0e7b0f
[ "MIT" ]
null
null
null
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()
32.951613
87
0.698972
8be760a4114acf5a4db49d05c1ef322eef5d00e1
1,779
py
Python
leetcode/easy/compare-version-numbers.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
leetcode/easy/compare-version-numbers.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
leetcode/easy/compare-version-numbers.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
# 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.
30.152542
100
0.518269
8be7873229c136c3351120aeb123d5e799820294
710
py
Python
utils.py
florenthemmi/ips-by-country
2f63ec2108ceaae97221de52654753c545733d84
[ "MIT" ]
1
2021-05-24T06:16:49.000Z
2021-05-24T06:16:49.000Z
utils.py
florenthemmi/ips-by-country
2f63ec2108ceaae97221de52654753c545733d84
[ "MIT" ]
null
null
null
utils.py
florenthemmi/ips-by-country
2f63ec2108ceaae97221de52654753c545733d84
[ "MIT" ]
null
null
null
from datetime import datetime from config import CIDR_MAX_SUBNETS
26.296296
71
0.640845
8be7899428e46960e100ad08d01429e3242a6f7d
4,897
py
Python
keats_crawler/crawl.py
mannmann2/keats-crawler
9fc108b75e63bf3dfac0c18ed2f0bec84d003c14
[ "MIT" ]
8
2021-01-21T19:34:59.000Z
2022-02-14T23:09:48.000Z
keats_crawler/crawl.py
mannmann2/keats-crawler
9fc108b75e63bf3dfac0c18ed2f0bec84d003c14
[ "MIT" ]
null
null
null
keats_crawler/crawl.py
mannmann2/keats-crawler
9fc108b75e63bf3dfac0c18ed2f0bec84d003c14
[ "MIT" ]
1
2021-12-27T11:09:44.000Z
2021-12-27T11:09:44.000Z
"""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()
27.357542
150
0.588115
8be7a3c80ff1ca3e87607f2cacd6a9420c5e831e
7,305
py
Python
logging_with_arcpy.py
Kortforsyningen/logging-with-arcpy
b227aea9c377ca6e98b2c398d294c08bce506f84
[ "MIT" ]
1
2022-03-03T13:20:12.000Z
2022-03-03T13:20:12.000Z
logging_with_arcpy.py
Kortforsyningen/logging-with-arcpy
b227aea9c377ca6e98b2c398d294c08bce506f84
[ "MIT" ]
null
null
null
logging_with_arcpy.py
Kortforsyningen/logging-with-arcpy
b227aea9c377ca6e98b2c398d294c08bce506f84
[ "MIT" ]
1
2022-03-30T11:33:43.000Z
2022-03-30T11:33:43.000Z
# -*- 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
46.826923
132
0.699384
8be7ac2245946060119cdd1d1ac823a02f85034d
892
py
Python
bot.py
fangyi-zhou/renamer
ec1215f7afea1c942116a37bdd2a5fcbabee6e94
[ "Unlicense" ]
null
null
null
bot.py
fangyi-zhou/renamer
ec1215f7afea1c942116a37bdd2a5fcbabee6e94
[ "Unlicense" ]
null
null
null
bot.py
fangyi-zhou/renamer
ec1215f7afea1c942116a37bdd2a5fcbabee6e94
[ "Unlicense" ]
null
null
null
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)
21.756098
88
0.649103
8be86bfbc616af693be4c8b1bf95b938750cfb4b
8,035
py
Python
market/views.py
morphosis-nitmz/Stock-Bridge-2018
5f7d55a5dfeed52e2fa46fd1e2abd6bba80c954a
[ "MIT" ]
12
2019-09-10T02:51:01.000Z
2022-03-23T07:19:34.000Z
market/views.py
morphosis-nitmz/Stock-Bridge-2018
5f7d55a5dfeed52e2fa46fd1e2abd6bba80c954a
[ "MIT" ]
null
null
null
market/views.py
morphosis-nitmz/Stock-Bridge-2018
5f7d55a5dfeed52e2fa46fd1e2abd6bba80c954a
[ "MIT" ]
8
2019-06-26T14:16:23.000Z
2022-01-07T08:48:08.000Z
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'
40.994898
108
0.601369
8be87a2381ba6a63956f68b01f8d66e526e6f9d0
21,478
py
Python
library.py
Kladmen228/kurs_work-c-
6648ca3d4f454aaa429993db80cd2fc6a3ab2bb4
[ "Apache-2.0" ]
2
2020-07-11T21:12:42.000Z
2020-07-11T21:49:22.000Z
library.py
Kladmen228/kurs_work-PP
6648ca3d4f454aaa429993db80cd2fc6a3ab2bb4
[ "Apache-2.0" ]
null
null
null
library.py
Kladmen228/kurs_work-PP
6648ca3d4f454aaa429993db80cd2fc6a3ab2bb4
[ "Apache-2.0" ]
null
null
null
# 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()
44.193416
122
0.648524
8be8ad1bff74a971fe98e6113f758f85c95026e6
621
py
Python
utilities.py
tsilifis/BayesEmbed-mfGP
61ee75284bac34084ee4d171257023cc4d60c910
[ "MIT" ]
null
null
null
utilities.py
tsilifis/BayesEmbed-mfGP
61ee75284bac34084ee4d171257023cc4d60c910
[ "MIT" ]
null
null
null
utilities.py
tsilifis/BayesEmbed-mfGP
61ee75284bac34084ee4d171257023cc4d60c910
[ "MIT" ]
null
null
null
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])
23
83
0.621578
8be92b2b82e61183cec9beb6bacf4eefc2f03ab0
4,049
py
Python
data/LoadingScripts/adapt_tcga.py
Bertinus/causal_cell_embedding
417b55749130fc7b7832fd3ee4c49feff4a04593
[ "MIT" ]
null
null
null
data/LoadingScripts/adapt_tcga.py
Bertinus/causal_cell_embedding
417b55749130fc7b7832fd3ee4c49feff4a04593
[ "MIT" ]
null
null
null
data/LoadingScripts/adapt_tcga.py
Bertinus/causal_cell_embedding
417b55749130fc7b7832fd3ee4c49feff4a04593
[ "MIT" ]
null
null
null
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")
46.011364
120
0.514942
8bea72f709ee92f0256045645314ed84137d7a0e
6,924
py
Python
tests/test_share_resource/test_master_data.py
anhlt59/django_refactor
1b1d86af9f732a000e30feb7644f6ca60b6e516a
[ "MIT" ]
null
null
null
tests/test_share_resource/test_master_data.py
anhlt59/django_refactor
1b1d86af9f732a000e30feb7644f6ca60b6e516a
[ "MIT" ]
null
null
null
tests/test_share_resource/test_master_data.py
anhlt59/django_refactor
1b1d86af9f732a000e30feb7644f6ca60b6e516a
[ "MIT" ]
null
null
null
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
33.941176
102
0.718515
8bec7a78ef815c669108337b9955421ae8412b87
1,192
py
Python
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/get_program_binary.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
210
2016-04-09T14:26:00.000Z
2022-03-25T18:36:19.000Z
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/get_program_binary.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
72
2016-09-04T09:30:19.000Z
2022-03-27T17:06:53.000Z
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/get_program_binary.py
ShujaKhalid/deep-rl
99c6ba6c3095d1bfdab81bd01395ced96bddd611
[ "MIT" ]
64
2016-04-09T14:26:49.000Z
2022-03-21T11:19:47.000Z
'''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)
44.148148
119
0.833054
4733f343c64441b45c6474b08ce6fa31a64e3fde
176
py
Python
hazm/utils.py
perryyo/hazm
8596ea060f0c241eba7dece3ad1db6baa36439ed
[ "MIT" ]
null
null
null
hazm/utils.py
perryyo/hazm
8596ea060f0c241eba7dece3ad1db6baa36439ed
[ "MIT" ]
null
null
null
hazm/utils.py
perryyo/hazm
8596ea060f0c241eba7dece3ad1db6baa36439ed
[ "MIT" ]
1
2018-12-09T05:16:06.000Z
2018-12-09T05:16:06.000Z
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')
25.142857
53
0.75
4735a6be395ffd4914453c63b7dd438db0593092
629
py
Python
parseridge/parser/training/callbacks/save_model_callback.py
jgontrum/parseridge
f87ef82a9468addeb09a91c3b5310db38840bf0f
[ "Apache-2.0" ]
6
2019-10-06T23:00:29.000Z
2020-04-08T02:04:24.000Z
parseridge/parser/training/callbacks/save_model_callback.py
jgontrum/parseridge
f87ef82a9468addeb09a91c3b5310db38840bf0f
[ "Apache-2.0" ]
2
2020-04-28T12:06:23.000Z
2020-04-28T13:30:03.000Z
parseridge/parser/training/callbacks/save_model_callback.py
jgontrum/parseridge
f87ef82a9468addeb09a91c3b5310db38840bf0f
[ "Apache-2.0" ]
1
2019-12-23T00:53:38.000Z
2019-12-23T00:53:38.000Z
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
28.590909
77
0.696343
4735d1f5a8954c473193826a0ee08dd64ab9a93e
35
py
Python
Training/pylens/__init__.py
Annarien/GravitationalLenses
c2606aacc62d2534fb199f5228dc21c0ea604251
[ "MIT" ]
null
null
null
Training/pylens/__init__.py
Annarien/GravitationalLenses
c2606aacc62d2534fb199f5228dc21c0ea604251
[ "MIT" ]
null
null
null
Training/pylens/__init__.py
Annarien/GravitationalLenses
c2606aacc62d2534fb199f5228dc21c0ea604251
[ "MIT" ]
null
null
null
import massmodel,pylens,MassModels
17.5
34
0.885714
473611358315db91be2c68a0523fa1b4712e6722
1,083
py
Python
conanfile.py
martinmoene/lest-conan-package
db0a1eda840e819edb0c1bb5dc4d8384d1a92c19
[ "MIT" ]
null
null
null
conanfile.py
martinmoene/lest-conan-package
db0a1eda840e819edb0c1bb5dc4d8384d1a92c19
[ "MIT" ]
null
null
null
conanfile.py
martinmoene/lest-conan-package
db0a1eda840e819edb0c1bb5dc4d8384d1a92c19
[ "MIT" ]
null
null
null
from contextlib import closing from tarfile import open as taropen from urllib2 import urlopen from conans import ConanFile
32.818182
104
0.644506
47364a3924f1597cca49227e92174ee485e954ae
555
py
Python
erp/migrations/0093_auto_20200922_0802.py
Foohx/acceslibre
55135e096f2ec4e413ff991f01c17f5e0d5925c0
[ "MIT" ]
8
2020-07-23T08:17:28.000Z
2022-03-09T22:31:36.000Z
erp/migrations/0093_auto_20200922_0802.py
Foohx/acceslibre
55135e096f2ec4e413ff991f01c17f5e0d5925c0
[ "MIT" ]
37
2020-07-01T08:47:33.000Z
2022-02-03T19:50:58.000Z
erp/migrations/0093_auto_20200922_0802.py
Foohx/acceslibre
55135e096f2ec4e413ff991f01c17f5e0d5925c0
[ "MIT" ]
4
2021-04-08T10:57:18.000Z
2022-01-31T13:16:31.000Z
# Generated by Django 3.1.1 on 2020-09-22 06:02 from django.db import migrations, models
29.210526
189
0.641441
4738887a5abd7d5e02db7c0d3385f50ba3f81899
8,290
py
Python
cli/cli.py
MustafaTheCoder/create-a-cli-tool
9f7c327927e22b390a58c8c8b599a59cad246f2e
[ "MIT" ]
3
2021-09-27T10:35:24.000Z
2021-10-02T08:16:46.000Z
cli/cli.py
MustafaTheCoder/create-a-cli-tool
9f7c327927e22b390a58c8c8b599a59cad246f2e
[ "MIT" ]
1
2021-09-22T15:44:30.000Z
2021-09-22T15:44:30.000Z
cli/cli.py
MustafaTheCoder/create-a-cli-tool
9f7c327927e22b390a58c8c8b599a59cad246f2e
[ "MIT" ]
3
2021-09-21T05:19:42.000Z
2021-10-02T08:16:48.000Z
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 *
30.932836
124
0.458987
47391c58cb36718e353c6d24ef9b6c3dc10d34e8
230
py
Python
propertiesTemplate/Fields/FieldTester.py
HenShalom/tableTransform
ede5c9ed3ecb32f74712778a6746b03773ac28ef
[ "Apache-2.0" ]
null
null
null
propertiesTemplate/Fields/FieldTester.py
HenShalom/tableTransform
ede5c9ed3ecb32f74712778a6746b03773ac28ef
[ "Apache-2.0" ]
null
null
null
propertiesTemplate/Fields/FieldTester.py
HenShalom/tableTransform
ede5c9ed3ecb32f74712778a6746b03773ac28ef
[ "Apache-2.0" ]
2
2019-11-20T02:47:23.000Z
2019-11-20T02:47:23.000Z
from propertiesTemplate.Fields.BasicField import BasicField from propertiesTemplate.Fields.ConstField import ConstField
25.555556
59
0.76087
473931c03e87e8ad7ec18f92b6ba042e2eddadd3
494
py
Python
Alice/Sorting/selection_sort.py
sandeepm96/cormen-algos
9154f6ce9cb0c318bc0d6ecaa13676d080985cec
[ "MIT" ]
1
2017-09-15T13:34:19.000Z
2017-09-15T13:34:19.000Z
Alice/Sorting/selection_sort.py
sandeepm96/cormen-algos
9154f6ce9cb0c318bc0d6ecaa13676d080985cec
[ "MIT" ]
null
null
null
Alice/Sorting/selection_sort.py
sandeepm96/cormen-algos
9154f6ce9cb0c318bc0d6ecaa13676d080985cec
[ "MIT" ]
null
null
null
test = list(map(int,input().split(' '))) t = SelectionSort(test) print(t.result())
29.058824
81
0.544534
4739439933f695399a93b2006266d661c9ac6918
1,521
py
Python
sprint/DS-Unit-3-Sprint-3-Productization-and-Cloud/sprint/aq_dashboard.py
ndow33/DS-Unit-3-Sprint-3-Productization-and-Cloud
17ebfc34991649580fce24dae5c0a7933f5b3095
[ "MIT" ]
null
null
null
sprint/DS-Unit-3-Sprint-3-Productization-and-Cloud/sprint/aq_dashboard.py
ndow33/DS-Unit-3-Sprint-3-Productization-and-Cloud
17ebfc34991649580fce24dae5c0a7933f5b3095
[ "MIT" ]
null
null
null
sprint/DS-Unit-3-Sprint-3-Productization-and-Cloud/sprint/aq_dashboard.py
ndow33/DS-Unit-3-Sprint-3-Productization-and-Cloud
17ebfc34991649580fce24dae5c0a7933f5b3095
[ "MIT" ]
null
null
null
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
27.160714
76
0.663379