content
stringlengths
7
1.05M
# Copyright (c) Microsoft 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. async def test_check_the_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.check("input") assert await page.evaluate("checkbox.checked") async def test_not_check_the_checked_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.check("input") assert await page.evaluate("checkbox.checked") async def test_uncheck_the_box(page): await page.setContent('<input id="checkbox" type="checkbox" checked></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False async def test_not_uncheck_the_unchecked_box(page): await page.setContent('<input id="checkbox" type="checkbox"></input>') await page.uncheck("input") assert await page.evaluate("checkbox.checked") is False async def test_check_the_box_by_label(page): await page.setContent( '<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_the_box_outside_label(page): await page.setContent( '<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_the_box_inside_label_without_id(page): await page.setContent( '<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>' ) await page.check("label") assert await page.evaluate("checkbox.checked") async def test_check_radio(page): await page.setContent( """ <input type='radio'>one</input> <input id='two' type='radio'>two</input> <input type='radio'>three</input>""" ) await page.check("#two") assert await page.evaluate("two.checked") async def test_check_the_box_by_aria_role(page): await page.setContent( """<div role='checkbox' id='checkbox'>CHECKBOX</div> <script> checkbox.addEventListener('click', () => checkbox.setAttribute('aria-checked', 'true')) </script>""" ) await page.check("div") assert await page.evaluate("checkbox.getAttribute('aria-checked')")
# https://leetcode.com/problems/single-number-iii/ class Solution: def singleNumber(self, nums: List[int]) -> List[int]: d = {} for num in nums: if num in d: d[num] += 1 else: d[num] = 1 result = [] for key, value in d.items(): if value == 1: result.append(key) return result
# https://stackoverflow.com/questions/1883980/find-the-nth-occurrence-of-substring-in-a-string def find_nth(haystack, needle, n): start = haystack.find(needle) while start >= 0 and n > 1: start = haystack.find(needle, start+len(needle)) n -= 1 return start file_to_be_read = input("Which file do you want to open? (Please specify the full filename.)\n") rtz_file = open(file_to_be_read, 'r') file_to_be_written = input("Which file do you want to write to? (The file ending 'rtz' will be added automagically.)\n") file = open(file_to_be_written + ".rtz", "w") count = 0 schedule_count = 0 date = "2018-04-06" hours = 10 minutes = 40 seconds = 11 for line in rtz_file: line = line.strip() if line: if "<!--" in line: pass else: if line.startswith('<waypoint id="'): count += 1 file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):] + '\n') # file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):]) if "</waypoint><waypoint" in line: count += 1 file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):] + '\n') # file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):]) else: if "<waypoint id=" in line: pass else: if "<scheduleElement eta=" in line: pass else: file.write(line + '\n') if "<calculated" in line: for number in range(count): schedule_count += 1 seconds += 13 if seconds < 45: seconds += 14 elif seconds > 59: seconds = 15 if minutes < 59: minutes += 1 elif minutes == 59: minutes = 0 hours += 1 if minutes < 9: file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":0" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') elif minutes >= 10: file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') # file.write(line + '\n')
a=int(input("Enter a number")) if a%2==0: print(a,"is an Even Number") else: print(a,"is an Odd Number")
# wczytanie wszystkich trzech plikow with open('../dane/dane5-1.txt') as f: data1 = [] for line in f.readlines(): data1.append(int(line[:-1])) with open('../dane/dane5-2.txt') as f: data2 = [] for line in f.readlines(): data2.append(int(line[:-1])) with open('../dane/dane5-3.txt') as f: data3 = [] for line in f.readlines(): data3.append(int(line[:-1])) # laczy elementy obok siebie ktore maja ten sam znak def squish(data): new_data = [data[0]] prev_sign = data[0] for num in data[1:]: # jezeli pomnozone to te z tym samym znakiem beda dawaly dodatnia liczbe if num * prev_sign > 0: new_data[-1] += num else: new_data.append(num) prev_sign = num return new_data # zwraca najlepsza sume ciagu def best_sum(data): # najlepsza suma rec = -float('inf') # przechodze po kazdym zakresie for start in range(len(data)): # aktualna suma curr_sum = data[start] for end in range(start + 1, len(data)): # zliczenie sumy curr_sum += data[end] # jezeli suma wieksza od rekordu to zapisz if curr_sum > rec: rec = curr_sum return rec rec1 = best_sum(squish(data1)) rec2 = best_sum(squish(data2)) rec3 = best_sum(squish(data3)) # wyswietlenie odpowiedzi answer = f'5 b) Najlepsza suma dla dane5-1.txt: {rec1}; ' answer += f'Najlepsza suma dla dane5-2.txt: {rec2}; ' answer += f'Najlepsza suma dla dane5-3.txt: {rec3}' print(answer)
numbers = list(range(0, 110, 10)) numbers = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100) second = [] x = 0 while x < len(numbers): t = numbers[x] *2.5 if t % 2 == 0: second.append(int(t)) x += 1 print(second) print(x)
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "workspace_and_buildfile") load( "@bazel_tools//tools/cpp:lib_cc_configure.bzl", "auto_configure_fail", "auto_configure_warning", "escape_string", "get_env_var", "get_starlark_list", "resolve_labels", "split_escaped", "which", ) load( "//AvrToolchain:cc_toolchain/cc_toolchain.bzl", "create_cc_toolchain_package", ) load( "//AvrToolchain:platforms/platforms.bzl", "write_constraints", ) load( "//AvrToolchain:platforms/platform_list.bzl", "platforms", ) def _avr_toolchain_impl(repository_ctx): prefix = "@EmbeddedSystemsBuildScripts//AvrToolchain:" paths = resolve_labels( repository_ctx, [prefix + label for label in [ "cc_toolchain/cc_toolchain_config.bzl.tpl", "platforms/cpu_frequency/cpu_frequency.bzl.tpl", "platforms/misc/BUILD.tpl", "platforms/BUILD.tpl", "helpers.bzl.tpl", "host_config/BUILD.tpl", "platforms/platform_list.bzl", "platforms/mcu/mcu.bzl", "BUILD.tpl", "cc_toolchain/avr-gcc.sh", ]], ) write_constraints(repository_ctx, paths) create_cc_toolchain_package(repository_ctx, paths) repository_ctx.template( "helpers.bzl", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:helpers.bzl.tpl"], ) repository_ctx.file("BUILD") repository_ctx.template("host_config/BUILD", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:host_config/BUILD.tpl"]) repository_ctx.template( "platforms/platform_list.bzl", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/platform_list.bzl"], ) repository_ctx.template( "platforms/mcu/mcu.bzl", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/mcu/mcu.bzl"], ) repository_ctx.template( "BUILD", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:BUILD.tpl"], ) _get_avr_toolchain_def_attrs = { "gcc_tool": attr.string(), "size_tool": attr.string(), "ar_tool": attr.string(), "ld_tool": attr.string(), "cpp_tool": attr.string(), "gcov_tool": attr.string(), "nm_tool": attr.string(), "objdump_tool": attr.string(), "strip_tool": attr.string(), "objcopy_tool": attr.string(), "mcu_list": attr.string_list(mandatory = True), } create_avr_toolchain = repository_rule( implementation = _avr_toolchain_impl, attrs = _get_avr_toolchain_def_attrs, doc = """ Creates an avr toolchain repository. The repository will contain toolchain definitions and constraints to allow compilation for avr platforms using the avr-gcc compiler. The compiler itself has to be provided by the operating system and discoverable through the PATH variable. Additionally avr-binutils and avr-libc should be installed. """, ) def avr_toolchain(): create_avr_toolchain( name = "AvrToolchain", mcu_list = platforms, ) for mcu in platforms: native.register_toolchains( "@AvrToolchain//cc_toolchain:cc-toolchain-avr-" + mcu, )
class initial(object): pass INITIAL = initial() another = INITIAL print(another is INITIAL)
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) {*[1,2,3], *[4,5,6]} # EXPECTED: [ ..., BUILD_SET_UNPACK(2), ... ]
def capital_indexes(string: str) -> list: return [index for index, char in enumerate(string) if char.isupper()] # return [letter for letter in range(len(indexes)) if indexes[letter].isupper()] def tests() -> None: print(capital_indexes("mYtESt")) # [1, 3, 4] print(capital_indexes("owO")) if __name__ == "__main__": tests()
# dataset settings dataset_type = 'ImageNet' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224, backend='pillow'), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1), backend='pillow'), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ] data_root = 'data/' data = dict( samples_per_gpu=32, workers_per_gpu=2, train=dict( type=dataset_type, data_prefix=data_root+'imagenet1k/train', ann_file=data_root+'imagenet1k/meta/train.txt', pipeline=train_pipeline), val=dict( type=dataset_type, data_prefix=data_root+'imagenet1k/val', ann_file=data_root+'imagenet1k/meta/val.txt', pipeline=test_pipeline), test=dict( # replace `data/val` with `data/test` for standard test type=dataset_type, data_prefix=data_root+'imagenet1k/val', ann_file=data_root+'imagenet1k/meta/val.txt', pipeline=test_pipeline)) # model settings model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, topk=(1, 5), dropout_ratio=0.0, loss=dict( type='LabelSmoothLoss', loss_weight=1.0, label_smooth_val=0.1, num_classes=1000), )) # optimizer optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) # learning policy #lr_config = dict( # policy='CosineAnnealing', # min_lr=0, # warmup='linear', # warmup_iters=2500, # warmup_ratio=0.25) lr_config = dict(policy='step', step=[30, 60, 90]) runner = dict(type='EpochBasedRunner', max_epochs=100) # checkpoint saving checkpoint_config = dict(interval=100) evaluation = dict(interval=1, metric='accuracy') # yapf:disable log_config = dict( interval=100, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:enable dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)]
"""Scorer of model predictions. Adaped from OneIE. """ def safe_div(num, denom): if denom > 0: if num / denom <= 1: return num / denom else: return 1 else: return 0 def compute_f1(predicted, gold, matched): precision = safe_div(matched, predicted) recall = safe_div(matched, gold) f1 = safe_div(2 * precision * recall, precision + recall) return precision, recall, f1 def convert_arguments(triggers, roles): args = set() for role in roles: trigger_idx = role[0] trigger_label = triggers[trigger_idx][-1] args.add((trigger_label, role[1], role[2], role[3])) return args def score_graphs(gold_graphs, pred_graphs): gold_arg_num = pred_arg_num = arg_idn_num = arg_class_num = 0 gold_trigger_num = pred_trigger_num = trigger_idn_num = trigger_class_num = 0 gold_men_num = pred_men_num = men_match_num = 0 for gold_graph, pred_graph in zip(gold_graphs, pred_graphs): # Trigger gold_triggers = gold_graph.triggers pred_triggers = pred_graph.triggers gold_trigger_num += len(gold_triggers) pred_trigger_num += len(pred_triggers) for trg_start, trg_end, event_type in pred_triggers: matched = [item for item in gold_triggers if item[0] == trg_start and item[1] == trg_end] if matched: trigger_idn_num += 1 if matched[0][-1] == event_type: trigger_class_num += 1 # Argument gold_args = convert_arguments(gold_triggers, gold_graph.roles) pred_args = convert_arguments(pred_triggers, pred_graph.roles) gold_arg_num += len(gold_args) pred_arg_num += len(pred_args) for pred_arg in pred_args: event_type, arg_start, arg_end, role = pred_arg gold_idn = {item for item in gold_args if item[1] == arg_start and item[2] == arg_end and item[0] == event_type} if gold_idn: arg_idn_num += 1 gold_class = {item for item in gold_idn if item[-1] == role} if gold_class: arg_class_num += 1 trigger_id_prec, trigger_id_rec, trigger_id_f = compute_f1( pred_trigger_num, gold_trigger_num, trigger_idn_num) trigger_prec, trigger_rec, trigger_f = compute_f1( pred_trigger_num, gold_trigger_num, trigger_class_num) role_id_prec, role_id_rec, role_id_f = compute_f1( pred_arg_num, gold_arg_num, arg_idn_num) role_prec, role_rec, role_f = compute_f1( pred_arg_num, gold_arg_num, arg_class_num) print('Trigger Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format( trigger_id_prec * 100.0, trigger_id_rec * 100.0, trigger_id_f * 100.0)) print('Trigger Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format( trigger_prec * 100.0, trigger_rec * 100.0, trigger_f * 100.0)) print('Argument Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format( role_id_prec * 100.0, role_id_rec * 100.0, role_id_f * 100.0)) print('Argument Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format( role_prec * 100.0, role_rec * 100.0, role_f * 100.0)) scores = { 'TC': {'prec': trigger_prec, 'rec': trigger_rec, 'f': trigger_f}, 'TI': {'prec': trigger_id_prec, 'rec': trigger_id_rec, 'f': trigger_id_f}, 'AC': {'prec': role_prec, 'rec': role_rec, 'f': role_f}, 'AI': {'prec': role_id_prec, 'rec': role_id_rec, 'f': role_id_f}, } return scores
class StakeHolder: def __init__(self, staker, amount_pending_for_approval, amount_approved, block_no_created): self._staker = staker self._amount_pending_for_approval = amount_pending_for_approval self._amount_approved = amount_approved self._block_no_created = block_no_created def to_dict(self): return { "staker": self._staker, "amount_pending_for_approval": self._amount_pending_for_approval, "amount_approved": self._amount_approved, "block_no_created": self._block_no_created } @property def staker(self): return self._staker @property def amount_pending_for_approval(self): return self._amount_pending_for_approval @property def amount_approved(self): return self._amount_approved @property def block_no_created(self): return self._block_no_created
sender = '' password = '' smtp_name = 'smtp.gmail.com' smtp_port = 587 body = """ <html> <body> <p>Hi User,<br> How are you?<br> </p> </body> </html> """ receiver = '' signature_img_name = 'awesome_attachment.png' signature_img_path = 'C:/Users/user/Desktop/' attachment_name = signature_img_name attachment_path = signature_img_path important_body = ''' <html> <body> <p> It is an e-mail with awesome attachment!<br> <br> And here it is</p> <br> Best regards, <br> <img src="cid:signature_image"> </body> </html> '''
""" * Assignment: Type Float Gradient * Required: no * Complexity: hard * Lines of code: 7 lines * Time: 8 min English: 1. At what altitude above sea level, pressure is equal to partial pressure of Oxygen 2. Print result in meters rounding to two decimal places 3. To calculate partial pressure use ratio (100% is 1013.25 hPa, 20.946% is how many hPa?) 4. Calculated altitude is pressure at sea level minus oxygen partial pressure divided by gradient 5. Mind the operator precedence 6. Run doctests - all must succeed Polish: 1. Na jakiej wysokości nad poziomem morza panuje ciśnienie równe ciśnieniu parcjalnemu tlenu? 2. Wypisz rezultat w metrach zaokrąglając do dwóch miejsc po przecinku 3. Aby policzyć ciśnienie parcjalne skorzystaj z proporcji (100% to 1013.25 hPa, 20.946% to ile hPa?) 4. Wyliczona wysokość to ciśnienie atmosferyczne na poziomie morza minus ciśnienie parcjalne tlenu podzielone przez gradient 5. Zwróć uwagę na kolejność wykonywania działań 6. Uruchom doctesty - wszystkie muszą się powieść Hints: * pressure gradient (decrease) = 11.3 Pa / 1 m * 1 hPa = 100 Pa * 1 kPa = 1000 Pa * 1 ata = 1013.25 hPa (ISA - International Standard Atmosphere) * Atmosphere gas composition: * Nitrogen 78.084% * Oxygen 20.946% * Argon 0.9340% * Carbon Dioxide 0.0407% * Others 0.001% Tests: >>> import sys; sys.tracebacklimit = 0 >>> assert pO2 is not Ellipsis, \ 'Assign result to variable: `pO2`' >>> assert gradient is not Ellipsis, \ 'Assign result to variable: `gradient`' >>> assert altitude is not Ellipsis, \ 'Assign result to variable: `altitude`' >>> assert type(pO2) is float, \ 'Variable `pO2` has invalid type, should be float' >>> assert type(gradient) is float, \ 'Variable `gradient` has invalid type, should be float' >>> assert type(altitude) is float, \ 'Variable `altitude` has invalid type, should be float' >>> pO2 21223.5345 >>> gradient 11.3 >>> round(altitude/m, 2) 7088.63 """ PERCENT = 100 N2 = 78.084 / PERCENT O2 = 20.946 / PERCENT Ar = 0.9340 / PERCENT CO2 = 0.0407 / PERCENT Others = 0.001 / PERCENT m = 1 Pa = 1 hPa = 100 * Pa ata = 1013.25 * hPa pO2 = O2 * ata # float: 11.3 Pascals per meter gradient = ... # float: ata minus pO2 all that divided by gradient altitude = ...
""" 1120. Maximum Average Subtree Medium Given the root of a binary tree, find the maximum average value of any subtree of that tree. (A subtree of a tree is any node of that tree plus all its descendants. The average value of a tree is the sum of its values, divided by the number of nodes.) Example 1: Input: [5,6,1] Output: 6.00000 Explanation: For the node with value = 5 we have an average of (5 + 6 + 1) / 3 = 4. For the node with value = 6 we have an average of 6 / 1 = 6. For the node with value = 1 we have an average of 1 / 1 = 1. So the answer is 6 which is the maximum. Note: The number of nodes in the tree is between 1 and 5000. Each node will have a value between 0 and 100000. Answers will be accepted as correct if they are within 10^-5 of the correct answer. """ # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def maximumAverageSubtree(self, root: TreeNode) -> float: self.res = 0 def helper(root): if not root: return [0, 0.0] n1, s1 = helper(root.left) n2, s2 = helper(root.right) n = n1 + n2 + 1 s = s1 + s2 + root.val self.res = max(self.res, s / n) return [n, s] helper(root) return self.res
# -*- coding: utf-8 -*- template_model_creation = """import pandas as pd from sklearn.model_selection import train_test_split {model_import} as ChosenMLAlgorithm from sklearn.metrics import accuracy_score, confusion_matrix import pickle csv_file = "{csv_file}" model_file = "{model_file}" predictors = {predictors} targets = {targets} historical_data = pd.read_csv(csv_file) pred_train, pred_test, tar_train, tar_test = train_test_split(historical_data[predictors], historical_data[targets], test_size=.3) if len(targets) == 1: tar_train = tar_train.values.ravel() tar_test = tar_test.values.ravel() model = ChosenMLAlgorithm().fit(pred_train, tar_train) predictions = model.predict(pred_test) # Analyze accuracy of prediction. # Remember that the data is randomly split into training and test set, so the values below will change # ever time you create a new model print confusion_matrix(tar_test, predictions) print accuracy_score(tar_test, predictions) pickle.dump(model, open(model_file, "wb")) """ template_model_predictor = """import pickle import numpy as np model_file = "{model_file}" model = pickle.load(open(model_file, 'rb')) # input_to_predict has to follow the order below: # {predictors} prediction = model.predict(np.array([input_to_predict])) print prediction """
my_variabel = "hai darmawan" for variabel_baru in my_variabel: print("for string: ",variabel_baru) my_list =["aku", "kamu", "dia"] my_tuple=(1,5,6,7) for variabel_baru3 in my_tuple: print("for list or tuple", variabel_baru3)
def main(): x=11 y=2 print("Addition X+Y=",x+y) print("Subtraction X-Y=",x-y) print("Multiplication X*Y=",x*y) print("Division X/Y=",x/y) print("Modulus X%Y=",x%y) print("Exponent X**Y=",x**y) print("Floor Division X//Y=",x//y) if __name__ == '__main__': main()
def test_screen_two(): for num in range(0, 100): col = int(num * 0.01 * 2.0) y = (num * 0.01 - float(col) / 2.0) * 2.0 newY = y / 960.0 * 480.0 + 1.0 / 4.0 print('col:' + str(col) + ' num: ' + str(num) + ' y: ' + str(y) + ' newY: ' + str(newY)) # print(str(newY)) def test_scale(): for num in range(0, 100): col = num * 0.01 textureCoordinateToUse = col - 0.5 use = textureCoordinateToUse / 1.5 newUse = use + 0.5 print(' textureCoordinateToUse: ' + str(textureCoordinateToUse)[0:5] + ' use: ' + str(use)[0:5] + ' newUse: ' + str(newUse)[0:5] + ' ' + str(col / 1.5)[0:5]) if __name__ == "__main__": test_scale() # test_screen_two()
__project__ = "o3seespy" __author__ = "Maxim Millen & Minjie Zhu" __version__ = "3.1.0.18" __license__ = "MIT with OpenSees License"
# By Kami Bigdely # Decompose conditional: You have a complicated conditional(if-then-else) statement. Extract # methods from the condition, then part, and else part(s). def make_alert_sound(): print('made alert sound.') def make_accept_sound(): print('made acceptance sound') def check_if_toxin(ingredients): """Checks if any of the ingredients are in the list of toxic ingrediets""" toxic_indredients = ['sodium nitrate', 'sodium benzoate', 'sodium oxide'] return any(item in ingredients for item in toxic_indredients) ingredients = ['sodium benzoate'] if check_if_toxin(ingredients): print('!!!') print('there is a toxin in the food!') print('!!!') make_alert_sound() else: print('***') print('Toxin Free') print('***') make_accept_sound()
class MyClass: def __init__(self): self.var = 'var' def method(self): print('method') x = MyClass() x.method() m = x.method m()
# -*- coding: utf-8 -*- """ Created on Sat Oct 16 19:01:59 2021 @author: gerry """ #Klasse: punkt class Punkt: #start med stor bokstav, skiller klasse fra funksjoner og variabler #konstruktør def __init__(self, start_x=0, start_y=0): self.x_koordinat = start_x self.y_koordinat = start_y punktet = Punkt() print(punktet.x_koordinat) print(punktet.y_koordinat) punktet.x_koordinat = 10 print(punktet.x_koordinat) print(punktet.y_koordinat) punktet = Punkt(2, 3) print(punktet.x_koordinat) print(punktet.y_koordinat)
''' @author: l4zyc0d3r People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt ''' class Solution: def kthFactor(self, n: int, k: int) -> int: for i in range(1, n+1): if n % i == 0: k-=1 if k == 0: return i return -1
"""This is the calculation class / abstraction class""" class Calculation: """Creates the Calculation parent class for the arithmetic subclasses""" # pylint: disable=bad-option-value, too-few-public-methods def __init__(self, values: tuple): """Constructor Method""" self.values = Calculation.convert_to_float(values) @classmethod def create(cls, values: tuple): """Creates an object""" return cls(values) @staticmethod def convert_to_float(values): """Converts the values passed to function into float values in a list""" list_of_floats = [] for item in values: list_of_floats.append(float(item)) return tuple(list_of_floats)
_base_ = [ '../_base_/datasets/nus-mono3d.py', '../_base_/models/fcos3d.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), # frozen_stages=1, frozen_stages=1, norm_cfg=dict(type='SyncBN', requires_grad=True), # norm_cfg=dict(type='BN', requires_grad=False), norm_eval=False, # norm_eval=True, style='pytorch', # style='caffe' dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False), stage_with_dcn=(False, False, True, True) )) class_names = [ 'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier' ] img_norm_cfg = dict( mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False) train_pipeline = [ dict(type='LoadImageFromFileMono3D'), dict( type='LoadAnnotations3D', with_bbox=True, with_label=True, with_attr_label=True, with_bbox_3d=True, with_label_3d=True, with_bbox_depth=True), dict(type='Resize', img_scale=(1600, 900), keep_ratio=True), dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle3D', class_names=class_names), dict( type='Collect3D', keys=[ 'img', 'gt_bboxes', 'gt_labels', 'attr_labels', 'gt_bboxes_3d', 'gt_labels_3d', 'centers2d', 'depths' ]), ] test_pipeline = [ dict(type='LoadImageFromFileMono3D'), dict( type='MultiScaleFlipAug', scale_factor=1.0, flip=False, transforms=[ dict(type='RandomFlip3D'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict( type='DefaultFormatBundle3D', class_names=class_names, with_label=False), dict(type='Collect3D', keys=['img']), ]) ] data = dict( samples_per_gpu=8, workers_per_gpu=8, train=dict(pipeline=train_pipeline), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline)) # optimizer optimizer = dict( lr=0.008, paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.)) optimizer_config = dict( _delete_=True, grad_clip=dict(max_norm=35, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=500, # warmup_iters=1500, # for moco warmup_ratio=1.0 / 3, step=[8, 11]) total_epochs = 12 evaluation = dict(interval=2) # load_from=None # load_from='checkpoints/waymo_ep50_with_backbone.pth' # load_from='checkpoints/imgsup_finetune_waymo_ep1_with_backbone.pth' # load_from='checkpoints/resnet50-19c8e357_convert_mono3d.pth' # load_from='checkpoints/imgsup_finetune_waymo_ep5_with_backbone_repro.pth' # load_from='checkpoints/imgsup_finetune_waymo_ep5_with_backbone_moco.pth' # load_from=None # load_from='checkpoints/mono3d_waymo_half.pth' # load_from='checkpoints/mono3d_waymo_oneten.pth' load_from='checkpoints/mono3d_waymo_full.pth' # load_from='checkpoints/mono3d_waymo_onefive.pth'
#! /usr/bin/env python3 def main(): languages = { "Python": "Guido van Rossum", "Ruby": "Yukihiro Matsumoto", "PHP": "Rasmus Lerdorf" } for each in languages: print(each + " was created by " + languages[each]) if __name__ == "__main__": main()
ziehungen = input().split(",") ziehungen = [int(x) for x in ziehungen] boards = [] while True: leer = input() zeile = [input().split(" ")] zeile[0] = [int(x) for x in zeile[0] if x != ''] if zeile[0] != []: for i in range(1,5): zeile.append(input().split(" ")) zeile[i] = [int(x) for x in zeile[i] if x != ''] boards.append([zeile[0], zeile[1], zeile[2], zeile[3], zeile[4]]) else: break gewinn_brett = '' for n in range(len(ziehungen)): letzte_zahl = ziehungen[n-1] if gewinn_brett != '': break for i in range(len(boards)): for ii in range(5): for iii in range(5): if boards[i][ii][iii] == ziehungen[n]: boards[i][ii][iii] = "x" for i in range(len(boards)): if gewinn_brett != '': break for ii in range(5): nicht_x = False for iii in range(5): if boards[i][ii][iii] != "x": nicht_x = True if nicht_x == False: gewinn_brett = i break for i in range(len(boards)): if gewinn_brett != '': break for ii in range(5): nicht_x = False for iii in range(5): if boards[i][iii][ii] != "x": nicht_x = True if nicht_x == False: gewinn_brett = i break summe_unmarkierter = 0 for i in range(5): for ii in range(5): if boards[gewinn_brett][i][ii] != "x": summe_unmarkierter += boards[gewinn_brett][i][ii] print(summe_unmarkierter * letzte_zahl)
def insertion_sort(arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while(j>=0 and arr[j]>key): arr[j+1]=arr[j] j = j - 1 arr[j+1] = key return arr def main(): arr = [6, 5, 8, 9, 3, 1, 4, 7, 2] sorted_arr = insertion_sort(arr) for i in sorted_arr: print(i, end=" ") if __name__ == "__main__": main()
""" This module contains all the submodules for the handybeam software package. """ name = "handybeam" __all__ = [ 'bugcatcher', 'cl_system', 'evaluators', 'misc', 'solver', 'translator', 'tx_array', 'tx_array_library', 'visiualize', 'world', 'cl', 'cl_py_ref_code', 'opencl_wrappers', 'propagator_mixins', 'samplers', 'solver_mixins', 'translator_mixins' ]
# # PySNMP MIB module DNS-SERVER-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/DNS-SERVER-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:08:40 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ( Integer, OctetString, ObjectIdentifier, ) = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") ( NotificationGroup, ObjectGroup, ModuleCompliance, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") ( IpAddress, iso, Counter32, ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, Unsigned32, mib_2, Integer32, Gauge32, ModuleIdentity, TimeTicks, MibIdentifier, ) = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "iso", "Counter32", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "Unsigned32", "mib-2", "Integer32", "Gauge32", "ModuleIdentity", "TimeTicks", "MibIdentifier") ( TruthValue, TextualConvention, RowStatus, DisplayString, ) = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "RowStatus", "DisplayString") dns = ObjectIdentity((1, 3, 6, 1, 2, 1, 32)) if mibBuilder.loadTexts: dns.setDescription('The OID assigned to DNS MIB work by the IANA.') dnsServMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 32, 1)) if mibBuilder.loadTexts: dnsServMIB.setLastUpdated('9401282251Z') if mibBuilder.loadTexts: dnsServMIB.setOrganization('IETF DNS Working Group') if mibBuilder.loadTexts: dnsServMIB.setContactInfo(' Rob Austein\n Postal: Epilogue Technology Corporation\n 268 Main Street, Suite 283\n North Reading, MA 10864\n US\n Tel: +1 617 245 0804\n Fax: +1 617 245 8122\n E-Mail: sra@epilogue.com\n\n Jon Saperia\n Postal: Digital Equipment Corporation\n 110 Spit Brook Road\n ZKO1-3/H18\n Nashua, NH 03062-2698\n US\n Tel: +1 603 881 0480\n Fax: +1 603 881 0120\n Email: saperia@zko.dec.com') if mibBuilder.loadTexts: dnsServMIB.setDescription('The MIB module for entities implementing the server side\n of the Domain Name System (DNS) protocol.') dnsServMIBObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1)) dnsServConfig = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 1)) dnsServCounter = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 2)) dnsServOptCounter = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 3)) dnsServZone = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 4)) class DnsName(OctetString, TextualConvention): subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(0,255) class DnsNameAsIndex(DnsName, TextualConvention): pass class DnsClass(Integer32, TextualConvention): displayHint = '2d' subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535) class DnsType(Integer32, TextualConvention): displayHint = '2d' subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535) class DnsQClass(Integer32, TextualConvention): displayHint = '2d' subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535) class DnsQType(Integer32, TextualConvention): displayHint = '2d' subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535) class DnsTime(Gauge32, TextualConvention): displayHint = '4d' class DnsOpCode(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,15) class DnsRespCode(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,15) dnsServConfigImplementIdent = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServConfigImplementIdent.setDescription("The implementation identification string for the DNS\n server software in use on the system, for example;\n `FNS-2.1'") dnsServConfigRecurs = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("available", 1), ("restricted", 2), ("unavailable", 3),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dnsServConfigRecurs.setDescription('This represents the recursion services offered by this\n name server. The values that can be read or written\n are:\n\n available(1) - performs recursion on requests from\n clients.\n\n restricted(2) - recursion is performed on requests only\n from certain clients, for example; clients on an access\n control list.\n\n unavailable(3) - recursion is not available.') dnsServConfigUpTime = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 3), DnsTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServConfigUpTime.setDescription('If the server has a persistent state (e.g., a process),\n this value will be the time elapsed since it started.\n For software without persistant state, this value will\n be zero.') dnsServConfigResetTime = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 4), DnsTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServConfigResetTime.setDescription("If the server has a persistent state (e.g., a process)\n and supports a `reset' operation (e.g., can be told to\n re-read configuration files), this value will be the\n time elapsed since the last time the name server was\n `reset.' For software that does not have persistence or\n does not support a `reset' operation, this value will be\n zero.") dnsServConfigReset = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("other", 1), ("reset", 2), ("initializing", 3), ("running", 4),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: dnsServConfigReset.setDescription('Status/action object to reinitialize any persistant name\n server state. When set to reset(2), any persistant\n name server state (such as a process) is reinitialized as\n if the name server had just been started. This value\n will never be returned by a read operation. When read,\n one of the following values will be returned:\n other(1) - server in some unknown state;\n initializing(3) - server (re)initializing;\n running(4) - server currently running.') dnsServCounterAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterAuthAns.setDescription('Number of queries which were authoritatively answered.') dnsServCounterAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterAuthNoNames.setDescription("Number of queries for which `authoritative no such name'\n responses were made.") dnsServCounterAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterAuthNoDataResps.setDescription("Number of queries for which `authoritative no such data'\n (empty answer) responses were made.") dnsServCounterNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterNonAuthDatas.setDescription('Number of queries which were non-authoritatively\n answered (cached data).') dnsServCounterNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterNonAuthNoDatas.setDescription('Number of queries which were non-authoritatively\n answered with no data (empty answer).') dnsServCounterReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterReferrals.setDescription('Number of requests that were referred to other servers.') dnsServCounterErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterErrors.setDescription('Number of requests the server has processed that were\n answered with errors (RCODE values other than 0 and 3).') dnsServCounterRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterRelNames.setDescription('Number of requests received by the server for names that\n are only 1 label long (text form - no internal dots).') dnsServCounterReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterReqRefusals.setDescription('Number of DNS requests refused by the server.') dnsServCounterReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterReqUnparses.setDescription('Number of requests received which were unparseable.') dnsServCounterOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors.') dnsServCounterTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13), ) if mibBuilder.loadTexts: dnsServCounterTable.setDescription('Counter information broken down by DNS class and type.') dnsServCounterEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServCounterOpCode"), (0, "DNS-SERVER-MIB", "dnsServCounterQClass"), (0, "DNS-SERVER-MIB", "dnsServCounterQType"), (0, "DNS-SERVER-MIB", "dnsServCounterTransport")) if mibBuilder.loadTexts: dnsServCounterEntry.setDescription("This table contains count information for each DNS class\n and type value known to the server. The index allows\n management software to to create indices to the table to\n get the specific information desired, e.g., number of\n queries over UDP for records with type value `A' which\n came to this server. In order to prevent an\n uncontrolled expansion of rows in the table; if\n dnsServCounterRequests is 0 and dnsServCounterResponses\n is 0, then the row does not exist and `no such' is\n returned when the agent is queried for such instances.") dnsServCounterOpCode = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 1), DnsOpCode()) if mibBuilder.loadTexts: dnsServCounterOpCode.setDescription('The DNS OPCODE being counted in this row of the table.') dnsServCounterQClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 2), DnsClass()) if mibBuilder.loadTexts: dnsServCounterQClass.setDescription('The class of record being counted in this row of the\n table.') dnsServCounterQType = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 3), DnsType()) if mibBuilder.loadTexts: dnsServCounterQType.setDescription('The type of record which is being counted in this row in\n the table.') dnsServCounterTransport = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("udp", 1), ("tcp", 2), ("other", 3),))) if mibBuilder.loadTexts: dnsServCounterTransport.setDescription('A value of udp(1) indicates that the queries reported on\n this row were sent using UDP.\n\n A value of tcp(2) indicates that the queries reported on\n this row were sent using TCP.\n\n A value of other(3) indicates that the queries reported\n on this row were sent using a transport that was neither\n TCP nor UDP.') dnsServCounterRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterRequests.setDescription('Number of requests (queries) that have been recorded in\n this row of the table.') dnsServCounterResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServCounterResponses.setDescription('Number of responses made by the server since\n initialization for the kind of query identified on this\n row of the table.') dnsServOptCounterSelfAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfAuthAns.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative answer.') dnsServOptCounterSelfAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfAuthNoNames.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such name answer\n given.') dnsServOptCounterSelfAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfAuthNoDataResps.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such data answer\n (empty answer) made.') dnsServOptCounterSelfNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfNonAuthDatas.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which a\n non-authoritative answer (cached data) was made.') dnsServOptCounterSelfNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfNonAuthNoDatas.setDescription("Number of requests the server has processed which\n originated from a resolver on the same host for which a\n `non-authoritative, no such data' response was made\n (empty answer).") dnsServOptCounterSelfReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfReferrals.setDescription('Number of queries the server has processed which\n originated from a resolver on the same host and were\n referred to other servers.') dnsServOptCounterSelfErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfErrors.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host which have\n been answered with errors (RCODEs other than 0 and 3).') dnsServOptCounterSelfRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfRelNames.setDescription('Number of requests received for names that are only 1\n label long (text form - no internal dots) the server has\n processed which originated from a resolver on the same\n host.') dnsServOptCounterSelfReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfReqRefusals.setDescription('Number of DNS requests refused by the server which\n originated from a resolver on the same host.') dnsServOptCounterSelfReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfReqUnparses.setDescription('Number of requests received which were unparseable and\n which originated from a resolver on the same host.') dnsServOptCounterSelfOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterSelfOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors and which originated on the same host.') dnsServOptCounterFriendsAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthAns.setDescription('Number of queries originating from friends which were\n authoritatively answered. The definition of friends is\n a locally defined matter.') dnsServOptCounterFriendsAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthNoNames.setDescription("Number of queries originating from friends, for which\n authoritative `no such name' responses were made. The\n definition of friends is a locally defined matter.") dnsServOptCounterFriendsAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthNoDataResps.setDescription('Number of queries originating from friends for which\n authoritative no such data (empty answer) responses were\n made. The definition of friends is a locally defined\n matter.') dnsServOptCounterFriendsNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsNonAuthDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered (cached data). The\n definition of friends is a locally defined matter.') dnsServOptCounterFriendsNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsNonAuthNoDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered with no such data (empty\n answer).') dnsServOptCounterFriendsReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsReferrals.setDescription('Number of requests which originated from friends that\n were referred to other servers. The definition of\n friends is a locally defined matter.') dnsServOptCounterFriendsErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsErrors.setDescription('Number of requests the server has processed which\n originated from friends and were answered with errors\n (RCODE values other than 0 and 3). The definition of\n friends is a locally defined matter.') dnsServOptCounterFriendsRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsRelNames.setDescription('Number of requests received for names from friends that\n are only 1 label long (text form - no internal dots) the\n server has processed.') dnsServOptCounterFriendsReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsReqRefusals.setDescription("Number of DNS requests refused by the server which were\n received from `friends'.") dnsServOptCounterFriendsReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsReqUnparses.setDescription("Number of requests received which were unparseable and\n which originated from `friends'.") dnsServOptCounterFriendsOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServOptCounterFriendsOtherErrors.setDescription("Number of requests which were aborted for other (local)\n server errors and which originated from `friends'.") dnsServZoneTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1), ) if mibBuilder.loadTexts: dnsServZoneTable.setDescription("Table of zones for which this name server provides\n information. Each of the zones may be loaded from stable\n storage via an implementation-specific mechanism or may\n be obtained from another name server via a zone transfer.\n\n If name server doesn't load any zones, this table is\n empty.") dnsServZoneEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServZoneName"), (0, "DNS-SERVER-MIB", "dnsServZoneClass")) if mibBuilder.loadTexts: dnsServZoneEntry.setDescription('An entry in the name server zone table. New rows may be\n added either via SNMP or by the name server itself.') dnsServZoneName = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 1), DnsNameAsIndex()) if mibBuilder.loadTexts: dnsServZoneName.setDescription("DNS name of the zone described by this row of the table.\n This is the owner name of the SOA RR that defines the\n top of the zone. This is name is in uppercase:\n characters 'a' through 'z' are mapped to 'A' through 'Z'\n in order to make the lexical ordering useful.") dnsServZoneClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 2), DnsClass()) if mibBuilder.loadTexts: dnsServZoneClass.setDescription('DNS class of the RRs in this zone.') dnsServZoneLastReloadSuccess = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 3), DnsTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneLastReloadSuccess.setDescription('Elapsed time in seconds since last successful reload of\n this zone.') dnsServZoneLastReloadAttempt = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 4), DnsTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneLastReloadAttempt.setDescription('Elapsed time in seconds since last attempted reload of\n this zone.') dnsServZoneLastSourceAttempt = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneLastSourceAttempt.setDescription('IP address of host from which most recent zone transfer\n of this zone was attempted. This value should match the\n value of dnsServZoneSourceSuccess if the attempt was\n succcessful. If zone transfer has not been attempted\n within the memory of this name server, this value should\n be 0.0.0.0.') dnsServZoneStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dnsServZoneStatus.setDescription('The status of the information represented in this row of\n the table.') dnsServZoneSerial = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneSerial.setDescription('Zone serial number (from the SOA RR) of the zone\n represented by this row of the table. If the zone has\n not been successfully loaded within the memory of this\n name server, the value of this variable is zero.') dnsServZoneCurrent = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 8), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneCurrent.setDescription("Whether the server's copy of the zone represented by\n this row of the table is currently valid. If the zone\n has never been successfully loaded or has expired since\n it was last succesfully loaded, this variable will have\n the value false(2), otherwise this variable will have\n the value true(1).") dnsServZoneLastSourceSuccess = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 9), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: dnsServZoneLastSourceSuccess.setDescription('IP address of host which was the source of the most\n recent successful zone transfer for this zone. If\n unknown (e.g., zone has never been successfully\n transfered) or irrelevant (e.g., zone was loaded from\n stable storage), this value should be 0.0.0.0.') dnsServZoneSrcTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2), ) if mibBuilder.loadTexts: dnsServZoneSrcTable.setDescription('This table is a list of IP addresses from which the\n server will attempt to load zone information using DNS\n zone transfer operations. A reload may occur due to SNMP\n operations that create a row in dnsServZoneTable or a\n SET to object dnsServZoneReload. This table is only\n used when the zone is loaded via zone transfer.') dnsServZoneSrcEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServZoneSrcName"), (0, "DNS-SERVER-MIB", "dnsServZoneSrcClass"), (0, "DNS-SERVER-MIB", "dnsServZoneSrcAddr")) if mibBuilder.loadTexts: dnsServZoneSrcEntry.setDescription('An entry in the name server zone source table.') dnsServZoneSrcName = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 1), DnsNameAsIndex()) if mibBuilder.loadTexts: dnsServZoneSrcName.setDescription('DNS name of the zone to which this entry applies.') dnsServZoneSrcClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 2), DnsClass()) if mibBuilder.loadTexts: dnsServZoneSrcClass.setDescription('DNS class of zone to which this entry applies.') dnsServZoneSrcAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 3), IpAddress()) if mibBuilder.loadTexts: dnsServZoneSrcAddr.setDescription('IP address of name server host from which this zone\n might be obtainable.') dnsServZoneSrcStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: dnsServZoneSrcStatus.setDescription('The status of the information represented in this row of\n the table.') dnsServMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 2)) dnsServConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 1)).setObjects(*(("DNS-SERVER-MIB", "dnsServConfigImplementIdent"), ("DNS-SERVER-MIB", "dnsServConfigRecurs"), ("DNS-SERVER-MIB", "dnsServConfigUpTime"), ("DNS-SERVER-MIB", "dnsServConfigResetTime"), ("DNS-SERVER-MIB", "dnsServConfigReset"),)) if mibBuilder.loadTexts: dnsServConfigGroup.setDescription('A collection of objects providing basic configuration\n control of a DNS name server.') dnsServCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 2)).setObjects(*(("DNS-SERVER-MIB", "dnsServCounterAuthAns"), ("DNS-SERVER-MIB", "dnsServCounterAuthNoNames"), ("DNS-SERVER-MIB", "dnsServCounterAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServCounterNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServCounterNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServCounterReferrals"), ("DNS-SERVER-MIB", "dnsServCounterErrors"), ("DNS-SERVER-MIB", "dnsServCounterRelNames"), ("DNS-SERVER-MIB", "dnsServCounterReqRefusals"), ("DNS-SERVER-MIB", "dnsServCounterReqUnparses"), ("DNS-SERVER-MIB", "dnsServCounterOtherErrors"), ("DNS-SERVER-MIB", "dnsServCounterOpCode"), ("DNS-SERVER-MIB", "dnsServCounterQClass"), ("DNS-SERVER-MIB", "dnsServCounterQType"), ("DNS-SERVER-MIB", "dnsServCounterTransport"), ("DNS-SERVER-MIB", "dnsServCounterRequests"), ("DNS-SERVER-MIB", "dnsServCounterResponses"),)) if mibBuilder.loadTexts: dnsServCounterGroup.setDescription('A collection of objects providing basic instrumentation\n of a DNS name server.') dnsServOptCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 3)).setObjects(*(("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthAns"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthNoNames"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReferrals"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfRelNames"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReqRefusals"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReqUnparses"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfOtherErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthAns"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthNoNames"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReferrals"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsRelNames"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReqRefusals"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReqUnparses"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsOtherErrors"),)) if mibBuilder.loadTexts: dnsServOptCounterGroup.setDescription('A collection of objects providing extended\n instrumentation of a DNS name server.') dnsServZoneGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 4)).setObjects(*(("DNS-SERVER-MIB", "dnsServZoneName"), ("DNS-SERVER-MIB", "dnsServZoneClass"), ("DNS-SERVER-MIB", "dnsServZoneLastReloadSuccess"), ("DNS-SERVER-MIB", "dnsServZoneLastReloadAttempt"), ("DNS-SERVER-MIB", "dnsServZoneLastSourceAttempt"), ("DNS-SERVER-MIB", "dnsServZoneLastSourceSuccess"), ("DNS-SERVER-MIB", "dnsServZoneStatus"), ("DNS-SERVER-MIB", "dnsServZoneSerial"), ("DNS-SERVER-MIB", "dnsServZoneCurrent"), ("DNS-SERVER-MIB", "dnsServZoneSrcName"), ("DNS-SERVER-MIB", "dnsServZoneSrcClass"), ("DNS-SERVER-MIB", "dnsServZoneSrcAddr"), ("DNS-SERVER-MIB", "dnsServZoneSrcStatus"),)) if mibBuilder.loadTexts: dnsServZoneGroup.setDescription('A collection of objects providing configuration control\n of a DNS name server which loads authoritative zones.') dnsServMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 3)) dnsServMIBCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 32, 1, 3, 1)).setObjects(*(("DNS-SERVER-MIB", "dnsServConfigGroup"), ("DNS-SERVER-MIB", "dnsServCounterGroup"), ("DNS-SERVER-MIB", "dnsServOptCounterGroup"), ("DNS-SERVER-MIB", "dnsServZoneGroup"),)) if mibBuilder.loadTexts: dnsServMIBCompliance.setDescription('The compliance statement for agents implementing the DNS\n name server MIB extensions.') mibBuilder.exportSymbols("DNS-SERVER-MIB", dnsServOptCounterSelfAuthNoDataResps=dnsServOptCounterSelfAuthNoDataResps, dnsServMIBCompliances=dnsServMIBCompliances, dnsServOptCounterSelfAuthNoNames=dnsServOptCounterSelfAuthNoNames, dnsServOptCounterSelfReqUnparses=dnsServOptCounterSelfReqUnparses, dnsServConfig=dnsServConfig, dnsServCounterReqUnparses=dnsServCounterReqUnparses, dnsServOptCounterSelfRelNames=dnsServOptCounterSelfRelNames, DnsName=DnsName, dnsServConfigRecurs=dnsServConfigRecurs, dnsServCounterTable=dnsServCounterTable, dnsServCounterOtherErrors=dnsServCounterOtherErrors, dnsServOptCounterFriendsRelNames=dnsServOptCounterFriendsRelNames, dnsServOptCounterSelfNonAuthNoDatas=dnsServOptCounterSelfNonAuthNoDatas, dnsServZoneEntry=dnsServZoneEntry, dnsServOptCounterGroup=dnsServOptCounterGroup, dnsServCounterReqRefusals=dnsServCounterReqRefusals, dnsServZoneSrcEntry=dnsServZoneSrcEntry, DnsType=DnsType, dnsServZoneLastSourceAttempt=dnsServZoneLastSourceAttempt, dnsServCounter=dnsServCounter, dnsServCounterAuthAns=dnsServCounterAuthAns, dnsServCounterEntry=dnsServCounterEntry, dnsServZoneLastReloadSuccess=dnsServZoneLastReloadSuccess, dnsServZoneLastReloadAttempt=dnsServZoneLastReloadAttempt, dnsServCounterOpCode=dnsServCounterOpCode, dnsServZone=dnsServZone, dnsServConfigReset=dnsServConfigReset, dnsServOptCounterFriendsOtherErrors=dnsServOptCounterFriendsOtherErrors, dnsServZoneTable=dnsServZoneTable, DnsClass=DnsClass, dnsServCounterRelNames=dnsServCounterRelNames, dnsServConfigGroup=dnsServConfigGroup, dnsServCounterAuthNoDataResps=dnsServCounterAuthNoDataResps, dnsServCounterQClass=dnsServCounterQClass, dnsServZoneStatus=dnsServZoneStatus, dnsServMIB=dnsServMIB, PYSNMP_MODULE_ID=dnsServMIB, dnsServMIBObjects=dnsServMIBObjects, dnsServCounterReferrals=dnsServCounterReferrals, DnsQClass=DnsQClass, dnsServZoneSrcClass=dnsServZoneSrcClass, dnsServMIBGroups=dnsServMIBGroups, dnsServOptCounterSelfAuthAns=dnsServOptCounterSelfAuthAns, dnsServOptCounter=dnsServOptCounter, DnsOpCode=DnsOpCode, dnsServOptCounterFriendsNonAuthNoDatas=dnsServOptCounterFriendsNonAuthNoDatas, dnsServMIBCompliance=dnsServMIBCompliance, dnsServCounterRequests=dnsServCounterRequests, dnsServOptCounterSelfReferrals=dnsServOptCounterSelfReferrals, dnsServZoneSrcAddr=dnsServZoneSrcAddr, dns=dns, dnsServCounterNonAuthDatas=dnsServCounterNonAuthDatas, dnsServZoneCurrent=dnsServZoneCurrent, dnsServConfigResetTime=dnsServConfigResetTime, dnsServCounterErrors=dnsServCounterErrors, dnsServCounterQType=dnsServCounterQType, dnsServZoneSrcStatus=dnsServZoneSrcStatus, dnsServOptCounterFriendsAuthAns=dnsServOptCounterFriendsAuthAns, dnsServZoneGroup=dnsServZoneGroup, dnsServOptCounterFriendsNonAuthDatas=dnsServOptCounterFriendsNonAuthDatas, DnsQType=DnsQType, DnsRespCode=DnsRespCode, dnsServZoneClass=dnsServZoneClass, dnsServCounterNonAuthNoDatas=dnsServCounterNonAuthNoDatas, dnsServOptCounterSelfNonAuthDatas=dnsServOptCounterSelfNonAuthDatas, dnsServOptCounterFriendsErrors=dnsServOptCounterFriendsErrors, dnsServCounterResponses=dnsServCounterResponses, DnsNameAsIndex=DnsNameAsIndex, dnsServOptCounterFriendsReqRefusals=dnsServOptCounterFriendsReqRefusals, dnsServCounterGroup=dnsServCounterGroup, dnsServOptCounterSelfReqRefusals=dnsServOptCounterSelfReqRefusals, dnsServZoneLastSourceSuccess=dnsServZoneLastSourceSuccess, dnsServOptCounterSelfErrors=dnsServOptCounterSelfErrors, dnsServCounterTransport=dnsServCounterTransport, dnsServCounterAuthNoNames=dnsServCounterAuthNoNames, dnsServOptCounterSelfOtherErrors=dnsServOptCounterSelfOtherErrors, dnsServConfigUpTime=dnsServConfigUpTime, DnsTime=DnsTime, dnsServOptCounterFriendsAuthNoDataResps=dnsServOptCounterFriendsAuthNoDataResps, dnsServOptCounterFriendsReferrals=dnsServOptCounterFriendsReferrals, dnsServZoneName=dnsServZoneName, dnsServZoneSrcName=dnsServZoneSrcName, dnsServOptCounterFriendsAuthNoNames=dnsServOptCounterFriendsAuthNoNames, dnsServZoneSrcTable=dnsServZoneSrcTable, dnsServZoneSerial=dnsServZoneSerial, dnsServConfigImplementIdent=dnsServConfigImplementIdent, dnsServOptCounterFriendsReqUnparses=dnsServOptCounterFriendsReqUnparses)
# _*_ coding: utf-8 _*_ """ inst_save.py by xianhu """ class Saver(object): """ class of Saver, must include function working() """ def working(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object): """ working function, must "try-except" and don't change the parameters and returns :return save_state: can be -1(save failed), 1(save success) :return save_result: can be any object, or exception[class_name, excep] """ try: save_state, save_result = self.item_save(priority, url, keys, deep, item) except Exception as excep: save_state, save_result = -1, [self.__class__.__name__, excep] return save_state, save_result def item_save(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object): """ save the content of a url. You must overwrite this function, parameters and returns refer to self.working() """ raise NotImplementedError
""" Get content from tag. >>> from GDLC.GDLC import * >>> dml = '''\ ... <idx:entry scriptable="yes"> ... <idx:orth value="ABC"> ... <idx:infl> ... <idx:iform name="" value="ABC"/> ... </idx:infl> ... </idx:orth> ... <div> ... <span> ... <b>ABC</b> ... </span> ... </div> ... <span> ... <strong>ABC -xy</strong><sup class="calibre23">1</sup>. ... </span> ... <div> ... <blockquote align="left"><span>Definition here.</span></blockquote> ... </blockquote align="left"><span>More details here.</span></blockquote> ... </blockquote align="left"><span>Even more details here.</span></blockquote> ... </div> ... </idx:entry>''' >>> soup = BeautifulSoup(dml, features='lxml') >>> print(get_content(soup, tag='idx:entry')) {'idx:entry': ['\n', <idx:orth value="ABC"> <idx:infl> <idx:iform name="" value="ABC"></idx:iform> </idx:infl> </idx:orth>, '\n', <div> <span> <b>ABC</b> </span> </div>, '\n', <span> <strong>ABC -xy</strong><sup class="calibre23">1</sup>. </span>, '\n', <div> <blockquote align="left"><span>Definition here.</span></blockquote> <span>More details here.</span> <span>Even more details here.</span> </div>, '\n']} """
#MAIN PROGRAM STARTS HERE: num = int(input('Enter the number of rows and columns for the square: ')) k = 1 for x in range(0, num ): for y in range(0, num): print ('%d ' % (k), end='') k += 2 print()
class Point(object): def __init__(self, x, y): self.x, self.y = x, y class PointHash(object): def __init__(self, x, y): self.x, self.y = x, y def __hash__(self): return hash((self.x, self.y)) def __eq__(self, other): return self.x == other.x and self.y == other.y if __name__ == "__main__": print("Test with default hash function") p1 = Point(1, 1) p2 = Point(1, 1) points = set([p1, p2]) print("Contents of set([p1, p2]): ", points) print("Point(1, 1) in set([p1, p2]) = ", (Point(1, 1) in points)) print("Test with custom hash function") p1 = PointHash(1, 1) p2 = PointHash(1, 1) points = set([p1, p2]) print("Contents of set([p1, p2]): ", points) print("Point(1, 1) in set([p1, p2]) = ", (PointHash(1, 1) in points))
""" This is pure python implementation of interpolation search algorithm """ """Pure implementation of interpolation search algorithm in Python Be careful collection must be ascending sorted, otherwise result will be unpredictable """ def interpolation_search(sorted_collection, item): left = 0 right = len(sorted_collection) - 1 while left <= right: if sorted_collection[left] == sorted_collection[right]: if sorted_collection[left] == item: return left else: return None point = left + ((item - sorted_collection[left]) * (right - left)) // ( sorted_collection[right] - sorted_collection[left] ) if point < 0 or point >= len(sorted_collection): return None current_item = sorted_collection[point] if current_item == item: return point else: if point < left: right = left left = point elif point > right: left = right right = point else: if item < current_item: right = point - 1 else: left = point + 1 return None
# -*- coding: utf-8 -*- # 18/1/30 # create by: snower version = "0.1.1" version_info = (0,1.1)
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. class TimeSeries(object): """Time series data for a given metric and time interval. This class implements the spec for v1 TimeSeries structs as of opencensus-proto release v0.1.0. See opencensus-proto for details: https://github.com/census-instrumentation/opencensus-proto/blob/v0.1.0/src/opencensus/proto/metrics/v1/metrics.proto#L132 A TimeSeries is a collection of data points that describes the time-varying values of a metric. :type label_values: list(:class: '~opencensus.metrics.label_value.LabelValue') :param label_values: The set of label values that uniquely identify this timeseries. :type points: list(:class: '~opencensus.metrics.export.point.Point') :param points: The data points of this timeseries. :type start_timestamp: str :param start_timestamp: The time when the cumulative value was reset to zero, must be set for cumulative metrics. """ # noqa def __init__(self, label_values, points, start_timestamp): if not label_values: raise ValueError("label_values must not be null or empty") if not points: raise ValueError("points must not be null or empty") self._label_values = label_values self._points = points self._start_timestamp = start_timestamp def __repr__(self): points_repr = '[{}]'.format( ', '.join(repr(point.value) for point in self.points)) lv_repr = tuple(lv.value for lv in self.label_values) return ('{}({}, label_values={}, start_timestamp={})' .format( type(self).__name__, points_repr, lv_repr, self.start_timestamp )) @property def start_timestamp(self): return self._start_timestamp @property def label_values(self): return self._label_values @property def points(self): return self._points def check_points_type(self, type_class): """Check that each point's value is an instance of `type_class`. `type_class` should typically be a Value type, i.e. one that extends :class: `opencensus.metrics.export.value.Value`. :type type_class: type :param type_class: Type to check against. :rtype: bool :return: Whether all points are instances of `type_class`. """ for point in self.points: if (point.value is not None and not isinstance(point.value, type_class)): return False return True
class Logger: PRINT_INTERVAL = 10 def __init__(self): self.buckets = [-1 for _ in range(self.PRINT_INTERVAL)] self.sets = [set() for _ in range(self.PRINT_INTERVAL)] def shouldPrintMessage(self, timestamp: int, message: str) -> bool: bucket_index = timestamp % self.PRINT_INTERVAL if self.buckets[bucket_index] != timestamp: self.sets[bucket_index].clear() self.buckets[bucket_index] = timestamp for i, bucket_timestamp in enumerate(self.buckets): if timestamp - bucket_timestamp < self.PRINT_INTERVAL: if message in self.sets[i]: return False self.sets[bucket_index].add(message) return True
#!/usr/bin/env python NAME = 'WebTotem (WebTotem)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return _, page = r # WebTotem returns its name in blockpage if all(i in page for i in (b'The current request was blocked', b'WebTotem')): return True return False
''' Ejemplo: auth.py Aqui se definen las API KEYS para autorizar el acceso y uso de la aplicacion rpi3bot de Twitter. Fuente: https://www.raspberrypi.org/learning/getting-started-with-the-twitter-api/worksheet/ Fecha: mié dic 7 22:00:22 COT 2016 Version: 1.0 ''' consumer_key = 'ABCDEFGHIJKLKMNOPQRSTUVWXYZ' consumer_secret = '1234567890ABCDEFGHIJKLMNOPQRSTUVXYZ' access_token = 'ZYXWVUTSRQPONMLKJIHFEDCBA' access_token_secret = '0987654321ZYXWVUTSRQPONMLKJIHFEDCBA' ''' Las API KEYS deben tener restriccion de acceso y de uso privativo. '''
{ 'targets': [ { 'target_name': 'node_expat_object', 'sources': [ 'src/parse.cc', 'src/node-expat-object.cc' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")' ], 'dependencies': [ 'deps/libexpat/libexpat.gyp:expat' ] } ] }
# Token types # # EOF (end-of-file) token is used to indicate that # there is no more input left for lexical analysis NUMBER, VARIABLE, VARIABLE_SET, PLUS, MINUS, MUL, DIV, LPAREN, RPAREN, EOF, LOG, SIN, COS, TAN, \ CTG, SQRT, POW, LOWER, HIGHER, HIGHER_EQ, LOWER_EQ, EQ, EQ_EQ, TRUE, FALSE, PLUS_EQUALS,\ MINUS_EQUALS, MUL_EQUALS, DIV_EQUALS, MOD, LEFT_SHIFT, RIGHT_SHIFT, PI, E_C, DEG, RAD = ( 'NUMBER', 'VARIABLE', 'VARIABLE_SET', 'PLUS', 'MINUS', 'MUL', 'DIV', '(', ')', 'EOF', 'LOG', \ 'SIN', 'COS', 'TG', 'CTG', 'SQRT', 'POW', '<', '>', '>=', '<=', '=', '==', 'True', 'False', '+=',\ '-=', '*=', '/=', '%', '<<', '>>', 'PI', 'E', 'DEG', 'RAD' ) class Token(object): def __init__(self, type, value): self.type = type self.value = value def __str__(self): """String representation of the class instance. Examples: Token(INTEGER, 3) Token(PLUS, '+') Token(MUL, '*') """ return 'Token({type}, {value})'.format( type=self.type, value=repr(self.value) ) def __repr__(self): return self.__str__() class Lexer(object): def __init__(self, text): # client string input, e.g. "4 + 2 * 3 - 6 / 2" self.text = text # self.pos is an index into self.text self.pos = 0 self.current_char = self.text[self.pos] def error(self): raise Exception('Invalid character') def advance(self): """Advance the `pos` pointer and set the `current_char` variable.""" self.pos += 1 if self.pos > len(self.text) - 1: self.current_char = None # Indicates end of input else: self.current_char = self.text[self.pos] def skip_whitespace(self): while self.current_char is not None and self.current_char.isspace(): self.advance() def number(self): """Return a (multidigit) integer consumed from the input.""" result = '' foundDot = False while self.current_char is not None and (self.current_char.isdigit() or self.current_char == '.'): if self.current_char == '.': foundDot = True result += self.current_char self.advance() if foundDot: return float(result) else: return int(result) def var(self): charName = '' while self.current_char is not None and self.current_char != '(' and self.current_char != '+' \ and self.current_char != '-' and self.current_char != '*' and self.current_char != '/' \ and not self.current_char.isspace() and self.current_char != '=' and self.current_char != '>' \ and self.current_char != '<': charName += self.current_char self.advance() if self.current_char is not None and self.current_char.isspace(): self.skip_whitespace() return charName def get_next_token(self): """Lexical analyzer (also known as scanner or tokenizer) This method is responsible for breaking a sentence apart into tokens. One token at a time. """ while self.current_char is not None: position = self.pos if self.current_char.isspace(): self.skip_whitespace() continue if self.current_char.isdigit(): br = self.number() return Token(NUMBER, br) if self.text[self.pos: self.pos + 2] == PLUS_EQUALS: self.advance() self.advance() return Token(PLUS_EQUALS, PLUS_EQUALS) if self.current_char == '+': self.advance() return Token(PLUS, '+') if self.text[self.pos: self.pos + 2] == MINUS_EQUALS: self.advance() self.advance() return Token(MINUS_EQUALS, MINUS_EQUALS) if self.current_char == '-': self.advance() return Token(MINUS, '-') if self.text[self.pos: self.pos + 2] == MUL_EQUALS: self.advance() self.advance() return Token(MUL_EQUALS, MUL_EQUALS) if self.current_char == '*': self.advance() return Token(MUL, '*') if self.text[self.pos: self.pos + 2] == DIV_EQUALS: self.advance() self.advance() return Token(DIV_EQUALS, DIV_EQUALS) if self.current_char == '/': self.advance() return Token(DIV, '/') if self.current_char == '(': self.advance() return Token(LPAREN, '(') if self.current_char == ')': self.advance() return Token(RPAREN, ')') if self.current_char == MOD: self.advance() return Token(MOD, MOD) if self.text[self.pos: self.pos + 2] == EQ_EQ: self.advance() self.advance() return Token(EQ_EQ, EQ_EQ) if self.current_char == EQ: self.advance() return Token(EQ, EQ) if self.text[self.pos: self.pos + 2] == LEFT_SHIFT: self.advance() self.advance() return Token(LEFT_SHIFT, LEFT_SHIFT) if self.text[self.pos: self.pos + 2] == LOWER_EQ: self.advance() self.advance() return Token(LOWER_EQ, LOWER_EQ) if self.current_char == LOWER: self.advance() return Token(LOWER, LOWER) if self.text[self.pos: self.pos + 2] == RIGHT_SHIFT: self.advance() self.advance() return Token(RIGHT_SHIFT, RIGHT_SHIFT) if self.text[self.pos: self.pos + 2] == HIGHER_EQ: self.advance() self.advance() return Token(HIGHER_EQ, HIGHER_EQ) if self.current_char == HIGHER: self.advance() return Token(HIGHER, HIGHER) if self.text[self.pos: self.pos + 5] == SQRT + LPAREN: self.advance() self.advance() self.advance() self.advance() return Token(SQRT, SQRT) if self.text[self.pos: self.pos + 4] == SIN + LPAREN: self.advance() self.advance() self.advance() return Token(SIN, SIN) if self.text[self.pos: self.pos + 3] == TAN + LPAREN: self.advance() self.advance() return Token(TAN, TAN) if self.text[self.pos: self.pos + 4] == POW + LPAREN: self.advance() self.advance() self.advance() return Token(POW, POW) if self.text[self.pos: self.pos + 4] == COS + LPAREN: self.advance() self.advance() self.advance() return Token(COS, COS) if self.text[self.pos: self.pos + 4] == CTG + LPAREN: self.advance() self.advance() self.advance() return Token(CTG, CTG) if self.text[self.pos: self.pos + 4] == LOG + LPAREN: self.advance() self.advance() self.advance() return Token(LOG, LOG) if self.text[self.pos: self.pos + 4] == DEG + LPAREN: self.advance() self.advance() self.advance() return Token(DEG, DEG) if self.text[self.pos: self.pos + 4] == RAD + LPAREN: self.advance() self.advance() self.advance() return Token(RAD, RAD) if self.text[self.pos: self.pos + 4] == TRUE: self.advance() self.advance() self.advance() self.advance() if self.current_char.isalpha: self.pos = self.pos - 4 self.current_char = self.text[self.pos] else: return Token(TRUE, TRUE) if self.text[self.pos: self.pos + 5] == FALSE: self.advance() self.advance() self.advance() self.advance() self.advance() if self.current_char.isalpha: self.pos = self.pos - 5 self.current_char = self.text[self.pos] else: return Token(FALSE, FALSE) if self.current_char.isalpha(): charName = self.var() if charName == PI: return Token(PI, PI) elif charName == E_C: return Token(E_C, E_C) if self.current_char is None: retrunToThisPos = self.pos - 1 else: retrunToThisPos = self.pos if self.current_char == '=': self.advance() if self.current_char == '=': self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE_SET, charName) elif self.current_char == '+': self.advance() if self.current_char == '=': self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE_SET, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) elif self.current_char == '*': self.advance() if self.current_char == '=': self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE_SET, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) elif self.current_char == '/': self.advance() if self.current_char == '=': self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE_SET, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) elif self.current_char == '-': self.advance() if self.current_char == '=': self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE_SET, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) else: self.pos = retrunToThisPos self.current_char = self.text[self.pos] return Token(VARIABLE, charName) self.error() return Token(EOF, None)
class ParamRequest(object): """ Represents a set of request parameters. """ def to_request_parameters(self): """ :return: list[:class:`ingenico.connect.sdk.RequestParam`] representing the HTTP request parameters """ raise NotImplementedError
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyLap(PythonPackage): """lap is a linear assignment problem solver using Jonker-Volgenant algorithm for dense (LAPJV) or sparse (LAPMOD) matrices.""" homepage = "https://github.com/gatagat/lap" pypi = "lap/lap-0.4.0.tar.gz" version('0.4.0', sha256='c4dad9976f0e9f276d8a676a6d03632c3cb7ab7c80142e3b27303d49f0ed0e3b') depends_on('py-setuptools', type='build') depends_on('py-cython@0.21:', type='build') depends_on('py-numpy@1.10.1:', type=('build', 'run'))
class CoffeeMaker: """Models the machine that makes the coffee""" def __init__(self): self.resources = { "water": 300, "milk": 200, "coffee": 100, } def report(self): """Prints a report of all resources.""" print(f"Water: {self.resources['water']}ml") print(f"Milk: {self.resources['milk']}ml") print(f"Coffee: {self.resources['coffee']}g") def is_resource_sufficient(self, drink): """Returns True when order can be made, False if ingredients are insufficient.""" can_make = True for item in drink.ingredients: if drink.ingredients[item] > self.resources[item]: print(f"Sorry there is not enough {item}.") can_make = False return can_make def make_coffee(self, order): """Deducts the required ingredients from the resources.""" for item in order.ingredients: self.resources[item] -= order.ingredients[item] print(f"Here is your {order.name} ☕️. Enjoy!") def off (self): """Powering off the machine""" exit("Powering off, Goodbye!")
list = ['Apple','Orange','Benana','Mango']; name = "Md Tazri"; print('"Apple" in list : ',"Apple" in list); print('"Kiwi" in list : ',"Kiwi" in list); print('"Water" not in list : ',"Water" not in list); print("'Md' in name : ",'Md' in name); print("'Tazri' not in name : ",'Tazri' not in name);
class DiceLoss(nn.Module): def __init__(self, tolerance=1e-8): super(DiceLoss, self).__init__() self.tolerance = tolerance def forward(self, pred, label): intersection = torch.sum(pred * label) + self.tolerance union = torch.sum(pred) + torch.sum(label) + self.tolerance dice_loss = 1 - 2 * intersection / union return dice_loss class EnsembleLoss(nn.Module): def __init__(self, mask_loss, loss_func): super(EnsembleLoss, self).__init__() self.mask_loss = mask_loss self.loss_func = loss_func def forward(self, masks, ensemble_mask, mask): ensemble_loss = 0 num_backbones = len(masks) for i in range(num_backbones): ensemble_loss = ensemble_loss + self.mask_loss(masks[i], mask) / num_backbones ensemble_loss = 0.5 * ensemble_loss + 0.5 * self.loss_func(ensemble_mask, mask) return ensemble_loss
class EventTypeFilter(TraceFilter): """ Indicates whether a listener should trace based on the event type. EventTypeFilter(level: SourceLevels) """ def ZZZ(self): """hardcoded/mock instance of the class""" return EventTypeFilter() instance=ZZZ() """hardcoded/returns an instance of the class""" def ShouldTrace(self,cache,source,eventType,id,formatOrMessage,args,data1,data): """ ShouldTrace(self: EventTypeFilter,cache: TraceEventCache,source: str,eventType: TraceEventType,id: int,formatOrMessage: str,args: Array[object],data1: object,data: Array[object]) -> bool Determines whether the trace listener should trace the event. cache: A System.Diagnostics.TraceEventCache that represents the information cache for the trace event. source: The name of the source. eventType: One of the System.Diagnostics.TraceEventType values. id: A trace identifier number. formatOrMessage: The format to use for writing an array of arguments,or a message to write. args: An array of argument objects. data1: A trace data object. data: An array of trace data objects. Returns: trueif the trace should be produced; otherwise,false. """ pass @staticmethod def __new__(self,level): """ __new__(cls: type,level: SourceLevels) """ pass EventType=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the event type of the messages to trace. Get: EventType(self: EventTypeFilter) -> SourceLevels Set: EventType(self: EventTypeFilter)=value """
# # This is the Robotics Language compiler # # Transformations.py: Applies tranformations to the XML structure # # Created on: June 22, 2017 # Author: Gabriel A. D. Lopes # Licence: Apache 2.0 # Copyright: 2014-2017 Robot Care Systems BV, The Hague, The Netherlands. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. atoms = { 'string':'Strings', 'boolean':'Booleans', 'real':'Reals', 'integer':'Integers' } def manySameNumbersOrStrings(x): '''number or string''' return all(map(lambda y: y in ['Reals', 'Integers'], x)) or all(map(lambda y: y == 'Strings', x)) def singleString(x): '''string''' return len(x) == 1 and x[0] == 'Strings' def singleReal(x): '''real''' return len(x) == 1 and (x[0] == 'Reals' or x[0] == 'Integers') def singleBoolean(x): '''boolean''' return len(x) == 1 and x[0] == 'Booleans' def manyStrings(x): '''string , ... , string''' return [ xi == 'Strings' for xi in x ] def manyExpressions(x): '''expression , ... , expression''' return [True] def manyCodeBlocks(x): '''code block , ... , code block''' return [ xi == 'CodeBlock' for xi in x ] def returnNothing(x): '''nothing''' return 'Nothing' def returnCodeBlock(x): '''code block''' return 'CodeBlock' def returnSameArgumentType(x): return x[0]
class Contact: def __init__(self, firstname, lastname, company, address, telephone, mobile, tel_work, email, email_1, www): self.firstname = firstname self.lastname = lastname self.company = company self.address = address self.telephone = telephone self.mobile = mobile self.tel_work = tel_work self.email = email self.email_1 = email_1 self.www = www
#!/usr/bin/env python # Tabuada de adição deve ser impressa de 1 a 10 sendo n o número digitado pelo usuario. n = int(input('Tabuada de: ')) x = 1 while x <= 10: print('{} + {} = '.format(n, x,), n + x) x = x + 1 print('FIM ')
# coding: utf-8 def array_pad(l, size, value): if size >= 0: return l + [value] * (size - len(l)) else: return [value] * (size * -1 - len(l)) + l if __name__ == '__main__': l = [12, 10, 9] print(array_pad(l, 5, 0)) print(array_pad(l, -7, -1)) print(array_pad(l, 2, 999))
k=int (input()) l=int (input()) m=int (input()) n=int (input()) d=int (input()) damagedDragons = 0 for i in range (1, d+1): if i%k == 0 or i%l == 0 or i%m == 0 or i%n == 0: damagedDragons = damagedDragons + 1 print(damagedDragons)
# Copyright 2018 Canonical Ltd. # # 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. """Module of exceptions that zaza may raise.""" class MissingOSAthenticationException(Exception): """Exception when some data needed to authenticate is missing.""" pass class CloudInitIncomplete(Exception): """Cloud init has not completed properly.""" pass class SSHFailed(Exception): """SSH failed.""" pass class NeutronAgentMissing(Exception): """Agent binary does not appear in the Neutron agent list.""" pass class NeutronBGPSpeakerMissing(Exception): """No BGP speaker appeared on agent.""" pass class ApplicationNotFound(Exception): """Application not found in machines.""" def __init__(self, application): """Create Application not found exception. :param application: Name of the application :type application: string :returns: ApplicationNotFound Exception """ msg = ("{} application was not found in machines.". format(application)) super(ApplicationNotFound, self).__init__(msg) class SeriesNotFound(Exception): """Series not found in status.""" pass class OSVersionNotFound(Exception): """OS Version not found.""" pass class ReleasePairNotFound(Exception): """Release pair was not found in OPENSTACK_RELEASES_PAIRS.""" pass class KeystoneAuthorizationStrict(Exception): """Authorization/Policy too strict.""" pass class KeystoneAuthorizationPermissive(Exception): """Authorization/Policy too permissive.""" pass class KeystoneWrongTokenProvider(Exception): """A token was issued from the wrong token provider.""" pass class KeystoneKeyRepositoryError(Exception): """Error in key repository. This may be caused by isues with one of: - incomplete or missing data in `key_repository` in leader storage - synchronization of keys to non-leader units - rotation of keys """ pass class ProcessNameCountMismatch(Exception): """Count of process names doesn't match.""" pass class ProcessNameMismatch(Exception): """Name of processes doesn't match.""" pass class PIDCountMismatch(Exception): """PID's count doesn't match.""" pass class ProcessIdsFailed(Exception): """Process ID lookup failed.""" pass class UnitNotFound(Exception): """Unit not found in actual dict.""" pass class UnitCountMismatch(Exception): """Count of unit doesn't match.""" pass class UbuntuReleaseNotFound(Exception): """Ubuntu release not found in list.""" pass class ServiceNotFound(Exception): """Service not found on unit.""" pass class CephPoolNotFound(Exception): """Ceph pool not found.""" pass class NovaGuestMigrationFailed(Exception): """Nova guest migration failed.""" pass class NovaGuestRestartFailed(Exception): """Nova guest restart failed.""" pass
menu = [ [ "egg", "spam", "bacon"], [ "egg", "sausage", "bacon"], [ "egg", "spam"], [ "egg", "bacon", "spam"], [ "egg", "bacon", "sausage", "spam"], [ "spam", "bacon", "sausage", "spam"], [ "spam", "egg", "spam", "spam", "bacon","spam"], [ "spam", "egg", "sausage", "spam"], [ "chicken", "chips"] ] # normal method meals = [] for meal in menu: if "spam" not in meal: meals.append(meal) else: meals.append("a meal was skipped") print(meals) print("*" * 120) # for comprehension with basic conditional comprehension meals = [meal for meal in menu if "spam" not in meal and "chicken" not in meal] print(meals) print("*" * 120) # for comprehension with two conditional comprehension fussy_meals = [meal for meal in menu if "spam" in meal or "eggs" in meal if not ("bacon" in meal and "sausage" in meal)] print(fussy_meals) print("*" * 120) fussy_meals =[meal for meal in menu if ("spam" in meal or "eggs" in meal) and not ("bacon" in meal and "sausage" in meal)] print(fussy_meals)
# *ex 7 = Desenvolva um programa que leia as duas notas de um aluno, calcule e mostre sua média. p = float(input('Cara, me manda sua primeira nota: ')) s = float(input('Manda a segunda: ')) print('Cara sua média é: {:.1f}'.format((p+s)/2))
# Refaça o DESAFIO 9, mostrando a tabuada de um número # que o usuário escolher, só que agora utilizando um laço for. num = int(input('Digite um valor: ')) for i in range(1,11): print(f'{num} X {i} = {num*i}')
def divide(x: int, y: int) -> int: result, power = 0, 32 y_power = y << power while x >= y: while y_power > x: y_power >>=1 power -=1 result += 1<<power x -= y_power return result
""" TODO: Add description. Date: 2021-05-27 Author: Vitali Lupusor """
sum = 0 for x in range(10): sum = sum + x print(sum)
""" Classes in this file are standalone because we don't want to impose a false hierarchy between two classes. That is, inheritance may imply a hierarchy that isn't real. """ class Settings(object): kExactTestBias = 1.0339757656912846e-25 kSmallEpsilon = 5.684341886080802e-14 kLargeEpsilon = 1e-07 SMALL_EPSILON = 5.684341886080802e-14 local_scratch = '/app/scratch' python = 'python' plink = "/srv/gsfs0/software/plink/1.90/plink" redis_uri = 'redis://hydra_redis:6379' class Commands(object): HELP = "HELP" INIT = "INIT" INIT_STATS = 'INIT_STATS' QC = "QC" PCA = "PCA" ECHO = "ECHO" ASSO = "ASSO" EXIT = "EXIT" all_commands = [HELP, INIT, QC, PCA, ASSO, EXIT] # used by v.1 interface commands_with_parms = [QC, PCA, ASSO] class Thresholds(object): # ECHO options ECHO_COUNTS = 20 # QC Options QC_hwe = 1e-10 QC_maf = 0.01 # PCA Options PCA_maf = 0.1 PCA_ld_window = 50 PCA_ld_threshold = 0.2 PCA_pcs = 10 # Association Options ASSO_pcs = 10 class Options(object): # HELP = Commands.HELP INIT = Commands.INIT QC = Commands.QC PCA = Commands.PCA ASSO = Commands.ASSO EXIT = Commands.EXIT HWE = "HWE" MAF = "MAF" MPS = "MPS" MPI = "MPI" SNP = "snp" LD = "LD" NONE = "NONE" class QCOptions(object): HWE = Options.HWE MAF = Options.MAF MPS = Options.MPS MPI = Options.MPI SNP = Options.SNP all_options = [HWE, MAF, MPS, MPI, SNP] class PCAOptions(object): HWE = Options.HWE MAF = Options.MAF MPS = Options.MPS MPI = Options.MPI SNP = Options.SNP LD = Options.LD NONE = Options.NONE all_options = [HWE, MAF, MPS, MPI, SNP, LD, NONE] class QCFilterNames(object): QC_HWE = Options.HWE QC_MAF = Options.MAF QC_MPS = Options.MPS QC_MPI = Options.MPI QC_snp = Options.SNP class PCAFilterNames(object): PCA_HWE = Options.HWE PCA_MAF = Options.MAF PCA_MPS = Options.MPS PCA_MPI = Options.MPI PCA_snp = Options.SNP PCA_LD = Options.LD PCA_NONE = Options.NONE external_host = "hydratest23.azurewebsites.net" class ServerHTTP(object): listen_host = '0.0.0.0' external_host = external_host#"localhost"#external_host#'hydraapp.azurewebsites.net'#"localhost"# port = '9001' max_content_length = 1024 * 1024 * 1024 # 1 GB wait_time = 0.5 # for the time.sleep() hacks class ClientHTTP(object): default_max_content_length = 1024 * 1024 * 1024 # 1 GB default_listen_host = '0.0.0.0' default_external_host = external_host#'hydraapp.azurewebsites.net' # "localhost"# clients = [{ 'name': 'Center1', 'listen_host': default_listen_host, 'external_host': default_external_host, 'port': 9002, 'max_content_length': default_max_content_length }, { 'name': 'Center2', 'listen_host': default_listen_host, 'external_host': default_external_host, 'port': 9003, 'max_content_length': default_max_content_length }, { 'name': 'Center3', 'listen_host': default_listen_host, 'external_host': default_external_host, 'port': 9004, 'max_content_length': default_max_content_length } ]
f = open("io/data/file1") print(f.readline()) print(f.readline(3)) print(f.readline(4)) print(f.readline(5)) print(f.readline()) # readline() on writable file f = open("io/data/file1", "ab") try: f.readline() except OSError: print("OSError") f.close()
# return an integere cycle length K of a permutation. Applying a permutation K-times to a list will return the original list. def permutation_cycle_length(permutation): initialArray = range(len(permutation)) permutedArray = range(len(permutation)) cycles = 0 while True: permutedArray = [permutedArray[permutation[i]] for i in range(len(initialArray))] cycles += 1 if(areEqual(initialArray, permutedArray)): break return cycles def areEqual(first, second): for i in range(len(first)): if(first[i] != second[i]): return False return True print(permutation_cycle_length([4, 3, 2, 0, 1]))
""" Exer 3 """ mes = input("Digite o mês do seu nascimento: ") ano = int(input("Digite o ano do seu nascimento: ")) trab = input("Trabaha em que cargo?") print("{},nascido no mês de {} e no ano de {}, trabalha de {}. data formada: {}/{}".format(nome,mes,ano,trab,mes,ano))
# This is the configuration file for IngeniousCoder’s Modmail. # Only Edit things if you know what you are doing. If not, do not change the default Value. # ALL VARIABLES ARE REQUIRED UNLESS SPECIFIED. # Entering a wrong value may crash the launcher and / or bot. # CONFIG START # MainGuildID : The main Guild’s ID For mod mail to be used in. # StaffGuildID : The staff Guild’s ID For mod mail to be used in. This will be the server where all Modmail Threading and Logging will occur. # ModMailCatagoryID : The Catagory ID of the Catagory Modmail shohld use. Must be in staff guild. MainGuildID = 000000000000000000 StaffGuildID = 000000000000000000 ModMailCatagoryID = 000000000000000000 # DiscordModmailLogChannel : The log channel for modmail threads. DiscordModmailLogChannel = 000000000000000000 # BotToken : The bot token for the Oauth2 App. # BotPlayingStatus : The bot playing status as shown in discord. # BotPrefix : The bot prefix. BotToken = "YOURBOTTOKENISHELLO" BotPlayingStatus = "Hello! DM me to contact mods." BotPrefix = "mail." # The 4 options below take booleans (True / False). # LogCommands : Set if the bot should log into the logs folder. # BotBoundToGuilds : Set if the bot should be bound to the Main and Staff Guilds. (Should the bot auto-leave other guilds when it is added to them?) # BotDMOwnerOnRestart : Set if the bot should DM the Oauth2 Owner everytime on Restart. # BotAutoReconnect : Set if the bot should Automatically Reconnect when disconnected. LogCommands = True BotBoundToGuilds = True BotDMOwnerOnRestart = True BotAutoReconnect = True #End of config. # DO NOT EDIT THIS # No, seriously this will wipe your config. CONFIG_VER = 1
BLOCKCHAIN = { 'class': 'thenewboston_node.business_logic.blockchain.file_blockchain.FileBlockchain', 'kwargs': {}, } BLOCKCHAIN_URL_PATH_PREFIX = '/blockchain/'
n = int(input()) a = n // 365 n = n - a*365 m = n // 30 n = n - m*30 d = n print('{} ano(s)'.format(a)) print('{} mes(es)'.format(m)) print('{} dia(s)'.format(d))
"""14. Faça uma função que recebe uma lista de números e retorna a média aritmética dos elementos dessa lista. Desafio""" #information funcion def fun(list_one, list_two): tot = 0 notes_fist = 0 notes_second = 0 for i in list_one: notes_fist += i for i in list_two: notes_second += i s = len(list_one) + len(list_two) tot = float(notes_fist+notes_second)/s return tot #Lists of input lista1 = [10,6,4,8.4,4.4,2,6.6,4.1] lista2 = [2,5,2.3,4,5,7,7,4,10,10] #funcions declaration x = fun(lista1,lista2) #printing values return print(f'The average is: {x:.2f}')
num=[10,20,30,40,50,60] n=[i for i in num] print(n) n=[10,20,30,40] s=[10,20] n1=[i for i in n] print(n1) n2=[j*j for j in n] print(n2) n3=[s+s for s in n ] print(n3) for m in n: s.append(m*m) print(s) #using lambda l=[1,2,3,4] p=list(map(lambda a:a*a ,l)) print(p) l=list(filter(lambda x:x%2==0,l)) print(l) v=[i for i in l if i%2==0] print(v) my=[] for letter in 'abcd': for num in range(4): my.append((letter,num)) print(my) x=[(letter,num)for letter in 'abcd' for num in range(4)] print(x)
""" PASSENGERS """ numPassengers = 3241 passenger_arriving = ( (2, 4, 9, 5, 2, 0, 7, 7, 4, 5, 1, 0), # 0 (1, 9, 7, 4, 1, 0, 6, 6, 9, 6, 1, 0), # 1 (5, 6, 8, 4, 3, 0, 8, 11, 5, 2, 1, 0), # 2 (4, 5, 5, 4, 2, 0, 8, 15, 0, 4, 4, 0), # 3 (5, 11, 13, 4, 3, 0, 11, 6, 3, 1, 1, 0), # 4 (9, 6, 8, 3, 0, 0, 7, 6, 9, 7, 4, 0), # 5 (8, 12, 3, 4, 1, 0, 4, 12, 5, 4, 0, 0), # 6 (4, 13, 11, 2, 3, 0, 9, 9, 6, 5, 1, 0), # 7 (3, 8, 7, 7, 3, 0, 5, 9, 7, 5, 1, 0), # 8 (2, 5, 5, 1, 3, 0, 3, 3, 5, 6, 5, 0), # 9 (5, 8, 9, 3, 1, 0, 8, 12, 4, 3, 4, 0), # 10 (3, 12, 6, 3, 2, 0, 6, 6, 8, 6, 1, 0), # 11 (1, 10, 8, 7, 1, 0, 10, 7, 6, 5, 1, 0), # 12 (4, 9, 8, 3, 1, 0, 7, 11, 12, 3, 3, 0), # 13 (2, 10, 6, 3, 2, 0, 9, 7, 4, 7, 1, 0), # 14 (2, 6, 9, 2, 4, 0, 7, 12, 7, 8, 2, 0), # 15 (3, 14, 8, 5, 5, 0, 8, 10, 5, 5, 1, 0), # 16 (2, 8, 6, 5, 2, 0, 6, 5, 3, 7, 0, 0), # 17 (3, 11, 8, 2, 0, 0, 4, 3, 4, 7, 0, 0), # 18 (2, 7, 4, 2, 4, 0, 7, 4, 3, 6, 2, 0), # 19 (7, 16, 5, 3, 3, 0, 8, 6, 6, 4, 2, 0), # 20 (1, 6, 11, 5, 0, 0, 4, 11, 6, 9, 0, 0), # 21 (5, 8, 7, 5, 2, 0, 10, 11, 4, 3, 2, 0), # 22 (2, 8, 14, 3, 3, 0, 3, 8, 4, 4, 3, 0), # 23 (3, 7, 5, 5, 5, 0, 5, 8, 4, 5, 3, 0), # 24 (7, 5, 5, 4, 3, 0, 2, 5, 6, 6, 1, 0), # 25 (7, 12, 3, 6, 3, 0, 4, 10, 9, 3, 4, 0), # 26 (1, 10, 8, 2, 1, 0, 5, 13, 5, 5, 0, 0), # 27 (6, 4, 9, 6, 3, 0, 6, 8, 7, 7, 3, 0), # 28 (6, 9, 13, 7, 1, 0, 3, 10, 7, 3, 4, 0), # 29 (4, 5, 5, 2, 2, 0, 9, 14, 6, 7, 1, 0), # 30 (2, 7, 3, 3, 1, 0, 7, 7, 4, 4, 2, 0), # 31 (4, 5, 9, 0, 2, 0, 5, 15, 3, 2, 1, 0), # 32 (4, 10, 9, 2, 3, 0, 11, 8, 4, 4, 1, 0), # 33 (6, 11, 6, 3, 1, 0, 8, 4, 10, 6, 2, 0), # 34 (6, 4, 3, 4, 3, 0, 10, 9, 6, 6, 0, 0), # 35 (4, 6, 15, 4, 2, 0, 13, 8, 3, 6, 2, 0), # 36 (6, 9, 5, 5, 6, 0, 10, 14, 2, 7, 3, 0), # 37 (2, 7, 11, 7, 1, 0, 7, 7, 5, 3, 1, 0), # 38 (4, 11, 7, 4, 2, 0, 6, 13, 3, 2, 3, 0), # 39 (10, 12, 10, 3, 3, 0, 4, 10, 6, 7, 1, 0), # 40 (6, 6, 4, 1, 2, 0, 7, 9, 5, 4, 0, 0), # 41 (6, 7, 10, 5, 3, 0, 0, 15, 9, 7, 0, 0), # 42 (8, 11, 8, 2, 3, 0, 9, 12, 7, 1, 3, 0), # 43 (5, 12, 13, 3, 2, 0, 8, 12, 3, 4, 4, 0), # 44 (5, 8, 4, 6, 0, 0, 8, 9, 5, 3, 5, 0), # 45 (11, 18, 7, 2, 0, 0, 5, 13, 6, 3, 3, 0), # 46 (5, 9, 2, 5, 0, 0, 4, 8, 5, 3, 1, 0), # 47 (5, 9, 8, 7, 1, 0, 11, 10, 4, 4, 0, 0), # 48 (0, 10, 8, 4, 1, 0, 6, 7, 7, 6, 2, 0), # 49 (8, 8, 7, 4, 3, 0, 4, 11, 4, 8, 1, 0), # 50 (9, 12, 10, 3, 2, 0, 7, 9, 6, 7, 3, 0), # 51 (3, 8, 7, 4, 3, 0, 3, 11, 5, 4, 1, 0), # 52 (6, 8, 6, 3, 4, 0, 9, 10, 6, 5, 3, 0), # 53 (2, 17, 11, 4, 2, 0, 5, 14, 6, 12, 2, 0), # 54 (3, 8, 5, 3, 2, 0, 12, 9, 5, 4, 1, 0), # 55 (1, 6, 9, 4, 6, 0, 11, 10, 6, 8, 2, 0), # 56 (5, 6, 3, 5, 1, 0, 8, 9, 3, 6, 1, 0), # 57 (0, 11, 6, 5, 0, 0, 4, 13, 5, 4, 2, 0), # 58 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59 ) station_arriving_intensity = ( (3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0 (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1 (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2 (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3 (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4 (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5 (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6 (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7 (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8 (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9 (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10 (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11 (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12 (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13 (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14 (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15 (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16 (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17 (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18 (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19 (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20 (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21 (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22 (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23 (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24 (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25 (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26 (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27 (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28 (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29 (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30 (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31 (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32 (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33 (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34 (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35 (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36 (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37 (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38 (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39 (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40 (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41 (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42 (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43 (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44 (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45 (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46 (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47 (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48 (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49 (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50 (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51 (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52 (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53 (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54 (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55 (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56 (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57 (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_arriving_acc = ( (2, 4, 9, 5, 2, 0, 7, 7, 4, 5, 1, 0), # 0 (3, 13, 16, 9, 3, 0, 13, 13, 13, 11, 2, 0), # 1 (8, 19, 24, 13, 6, 0, 21, 24, 18, 13, 3, 0), # 2 (12, 24, 29, 17, 8, 0, 29, 39, 18, 17, 7, 0), # 3 (17, 35, 42, 21, 11, 0, 40, 45, 21, 18, 8, 0), # 4 (26, 41, 50, 24, 11, 0, 47, 51, 30, 25, 12, 0), # 5 (34, 53, 53, 28, 12, 0, 51, 63, 35, 29, 12, 0), # 6 (38, 66, 64, 30, 15, 0, 60, 72, 41, 34, 13, 0), # 7 (41, 74, 71, 37, 18, 0, 65, 81, 48, 39, 14, 0), # 8 (43, 79, 76, 38, 21, 0, 68, 84, 53, 45, 19, 0), # 9 (48, 87, 85, 41, 22, 0, 76, 96, 57, 48, 23, 0), # 10 (51, 99, 91, 44, 24, 0, 82, 102, 65, 54, 24, 0), # 11 (52, 109, 99, 51, 25, 0, 92, 109, 71, 59, 25, 0), # 12 (56, 118, 107, 54, 26, 0, 99, 120, 83, 62, 28, 0), # 13 (58, 128, 113, 57, 28, 0, 108, 127, 87, 69, 29, 0), # 14 (60, 134, 122, 59, 32, 0, 115, 139, 94, 77, 31, 0), # 15 (63, 148, 130, 64, 37, 0, 123, 149, 99, 82, 32, 0), # 16 (65, 156, 136, 69, 39, 0, 129, 154, 102, 89, 32, 0), # 17 (68, 167, 144, 71, 39, 0, 133, 157, 106, 96, 32, 0), # 18 (70, 174, 148, 73, 43, 0, 140, 161, 109, 102, 34, 0), # 19 (77, 190, 153, 76, 46, 0, 148, 167, 115, 106, 36, 0), # 20 (78, 196, 164, 81, 46, 0, 152, 178, 121, 115, 36, 0), # 21 (83, 204, 171, 86, 48, 0, 162, 189, 125, 118, 38, 0), # 22 (85, 212, 185, 89, 51, 0, 165, 197, 129, 122, 41, 0), # 23 (88, 219, 190, 94, 56, 0, 170, 205, 133, 127, 44, 0), # 24 (95, 224, 195, 98, 59, 0, 172, 210, 139, 133, 45, 0), # 25 (102, 236, 198, 104, 62, 0, 176, 220, 148, 136, 49, 0), # 26 (103, 246, 206, 106, 63, 0, 181, 233, 153, 141, 49, 0), # 27 (109, 250, 215, 112, 66, 0, 187, 241, 160, 148, 52, 0), # 28 (115, 259, 228, 119, 67, 0, 190, 251, 167, 151, 56, 0), # 29 (119, 264, 233, 121, 69, 0, 199, 265, 173, 158, 57, 0), # 30 (121, 271, 236, 124, 70, 0, 206, 272, 177, 162, 59, 0), # 31 (125, 276, 245, 124, 72, 0, 211, 287, 180, 164, 60, 0), # 32 (129, 286, 254, 126, 75, 0, 222, 295, 184, 168, 61, 0), # 33 (135, 297, 260, 129, 76, 0, 230, 299, 194, 174, 63, 0), # 34 (141, 301, 263, 133, 79, 0, 240, 308, 200, 180, 63, 0), # 35 (145, 307, 278, 137, 81, 0, 253, 316, 203, 186, 65, 0), # 36 (151, 316, 283, 142, 87, 0, 263, 330, 205, 193, 68, 0), # 37 (153, 323, 294, 149, 88, 0, 270, 337, 210, 196, 69, 0), # 38 (157, 334, 301, 153, 90, 0, 276, 350, 213, 198, 72, 0), # 39 (167, 346, 311, 156, 93, 0, 280, 360, 219, 205, 73, 0), # 40 (173, 352, 315, 157, 95, 0, 287, 369, 224, 209, 73, 0), # 41 (179, 359, 325, 162, 98, 0, 287, 384, 233, 216, 73, 0), # 42 (187, 370, 333, 164, 101, 0, 296, 396, 240, 217, 76, 0), # 43 (192, 382, 346, 167, 103, 0, 304, 408, 243, 221, 80, 0), # 44 (197, 390, 350, 173, 103, 0, 312, 417, 248, 224, 85, 0), # 45 (208, 408, 357, 175, 103, 0, 317, 430, 254, 227, 88, 0), # 46 (213, 417, 359, 180, 103, 0, 321, 438, 259, 230, 89, 0), # 47 (218, 426, 367, 187, 104, 0, 332, 448, 263, 234, 89, 0), # 48 (218, 436, 375, 191, 105, 0, 338, 455, 270, 240, 91, 0), # 49 (226, 444, 382, 195, 108, 0, 342, 466, 274, 248, 92, 0), # 50 (235, 456, 392, 198, 110, 0, 349, 475, 280, 255, 95, 0), # 51 (238, 464, 399, 202, 113, 0, 352, 486, 285, 259, 96, 0), # 52 (244, 472, 405, 205, 117, 0, 361, 496, 291, 264, 99, 0), # 53 (246, 489, 416, 209, 119, 0, 366, 510, 297, 276, 101, 0), # 54 (249, 497, 421, 212, 121, 0, 378, 519, 302, 280, 102, 0), # 55 (250, 503, 430, 216, 127, 0, 389, 529, 308, 288, 104, 0), # 56 (255, 509, 433, 221, 128, 0, 397, 538, 311, 294, 105, 0), # 57 (255, 520, 439, 226, 128, 0, 401, 551, 316, 298, 107, 0), # 58 (255, 520, 439, 226, 128, 0, 401, 551, 316, 298, 107, 0), # 59 ) passenger_arriving_rate = ( (3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0 (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1 (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2 (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3 (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4 (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5 (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6 (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7 (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8 (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9 (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10 (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11 (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12 (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13 (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14 (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15 (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16 (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17 (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18 (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19 (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20 (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21 (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22 (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23 (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24 (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25 (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26 (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27 (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28 (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29 (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30 (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31 (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32 (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33 (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34 (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35 (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36 (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37 (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38 (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39 (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40 (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41 (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42 (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43 (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44 (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45 (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46 (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47 (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48 (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49 (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50 (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51 (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52 (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53 (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54 (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55 (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56 (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57 (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_allighting_rate = ( (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59 ) """ parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html """ #initial entropy entropy = 258194110137029475889902652135037600173 #index for seed sequence child child_seed_index = ( 1, # 0 59, # 1 )
"""A basic example of using the SQLAlchemy Sharding API. Sharding refers to horizontally scaling data across multiple databases. The basic components of a "sharded" mapping are: * multiple databases, each assigned a 'shard id' * a function which can return a single shard id, given an instance to be saved; this is called "shard_chooser" * a function which can return a list of shard ids which apply to a particular instance identifier; this is called "id_chooser". If it returns all shard ids, all shards will be searched. * a function which can return a list of shard ids to try, given a particular Query ("query_chooser"). If it returns all shard ids, all shards will be queried and the results joined together. In this example, four sqlite databases will store information about weather data on a database-per-continent basis. We provide example shard_chooser, id_chooser and query_chooser functions. The query_chooser illustrates inspection of the SQL expression element in order to attempt to determine a single shard being requested. The construction of generic sharding routines is an ambitious approach to the issue of organizing instances among multiple databases. For a more plain-spoken alternative, the "distinct entity" approach is a simple method of assigning objects to different tables (and potentially database nodes) in an explicit way - described on the wiki at `EntityName <http://www.sqlalchemy.org/trac/wiki/UsageRecipes/EntityName>`_. """
# # PySNMP MIB module CISCO-IPSEC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IPSEC-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:02:28 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint") ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") iso, Gauge32, NotificationType, Integer32, ModuleIdentity, ObjectIdentity, Bits, TimeTicks, Counter32, MibIdentifier, Counter64, IpAddress, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Gauge32", "NotificationType", "Integer32", "ModuleIdentity", "ObjectIdentity", "Bits", "TimeTicks", "Counter32", "MibIdentifier", "Counter64", "IpAddress", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue") ciscoIPsecMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 62)) if mibBuilder.loadTexts: ciscoIPsecMIB.setLastUpdated('200008071139Z') if mibBuilder.loadTexts: ciscoIPsecMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoIPsecMIB.setContactInfo(' Cisco Systems Enterprise Business Management Unit Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-ipsecurity@cisco.com') if mibBuilder.loadTexts: ciscoIPsecMIB.setDescription("The MIB module for modeling Cisco-specific IPsec attributes Overview of Cisco IPsec MIB MIB description This MIB models the Cisco implementation-specific attributes of a Cisco entity that implements IPsec. This MIB is complementary to the standard IPsec MIB proposed jointly by Tivoli and Cisco. The ciscoIPsec MIB provides the operational information on Cisco's IPsec tunnelling implementation. The following entities are managed: 1) ISAKMP Group: a) ISAKMP global parameters b) ISAKMP Policy Table 2) IPSec Group: a) IPSec Global Parameters b) IPSec Global Traffic Parameters c) Cryptomap Group - Cryptomap Set Table - Cryptomap Table - CryptomapSet Binding Table 3) System Capacity & Capability Group: a) Capacity Parameters b) Capability Parameters 4) Trap Control Group 5) Notifications Group") class CIPsecLifetime(TextualConvention, Gauge32): description = 'Value in units of seconds' status = 'current' subtypeSpec = Gauge32.subtypeSpec + ValueRangeConstraint(120, 86400) class CIPsecLifesize(TextualConvention, Gauge32): description = 'Value in units of kilobytes' status = 'current' subtypeSpec = Gauge32.subtypeSpec + ValueRangeConstraint(2560, 536870912) class CIPsecNumCryptoMaps(TextualConvention, Gauge32): description = 'Integral units representing count of cryptomaps' status = 'current' subtypeSpec = Gauge32.subtypeSpec + ValueRangeConstraint(0, 2147483647) class CryptomapType(TextualConvention, Integer32): description = 'The type of a cryptomap entry. Cryptomap is a unit of IOS IPSec policy specification.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5)) namedValues = NamedValues(("cryptomapTypeNONE", 0), ("cryptomapTypeMANUAL", 1), ("cryptomapTypeISAKMP", 2), ("cryptomapTypeCET", 3), ("cryptomapTypeDYNAMIC", 4), ("cryptomapTypeDYNAMICDISCOVERY", 5)) class CryptomapSetBindStatus(TextualConvention, Integer32): description = "The status of the binding of a cryptomap set to the specified interface. The value qhen queried is always 'attached'. When set to 'detached', the cryptomap set if detached from the specified interface. Setting the value to 'attached' will result in SNMP General Error." status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2)) namedValues = NamedValues(("unknown", 0), ("attached", 1), ("detached", 2)) class IPSIpAddress(TextualConvention, OctetString): description = 'An IP V4 or V6 Address.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), ) class IkeHashAlgo(TextualConvention, Integer32): description = 'The hash algorithm used in IPsec Phase-1 IKE negotiations.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("none", 1), ("md5", 2), ("sha", 3)) class IkeAuthMethod(TextualConvention, Integer32): description = 'The authentication method used in IPsec Phase-1 IKE negotiations.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("none", 1), ("preSharedKey", 2), ("rsaSig", 3), ("rsaEncrypt", 4), ("revPublicKey", 5)) class IkeIdentityType(TextualConvention, Integer32): description = 'The type of identity used by the local entity to identity itself to the peer with which it performs IPSec Main Mode negotiations. This type decides the content of the Identification payload in the Main Mode of IPSec tunnel setup.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2)) namedValues = NamedValues(("isakmpIdTypeUNKNOWN", 0), ("isakmpIdTypeADDRESS", 1), ("isakmpIdTypeHOSTNAME", 2)) class DiffHellmanGrp(TextualConvention, Integer32): description = 'The Diffie Hellman Group used in negotiations.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("none", 1), ("dhGroup1", 2), ("dhGroup2", 3)) class EncryptAlgo(TextualConvention, Integer32): description = 'The encryption algorithm used in negotiations.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("none", 1), ("des", 2), ("des3", 3)) class TrapStatus(TextualConvention, Integer32): description = 'The administrative status for sending a TRAP.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("enabled", 1), ("disabled", 2)) ciscoIPsecMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1)) ciscoIPsecMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 2)) ciscoIPsecMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 3)) cipsIsakmpGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1)) cipsIPsecGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2)) cipsIPsecGlobals = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1)) cipsIPsecStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 2)) cipsCryptomapGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3)) cipsSysCapacityGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 3)) cipsTrapCntlGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4)) cipsIsakmpEnabled = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpEnabled.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpEnabled.setDescription('The value of this object is TRUE if ISAKMP has been enabled on the managed entity. Otherise the value of this object is FALSE.') cipsIsakmpIdentity = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 2), IkeIdentityType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpIdentity.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpIdentity.setDescription('The value of this object is shows the type of identity used by the managed entity in ISAKMP negotiations with another peer.') cipsIsakmpKeepaliveInterval = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 3600))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpKeepaliveInterval.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpKeepaliveInterval.setDescription('The value of this object is time interval in seconds between successive ISAKMP keepalive heartbeats issued to the peers to which IKE tunnels have been setup.') cipsNumIsakmpPolicies = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumIsakmpPolicies.setStatus('current') if mibBuilder.loadTexts: cipsNumIsakmpPolicies.setDescription('The value of this object is the number of ISAKMP policies that have been configured on the managed entity.') cipsIsakmpPolicyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5), ) if mibBuilder.loadTexts: cipsIsakmpPolicyTable.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolicyTable.setDescription('The table containing the list of all ISAKMP policy entries configured by the operator.') cipsIsakmpPolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1), ).setIndexNames((0, "CISCO-IPSEC-MIB", "cipsIsakmpPolPriority")) if mibBuilder.loadTexts: cipsIsakmpPolicyEntry.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolicyEntry.setDescription('Each entry contains the attributes associated with a single ISAKMP Policy entry.') cipsIsakmpPolPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cipsIsakmpPolPriority.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolPriority.setDescription('The priotity of this ISAKMP Policy entry. This is also the index of this table.') cipsIsakmpPolEncr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 2), EncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpPolEncr.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolEncr.setDescription('The encryption transform specified by this ISAKMP policy specification. The Internet Key Exchange (IKE) tunnels setup using this policy item would use the specified encryption transform to protect the ISAKMP PDUs.') cipsIsakmpPolHash = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 3), IkeHashAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpPolHash.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolHash.setDescription('The hash transform specified by this ISAKMP policy specification. The IKE tunnels setup using this policy item would use the specified hash transform to protect the ISAKMP PDUs.') cipsIsakmpPolAuth = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 4), IkeAuthMethod()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpPolAuth.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolAuth.setDescription('The peer authentication mthod specified by this ISAKMP policy specification. If this policy entity is selected for negotiation with a peer, the local entity would authenticate the peer using the method specified by this object.') cipsIsakmpPolGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 5), DiffHellmanGrp()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpPolGroup.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolGroup.setDescription('This object specifies the Oakley group used for Diffie Hellman exchange in the Main Mode. If this policy item is selected to negotiate Main Mode with an IKE peer, the local entity chooses the group specified by this object to perform Diffie Hellman exchange with the peer.') cipsIsakmpPolLifetime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 1, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 86400))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsIsakmpPolLifetime.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolLifetime.setDescription('This object specifies the lifetime in seconds of the IKE tunnels generated using this policy specification.') cipsSALifetime = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 1), CIPsecLifetime()).setUnits('Seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsSALifetime.setStatus('current') if mibBuilder.loadTexts: cipsSALifetime.setDescription('The default lifetime (in seconds) assigned to an SA as a global policy (maybe overridden in specific cryptomap definitions).') cipsSALifesize = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 2), CIPsecLifesize()).setUnits('KBytes').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsSALifesize.setStatus('current') if mibBuilder.loadTexts: cipsSALifesize.setDescription('The default lifesize in KBytes assigned to an SA as a global policy (unless overridden in cryptomap definition)') cipsNumStaticCryptomapSets = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 3), CIPsecNumCryptoMaps()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumStaticCryptomapSets.setStatus('current') if mibBuilder.loadTexts: cipsNumStaticCryptomapSets.setDescription('The number of Cryptomap Sets that are are fully configured. Statically defined cryptomap sets are ones where the operator has fully specified all the parameters required set up IPSec Virtual Private Networks (VPNs).') cipsNumCETCryptomapSets = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 4), CIPsecNumCryptoMaps()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumCETCryptomapSets.setStatus('current') if mibBuilder.loadTexts: cipsNumCETCryptomapSets.setDescription('The number of static Cryptomap Sets that have at least one CET cryptomap element as a member of the set.') cipsNumDynamicCryptomapSets = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 5), CIPsecNumCryptoMaps()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumDynamicCryptomapSets.setStatus('current') if mibBuilder.loadTexts: cipsNumDynamicCryptomapSets.setDescription("The number of dynamic IPSec Policy templates (called 'dynamic cryptomap templates') configured on the managed entity.") cipsNumTEDCryptomapSets = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 1, 6), CIPsecNumCryptoMaps()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumTEDCryptomapSets.setStatus('current') if mibBuilder.loadTexts: cipsNumTEDCryptomapSets.setDescription('The number of static Cryptomap Sets that have at least one dynamic cryptomap template bound to them which has the Tunnel Endpoint Discovery (TED) enabled.') cipsNumTEDProbesReceived = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 2, 1), Counter32()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumTEDProbesReceived.setStatus('current') if mibBuilder.loadTexts: cipsNumTEDProbesReceived.setDescription('The number of TED probes that were received by this managed entity since bootup. Not affected by any CLI operation.') cipsNumTEDProbesSent = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 2, 2), Counter32()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumTEDProbesSent.setStatus('current') if mibBuilder.loadTexts: cipsNumTEDProbesSent.setDescription('The number of TED probes that were dispatched by all the dynamic cryptomaps in this managed entity since bootup. Not affected by any CLI operation.') cipsNumTEDFailures = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 2, 3), Counter32()).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsNumTEDFailures.setStatus('current') if mibBuilder.loadTexts: cipsNumTEDFailures.setDescription('The number of TED probes that were dispatched by the local entity and that failed to locate crypto endpoint. Not affected by any CLI operation.') cipsMaxSAs = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setUnits('Integral Units').setMaxAccess("readonly") if mibBuilder.loadTexts: cipsMaxSAs.setStatus('current') if mibBuilder.loadTexts: cipsMaxSAs.setDescription('The maximum number of IPsec Security Associations that can be established on this managed entity. If no theoretical limit exists, this returns value 0. Not affected by any CLI operation.') cips3DesCapable = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 3, 2), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cips3DesCapable.setStatus('current') if mibBuilder.loadTexts: cips3DesCapable.setDescription('The value of this object is TRUE if the managed entity has the hardware nad software features to support 3DES encryption algorithm. Not affected by any CLI operation.') cipsStaticCryptomapSetTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1), ) if mibBuilder.loadTexts: cipsStaticCryptomapSetTable.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetTable.setDescription('The table containing the list of all cryptomap sets that are fully specified and are not wild-carded. The operator may include different types of cryptomaps in such a set - manual, CET, ISAKMP or dynamic.') cipsStaticCryptomapSetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1), ).setIndexNames((0, "CISCO-IPSEC-MIB", "cipsStaticCryptomapSetName")) if mibBuilder.loadTexts: cipsStaticCryptomapSetEntry.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetEntry.setDescription('Each entry contains the attributes associated with a single static cryptomap set.') cipsStaticCryptomapSetName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 1), DisplayString()) if mibBuilder.loadTexts: cipsStaticCryptomapSetName.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetName.setDescription('The index of the static cryptomap table. The value of the string is the name string assigned by the operator in defining the cryptomap set.') cipsStaticCryptomapSetSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetSize.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetSize.setDescription('The total number of cryptomap entries contained in this cryptomap set. ') cipsStaticCryptomapSetNumIsakmp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumIsakmp.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumIsakmp.setDescription('The number of cryptomaps associated with this cryptomap set that use ISAKMP protocol to do key exchange.') cipsStaticCryptomapSetNumManual = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumManual.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumManual.setDescription('The number of cryptomaps associated with this cryptomap set that require the operator to manually setup the keys and SPIs.') cipsStaticCryptomapSetNumCET = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumCET.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumCET.setDescription("The number of cryptomaps of type 'ipsec-cisco' associated with this cryptomap set. Such cryptomap elements implement Cisco Encryption Technology based Virtual Private Networks.") cipsStaticCryptomapSetNumDynamic = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumDynamic.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumDynamic.setDescription('The number of dynamic cryptomap templates linked to this cryptomap set.') cipsStaticCryptomapSetNumDisc = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumDisc.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumDisc.setDescription('The number of dynamic cryptomap templates linked to this cryptomap set that have Tunnel Endpoint Discovery (TED) enabled.') cipsStaticCryptomapSetNumSAs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 1, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapSetNumSAs.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapSetNumSAs.setDescription('The number of and IPsec Security Associations that are active and were setup using this cryptomap. ') cipsDynamicCryptomapSetTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 2), ) if mibBuilder.loadTexts: cipsDynamicCryptomapSetTable.setStatus('current') if mibBuilder.loadTexts: cipsDynamicCryptomapSetTable.setDescription('The table containing the list of all dynamic cryptomaps that use IKE, defined on the managed entity.') cipsDynamicCryptomapSetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 2, 1), ).setIndexNames((0, "CISCO-IPSEC-MIB", "cipsDynamicCryptomapSetName")) if mibBuilder.loadTexts: cipsDynamicCryptomapSetEntry.setStatus('current') if mibBuilder.loadTexts: cipsDynamicCryptomapSetEntry.setDescription('Each entry contains the attributes associated with a single dynamic cryptomap template.') cipsDynamicCryptomapSetName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 2, 1, 1), DisplayString()) if mibBuilder.loadTexts: cipsDynamicCryptomapSetName.setStatus('current') if mibBuilder.loadTexts: cipsDynamicCryptomapSetName.setDescription('The index of the dynamic cryptomap table. The value of the string is the one assigned by the operator in defining the cryptomap set.') cipsDynamicCryptomapSetSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 2, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsDynamicCryptomapSetSize.setStatus('current') if mibBuilder.loadTexts: cipsDynamicCryptomapSetSize.setDescription('The number of cryptomap entries in this cryptomap.') cipsDynamicCryptomapSetNumAssoc = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 2, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsDynamicCryptomapSetNumAssoc.setStatus('current') if mibBuilder.loadTexts: cipsDynamicCryptomapSetNumAssoc.setDescription('The number of static cryptomap sets with which this dynamic cryptomap is associated. ') cipsStaticCryptomapTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3), ) if mibBuilder.loadTexts: cipsStaticCryptomapTable.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapTable.setDescription('The table ilisting the member cryptomaps of the cryptomap sets that are configured on the managed entity.') cipsStaticCryptomapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1), ).setIndexNames((0, "CISCO-IPSEC-MIB", "cipsStaticCryptomapSetName"), (0, "CISCO-IPSEC-MIB", "cipsStaticCryptomapPriority")) if mibBuilder.loadTexts: cipsStaticCryptomapEntry.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapEntry.setDescription('Each entry contains the attributes associated with a single static (fully specified) cryptomap entry. This table does not include the members of dynamic cryptomap sets that may be linked with the parent static cryptomap set.') cipsStaticCryptomapPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cipsStaticCryptomapPriority.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapPriority.setDescription('The priority of the cryptomap entry in the cryptomap set. This is the second index component of this table.') cipsStaticCryptomapType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 2), CryptomapType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapType.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapType.setDescription('The type of the cryptomap entry. This can be an ISAKMP cryptomap, CET or manual. Dynamic cryptomaps are not counted in this table.') cipsStaticCryptomapDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapDescr.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapDescr.setDescription('The description string entered by the operatoir while creating this cryptomap. The string generally identifies a description and the purpose of this policy.') cipsStaticCryptomapPeer = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 4), IPSIpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapPeer.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapPeer.setDescription('The IP address of the current peer associated with this IPSec policy item. Traffic that is protected by this cryptomap is protected by a tunnel that terminates at the device whose IP address is specified by this object.') cipsStaticCryptomapNumPeers = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 40))).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapNumPeers.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapNumPeers.setDescription("The number of peers associated with this cryptomap entry. The peers other than the one identified by 'cipsStaticCryptomapPeer' are backup peers. Manual cryptomaps may have only one peer.") cipsStaticCryptomapPfs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 6), DiffHellmanGrp()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapPfs.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapPfs.setDescription('This object identifies if the tunnels instantiated due to this policy item should use Perfect Forward Secrecy (PFS) and if so, what group of Oakley they should use.') cipsStaticCryptomapLifetime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(120, 86400), ))).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapLifetime.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapLifetime.setDescription('This object identifies the lifetime of the IPSec Security Associations (SA) created using this IPSec policy entry. If this value is zero, the lifetime assumes the value specified by the global lifetime parameter.') cipsStaticCryptomapLifesize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(2560, 536870912), ))).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapLifesize.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapLifesize.setDescription('This object identifies the lifesize (maximum traffic in bytes that may be carried) of the IPSec SAs created using this IPSec policy entry. If this value is zero, the lifetime assumes the value specified by the global lifesize parameter.') cipsStaticCryptomapLevelHost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 3, 1, 9), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsStaticCryptomapLevelHost.setStatus('current') if mibBuilder.loadTexts: cipsStaticCryptomapLevelHost.setDescription('This object identifies the granularity of the IPSec SAs created using this IPSec policy entry. If this value is TRUE, distinct SA bundles are created for distinct hosts at the end of the application traffic.') cipsCryptomapSetIfTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 4), ) if mibBuilder.loadTexts: cipsCryptomapSetIfTable.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetIfTable.setDescription('The table lists the binding of cryptomap sets to the interfaces of the managed entity.') cipsCryptomapSetIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-IPSEC-MIB", "cipsStaticCryptomapSetName")) if mibBuilder.loadTexts: cipsCryptomapSetIfEntry.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetIfEntry.setDescription('Each entry contains the record of the association between an interface and a cryptomap set (static) that is defined on the managed entity. Note that the cryptomap set identified in this binding must static. Dynamic cryptomaps cannot be bound to interfaces.') cipsCryptomapSetIfVirtual = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 4, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cipsCryptomapSetIfVirtual.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetIfVirtual.setDescription('The value of this object identifies if the interface to which the cryptomap set is attached is a tunnel (such as a GRE or PPTP tunnel).') cipsCryptomapSetIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 2, 3, 4, 1, 2), CryptomapSetBindStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCryptomapSetIfStatus.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetIfStatus.setDescription("This object identifies the status of the binding of the specified cryptomap set with the specified interface. The value when queried is always 'attached'. When set to 'detached', the cryptomap set if detached from the specified interface. The effect of this is same as the CLI command config-if# no crypto map cryptomapSetName Setting the value to 'attached' will result in SNMP General Error.") cipsCntlIsakmpPolicyAdded = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 1), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlIsakmpPolicyAdded.setStatus('current') if mibBuilder.loadTexts: cipsCntlIsakmpPolicyAdded.setDescription('This object defines the administrative state of sending the IOS IPsec ISAKMP Policy Add trap.') cipsCntlIsakmpPolicyDeleted = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 2), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlIsakmpPolicyDeleted.setStatus('current') if mibBuilder.loadTexts: cipsCntlIsakmpPolicyDeleted.setDescription('This object defines the administrative state of sending the IOS IPsec ISAKMP Policy Delete trap.') cipsCntlCryptomapAdded = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 3), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlCryptomapAdded.setStatus('current') if mibBuilder.loadTexts: cipsCntlCryptomapAdded.setDescription('This object defines the administrative state of sending the IOS IPsec Cryptomap Add trap.') cipsCntlCryptomapDeleted = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 4), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlCryptomapDeleted.setStatus('current') if mibBuilder.loadTexts: cipsCntlCryptomapDeleted.setDescription('This object defines the administrative state of sending the IOS IPsec Cryptomap Delete trap.') cipsCntlCryptomapSetAttached = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 5), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlCryptomapSetAttached.setStatus('current') if mibBuilder.loadTexts: cipsCntlCryptomapSetAttached.setDescription('This object defines the administrative state of sending the IOS IPsec trap that is issued when a cryptomap set is attached to an interface.') cipsCntlCryptomapSetDetached = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 6), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlCryptomapSetDetached.setStatus('current') if mibBuilder.loadTexts: cipsCntlCryptomapSetDetached.setDescription('This object defines the administrative state of sending the IOS IPsec trap that is issued when a cryptomap set is detached from an interface. to which it was earlier bound.') cipsCntlTooManySAs = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 62, 1, 4, 7), TrapStatus().clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cipsCntlTooManySAs.setStatus('current') if mibBuilder.loadTexts: cipsCntlTooManySAs.setDescription('This object defines the administrative state of sending the IOS IPsec trap that is issued when the number of SAs crosses the maximum number of SAs that may be supported on the managed entity.') cipsMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0)) cipsIsakmpPolicyAdded = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 1)).setObjects(("CISCO-IPSEC-MIB", "cipsNumIsakmpPolicies")) if mibBuilder.loadTexts: cipsIsakmpPolicyAdded.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolicyAdded.setDescription('This trap is generated when a new ISAKMP policy element is defined on the managed entity. The context of the event includes the updated number of ISAKMP policy elements currently available.') cipsIsakmpPolicyDeleted = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 2)).setObjects(("CISCO-IPSEC-MIB", "cipsNumIsakmpPolicies")) if mibBuilder.loadTexts: cipsIsakmpPolicyDeleted.setStatus('current') if mibBuilder.loadTexts: cipsIsakmpPolicyDeleted.setDescription('This trap is generated when an existing ISAKMP policy element is deleted on the managed entity. The context of the event includes the updated number of ISAKMP policy elements currently available.') cipsCryptomapAdded = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 3)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapType"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetSize")) if mibBuilder.loadTexts: cipsCryptomapAdded.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapAdded.setDescription('This trap is generated when a new cryptomap is added to the specified cryptomap set.') cipsCryptomapDeleted = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 4)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetSize")) if mibBuilder.loadTexts: cipsCryptomapDeleted.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapDeleted.setDescription('This trap is generated when a cryptomap is removed from the specified cryptomap set.') cipsCryptomapSetAttached = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 5)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetSize"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumIsakmp"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumDynamic")) if mibBuilder.loadTexts: cipsCryptomapSetAttached.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetAttached.setDescription('A cryptomap set must be attached to an interface of the device in order for it to be operational. This trap is generated when the cryptomap set attached to an active interface of the managed entity. The context of the notification includes: Size of the attached cryptomap set, Number of ISAKMP cryptomaps in the set and Number of Dynamic cryptomaps in the set.') cipsCryptomapSetDetached = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 6)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetSize")) if mibBuilder.loadTexts: cipsCryptomapSetDetached.setStatus('current') if mibBuilder.loadTexts: cipsCryptomapSetDetached.setDescription('This trap is generated when a cryptomap set is detached from an interafce to which it was bound earlier. The context of the event identifies the size of the cryptomap set.') cipsTooManySAs = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 62, 2, 0, 7)).setObjects(("CISCO-IPSEC-MIB", "cipsMaxSAs")) if mibBuilder.loadTexts: cipsTooManySAs.setStatus('current') if mibBuilder.loadTexts: cipsTooManySAs.setDescription('This trap is generated when a new SA is attempted to be setup while the number of currently active SAs equals the maximum configurable. The variables are: cipsMaxSAs') cipsMIBConformances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 1)) cipsMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2)) cipsMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 1, 1)).setObjects(("CISCO-IPSEC-MIB", "cipsMIBConfIsakmpGroup"), ("CISCO-IPSEC-MIB", "cipsMIBConfIPSecGlobalsGroup"), ("CISCO-IPSEC-MIB", "cipsMIBConfCapacityGroup"), ("CISCO-IPSEC-MIB", "cipsMIBStaticCryptomapGroup"), ("CISCO-IPSEC-MIB", "cipsMIBMandatoryNotifCntlGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBCompliance = cipsMIBCompliance.setStatus('current') if mibBuilder.loadTexts: cipsMIBCompliance.setDescription('The compliance statement for entities which implement the Cisco IPsec MIB') cipsMIBConfIsakmpGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 1)).setObjects(("CISCO-IPSEC-MIB", "cipsIsakmpEnabled"), ("CISCO-IPSEC-MIB", "cipsIsakmpIdentity"), ("CISCO-IPSEC-MIB", "cipsIsakmpKeepaliveInterval"), ("CISCO-IPSEC-MIB", "cipsNumIsakmpPolicies")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBConfIsakmpGroup = cipsMIBConfIsakmpGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBConfIsakmpGroup.setDescription('A collection of objects providing Global ISAKMP policy monitoring capability to a Cisco IPsec capable VPN router.') cipsMIBConfIPSecGlobalsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 2)).setObjects(("CISCO-IPSEC-MIB", "cipsSALifetime"), ("CISCO-IPSEC-MIB", "cipsSALifesize")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBConfIPSecGlobalsGroup = cipsMIBConfIPSecGlobalsGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBConfIPSecGlobalsGroup.setDescription('A collection of objects providing Global IPSec policy monitoring capability to a Cisco IPsec capable VPN router.') cipsMIBConfCapacityGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 3)).setObjects(("CISCO-IPSEC-MIB", "cipsMaxSAs"), ("CISCO-IPSEC-MIB", "cips3DesCapable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBConfCapacityGroup = cipsMIBConfCapacityGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBConfCapacityGroup.setDescription('A collection of objects providing IPsec System Capacity monitoring capability to a Cisco IPsec capable VPN router.') cipsMIBStaticCryptomapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 4)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetSize"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumIsakmp"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumCET"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumSAs")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBStaticCryptomapGroup = cipsMIBStaticCryptomapGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBStaticCryptomapGroup.setDescription('A collection of objects instrumenting the properties of the Static (fully specified) Cryptomap Sets on an IPsec-capable IOS router.') cipsMIBManualCryptomapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 5)).setObjects(("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumManual")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBManualCryptomapGroup = cipsMIBManualCryptomapGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBManualCryptomapGroup.setDescription('A collection of objects instrumenting the properties of the Manual Cryptomap entries on a Cisco IPsec capable IOS router.') cipsMIBDynamicCryptomapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 6)).setObjects(("CISCO-IPSEC-MIB", "cipsNumTEDProbesReceived"), ("CISCO-IPSEC-MIB", "cipsNumTEDProbesSent"), ("CISCO-IPSEC-MIB", "cipsNumTEDFailures"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumDynamic"), ("CISCO-IPSEC-MIB", "cipsStaticCryptomapSetNumDisc"), ("CISCO-IPSEC-MIB", "cipsNumTEDCryptomapSets"), ("CISCO-IPSEC-MIB", "cipsDynamicCryptomapSetSize"), ("CISCO-IPSEC-MIB", "cipsDynamicCryptomapSetNumAssoc")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBDynamicCryptomapGroup = cipsMIBDynamicCryptomapGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBDynamicCryptomapGroup.setDescription('A collection of objects instrumenting the properties of the Dynamic Cryptomap group on a Cisco IPsec capable IOS router.') cipsMIBMandatoryNotifCntlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 62, 3, 2, 7)).setObjects(("CISCO-IPSEC-MIB", "cipsCntlIsakmpPolicyAdded"), ("CISCO-IPSEC-MIB", "cipsCntlIsakmpPolicyDeleted"), ("CISCO-IPSEC-MIB", "cipsCntlCryptomapAdded"), ("CISCO-IPSEC-MIB", "cipsCntlCryptomapDeleted"), ("CISCO-IPSEC-MIB", "cipsCntlCryptomapSetAttached"), ("CISCO-IPSEC-MIB", "cipsCntlCryptomapSetDetached"), ("CISCO-IPSEC-MIB", "cipsCntlTooManySAs")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cipsMIBMandatoryNotifCntlGroup = cipsMIBMandatoryNotifCntlGroup.setStatus('current') if mibBuilder.loadTexts: cipsMIBMandatoryNotifCntlGroup.setDescription('A collection of objects providing IPsec Notification capability to a IPsec-capable IOS router. It is mandatory to implement this set of objects pertaining to IOS notifications about IPSec activity.') mibBuilder.exportSymbols("CISCO-IPSEC-MIB", cipsIPsecGlobals=cipsIPsecGlobals, cipsCryptomapSetIfVirtual=cipsCryptomapSetIfVirtual, cipsStaticCryptomapSetNumManual=cipsStaticCryptomapSetNumManual, cipsStaticCryptomapDescr=cipsStaticCryptomapDescr, cipsIsakmpGroup=cipsIsakmpGroup, cipsDynamicCryptomapSetSize=cipsDynamicCryptomapSetSize, cipsCryptomapAdded=cipsCryptomapAdded, cipsTrapCntlGroup=cipsTrapCntlGroup, cipsCryptomapSetIfEntry=cipsCryptomapSetIfEntry, cipsMIBConfIPSecGlobalsGroup=cipsMIBConfIPSecGlobalsGroup, cipsStaticCryptomapSetNumIsakmp=cipsStaticCryptomapSetNumIsakmp, cipsMIBMandatoryNotifCntlGroup=cipsMIBMandatoryNotifCntlGroup, cipsNumTEDFailures=cipsNumTEDFailures, ciscoIPsecMIB=ciscoIPsecMIB, cipsStaticCryptomapPfs=cipsStaticCryptomapPfs, cipsStaticCryptomapSetSize=cipsStaticCryptomapSetSize, CryptomapSetBindStatus=CryptomapSetBindStatus, ciscoIPsecMIBNotificationPrefix=ciscoIPsecMIBNotificationPrefix, cipsNumCETCryptomapSets=cipsNumCETCryptomapSets, cipsNumStaticCryptomapSets=cipsNumStaticCryptomapSets, cipsIsakmpPolPriority=cipsIsakmpPolPriority, IkeHashAlgo=IkeHashAlgo, cipsCryptomapSetAttached=cipsCryptomapSetAttached, cipsMIBDynamicCryptomapGroup=cipsMIBDynamicCryptomapGroup, cips3DesCapable=cips3DesCapable, cipsIsakmpPolicyTable=cipsIsakmpPolicyTable, cipsStaticCryptomapPeer=cipsStaticCryptomapPeer, cipsSysCapacityGroup=cipsSysCapacityGroup, cipsStaticCryptomapLevelHost=cipsStaticCryptomapLevelHost, cipsIsakmpKeepaliveInterval=cipsIsakmpKeepaliveInterval, cipsMIBCompliance=cipsMIBCompliance, cipsNumDynamicCryptomapSets=cipsNumDynamicCryptomapSets, cipsIsakmpPolicyEntry=cipsIsakmpPolicyEntry, cipsStaticCryptomapType=cipsStaticCryptomapType, cipsDynamicCryptomapSetEntry=cipsDynamicCryptomapSetEntry, cipsIsakmpPolEncr=cipsIsakmpPolEncr, ciscoIPsecMIBObjects=ciscoIPsecMIBObjects, cipsMIBStaticCryptomapGroup=cipsMIBStaticCryptomapGroup, cipsStaticCryptomapSetName=cipsStaticCryptomapSetName, cipsNumTEDProbesSent=cipsNumTEDProbesSent, cipsMIBConfCapacityGroup=cipsMIBConfCapacityGroup, cipsCntlTooManySAs=cipsCntlTooManySAs, cipsIsakmpPolAuth=cipsIsakmpPolAuth, IPSIpAddress=IPSIpAddress, ciscoIPsecMIBConformance=ciscoIPsecMIBConformance, cipsMaxSAs=cipsMaxSAs, cipsDynamicCryptomapSetNumAssoc=cipsDynamicCryptomapSetNumAssoc, cipsIsakmpPolHash=cipsIsakmpPolHash, cipsStaticCryptomapTable=cipsStaticCryptomapTable, CryptomapType=CryptomapType, cipsMIBConformances=cipsMIBConformances, cipsStaticCryptomapNumPeers=cipsStaticCryptomapNumPeers, cipsNumTEDProbesReceived=cipsNumTEDProbesReceived, cipsCryptomapDeleted=cipsCryptomapDeleted, cipsStaticCryptomapSetNumSAs=cipsStaticCryptomapSetNumSAs, cipsStaticCryptomapSetNumDynamic=cipsStaticCryptomapSetNumDynamic, cipsStaticCryptomapLifesize=cipsStaticCryptomapLifesize, cipsCntlCryptomapAdded=cipsCntlCryptomapAdded, cipsIsakmpPolicyAdded=cipsIsakmpPolicyAdded, IkeIdentityType=IkeIdentityType, cipsIsakmpIdentity=cipsIsakmpIdentity, cipsCryptomapSetIfTable=cipsCryptomapSetIfTable, cipsDynamicCryptomapSetTable=cipsDynamicCryptomapSetTable, PYSNMP_MODULE_ID=ciscoIPsecMIB, cipsMIBManualCryptomapGroup=cipsMIBManualCryptomapGroup, cipsMIBNotifications=cipsMIBNotifications, cipsIsakmpEnabled=cipsIsakmpEnabled, cipsTooManySAs=cipsTooManySAs, cipsStaticCryptomapSetEntry=cipsStaticCryptomapSetEntry, cipsCntlCryptomapSetAttached=cipsCntlCryptomapSetAttached, cipsMIBConfIsakmpGroup=cipsMIBConfIsakmpGroup, CIPsecLifesize=CIPsecLifesize, cipsDynamicCryptomapSetName=cipsDynamicCryptomapSetName, cipsCryptomapGroup=cipsCryptomapGroup, cipsCntlCryptomapDeleted=cipsCntlCryptomapDeleted, TrapStatus=TrapStatus, cipsNumIsakmpPolicies=cipsNumIsakmpPolicies, cipsIsakmpPolicyDeleted=cipsIsakmpPolicyDeleted, cipsStaticCryptomapLifetime=cipsStaticCryptomapLifetime, cipsCntlCryptomapSetDetached=cipsCntlCryptomapSetDetached, EncryptAlgo=EncryptAlgo, cipsIPsecStatistics=cipsIPsecStatistics, cipsCntlIsakmpPolicyAdded=cipsCntlIsakmpPolicyAdded, IkeAuthMethod=IkeAuthMethod, cipsSALifetime=cipsSALifetime, cipsStaticCryptomapSetNumCET=cipsStaticCryptomapSetNumCET, cipsStaticCryptomapSetTable=cipsStaticCryptomapSetTable, cipsCntlIsakmpPolicyDeleted=cipsCntlIsakmpPolicyDeleted, cipsIsakmpPolLifetime=cipsIsakmpPolLifetime, cipsStaticCryptomapEntry=cipsStaticCryptomapEntry, DiffHellmanGrp=DiffHellmanGrp, cipsCryptomapSetDetached=cipsCryptomapSetDetached, cipsStaticCryptomapSetNumDisc=cipsStaticCryptomapSetNumDisc, CIPsecNumCryptoMaps=CIPsecNumCryptoMaps, cipsNumTEDCryptomapSets=cipsNumTEDCryptomapSets, cipsSALifesize=cipsSALifesize, cipsCryptomapSetIfStatus=cipsCryptomapSetIfStatus, CIPsecLifetime=CIPsecLifetime, cipsStaticCryptomapPriority=cipsStaticCryptomapPriority, cipsIsakmpPolGroup=cipsIsakmpPolGroup, cipsIPsecGroup=cipsIPsecGroup, cipsMIBGroups=cipsMIBGroups)
sensorData = open('input.txt').read().splitlines() diff = [-1, 0, 1] key = None trenchMap = set() y = 0 for line in sensorData: if not key: key = line elif len(line) > 0: for x in range(len(line)): if line[x] == '#': trenchMap.add((x, y)) y += 1 neighboorhood = set() for point in trenchMap: x, y = point for dx in diff: for dy in diff: neighboorhood.add((x + dx, y + dy)) print(len(key)) def oneStep(trenchMap, neighboorhood, itr=0): itrKey = {'#': '1', '.': '0'} pointToSave = '#' if key[0] == '#' and key[-1] == '.': if itr > 0 and (itr % 2) == 0: itrKey = {'#': '0', '.': '1'} else: pointToSave = '.' newTrenchMap = set() newNeighboorhood = set() for point in neighboorhood: number = '' x, y = point for dy in diff: for dx in diff: if (x + dx, y + dy) in trenchMap: number += itrKey['#'] else: number += itrKey['.'] if key[int(number, 2)] == pointToSave: newTrenchMap.add(point) for dy in diff: for dx in diff: newNeighboorhood.add((x + dx, y + dy)) return newTrenchMap, newNeighboorhood def printMap(trenchMap): minY = len(trenchMap) minX = len(trenchMap) maxY = 0 maxX = 0 for point in trenchMap: x, y = point if y < minY: minY = y if y > maxY: maxY = y if x < minX: minX = x if x > maxX: maxX = x for y in range(minY, maxY + 1): for x in range(minX, maxX + 1): if (x, y) in trenchMap: print('#', end='') else: print('.', end='') print('') print('') for i in range(50): trenchMap, neighboorhood = oneStep(trenchMap, neighboorhood, itr=i + 1) if (i + 1) == 2: print("Answer part A: the number of lit points is {}".format(len(trenchMap))) print("Answer part B: the number of lit points is {}".format(len(trenchMap)))
class Config(object): CHROME_PATH = '/Library/Application Support/Google/chromedriver76.0.3809.68' BROWSERMOB_PATH = '/usr/local/bin/browsermob-proxy-2.1.4/bin/browsermob-proxy' class Docker(Config): CHROME_PATH = '/usr/local/bin/chromedriver'
l = float(input('Qual a largura da parede em metros: ')) a = float(input('Qual a altura da parede em metros: ')) ar = l * a t = ar * 0.5 print('Considerando que usamos 1 litro de tinta para pintar uma parede de 2 metros quadrados! \nPara pintar uma área de {} metros quadrados é necessário {} litros de tinta'.format(ar, t))
numbers = [1, 2, 3, 4, 5] for x in numbers: print(x) print("--------") for x in reversed(numbers): print(x) print(numbers)
a=int(input()) def s(n): if n==3:return['***','* *','***'] x=s(n//3) y=list(zip(x,x,x)) for i in range(len(y)): y[i]=''.join(y[i]) z=list(zip(x,[' '*(n//3)]*(n//3),x)) for i in range(len(z)): z[i]=''.join(z[i]) return y+z+y print('\n'.join(s(a)))
def dictTolist(data): result = [] if isinstance(data, dict) and data.__len__() > 0: result.append(data) elif isinstance(data, list) and data.__len__() > 0: result = data else: result = None return result
######################## # * First Solution ######################## class Solution: def searchInsert(self, nums: List[int], target: int) -> int: low = 0 high = len(nums)-1 while low < high: mid = (low+high) // 2 if nums[mid] == target: return mid elif nums[mid] > target: high = mid-1 elif nums[mid] < target: low = mid+1 for i in range(len(nums)): if nums[i] >= target: return i return len(nums) ######################## # * Second Solution ######################## class Solution: def searchInsert(self, nums: List[int], target: int) -> int: # ? Border Cases if target > nums[-1]: return len(nums) if target <= nums[0]: return 0 ############ # * Binary Search here low = 0 high = len(nums)-1 while low < high: mid = (low+high) // 2 if nums[mid] == target: return mid elif nums[mid] > target: high = mid-1 elif nums[mid] < target: low = mid+1 # * Simple Traversal here for i in range(len(nums)): if nums[i] >= target: return i
# Dictionary # length (len), check a key, get, set, add # Dictionary 1 ------------------------------------------- print(" Dictionary with string keys ".center(44, "-")) dict_employee_IDs = {"ID01": 'John Papa', "ID02": 'David Thompson', "ID03": 'Terry Gao', "ID04": 'Barry Tex'} print(dict_employee_IDs) # len ------------------------------------------- print(" dictionary length ".center(44, "-")) dict_employee_IDs_length = len(dict_employee_IDs) print(str(dict_employee_IDs_length)) # Check if a key is in dictionary ------------------------------------------- print(" Check if a key is in dictionary ".center(44, "-")) emp_id = "ID02" # emp_id = "ID05" # Invalid Key if emp_id in dict_employee_IDs: name = dict_employee_IDs[emp_id] print('Employee ID {} is {}.'.format(emp_id, name)) else: print('Employee ID {} not found!'.format(emp_id)) # Dictionary 2 ------------------------------------------- print(" Dictionary with string keys ".center(44, "-")) dict_employee1_Info = {"Name": 'John Papa', "Department": 'Network', "DataOfBirth": '02/24/1975', "Salary": '$60K US'} print(dict_employee1_Info) # get ------------------------------------------- print(" Getting data from dictionary ".center(44, "-")) name = dict_employee1_Info.get("Name") department = dict_employee1_Info.get("Department") dob = dict_employee1_Info.get("DataOfBirth") salary = dict_employee1_Info.get("Salary") print('{} works in {} department with a salary of {}. His data of birth is {}'.format(name, department, salary, dob)) print(dict_employee1_Info.get("City")) print(dict_employee1_Info.get("Branch", "Unknown")) # set ------------------------------------------- print(" Setting value for an item in dictionary ".center(60, "-")) dict_employee1_Info["Department"] = 'Development' dict_employee1_Info["Salary"] = '$70K US' print('{} works in {} department with a salary of {}. His data of birth is {}'.format(name, department, salary, dob)) department = dict_employee1_Info.get("Department") salary = dict_employee1_Info.get("Salary") print('{} works in {} department with a salary of {}. His data of birth is {}'.format(name, department, salary, dob)) print(dict_employee1_Info) # add ------------------------------------------- print(" Add to dictionary ".center(60, "-")) dict_employee1_Info["Branch"] = "Airport Branch" dict_employee1_Info["City"] = "Boston" print(dict_employee1_Info) print(dict_employee1_Info.get("City")) print(dict_employee1_Info.get("Branch", "Unknown"))
class Solution: def isUgly(self, num): """ :type num: int :rtype: bool """ while not num: return False while not (num % 2): num //= 2 while not (num % 3): num //= 3 while not (num % 5): num //= 5 return num == 1
# Processing functions for various USMTF message formats def tacelint(logger_item, message_dict, lines_list, processed_message_list): prev_soi = [] prev_line = [] for line in lines_list: if len(prev_line) == 0: prev_line.append(line) else: del prev_line[0] prev_line.append(line) line_split = line.split("/") if line_split[0] == 'SOI': if len(prev_soi) == 0: prev_soi.append(line) else: del prev_soi[0] prev_soi.append(line) message_dict['tar-sig-id'] = line_split[1] message_dict['time-up'] = line_split[2] message_dict['time-down'] = line_split[3] message_dict['sort-code'] = line_split[4] message_dict['emitter-desig'] = line_split[5] try: message_dict['event-loc'] = line_split[6] except: pass try: message_dict['tgt-id'] = line_split[7] except: pass try: message_dict['enemy-uid'] = line_split[8] except: pass try: message_dict['wpn-type'] = line_split[9] except: pass try: message_dict['emitter-func-code'] = line_split[10] except: pass continue if line_split[0] == 'EMLOC': message_dict['data-entry'] = line_split[1] message_dict['emitter-loc-cat'] = line_split[2] message_dict['loc'] = line_split[3].split(":")[1] message_dict['orientation'] = line_split[5][:-1] message_dict['semi-major'] = line_split[6][:-2] message_dict['semi-minor'] = line_split[7][:-2] message_dict['units'] = line_split[6][-2:] continue if line_split[0] == 'PRM': message_dict['data-entry'] = line_split[1] message_dict['freq'] = line_split[2][:-3] message_dict['freq-units'] = line_split[2][-3:] message_dict['rf-op-mode'] = line_split[3] message_dict['pri'] = line_split[4].split(":")[1] try: message_dict['pri-ac'] = line_split[5] except: pass try: message_dict['pd'] = line_split[6].split(":")[1] except: pass try: message_dict['scan-type'] = line_split[7] except: pass try: message_dict['scan-rate'] = line_split[8] except: pass try: message_dict['ant-pol'] = line_split[9] except: pass processed_message_list.append(message_dict) continue if line_split[0] == 'REF': message_dict['serial-letter'] = line_split[1] message_dict['ref-type'] = line_split[2] message_dict['originiator'] = line_split[3] message_dict['dt-ref'] = line_split[4] continue if line_split[0] == 'AMPN': message_dict['ampn'] = line_split[1] processed_message_list.append(message_dict) continue if line_split[0] == 'NARR': message_dict['narr'] = line_split[1] processed_message_list.append(message_dict) continue if line_split[0] == 'COLLINFO': try: message_dict['collector-di'] = line_split[1] except: pass try: message_dict['collector-tri'] = line_split[2] except: pass try: message_dict['coll-msn-num'] = line_split[3] except: pass try: message_dict['coll-proj-name'] = line_split[4] except: pass continue if line_split[0] == 'FORCODE': message_dict['forcode'] = line_split[1] processed_message_list.append(message_dict) continue if line_split[0] == 'PLATID': message_dict['scn'] = line_split[1] message_dict['pt-d'] = line_split[2] message_dict['pt'] = line_split[3] message_dict['plat-name'] = line_split[4] message_dict['ship-name'] = line_split[5] try: message_dict['pen-num'] = line_split[6] except: pass try: message_dict['nationality'] = line_split[7] except: pass try: message_dict['track-num'] = line_split[8] except: pass processed_message_list.append(message_dict) continue if line_split[0] == 'DECL': message_dict['source-class'] = line_split[1] message_dict['class-reason'] = line_split[2] message_dict['dg-inst'] = line_split[3] try: message_dict['dg-exempt-code'] = line_split[4] except: pass processed_message_list.append(message_dict) continue
class AnyOrderList: """Sequence that compares to a list, but allows any order. This is only intended for comparison purposes, not as an actual list replacement. """ def __init__(self, list_): self._list = list_ self._list.sort() def __eq__(self, other): assert isinstance(other, list) return self._list == sorted(other) def __str__(self): return str(self._list) def __repr__(self): return "AnyOrderList({})".format(repr(self._list))
def first(n_1): line_1 = set() for i in range(n_1): number = int(input()) line_1.add(number) return line_1 def second(n_2): line_2 = set() for i in range(n_2): number = int(input()) line_2.add(number) return line_2 data = input().split() n_1 = int(data[0]) n_2 =int(data[1]) first_line = first(n_1) second_line = second(n_2) common = first_line.intersection(second_line) for i in common: print(i)
""" List Data Type(list): - Just Like Array following indexing - **Unlike Arrays, list can hold HETEROGENEOUS DATA TYPE - Repetition allowed - Multi Dimensional """ # Creating a Multi-Dimensional List print(" \n-------CREATE---------- ") List = [['Hitesh', 'kumar', 'Sahu'], [29]] thislist = ["0", "1", "2", "3", "4", "5", "6", "7"] fruitList = list(("apple", "banana", "cherry")) print(List) print(" \n-------READ---------- ") print("List[1]: ", List[1]) print("List[0][0]: ", List[0][0]) print("List[0][-2]: ", List[0][-2]) # negative index start from -1 for x in thislist: print("Element", x) print(thislist) print("LENGTH", len(thislist)) print("MAX", max(thislist)) print("MIN", min(thislist)) print("thislist[:4]: ", thislist[:4]) print("thislist[2:]: ", thislist[2:]) print(" \n-------UPDATE---------- ") thislist[1] = "9" print(thislist) print("\nTraversing Elements") if "9" in thislist: print("Yes, '9' is in the list") thislist.reverse() print("Reverse", thislist) thislist.sort() print("Sorted", thislist) thislist.append("10") print("Append 10:", thislist) thislist.insert(7, "8") print("Insert 8:", thislist) thislist.insert(1, "1") print("Insert 1:", thislist) print(" \n-------DELETE---------- ") thislist.remove("10") print("remove 10:", thislist) thislist.pop(9) print("pop 9:", thislist) del thislist[8] print("del 8:", thislist) thislist.clear() print("clear:", thislist)
class UnityPackException(Exception): pass class ArchiveNotFound(UnityPackException): pass
""" [9/08/2014] Challenge #179 [Easy] You make me happy when clouds are gray...scale https://www.reddit.com/r/dailyprogrammer/comments/2ftcb8/9082014_challenge_179_easy_you_make_me_happy_when/ #Description The 'Daily Business' newspaper are a distributor of the most recent news concerning business. They have a problem though, there is a new newspaper brought out every single day and up to this point, all of the images and advertisements featured have been in full colour and this is costing the company. If you can convert these images before they reach the publisher, then you will surely get a promotion, or at least a raise! #Formal Inputs & Outputs ##Input description On console input you should enter a filepath to the image you wish to convert to grayscale. ##Output description The program should save an image in the current directory of the image passed as input, the only difference being that it is now in black and white. #Notes/Hints There are several methods to convert an image to grayscale, the easiest is to sum up all of the RGB values and divide it by 3 (The length of the array) and fill each R,G and B value with that number. For example RED = (255,0,0) Would turn to (85,85,85) //Because 255/3 == 85. There is a problem with this method though, GREEN = (0,255,0) brings back the exact same value! There is a formula to solve this, see if you can find it. Share any interesting methods for grayscale conversion that you come across. #Finally We have an IRC channel over at irc.freenode.net in #reddit-dailyprogrammer Stop on by :D Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas """ def main(): pass if __name__ == "__main__": main()
# # Arquivo com exemplos de loop # # Definindo um LOOP FOR def loopFor(): for x in range (5, 10): print (x) loopFor() # Usando um LOOP FOR em uma coleçao def loopArray (): dias = ["seg", "ter", "quar", "quin", "sex", "sab", "dom"] for d in dias: print (d) loopArray() # Usando BREAK e CONTINUE # Usando a função enumerate, para buscar valores e seus índices def loopEnum (): dias = ["seg", "ter", "quar", "quin", "sex", "sab", "dom"] for i, d in enumerate(dias): print (i, d) loopEnum()
""" import urllib import urllib.request try: site = urllib.request.urlopen('http://www.pudim.com.br') except urllib.error.URLError: print('O site Pudim não está acessível no momento!') else: print('Consegui acessar o site Pudim com sucesso!') """ inventory = ["shoes, 12, 29.99", "shirts, 20, 9.99", "sweatpants, 25, 15.00", "scarves, 13, 7.75"] store = list() sub = list() #print('{:<15}{:<8}{:>8}', format("Item", "Quant.", "Preço")) for i in inventory: sub = i.split(',') store.append(sub) #The store has 12 shoes, each for 29.99 USD.:<15}{:<8}{:>8} print('{}'.format("#The store has " + sub[1] + sub[0] + ', each for ' + sub[2] + 'U$D')) sub.clear()
# Interview Question #5 # The problem is that we want to find duplicates in a one-dimensional array of integers in O(N) running time # where the integer values are smaller than the length of the array! # For example: if we have a list [1, 2, 3, 1, 5] then the algorithm can detect that there are a duplicate with value 1. # Note: the array can not contain items smaller than 0 and items with values greater than the size of the list. # This is how we can achieve O(N) linear running time complexity! def duplicate_finder_1(nums): duplicates = [] for n in set(nums): if nums.count(n) > 1: duplicates.append(n) return duplicates if duplicates else 'The array does not contain any duplicates!' def duplicate_finder_2(nums): duplicates = set() for i, n in enumerate(sorted(nums)): if i + 1 < len(nums) and n == nums[i + 1]: duplicates.add(n) return list(duplicates) if duplicates else 'The array does not contain any duplicates!' # Course implementation def duplicate_finder_3(nums): duplicates = set() for n in nums: if nums[abs(n)] >= 0: nums[abs(n)] *= -1 else: duplicates.add(n) return list({-n if n < 0 else n for n in duplicates}) if duplicates \ else 'The array does not contain any duplicates!' # return list(map(lambda n: n * -1 if n < 0 else n, # duplicates)) if duplicates else 'The array does not contain any duplicates!' # My solutions allow the use of numbers greater than the length of the array print(duplicate_finder_1([1, 2, 3, 4])) print(duplicate_finder_1([1, 1, 2, 3, 3, 4])) print(duplicate_finder_2([5, 6, 7, 8])) print(duplicate_finder_2([5, 6, 6, 6, 7, 7, 9])) print(duplicate_finder_3([2, 3, 1, 2, 4, 3, 3])) print(duplicate_finder_3([0, 1, 2]))
''' sgqlc - Simple GraphQL Client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Access GraphQL endpoints using Python ===================================== This package provide the following modules: - :mod:`sgqlc.endpoint.base`: with abstract class :class:`sgqlc.endpoint.base.BaseEndpoint` and helpful logging utilities to transform errors into JSON objects. - :mod:`sgqlc.endpoint.http`: concrete :class:`sgqlc.endpoint.http.HTTPEndpoint` using :func:`urllib.request.urlopen()`. :license: ISC ''' __docformat__ = 'reStructuredText en'
START = { "type": "http.response.start", "status": 200, "headers": [ (b"content-length", b"13"), (b"content-type", b"text/html; charset=utf-8"), ], } BODY1 = {"type": "http.response.body", "body": b"Hello"} BODY2 = {"type": "http.response.body", "body": b", world!"} async def helloworld(scope, receive, send) -> None: await send(START) await send(BODY1) await send(BODY2) async def receiver(scope, receive, send) -> None: while True: try: await receive() except StopAsyncIteration: break await send(START) await send(BODY1) await send(BODY2) async def handle_404(scope, receive, send): await send( { "type": "http.response.start", "status": 404, "headers": [], } ) await send({"type": "http.response.body"}) routes = { "/": helloworld, "/receiver": receiver, } async def app(scope, receive, send): path = scope["path"] handler = routes.get(path, handle_404) await handler(scope, receive, send)
genres = { 28: "Ação", 12: "Aventura", 16: "Animação", 35: "Comédia", 80: "Crime", 99: "Documentário", 18: "Drama", 10751: "Família", 14: "Fantasia", 36: "História", 27: "Terror", 10402: "Música", 9648: "Mistério", 10749: "Romance", 878: "Ficção científica", 10770: "Cinema TV", 53: "Thriller", 10752: "Guerra", 37: "Faroeste" }
''' Write a program to get 3 integers from keyboard, then find out how many even and odd numbers there are. Finally, print ofor _ in range(3)nd “odd” followed by quantity of the even and odd number. ''' seq = (int(input()) for _ in range(3)) even = sum(1 for i in seq if i % 2 ==0) print(f'even {even}', f'odd {3-even}', sep='\n')
load("@fbcode_macros//build_defs:platform_utils.bzl", "platform_utils") def get_ppx_bin(): return "third-party-buck/{}/build/ocaml-lwt_ppx/lib/lwt_ppx/ppx.exe".format(platform_utils.get_platform_for_base_path(get_base_path()))
def append_attr(obj, attr, value): """ Appends value to object attribute Attribute may be undefined For example: append_attr(obj, 'test', 1) append_attr(obj, 'test', 2) assert obj.test == [1, 2] """ try: getattr(obj, attr).append(value) except AttributeError: setattr(obj, attr, [value])
"""DataSet base class """ class DataSet(object): """Base DataSet """ def __init__(self, common_params, dataset_params): """ common_params: A params dict dataset_params: A params dict """ raise NotImplementedError def batch(self): """Get batch """ raise NotImplementedError
# -*- coding: utf-8 -*- class Solution: def maxProduct(self, nums): best_max, current_max, current_min = float('-inf'), 1, 1 for num in nums: current_max, current_min = max(current_min * num, num, current_max * num),\ min(current_min * num, num, current_max * num) best_max = max(best_max, current_max) return best_max if __name__ == '__main__': solution = Solution() assert 6 == solution.maxProduct([2, 3, -2, 4]) assert 0 == solution.maxProduct([-2, 0, -1])