content stringlengths 7 1.05M |
|---|
#!/usr/bin/env python3
"""
.. automodule:: test_phile.test_PySide2
.. automodule:: test_phile.test_asyncio
.. automodule:: test_phile.test_builtins
.. automodule:: test_phile.test_cmd
.. automodule:: test_phile.test_configuration
.. automodule:: test_phile.test_data
.. automodule:: test_phile.test_datetime
.. automodule:: test_phile.test_imapclient
.. automodule:: test_phile.test_keyring
.. automodule:: test_phile.test_launcher
.. automodule:: test_phile.test_main
.. automodule:: test_phile.test_notify
.. automodule:: test_phile.test_os
.. automodule:: test_phile.test_tmux
.. automodule:: test_phile.test_tray
.. automodule:: test_phile.test_trigger
.. automodule:: test_phile.test_unittest
.. automodule:: test_phile.test_watchdog
.. automodule:: test_phile.threaded_mock
"""
|
def limpar(tela):
telaPrincipal = tela
lista = [telaPrincipal.telefone, telaPrincipal.nome,
telaPrincipal.cep,
telaPrincipal.end,
telaPrincipal.numero,
telaPrincipal.bairro,
telaPrincipal.ref,
telaPrincipal.complemento, telaPrincipal.devendo, telaPrincipal.taxa_2]
for i in lista:
i.clear()
telaPrincipal.label_cadastrado.hide()
telaPrincipal.label_atualizado.hide() |
#Embedded file name: ACEStream\version.pyo
VERSION = '2.0.8.7'
VERSION_REV = '2191'
VERSION_DATE = '2013/03/28 18:36:41'
|
credentials = {
'ldap': {
'user': '',
'pass': ''
},
'rocket': {
'user': '',
'pass': ''
}
} |
# https://edabit.com/challenge/KWoj7kWiHRqJtG6S2
# There is a single operator in Python
# capable of providing the remainder of a division operation.
# Two numbers are passed as parameters.
# The first parameter divided by the second parameter will have a remainder, possibly zero.
# Return that value.
def remainder(int1: int, int2: int) -> int:
leftovers = int1 % int2
return leftovers
print(remainder(5, 5))
|
ano=int(input('que ano quer analisar'))
if ano%4==0 and ano % 100 !=0 or ano %400==0:
print('o ano é bissexto'.format (ano))
else:
print('o ano nao é bissesto')
|
#! /usr/bin/python
##
# @file
# This file is part of SeisSol.
#
# @author Sebastian Rettenberger (sebastian.rettenberger AT tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger)
#
# @section LICENSE
# Copyright (c) 2016, SeisSol Group
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# @section DESCRIPTION
# Finds ASAGI and add inlcude pathes, libs and library pathes
#
asagi_prog_src = """
#include <asagi.h>
int main() {
asagi::Grid* grid = asagi::Grid::create();
return 0;
}
"""
def CheckPKG(context, lib):
context.Message('Checking for ASAGI... ')
ret = context.TryAction('pkg-config --exists \'%s\'' % lib)[0]
context.Result(ret)
return ret
def CheckASAGILinking(context, message):
context.Message(message+'... ')
ret = context.TryLink(asagi_prog_src, '.cpp')
context.Result(ret)
return ret
def generate(env, **kw):
conf = env.Configure(custom_tests = {'CheckPKG': CheckPKG,
'CheckASAGILinking': CheckASAGILinking})
if 'required' in kw:
required = kw['required']
else:
required = False
if 'parallel' in kw:
parallel = kw['parallel']
else:
# Use parallel as default, since ASAGI makes not too much
# sense in serial code
parallel = True
if not parallel:
env.Append(CPPDEFINES=['ASAGI_NOMPI'])
lib = 'asagi' if parallel else 'asagi_nompi'
ret = conf.CheckPKG(lib)
if not ret:
if required:
print('Could not find ASAGI!')
env.Exit(1)
else:
conf.Finish()
return
# Try shared first
conf.env.ParseConfig('pkg-config --cflags --libs '+lib)
ret = conf.CheckASAGILinking('Checking for shared ASAGI library')
if not ret:
conf.env.ParseConfig('pkg-config --cflags --libs --static '+lib)
ret = conf.CheckASAGILinking('Checking for static ASAGI library')
if not ret:
if required:
print('Could not find ASAGI!')
env.Exit(1)
else:
conf.Finish()
return
conf.Finish()
def exists(env):
return True
|
# -----------------------------------------------------.
# ポリゴンメッシュの不要な頂点/稜線を削除.
# 選択されたポリゴンメッシュの面を構成しない頂点や稜線を削除.
#
# @title \en Remove unnecessary vertices/edges of polygon mesh \enden
# @title \ja ポリゴンメッシュの不要な頂点/稜線を削除 \endja
# -----------------------------------------------------.
scene = xshade.scene()
# ポリゴンメッシュの面を構成しない頂点や稜線を削除.
def CleanupPolygonmesh (shape):
# 面で参照される頂点を取得.
versCou = shape.total_number_of_control_points
facesCou = shape.number_of_faces
vUsedList = [0] * versCou
for fLoop in range(facesCou):
f = shape.face(fLoop)
vCou = f.number_of_vertices
for i in range(vCou):
vUsedList[ f.vertex_indices[i] ] = 1
# 参照されない頂点を削除.
shape.begin_removing_control_points()
for i in range(versCou):
if vUsedList[i] == 0:
shape.remove_control_point(i)
shape.end_removing_control_points()
for shape in scene.active_shapes:
if shape.type == 7: # ポリゴンメッシュの場合.
CleanupPolygonmesh(shape)
|
# Script Name : data.py
# Author : Howard Zhang
# Created : 14th June 2018
# Last Modified : 14th June 2018
# Version : 1.0
# Modifications :
# Description : The struct of data to sort and display.
class Data:
# Total of data to sort
data_count = 32
def __init__(self, value):
self.value = value
self.set_color()
def set_color(self, rgba = None):
if not rgba:
rgba = (0,
1 - self.value / (self.data_count * 2),
self.value / (self.data_count * 2) + 0.5,
1)
self.color = rgba
|
class Plugin:
def __init__(self):
pass
def execute(self):
print("HELLO WORLD 2. :D")
|
class NotAuthenticatedError(Exception):
pass
class AuthenticationFailedError(Exception):
pass
|
OPERATION_TYPES = [
'ADD',
'REMOVE',
'CHANGE_DATA',
'PATCH_METADATA'
]
USER_CHANGEABLE_RELEASE_STATUSES = {
'MUTABLE': [
'DRAFT',
'PENDING_RELEASE',
'PENDING_DELETE'
],
'IMMUTABLE': [
'RELEASED',
'DELETED'
]
}
RELEASE_STATUS_ALLOWED_TRANSITIONS = {
'DRAFT': ['PENDING_RELEASE'],
'PENDING_RELEASE': ['DRAFT'],
'PENDING_DELETE': [],
'RELEASED': ['DRAFT', 'PENDING_DELETE'],
'DELETED': []
}
|
total_taxis = 100
size = 4
expected_customers = 120
size_without_driver = size - 1
number_of_cars_required = expected_customers/size_without_driver
print(f"number of cars required {number_of_cars_required}")
|
lst = ["Peace", "of", "the", "mind", 2, 4, 7]
for i in lst:
place = "".join(map(str, lst))
print(place)
|
class DebuggerStepperBoundaryAttribute(Attribute,_Attribute):
"""
Indicates the code following the attribute is to be executed in run,not step,mode.
DebuggerStepperBoundaryAttribute()
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __reduce_ex__(self,*args):
pass
|
choice = ''
def add(num1, num2):
return num1 + num2
def subs(num1, num2):
return num1 - num2
def mult(num1, num2):
return num1 * num2
def div(num1, num2):
return num1 / num2
def mod(num1, num2):
return num1 % num2
def power(num1, num2):
result = 1
for i in range(num2):
result *= num1
return result
def input_checker(item):
try:
checked = int(item)
return True
except:
print("\nSorry your input is invalid")
return False
def get_user_inputs():
while True:
num1 = input("Input first number: ")
num2 = input("Input second number: ")
if input_checker(num1) & input_checker(num2):
num1 = int(num1)
num2 = int(num2)
break
return num1, num2
def main():
while True:
print("Please select operations you want: \n 1. Adding\n 2. Substracting\n 3. Multiplying\n 4. Dividing\n 5. Modulo\n 6. Powering")
choice = input("\nYour choice (1,2,3,4,5,6): ")
if input_checker(choice):
choice = int(choice)
num1, num2 = get_user_inputs()
if choice==1:
print(num1, "+", num2, " = ", add(num1,num2))
elif choice==2:
print(num1, "-", num2, " = ", subs(num1,num2))
elif choice==3:
print(num1, "*", num2, " = ", mult(num1,num2))
elif choice==4:
print(num1, "/", num2, " = ", div(num1,num2))
elif choice==5:
print(num1, "%", num2, " = ", mod(num1,num2))
elif choice==6:
print(num1, "^", num2, " = ", power(num1,num2))
else:
print("Choose between 1 - 6!")
print('\n')
if __name__ == "__main__":
main() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND/intropylab-classifying-images/print_functions_for_lab_checks.py
#
# PROGRAMMER: Jennifer S.
# DATE CREATED: 05/14/2018
# REVISED DATE: <=(Date Revised - if any)
# PURPOSE: This set of functions can be used to check your code after programming
# each function. The top section of each part of the lab contains
# the section labeled 'Checking your code'. When directed within this
# section of the lab one can use these functions to more easily check
# your code. See the docstrings below each function for details on how
# to use the function within your code.
#
##
# Functions below defined to help with "Checking your code", specifically
# running these functions with the appropriate input arguments within the
# main() funtion will print out what's needed for "Checking your code"
#
def check_command_line_arguments(in_arg):
"""
For Lab: Classifying Images - 7. Command Line Arguments
Prints each of the command line arguments passed in as parameter in_arg,
assumes you defined all three command line arguments as outlined in
'7. Command Line Arguments'
Parameters:
in_arg -data structure that stores the command line arguments object
Returns:
Nothing - just prints to console
"""
if in_arg is None:
print("* Doesn't Check the Command Line Arguments because 'get_input_args' hasn't been defined.")
else:
# prints command line agrs
print("Command Line Arguments:\n dir =", in_arg.dir,
"\n arch =", in_arg.arch, "\n dogfile =", in_arg.dogfile)
def check_creating_pet_image_labels(results_dic):
""" For Lab: Classifying Images - 9/10. Creating Pet Image Labels
Prints first 10 key-value pairs and makes sure there are 40 key-value
pairs in your results_dic dictionary. Assumes you defined the results_dic
dictionary as was outlined in
'9/10. Creating Pet Image Labels'
Parameters:
results_dic - Dictionary with key as image filename and value as a List
(index)idx 0 = pet image label (string)
Returns:
Nothing - just prints to console
"""
if results_dic is None:
print("* Doesn't Check the Results Dictionary because 'get_pet_labels' hasn't been defined.")
else:
# Code to print 10 key-value pairs (or fewer if less than 10 images)
# & makes sure there are 40 pairs, one for each file in pet_images/
stop_point = len(results_dic)
if stop_point > 10:
stop_point = 10
print("\nPet Image Label Dictionary has", len(results_dic),
"key-value pairs.\nBelow are", stop_point, "of them:")
# counter - to count how many labels have been printed
n = 0
# for loop to iterate through the dictionary
for key in results_dic:
# prints only first 10 labels
if n < stop_point:
print("{:2d} key: {:>30} label: {:>26}".format(n+1, key,
results_dic[key][0]) )
# Increments counter
n += 1
# If past first 10 (or fewer) labels the breaks out of loop
else:
break
def check_classifying_images(results_dic):
""" For Lab: Classifying Images - 11/12. Classifying Images
Prints Pet Image Label and Classifier Label for ALL Matches followed by ALL
NOT matches. Next prints out the total number of images followed by how
many were matches and how many were not-matches to check all 40 images are
processed. Assumes you defined the results_dic dictionary as was
outlined in '11/12. Classifying Images'
Parameters:
results_dic - Dictionary with key as image filename and value as a List
(index)idx 0 = pet image label (string)
idx 1 = classifier label (string)
idx 2 = 1/0 (int) where 1 = match between pet image and
classifer labels and 0 = no match between labels
Returns:
Nothing - just prints to console
"""
if results_dic is None:
print("* Doesn't Check the Results Dictionary because 'classify_images' hasn't been defined.")
elif len(results_dic[next(iter(results_dic))]) < 2:
print("* Doesn't Check the Results Dictionary because 'classify_images' hasn't been defined.")
else:
# Code for checking classify_images -
# Checks matches and not matches are classified correctly
# Checks that all 40 images are classified as a Match or Not-a Match
# Sets counters for matches & NOT-matches
n_match = 0
n_notmatch = 0
# Prints all Matches first
print("\n MATCH:")
for key in results_dic:
# Prints only if a Match Index 2 == 1
if results_dic[key][2] == 1:
# Increments Match counter
n_match += 1
print("\n{:>30}: \nReal: {:>26} Classifier: {:>30}".format(key,
results_dic[key][0], results_dic[key][1]))
# Prints all NOT-Matches next
print("\n NOT A MATCH:")
for key in results_dic:
# Prints only if NOT-a-Match Index 2 == 0
if results_dic[key][2] == 0:
# Increments Not-a-Match counter
n_notmatch += 1
print("\n{:>30}: \nReal: {:>26} Classifier: {:>30}".format(key,
results_dic[key][0], results_dic[key][1]))
# Prints Total Number of Images - expects 40 from pet_images folder
print("\n# Total Images",n_match + n_notmatch, "# Matches:",n_match ,
"# NOT Matches:",n_notmatch)
def check_classifying_labels_as_dogs(results_dic):
""" For Lab: Classifying Images - 13. Classifying Labels as Dogs
Prints Pet Image Label, Classifier Label, whether Pet Label is-a-dog(1=Yes,
0=No), and whether Classifier Label is-a-dog(1=Yes, 0=No) for ALL Matches
followed by ALL NOT matches. Next prints out the total number of images
followed by how many were matches and how many were not-matches to check
all 40 images are processed. Assumes you defined the results_dic dictionary
as was outlined in '13. Classifying Labels as Dogs'
Parameters:
results_dic - Dictionary with key as image filename and value as a List
(index)idx 0 = pet image label (string)
idx 1 = classifier label (string)
idx 2 = 1/0 (int) where 1 = match between pet image and
classifer labels and 0 = no match between labels
idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and
0 = pet Image 'is-NOT-a' dog.
idx 4 = 1/0 (int) where 1 = Classifier classifies image
'as-a' dog and 0 = Classifier classifies image
'as-NOT-a' dog.
Returns:
Nothing - just prints to console
"""
if results_dic is None:
print("* Doesn't Check the Results Dictionary because 'adjust_results4_isadog' hasn't been defined.")
elif len(results_dic[next(iter(results_dic))]) < 4 :
print("* Doesn't Check the Results Dictionary because 'adjust_results4_isadog' hasn't been defined.")
else:
# Code for checking adjust_results4_isadog -
# Checks matches and not matches are classified correctly as "dogs" and
# "not-dogs" Checks that all 40 images are classified as a Match or Not-a
# Match
# Sets counters for matches & NOT-matches
n_match = 0
n_notmatch = 0
# Prints all Matches first
print("\n MATCH:")
for key in results_dic:
# Prints only if a Match Index 2 == 1
if results_dic[key][2] == 1:
# Increments Match counter
n_match += 1
print("\n{:>30}: \nReal: {:>26} Classifier: {:>30} \nPetLabelDog: {:1d} ClassLabelDog: {:1d}".format(key,
results_dic[key][0], results_dic[key][1], results_dic[key][3],
results_dic[key][4]))
# Prints all NOT-Matches next
print("\n NOT A MATCH:")
for key in results_dic:
# Prints only if NOT-a-Match Index 2 == 0
if results_dic[key][2] == 0:
# Increments Not-a-Match counter
n_notmatch += 1
print("\n{:>30}: \nReal: {:>26} Classifier: {:>30} \nPetLabelDog: {:1d} ClassLabelDog: {:1d}".format(key,
results_dic[key][0], results_dic[key][1], results_dic[key][3],
results_dic[key][4]))
# Prints Total Number of Images - expects 40 from pet_images folder
print("\n# Total Images",n_match + n_notmatch, "# Matches:",n_match ,
"# NOT Matches:",n_notmatch)
def check_calculating_results(results_dic, results_stats_dic):
""" For Lab: Classifying Images - 14. Calculating Results
Prints First statistics from the results stats dictionary (that was created
by the calculates_results_stats() function), then prints the same statistics
that were calculated in this function using the results dictionary.
Assumes you defined the results_stats dictionary and the statistics
as was outlined in '14. Calculating Results '
Parameters:
results_dic - Dictionary with key as image filename and value as a List
(index)idx 0 = pet image label (string)
idx 1 = classifier label (string)
idx 2 = 1/0 (int) where 1 = match between pet image and
classifer labels and 0 = no match between labels
idx 3 = 1/0 (int) where 1 = pet image 'is-a' dog and
0 = pet Image 'is-NOT-a' dog.
idx 4 = 1/0 (int) where 1 = Classifier classifies image
'as-a' dog and 0 = Classifier classifies image
'as-NOT-a' dog.
results_stats_dic - Dictionary that contains the results statistics (either
a percentage or a count) where the key is the statistic's
name (starting with 'pct' for percentage or 'n' for count)
and the value is the statistic's value
Returns:
Nothing - just prints to console
"""
if results_stats_dic is None:
print("* Doesn't Check the Results Dictionary because 'calculates_results_stats' hasn't been defined.")
else:
# Code for checking results_stats_dic -
# Checks calculations of counts & percentages BY using results_dic
# to re-calculate the values and then compare to the values
# in results_stats_dic
# Initialize counters to zero and number of images total
n_images = len(results_dic)
n_pet_dog = 0
n_class_cdog = 0
n_class_cnotd = 0
n_match_breed = 0
# Interates through results_dic dictionary to recompute the statistics
# outside of the calculates_results_stats() function
for key in results_dic:
# match (if dog then breed match)
if results_dic[key][2] == 1:
# isa dog (pet label) & breed match
if results_dic[key][3] == 1:
n_pet_dog += 1
# isa dog (classifier label) & breed match
if results_dic[key][4] == 1:
n_class_cdog += 1
n_match_breed += 1
# NOT dog (pet_label)
else:
# NOT dog (classifier label)
if results_dic[key][4] == 0:
n_class_cnotd += 1
# NOT - match (not a breed match if a dog)
else:
# NOT - match
# isa dog (pet label)
if results_dic[key][3] == 1:
n_pet_dog += 1
# isa dog (classifier label)
if results_dic[key][4] == 1:
n_class_cdog += 1
# NOT dog (pet_label)
else:
# NOT dog (classifier label)
if results_dic[key][4] == 0:
n_class_cnotd += 1
# calculates statistics based upon counters from above
n_pet_notd = n_images - n_pet_dog
if n_pet_dog != 0:
pct_corr_dog = ( n_class_cdog / n_pet_dog )*100
else:
pct_corr_dog = 0
if n_pet_notd != 0:
pct_corr_notdog = ( n_class_cnotd / n_pet_notd )*100
else:
pct_corr_notdog = 0
if n_pet_dog != 0:
pct_corr_breed = ( n_match_breed / n_pet_dog )*100
else:
pct_corr_breed = 0
# prints calculated statistics
print("\n ** Statistics from calculates_results_stats() function:")
print("N Images: {:2d} N Dog Images: {:2d} N NotDog Images: {:2d} \nPct Corr dog: {:5.1f} Pct Corr NOTdog: {:5.1f} Pct Corr Breed: {:5.1f}".format(
results_stats_dic['n_images'], results_stats_dic['n_dogs_img'],
results_stats_dic['n_notdogs_img'], results_stats_dic['pct_correct_dogs'],
results_stats_dic['pct_correct_notdogs'],
results_stats_dic['pct_correct_breed']))
print("\n ** Check Statistics - calculated from this function as a check:")
print("N Images: {:2d} N Dog Images: {:2d} N NotDog Images: {:2d} \nPct Corr dog: {:5.1f} Pct Corr NOTdog: {:5.1f} Pct Corr Breed: {:5.1f}".format(
n_images, n_pet_dog, n_pet_notd, pct_corr_dog, pct_corr_notdog,
pct_corr_breed))
|
#!/usr/bin/env python
'''\
Given two strings, remove all characters contained in the latter from
the former. Note that order is preserved. For example:
"ab", "b" -> "a"
"abcdabcd", "acec" -> "bdbd"
What is the run-time of your algorithm? How much memory does it use? Is it
optimal?
linear search with memcpy: O(nh**2)
linear search without memcpy: O(nh)
sort then binary search: O(n log n + h log n)
table lookup: O(n + h)
'''
def remove_needles(haystack, needles):
needles_set = frozenset(needles)
return ''.join(c for c in haystack if c not in needles_set)
def remove_needles_test(haystack, needles, expected):
actual = remove_needles(haystack, needles)
assert actual == expected
def main():
remove_needles_test('', '', '');
remove_needles_test('a', '', 'a');
remove_needles_test('', 'a', '');
remove_needles_test('ab', 'b', 'a');
remove_needles_test('bab', 'b', 'a');
remove_needles_test('bab', 'a', 'bb');
remove_needles_test('abcdabcd', 'acec', 'bdbd');
if __name__ == '__main__':
main()
|
ACACA_AcCoA = 34
ACACA_HCO3 = 2100
ACAT2_AcCoA = 29
ACLY_Citrate = 78
ACLY_CoA = 14
ACO2_Citrate = 480
ACO2_Isocitrate = 120
ACOT12_AcCoA = 47
ACOT13_AcCoA = 47
ACSS1_Acetate = 73
ACSS1_CoA = 11
ACSS2_Acetate = 73
ACSS2_CoA = 11
CS_AcCoA = 5
CS_OXa = 5.9
EP300_AcCoA = 0.28
FASN_AcCoA = 7
FASN_HCO3 = 2100
FASN_NADPH = 5
FH_Fumarate = 13
HMGCS1_AcCoA = 14
IDH2_Isocitrate = 2400
IDH2_NAD = 80
KAT2A_AcCoA = 6.7
KAT2B_AcCoA = 1.1
MDH2_Malate = 560
MDH2_NAD = 140
OGDH_AlphaKG = 4000
OGDH_NAD = 80
PC_Pyruvate = 220
PC_HCO3 = 3200
PDHA1_Pyruvate = 64.8
PDHA1_NAD = 33
PDHA1_CoA = 4
SDHA_Succinate = 20
SDHA_Fumarate = 25
SLC13A5_Citrate = 600 # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2913483/
SUCLG2_SucCoA = 86
"""Not used Km values
HDAC1_Ac-protein = 25,
HDAC2_Ac-rotein = 32,
HDAC3_Ac-protein = 35,
"""
|
# Set the following variables and rename to credentials.py
USER = RPC_USERNAME
PASSWORD = RPC_PASSWORD
SITE_SECRET_KEY = BYTE_STRING
|
# 카카오 압축
# 투 포인터 알고리즘 사용
"""
1. 길이가 1인 모든 단어를 포함하도록 딕셔너리 초기화
2. 만약 어떤 글자가 사전에 존재한다면, 오른쪽 범위를 1 증가시켜 탐색
3. 범위를 증가시켰을 때 존재하지 않는다면, 단어를 사전에 등록 후 right를 -1 감소시킨 값을 출력함
"""
def solution(msg):
hs = set()
words = {}
ans = []
left, right = 0, 1
# 딕셔너리 및 해시 초기화
idx = 27
for i in range(26):
words[chr(i + ord("A"))] = i + 1
hs.add(chr(i + ord("A")))
while True:
while right <= len(msg) and msg[left:right] in hs:
right += 1
if right <= len(msg) and msg[left:right] not in hs:
hs.add(msg[left:right])
words[msg[left:right]] = idx
idx += 1
right -= 1
ans.append(words[msg[left:right]])
left = right
right = left + 1
elif right > len(msg):
right -= 1
ans.append(words[msg[left:right]])
break
return ans
print(solution("ABABABABABABABAB")) |
def GetXSection(fileName): #[pb]
#Cross Section derived from sample name using https://cms-gen-dev.cern.ch/xsdb/
#TODO UL QCD files have PSWeights in their name, but xsdb does not include it in its name
fileName = fileName.replace("PSWeights_", "")
#TODO: UL Single Top xSection only defined for filename without inclusive decays specified
fileName = fileName.replace("5f_InclusiveDecays_", "5f_")
#TODO: UL tZq_ll_4f_ckm_NLO_TuneCP5_13TeV-amcatnlo-pythia8 only defined with PSWeights...
fileName = fileName.replace("tZq_ll_4f_ckm_NLO_TuneCP5_13TeV-amcatnlo-pythia8", "tZq_ll_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8")
if fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 70.89
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 68.45
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 69.66
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 116.1
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 112.5
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 118.0
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8_correctnPartonsInBorn") !=-1 : return 3.74
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8") !=-1 : return 114.4
elif fileName.find("ST_t-channel_antitop_4f_hdampdown_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_tW_antitop_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.99
elif fileName.find("ST_t-channel_antitop_4f_hdampdown_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_antitop_4f_hdampup_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_tW_antitop_5f_hdampup_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.96
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-100to200_M-50_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 2.678
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-200toInf_M-50_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 0.3909
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 82.52
elif fileName.find("ST_t-channel_antitop_4f_hdampup_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_hdampdown_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_top_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.92
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 225.5
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_4f_hdampup_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_top_4f_hdampdown_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_erdON_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_tW_top_5f_hdampup_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.9
elif fileName.find("DYJetsToTauTau_ForcedMuEleDecay_M-50_TuneCP5_PSweights_13TeV-amcatnloFXFX-pythia8") !=-1 : return 6505.0
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("DYJetsToTauTau_ForcedMuEleDecay_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_ext1") !=-1 : return 1991.0
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.44
elif fileName.find("ST_t-channel_top_4f_hdampup_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_top_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 138.1
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.4
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.52
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5down_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_DS_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.25
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR2_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_5f_TuneCP5_PSweights_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 547.2
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_PSweights_correctnPartonsInBorn_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_erdON_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5CR1_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-200toInf_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.5082
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_erdON_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("TTWJetsToLNu_TuneCP5CR2_GluonMove_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2183
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1715_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.824
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1755_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.506
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1695_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.991
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-100to200_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3.41
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_antitop_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8") !=-1 : return 67.91
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5up_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_s-channel_4f_leptonDecays_mtop1735_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.653
elif fileName.find("TTWJetsToLNu_TuneCP5CR1_QCDbased_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2169
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_tW_antitop_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.98
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_antitop_4f_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 69.09
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1715_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1695_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 36.58
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR2_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR1_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1735_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("DYJetsToLL_Zpt-200toInf_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_TuneDown") !=-1 : return 6.714
elif fileName.find("DYJetsToTauTau_ForcedMuEleDecay_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 1981.0
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1735_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.38
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1695_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_DS_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.75
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_mtop1755_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1715_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.46
elif fileName.find("DYJetsToLL_M-105To160_VBFFilter_TuneCP5_PSweights_13TeV-amcatnloFXFX-pythia8") !=-1 : return 2.01
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5down_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_top_5f_inclusiveDecays_mtop1755_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.34
elif fileName.find("DYJetsToLL_M-105To160_VBFFilter_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 1.526
elif fileName.find("DYBJetsToLL_M-50_Zpt-200toInf_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 0.3282
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR2_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_t-channel_eleDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.81
elif fileName.find("ST_tW_antitop_5f_hdampup_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.69
elif fileName.find("DYBJetsToLL_M-50_Zpt-100to200_TuneCP5_13TeV-madgraphMLM-pythia8_newgridpack") !=-1 : return 3.21
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.72
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5CR1_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("DYJetsToLL_M-4to50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 203.3
elif fileName.find("DYJetsToLL_Zpt-200toInf_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_TuneUp") !=-1 : return 6.716
elif fileName.find("TTToSemiLepton_HT500Njet9_hdampDOWN_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 3.884
elif fileName.find("ST_tW_antitop_5f_DS_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 35.25
elif fileName.find("DYJetsToLL_M-4to50_HT-600toInf_TuneCP5_PSWeights_13TeV-madgraphMLM-pythia8") !=-1 : return 1.837
elif fileName.find("ST_t-channel_muDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.86
elif fileName.find("DYJetsToLL_M-4to50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 54.31
elif fileName.find("ST_t-channel_top_4f_inclusiveDecays_TuneCP5_13TeV-powhegV2-madspin-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5up_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_decay") !=-1 : return 82.52
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 113.3
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRV_LVRVunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 47.63
elif fileName.find("DYJetsToLL_CGenFilter_Zpt-200toInf_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 3.184
elif fileName.find("DYJetsToLL_M-4to50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 146.6
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1937
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5down_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_eDecays_anomwtbLVLT_LVLTunphys_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 84.84
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-200toInf_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.5327
elif fileName.find("DYJetsToLL_BGenFilter_Zpt-100to200_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 3.384
elif fileName.find("ST_tW_top_5f_hdampdown_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("DYJetsToLL_CGenFilter_Zpt-100to200_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 25.86
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 225.5
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("DYJetsToTauTau_ForcedMuDecay_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 1990.0
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1695_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1715_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("TTToSemiLepton_HT500Njet9_hdampUP_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 4.613
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.8021
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003514
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR2_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1735_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR1_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_top_4f_InclusiveDecays_TuneCP5_13TeV-powheg-madspin-pythia8") !=-1 : return 115.3
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_mtop1755_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 36.65
elif fileName.find("TTToSemilepton_ttbbFilter_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8") !=-1 : return 31.06
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5up_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.2
elif fileName.find("DYJetsToEE_M-50_LTbinned_800To2000_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.01009
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 160.7
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.3
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_LV3RT1_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 54.52
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 48.63
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 1.761
elif fileName.find("DYJetsToTauTau_ForcedMuEleDecay_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 6458.0
elif fileName.find("ST_tW_top_5f_hdampup_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.9
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 6.993
elif fileName.find("DYJetsToEE_M-50_LTbinned_100To200_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 93.51
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.6
elif fileName.find("tZq_ll_4f_ckm_NLO_TuneCP5CR1_QCDbased_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.07358
elif fileName.find("DYJetsToLL_M-50_VBFFilter_TuneCP5_PSweights_13TeV-amcatnloFXFX-pythia8") !=-1 : return 266.1
elif fileName.find("DYJetsToEE_M-50_LTbinned_200To400_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 4.121
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.7
elif fileName.find("DYJetsToLL_M-50_HT-70to100_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 146.5
elif fileName.find("ST_tW_top_5f_DS_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 33.75
elif fileName.find("ST_tW_antitop_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 35.13
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR2_GluonMove_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DYJetsToEE_M-50_LTbinned_400To800_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.2445
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR1_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5CR2_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("TTJets_SingleLeptFromTbar_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.167
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_LV3RT1_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 54.72
elif fileName.find("DYJetsToLL_M-5to50_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1.107
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_LV2RT2_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 102.9
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("TTTo2L2Nu_HT500Njet7_hdampDOWN_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 10.56
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("DYJetsToEE_M-50_LTbinned_95To100_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 47.14
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("TTJets_SingleLeptFromTbar_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 31.68
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_4f_leptonDecays_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 70.9
elif fileName.find("DYJetsToLL_M-5to50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3.628
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_LV1RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 108.9
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR1_QCDbased_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DYJetsToLL_M-50_VBFFilter_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 202.3
elif fileName.find("DYJetsToLL_M-5to50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 224.4
elif fileName.find("ST_t-channel_top_5f_TuneCP5_13TeV-powheg-madspin-pythia8_vtd_vts_prod") !=-1 : return 547.2
elif fileName.find("DYJetsToLL_M-5to50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 37.87
elif fileName.find("TTWJetsToLNu_TuneCP5CR2_GluonMove_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2188
elif fileName.find("DYBJetsToLL_M-50_Zpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 3.088
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.84
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_CUETP8M1Down") !=-1 : return 5940.0
elif fileName.find("DYJetsToLL_M-1To5_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 65.9
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 4.179
elif fileName.find("DYJetsToLL_M-1To5_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 789.8
elif fileName.find("DYJetsToEE_M-50_LTbinned_80To85_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 174.1
elif fileName.find("DYBJetsToLL_M-50_Zpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.3159
elif fileName.find("DYJetsToEE_M-50_LTbinned_90To95_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 179.6
elif fileName.find("DYJetsToTauTau_ForcedMuDecay_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 6503.0
elif fileName.find("DYJetsToLL_M-1To5_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 16.72
elif fileName.find("DYJetsToLL_M-5to50_HT-70to100_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 301.0
elif fileName.find("DYJetsToLL_M-1To5_HT-150to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1124.0
elif fileName.find("DYJetsToEE_M-50_LTbinned_85To90_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 250.6
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1512
elif fileName.find("TTToSemiLeptonic_TuneCP5CR2_GluonMove_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-160_MZp-2_13TeV-madgraph") !=-1 : return 0.0001077
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-100_MZp-8_13TeV-madgraph") !=-1 : return 1.563e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-160_MZp-5_13TeV-madgraph") !=-1 : return 4.298e-05
elif fileName.find("TTToSemiLeptonic_TuneCP5CR1_QCDbased_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-150_MZp-8_13TeV-madgraph") !=-1 : return 5.117e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-150_MZp-5_13TeV-madgraph") !=-1 : return 8.237e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-120_MZp-2_13TeV-madgraph") !=-1 : return 0.0002052
elif fileName.find("TTJets_SingleLeptFromT_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.212
elif fileName.find("TTTo2L2Nu_HT500Njet7_hdampUP_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 12.41
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-140_MZp-8_13TeV-madgraph") !=-1 : return 6.504e-05
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003659
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-130_MZp-2_13TeV-madgraph") !=-1 : return 0.0002577
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-150_MZp-2_13TeV-madgraph") !=-1 : return 0.0002047
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-140_MZp-2_13TeV-madgraph") !=-1 : return 0.0002613
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-130_MZp-5_13TeV-madgraph") !=-1 : return 0.0001031
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-100_MZp-2_13TeV-madgraph") !=-1 : return 5.684e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-110_MZp-8_13TeV-madgraph") !=-1 : return 3.331e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-130_MZp-8_13TeV-madgraph") !=-1 : return 6.456e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-100_MZp-5_13TeV-madgraph") !=-1 : return 2.343e-05
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-120_13TeV_amcatnlo_pythia8") !=-1 : return 7.402
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-150_13TeV_amcatnlo_pythia8") !=-1 : return 1.686
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-110_MZp-5_13TeV-madgraph") !=-1 : return 5.221e-05
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-140_13TeV_amcatnlo_pythia8") !=-1 : return 3.367
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.06
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-110_MZp-2_13TeV-madgraph") !=-1 : return 0.0001291
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-120_MZp-8_13TeV-madgraph") !=-1 : return 5.201e-05
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-140_MZp-5_13TeV-madgraph") !=-1 : return 0.0001043
elif fileName.find("ST_t-channel_tauDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.8
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-160_13TeV_amcatnlo_pythia8") !=-1 : return 0.4841
elif fileName.find("TTWJetsToLNu_TuneCP5CR1_QCDbased_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2183
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ST_tW_antitop_5f_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-100_13TeV_amcatnlo_pythia8") !=-1 : return 11.62
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-160_MZp-8_13TeV-madgraph") !=-1 : return 2.687e-05
elif fileName.find("DYJetsToLL_Zpt-200toInf_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 6.733
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 0.6229
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-120_MZp-5_13TeV-madgraph") !=-1 : return 8.243e-05
elif fileName.find("DYJetsToLL_Zpt-100to200_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 57.3
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.81
elif fileName.find("DYJetsToLL_M-50_Zpt-150toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 18.36
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-155_13TeV_amcatnlo_pythia8") !=-1 : return 1.008
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 41.04
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-90_MZp-8_13TeV-madgraph") !=-1 : return 3.684e-06
elif fileName.find("DYJetsToLL_M-105To160_TuneCP5_PSweights_13TeV-amcatnloFXFX-pythia8") !=-1 : return 47.05
elif fileName.find("tZq_Zhad_Wlept_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.1518
elif fileName.find("TTJets_SingleLeptFromT_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 32.27
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_CUETP8M1Up") !=-1 : return 5872.0
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR2_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-90_MZp-5_13TeV-madgraph") !=-1 : return 5.859e-06
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 4.295
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 147.4
elif fileName.find("DYJetsToLL_M-105To160_VBFFilter_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 2.026
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1.358
elif fileName.find("ST_t-channel_muDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.21
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-90_13TeV_amcatnlo_pythia8") !=-1 : return 13.46
elif fileName.find("ST_t-channel_muDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.67
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5CR1_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("ChargedHiggs_TTToHplusBWB_HplusToTauNu_M-80_13TeV_amcatnlo_pythia8") !=-1 : return 15.03
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 5.674
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRT_RT4_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 53.7
elif fileName.find("ST_tW_top_5f_DS_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 33.67
elif fileName.find("TTTo2L2Nu_ttbbFilter_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8") !=-1 : return 7.269
elif fileName.find("TTToHplusToWZp_WToTauNu_WuToQQ_ZpToMuMu_MH-90_MZp-2_13TeV-madgraph") !=-1 : return 1.318e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-140_MZp-2_13TeV-madgraph") !=-1 : return 0.0001947
elif fileName.find("DYJetsToNuNu_PtZ-400To650_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.2783
elif fileName.find("DYJetsToLL_BGenFilter_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 255.2
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-130_MZp-8_13TeV-madgraph") !=-1 : return 4.803e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-110_MZp-5_13TeV-madgraph") !=-1 : return 3.898e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-110_MZp-8_13TeV-madgraph") !=-1 : return 2.495e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-100_MZp-5_13TeV-madgraph") !=-1 : return 1.776e-05
elif fileName.find("DYJetsToNuNu_PtZ-100To250_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 54.86
elif fileName.find("TTToSemiLeptonic_hdampDOWN_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-120_MZp-8_13TeV-madgraph") !=-1 : return 3.87e-05
elif fileName.find("TTToSemiLeptonic_mtop178p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("DYJetsToNuNu_PtZ-250To400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 2.073
elif fileName.find("TTToSemiLeptonic_mtop175p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-130_MZp-5_13TeV-madgraph") !=-1 : return 7.685e-05
elif fileName.find("TTToSemiLeptonic_mtop169p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-160_MZp-5_13TeV-madgraph") !=-1 : return 3.199e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-160_MZp-8_13TeV-madgraph") !=-1 : return 1.993e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-120_MZp-2_13TeV-madgraph") !=-1 : return 0.0001529
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-160_MZp-2_13TeV-madgraph") !=-1 : return 7.999e-05
elif fileName.find("DYJetsToLL_M-105To160_TuneCP5_PSweights_13TeV-madgraphMLM-pythia8") !=-1 : return 38.81
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-100_MZp-2_13TeV-madgraph") !=-1 : return 4.276e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-150_MZp-5_13TeV-madgraph") !=-1 : return 6.133e-05
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTToSemiLeptonic_mtop173p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-140_MZp-8_13TeV-madgraph") !=-1 : return 4.869e-05
elif fileName.find("TTToSemiLeptonic_mtop166p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-150_MZp-8_13TeV-madgraph") !=-1 : return 3.827e-05
elif fileName.find("ST_t-channel_eDecays_anomwtbLVRV_RV_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.12
elif fileName.find("DYJetsToNuNu_PtZ-650ToInf_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.02603
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-140_MZp-5_13TeV-madgraph") !=-1 : return 7.75e-05
elif fileName.find("ST_t-channel_eDecays_anomwtbLVLT_LT_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 71.81
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-110_MZp-2_13TeV-madgraph") !=-1 : return 9.633e-05
elif fileName.find("TTWJetsToLNu_TuneCP5_PSweights_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2198
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-130_MZp-2_13TeV-madgraph") !=-1 : return 0.0001914
elif fileName.find("TTToSemiLeptonic_mtop171p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-120_MZp-5_13TeV-madgraph") !=-1 : return 6.122e-05
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-150_MZp-2_13TeV-madgraph") !=-1 : return 0.000153
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-100_MZp-8_13TeV-madgraph") !=-1 : return 1.168e-05
elif fileName.find("DYJetsToLL_M-105To160_VBFFilter_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.518
elif fileName.find("DYJetsToLL_M-4to50_HT-600toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.85
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-25_13TeV-madgraph") !=-1 : return 0.01724
elif fileName.find("DY2JetsToLL_M-50_LHEZpT_400-inf_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 0.4477
elif fileName.find("DY1JetsToLL_M-50_LHEZpT_400-inf_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 0.1193
elif fileName.find("DY2JetsToLL_M-50_LHEZpT_250-400_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 2.737
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-30_13TeV-madgraph") !=-1 : return 0.01416
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-35_13TeV-madgraph") !=-1 : return 0.02032
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-25_13TeV-madgraph") !=-1 : return 0.03673
elif fileName.find("DYJetsToNuNu_PtZ-50To100_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 237.2
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-90_MZp-8_13TeV-madgraph") !=-1 : return 2.736e-06
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-100_MA-20_13TeV-madgraph") !=-1 : return 0.0008489
elif fileName.find("DY1JetsToLL_M-50_LHEZpT_250-400_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 1.098
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-90_MZp-5_13TeV-madgraph") !=-1 : return 4.393e-06
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-20_13TeV-madgraph") !=-1 : return 0.03297
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-25_13TeV-madgraph") !=-1 : return 0.03162
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-10_13TeV-madgraph") !=-1 : return 0.01898
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-110_MA-25_13TeV-madgraph") !=-1 : return 0.005135
elif fileName.find("DYJetsToLL_M-4to50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 54.39
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-110_MA-20_13TeV-madgraph") !=-1 : return 0.008633
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-100_MA-10_13TeV-madgraph") !=-1 : return 0.002968
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-35_13TeV-madgraph") !=-1 : return 0.03638
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-15_13TeV-madgraph") !=-1 : return 0.01158
elif fileName.find("DYJetsToLL_M-4to50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 5.697
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-100_MA-15_13TeV-madgraph") !=-1 : return 0.002361
elif fileName.find("TTToSemiLepton_HT500Njet9_hdampDOWN_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 3.899
elif fileName.find("ST_tW_DS_antitop_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 35.13
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-20_13TeV-madgraph") !=-1 : return 0.02027
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-10_13TeV-madgraph") !=-1 : return 0.01418
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-25_13TeV-madgraph") !=-1 : return 0.03152
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-35_13TeV-madgraph") !=-1 : return 0.0346
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-30_13TeV-madgraph") !=-1 : return 0.03397
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-25_13TeV-madgraph") !=-1 : return 0.0188
elif fileName.find("DY1JetsToLL_M-50_LHEZpT_150-250_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 9.543
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-110_MA-30_13TeV-madgraph") !=-1 : return 0.001474
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-10_13TeV-madgraph") !=-1 : return 0.01521
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-30_13TeV-madgraph") !=-1 : return 0.01928
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-15_13TeV-madgraph") !=-1 : return 0.02175
elif fileName.find("DYJetsToLL_M-4to50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 204.0
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-15_13TeV-madgraph") !=-1 : return 0.0269
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 4.253
elif fileName.find("DYBJetsToNuNu_Zpt-40toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 48.71
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-30_13TeV-madgraph") !=-1 : return 0.02977
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-20_13TeV-madgraph") !=-1 : return 0.01481
elif fileName.find("TTToHadronic_TuneCP5CR2_GluonMove_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-20_13TeV-madgraph") !=-1 : return 0.03
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-15_13TeV-madgraph") !=-1 : return 0.01866
elif fileName.find("TTToHplusToWZp_WToLNu_WToLNu_ZpToMuMu_MH-90_MZp-2_13TeV-madgraph") !=-1 : return 9.812e-06
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-10_13TeV-madgraph") !=-1 : return 0.01839
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-15_13TeV-madgraph") !=-1 : return 0.02536
elif fileName.find("DY2JetsToLL_M-50_LHEZpT_150-250_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 15.65
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-160_MA-10_13TeV-madgraph") !=-1 : return 0.008011
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-110_MA-15_13TeV-madgraph") !=-1 : return 0.009756
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-120_MA-35_13TeV-madgraph") !=-1 : return 0.007598
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-110_MA-10_13TeV-madgraph") !=-1 : return 0.008264
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-130_MA-35_13TeV-madgraph") !=-1 : return 0.02491
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-140_MA-30_13TeV-madgraph") !=-1 : return 0.03793
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-150_MA-20_13TeV-madgraph") !=-1 : return 0.02735
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1933
elif fileName.find("DYJetsToLL_M-1500to2000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.00218
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5down_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-35_13TeV-madgraph") !=-1 : return 0.02608
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-20_13TeV-madgraph") !=-1 : return 0.02245
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-20_13TeV-madgraph") !=-1 : return 0.02486
elif fileName.find("TTToHadronic_TuneCP5CR1_QCDbased_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-25_13TeV-madgraph") !=-1 : return 0.01403
elif fileName.find("DYBJetsToLL_M-50_Zpt-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 4.042
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("DYJetsToLL_M-1to4_HT-600toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 2.453
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-110_MA-30_13TeV-madgraph") !=-1 : return 0.0011
elif fileName.find("DYJetsToLL_M-1to4_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 479.6
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-110_MA-25_13TeV-madgraph") !=-1 : return 0.003863
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-25_13TeV-madgraph") !=-1 : return 0.01305
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-35_13TeV-madgraph") !=-1 : return 0.01856
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-30_13TeV-madgraph") !=-1 : return 0.02827
elif fileName.find("DY1JetsToLL_M-50_LHEZpT_50-150_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 316.6
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-20_13TeV-madgraph") !=-1 : return 0.01516
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-35_13TeV-madgraph") !=-1 : return 0.02718
elif fileName.find("DYJetsToLL_M-50_HT-1200to2500_TuneCP5_14TeV-madgraphMLM-pythia8") !=-1 : return 0.2466
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-10_13TeV-madgraph") !=-1 : return 0.006028
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-35_13TeV-madgraph") !=-1 : return 0.005625
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-35_13TeV-madgraph") !=-1 : return 0.01527
elif fileName.find("DYJetsToLL_M-1to4_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 8.207
elif fileName.find("TTToSemiLeptonic_hdampUP_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-10_13TeV-madgraph") !=-1 : return 0.01143
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-110_MA-20_13TeV-madgraph") !=-1 : return 0.006446
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-30_13TeV-madgraph") !=-1 : return 0.01449
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-110_MA-15_13TeV-madgraph") !=-1 : return 0.007288
elif fileName.find("DY2JetsToLL_M-50_LHEZpT_50-150_TuneCP5_13TeV-amcnloFXFX-pythia8") !=-1 : return 169.6
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-20_13TeV-madgraph") !=-1 : return 0.02056
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-30_13TeV-madgraph") !=-1 : return 0.02555
elif fileName.find("DYJetsToLL_M-2000to3000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.0005156
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-25_13TeV-madgraph") !=-1 : return 0.02348
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-25_13TeV-madgraph") !=-1 : return 0.02368
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-20_13TeV-madgraph") !=-1 : return 0.01108
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-10_13TeV-madgraph") !=-1 : return 0.01375
elif fileName.find("ST_tW_top_5f_NoFullyHadronicDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 11.34
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-25_13TeV-madgraph") !=-1 : return 0.02774
elif fileName.find("DYJetsToLL_M-4to50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 145.5
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-100_MA-20_13TeV-madgraph") !=-1 : return 0.0006391
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-10_13TeV-madgraph") !=-1 : return 0.01428
elif fileName.find("DYJetsToLL_M-1000to1500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.01636
elif fileName.find("DYJetsToEE_M-50_LTbinned_800To2000_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 0.008352
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-100_MA-15_13TeV-madgraph") !=-1 : return 0.001767
elif fileName.find("DYBJetsToLL_M-50_Zpt-200toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.4286
elif fileName.find("TTToHplusToWA_WToTauNu_WToQQ_AToMuMu_MH-90_MA-10_13TeV-madgraph") !=-1 : return 0.0002799
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-30_13TeV-madgraph") !=-1 : return 0.02227
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-130_MA-15_13TeV-madgraph") !=-1 : return 0.01906
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-160_MA-15_13TeV-madgraph") !=-1 : return 0.008748
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-150_MA-15_13TeV-madgraph") !=-1 : return 0.01638
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-140_MA-15_13TeV-madgraph") !=-1 : return 0.02024
elif fileName.find("DYJetsToLL_M-1to4_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 85.85
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-100_MA-10_13TeV-madgraph") !=-1 : return 0.002219
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-30_13TeV-madgraph") !=-1 : return 0.01063
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-110_MA-10_13TeV-madgraph") !=-1 : return 0.006195
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-10_13TeV-madgraph") !=-1 : return 0.01064
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-120_MA-15_13TeV-madgraph") !=-1 : return 0.014
elif fileName.find("TTToSemiLepton_HT500Njet9_hdampUP_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 4.571
elif fileName.find("DYJetsToLL_M-50_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.003468
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR2_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("DYJetsToEE_M-50_LTbinned_200To400_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 3.574
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 71.74
elif fileName.find("TTZPrimeToMuMu_M-1700_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 9.353e-05
elif fileName.find("TTZPrimeToMuMu_M-2000_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 3.577e-05
elif fileName.find("TTZPrimeToMuMu_M-1600_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0001325
elif fileName.find("DYJetsToLL_M-50_Zpt-150toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 22.93
elif fileName.find("TTToHplusToWA_WToLNu_WToLNu_AToMuMu_MH-90_MA-10_13TeV-madgraph") !=-1 : return 0.0002095
elif fileName.find("DYJetsToLL_M-1to4_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 626.8
elif fileName.find("TTZPrimeToMuMu_M-1300_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0004131
elif fileName.find("DYJetsToEE_M-50_LTbinned_100To200_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 94.34
elif fileName.find("DYJetsToEE_M-50_LTbinned_400To800_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 0.2005
elif fileName.find("DYJetsToLL_Pt-100To250_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 81.22
elif fileName.find("DYJetsToLL_M-50_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.8052
elif fileName.find("TTZPrimeToMuMu_M-1500_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0001903
elif fileName.find("TTZPrimeToMuMu_M-1900_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 4.862e-05
elif fileName.find("TTZPrimeToMuMu_M-1000_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.00154
elif fileName.find("DYJetsToLL_Pt-400To650_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.3882
elif fileName.find("TTZPrimeToMuMu_M-1800_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 6.693e-05
elif fileName.find("TTZPrimeToMuMu_M-1400_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0002778
elif fileName.find("TTZPrimeToMuMu_M-1200_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0006259
elif fileName.find("DYJetsToLL_Pt-250To400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 2.991
elif fileName.find("DYJetsToLL_M-800to1000_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.03047
elif fileName.find("TTToSemiLeptonic_WspTgt150_TuneCUETP8M2T4_13TeV-powheg-pythia8") !=-1 : return 34.49
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_DownPS") !=-1 : return 5735.0
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5CR1_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("DYJetsToLL_Pt-650ToInf_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.03737
elif fileName.find("TTZPrimeToMuMu_M-900_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.002515
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-160_MZ-2_13TeV-madgraph") !=-1 : return 5.559e-05
elif fileName.find("DYJetsToLL_M-700to800_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.03614
elif fileName.find("DYJetsToLL_M-200to400_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 7.77
elif fileName.find("DYJetsToLL_M-400to500_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.4065
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-140_MZ-8_13TeV-madgraph") !=-1 : return 4.225e-05
elif fileName.find("ST_tW_antitop_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.97
elif fileName.find("DYJetsToEE_M-50_LTbinned_95To100_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 48.2
elif fileName.find("TTZPrimeToMuMu_M-800_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.004257
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-130_MZ-2_13TeV-madgraph") !=-1 : return 0.000168
elif fileName.find("Test_ZprimeToTT_M-4500_W-45_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.000701
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 11.59
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-160_MZ-8_13TeV-madgraph") !=-1 : return 1.365e-05
elif fileName.find("TTTo2L2Nu_TuneCP5CR2_GluonMove_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTZPrimeToMuMu_M-400_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.06842
elif fileName.find("TTToHadronic_hdampDOWN_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5up_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("TTToHadronic_mtop175p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-110_MZ-5_13TeV-madgraph") !=-1 : return 2.886e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-120_MZ-5_13TeV-madgraph") !=-1 : return 5.067e-05
elif fileName.find("DYJetsToLL_M-500to700_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.2334
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-140_MZ-2_13TeV-madgraph") !=-1 : return 0.0001727
elif fileName.find("TTZPrimeToMuMu_M-300_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.2194
elif fileName.find("DYJetsToLL_Pt-50To100_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 354.8
elif fileName.find("TTToHadronic_mtop171p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("TTZPrimeToMuMu_M-600_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.01409
elif fileName.find("TTZPrimeToMuMu_M-500_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.0287
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-110_MZ-8_13TeV-madgraph") !=-1 : return 1.808e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-100_MZ-2_13TeV-madgraph") !=-1 : return 2.652e-05
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5down_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTToHadronic_mtop169p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-130_MZ-5_13TeV-madgraph") !=-1 : return 6.649e-05
elif fileName.find("TTZPrimeToMuMu_M-700_TuneCP5_PSWeights_13TeV-madgraph-pythia8") !=-1 : return 0.007522
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-100_MZ-8_13TeV-madgraph") !=-1 : return 6.686e-06
elif fileName.find("DYJetsToLL_M-50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 161.1
elif fileName.find("TTToHadronic_mtop166p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-130_MZ-8_13TeV-madgraph") !=-1 : return 4.106e-05
elif fileName.find("TTToHadronic_mtop173p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("ST_s-channel_4f_hadronicDecays_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 11.24
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-150_MZ-5_13TeV-madgraph") !=-1 : return 5.214e-05
elif fileName.find("DYJetsToLL_M-50_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.743
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-120_MZ-8_13TeV-madgraph") !=-1 : return 3.151e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-150_MZ-2_13TeV-madgraph") !=-1 : return 0.0001319
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-100_MZ-5_13TeV-madgraph") !=-1 : return 1.058e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-140_MZ-5_13TeV-madgraph") !=-1 : return 6.855e-05
elif fileName.find("DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 48.66
elif fileName.find("BdToPsi2sKst_MuTrkFilter_DGamma0_TuneCP5_13TeV-pythia8-evtgen") !=-1 : return 5942000.0
elif fileName.find("DYJetsToLL_M-100to200_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 226.6
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-120_MZ-2_13TeV-madgraph") !=-1 : return 0.0001282
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-110_MZ-2_13TeV-madgraph") !=-1 : return 7.276e-05
elif fileName.find("TTToHadronic_mtop178p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("DYJetsToLL_M-50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6.968
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-150_MZ-8_13TeV-madgraph") !=-1 : return 3.237e-05
elif fileName.find("ST_s-channel_4f_hadronicDecays_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 11.24
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-160_MZ-5_13TeV-madgraph") !=-1 : return 2.198e-05
elif fileName.find("DYJetsToLL_Zpt-0To50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 5375.0
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-150_MZ-2_13TeV-madgraph") !=-1 : return 0.0001309
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_UpPS") !=-1 : return 6005.0
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-110_MZ-8_13TeV-madgraph") !=-1 : return 1.802e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-140_MZ-2_13TeV-madgraph") !=-1 : return 0.0001729
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-120_MZ-8_13TeV-madgraph") !=-1 : return 3.146e-05
elif fileName.find("tZq_nunu_4f_ckm_NLO_TuneCP5_PSweights_13TeV-madgraph-pythia8") !=-1 : return 0.1337
elif fileName.find("DYJetsToEE_M-50_LTbinned_90To95_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 167.3
elif fileName.find("DYJetsToEE_M-50_LTbinned_80To85_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 159.9
elif fileName.find("DYJetsToEE_M-50_LTbinned_75To80_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 134.6
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR2_GluonMove_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-160_MZ-2_13TeV-madgraph") !=-1 : return 5.542e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-90_MZ-8_13TeV-madgraph") !=-1 : return 9.926e-07
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-90_MZ-5_13TeV-madgraph") !=-1 : return 1.652e-06
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-140_MZ-5_13TeV-madgraph") !=-1 : return 6.851e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-110_MZ-2_13TeV-madgraph") !=-1 : return 7.265e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-140_MZ-8_13TeV-madgraph") !=-1 : return 4.231e-05
elif fileName.find("DYJetsToEE_M-50_LTbinned_85To90_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 229.4
elif fileName.find("TTToSemilepton_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8") !=-1 : return 320.1
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-150_MZ-8_13TeV-madgraph") !=-1 : return 3.234e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-160_MZ-5_13TeV-madgraph") !=-1 : return 2.212e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-160_MZ-8_13TeV-madgraph") !=-1 : return 1.364e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-130_MZ-8_13TeV-madgraph") !=-1 : return 4.116e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-100_MZ-5_13TeV-madgraph") !=-1 : return 1.06e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-100_MZ-2_13TeV-madgraph") !=-1 : return 2.654e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-150_MZ-5_13TeV-madgraph") !=-1 : return 5.234e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-110_MZ-5_13TeV-madgraph") !=-1 : return 2.894e-05
elif fileName.find("TTToHplusToWZprime_WToMuNu_ZToMuMu_MH-90_MZ-2_13TeV-madgraph") !=-1 : return 4.124e-06
elif fileName.find("ST_tW_DS_top_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 33.67
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-120_MZ-5_13TeV-madgraph") !=-1 : return 5.064e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-120_MZ-2_13TeV-madgraph") !=-1 : return 0.0001276
elif fileName.find("TTTo2L2Nu_TuneCP5CR1_QCDbased_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-130_MZ-2_13TeV-madgraph") !=-1 : return 0.0001671
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-100_MZ-8_13TeV-madgraph") !=-1 : return 6.706e-06
elif fileName.find("DYJetsToLL_M-50_HT-70to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 146.7
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-130_MZ-5_13TeV-madgraph") !=-1 : return 6.66e-05
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-90_MZ-2_13TeV-madgraph") !=-1 : return 4.126e-06
elif fileName.find("TTToSemiLeptonic_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYToMuMu_M-4500To6000_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 3.566e-07
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 3.74
elif fileName.find("DYJetsToLL_M-50_HT-40to70_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 311.4
elif fileName.find("DYToMuMu_M-3500To4500_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 3.317e-06
elif fileName.find("DYToMuMu_M-2300To3500_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 7.34e-05
elif fileName.find("ST_s-channel_4f_leptonDecays_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 3.74
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-90_MZ-8_13TeV-madgraph") !=-1 : return 9.872e-07
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5up_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DY1JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 730.3
elif fileName.find("DY2JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 387.4
elif fileName.find("DYJetsToEE_M-50_LTbinned_5To75_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 866.2
elif fileName.find("TTToHplusToWZprime_WToENu_ZToMuMu_MH-90_MZ-5_13TeV-madgraph") !=-1 : return 1.655e-06
elif fileName.find("DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 18810.0
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5CR1_QCDbased_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("DYJetsToEE_M-50_LTbinned_0To75_5f_LO_13TeV-madgraph_pythia8") !=-1 : return 948.2
elif fileName.find("TTToHadronic_hdampUP_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("TTJets_SingleLeptFromTbar_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 108.7
elif fileName.find("TTTo2L2Nu_HT500Njet7_hdampDOWN_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 10.58
elif fileName.find("DY3JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 95.02
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 11.37
elif fileName.find("DY4JetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 36.71
elif fileName.find("TTZJetsToQQ_Dilept_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.0568
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-herwigpp_30M") !=-1 : return 14240.0
elif fileName.find("DYToMuMu_M-1400To2300_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.001178
elif fileName.find("DYJetsToLL_M-1500to2000_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.002367
elif fileName.find("TTJets_DiLept_genMET-150_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 3.655
elif fileName.find("TTTo2L2Nu_mtop166p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 4.216
elif fileName.find("tZq_ll_4f_ckm_NLO_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.07358
elif fileName.find("DYToMuMu_M-800To1400_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.01437
elif fileName.find("DYJetsToLL_M-10to50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 16270.0
elif fileName.find("TTTo2L2Nu_hdampDOWN_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT1500to2000_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 13.61
elif fileName.find("DYToMuMu_M-6000ToInf_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 1.576e-08
elif fileName.find("TTToSemiLeptonic_TuneCP5CR2_GluonMove_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT1000to1500_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 138.2
elif fileName.find("DYJetsToLL_M-2000to3000_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.0005409
elif fileName.find("TTTo2L2Nu_mtop173p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("DYJetsToLL_M-10to50_TuneCUETP8M1_14TeV-madgraphMLM-pythia8") !=-1 : return 17230.0
elif fileName.find("TTTo2L2Nu_mtop169p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("TTTo2L2Nu_mtop175p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("DYJetsToLL_M-1000to1500_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.01828
elif fileName.find("TTTo2L2Nu_mtop178p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("TTTo2L2Nu_mtop171p5_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-15_13TeV-madgraph") !=-1 : return 0.01533
elif fileName.find("QCD_HT2000toInf_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 2.92
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-110_MA-20_13TeV-madgraph") !=-1 : return 0.004946
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-110_MA-10_13TeV-madgraph") !=-1 : return 0.003822
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-25_13TeV-madgraph") !=-1 : return 0.00815
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-30_13TeV-madgraph") !=-1 : return 0.01965
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-25_13TeV-madgraph") !=-1 : return 0.0186
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-10_13TeV-madgraph") !=-1 : return 0.01061
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-20_13TeV-madgraph") !=-1 : return 0.01191
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-110_MA-30_13TeV-madgraph") !=-1 : return 0.0009769
elif fileName.find("DYJetsToLL_Pt-650ToInf_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.04796
elif fileName.find("DYToEE_M-3500To4500_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 3.327e-06
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-100_MA-15_13TeV-madgraph") !=-1 : return 0.001117
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-110_MA-15_13TeV-madgraph") !=-1 : return 0.004958
elif fileName.find("TTToSemiLeptonic_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-25_13TeV-madgraph") !=-1 : return 0.02274
elif fileName.find("DYJetsToLL_Pt-250To400_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 3.774
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-20_13TeV-madgraph") !=-1 : return 0.01947
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-35_13TeV-madgraph") !=-1 : return 0.005199
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-10_13TeV-madgraph") !=-1 : return 0.003564
elif fileName.find("TTTo2L2Nu_HT500Njet7_hdampUP_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 12.39
elif fileName.find("DYJetsToLL_M-800to1000_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.03406
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-30_13TeV-madgraph") !=-1 : return 0.009303
elif fileName.find("DYJetsToLL_M-3000toInf_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 3.048e-05
elif fileName.find("ST_tW_top_5f_inclusiveDecays_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 34.91
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-30_13TeV-madgraph") !=-1 : return 0.009536
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-35_13TeV-madgraph") !=-1 : return 0.01695
elif fileName.find("DYToMuMu_M-200To400_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 2.342
elif fileName.find("DYJetsToLL_Pt-400To650_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.5164
elif fileName.find("BdToXKst_MuTrkFilter_DGamma0_TuneCP5_13TeV-pythia8-evtgen") !=-1 : return 7990000.0
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-35_13TeV-madgraph") !=-1 : return 0.02178
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-10_13TeV-madgraph") !=-1 : return 0.008312
elif fileName.find("DYToEE_M-4500To6000_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 3.551e-07
elif fileName.find("DYToEE_M-2300To3500_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 7.405e-05
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-30_13TeV-madgraph") !=-1 : return 0.02451
elif fileName.find("TTToSemiLeptonic_TuneCP5CR1_QCDbased_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-30_13TeV-madgraph") !=-1 : return 0.02076
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-15_13TeV-madgraph") !=-1 : return 0.01426
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-110_MA-25_13TeV-madgraph") !=-1 : return 0.003278
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-15_13TeV-madgraph") !=-1 : return 0.01005
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-35_13TeV-madgraph") !=-1 : return 0.01012
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-10_13TeV-madgraph") !=-1 : return 0.007271
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-140_MA-35_13TeV-madgraph") !=-1 : return 0.02426
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-25_13TeV-madgraph") !=-1 : return 0.01975
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-10_13TeV-madgraph") !=-1 : return 0.01005
elif fileName.find("QCD_HT700to1000_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 721.8
elif fileName.find("DYToEE_M-1400To2300_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.001177
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-100_MA-20_13TeV-madgraph") !=-1 : return 0.0004878
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-130_MA-20_13TeV-madgraph") !=-1 : return 0.01767
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-20_13TeV-madgraph") !=-1 : return 0.01555
elif fileName.find("DYJetsToLL_Pt-100To250_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 96.8
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-15_13TeV-madgraph") !=-1 : return 0.005209
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-160_MA-20_13TeV-madgraph") !=-1 : return 0.006725
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-100_MA-10_13TeV-madgraph") !=-1 : return 0.001144
elif fileName.find("TTJets_DiLept_genMET-80_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 22.45
elif fileName.find("DYJetsToLL_M-1to10_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 173100.0
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_PSweights_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-150_MA-15_13TeV-madgraph") !=-1 : return 0.01206
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-120_MA-25_13TeV-madgraph") !=-1 : return 0.01188
elif fileName.find("DYToMuMu_M-400To800_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.2084
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-100_MA-15_13TeV-madgraph") !=-1 : return 0.001121
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-15_13TeV-madgraph") !=-1 : return 0.005207
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-35_13TeV-madgraph") !=-1 : return 0.02177
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-10_13TeV-madgraph") !=-1 : return 0.003565
elif fileName.find("QCD_HT500to700_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 3078.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-100_MA-10_13TeV-madgraph") !=-1 : return 0.001146
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-110_MA-25_13TeV-madgraph") !=-1 : return 0.003271
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-20_13TeV-madgraph") !=-1 : return 0.01949
elif fileName.find("DYJetsToLL_M-500to700_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.2558
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-110_MA-30_13TeV-madgraph") !=-1 : return 0.0009777
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-30_13TeV-madgraph") !=-1 : return 0.0196
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-25_13TeV-madgraph") !=-1 : return 0.01853
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 4.281
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-10_13TeV-madgraph") !=-1 : return 0.01066
elif fileName.find("TTToHplusToWA_WToMuNu_AToMuMu_MH-90_MA-10_13TeV-madgraph") !=-1 : return 0.000107
elif fileName.find("TTTo2L2Nu_hdampUP_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-25_13TeV-madgraph") !=-1 : return 0.01975
elif fileName.find("TTToSemiLeptonic_widthx1p15_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-30_13TeV-madgraph") !=-1 : return 0.009525
elif fileName.find("ST_tWnunu_5f_LO_TuneCP5_PSweights_13TeV-madgraph-pythia8") !=-1 : return 0.02099
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-10_13TeV-madgraph") !=-1 : return 0.008305
elif fileName.find("QCD_HT200to300_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 111700.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-15_13TeV-madgraph") !=-1 : return 0.01205
elif fileName.find("QCD_HT100to200_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1275000.0
elif fileName.find("DYJetsToLL_Pt-50To100_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 407.9
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-35_13TeV-madgraph") !=-1 : return 0.01689
elif fileName.find("DYJetsToLL_M-200to400_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 8.502
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-20_13TeV-madgraph") !=-1 : return 0.006756
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-30_13TeV-madgraph") !=-1 : return 0.00934
elif fileName.find("DYJetsToLL_M-700to800_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.04023
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-35_13TeV-madgraph") !=-1 : return 0.01011
elif fileName.find("DY4JetsToTauTau_M-50_TuneCUETP8M1_13TeV-madgraph-pythia8") !=-1 : return 18.17
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-15_13TeV-madgraph") !=-1 : return 0.01429
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-15_13TeV-madgraph") !=-1 : return 0.01007
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-110_MA-20_13TeV-madgraph") !=-1 : return 0.004962
elif fileName.find("DY2JetsToTauTau_M-50_TuneCUETP8M1_13TeV-madgraph-pythia8") !=-1 : return 111.1
elif fileName.find("DYToEE_M-800To1400_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.01445
elif fileName.find("DY3JetsToTauTau_M-50_TuneCUETP8M1_13TeV-madgraph-pythia8") !=-1 : return 34.04
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8_Fall17") !=-1 : return 5350.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-10_13TeV-madgraph") !=-1 : return 0.007278
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-30_13TeV-madgraph") !=-1 : return 0.02073
elif fileName.find("DYJetsToLL_M-400to500_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 0.4514
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-150_MA-20_13TeV-madgraph") !=-1 : return 0.01554
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-15_13TeV-madgraph") !=-1 : return 0.01535
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-160_MA-25_13TeV-madgraph") !=-1 : return 0.008158
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-110_MA-10_13TeV-madgraph") !=-1 : return 0.003828
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-20_13TeV-madgraph") !=-1 : return 0.0177
elif fileName.find("DYToEE_M-6000ToInf_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 1.585e-08
elif fileName.find("TTToSemiLeptonic_widthx0p85_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-25_13TeV-madgraph") !=-1 : return 0.0119
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-20_13TeV-madgraph") !=-1 : return 0.0119
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-110_MA-15_13TeV-madgraph") !=-1 : return 0.004967
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-25_13TeV-madgraph") !=-1 : return 0.02275
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-130_MA-10_13TeV-madgraph") !=-1 : return 0.009985
elif fileName.find("TTJets_SingleLeptFromT_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 109.6
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-100_MA-20_13TeV-madgraph") !=-1 : return 0.0004875
elif fileName.find("QCD_HT300to500_BGenFilter_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 27960.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-35_13TeV-madgraph") !=-1 : return 0.02431
elif fileName.find("DYJetsToLL_M-100to200_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 247.8
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-120_MA-35_13TeV-madgraph") !=-1 : return 0.00514
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-140_MA-30_13TeV-madgraph") !=-1 : return 0.02449
elif fileName.find("DY2JetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 334.7
elif fileName.find("TTToSemiLeptonic_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DY3JetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 102.3
elif fileName.find("DY1JetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 1012.0
elif fileName.find("DY4JetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 54.52
elif fileName.find("TTToLL_MLL_1200To1800_TuneCUETP8M1_13TeV-powheg-pythia8") !=-1 : return 76.63
elif fileName.find("TTToSemiLeptonic_TuneCP2_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8") !=-1 : return 5941.0
elif fileName.find("TTToHplusToWA_WToENu_AToMuMu_MH-90_MA-10_13TeV-madgraph") !=-1 : return 0.000107
elif fileName.find("TTToSemiLeptonic_mtop166p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("TTToSemiLeptonic_widthx1p3_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToSemiLeptonic_mtop173p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("TTToSemiLeptonic_mtop178p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("DYBJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 70.08
elif fileName.find("TTTo2L2Nu_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8") !=-1 : return 76.7
elif fileName.find("DYToEE_M-200To400_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 2.341
elif fileName.find("TTToSemiLeptonic_hdampDOWN_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToSemiLeptonic_mtop169p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("TTToSemiLeptonic_mtop171p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("TTToSemiLeptonic_widthx0p7_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYToEE_M-400To800_NNPDF30NLO_TuneCUETP8M1_13TeV-pythia8") !=-1 : return 0.208
elif fileName.find("TTToHadronic_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTWJetsToLNu_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.2149
elif fileName.find("TTToSemiLeptonic_mtop175p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("DYJetsToLL_M-50_TuneCUETHS1_13TeV-madgraphMLM-herwigpp") !=-1 : return 358.6
elif fileName.find("TTToLL_MLL_1800ToInf_TuneCUETP8M1_13TeV-powheg-pythia8") !=-1 : return 76.63
elif fileName.find("TTToHadronic_TuneCP5CR2_GluonMove_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYJetsToLL_Pt-0To50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 106300.0
elif fileName.find("DYJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8") !=-1 : return 4963.0
elif fileName.find("TTWJetsToQQ_TuneCP5_13TeV-amcatnloFXFX-madspin-pythia8") !=-1 : return 0.4316
elif fileName.find("TTToSemiLepton_HT500Njet9_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 4.239
elif fileName.find("ST_tWll_5f_LO_TuneCP5_PSweights_13TeV-madgraph-pythia8") !=-1 : return 0.01103
elif fileName.find("TTToLL_MLL_800To1200_TuneCUETP8M1_13TeV-powheg-pythia8") !=-1 : return 76.63
elif fileName.find("Test_BulkGravToWW_narrow_M-4000_13TeV_TuneCP5-madgraph") !=-1 : return 4.543e-05
elif fileName.find("TTJets_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.1316
elif fileName.find("tZq_W_lept_Z_hadron_4f_ckm_NLO_13TeV_amcatnlo_pythia8") !=-1 : return 0.1573
elif fileName.find("DYJetsToLL_M-10to50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 15810
elif fileName.find("ttHTobb_ttToSemiLep_M125_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 0.5418
elif fileName.find("TTJets_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.001407
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 11.38
elif fileName.find("TTToHadronic_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTJets_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 0.7532
elif fileName.find("TTToSemiLeptonic_hdampUP_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("TTToLL_MLL_500To800_TuneCUETP8M1_13TeV-powheg-pythia8") !=-1 : return 76.63
elif fileName.find("TTToHadronic_TuneCP5CR1_QCDbased_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTTo2L2Nu_TuneCP5down_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTZPrimeToMuMu_M-1800_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 6.694e-05
elif fileName.find("TTZPrimeToMuMu_M-1600_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0001324
elif fileName.find("TTZPrimeToMuMu_M-1200_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0006278
elif fileName.find("ST_t-channel_antitop_5f_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 82.52
elif fileName.find("TTZPrimeToMuMu_M-1500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0001899
elif fileName.find("TTZPrimeToMuMu_M-1700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 9.354e-05
elif fileName.find("TTJets_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1.821
elif fileName.find("TTZPrimeToMuMu_M-1000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001539
elif fileName.find("ST_t-channel_eleDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.85
elif fileName.find("ST_t-channel_tauDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.7
elif fileName.find("DYJetsToLL_M-5to50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 81880.0
elif fileName.find("TTZPrimeToMuMu_M-2000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001539
elif fileName.find("TTZPrimeToMuMu_M-1400_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0002776
elif fileName.find("TTZPrimeToMuMu_M-1300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0004127
elif fileName.find("TTZPrimeToMuMu_M-1900_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 4.857e-05
elif fileName.find("TTToHadronic_hdampDOWN_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHadronic_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTZPrimeToMuMu_M-600_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.01408
elif fileName.find("TTToHadronic_mtop169p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("TTZPrimeToMuMu_M-300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.22
elif fileName.find("TTToSemiLeptonic_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5down_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("ST_t-channel_muDecays_13TeV-comphep-pythia8_TuneCP5") !=-1 : return 24.72
elif fileName.find("TTToHadronic_mtop171p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("TTZPrimeToMuMu_M-400_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0684
elif fileName.find("DYBBJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 14.49
elif fileName.find("TTToHadronic_mtop166p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("ttHTobb_ttTo2L2Nu_M125_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 0.5418
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 11.43
elif fileName.find("TTZPrimeToMuMu_M-900_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.002517
elif fileName.find("TTToHadronic_mtop178p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("TTToHadronic_mtop173p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("TTZPrimeToMuMu_M-700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.007514
elif fileName.find("TTZPrimeToMuMu_M-500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.02871
elif fileName.find("TTZPrimeToMuMu_M-800_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.004255
elif fileName.find("TTTo2L2Nu_TuneCP5CR2_GluonMove_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHadronic_mtop175p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("TTTo2L2Nu_noSC_TuneCUETP8M2T4_13TeV-powheg-pythia8") !=-1 : return 76.7
elif fileName.find("DY1JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 877.8
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 6529.0
elif fileName.find("QCD_HT1000to1500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1092.0
elif fileName.find("DY4JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 44.03
elif fileName.find("TTTo2L2Nu_TuneCP5up_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT1500to2000_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 99.76
elif fileName.find("TTTo2L2Nu_TuneCP5CR1_QCDbased_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DY3JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 111.5
elif fileName.find("DY2JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 304.4
elif fileName.find("TTToHadrons_mtop178p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("DYJetsToQQ_HT180_13TeV_TuneCP5-madgraphMLM-pythia8") !=-1 : return 1728.0
elif fileName.find("DYJetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 5343.0
elif fileName.find("QCD_HT2000toInf_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 20.35
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5up_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTTo2L2Nu_widthx1p15_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYTo2Mu_M1300_CUETP8M1_13TeV_Pythia8_Corrected-v3") !=-1 : return 0.001656
elif fileName.find("DYJetsToLL_M-50_TuneCH3_13TeV-madgraphMLM-herwig7") !=-1 : return 9.402
elif fileName.find("TTTo2L2Nu_HT500Njet7_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 11.28
elif fileName.find("DYJetsToEE_M-50_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1795.0
elif fileName.find("QCD_HT700to1000_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 6344.0
elif fileName.find("TTToSemiLeptonic_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYJetsToLL_M-50_TuneCP2_13TeV-madgraphMLM-pythia8") !=-1 : return 4878.0
elif fileName.find("DYJetsToLL_M-50_TuneCP1_13TeV-madgraphMLM-pythia8") !=-1 : return 4661.0
elif fileName.find("TTToHadronic_hdampUP_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("TTTo2L2Nu_widthx0p85_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYTo2E_M1300_CUETP8M1_13TeV_Pythia8_Corrected-v3") !=-1 : return 0.001661
elif fileName.find("DYTo2Mu_M800_CUETP8M1_13TeV_Pythia8_Corrected-v3") !=-1 : return 0.01419
elif fileName.find("TTTo2L2Nu_TuneCP5_PSweights_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYTo2Mu_M300_CUETP8M1_13TeV_Pythia8_Corrected-v3") !=-1 : return 0.5658
elif fileName.find("TTTo2L2Nu_mtop175p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 633.4
elif fileName.find("TTTo2L2Nu_mtop169p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 746.2
elif fileName.find("DYJetsToLL_1J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 955.8
elif fileName.find("QCD_HT300to500_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 323400.0
elif fileName.find("DYToEE_M-50_NNPDF31_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 2137.0
elif fileName.find("TTTo2L2Nu_mtop173p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 668.6
elif fileName.find("TTTo2L2Nu_hdampDOWN_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYJetsToLL_0J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 5313.0
elif fileName.find("DYJetsToLL_2J_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 360.4
elif fileName.find("TTTo2L2Nu_mtop178p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 584.6
elif fileName.find("TTTo2L2Nu_mtop171p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 706.1
elif fileName.find("QCD_HT200to300_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 1551000.0
elif fileName.find("TTTo2L2Nu_widthx0p7_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT500to700_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 30140.0
elif fileName.find("TTTo2L2Nu_mtop166p5_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 811.4
elif fileName.find("ST_t-channel_top_5f_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 119.7
elif fileName.find("TTTo2L2Nu_widthx1p3_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT100to200_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 23590000.0
elif fileName.find("QCD_HT50to100_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 185300000.0
elif fileName.find("TTZToLLNuNu_M-10_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.2432
elif fileName.find("TTToSemiLeptonic_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTJets_DiLept_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 54.23
elif fileName.find("QCD_HT1000to1500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1088.0
elif fileName.find("TTToHadronic_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToLL_MLL_500To800_41to65_NNPDF31_13TeV-powheg") !=-1 : return 687.1
elif fileName.find("QCD_HT1500to2000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 99.11
elif fileName.find("TTZToLL_M-1to10_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.05324
elif fileName.find("TTTo2L2Nu_hdampUP_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.0
elif fileName.find("QCD_HT700to1000_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 6334.0
elif fileName.find("QCD_HT2000toInf_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 20.23
elif fileName.find("ST_tWlnuZ_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001267
elif fileName.find("TTToLL_MLL_500To800_0to20_NNPDF31_13TeV-powheg") !=-1 : return 687.1
elif fileName.find("W4JetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 544.3
elif fileName.find("QCD_HT300to500_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 322600.0
elif fileName.find("W2JetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 2793.0
elif fileName.find("TTZZTo4b_5f_LO_TuneCP5_13TeV_madgraph_pythia8") !=-1 : return 0.001385
elif fileName.find("TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("W3JetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 992.5
elif fileName.find("QCD_HT500to700_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 29980.0
elif fileName.find("QCD_HT200to300_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 1547000.0
elif fileName.find("W1JetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 8873.0
elif fileName.find("TTToHadronic_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("QCD_HT100to200_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 23700000.0
elif fileName.find("ST_tWqqZ_5f_LO_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001122
elif fileName.find("DYToMuMu_pomflux_Pt-30_TuneCP5_13TeV-pythia8") !=-1 : return 4.219
elif fileName.find("WJetsToLNu_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 52940.0
elif fileName.find("TTTo2L2Nu_TuneCP5_erdON_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTToHadronic_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTTo2L2Nu_TuneCUETP8M1_14TeV-powheg-pythia8") !=-1 : return 90.75
elif fileName.find("TTToLL_MLL_1200To1800_NNPDF31_13TeV-powheg") !=-1 : return 687.1
elif fileName.find("TTTo2L2Nu_TuneCP5down_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYJetsToQQ_HT180_13TeV-madgraphMLM-pythia8") !=-1 : return 1208.0
elif fileName.find("tZq_ll_4f_scaledown_13TeV-amcatnlo-pythia8") !=-1 : return 0.0758
elif fileName.find("TTToLL_MLL_1800ToInf_NNPDF31_13TeV-powheg") !=-1 : return 687.1
elif fileName.find("TTJets_TuneCP5_13TeV-amcatnloFXFX-pythia8") !=-1 : return 722.8
elif fileName.find("ttZJets_TuneCP5_13TeV_madgraphMLM_pythia8") !=-1 : return 0.5407
elif fileName.find("TTToHadronic_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("tZq_ll_4f_ckm_NLO_13TeV-amcatnlo-herwigpp") !=-1 : return 0.07579
elif fileName.find("ttWJets_TuneCP5_13TeV_madgraphMLM_pythia8") !=-1 : return 0.4611
elif fileName.find("TTToLL_MLL_800To1200_NNPDF31_13TeV-powheg") !=-1 : return 687.1
elif fileName.find("tZq_ll_4f_scaleup_13TeV-amcatnlo-pythia8") !=-1 : return 0.0758
elif fileName.find("DYToEE_M-50_NNPDF31_13TeV-powheg-pythia8") !=-1 : return 2137.0
elif fileName.find("TTJets_TuneCP5_13TeV-madgraphMLM-pythia8") !=-1 : return 496.1
elif fileName.find("DYToLL-M-50_3J_14TeV-madgraphMLM-pythia8") !=-1 : return 191.7
elif fileName.find("DYToLL-M-50_0J_14TeV-madgraphMLM-pythia8") !=-1 : return 3676.0
elif fileName.find("TTTo2L2Nu_TuneCP5up_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("DYToLL-M-50_1J_14TeV-madgraphMLM-pythia8") !=-1 : return 1090.0
elif fileName.find("DYToLL-M-50_2J_14TeV-madgraphMLM-pythia8") !=-1 : return 358.7
elif fileName.find("TTZToQQ_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.5104
elif fileName.find("TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8") !=-1 : return 687.1
elif fileName.find("TTZToBB_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.1118
elif fileName.find("DYToLL_M_1_TuneCUETP8M1_13TeV_pythia8") !=-1 : return 19670.0
elif fileName.find("DYToLL_2J_13TeV-amcatnloFXFX-pythia8") !=-1 : return 340.5
elif fileName.find("DYToLL_0J_13TeV-amcatnloFXFX-pythia8") !=-1 : return 4757.0
elif fileName.find("DYTo2Mu_M1300_CUETP8M1_13TeV-pythia8") !=-1 : return 78420000000.0
elif fileName.find("TTWZ_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.002441
elif fileName.find("TTWW_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.006979
elif fileName.find("TTZZ_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001386
elif fileName.find("DYTo2Mu_M300_CUETP8M1_13TeV-pythia8") !=-1 : return 78390000000.0
elif fileName.find("TTZH_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.00113
elif fileName.find("TTTW_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.0007314
elif fileName.find("DYTo2E_M1300_CUETP8M1_13TeV-pythia8") !=-1 : return 78390000000.0
elif fileName.find("DYTo2Mu_M800_CUETP8M1_13TeV-pythia8") !=-1 : return 78420000000.0
elif fileName.find("TTWH_TuneCP5_13TeV-madgraph-pythia8") !=-1 : return 0.001141
elif fileName.find("WZ_TuneCP5_PSweights_13TeV-pythia8") !=-1 : return 27.52
elif fileName.find("WWZ_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.1676
elif fileName.find("DYTo2E_M800_CUETP8M1_13TeV-pythia8") !=-1 : return 78420000000.0
elif fileName.find("WW_TuneCP5_PSweights_13TeV-pythia8") !=-1 : return 76.15
elif fileName.find("ZZZ_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.01398
elif fileName.find("DYTo2E_M300_CUETP8M1_13TeV-pythia8") !=-1 : return 78420000000.0
elif fileName.find("WZZ_TuneCP5_13TeV-amcatnlo-pythia8") !=-1 : return 0.05565
elif fileName.find("tZq_ll_4f_13TeV-amcatnlo-herwigpp") !=-1 : return 0.0758
elif fileName.find("tZq_ll_4f_13TeV-amcatnlo-pythia8") !=-1 : return 0.0758
elif fileName.find("DYToLL_M-50_14TeV_pythia8_pilot1") !=-1 : return 4927.0
elif fileName.find("DYToLL_M-50_14TeV_pythia8") !=-1 : return 4963.0
elif fileName.find("WZ_TuneCP5_13TeV-pythia8") !=-1 : return 27.6
elif fileName.find("ZZ_TuneCP5_13TeV-pythia8") !=-1 : return 12.14
elif fileName.find("WW_TuneCP5_13TeV-pythia8") !=-1 : return 75.8
elif fileName.find("DYJetsToLL_Pt-100To250") !=-1 : return 84.014804
elif fileName.find("DYJetsToLL_Pt-400To650") !=-1 : return 0.436041144
elif fileName.find("DYJetsToLL_Pt-650ToInf") !=-1 : return 0.040981055
elif fileName.find("DYJetsToLL_Pt-250To400") !=-1 : return 3.228256512
elif fileName.find("DYJetsToLL_Pt-50To100") !=-1 : return 363.81428
elif fileName.find("DYJetsToLL_Zpt-0To50") !=-1 : return 5352.57924
elif fileName.find("TTToSemiLeptonic") !=-1 : return 365.34
elif fileName.find("TTToHadronic") !=-1 : return 377.96
elif fileName.find("TTJetsFXFX") !=-1 : return 831.76
elif fileName.find("TTTo2L2Nu") !=-1 : return 88.29
elif fileName.find("DYToLL_0J") !=-1 : return 4620.519036
elif fileName.find("DYToLL_2J") !=-1 : return 338.258531
elif fileName.find("DYToLL_1J") !=-1 : return 859.589402
elif fileName.find("SingleMuon")!=-1 or fileName.find("SingleElectron") !=-1 or fileName.find("JetHT") !=-1 or fileName.find("MET") !=-1 or fileName.find("MTHT") !=-1: return 1.
else:
print("Cross section not defined! Returning 0 and skipping sample:\n{}\n".format(fileName))
return 0
|
"""
--- Day 1: Report Repair ---
After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you.
The tropical island has its own currency and is entirely cash-only. The gold coins used there have a little picture of a starfish; the locals just call them stars. None of the currency exchanges seem to have heard of them, but somehow, you'll need to find fifty of these coins by the time you arrive so you can pay the deposit on your room.
To save your vacation, you need to get all fifty stars by December 25th.
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
Before you leave, the Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite adding up.
Specifically, they need you to find the two entries that sum to 2020 and then multiply those two numbers together.
For example, suppose your expense report contained the following:
1721
979
366
299
675
1456
In this list, the two entries that sum to 2020 are 1721 and 299. Multiplying them together produces 1721 * 299 = 514579, so the correct answer is 514579.
Of course, your expense report is much larger. Find the two entries that sum to 2020; what do you get if you multiply them together?
Your puzzle answer was 898299.
--- Part Two ---
The Elves in accounting are thankful for your help; one of them even offers you a starfish coin they had left over from a past vacation. They offer you a second one if you can find three numbers in your expense report that meet the same criteria.
Using the above example again, the three entries that sum to 2020 are 979, 366, and 675. Multiplying them together produces the answer, 241861950.
In your expense report, what is the product of the three entries that sum to 2020?
"""
# This solution is highly inefficient, I did it at like 11pm the night of so there are better ways to do it
data = ["1810", "1729", "1857", "1777", "1927", "1936", "1797", "1719", "1703", "1758", "1768", "2008", "1963", "1925", "1919", "1911", "1782", "2001", "1744", "1738", "1742", "1799", "1765", "1819", "1888", "127", "1880", "1984", "1697", "1760", "1680", "1951", "1745", "1817", "1704", "1736", "1969", "1705", "1690", "1848", "1885", "1912", "1982", "1895", "1959", "1769", "1722", "1807", "1901", "1983", "1993", "1871", "1795", "1955", "1921", "1934", "1743", "1899", "1942", "1964", "1034", "1952", "1851", "1716", "1800", "1771", "1945", "1877", "1917", "1930", "1970", "1948", "1914", "1767", "1910", "563", "1121", "1897", "1946", "1882", "1739", "1900", "1714", "1931", "2000", "311", "1881", "1876", "354", "1965", "1842", "1979", "1998", "1960", "1852", "1847", "1938", "1369", "1780", "1698", "1753", "1746", "1868", "1752", "1802", "1892", "1755", "1818", "1913", "1706", "1862", "326", "1941", "1926", "1809", "1879", "1815", "1939", "1859", "1999", "1947", "1898", "1794", "1737", "1971", "1977", "1944", "1812", "1905", "1359", "1788", "1754", "1774", "1825", "1748", "1701", "1791", "1786", "1692", "1894", "1961", "1902", "1849", "1967", "1770", "1987", "1831", "1728", "1896", "1805", "1733", "1918", "1731", "661", "1776", "1494", "2005", "2009", "2004", "1915", "1695", "1710", "1804", "1929", "1725", "1772", "1933", "609", "1708", "1822", "1978", "1811", "1816", "1073", "1874", "1845", "1989", "1696", "1953", "1823", "1923", "1907", "1834", "1806", "1861", "1785", "297", "1968", "1764", "1932", "1937", "1826", "1732", "1962", "1916", "1756", "1975", "1775", "1922", "1773"]
for item in data:
if item.isdigit():
item = int(item)
for sub_item in data:
if sub_item.isdigit():
sub_item = int(sub_item)
if item + sub_item == 2020:
print(f"Answer found:\n\t{item} + {sub_item} == 2020\n\t{item} * {sub_item} == {item*sub_item}") # Answer to part 1
for sub_sub_item in data:
if sub_sub_item.isdigit(): # Answer to part 2
sub_sub_item = int(sub_sub_item)
if item + sub_item + sub_sub_item == 2020:
print(f"Answer found:\n\t{item} + {sub_item} + {sub_sub_item} == 2020\n\t{item} * {sub_item} * {sub_sub_item} == {item*sub_item * sub_sub_item}")
|
# Given an array of non-negative integers,
# you are initially positioned at the first index of the array.
# Each element in the array represents your maximum jump length at that position.
# Determine if you are able to reach the last index.
# Example 1:
# Input: [2,3,1,1,4]
# Output: true
# Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.
# Example 2:
# Input: [3,2,1,0,4]
# Output: false
# Explanation: You will always arrive at index 3 no matter what. Its maximum
# jump length is 0, which makes it impossible to reach the last index.
class Solution(object):
def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
# 贪心 O(n)
# 先想一下什么时候不能够完成跳跃,在当前位置之前(包括当前位置)能够跳跃到的最远距离就是当前位置,且这时候还没有到终点;
# 什么样的情况就能保证可以跳到终点呢,只要当前最远距离超过终点即可。
# 只要当前的位置没有超过能跳到的最远距离,就可以不断的刷新最远距离来继续前进。
if not nums:
return False
length = len(nums)
index = 0
longest = nums[0]
while index <= longest:
if longest >= length - 1:
return True
longest = max(longest, index + nums[index])
index += 1
return False
|
"""
给定一个二叉树,检查它是否是镜像对称的。
例如,二叉树 [1,2,2,3,4,4,3] 是对称的。
1
/ \
2 2
/ \ / \
3 4 4 3
但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:
1
/ \
2 2
\ \
3 3
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/symmetric-tree
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def isSymmetric(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
if not root or (not root.left and not root.right):
return True
if not root.left or not root.right:
return False
def symmetricTree(p, q):
if not p and not q:
return True
if not p or not q:
return False
return (p.val == q.val) and symmetricTree(p.left, q.right) and symmetricTree(p.right, q.left)
return symmetricTree(root, root)
|
def mdc(m, n):
while m%n != 0:
oldm = m
oldn = n
m = oldn
n = oldm%oldn
return n
def mesmaFracao(f1, f2):
return (f1.getNum() == f2.getNum()) and (f1.getDen() == f2.getDen())
class Fracao:
def __init__(self, num, den):
self.__num = num
self.__den = den
def __str__(self):
return str(self.__num) + "/" + str(self.__den)
def getNum(self):
return self.__num
def getDen(self):
return self.__den
def simplifica(self):
divComum = mdc(self.__num, self.__den)
self.__num = self.__num // divComum
self.__den = self.__den // divComum
def __add__(self, outraFrac):
novoNum = self.__num * outraFrac.getDen() + self.__den * outraFrac.getNum()
novoDen = self.__den * outraFrac.getDen()
divComum = mdc(novoNum, novoDen)
novaFracao = Fracao(novoNum // divComum, novoDen//divComum)
if novaFracao.getNum() % novaFracao.getDen() == 0:
return int(novaFracao.getNum() / novaFracao.getDen())
elif novaFracao.getNum() / novaFracao.getDen() < 1:
return novaFracao
else:
parteInt = novaFracao.getNum() // novaFracao.getDen()
novoNum = novaFracao.getNum() - parteInt * novaFracao.getDen()
fracMista = FracaoMista(parteInt, novoNum, novaFracao.getDen())
return fracMista
class FracaoMista(Fracao):
def __init__(self, parteInteira, num, den):
super().__init__(num, den)
self.__parteInteira = parteInteira
def getParteInteira(self):
return self.__parteInteira
def __str__(self):
return str(self.__parteInteira) + ' ' + str(self.getNum()) + '/' + str(self.getDen())
def __add__(self, outraFrac):
parteInt = self.getParteInteira() + outraFrac.getParteInteira() #Soma da parte inteira das frações
novoNum = self.getNum() * outraFrac.getDen() + self.getDen() * outraFrac.getNum()
novoDen = self.getDen() * outraFrac.getDen()
divComum = mdc(novoNum, novoDen)
novaFracao = FracaoMista(parteInt, novoNum // divComum, novoDen//divComum) #Soma da parte fracionária
if novaFracao.getNum() % novaFracao.getDen() == 0:
return int(novaFracao.getNum() / novaFracao.getDen()) + parteInt
elif novaFracao.getNum() / novaFracao.getDen() < 1:
return novaFracao
else:
novaParteInt = novaFracao.getNum() // novaFracao.getDen()
novoNum = novaFracao.getNum() - novaParteInt * novaFracao.getDen()
fracMista = FracaoMista(novaParteInt + parteInt, novoNum, novaFracao.getDen())
return fracMista
if __name__ == "__main__":
frac1 = Fracao(7, 6) # 7/6 + 13/7 = 3 1/42
frac2 = Fracao(13, 7)
print('Fração 01 = {}'.format(frac1))
print('Fração 02 = {}'.format(frac2))
print('Soma = {}'.format(frac1 + frac2))
print("\n-=-=-=-=-=-=-=-=-=-=-=-\n")
frac1 = Fracao(1, 3) # 1/3 + 2/3 = 1
frac2 = Fracao(2, 3)
print('Fração 01 = {}'.format(frac1))
print('Fração 02 = {}'.format(frac2))
print('Soma = {}'.format(frac1 + frac2))
print("\n-=-=-=-=-=-=-=-=-=-=-=-\n")
frac1 = FracaoMista(3, 1, 2) # 3 1/2 + 4 2/3 = 8 1/6
frac2 = FracaoMista(4, 2, 3)
print('Fração 01 = {}'.format(frac1))
print('Fração 02 = {}'.format(frac2))
print('Soma = {}'.format(frac1 + frac2)) |
class WeatherAnalyzer:
def __init__(self, weathers):
weathers.sort(key=lambda x: x.temp)
self.weathers = weathers
def coldest(self):
print("Najzimniejsza temperatura panuje w mieście {}. Temperatura wynosi {}".
format(self.weathers[0].city_name, self.weathers[0].temp))
def print_all_weathers(self):
for i in self.weathers:
print(i)
|
# -*- coding: utf-8 -*-
"""
To-Do application
"""
def add(todos):
"""
Add a task
"""
task = input('New task: ')
todos.append({
'task': task,
'done': False
})
def delete(todos, index=None):
"""
Delete one or all tasks
"""
if index is not None:
del todos[index]
else:
del todos[:]
def get_printable_todos(todos):
"""
Get formatted tasks
"""
pass
def toggle_done(todos, index):
"""
Toggle a task
"""
todos[index]['done'] = not todos[index]['done']
def view(todos, index):
"""
Print tasks
"""
print('\nTo-Do list')
print('=' * 40)
def main():
"""
Main function
"""
todos = []
print('Add New tasks...')
add(todos)
add(todos)
add(todos)
print(todos)
print('\nThe Second one is toggled')
toggle_done(todos, 1)
print(todos)
print('\nThe last one is removed')
delete(todos, 2)
print(todos)
print('\nAll the todos are cleaned.')
delete(todos)
print(todos)
if __name__ == '__main__':
main()
|
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A test rule that compares two binary files.
The rule uses a Bash command (diff) on Linux/macOS/non-Windows, and a cmd.exe
command (fc.exe) on Windows (no Bash is required).
"""
def _runfiles_path(f):
if f.root.path:
return f.path[len(f.root.path) + 1:] # generated file
else:
return f.path # source file
def _diff_test_impl(ctx):
if ctx.attr.is_windows:
test_bin = ctx.actions.declare_file(ctx.label.name + "-test.bat")
ctx.actions.write(
output = test_bin,
content = """@rem Generated by diff_test.bzl, do not edit.
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set MF=%RUNFILES_MANIFEST_FILE:/=\\%
set PATH=%SYSTEMROOT%\\system32
set F1={file1}
set F2={file2}
if "!F1:~0,9!" equ "external/" (set F1=!F1:~9!) else (set F1=!TEST_WORKSPACE!/!F1!)
if "!F2:~0,9!" equ "external/" (set F2=!F2:~9!) else (set F2=!TEST_WORKSPACE!/!F2!)
for /F "tokens=2* usebackq" %%i in (`findstr.exe /l /c:"!F1! " "%MF%"`) do (
set RF1=%%i
set RF1=!RF1:/=\\!
)
if "!RF1!" equ "" (
echo>&2 ERROR: !F1! not found
exit /b 1
)
for /F "tokens=2* usebackq" %%i in (`findstr.exe /l /c:"!F2! " "%MF%"`) do (
set RF2=%%i
set RF2=!RF2:/=\\!
)
if "!RF2!" equ "" (
echo>&2 ERROR: !F2! not found
exit /b 1
)
fc.exe 2>NUL 1>NUL /B "!RF1!" "!RF2!"
if %ERRORLEVEL% neq 0 (
if %ERRORLEVEL% equ 1 (
echo>&2 FAIL: files "{file1}" and "{file2}" differ
exit /b 1
) else (
fc.exe /B "!RF1!" "!RF2!"
exit /b %errorlevel%
)
)
""".format(
file1 = _runfiles_path(ctx.file.file1),
file2 = _runfiles_path(ctx.file.file2),
),
is_executable = True,
)
else:
test_bin = ctx.actions.declare_file(ctx.label.name + "-test.sh")
ctx.actions.write(
output = test_bin,
content = r"""#!/bin/bash
set -euo pipefail
F1="{file1}"
F2="{file2}"
[[ "$F1" =~ ^external/* ]] && F1="${{F1#external/}}" || F1="$TEST_WORKSPACE/$F1"
[[ "$F2" =~ ^external/* ]] && F2="${{F2#external/}}" || F2="$TEST_WORKSPACE/$F2"
if [[ -d "${{RUNFILES_DIR:-/dev/null}}" && "${{RUNFILES_MANIFEST_ONLY:-}}" != 1 ]]; then
RF1="$RUNFILES_DIR/$F1"
RF2="$RUNFILES_DIR/$F2"
elif [[ -f "${{RUNFILES_MANIFEST_FILE:-/dev/null}}" ]]; then
RF1="$(grep -F -m1 "$F1 " "$RUNFILES_MANIFEST_FILE" | sed 's/^[^ ]* //')"
RF2="$(grep -F -m1 "$F2 " "$RUNFILES_MANIFEST_FILE" | sed 's/^[^ ]* //')"
elif [[ -f "$TEST_SRCDIR/$F1" && -f "$TEST_SRCDIR/$F2" ]]; then
RF1="$TEST_SRCDIR/$F1"
RF2="$TEST_SRCDIR/$F2"
else
echo >&2 "ERROR: could not find \"{file1}\" and \"{file2}\""
exit 1
fi
if ! diff "$RF1" "$RF2"; then
echo >&2 "FAIL: files \"{file1}\" and \"{file2}\" differ"
exit 1
fi
""".format(
file1 = _runfiles_path(ctx.file.file1),
file2 = _runfiles_path(ctx.file.file2),
),
is_executable = True,
)
return DefaultInfo(
executable = test_bin,
files = depset(direct = [test_bin]),
runfiles = ctx.runfiles(files = [test_bin, ctx.file.file1, ctx.file.file2]),
)
_diff_test = rule(
attrs = {
"file1": attr.label(
allow_single_file = True,
mandatory = True,
),
"file2": attr.label(
allow_single_file = True,
mandatory = True,
),
"is_windows": attr.bool(mandatory = True),
},
test = True,
implementation = _diff_test_impl,
)
def diff_test(name, file1, file2, **kwargs):
"""A test that compares two files.
The test succeeds if the files' contents match.
Args:
name: The name of the test rule.
file1: Label of the file to compare to <code>file2</code>.
file2: Label of the file to compare to <code>file1</code>.
**kwargs: The <a href="https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes-tests">common attributes for tests</a>.
"""
_diff_test(
name = name,
file1 = file1,
file2 = file2,
is_windows = select({
"@bazel_tools//src/conditions:host_windows": True,
"//conditions:default": False,
}),
**kwargs
)
|
class Solution:
"""
@param numbers: Give an array numbers of n integer
@param target: An integer
@return: return the sum of the three integers, the sum closest target.
"""
def threeSumClosest(self, numbers, target):
numbers.sort()
ans = None
for i in range(len(numbers)):
left, right = i + 1, len(numbers) - 1
while left < right:
sum = numbers[left] + numbers[right] + numbers[i]
if ans is None or abs(sum - target) < abs(ans - target):
ans = sum
if sum <= target:
left += 1
else:
right -= 1
return ans |
# polymorphism
# fonksiyonlarda polymorphism
# var1 = "metin"
# var2 = [1,2,3,4]
# print(len(var1))
# print(len(var2))
# def add(x,y,z=0):
# return x+y+z
# print(add(2,3))
# print(add(2,3,4))
# Class Method polymorphism
# class Azerbaycan():
# def baskent(self):
# print("Bakü Azerbaycan Başkentidir.")
# def dil(self):
# print("Türkçe")
# def type(self):
# print("Demokrasi")
# class Turkiye():
# def baskent(self):
# print("Ankara Türkiye Başkentidir.")
# def dil(self):
# print("Türkçe")
# def type(self):
# print("Demokrasi-Cumhuriyet")
# obj1 = Azerbaycan()
# obj2 = Turkiye()
# for ulke in (obj1,obj2):
# ulke.baskent()
# ulke.dil()
# ulke.type()
class A():
def __init__(self):
self.a = "A"
def imet(self):
return self.a
class B(A):
def __init__(self):
super().__init__()
self.b = "B"
def imet(self):
print(super().imet())
return self.b
obj1 = B()
print(obj1.imet())
obj1 = A()
print(obj1.imet())
|
variant = ["_clear", "_scratched", "_crystal", "_dim", "_dark", "_bright", "_ghostly", "_ethereal", "_foreboding", "_strong"]
colors = ["white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "silver", "cyan", "purple", "blue", "brown", "green", "red", "black"]
for prefix in variant:
with open("./glass" + prefix + ".json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:cube_ctm_cutout",
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./glass" + prefix + "_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:cube_ctm_translucent",
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./glass_panel" + prefix + ".json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_cutout",
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./glass_panel" + prefix + "_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_translucent",
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
##################### STAINED GLASS #########
with open("./stained_glass" + prefix + ".json", "w") as f:
q = ''
for color in colors:
q += '''"color=''' + color + '''": [{
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}
}],'''
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:cube_ctm_translucent"
},
"variants": {
''' + q[:-1] + '''
}
}
''')
with open("./stained_glass_panel" + prefix + ".json", "w") as f:
q = ''
for color in colors:
q += '''"color=''' + color + '''": [{
"textures": {
"all": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"connected_tex": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}
}],'''
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_translucent"
},
"variants": {
''' + q[:-1] + '''
}
}
''')
################# GLASS PANE ###########
with open("./glass_pane" + prefix + ".json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-item",
"textures": {
"edge" : "blocks/glass_pane_top",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_ctm"
}
},
"variants": {
"inventory": [{ "model": "planarartifice:pane/ctm_ew" }],
"east=false,north=false,south=false,west=false": [{ "model": "planarartifice:pane/post" }],
"east=false,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_n" }],
"east=true,north=false,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_e" }],
"east=false,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_s" }],
"east=false,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_w" }],
"east=true,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_ne" }],
"east=true,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_se" }],
"east=false,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sw" }],
"east=false,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_nw" }],
"east=false,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_ns" }],
"east=true,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_ew" }],
"east=true,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_nse" }],
"east=true,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sew" }],
"east=false,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsw" }],
"east=true,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_new" }],
"east=true,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsew" }]
}
}
''')
with open("./glass_pane" + prefix + "_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-item",
"textures": {
"edge" : "planarartifice:blocks/glass/glass_pane_top_rainbow",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_rainbow_ctm"
}
},
"variants": {
"inventory": [{ "model": "planarartifice:pane/ctm_ew_translucent" }],
"east=false,north=false,south=false,west=false": [{ "model": "planarartifice:pane/post_translucent" }],
"east=false,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_n_translucent" }],
"east=true,north=false,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_e_translucent" }],
"east=false,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_s_translucent" }],
"east=false,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_w_translucent" }],
"east=true,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_ne_translucent" }],
"east=true,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_se_translucent" }],
"east=false,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sw_translucent" }],
"east=false,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_nw_translucent" }],
"east=false,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_ns_translucent" }],
"east=true,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_ew_translucent" }],
"east=true,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_nse_translucent" }],
"east=true,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sew_translucent" }],
"east=false,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsw_translucent" }],
"east=true,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_new_translucent" }],
"east=true,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsew_translucent" }]
}
}
''')
############ STAINED GLASS PANE #####
with open("./stained_glass_pane" + prefix + ".json", "w") as f:
q = ''
for color in colors:
q += '''"color=''' + color + ''',east=false,north=false,south=false,west=false": [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/post_translucent" }],
"color=''' + color + ''',east=false,north=true,south=false,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_n_translucent" }],
"color=''' + color + ''',east=true,north=false,south=false,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_e_translucent" }],
"color=''' + color + ''',east=false,north=false,south=true,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_s_translucent" }],
"color=''' + color + ''',east=false,north=false,south=false,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_w_translucent" }],
"color=''' + color + ''',east=true,north=true,south=false,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_ne_translucent" }],
"color=''' + color + ''',east=true,north=false,south=true,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_se_translucent" }],
"color=''' + color + ''',east=false,north=false,south=true,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_sw_translucent" }],
"color=''' + color + ''',east=false,north=true,south=false,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_nw_translucent" }],'''
q += '''"color=''' + color + ''',east=false,north=true,south=true,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_ns_translucent" }],
"color=''' + color + ''',east=true,north=false,south=false,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_ew_translucent" }],
"color=''' + color + ''',east=true,north=true,south=true,west=false" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_nse_translucent" }],
"color=''' + color + ''',east=true,north=false,south=true,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_sew_translucent" }],
"color=''' + color + ''',east=false,north=true,south=true,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_nsw_translucent" }],
"color=''' + color + ''',east=true,north=true,south=false,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_new_translucent" }],
"color=''' + color + ''',east=true,north=true,south=true,west=true" : [{ "textures": {
"edge" : "blocks/glass_pane_top_''' + color + '''",
"pane" : "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"particle": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''",
"pane_ct": "planarartifice:blocks/glass/glass''' + prefix + '''_''' + color + '''_ctm"
}, "model": "planarartifice:pane/ctm_nsew_translucent" }],'''
f.write('''
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-item"
},
"variants": {
''' + q[:-1] + '''
}
}
''')
with open("./glass_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:cube_ctm_translucent",
"textures": {
"all": "planarartifice:blocks/glass/glass_rainbow",
"particle": "planarartifice:blocks/glass/glass_rainbow",
"connected_tex": "planarartifice:blocks/glass/glass_rainbow_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./glass_pane_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"transform": "forge:default-item",
"textures": {
"edge" : "planarartifice:blocks/glass/glass_pane_top_rainbow",
"pane" : "planarartifice:blocks/glass/glass_rainbow",
"particle": "planarartifice:blocks/glass/glass_rainbow",
"pane_ct": "planarartifice:blocks/glass/glass_rainbow_ctm"
}
},
"variants": {
"inventory": [{ "model": "planarartifice:pane/ctm_ew_translucent" }],
"east=false,north=false,south=false,west=false": [{ "model": "planarartifice:pane/post_translucent" }],
"east=false,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_n_translucent" }],
"east=true,north=false,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_e_translucent" }],
"east=false,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_s_translucent" }],
"east=false,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_w_translucent" }],
"east=true,north=true,south=false,west=false" : [{ "model": "planarartifice:pane/ctm_ne_translucent" }],
"east=true,north=false,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_se_translucent" }],
"east=false,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sw_translucent" }],
"east=false,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_nw_translucent" }],
"east=false,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_ns_translucent" }],
"east=true,north=false,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_ew_translucent" }],
"east=true,north=true,south=true,west=false" : [{ "model": "planarartifice:pane/ctm_nse_translucent" }],
"east=true,north=false,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_sew_translucent" }],
"east=false,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsw_translucent" }],
"east=true,north=true,south=false,west=true" : [{ "model": "planarartifice:pane/ctm_new_translucent" }],
"east=true,north=true,south=true,west=true" : [{ "model": "planarartifice:pane/ctm_nsew_translucent" }]
}
}
''')
with open("./glass_panel.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_cutout",
"textures": {
"all": "blocks/glass",
"particle": "blocks/glass",
"connected_tex": "blocks/glass_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./glass_panel_rainbow.json", "w") as f:
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_translucent",
"textures": {
"all": "planarartifice:blocks/glass/glass_rainbow",
"particle": "planarartifice:blocks/glass/glass_rainbow",
"connected_tex": "planarartifice:blocks/glass/glass_rainbow_ctm"
}
},
"variants": {
"normal": [{}],
"inventory": [{}]
}
}
''')
with open("./stained_glass_panel.json", "w") as f:
q = ''
for color in colors:
q += '''"color=''' + color + '''": [{
"textures": {
"all": "blocks/glass_''' + color + '''",
"particle": "blocks/glass_''' + color + '''",
"connected_tex": "blocks/glass_''' + color + '''_ctm"
}
}],'''
f.write('''
{
"forge_marker": 1,
"defaults": {
"model": "planarartifice:panel_ctm_translucent"
},
"variants": {
''' + q[:-1] + '''
}
}
''') |
[
{
'date': '2011-01-01',
'description': 'Nieuwjaarsdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2011-04-22',
'description': 'Goede Vrijdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-04-24',
'description': 'Eerste Paasdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-04-25',
'description': 'Tweede Paasdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-04-30',
'description': 'Koninginnedag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NV'
},
{
'date': '2011-05-04',
'description': 'Dodenherdenking',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'F'
},
{
'date': '2011-05-05',
'description': 'Bevrijdingsdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2011-06-02',
'description': 'Hemelvaartsdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-06-12',
'description': 'Eerste Pinksterdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-06-13',
'description': 'Tweede Pinksterdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2011-12-05',
'description': 'Sinterklaas',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'RF'
},
{
'date': '2011-12-15',
'description': 'Koninkrijksdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NV'
},
{
'date': '2011-12-25',
'description': 'Eerste Kerstdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2011-12-26',
'description': 'Tweede Kerstdag',
'locale': 'nl-NL',
'notes': '',
'region': '',
'type': 'NRF'
}
] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'liying'
class Latest(object):
def __init__(self):
self.package = None
self.latest_version = None
|
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-dgidb'
ES_DOC_TYPE = 'association'
API_PREFIX = 'dgidb'
API_VERSION = ''
|
class CSVUpperTriangularPlugin:
def input(self, filename):
infile = open(filename, 'r')
self.colnames = infile.readline().strip().split(',') # Assume rownames=colnames
self.ADJ = []
for line in infile:
self.ADJ.append(line.strip().split(',')[1:])
def run(self):
pass
def output(self, filename):
outfile = open(filename, 'w')
outfile.write("X1,X2,Value\n")
for i in range(0, len(self.ADJ)):
for j in range(0, len(self.ADJ[i])):
if (i < j):
outfile.write(self.colnames[i]+","+self.colnames[j]+","+self.ADJ[i][j]+"\n")
|
"""
Python program to remove an empty element from a list.
"""
list_in = ['Hello', 34, 45, '', 40]
# result = ['Hello', 34, 45, 40]
for item in list_in:
if not item:
list_in.remove(item)
print(list_in) |
class GithubError(Exception):
pass
class GithubAPIError(GithubError):
pass
|
"""
if the number of petals is greater than the length of the list, reduce the number of petals by the length
loop though list, checking if the number of petals is greater than the length of the list
reduce the number of petals by the length of the list after every iteration until the number is less than or equal to
length of the list, in this case: it is either 1-6
return the value at that index
"""
def how_much_i_love_you(nb_petals):
love = ["I love you", "a little", "a lot", "passionately", "madly", "not at all"]
while nb_petals > len(love):
nb_petals -= len(love)
if nb_petals in range(0, len(love)):
break
else:
continue
return love[nb_petals - 1]
def how_much_i_love_you_2(nb_petals):
return ["I love you", "a little", "a lot", "passionately", "madly", "not at all"][nb_petals % 6 - 1]
|
# Write a function to find the longest common prefix string amongst an array of strings.
class Solution(object):
def longestCommonPrefix(self, strs):
if len(strs) == 0:
return ""
standard = strs[0]
longest_length = len(standard)
for string in strs[1:]:
index = 0
while index < len(string) and index < len(standard) and string[index] == standard[index]:
index += 1
longest_length = min(index, longest_length)
return strs[0][:longest_length] |
# Copyright Notice:
# Copyright 2016-2019 DMTF. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Interface-Emulator/blob/master/LICENSE.md
# Redfish template
REDFISH_TEMPLATE = {
"@odata.context": "{rest_base}$metadata#Systems/cs_puid",
"@odata.id": "{rest_base}Systems/{cs_puid}",
"@odata.type": '#ComputerSystem.1.0.0.ComputerSystem',
"Id": None,
"Name": "WebFrontEnd483",
"SystemType": "Virtual",
"AssetTag": "Chicago-45Z-2381",
"Manufacturer": "Redfish Computers",
"Model": "3500RX",
"SKU": "8675309",
"SerialNumber": None,
"PartNumber": "224071-J23",
"Description": "Web Front End node",
"UUID": None,
"HostName":"web483",
"Status": {
"State": "Enabled",
"Health": "OK",
"HealthRollUp": "OK"
},
"IndicatorLED": "Off",
"PowerState": "On",
"Boot": {
"BootSourceOverrideEnabled": "Once",
"BootSourceOverrideTarget": "Pxe",
"BootSourceOverrideTarget@DMTF.AllowableValues": [
"None",
"Pxe",
"Floppy",
"Cd",
"Usb",
"Hdd",
"BiosSetup",
"Utilities",
"Diags",
"UefiTarget"
],
"UefiTargetBootSourceOverride": "/0x31/0x33/0x01/0x01"
},
"Oem":{},
"BiosVersion": "P79 v1.00 (09/20/2013)",
"Processors": {
"Count": 8,
"Model": "Multi-Core Intel(R) Xeon(R) processor 7xxx Series",
"Status": {
"State": "Enabled",
"Health": "OK",
"HealthRollUp": "OK"
}
},
"Memory": {
"TotalSystemMemoryGB": 16,
"Status": {
"State": "Enabled",
"Health": "OK",
"HealthRollUp": "OK"
}
},
"Links": {
"Chassis": [
{
"@odata.id": "/redfish/v1/Chassis/1"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/1"
}
],
"Processors": {
"@odata.id": "/redfish/v1/Systems/{cs_puid}/Processors"
},
"EthernetInterfaces": {
"@odata.id": "/redfish/v1/Systems/{cs_puid}/EthernetInterfaces"
},
"SimpleStorage": {
"@odata.id": "/redfish/v1/Systems/{cs_puid}/SimpleStorage"
},
"LogService": {
"@odata.id": "/redfish/v1/Systems/1/Logs"
}
},
"Actions": {
"#ComputerSystem.Reset": {
"target": "/redfish/v1/Systems/{cs_puid}/Actions/ComputerSystem.Reset",
"ResetType@DMTF.AllowableValues": [
"On",
"ForceOff",
"GracefulRestart",
"ForceRestart",
"Nmi",
"GracefulRestart",
"ForceOn",
"PushPowerButton"
]
},
"Oem": {
"http://Contoso.com/Schema/CustomTypes#Contoso.Reset": {
"target": "/redfish/v1/Systems/1/OEM/Contoso/Actions/Contoso.Reset"
}
}
},
"Oem": {
"Contoso": {
"@odata.type": "http://Contoso.com/Schema#Contoso.ComputerSystem",
"ProductionLocation": {
"FacilityName": "PacWest Production Facility",
"Country": "USA"
}
},
"Chipwise": {
"@odata.type": "http://Chipwise.com/Schema#Chipwise.ComputerSystem",
"Style": "Executive"
}
}
}
|
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
consecutive = 0
ret = 0
for i in range(len(nums) + 1):
if i == len(nums) or nums[i] == 0:
ret = max(ret, consecutive)
consecutive = 0
else:
consecutive += 1
return ret
|
""" Router memory information """
class Mem(object):
""" Router memory information """
def __init__(self, usage, total, hz, type):
self._usage = usage
self._total = total
self._hz = hz
self._type = type
def get_usage(self):
return self._usage
def get_total(self):
return self._total
def get_hz(self):
return self._hz
def get_type(self):
return self._type
def create_mem_from_json(json_entry):
return Mem(json_entry['usage'], json_entry['total'], json_entry['hz'],
json_entry['type'])
|
def get_max_increasing_sub_sequence(arr):
i = 1
n = len(arr)
j = 0
dp = arr[:]
while i < n:
while j < i:
if dp[j] < dp[i] < dp[i] + dp[j]:
dp[i] = dp[j] + dp[i]
j += 1
i += 1
return max(dp)
if __name__ == '__main__':
# arr = [1, 101, 2, 3, 100, 4, 5]
# print(get_max_increasing_sub_sequence(arr))
test_cases = int(input())
for t_case in range(test_cases):
n = map(int, input().split())
array = list(map(int, input().split()))
print(get_max_increasing_sub_sequence(array))
|
# Author : BIZZOZZERO Nicolas
# Completed on Sun, 24 Jan 2016, 22:38
#
# This program find the solution of the problem 1 of the Project Euler.
# The problem is the following :
#
# If we list all the natural numbers below 10 that are multiples of 3 or
# 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
#
# The answer to this problem is :
# 233168
def is_divisible_by(n: int, divisor: int) -> bool:
"""Return True if n is divisible by divisor, False otherwise. """
return n % divisor == 0
def main():
set_of_multiples = set()
for i in range(1001):
if is_divisible_by(i, 3) or is_divisible_by(i, 5):
set_of_multiples.add(i)
print(sum(set_of_multiples))
if __name__ == '__main__':
main()
|
# -*- coding: utf-8 -*-
########################################
# Created on Sun Feb 11 13:35:07 2018
#
# @author: guenther.wasser
########################################
#
# Problem 7:
# ----------
#
# Implement a function that meets the specifications below.
#
# def applyF_filterG(L, f, g):
# """
# Assumes L is a list of integers
# Assume functions f and g are defined for you.
# f takes in an integer, applies a function, returns another integer
# g takes in an integer, applies a Boolean function,
# returns either True or False
# Mutates L such that, for each element i originally in L, L contains
# i if g(f(i)) returns True, and no other elements
# Returns the largest element in the mutated L or -1 if the list is empty
# """
# For example, the following functions, f, g, and test code:
#
# def f(i):
# return i + 2
# def g(i):
# return i > 5
#
# L = [0, -10, 5, 6, -4]
# print(applyF_filterG(L, f, g))
# print(L)
# Should print:
#
# 6
# [5, 6]
# For this question, you will not be able to see the test cases we run.
# This problem will test your ability to come up with your own test cases.
#
# ----------
def f(i):
"""Add 2 to a value
Args:
i ([int]): integer value
Returns:
[int]: integer value
"""
return i + 2
def g(i):
"""Evaluates value to be greater than 5
Args:
i ([int]): integer value
Returns:
[bool]: True if value is greater than 5
"""
return i > 5
def applyF_filterG(L, f, g):
"""Mutates a list of integers
Mutates L such that, for each element i originally in L, L contains
i if g(f(i)) returns True, and no other elements
Decorators:
guenther.wasser
Args:
L ([list]): List of integer values
f ([function]): [description]
g ([type]): [description]
"""
newList = []
L2 = L[:]
maxValue = 0
# Empty list return -1
if len(L) == 0:
return -1
# Create new List
for i in L:
if g(f(i)):
newList.append(i)
# Alter original List
for i in L2:
if i not in newList:
L.remove(i)
# Find max value
for i in newList:
if i > maxValue:
maxValue = i
return maxValue
L = [0, -10, 5, 6, -4]
print(applyF_filterG(L, f, g))
print(L)
L = [7, -1, 3, 4, -4, 8, -9]
print(applyF_filterG(L, f, g))
print(L)
L = []
print(applyF_filterG(L, f, g))
print(L)
L = [1, 2, 3, 4, 5, 6, 7]
print(applyF_filterG(L, f, g))
print(L)
# Only 16 from 20 points earned!
|
# this file defines available actions
# reference: https://github.com/TeamFightingICE/FightingICE/blob/master/python/Feature%20Extractor%20in%20Python/action.py
class Actions:
def __init__(self):
# map digits to actions
self.actions = [
"NEUTRAL",
"STAND",
"FORWARD_WALK",
"DASH",
"BACK_STEP",
"CROUCH",
"JUMP",
"FOR_JUMP",
"BACK_JUMP",
"AIR",
"STAND_GUARD",
"CROUCH_GUARD",
"AIR_GUARD",
"STAND_GUARD_RECOV",
"CROUCH_GUARD_RECOV",
"AIR_GUARD_RECOV",
"STAND_RECOV",
"CROUCH_RECOV",
"AIR_RECOV",
"CHANGE_DOWN",
"DOWN",
"RISE",
"LANDING",
"THROW_A",
"THROW_B",
"THROW_HIT",
"THROW_SUFFER",
"STAND_A",
"STAND_B",
"CROUCH_A",
"CROUCH_B",
"AIR_A",
"AIR_B",
"AIR_DA",
"AIR_DB",
"STAND_FA",
"STAND_FB",
"CROUCH_FA",
"CROUCH_FB",
"AIR_FA",
"AIR_FB",
"AIR_UA",
"AIR_UB",
"STAND_D_DF_FA",
"STAND_D_DF_FB",
"STAND_F_D_DFA",
"STAND_F_D_DFB",
"STAND_D_DB_BA",
"STAND_D_DB_BB",
"AIR_D_DF_FA",
"AIR_D_DF_FB",
"AIR_F_D_DFA",
"AIR_F_D_DFB",
"AIR_D_DB_BA",
"AIR_D_DB_BB",
"STAND_D_DF_FC"
]
# map action to digits
self.actions_map = {
m:i for i, m in enumerate(self.actions)
}
# set number of actions
self.count = 56
assert len(self.actions) == self.count
# set other types of actions
self.actions_digits_useless = [
self.actions_map[m] for m in [
"STAND",
"AIR",
"STAND_GUARD_RECOV",
"CROUCH_GUARD_RECOV",
"AIR_GUARD_RECOV",
"STAND_RECOV",
"CROUCH_RECOV",
"AIR_RECOV",
"CHANGE_DOWN",
"DOWN",
"RISE",
"LANDING",
"THROW_HIT",
"THROW_SUFFER"
]
]
self.actions_digits_useful = [
i for i in range(self.count) if i not in self.actions_digits_useless
]
self.count_useful = len(self.actions_digits_useful)
self.actions_map_useful = {
i:self.actions[n] for i,n in enumerate(self.actions_digits_useful)
}
self.actions_digits_air = [
self.actions_map[m] for m in [
"AIR_GUARD",
"AIR_A",
"AIR_B",
"AIR_DA",
"AIR_DB",
"AIR_FA",
"AIR_FB",
"AIR_UA",
"AIR_UB",
"AIR_D_DF_FA",
"AIR_D_DF_FB",
"AIR_F_D_DFA",
"AIR_F_D_DFB",
"AIR_D_DB_BA",
"AIR_D_DB_BB"
]
]
self.actions_digits_ground = [
self.actions_map[m] for m in [
"STAND_D_DB_BA",
"BACK_STEP",
"FORWARD_WALK",
"DASH",
"JUMP",
"FOR_JUMP",
"BACK_JUMP",
"STAND_GUARD",
"CROUCH_GUARD",
"THROW_A",
"THROW_B",
"STAND_A",
"STAND_B",
"CROUCH_A",
"CROUCH_B",
"STAND_FA",
"STAND_FB",
"CROUCH_FA",
"CROUCH_FB",
"STAND_D_DF_FA",
"STAND_D_DF_FB",
"STAND_F_D_DFA",
"STAND_F_D_DFB",
"STAND_D_DB_BB"
]
] |
#!/usr/bin/python3
"""
implement strongly connected components algorithm using 'SCC.txt' adjusency
list.
Problem answer (first 5): [434821, 968, 459, 313, 211]
"""
|
'''
Created on 16-10-2012
@author: Jacek Przemieniecki
'''
class Mixture(object):
def _calc_groups(self):
self._groups = {}
groups = self._groups
tot_grps = 0
for mol in self.moles:
m_groups = self.moles[mol].get_groups()
for m_grp in m_groups:
groups[m_grp] = groups.get(m_grp, 0) + m_groups[m_grp]*self.quantities[mol]
tot_grps += m_groups[m_grp]*self.quantities[mol]
for grp in groups:
groups[grp] = groups[grp]/tot_grps
def _calc_ordered(self):
total_moles = sum(self.quantities.values())
for mol in self.moles:
self._ordered_moles.append(self.moles[mol])
self._ordered_mol_fractions.append(self.quantities[mol]/total_moles)
def _finalize(self):
self._calc_groups()
self._calc_ordered()
self._finalized = True
def __init__(self):
self.moles = {}
self.quantities = {}
self._finalized = False
self._groups = None
# Those two lists must be ordered so that moles[i]
# corresponds to quantities[i]
self._ordered_moles = []
self._ordered_mol_fractions = []
def add(self, iden, mol, amount):
if self._finalized:
raise Exception() # TODO: Exception handling
if iden in self.moles:
self.quantities[iden] += amount
else:
self.moles[iden] = mol
self.quantities[iden] = amount
def get_moles(self):
if not self._finalized:
self._finalize()
return self._ordered_moles
def get_groups(self):
if not self._finalized:
self._finalize()
return self._groups
def get_mole_fractions(self):
if not self._finalized:
self._finalize()
return self._ordered_mol_fractions |
extractable_regions = ["TextRegion",
"ImageRegion",
"LineDrawingRegion",
"GraphicRegion",
"TableRegion",
"ChartRegion",
"MapRegion",
"SeparatorRegion",
"MathsRegion",
"ChemRegion",
"MusicRegion",
"AdvertRegion",
"NoiseRegion",
"NoiseRegion",
"UnknownRegion",
"CustomRegion",
"TextLine"]
TEXT_COUNT_SUPPORTED_ELEMS = ["TextRegion", "TextLine", "Word"] |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
""" Score handler
Score operation handler"""
class Score(object):
def __init__(self, kind):
""" init about importer
This module assume about import module.
Argument of 'kind' indicates the way of judging.
In __init__, dicide what module is need."""
score_dir = kind
score_module = kind.lower()
""" Import only necessary module """
import_module = "score.%s.%s" % (score_dir, score_module)
from_list = ["Calculation, Registration"]
self.main_module = __import__(import_module, fromlist=from_list)
def calc(self, score):
score_cls = self.main_module.Calculation(score)
return score_cls.main()
def register(self, score=1):
score_reg = self.main_module.Registration(score)
score_reg.main()
def catch_total(self):
return self.main_module.Overall()
if __name__ == "__main__":
hand = Handler()
|
"""Repository rule for ROCm autoconfiguration.
`rocm_configure` depends on the following environment variables:
* `TF_NEED_ROCM`: Whether to enable building with ROCm.
* `GCC_HOST_COMPILER_PATH`: The GCC host compiler path
* `ROCM_TOOLKIT_PATH`: The path to the ROCm toolkit. Default is
`/opt/rocm`.
* `TF_ROCM_VERSION`: The version of the ROCm toolkit. If this is blank, then
use the system default.
* `TF_MIOPEN_VERSION`: The version of the MIOpen library.
* `TF_ROCM_AMDGPU_TARGETS`: The AMDGPU targets.
"""
load(
":cuda_configure.bzl",
"make_copy_dir_rule",
"make_copy_files_rule",
"to_list_of_strings",
)
load(
"//third_party/remote_config:common.bzl",
"config_repo_label",
"err_out",
"execute",
"files_exist",
"get_bash_bin",
"get_cpu_value",
"get_host_environ",
"raw_exec",
"realpath",
"which",
)
_GCC_HOST_COMPILER_PATH = "GCC_HOST_COMPILER_PATH"
_GCC_HOST_COMPILER_PREFIX = "GCC_HOST_COMPILER_PREFIX"
_ROCM_TOOLKIT_PATH = "ROCM_PATH"
_TF_ROCM_VERSION = "TF_ROCM_VERSION"
_TF_MIOPEN_VERSION = "TF_MIOPEN_VERSION"
_TF_ROCM_AMDGPU_TARGETS = "TF_ROCM_AMDGPU_TARGETS"
_TF_ROCM_CONFIG_REPO = "TF_ROCM_CONFIG_REPO"
_DEFAULT_ROCM_VERSION = ""
_DEFAULT_MIOPEN_VERSION = ""
_DEFAULT_ROCM_TOOLKIT_PATH = "/opt/rocm"
def verify_build_defines(params):
"""Verify all variables that crosstool/BUILD.rocm.tpl expects are substituted.
Args:
params: dict of variables that will be passed to the BUILD.tpl template.
"""
missing = []
for param in [
"cxx_builtin_include_directories",
"extra_no_canonical_prefixes_flags",
"host_compiler_path",
"host_compiler_prefix",
"linker_bin_path",
"unfiltered_compile_flags",
]:
if ("%{" + param + "}") not in params:
missing.append(param)
if missing:
auto_configure_fail(
"BUILD.rocm.tpl template is missing these variables: " +
str(missing) +
".\nWe only got: " +
str(params) +
".",
)
def find_cc(repository_ctx):
"""Find the C++ compiler."""
# Return a dummy value for GCC detection here to avoid error
target_cc_name = "gcc"
cc_path_envvar = _GCC_HOST_COMPILER_PATH
cc_name = target_cc_name
cc_name_from_env = get_host_environ(repository_ctx, cc_path_envvar)
if cc_name_from_env:
cc_name = cc_name_from_env
if cc_name.startswith("/"):
# Absolute path, maybe we should make this supported by our which function.
return cc_name
cc = which(repository_ctx, cc_name)
if cc == None:
fail(("Cannot find {}, either correct your path or set the {}" +
" environment variable").format(target_cc_name, cc_path_envvar))
return cc
_INC_DIR_MARKER_BEGIN = "#include <...>"
def _cxx_inc_convert(path):
"""Convert path returned by cc -E xc++ in a complete path."""
path = path.strip()
return path
def _get_cxx_inc_directories_impl(repository_ctx, cc, lang_is_cpp):
"""Compute the list of default C or C++ include directories."""
if lang_is_cpp:
lang = "c++"
else:
lang = "c"
# TODO: We pass -no-canonical-prefixes here to match the compiler flags,
# but in rocm_clang CROSSTOOL file that is a `feature` and we should
# handle the case when it's disabled and no flag is passed
result = raw_exec(repository_ctx, [
cc,
"-no-canonical-prefixes",
"-E",
"-x" + lang,
"-",
"-v",
])
stderr = err_out(result)
index1 = stderr.find(_INC_DIR_MARKER_BEGIN)
if index1 == -1:
return []
index1 = stderr.find("\n", index1)
if index1 == -1:
return []
index2 = stderr.rfind("\n ")
if index2 == -1 or index2 < index1:
return []
index2 = stderr.find("\n", index2 + 1)
if index2 == -1:
inc_dirs = stderr[index1 + 1:]
else:
inc_dirs = stderr[index1 + 1:index2].strip()
return [
str(repository_ctx.path(_cxx_inc_convert(p)))
for p in inc_dirs.split("\n")
]
def get_cxx_inc_directories(repository_ctx, cc):
"""Compute the list of default C and C++ include directories."""
# For some reason `clang -xc` sometimes returns include paths that are
# different from the ones from `clang -xc++`. (Symlink and a dir)
# So we run the compiler with both `-xc` and `-xc++` and merge resulting lists
includes_cpp = _get_cxx_inc_directories_impl(repository_ctx, cc, True)
includes_c = _get_cxx_inc_directories_impl(repository_ctx, cc, False)
includes_cpp_set = depset(includes_cpp)
return includes_cpp + [
inc
for inc in includes_c
if inc not in includes_cpp_set.to_list()
]
def auto_configure_fail(msg):
"""Output failure message when rocm configuration fails."""
red = "\033[0;31m"
no_color = "\033[0m"
fail("\n%sROCm Configuration Error:%s %s\n" % (red, no_color, msg))
def auto_configure_warning(msg):
"""Output warning message during auto configuration."""
yellow = "\033[1;33m"
no_color = "\033[0m"
print("\n%sAuto-Configuration Warning:%s %s\n" % (yellow, no_color, msg))
# END cc_configure common functions (see TODO above).
def _rocm_include_path(repository_ctx, rocm_config, bash_bin):
"""Generates the cxx_builtin_include_directory entries for rocm inc dirs.
Args:
repository_ctx: The repository context.
rocm_config: The path to the gcc host compiler.
Returns:
A string containing the Starlark string for each of the gcc
host compiler include directories, which can be added to the CROSSTOOL
file.
"""
inc_dirs = []
# Add HSA headers (needs to match $HSA_PATH)
inc_dirs.append(rocm_config.rocm_toolkit_path + "/hsa/include")
# Add HIP headers (needs to match $HIP_PATH)
inc_dirs.append(rocm_config.rocm_toolkit_path + "/hip/include")
# Add HIP-Clang headers (realpath relative to compiler binary)
rocm_toolkit_path = realpath(repository_ctx, rocm_config.rocm_toolkit_path, bash_bin)
inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/8.0/include")
inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/9.0.0/include")
inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/10.0.0/include")
inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/11.0.0/include")
# Support hcc based off clang 10.0.0 (for ROCm 3.3)
inc_dirs.append(rocm_toolkit_path + "/hcc/compiler/lib/clang/10.0.0/include/")
inc_dirs.append(rocm_toolkit_path + "/hcc/lib/clang/10.0.0/include")
# Add hcc headers
inc_dirs.append(rocm_toolkit_path + "/hcc/include")
return inc_dirs
def _enable_rocm(repository_ctx):
enable_rocm = get_host_environ(repository_ctx, "TF_NEED_ROCM")
if enable_rocm == "1":
if get_cpu_value(repository_ctx) != "Linux":
auto_configure_warning("ROCm configure is only supported on Linux")
return False
return True
return False
def _rocm_toolkit_path(repository_ctx, bash_bin):
"""Finds the rocm toolkit directory.
Args:
repository_ctx: The repository context.
Returns:
A speculative real path of the rocm toolkit install directory.
"""
rocm_toolkit_path = get_host_environ(repository_ctx, _ROCM_TOOLKIT_PATH, _DEFAULT_ROCM_TOOLKIT_PATH)
if files_exist(repository_ctx, [rocm_toolkit_path], bash_bin) != [True]:
auto_configure_fail("Cannot find rocm toolkit path.")
return rocm_toolkit_path
def _amdgpu_targets(repository_ctx, rocm_toolkit_path, bash_bin):
"""Returns a list of strings representing AMDGPU targets."""
amdgpu_targets_str = get_host_environ(repository_ctx, _TF_ROCM_AMDGPU_TARGETS)
if not amdgpu_targets_str:
cmd = "%s/bin/rocm_agent_enumerator" % rocm_toolkit_path
result = execute(repository_ctx, [bash_bin, "-c", cmd])
targets = [target for target in result.stdout.strip().split("\n") if target != "gfx000"]
amdgpu_targets_str = ",".join(targets)
amdgpu_targets = amdgpu_targets_str.split(",")
for amdgpu_target in amdgpu_targets:
if amdgpu_target[:3] != "gfx" or not amdgpu_target[3:].isdigit():
auto_configure_fail("Invalid AMDGPU target: %s" % amdgpu_target)
return amdgpu_targets
def _hipcc_env(repository_ctx):
"""Returns the environment variable string for hipcc.
Args:
repository_ctx: The repository context.
Returns:
A string containing environment variables for hipcc.
"""
hipcc_env = ""
for name in [
"HIP_CLANG_PATH",
"DEVICE_LIB_PATH",
"HIP_VDI_HOME",
"HIPCC_VERBOSE",
"HIPCC_COMPILE_FLAGS_APPEND",
"HIPPCC_LINK_FLAGS_APPEND",
"HCC_AMDGPU_TARGET",
"HIP_PLATFORM",
]:
env_value = get_host_environ(repository_ctx, name)
if env_value:
hipcc_env = (hipcc_env + " " + name + "=\"" + env_value + "\";")
return hipcc_env.strip()
def _hipcc_is_hipclang(repository_ctx, rocm_config, bash_bin):
"""Returns if hipcc is based on hip-clang toolchain.
Args:
repository_ctx: The repository context.
rocm_config: The path to the hip compiler.
bash_bin: the path to the bash interpreter
Returns:
A string "True" if hipcc is based on hip-clang toolchain.
The functions returns "False" if not (ie: based on HIP/HCC toolchain).
"""
# check user-defined hip-clang environment variables
for name in ["HIP_CLANG_PATH", "HIP_VDI_HOME"]:
if get_host_environ(repository_ctx, name):
return "True"
# grep for "HIP_COMPILER=clang" in /opt/rocm/hip/lib/.hipInfo
cmd = "grep HIP_COMPILER=clang %s/hip/lib/.hipInfo || true" % rocm_config.rocm_toolkit_path
grep_result = execute(repository_ctx, [bash_bin, "-c", cmd], empty_stdout_fine = True)
result = grep_result.stdout.strip()
if result == "HIP_COMPILER=clang":
return "True"
return "False"
def _if_hipcc_is_hipclang(repository_ctx, rocm_config, bash_bin, if_true, if_false = []):
"""
Returns either the if_true or if_false arg based on whether hipcc
is based on the hip-clang toolchain
Args :
repository_ctx: The repository context.
rocm_config: The path to the hip compiler.
if_true : value to return if hipcc is hip-clang based
if_false : value to return if hipcc is not hip-clang based
(optional, defaults to empty list)
Returns :
either the if_true arg or the of_False arg
"""
if _hipcc_is_hipclang(repository_ctx, rocm_config, bash_bin) == "True":
return if_true
return if_false
def _crosstool_verbose(repository_ctx):
"""Returns the environment variable value CROSSTOOL_VERBOSE.
Args:
repository_ctx: The repository context.
Returns:
A string containing value of environment variable CROSSTOOL_VERBOSE.
"""
return get_host_environ(repository_ctx, "CROSSTOOL_VERBOSE", "0")
def _lib_name(lib, version = "", static = False):
"""Constructs the name of a library on Linux.
Args:
lib: The name of the library, such as "hip"
version: The version of the library.
static: True the library is static or False if it is a shared object.
Returns:
The platform-specific name of the library.
"""
if static:
return "lib%s.a" % lib
else:
if version:
version = ".%s" % version
return "lib%s.so%s" % (lib, version)
def _rocm_lib_paths(repository_ctx, lib, basedir):
file_name = _lib_name(lib, version = "", static = False)
return [
repository_ctx.path("%s/lib64/%s" % (basedir, file_name)),
repository_ctx.path("%s/lib64/stubs/%s" % (basedir, file_name)),
repository_ctx.path("%s/lib/x86_64-linux-gnu/%s" % (basedir, file_name)),
repository_ctx.path("%s/lib/%s" % (basedir, file_name)),
repository_ctx.path("%s/%s" % (basedir, file_name)),
]
def _batch_files_exist(repository_ctx, libs_paths, bash_bin):
all_paths = []
for _, lib_paths in libs_paths:
for lib_path in lib_paths:
all_paths.append(lib_path)
return files_exist(repository_ctx, all_paths, bash_bin)
def _select_rocm_lib_paths(repository_ctx, libs_paths, bash_bin):
test_results = _batch_files_exist(repository_ctx, libs_paths, bash_bin)
libs = {}
i = 0
for name, lib_paths in libs_paths:
selected_path = None
for path in lib_paths:
if test_results[i] and selected_path == None:
# For each lib select the first path that exists.
selected_path = path
i = i + 1
if selected_path == None:
auto_configure_fail("Cannot find rocm library %s" % name)
libs[name] = struct(file_name = selected_path.basename, path = realpath(repository_ctx, selected_path, bash_bin))
return libs
def _find_libs(repository_ctx, rocm_config, bash_bin):
"""Returns the ROCm libraries on the system.
Args:
repository_ctx: The repository context.
rocm_config: The ROCm config as returned by _get_rocm_config
bash_bin: the path to the bash interpreter
Returns:
Map of library names to structs of filename and path
"""
libs_paths = [
(name, _rocm_lib_paths(repository_ctx, name, path))
for name, path in [
("hip_hcc", rocm_config.rocm_toolkit_path + "/hip"),
("rocblas", rocm_config.rocm_toolkit_path + "/rocblas"),
("rocfft", rocm_config.rocm_toolkit_path + "/rocfft"),
("hiprand", rocm_config.rocm_toolkit_path + "/hiprand"),
("MIOpen", rocm_config.rocm_toolkit_path + "/miopen"),
("rccl", rocm_config.rocm_toolkit_path + "/rccl"),
("hipsparse", rocm_config.rocm_toolkit_path + "/hipsparse"),
]
]
return _select_rocm_lib_paths(repository_ctx, libs_paths, bash_bin)
def _get_rocm_config(repository_ctx, bash_bin):
"""Detects and returns information about the ROCm installation on the system.
Args:
repository_ctx: The repository context.
bash_bin: the path to the path interpreter
Returns:
A struct containing the following fields:
rocm_toolkit_path: The ROCm toolkit installation directory.
amdgpu_targets: A list of the system's AMDGPU targets.
"""
rocm_toolkit_path = _rocm_toolkit_path(repository_ctx, bash_bin)
return struct(
rocm_toolkit_path = rocm_toolkit_path,
amdgpu_targets = _amdgpu_targets(repository_ctx, rocm_toolkit_path, bash_bin),
)
def _tpl_path(repository_ctx, labelname):
return repository_ctx.path(Label("//third_party/gpus/%s.tpl" % labelname))
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
if not out:
out = tpl.replace(":", "/")
repository_ctx.template(
out,
_tpl_path(repository_ctx, tpl),
substitutions,
)
_DUMMY_CROSSTOOL_BZL_FILE = """
def error_gpu_disabled():
fail("ERROR: Building with --config=rocm but TensorFlow is not configured " +
"to build with GPU support. Please re-run ./configure and enter 'Y' " +
"at the prompt to build with GPU support.")
native.genrule(
name = "error_gen_crosstool",
outs = ["CROSSTOOL"],
cmd = "echo 'Should not be run.' && exit 1",
)
native.filegroup(
name = "crosstool",
srcs = [":CROSSTOOL"],
output_licenses = ["unencumbered"],
)
"""
_DUMMY_CROSSTOOL_BUILD_FILE = """
load("//crosstool:error_gpu_disabled.bzl", "error_gpu_disabled")
error_gpu_disabled()
"""
def _create_dummy_repository(repository_ctx):
# Set up BUILD file for rocm/.
_tpl(
repository_ctx,
"rocm:build_defs.bzl",
{
"%{rocm_is_configured}": "False",
"%{rocm_extra_copts}": "[]",
"%{rocm_gpu_architectures}": "[]",
},
)
_tpl(
repository_ctx,
"rocm:BUILD",
{
"%{hip_lib}": _lib_name("hip"),
"%{rocblas_lib}": _lib_name("rocblas"),
"%{miopen_lib}": _lib_name("miopen"),
"%{rccl_lib}": _lib_name("rccl"),
"%{rocfft_lib}": _lib_name("rocfft"),
"%{hiprand_lib}": _lib_name("hiprand"),
"%{hipsparse_lib}": _lib_name("hipsparse"),
"%{copy_rules}": "",
"%{rocm_headers}": "",
},
)
# Create dummy files for the ROCm toolkit since they are still required by
# tensorflow/core/platform/default/build_config:rocm.
repository_ctx.file("rocm/hip/include/hip/hip_runtime.h", "")
# Set up rocm_config.h, which is used by
# tensorflow/stream_executor/dso_loader.cc.
_tpl(
repository_ctx,
"rocm:rocm_config.h",
{
"%{rocm_toolkit_path}": _DEFAULT_ROCM_TOOLKIT_PATH,
},
"rocm/rocm/rocm_config.h",
)
# If rocm_configure is not configured to build with GPU support, and the user
# attempts to build with --config=rocm, add a dummy build rule to intercept
# this and fail with an actionable error message.
repository_ctx.file(
"crosstool/error_gpu_disabled.bzl",
_DUMMY_CROSSTOOL_BZL_FILE,
)
repository_ctx.file("crosstool/BUILD", _DUMMY_CROSSTOOL_BUILD_FILE)
def _norm_path(path):
"""Returns a path with '/' and remove the trailing slash."""
path = path.replace("\\", "/")
if path[-1] == "/":
path = path[:-1]
return path
def _genrule(src_dir, genrule_name, command, outs):
"""Returns a string with a genrule.
Genrule executes the given command and produces the given outputs.
"""
return (
"genrule(\n" +
' name = "' +
genrule_name + '",\n' +
" outs = [\n" +
outs +
"\n ],\n" +
' cmd = """\n' +
command +
'\n """,\n' +
")\n"
)
def _compute_rocm_extra_copts(repository_ctx, amdgpu_targets):
amdgpu_target_flags = ["--amdgpu-target=" +
amdgpu_target for amdgpu_target in amdgpu_targets]
return str(amdgpu_target_flags)
def _create_local_rocm_repository(repository_ctx):
"""Creates the repository containing files set up to build with ROCm."""
tpl_paths = {labelname: _tpl_path(repository_ctx, labelname) for labelname in [
"rocm:build_defs.bzl",
"rocm:BUILD",
"crosstool:BUILD.rocm",
"crosstool:hipcc_cc_toolchain_config.bzl",
"crosstool:clang/bin/crosstool_wrapper_driver_rocm",
"rocm:rocm_config.h",
]}
bash_bin = get_bash_bin(repository_ctx)
rocm_config = _get_rocm_config(repository_ctx, bash_bin)
# Copy header and library files to execroot.
# rocm_toolkit_path
rocm_toolkit_path = rocm_config.rocm_toolkit_path
copy_rules = [
make_copy_dir_rule(
repository_ctx,
name = "rocm-include",
src_dir = rocm_toolkit_path + "/include",
out_dir = "rocm/include",
exceptions = ["gtest", "gmock"],
),
make_copy_dir_rule(
repository_ctx,
name = "rocfft-include",
src_dir = rocm_toolkit_path + "/rocfft/include",
out_dir = "rocm/include/rocfft",
),
make_copy_dir_rule(
repository_ctx,
name = "rocblas-include",
src_dir = rocm_toolkit_path + "/rocblas/include",
out_dir = "rocm/include/rocblas",
),
make_copy_dir_rule(
repository_ctx,
name = "miopen-include",
src_dir = rocm_toolkit_path + "/miopen/include",
out_dir = "rocm/include/miopen",
),
make_copy_dir_rule(
repository_ctx,
name = "rccl-include",
src_dir = rocm_toolkit_path + "/rccl/include",
out_dir = "rocm/include/rccl",
),
make_copy_dir_rule(
repository_ctx,
name = "hipsparse-include",
src_dir = rocm_toolkit_path + "/hipsparse/include",
out_dir = "rocm/include/hipsparse",
),
]
rocm_libs = _find_libs(repository_ctx, rocm_config, bash_bin)
rocm_lib_srcs = []
rocm_lib_outs = []
for lib in rocm_libs.values():
rocm_lib_srcs.append(lib.path)
rocm_lib_outs.append("rocm/lib/" + lib.file_name)
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "rocm-lib",
srcs = rocm_lib_srcs,
outs = rocm_lib_outs,
))
clang_offload_bundler_path = rocm_toolkit_path + _if_hipcc_is_hipclang(
repository_ctx,
rocm_config,
bash_bin,
"/llvm/bin/",
"/hcc/bin/",
) + "clang-offload-bundler"
# copy files mentioned in third_party/gpus/rocm/BUILD
copy_rules.append(make_copy_files_rule(
repository_ctx,
name = "rocm-bin",
srcs = [
clang_offload_bundler_path,
],
outs = [
"rocm/bin/" + "clang-offload-bundler",
],
))
# Set up BUILD file for rocm/
repository_ctx.template(
"rocm/build_defs.bzl",
tpl_paths["rocm:build_defs.bzl"],
{
"%{rocm_is_configured}": "True",
"%{rocm_extra_copts}": _compute_rocm_extra_copts(
repository_ctx,
rocm_config.amdgpu_targets,
),
"%{rocm_gpu_architectures}": str(rocm_config.amdgpu_targets),
},
)
repository_ctx.template(
"rocm/BUILD",
tpl_paths["rocm:BUILD"],
{
"%{hip_lib}": rocm_libs["hip_hcc"].file_name,
"%{rocblas_lib}": rocm_libs["rocblas"].file_name,
"%{rocfft_lib}": rocm_libs["rocfft"].file_name,
"%{hiprand_lib}": rocm_libs["hiprand"].file_name,
"%{miopen_lib}": rocm_libs["MIOpen"].file_name,
"%{rccl_lib}": rocm_libs["rccl"].file_name,
"%{hipsparse_lib}": rocm_libs["hipsparse"].file_name,
"%{copy_rules}": "\n".join(copy_rules),
"%{rocm_headers}": ('":rocm-include",\n' +
'":rocfft-include",\n' +
'":rocblas-include",\n' +
'":miopen-include",\n' +
'":rccl-include",\n' +
'":hipsparse-include",'),
},
)
# Set up crosstool/
cc = find_cc(repository_ctx)
host_compiler_includes = get_cxx_inc_directories(repository_ctx, cc)
host_compiler_prefix = get_host_environ(repository_ctx, _GCC_HOST_COMPILER_PREFIX, "/usr/bin")
rocm_defines = {}
rocm_defines["%{host_compiler_prefix}"] = host_compiler_prefix
rocm_defines["%{linker_bin_path}"] = rocm_config.rocm_toolkit_path + "/hcc/compiler/bin"
# For gcc, do not canonicalize system header paths; some versions of gcc
# pick the shortest possible path for system includes when creating the
# .d file - given that includes that are prefixed with "../" multiple
# time quickly grow longer than the root of the tree, this can lead to
# bazel's header check failing.
rocm_defines["%{extra_no_canonical_prefixes_flags}"] = "\"-fno-canonical-system-headers\""
rocm_defines["%{unfiltered_compile_flags}"] = to_list_of_strings([
"-DTENSORFLOW_USE_ROCM=1",
"-D__HIP_PLATFORM_HCC__",
"-DEIGEN_USE_HIP",
] + _if_hipcc_is_hipclang(repository_ctx, rocm_config, bash_bin, [
#
# define "TENSORFLOW_COMPILER_IS_HIP_CLANG" when we are using clang
# based hipcc to compile/build tensorflow
#
# Note that this #define should not be used to check whether or not
# tensorflow is being built with ROCm support
# (only TENSORFLOW_USE_ROCM should be used for that purpose)
#
"-DTENSORFLOW_COMPILER_IS_HIP_CLANG=1",
]))
rocm_defines["%{host_compiler_path}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
rocm_defines["%{cxx_builtin_include_directories}"] = to_list_of_strings(
host_compiler_includes + _rocm_include_path(repository_ctx, rocm_config, bash_bin),
)
verify_build_defines(rocm_defines)
# Only expand template variables in the BUILD file
repository_ctx.template(
"crosstool/BUILD",
tpl_paths["crosstool:BUILD.rocm"],
rocm_defines,
)
# No templating of cc_toolchain_config - use attributes and templatize the
# BUILD file.
repository_ctx.template(
"crosstool/cc_toolchain_config.bzl",
tpl_paths["crosstool:hipcc_cc_toolchain_config.bzl"],
)
repository_ctx.template(
"crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc",
tpl_paths["crosstool:clang/bin/crosstool_wrapper_driver_rocm"],
{
"%{cpu_compiler}": str(cc),
"%{hipcc_path}": rocm_config.rocm_toolkit_path + "/hip/bin/hipcc",
"%{hipcc_env}": _hipcc_env(repository_ctx),
"%{hipcc_is_hipclang}": _hipcc_is_hipclang(repository_ctx, rocm_config, bash_bin),
"%{rocr_runtime_path}": rocm_config.rocm_toolkit_path + "/lib",
"%{rocr_runtime_library}": "hsa-runtime64",
"%{hip_runtime_path}": rocm_config.rocm_toolkit_path + "/hip/lib",
"%{hip_runtime_library}": "hip_hcc",
"%{hcc_runtime_path}": rocm_config.rocm_toolkit_path + "/hcc/lib",
"%{hcc_runtime_library}": "mcwamp",
"%{crosstool_verbose}": _crosstool_verbose(repository_ctx),
"%{gcc_host_compiler_path}": str(cc),
},
)
# Set up rocm_config.h, which is used by
# tensorflow/stream_executor/dso_loader.cc.
repository_ctx.template(
"rocm/rocm/rocm_config.h",
tpl_paths["rocm:rocm_config.h"],
{
"%{rocm_amdgpu_targets}": ",".join(
["\"%s\"" % c for c in rocm_config.amdgpu_targets],
),
"%{rocm_toolkit_path}": rocm_config.rocm_toolkit_path,
},
)
def _create_remote_rocm_repository(repository_ctx, remote_config_repo):
"""Creates pointers to a remotely configured repo set up to build with ROCm."""
_tpl(
repository_ctx,
"rocm:build_defs.bzl",
{
"%{rocm_is_configured}": "True",
"%{rocm_extra_copts}": _compute_rocm_extra_copts(
repository_ctx,
[], #_compute_capabilities(repository_ctx)
),
},
)
repository_ctx.template(
"rocm/BUILD",
config_repo_label(remote_config_repo, "rocm:BUILD"),
{},
)
repository_ctx.template(
"rocm/build_defs.bzl",
config_repo_label(remote_config_repo, "rocm:build_defs.bzl"),
{},
)
repository_ctx.template(
"rocm/rocm/rocm_config.h",
config_repo_label(remote_config_repo, "rocm:rocm/rocm_config.h"),
{},
)
repository_ctx.template(
"crosstool/BUILD",
config_repo_label(remote_config_repo, "crosstool:BUILD"),
{},
)
repository_ctx.template(
"crosstool/cc_toolchain_config.bzl",
config_repo_label(remote_config_repo, "crosstool:cc_toolchain_config.bzl"),
{},
)
repository_ctx.template(
"crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc",
config_repo_label(remote_config_repo, "crosstool:clang/bin/crosstool_wrapper_driver_is_not_gcc"),
{},
)
def _rocm_autoconf_impl(repository_ctx):
"""Implementation of the rocm_autoconf repository rule."""
if not _enable_rocm(repository_ctx):
_create_dummy_repository(repository_ctx)
elif get_host_environ(repository_ctx, _TF_ROCM_CONFIG_REPO) != None:
_create_remote_rocm_repository(
repository_ctx,
get_host_environ(repository_ctx, _TF_ROCM_CONFIG_REPO),
)
else:
_create_local_rocm_repository(repository_ctx)
_ENVIRONS = [
_GCC_HOST_COMPILER_PATH,
_GCC_HOST_COMPILER_PREFIX,
"TF_NEED_ROCM",
_ROCM_TOOLKIT_PATH,
_TF_ROCM_VERSION,
_TF_MIOPEN_VERSION,
_TF_ROCM_AMDGPU_TARGETS,
]
remote_rocm_configure = repository_rule(
implementation = _create_local_rocm_repository,
environ = _ENVIRONS,
remotable = True,
attrs = {
"environ": attr.string_dict(),
},
)
rocm_configure = repository_rule(
implementation = _rocm_autoconf_impl,
environ = _ENVIRONS + [_TF_ROCM_CONFIG_REPO],
)
"""Detects and configures the local ROCm toolchain.
Add the following to your WORKSPACE FILE:
```python
rocm_configure(name = "local_config_rocm")
```
Args:
name: A unique name for this workspace rule.
"""
|
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
def cram_test(name, srcs, deps=[]):
for s in srcs:
testname = name + '_' + s
script = testname + '_script.sh'
gr = "_gen_" + script
# This genrule is a kludge, and at some point we should move
# to a real rule
# (http://bazel.io/docs/skylark/rules.html). What this does is
# it builds a "bash script" whose first line execs cram on the
# script. Conveniently, that first line is a comment as far as
# cram is concerned (it's not indented at all), so everything
# just works.
native.genrule(name=gr,
srcs=[s],
outs=[script],
cmd=("echo 'exec $${TEST_SRCDIR}/copybara/integration/cram " +
"--xunit-file=$$XML_OUTPUT_FILE $$0' > \"$@\" ; " +
"cat $(SRCS) >> \"$@\""),
)
native.sh_test(name=testname,
srcs=[script],
data=["//copybara/integration:cram"] + deps,
)
|
class Graph:
"""
The purpose of the class is to provide a clean way to define a graph for
a searching algorithm:
"""
def __init__(self):
self.edges = {} # dictionary of edges NODE: NEIGHBOURS
self.weights = {} # dictionary of NODES and their COSTS
self.herist={}
def neighbours(self, node):
"""
The function returns the neighbour of the node passed to it,
which is essentially the value of the key in the edges dictionary.
:params node: (string) a node in the graph
:return: (list) neighbouring nodes
"""
return self.edges[node]
def get_cost(self, from_node, to_node):
"""
Gets the cost of a connection between adjacent nodes.
:params from_node: (string) starting node
:params to_node: (string) ending node
:return: (int)
"""
return self.weights[(from_node + to_node)]
def get_h(self, node):
"""
This function will give our the heuristic from the node to goal.
:params node: (String) current node / any node
:return: (int) heuristic to the goal
"""
return self.herist[node]
if __name__ == "__main__":
# testing out the graph class
graph = Graph()
# setting up nodes and neighbours
graph.edges = {
'A': set(['B','C','D']),
'B': set(['E','F']),
'C':set(['G','H']),
'D':set(['I',"J"]),
'H':set(['K'])
}
# setting up connection costs
graph.herist={'A':3,'B':4,'C':6,'D':5,'E':3,'F':2,'G':7,'H':8,'I':6,'J':7,'K':9}
print(graph.get_h("A"))
|
#
# PySNMP MIB module RADLAN-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DHCP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:01:12 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)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint")
rnd, = mibBuilder.importSymbols("RADLAN-MIB", "rnd")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
IpAddress, Counter64, ObjectIdentity, Counter32, Gauge32, MibIdentifier, Unsigned32, ModuleIdentity, iso, TimeTicks, NotificationType, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Counter64", "ObjectIdentity", "Counter32", "Gauge32", "MibIdentifier", "Unsigned32", "ModuleIdentity", "iso", "TimeTicks", "NotificationType", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits")
DisplayString, RowStatus, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TruthValue", "TextualConvention")
rsDHCP = ModuleIdentity((1, 3, 6, 1, 4, 1, 89, 38))
rsDHCP.setRevisions(('2003-10-18 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: rsDHCP.setRevisionsDescriptions(('Initial version of this MIB.',))
if mibBuilder.loadTexts: rsDHCP.setLastUpdated('200310180000Z')
if mibBuilder.loadTexts: rsDHCP.setOrganization('')
if mibBuilder.loadTexts: rsDHCP.setContactInfo('')
if mibBuilder.loadTexts: rsDHCP.setDescription('The private MIB module definition for DHCP server support.')
rsDhcpMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 14), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rsDhcpMibVersion.setStatus('current')
if mibBuilder.loadTexts: rsDhcpMibVersion.setDescription("DHCP MIB's version, the current version is 4.")
rlDhcpRelayEnable = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 25), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpRelayEnable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayEnable.setDescription('Enable or disable the use of the DHCP relay.')
rlDhcpRelayExists = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 26), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpRelayExists.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayExists.setDescription('This variable shows whether the device can function as a DHCP Relay Agent.')
rlDhcpRelayNextServerTable = MibTable((1, 3, 6, 1, 4, 1, 89, 38, 27), )
if mibBuilder.loadTexts: rlDhcpRelayNextServerTable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayNextServerTable.setDescription('The DHCP Relay Next Servers configuration Table')
rlDhcpRelayNextServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 38, 27, 1), ).setIndexNames((0, "RADLAN-DHCP-MIB", "rlDhcpRelayNextServerIpAddr"))
if mibBuilder.loadTexts: rlDhcpRelayNextServerEntry.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayNextServerEntry.setDescription('The row definition for this table. DHCP requests are relayed to the specified next server according to their threshold values.')
rlDhcpRelayNextServerIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 27, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpRelayNextServerIpAddr.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayNextServerIpAddr.setDescription('The IPAddress of the next configuration server. DHCP Server may act as a DHCP relay if this parameter is not equal to 0.0.0.0.')
rlDhcpRelayNextServerSecThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 27, 1, 2), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpRelayNextServerSecThreshold.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayNextServerSecThreshold.setDescription('DHCP requests are relayed only if their SEC field is greater or equal to the threshold value in order to allow local DHCP Servers to answer first.')
rlDhcpRelayNextServerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 27, 1, 3), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpRelayNextServerRowStatus.setStatus('current')
if mibBuilder.loadTexts: rlDhcpRelayNextServerRowStatus.setDescription("This variable displays the validity or invalidity of the entry. Setting it to 'destroy' has the effect of rendering it inoperative. The internal effect (row removal) is implementation dependent.")
rlDhcpSrvEnable = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 30), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvEnable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvEnable.setDescription('Enable or Disable the use of the DHCP Server.')
rlDhcpSrvExists = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 31), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvExists.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvExists.setDescription('This variable shows whether the device can function as a DHCP Server.')
rlDhcpSrvDbLocation = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("nvram", 1), ("flash", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvDbLocation.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDbLocation.setDescription('Describes where DHCP Server database is stored.')
rlDhcpSrvMaxNumOfClients = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 33), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvMaxNumOfClients.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvMaxNumOfClients.setDescription('This variable shows maximum number of clients that can be supported by DHCP Server dynamic allocation.')
rlDhcpSrvDbNumOfActiveEntries = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 34), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvDbNumOfActiveEntries.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDbNumOfActiveEntries.setDescription('This variable shows number of active entries stored in database.')
rlDhcpSrvDbErase = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 35), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDbErase.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDbErase.setDescription('The value is always false. Setting this variable to true causes erasing all entries in DHCP database.')
rlDhcpSrvProbeEnable = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 36), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvProbeEnable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvProbeEnable.setDescription('Enable or Disable the use of the DHCP probe before allocating an IP address.')
rlDhcpSrvProbeTimeout = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 37), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(300, 10000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvProbeTimeout.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvProbeTimeout.setDescription('Indicates the peiod of time in milliseconds the DHCP probe will wait before issuing a new trial or deciding that no other device on the network has the IP address which DHCP considers allocating.')
rlDhcpSrvProbeRetries = MibScalar((1, 3, 6, 1, 4, 1, 89, 38, 38), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvProbeRetries.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvProbeRetries.setDescription('Indicates how many times DHCP will probe before deciding that no other device on the network has the IP address which DHCP considers allocating.')
rlDhcpSrvIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 89, 38, 45), )
if mibBuilder.loadTexts: rlDhcpSrvIpAddrTable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrTable.setDescription('Table of IP Addresses allocated by DHCP Server by static and dynamic allocations.')
rlDhcpSrvIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 38, 45, 1), ).setIndexNames((0, "RADLAN-DHCP-MIB", "rlDhcpSrvIpAddrIpAddr"))
if mibBuilder.loadTexts: rlDhcpSrvIpAddrEntry.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrEntry.setDescription('The row definition for this table. Parameters of DHCP allocated IP Addresses table.')
rlDhcpSrvIpAddrIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIpAddr.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIpAddr.setDescription('The IP address that was allocated by DHCP Server.')
rlDhcpSrvIpAddrIpNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIpNetMask.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIpNetMask.setDescription('The subnet mask associated with the IP address of this entry. The value of the mask is an IP address with all the network bits set to 1 and all the hosts bits set to 0.')
rlDhcpSrvIpAddrIdentifier = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIdentifier.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIdentifier.setDescription('Unique Identifier for client. Either physical address or DHCP Client Identifier.')
rlDhcpSrvIpAddrIdentifierType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("physAddr", 1), ("clientId", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIdentifierType.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrIdentifierType.setDescription('Identifier Type. Either physical address or DHCP Client Identifier.')
rlDhcpSrvIpAddrClnHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 5), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrClnHostName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrClnHostName.setDescription('Client Host Name. DHCP Server will use it to update DNS Server. Must be unique per client.')
rlDhcpSrvIpAddrMechanism = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("manual", 1), ("automatic", 2), ("dynamic", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrMechanism.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrMechanism.setDescription('Mechanism of allocation IP Address by DHCP Server. The only value that can be set by user is manual.')
rlDhcpSrvIpAddrAgeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrAgeTime.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrAgeTime.setDescription('Age time of the IP Address.')
rlDhcpSrvIpAddrPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrPoolName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrPoolName.setDescription('Ip address pool name. A unique name for host pool static allocation, or network pool name in case of dynamic allocation.')
rlDhcpSrvIpAddrConfParamsName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrConfParamsName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrConfParamsName.setDescription('This variable points (serves as key) to appropriate set of parameters in the DHCP Server configuration parameters table.')
rlDhcpSrvIpAddrRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 45, 1, 10), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvIpAddrRowStatus.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvIpAddrRowStatus.setDescription('The row status variable, used according to row installation and removal conventions.')
rlDhcpSrvDynamicTable = MibTable((1, 3, 6, 1, 4, 1, 89, 38, 46), )
if mibBuilder.loadTexts: rlDhcpSrvDynamicTable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicTable.setDescription("The DHCP Dynamic Server's configuration Table")
rlDhcpSrvDynamicEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 38, 46, 1), ).setIndexNames((0, "RADLAN-DHCP-MIB", "rlDhcpSrvDynamicPoolName"))
if mibBuilder.loadTexts: rlDhcpSrvDynamicEntry.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicEntry.setDescription('The row definition for this table. Parameters sent in as a DHCP Reply to DHCP Request with specified indices')
rlDhcpSrvDynamicPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicPoolName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicPoolName.setDescription('The name of DHCP dynamic addresses pool.')
rlDhcpSrvDynamicIpAddrFrom = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpAddrFrom.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpAddrFrom.setDescription('The first IP address allocated in this row.')
rlDhcpSrvDynamicIpAddrTo = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpAddrTo.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpAddrTo.setDescription('The last IP address allocated in this row.')
rlDhcpSrvDynamicIpNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 4), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpNetMask.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicIpNetMask.setDescription('The subnet mask associated with the IP addresses of this entry. The value of the mask is an IP address with all the network bits set to 1 and all the hosts bits set to 0.')
rlDhcpSrvDynamicLeaseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 5), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicLeaseTime.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicLeaseTime.setDescription('Maximum lease-time in seconds granted to a requesting DHCP client. For automatic allocation use 0xFFFFFFFF. To exclude addresses from allocation mechanism, set this value to 0.')
rlDhcpSrvDynamicProbeEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 6), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicProbeEnable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicProbeEnable.setDescription('Enable or Disable the use of the DHCP probe before allocating the address.')
rlDhcpSrvDynamicTotalNumOfAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvDynamicTotalNumOfAddr.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicTotalNumOfAddr.setDescription('Total number of addresses in space.')
rlDhcpSrvDynamicFreeNumOfAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDhcpSrvDynamicFreeNumOfAddr.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicFreeNumOfAddr.setDescription('Free number of addresses in space.')
rlDhcpSrvDynamicConfParamsName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicConfParamsName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicConfParamsName.setDescription('This variable points (serves as key) to appropriate set of parameters in the DHCP Server configuration parameters table.')
rlDhcpSrvDynamicRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 46, 1, 10), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvDynamicRowStatus.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvDynamicRowStatus.setDescription('The row status variable, used according to row installation and removal conventions.')
rlDhcpSrvConfParamsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 38, 47), )
if mibBuilder.loadTexts: rlDhcpSrvConfParamsTable.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsTable.setDescription('The DHCP Configuration Parameters Table')
rlDhcpSrvConfParamsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 38, 47, 1), ).setIndexNames((0, "RADLAN-DHCP-MIB", "rlDhcpSrvConfParamsName"))
if mibBuilder.loadTexts: rlDhcpSrvConfParamsEntry.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsEntry.setDescription('The row definition for this table. Each entry corresponds to one specific parameters set.')
rlDhcpSrvConfParamsName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsName.setDescription('This value is a unique index for the entry in the rlDhcpSrvConfParamsTable.')
rlDhcpSrvConfParamsNextServerIp = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNextServerIp.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNextServerIp.setDescription('The IP of next server for client to use in configuration process.')
rlDhcpSrvConfParamsNextServerName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNextServerName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNextServerName.setDescription('The mame of next server for client to use in configuration process.')
rlDhcpSrvConfParamsBootfileName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsBootfileName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsBootfileName.setDescription('Name of file for client to request from next server.')
rlDhcpSrvConfParamsRoutersList = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 5), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsRoutersList.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsRoutersList.setDescription("The value of option code 3, which defines default routers list. Each IP address is represented in dotted decimal notation format with ';' between them.")
rlDhcpSrvConfParamsTimeSrvList = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 6), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsTimeSrvList.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsTimeSrvList.setDescription("The value of option code 4, which defines time servers list. Each IP address is represented in dotted decimal notation format with ';' between them.")
rlDhcpSrvConfParamsDnsList = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 7), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsDnsList.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsDnsList.setDescription("The value of option code 6, which defines the list of DNSs. Each IP address is represented in dotted decimal notation format with ';' between them.")
rlDhcpSrvConfParamsDomainName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 8), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsDomainName.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsDomainName.setDescription('The value option code 15, which defines the domain name..')
rlDhcpSrvConfParamsNetbiosNameList = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNetbiosNameList.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNetbiosNameList.setDescription("The value option code 44, which defines the list of NETBios Name Servers. Each IP address is represented in dotted decimal notation format with ';' between them.")
rlDhcpSrvConfParamsNetbiosNodeType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8))).clone(namedValues=NamedValues(("b-node", 1), ("p-node", 2), ("m-node", 4), ("h-node", 8)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNetbiosNodeType.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNetbiosNodeType.setDescription('The value option code 46, which defines the NETBios node type. The option will be added only if rlDhcpSrvConfParamsNetbiosNameList is not empty.')
rlDhcpSrvConfParamsCommunity = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsCommunity.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsCommunity.setDescription('The value of site-specific option 128, which defines Community. The option will be added only if rlDhcpSrvConfParamsNmsIp is set.')
rlDhcpSrvConfParamsNmsIp = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 12), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNmsIp.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsNmsIp.setDescription('The value of site-specific option 129, which defines IP of Network Manager.')
rlDhcpSrvConfParamsOptionsList = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 13), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsOptionsList.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsOptionsList.setDescription("The sequence of option segments. Each option segment is represented by a triplet <code/length/value>. The code defines the code of each supported option. The length defines the length of each supported option. The value defines the value of the supported option. If there is a number of elements in the value field, they are divided by ','. Each element of type IP address in value field is represented in dotted decimal notation format.")
rlDhcpSrvConfParamsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 38, 47, 1, 14), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpSrvConfParamsRowStatus.setStatus('current')
if mibBuilder.loadTexts: rlDhcpSrvConfParamsRowStatus.setDescription('The row status variable, used according to row installation and removal conventions.')
mibBuilder.exportSymbols("RADLAN-DHCP-MIB", rlDhcpSrvDynamicRowStatus=rlDhcpSrvDynamicRowStatus, rlDhcpRelayEnable=rlDhcpRelayEnable, rlDhcpSrvConfParamsNetbiosNameList=rlDhcpSrvConfParamsNetbiosNameList, rlDhcpSrvDbErase=rlDhcpSrvDbErase, rlDhcpSrvConfParamsOptionsList=rlDhcpSrvConfParamsOptionsList, rlDhcpSrvIpAddrIdentifier=rlDhcpSrvIpAddrIdentifier, rlDhcpSrvConfParamsRoutersList=rlDhcpSrvConfParamsRoutersList, rlDhcpSrvDynamicLeaseTime=rlDhcpSrvDynamicLeaseTime, rlDhcpSrvDynamicTotalNumOfAddr=rlDhcpSrvDynamicTotalNumOfAddr, rlDhcpSrvDynamicIpAddrTo=rlDhcpSrvDynamicIpAddrTo, rlDhcpSrvIpAddrPoolName=rlDhcpSrvIpAddrPoolName, rlDhcpSrvConfParamsDomainName=rlDhcpSrvConfParamsDomainName, rlDhcpSrvIpAddrAgeTime=rlDhcpSrvIpAddrAgeTime, rlDhcpRelayNextServerSecThreshold=rlDhcpRelayNextServerSecThreshold, rlDhcpSrvConfParamsNextServerName=rlDhcpSrvConfParamsNextServerName, rlDhcpSrvDynamicConfParamsName=rlDhcpSrvDynamicConfParamsName, rlDhcpSrvConfParamsBootfileName=rlDhcpSrvConfParamsBootfileName, rlDhcpSrvDbLocation=rlDhcpSrvDbLocation, rlDhcpRelayNextServerTable=rlDhcpRelayNextServerTable, rlDhcpSrvIpAddrEntry=rlDhcpSrvIpAddrEntry, rlDhcpSrvIpAddrIpNetMask=rlDhcpSrvIpAddrIpNetMask, rlDhcpSrvIpAddrIdentifierType=rlDhcpSrvIpAddrIdentifierType, rlDhcpSrvConfParamsCommunity=rlDhcpSrvConfParamsCommunity, rlDhcpSrvDynamicEntry=rlDhcpSrvDynamicEntry, PYSNMP_MODULE_ID=rsDHCP, rsDHCP=rsDHCP, rlDhcpSrvIpAddrRowStatus=rlDhcpSrvIpAddrRowStatus, rlDhcpSrvConfParamsTimeSrvList=rlDhcpSrvConfParamsTimeSrvList, rlDhcpSrvConfParamsName=rlDhcpSrvConfParamsName, rlDhcpSrvConfParamsNextServerIp=rlDhcpSrvConfParamsNextServerIp, rlDhcpSrvMaxNumOfClients=rlDhcpSrvMaxNumOfClients, rlDhcpSrvEnable=rlDhcpSrvEnable, rsDhcpMibVersion=rsDhcpMibVersion, rlDhcpSrvConfParamsEntry=rlDhcpSrvConfParamsEntry, rlDhcpSrvDynamicFreeNumOfAddr=rlDhcpSrvDynamicFreeNumOfAddr, rlDhcpRelayNextServerEntry=rlDhcpRelayNextServerEntry, rlDhcpSrvIpAddrMechanism=rlDhcpSrvIpAddrMechanism, rlDhcpRelayNextServerIpAddr=rlDhcpRelayNextServerIpAddr, rlDhcpRelayNextServerRowStatus=rlDhcpRelayNextServerRowStatus, rlDhcpSrvDynamicIpAddrFrom=rlDhcpSrvDynamicIpAddrFrom, rlDhcpSrvProbeRetries=rlDhcpSrvProbeRetries, rlDhcpSrvDynamicPoolName=rlDhcpSrvDynamicPoolName, rlDhcpSrvDbNumOfActiveEntries=rlDhcpSrvDbNumOfActiveEntries, rlDhcpSrvIpAddrClnHostName=rlDhcpSrvIpAddrClnHostName, rlDhcpSrvDynamicTable=rlDhcpSrvDynamicTable, rlDhcpSrvConfParamsTable=rlDhcpSrvConfParamsTable, rlDhcpSrvDynamicProbeEnable=rlDhcpSrvDynamicProbeEnable, rlDhcpSrvProbeTimeout=rlDhcpSrvProbeTimeout, rlDhcpSrvDynamicIpNetMask=rlDhcpSrvDynamicIpNetMask, rlDhcpSrvConfParamsNetbiosNodeType=rlDhcpSrvConfParamsNetbiosNodeType, rlDhcpSrvIpAddrIpAddr=rlDhcpSrvIpAddrIpAddr, rlDhcpRelayExists=rlDhcpRelayExists, rlDhcpSrvExists=rlDhcpSrvExists, rlDhcpSrvIpAddrTable=rlDhcpSrvIpAddrTable, rlDhcpSrvConfParamsRowStatus=rlDhcpSrvConfParamsRowStatus, rlDhcpSrvConfParamsNmsIp=rlDhcpSrvConfParamsNmsIp, rlDhcpSrvIpAddrConfParamsName=rlDhcpSrvIpAddrConfParamsName, rlDhcpSrvConfParamsDnsList=rlDhcpSrvConfParamsDnsList, rlDhcpSrvProbeEnable=rlDhcpSrvProbeEnable)
|
'''
+-------------------------+
¦ 34 ¦ 21 ¦ 32 ¦ 41 ¦ 25 ¦
+----+----+----+----+-----¦
¦ 14 ¦ 42 ¦ 43 ¦ 14 ¦ 31 ¦
+----+----+----+----+-----¦
¦ 54 ¦ 45 ¦ 52 ¦ 42 ¦ 23 ¦
+----+----+----+----+-----¦
¦ 33 ¦ 15 ¦ 51 ¦ 31 ¦ 35 ¦
+----+----+----+----+-----¦
¦ 21 ¦ 52 ¦ 33 ¦ 13 ¦ 23 ¦
+-------------------------+
1. Do you like treasure hunts? In this problem you are to write a program to explore the above array for a treasure. The values in the array are clues. Each cell contains an integer between 11 and 55; for each value the ten's digit represents the row number and the unit's digit represents the column number of the cell containing the next clue. Starting in the upper left corner (at 1,1), use the clues to guide your search of the array. (The first three clues are 11, 34, 42). The treasure is a cell whose value is the same as its coordinates. Your program must first read in the treasure map data into a 5 by 5 array. Your program should output the cells it visits during its search, and a message indicating where you found the treasure.
'''
clues_array = [[34, 21, 32, 41, 25],
[14, 42, 43, 14, 31],
[54, 45, 52, 42, 23],
[33, 15, 51, 31, 35],
[21, 52, 33, 13, 23]]
# visiting locations by checking data at location
def visit_locations(row, col):
# indexing starts from 0 so, substracting 1 from col and row
clue = str(clues_array[row-1][col-1])
# checking if location contains locatin itself
if row == int(clue[0]) and col == int(clue[1]):
print(f"Treasure found at {row},{col}") # then treasure s found
return
# else print current visited location and go for visiting location present given in its data
print(f"{row},{col} visited.")
visit_locations(int(clue[0]), int(clue[1]))
visit_locations(1, 1)
|
# Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR.
numero = int(input('Digite um número: '))
if numero % 2 == 0:
print('O número {} é \033[1;34mPar\033[m.'.format(numero))
else:
print('O número {} é \033[1;34mÍmpar\033[m.'.format(numero)) |
def lerp(a, b, amount):
return (amount * a) + ((1 - amount) * b)
def smoothstep(edge0, edge1, amount):
x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0)
return x * x * (3 - 2 * x)
def smootherstep(edge0, edge1, amount):
x = clamp((amount - edge0) / (edge1 - edge0), 0.0, 1.0)
return x * x * x * (x * (x * 6 - 15) + 10)
def smoothererstep(edge0, edge1, amount):
x = clamp(amount, 0.0, 1.0)
return x^5
def clamp(x, lower_limit, upper_limit):
if (x < lower_limit):
x = lower_limit
if (x > upper_limit):
x = upper_limit
return x
def manhattan_dist(x0, y0, x1, y1):
return abs(x0 - x1) + abs(y0 - y1)
def create_hit_box(width, height):
w2 = width / 2
h2 = height / 2
return [
[-w2, -h2],
[-w2, h2],
[w2, h2],
[w2, -h2]
] |
# Time: O(n); Space: O(n)
def next_greater_element(nums1, nums2):
stack = []
d = {}
i = len(nums2) - 1
while i >= 0:
num = nums2[i]
if not stack:
d[num] = -1
stack.append(num)
i -= 1
elif stack[-1] > num:
d[num] = stack[-1]
stack.append(num)
i -= 1
else:
stack.pop()
ans = []
for num in nums1:
ans.append(d[num])
return ans
# Better implementation
def next_greater_element2(nums1, nums2):
d = {}
stack = []
for i in range(len(nums2) - 1, -1, -1):
num = nums2[i]
while stack and stack[-1] <= num:
stack.pop()
if stack:
d[num] = stack[-1]
else:
d[num] = -1
stack.append(num)
return [d[num] for num in nums1]
# Test cases:
print(next_greater_element(nums1=[4, 1, 2], nums2=[1, 3, 4, 2]))
print(next_greater_element(nums1=[2, 4], nums2=[1, 2, 3, 4]))
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
DEFAULT_HOST = '127.0.01'
DEFAULT_PORT = 3306
DEFAULT_USER_NAME = 'root'
DEFAULT_USER_PASS = 'root123'
DEFAULT_USER_LIST = 'accounts/user.list'
DEFAULT_WORD_LIST = 'accounts/word.list'
# text color in console |
# mock resource classes from peeringdb-py client
class Organization:
pass
class Facility:
pass
class Network:
pass
class InternetExchange:
pass
class InternetExchangeFacility:
pass
class InternetExchangeLan:
pass
class InternetExchangeLanPrefix:
pass
class NetworkFacility:
pass
class NetworkIXLan:
pass
class NetworkContact:
pass
|
class Player():
def __init__(self, name, start=False, ai_switch=False):
self.ai = ai_switch
self.values = {0:.5}
self.name = name
self.turn = start
self.epsilon = 1
|
CONFIG_FILE_PATH = 'TypeRacerStats/src/config.json'
ACCOUNTS_FILE_PATH = 'TypeRacerStats/src/accounts.json'
ALIASES_FILE_PATH = 'TypeRacerStats/src/commands.json'
PREFIXES_FILE_PATH = 'TypeRacerStats/src/prefixes.json'
SUPPORTERS_FILE_PATH = 'TypeRacerStats/src/supporter_colors.json'
UNIVERSES_FILE_PATH = 'TypeRacerStats/src/universes.txt'
ART_JSON = 'TypeRacerStats/src/art.json'
CLIPS_JSON = 'TypeRacerStats/src/clips.json'
DATABASE_PATH = 'TypeRacerStats/src/data/typeracer.db'
TEMPORARY_DATABASE_PATH = 'TypeRacerStats/src/data/temp.db'
TEXTS_FILE_PATH = 'TypeRacerStats/src/data/texts'
TOPTENS_JSON_FILE_PATH = 'TypeRacerStats/src/data/texts/top_ten.json'
TOPTENS_FILE_PATH = 'TypeRacerStats/src/data/texts/player_top_tens.json'
TEXTS_FILE_PATH_CSV = 'TypeRacerStats/src/data/texts/texts.csv'
MAINTAIN_PLAYERS_TXT = 'TypeRacerStats/src/data/maintain_players.txt'
CSS_COLORS = 'TypeRacerStats/src/css_colors.json'
CMAPS = 'TypeRacerStats/src/cmaps.json'
TYPERACER_RECORDS_JSON = 'TypeRacerStats/src/data/typeracer_records.json'
COUNTRY_CODES = 'TypeRacerStats/src/country_codes.json'
TEXTS_LENGTHS = 'TypeRacerStats/src/data/texts/texts.json'
TEXTS_LARGE = 'TypeRacerStats/src/data/texts/texts_large.json'
CHANGELOG = 'TypeRacerStats/src/changelog.json'
KEYMAPS_SVG = 'TypeRacerStats/src/keymap_svg.txt'
BLANK_KEYMAP = 'TypeRacerStats/src/keymap_template.json'
|
#
# PySNMP MIB module HP-ICF-VRRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-VRRP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:26 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)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection")
hpSwitch, = mibBuilder.importSymbols("HP-ICF-OID", "hpSwitch")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
ModuleIdentity, iso, Integer32, NotificationType, Counter64, Counter32, TimeTicks, Gauge32, Unsigned32, ObjectIdentity, Bits, IpAddress, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "iso", "Integer32", "NotificationType", "Counter64", "Counter32", "TimeTicks", "Gauge32", "Unsigned32", "ObjectIdentity", "Bits", "IpAddress", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TruthValue, RowStatus, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "TextualConvention", "DisplayString")
vrrpOperVrId, vrrpAssoIpAddrEntry, vrrpOperEntry = mibBuilder.importSymbols("VRRP-MIB", "vrrpOperVrId", "vrrpAssoIpAddrEntry", "vrrpOperEntry")
hpicfVrrpMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31))
hpicfVrrpMIB.setRevisions(('2012-11-15 00:00', '2013-06-12 00:00', '2012-02-22 00:00', '2010-10-20 00:00', '2010-07-28 00:00', '2009-05-19 00:00', '2008-02-20 00:00', '2007-12-12 00:00', '2007-08-22 00:00', '2005-07-14 00:00',))
if mibBuilder.loadTexts: hpicfVrrpMIB.setLastUpdated('201211150000Z')
if mibBuilder.loadTexts: hpicfVrrpMIB.setOrganization('HP Networking')
hpicfVrrpOperations = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1))
hpicfVrrpConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2))
hpicfVrrpAdminStatus = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfVrrpAdminStatus.setStatus('deprecated')
hpicfVrrpOperTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2), )
if mibBuilder.loadTexts: hpicfVrrpOperTable.setStatus('current')
hpicfVrrpOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1), )
vrrpOperEntry.registerAugmentions(("HP-ICF-VRRP-MIB", "hpicfVrrpOperEntry"))
hpicfVrrpOperEntry.setIndexNames(*vrrpOperEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfVrrpOperEntry.setStatus('current')
hpicfVrrpVrMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("owner", 1), ("backup", 2), ("uninitialized", 3))).clone('uninitialized')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrMode.setStatus('current')
hpicfVrrpVrMasterPreempt = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 2), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrMasterPreempt.setStatus('current')
hpicfVrrpVrTransferControl = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 3), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrTransferControl.setStatus('current')
hpicfVrrpVrPreemptDelayTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrPreemptDelayTime.setStatus('current')
hpicfVrrpVrControl = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("failback", 1), ("failover", 2), ("failoverWithMonitoring", 3), ("invalid", 4))).clone('invalid')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrControl.setStatus('current')
hpicfVrrpVrRespondToPing = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 2, 1, 6), TruthValue().clone('true')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpVrRespondToPing.setStatus('current')
hpicfVrrpAssoIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 3), )
if mibBuilder.loadTexts: hpicfVrrpAssoIpAddrTable.setStatus('current')
hpicfVrrpAssoIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 3, 1), )
vrrpAssoIpAddrEntry.registerAugmentions(("HP-ICF-VRRP-MIB", "hpicfVrrpAssoIpAddrEntry"))
hpicfVrrpAssoIpAddrEntry.setIndexNames(*vrrpAssoIpAddrEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfVrrpAssoIpAddrEntry.setStatus('current')
hpicfVrrpAssoIpMask = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 3, 1, 1), IpAddress().clone(hexValue="00000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpAssoIpMask.setStatus('current')
hpicfVrrpTrackTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5), )
if mibBuilder.loadTexts: hpicfVrrpTrackTable.setStatus('current')
hpicfVrrpTrackEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "VRRP-MIB", "vrrpOperVrId"), (0, "HP-ICF-VRRP-MIB", "hpicfVrrpVrTrackType"), (0, "HP-ICF-VRRP-MIB", "hpicfVrrpVrTrackEntity"))
if mibBuilder.loadTexts: hpicfVrrpTrackEntry.setStatus('current')
hpicfVrrpVrTrackType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("port", 1), ("trunk", 2), ("vlan", 3))))
if mibBuilder.loadTexts: hpicfVrrpVrTrackType.setStatus('current')
hpicfVrrpVrTrackEntity = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 255)))
if mibBuilder.loadTexts: hpicfVrrpVrTrackEntity.setStatus('current')
hpicfVrrpTrackRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfVrrpTrackRowStatus.setStatus('current')
hpicfVrrpTrackState = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("down", 0), ("up", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfVrrpTrackState.setStatus('current')
hpicfVrrpStatsTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 6), )
if mibBuilder.loadTexts: hpicfVrrpStatsTable.setStatus('current')
hpicfVrrpRespondToPing = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 7), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfVrrpRespondToPing.setStatus('deprecated')
hpicfVrrpRemoveConfig = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 8), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfVrrpRemoveConfig.setStatus('deprecated')
hpicfVrrpNonstop = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 9), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfVrrpNonstop.setStatus('deprecated')
hpicfVrrpStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 6, 1), )
vrrpOperEntry.registerAugmentions(("HP-ICF-VRRP-MIB", "hpicfVrrpStatsEntry"))
hpicfVrrpStatsEntry.setIndexNames(*vrrpOperEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfVrrpStatsEntry.setStatus('current')
hpicfVrrpStatsNearFailovers = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 1, 6, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfVrrpStatsNearFailovers.setStatus('current')
hpicfVrrpMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1))
hpicfVrrpMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2))
hpicfVrrpMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 1)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance = hpicfVrrpMIBCompliance.setStatus('deprecated')
hpicfVrrpMIBCompliance1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 2)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance1 = hpicfVrrpMIBCompliance1.setStatus('deprecated')
hpicfVrrpMIBCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 3)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpVrPingGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrPingGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance2 = hpicfVrrpMIBCompliance2.setStatus('current')
hpicfVrrpMIBCompliance3 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 4)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpNonstopGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpNonstopGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance3 = hpicfVrrpMIBCompliance3.setStatus('deprecated')
hpicfVrrpMIBCompliance4 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 5)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperationsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance4 = hpicfVrrpMIBCompliance4.setStatus('deprecated')
hpicfVrrpMIBCompliance5 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 6)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup1"), ("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance5 = hpicfVrrpMIBCompliance5.setStatus('deprecated')
hpicfVrrpMIBCompliance6 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 7)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup1"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup1"), ("HP-ICF-VRRP-MIB", "hpicfVrrpOperGroup1"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackGroup1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance6 = hpicfVrrpMIBCompliance6.setStatus('current')
hpicfVrrpMIBCompliance7 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 1, 8)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpOperationsGroup1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpMIBCompliance7 = hpicfVrrpMIBCompliance7.setStatus('current')
hpicfVrrpOperGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 1)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpAdminStatus"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrMode"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrMasterPreempt"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrTransferControl"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrPreemptDelayTime"), ("HP-ICF-VRRP-MIB", "hpicfVrrpAssoIpMask"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpOperGroup = hpicfVrrpOperGroup.setStatus('deprecated')
hpicfVrrpTrackGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 2)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpTrackRowStatus"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrControl"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpTrackGroup = hpicfVrrpTrackGroup.setStatus('deprecated')
hpicfVrrpVrPingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 3)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpVrRespondToPing"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpVrPingGroup = hpicfVrrpVrPingGroup.setStatus('current')
hpicfVrrpNonstopGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 4)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpNonstop"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpNonstopGroup = hpicfVrrpNonstopGroup.setStatus('deprecated')
hpicfVrrpOperationsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 5)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpRespondToPing"), ("HP-ICF-VRRP-MIB", "hpicfVrrpRemoveConfig"), ("HP-ICF-VRRP-MIB", "hpicfVrrpStatsNearFailovers"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpOperationsGroup = hpicfVrrpOperationsGroup.setStatus('deprecated')
hpicfVrrpTrackGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 6)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpTrackRowStatus"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrControl"), ("HP-ICF-VRRP-MIB", "hpicfVrrpTrackState"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpTrackGroup1 = hpicfVrrpTrackGroup1.setStatus('current')
hpicfVrrpOperGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 7)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpVrMode"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrMasterPreempt"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrTransferControl"), ("HP-ICF-VRRP-MIB", "hpicfVrrpVrPreemptDelayTime"), ("HP-ICF-VRRP-MIB", "hpicfVrrpAssoIpMask"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpOperGroup1 = hpicfVrrpOperGroup1.setStatus('current')
hpicfVrrpOperationsGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 31, 2, 2, 8)).setObjects(("HP-ICF-VRRP-MIB", "hpicfVrrpStatsNearFailovers"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfVrrpOperationsGroup1 = hpicfVrrpOperationsGroup1.setStatus('current')
mibBuilder.exportSymbols("HP-ICF-VRRP-MIB", hpicfVrrpVrControl=hpicfVrrpVrControl, hpicfVrrpTrackEntry=hpicfVrrpTrackEntry, hpicfVrrpVrPreemptDelayTime=hpicfVrrpVrPreemptDelayTime, hpicfVrrpTrackTable=hpicfVrrpTrackTable, hpicfVrrpVrTrackEntity=hpicfVrrpVrTrackEntity, hpicfVrrpVrTrackType=hpicfVrrpVrTrackType, hpicfVrrpAssoIpAddrTable=hpicfVrrpAssoIpAddrTable, hpicfVrrpAdminStatus=hpicfVrrpAdminStatus, hpicfVrrpAssoIpAddrEntry=hpicfVrrpAssoIpAddrEntry, hpicfVrrpVrRespondToPing=hpicfVrrpVrRespondToPing, hpicfVrrpStatsEntry=hpicfVrrpStatsEntry, hpicfVrrpRemoveConfig=hpicfVrrpRemoveConfig, hpicfVrrpOperEntry=hpicfVrrpOperEntry, hpicfVrrpOperations=hpicfVrrpOperations, hpicfVrrpMIBCompliance=hpicfVrrpMIBCompliance, hpicfVrrpTrackGroup=hpicfVrrpTrackGroup, hpicfVrrpNonstop=hpicfVrrpNonstop, PYSNMP_MODULE_ID=hpicfVrrpMIB, hpicfVrrpMIBCompliance1=hpicfVrrpMIBCompliance1, hpicfVrrpVrMasterPreempt=hpicfVrrpVrMasterPreempt, hpicfVrrpMIBCompliance5=hpicfVrrpMIBCompliance5, hpicfVrrpNonstopGroup=hpicfVrrpNonstopGroup, hpicfVrrpMIBCompliance3=hpicfVrrpMIBCompliance3, hpicfVrrpTrackGroup1=hpicfVrrpTrackGroup1, hpicfVrrpVrPingGroup=hpicfVrrpVrPingGroup, hpicfVrrpVrMode=hpicfVrrpVrMode, hpicfVrrpOperationsGroup=hpicfVrrpOperationsGroup, hpicfVrrpTrackRowStatus=hpicfVrrpTrackRowStatus, hpicfVrrpConformance=hpicfVrrpConformance, hpicfVrrpMIB=hpicfVrrpMIB, hpicfVrrpMIBCompliance6=hpicfVrrpMIBCompliance6, hpicfVrrpOperGroup1=hpicfVrrpOperGroup1, hpicfVrrpVrTransferControl=hpicfVrrpVrTransferControl, hpicfVrrpMIBCompliances=hpicfVrrpMIBCompliances, hpicfVrrpRespondToPing=hpicfVrrpRespondToPing, hpicfVrrpAssoIpMask=hpicfVrrpAssoIpMask, hpicfVrrpMIBCompliance7=hpicfVrrpMIBCompliance7, hpicfVrrpOperationsGroup1=hpicfVrrpOperationsGroup1, hpicfVrrpStatsNearFailovers=hpicfVrrpStatsNearFailovers, hpicfVrrpStatsTable=hpicfVrrpStatsTable, hpicfVrrpOperGroup=hpicfVrrpOperGroup, hpicfVrrpMIBCompliance4=hpicfVrrpMIBCompliance4, hpicfVrrpMIBGroups=hpicfVrrpMIBGroups, hpicfVrrpMIBCompliance2=hpicfVrrpMIBCompliance2, hpicfVrrpOperTable=hpicfVrrpOperTable, hpicfVrrpTrackState=hpicfVrrpTrackState)
|
def pytest_addoption(parser):
parser.addoption('--integration_tests', action='store_true', dest="integration_tests",
default=False, help="enable integration tests")
def pytest_configure(config):
if not config.option.integration_tests:
setattr(config.option, 'markexpr', 'not integration_tests')
|
class CountdownCancelAll:
def __init__(self):
self.symbol = ""
self.countdownTime = 0
@staticmethod
def json_parse(json_data):
result = CountdownCancelAll()
result.symbol = json_data.get_string("symbol")
result.countdownTime = json_data.get_int("countdownTime")
return result
|
"""Contains all variable for custom scripts"""
ENVS = {
"staging": {
"app": "sparte-staging",
"region": "osc-fr1",
},
"prod": {
"app": "sparte",
"region": "osc-secnum-fr1",
},
}
|
def fn1(a,b):
print("Subtraction=",a-b)
def fn2(c):
print(c) |
#taking values through keyboard
a,b=[int(i) for i in input('enter two numbers:').split(',')]
if(a>b):
print(a,'is big')
elif(a<b):
print(b,'is big')
else:
print('both are equal')
#taking values directly
a=5
b=3
if(a>b):
print(a,'is big')
elif(b>a):
print(b,'is big')
else:
print('both are equal') |
# -*- coding: utf-8 -*-
# 这个文件是配置文件
# 手动搜索Appfilter并保存到本地(会覆盖下面的设置,若开启,下面全部内容失效,未开工)
mannualAppfilterMode = False
# 是否输入Iconpack.xml所需内容
needIconpackXml = True
# 是是否生成Drawable.xml所需内容
needDrawableXml = True
# 是否联网获取Appfilter.xml
needAppfilterXml = True
# 设置搜索结果上限(<=128)
# 对 index.py 和 getAppfilter.py 同时使用(LoopMode)
maxResults = 10
# 是否生成主题图标文件(未开工)
needXUIIconFile = False
#------以下是getAppfilter.py的配置------#
# 循环模式,直到不输入任何内容直接回车才停止
infiniteLoop = True |
"""This file holds the payload yaml validator/definition template."""
VALIDATOR = {
"specification": {
"type": dict,
"required": True,
"childs": {
"payload": {
"type": str,
"required": True,
"allowed": "^(cmd)$",
"childs": {},
},
"type": {
"type": str,
"required": True,
"allowed": "^(revshell|bindshell)$",
"childs": {},
},
"version": {
"type": str,
"required": True,
"allowed": "^([0-9]\\.[0-9]\\.[0-9])$",
"childs": {},
},
},
},
"items": {
"type": list,
"required": True,
"childs": {
"name": {
"type": str,
"required": True,
"allowed": "^(.+)$",
"childs": {},
},
"desc": {
"type": str,
"required": True,
"allowed": "^(.+)$",
"childs": {},
},
"info": {
"type": list,
"required": True,
"childs": {},
},
"rating": {
"type": int,
"required": True,
"allowed": "^([0-9])$",
"childs": {},
},
"meta": {
"type": dict,
"required": True,
"childs": {
"author": {
"type": str,
"required": True,
"childs": {},
},
"editors": {
"type": list,
"required": True,
"childs": {},
},
"created": {
"type": str,
"required": True,
"allowed": "^([0-9]{4}-[0-9]{2}-[0-9]{2})$",
"childs": {},
},
"modified": {
"type": str,
"required": True,
"allowed": "^([0-9]{4}-[0-9]{2}-[0-9]{2})$",
"childs": {},
},
"version": {
"type": str,
"required": True,
"allowed": "^([0-9]\\.[0-9]\\.[0-9])$",
"childs": {},
},
},
},
"cmd": {
"type": dict,
"required": True,
"childs": {
"executable": {
"type": str,
"required": True,
"allowed": "^(.+)$",
"childs": {},
},
"requires": {
"type": dict,
"required": True,
"childs": {
"commands": {
"type": list,
"required": True,
"childs": {},
},
"shell_env": {
"type": list,
"required": True,
"childs": {},
},
"os": {
"type": list,
"required": True,
"childs": {},
},
},
},
},
},
"revshell": {
"type": dict,
"required": True,
"childs": {
"proto": {
"type": str,
"required": True,
"allowed": "^(tcp|udp)$",
"childs": {},
},
"shell": {
"type": str,
"required": True,
"allowed": "^(.+)$",
"childs": {},
},
"command": {
"type": (str, type(None)),
"required": True,
"allowed": "^(.+)$",
"childs": {},
},
},
},
"payload": {
"type": str,
"required": True,
"allowed": "(.*__ADDR__.*__PORT__.*|.*__PORT__.*__ADDR__.*)",
"childs": {},
},
},
},
}
|
# Define a python class to execute sequencial action during a SOT execution.
#
# Examples would be:
# attime(1800,lambda: sigset(sot.damping,0.9))
# attime(1920,lambda: sigset(sot.damping,0.1))
# attime(1920,lambda: pop(tw))
# attime(850,lambda: sigset(taskSupportSmall.controlGain,0.01))
# @attime(400)
# def action400():
# print 'toto'
#
class attimeAlways:
None
ALWAYS = attimeAlways()
class attimeStop:
None
STOP = attimeStop()
class Calendar:
def __init__(self):
self.events = dict()
self.ping = list()
# self.periodic=list()
def __repr__(self):
res = ''
for iter, funpairs in sorted(self.events.iteritems()):
res += str(iter) + ": \n"
for funpair in funpairs:
if funpair[1] == '':
res += funpair[0] + '\n'
else:
res += str(funpair[1]) + '\n'
return res
def stop(self, *args):
self.registerEvents(STOP, *args)
def registerEvent(self, iter, pairfundoc):
# if iter==ALWAYS:
# self.periodic.append(pairfundoc)
# return
if iter == STOP:
self.events[ALWAYS].remove(pairfundoc)
if iter not in self.events.keys():
self.events[iter] = list()
self.events[iter].append(pairfundoc)
def registerEvents(self, iter, *funs):
'''
3 entry types are possible: 1. only the functor. 2. a pair
(functor,doc). 3. a list of pairs (functor,doc).
'''
if len(funs) == 2 and callable(funs[0]) and isinstance(funs[1], str):
self.registerEvent(iter, (funs[0], funs[1]))
else:
for fun in funs:
if isinstance(fun, tuple):
self.registerEvent(iter, fun)
else: # assert iscallable(fun)
if 'functor' in fun.__dict__:
self.registerEvent(iter,
(fun.functor, fun.functor.__doc__))
else:
self.registerEvent(iter, (fun, fun.__doc__))
def addPing(self, f):
self.ping.append(f)
def callPing(self):
for f in self.ping:
f()
def run(self, iter, *args):
if ALWAYS in self.events:
for fun, doc in self.events[ALWAYS]:
fun(*args)
if iter in self.events:
self.callPing()
for fun, doc in self.events[iter]:
intro = "At time " + str(iter) + ": "
if doc is not None:
print(intro, doc)
else:
if fun.__doc__ is not None:
print(intro, fun.__doc__)
else:
print(intro, "Runing ", fun)
fun(*args)
def __call__(self, iterarg, *funs):
if len(funs) == 0:
return self.generatorDecorator(iterarg)
else:
self.registerEvents(iterarg, *funs)
def generatorDecorator(self, iterarg):
"""
This next calling pattern is a little bit strange. Use it to decorate
a function definition: @attime(30) def run30(): ...
"""
class calendarDeco:
iterRef = iterarg
calendarRef = self
fun = None
def __init__(selfdeco, functer):
if functer.__doc__ is None:
functer.__doc__ = "No doc fun"
if len(functer.__doc__) > 0:
selfdeco.__doc__ = functer.__doc__
selfdeco.__doc__ += " (will be run at time " + str(
selfdeco.iterRef) + ")"
selfdeco.fun = functer
selfdeco.calendarRef.registerEvents(selfdeco.iterRef, functer,
functer.__doc__)
def __call__(selfdeco, *args):
selfdeco.fun(*args)
return calendarDeco
def fastForward(self, t):
for i in range(t + 1):
self.run(i)
attime = Calendar()
sigset = (lambda s, v: s.__class__.value.__set__(s, v))
refset = (lambda mt, v: mt.__class__.ref.__set__(mt, v))
|
def flatten(lst):
if lst:
car,*cdr=lst
if isinstance(car,(list,tuple)):
if cdr: return flatten(car) + flatten(cdr)
return flatten(car)
if cdr: return [car] + flatten(cdr)
return [car]
|
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
res = []
nums.sort()
n = len(nums)
for i in range(n-2):
if i > 0 and nums[i] == nums[i-1]:
continue
j, k = i + 1, n - 1
while j < k:
_sum = nums[i] + nums[j] + nums[k]
if _sum == 0:
res.append([nums[i], nums[j], nums[k]])
j += 1
k -= 1
while j < k and nums[j] == nums[j-1]:
j += 1
while j < k and nums[k] == nums[k+1]:
k -= 1
elif _sum < 0:
j += 1
else:
k -= 1
return res |
def min_rooms_required(intervals):
'''Returns the minimum amount of rooms necessary.
Input consists of a list of time-intervals (start, stop):
>>> min_rooms_required([(10, 20), (15, 25)])
2
>>> min_rooms_required([(10, 20), (20, 30)])
1
'''
# transform intervals
# [(10, 20), (15, 25)]
# to
# [(10, 1), (15, 1), (20, -1), (25, -1)]
times = []
for interval in intervals:
start, stop = interval
assert start < stop
times.append((start, 1))
times.append((stop, -1))
times.sort()
rooms_required = 0
current_rooms_taken = 0
for _, status in times:
current_rooms_taken += status
rooms_required = max(current_rooms_taken, rooms_required)
return rooms_required
|
class Solution:
def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
intervals.sort(reverse=True,key=lambda x:(x[1],-x[0]))
# print(intervals)
slen = len(intervals)
count = slen
for i in range(slen-1):
# print(intervals[i],intervals[i+1])
if intervals[i][0]<=intervals[i+1][0] and intervals[i][1]>=intervals[i+1][1]:
# print("wh")
intervals[i+1] = intervals[i]
count-=1
return count
|
# 312. Burst Balloons
# Runtime: 8448 ms, faster than 44.62% of Python3 online submissions for Burst Balloons.
# Memory Usage: 19.9 MB, less than 38.33% of Python3 online submissions for Burst Balloons.
class Solution:
def maxCoins(self, nums: list[int]) -> int:
n = len(nums)
# Edge case
nums = [1] + nums + [1]
scores = [[0 for _ in range(len(nums))] for _ in range(len(nums))]
for i in range(n, -1, -1):
for j in range(i + 1, n + 2):
# The last burst.
for k in range(i + 1, j):
scores[i][j] = max(scores[i][j], scores[i][k] + scores[k][j] + nums[i] * nums[k] * nums[j])
return scores[0][n + 1] |
## Implementation of a recursive fibonacci series. Extremely inefficient though.
## Author: AJ
class fibonacci:
def __init__(self):
self.number = 0
self.series = []
def fib_series(self, num):
if num <=2:
if 1 not in self.series:
self.series.append(1)
#self.series = list(set(self.series))
return 1
next = self.fib_series(num-1) + self.fib_series(num-2)
if next not in self.series:
self.series.append(next)
#self.series = list(set(self.series))
return next
def print_fib_series(self):
for ele in self.series:
print(ele, end=' ')
fib = fibonacci()
num = int(input())
fib.fib_series(num)
fib.series.insert(0, 0)
fib.series.insert(1, 1)
fib.print_fib_series()
|
my_list = [('apple', 'orange', 'banana', 'grape'), (1, 2, 3)]
for item in my_list:
for child in item:
print(child, end=' ')
else:
print('遍历结束') |
#inherits , extend , override
class Employee:
def __init__(self , name , age , salary):
self.name = name
self.age = age
self.salary = salary
def work(self):
print( f"{self.name} is working..." )
class SoftwareEngineer(Employee):
def __init__(self , name , age , salary , level):
# super().__init__(name , age , salary)
super(SoftwareEngineer , self).__init__(name , age , salary)
self.level = level
def debug(self):
print( f"{self.name} is debugging..." )
def work(self):
print( f"{self.name} is coding..." )
class Designer(Employee):
def work(self):
print( f"{self.name} is designing..." )
def draw(self):
print( f"{self.name} is drawing..." )
# se = SoftwareEngineer('Hussein' , 22 , 5000 , 'Junior')
# print( se.name , se.age)
# print(se.level)
# se.work()
# se.debug()
#
# d = Designer('Lisa' , 22 , 4000)
# print( d.name , d.age)
# d.work()
# d.draw()
#polymorphism
employees = [
SoftwareEngineer('Sara' , 22 , 4445 , 'Junior'),
SoftwareEngineer('Moataz' , 22 , 9000 , 'Senior'),
Designer('Asmaa' , 20 , 9000)
]
def motivate_employees(employees):
for employee in employees:
employee.work()
motivate_employees(employees)
#Recap
#inheritance: ChildClass(BaseClass)
#inherits , extends , overrides
#super().__init__() or super(class , self).__init__()
#polymorphism
|
MODULE_CONTEXT = {'metadata':{'module':'ANUVAAD-NMT-MODELS'}}
def init():
global app_context
app_context = {
'application_context' : None
} |
class TestStackiBoxInfo:
def test_no_name(self, run_ansible_module):
result = run_ansible_module("stacki_box_info")
assert result.status == "SUCCESS"
assert result.data["changed"] == False
assert len(result.data["boxes"]) == 2
def test_with_name(self, run_ansible_module):
result = run_ansible_module("stacki_box_info", name="default")
assert result.status == "SUCCESS"
assert result.data["changed"] == False
assert len(result.data["boxes"]) == 1
assert result.data["boxes"][0]["name"] == "default"
def test_bad_name(self, run_ansible_module):
result = run_ansible_module("stacki_box_info", name="foo")
assert result.status == "FAILED!"
assert result.data["changed"] == False
assert "error" in result.data["msg"]
assert "not a valid box" in result.data["msg"]
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Indian - Purchase Report(GST)',
'version': '1.0',
'description': """GST Purchase Report""",
'category': 'Accounting',
'depends': [
'l10n_in',
'purchase',
],
'data': [
'views/report_purchase_order.xml',
],
'installable': True,
'application': False,
'auto_install': True,
}
|
# Dictionaries
# https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/python-dictionaries
# A collection of values each with their own key identifiers - like a java hashmap
ddd = dict()
ddd['age'] = 21
ddd['course'] = 182
print(ddd)
ddd['age'] = 27
print(ddd)
# Literals
jjj = {'name': 'bob', 'age': 21}
print(jjj)
# Counting occurrences
ccc = dict()
ccc['count1'] = 1
ccc['count2'] = 1
print(ccc)
ccc['count1'] = ccc['count1'] + 1
print(ccc)
# Counting names ex.
counts = dict()
names = ['bob', 'bob6', 'bob4', 'bob2', 'bob', 'bob6']
for name in names:
if name not in counts:
counts[name] = 1
else:
counts[name] += 1
print(counts)
# The get method
if name in counts:
x = counts[name]
else:
x = 0
# get returns the value for a specified key in the dictionary
x = counts.get(name, 0) # 0 is the default value
# Counting w/ get
counts = dict()
for name in names:
counts[name] = counts.get(name, 0) + 1
print(counts)
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub, actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_wait_for_process
version_added: '2.7'
short_description: Waits for a process to exist or not exist before continuing.
description:
- Waiting for a process to start or stop.
- This is useful when Windows services behave poorly and do not enumerate external dependencies in their manifest.
options:
process_name_exact:
description:
- The name of the process(es) for which to wait.
type: str
process_name_pattern:
description:
- RegEx pattern matching desired process(es).
type: str
sleep:
description:
- Number of seconds to sleep between checks.
- Only applies when waiting for a process to start. Waiting for a process to start
does not have a native non-polling mechanism. Waiting for a stop uses native PowerShell
and does not require polling.
type: int
default: 1
process_min_count:
description:
- Minimum number of process matching the supplied pattern to satisfy C(present) condition.
- Only applies to C(present).
type: int
default: 1
pid:
description:
- The PID of the process.
type: int
owner:
description:
- The owner of the process.
- Requires PowerShell version 4.0 or newer.
type: str
pre_wait_delay:
description:
- Seconds to wait before checking processes.
type: int
default: 0
post_wait_delay:
description:
- Seconds to wait after checking for processes.
type: int
default: 0
state:
description:
- When checking for a running process C(present) will block execution
until the process exists, or until the timeout has been reached.
C(absent) will block execution untile the processs no longer exists,
or until the timeout has been reached.
- When waiting for C(present), the module will return changed only if
the process was not present on the initial check but became present on
subsequent checks.
- If, while waiting for C(absent), new processes matching the supplied
pattern are started, these new processes will not be included in the
action.
type: str
default: present
choices: [ absent, present ]
timeout:
description:
- The maximum number of seconds to wait for a for a process to start or stop
before erroring out.
type: int
default: 300
author:
- Charles Crossan (@crossan007)
'''
EXAMPLES = r'''
- name: Wait 300 seconds for all Oracle VirtualBox processes to stop. (VBoxHeadless, VirtualBox, VBoxSVC)
win_wait_for_process:
process_name: 'v(irtual)?box(headless|svc)?'
state: absent
timeout: 500
- name: Wait 300 seconds for 3 instances of cmd to start, waiting 5 seconds between each check
win_wait_for_process:
process_name_exact: cmd
state: present
timeout: 500
sleep: 5
process_min_count: 3
'''
RETURN = r'''
elapsed:
description: The elapsed seconds between the start of poll and the end of the module.
returned: always
type: float
sample: 3.14159265
matched_processes:
description: List of matched processes (either stopped or started)
returned: always
type: complex
contains:
name:
description: The name of the matched process
returned: always
type: str
sample: svchost
owner:
description: The owner of the matched process
returned: when supported by PowerShell
type: str
sample: NT AUTHORITY\SYSTEM
pid:
description: The PID of the matched process
returned: always
type: int
sample: 7908
'''
|
file = 'fer2018surprise.csv'
file_path = '../data/original/'+file
new_file_path = '../data/converted/'+file
num = 0
with open(file_path, 'r') as fp:
with open(new_file_path, 'w') as fp2:
num = num + 1
line = fp.readline()
while line:
lineWithCommas = line.replace(' ', ',')
fp2.write(lineWithCommas)
line = fp.readline()
num = num+1
if num % 100 == 0:
print("Working on line", num)
print("DONE!") |
__author__ = 'BeyondSky'
class Solution:
def climbStairs_dp(self, n):
if n < 2:
return 1
steps = []
steps.append(1)
steps.append(2)
for i in range(2,n):
steps.append(steps[i-1] + steps[i-2])
return steps[n-1]
def main():
outer = Solution();
print(outer.climbStairs_dp(4))
if __name__ == "__main__":
main() |
# Maximum Erasure Value
'''
You are given an array of positive integers nums and want to erase a subarray containing unique elements. The score you get by erasing the subarray is equal to the sum of its elements.
Return the maximum score you can get by erasing exactly one subarray.
An array b is called to be a subarray of a if it forms a contiguous subsequence of a, that is, if it is equal to a[l],a[l+1],...,a[r] for some (l,r).
Example 1:
Input: nums = [4,2,4,5,6]
Output: 17
Explanation: The optimal subarray here is [2,4,5,6].
Example 2:
Input: nums = [5,2,1,2,5,2,1,2,5]
Output: 8
Explanation: The optimal subarray here is [5,2,1] or [1,2,5].
Constraints:
1 <= nums.length <= 105
1 <= nums[i] <= 104
Hide Hint #1
The main point here is for the subarray to contain unique elements for each index. Only the first subarrays starting from that index have unique elements.
Hide Hint #2
This can be solved using the two pointers technique
'''
class Solution:
def maximumUniqueSubarray(self, nums: List[int]) -> int:
res,s,e = 0,0,0
add = 0
return 1
for i in range(len(nums)):
if nums[i] not in nums[s:i]:
add = add+nums[i]
print('if')
else:
s = s+nums[s:i].index(nums[i])+1
add = sum(nums[s:i+1])
print('else')
e = i
res = max(res,add)
print(s,e,add, res)
return res
|
# class Queue(object):
# def __init__(self):
# """
# initialize your data structure here.
# """
# self.stack1 = []
# self.stack2 = []
#
#
# def push(self, x):
# """
# :type x: int
# :rtype: nothing
# """
# while len(self.stack1) > 0:
# curr = self.stack1.pop()
# self.stack2.append(curr)
# self.stack1.append(x)
# while len(self.stack2) > 0:
# curr = self.stack2.pop()
# self.stack1.append(curr)
#
# def pop(self):
# """
# :rtype: nothing
# """
# self.stack1.pop()
#
#
# def peek(self):
# """
# :rtype: int
# """
# return self.stack1[-1]
#
# def empty(self):
# """
# :rtype: bool
# """
# return len(self.stack1) == 0
class Queue(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.main_stack = []
self.temp_stack = []
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.main_stack.append(x)
def pop(self):
"""
:rtype: nothing
"""
while self.main_stack:
self.temp_stack.append(self.main_stack.pop())
ret = self.temp_stack.pop()
while self.temp_stack:
self.main_stack.append(self.temp_stack.pop())
return ret
def peek(self):
"""
:rtype: int
"""
while self.main_stack:
self.temp_stack.append(self.main_stack.pop())
ret = self.temp_stack[-1]
while self.temp_stack:
self.main_stack.append(self.temp_stack.pop())
return ret
def empty(self):
"""
:rtype: bool
"""
return len(self.main_stack) == 0
|
# --------------------------------------------------------------
class ModelSimilarity:
'''
Uses a model (e.g. Word2Vec model) to calculate the similarity between two terms.
'''
def __init__( self, model ):
self.model = model
def similarity( self, ranking_i, ranking_j ):
sim = 0.0
pairs = 0
for term_i in ranking_i:
for term_j in ranking_j:
try:
sim += self.model.similarity(term_i, term_j)
pairs += 1
except:
#print "Failed pair (%s,%s)" % (term_i,term_j)
pass
if pairs == 0:
return 0.0
return sim/pairs
# --------------------------------------------------------------
class WithinTopicMeasure:
'''
Measures within-topic coherence for a topic model, based on a set of term rankings.
'''
def __init__( self, metric ):
self.metric = metric
def evaluate_ranking( self, term_ranking ):
return self.metric.similarity( term_ranking, term_ranking )
def evaluate_rankings( self, term_rankings ):
scores = []
overall = 0.0
for topic_index in range(len(term_rankings)):
score = self.evaluate_ranking( term_rankings[topic_index] )
scores.append( score )
overall += score
overall /= len(term_rankings)
return overall
|
xs1 = ys[42:
5:
-1]
xs2 = ys[:
2:
3]
xs3 = ys[::
3]
|
# 1 - Faça um Programa que peça dois números e imprima o
# maior deles.
num1 = input("Digite um número: ")
num2 = input("Digite outro número: ")
if(num1 > num2):
print(f"O maior é {num1}")
else:
print(f"O maior é {num2}")
|
class Stack:
topNode = None
class Node:
def __init__(self, value):
self.value = value
self.nextNode = None
def __repr__(self):
return "[{}]".format(self.value)
def __init__(self, iterable):
if len(iterable) != 0:
for k in iterable:
new_node = self.Node(k)
new_node.nextNode = self.topNode
self.topNode = new_node
def __repr__(self):
lines = []
working_node = self.topNode
if working_node is None:
return "[EmptyStack]"
while working_node is not None:
lines.append(str(working_node))
working_node = working_node.nextNode
return "\n |\n".join(lines)
def peek(self):
return self.topNode.value
def push(self, value):
new_node = self.Node(value)
new_node.nextNode = self.topNode
self.topNode = new_node
def pop(self):
self.topNode = self.topNode.nextNode
def is_empty(self):
if self.topNode is None:
return True
return False
if __name__ == '__main__':
stack = Stack([3, 5])
stack.push(6)
stack.pop()
print(stack)
stack.pop()
stack.pop()
print(stack, stack.is_empty())
|
# Multicollinearity solution using VIF 26/6/19
def calculate_vif_(X, thresh=5.0):
"""
Linear variational inflation factor for multi-colinearity solutions
Removes colinear features with messages
X is patients by features DataFrame
Good idea to inspect the VIFs for all data and consider threshold changes?
Returns remaining X without the omitted features and list of VIFs
"""
features = list(range(X.shape[1]))
dropped = True
while dropped:
dropped = False
vif = [variance_inflation_factor(X.iloc[:, features].values, ix)
for ix in range(X.iloc[:, features].shape[1])]
maxloc = vif.index(max(vif))
if max(vif) > thresh:
print('dropping \'' + X.iloc[:, features].columns[maxloc] +
'\' at index: ' + str(maxloc))
print('VIF = ', vif[maxloc])
print('\n\n all VIFs = ', vif)
del features[maxloc]
dropped = True
print('Remaining features:')
print(X.columns[features])
return X.iloc[:, features], vif |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Test.Summary = 'Testing ATS active timeout'
Test.SkipUnless(
Condition.HasCurlFeature('http2')
)
ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
server = Test.MakeOriginServer("server", delay=8)
request_header = {"headers": "GET /file HTTP/1.1\r\nHost: *\r\n\r\n", "timestamp": "5678", "body": ""}
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "5678", "body": ""}
server.addResponse("sessionfile.log", request_header, response_header)
ts.addSSLfile("../tls/ssl/server.pem")
ts.addSSLfile("../tls/ssl/server.key")
ts.Disk.records_config.update({
'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.ssl.server.private_key.path': '{0}'.format(ts.Variables.SSLDir),
'proxy.config.url_remap.remap_required': 1,
'proxy.config.http.transaction_active_timeout_out': 2,
})
ts.Disk.remap_config.AddLine(
'map / http://127.0.0.1:{0}/'.format(server.Variables.Port))
ts.Disk.ssl_multicert_config.AddLine(
'dest_ip=* ssl_cert_name=server.pem ssl_key_name=server.key'
)
tr = Test.AddTestRun("tr")
tr.Processes.Default.StartBefore(server)
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.Command = 'curl -i http://127.0.0.1:{0}/file'.format(ts.Variables.port)
tr.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
tr2 = Test.AddTestRun("tr")
tr2.Processes.Default.Command = 'curl -k -i --http1.1 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
tr2.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
tr3 = Test.AddTestRun("tr")
tr3.Processes.Default.Command = 'curl -k -i --http2 https://127.0.0.1:{0}/file'.format(ts.Variables.ssl_port)
tr3.Processes.Default.Streams.stdout = Testers.ContainsExpression("Activity Timeout", "Request should fail with active timeout")
|
class take_skip:
def __init__(self, step, count):
self.step = step
self.count = count
self.start = 0
self.end = step * count
def __iter__(self):
return self
def __next__(self):
index = self.start
if index >= self.end:
raise StopIteration
self.start += self.step
return index
numbers = take_skip(10, 5)
for number in numbers:
print(number) |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
def getCommonPrefix(s1, s2):
result = []
for i in range(min(len(s1), len(s2))):
if s1[i] == s2[i]:
result.append(s1[i])
else:
break
return ''.join(result)
commonPrefix = strs[0]
for i in range(1, len(strs)):
commonPrefix = getCommonPrefix(commonPrefix, strs[i])
return commonPrefix |
n = int(input())
a = list(map(int, input().split()))
xor = a[0]
for x in a[1:]:
xor ^= x
ans = print(*[xor ^ x for x in a]) |
class DictTrafo(object):
def __init__(self, trafo_dict=None, prefix=None):
if trafo_dict is None:
trafo_dict = {}
self.trafo_dict = trafo_dict
if type(prefix) is str:
self.prefix = (prefix,)
elif type(prefix) is tuple:
self.prefix = prefix
else:
self.prefix = None
def transform(self, in_dict, trafo_dict=None, keep_none=False):
if trafo_dict is None:
trafo_dict = self.trafo_dict
res = {}
for key in trafo_dict:
val = trafo_dict[key]
tval = type(val)
# sub dict
if tval is dict:
vres = self.transform(in_dict, val)
# (callable, rel_path)
elif tval is tuple and len(val) == 2 and callable(val[0]):
rel_path = self.read_rel_path(val[1], in_dict)
vres = val[0](key, rel_path)
# a rel_path in in_dict
elif tval in (str, tuple, list):
vres = self.read_rel_path(val, in_dict)
# invalid
else:
raise ValueError("invalid type in trafo_dict: %s" + val)
if vres is not None or keep_none:
res[key] = vres
return res
def read_rel_path(self, path, in_dict):
abs_path = []
if self.prefix:
abs_path += self.prefix
if type(path) is str:
abs_path.append(path)
else:
abs_path += path
return self.read_path(abs_path, in_dict)
def read_path(self, path, in_dict):
if len(path) == 0:
return in_dict
if type(in_dict) is not dict:
return None
key = path[0]
if key in in_dict:
val = in_dict[key]
path = path[1:]
return self.read_path(path, val)
|
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Python port of legacy_unit_info.html. This is a mapping of various units
# reported by gtest perf tests to histogram units, including improvement
# direction and conversion factors.
# Note that some of the converted names don't match up exactly with the ones
# in the HTML file, as unit names are sometimes different between the two
# implementations. For example, timeDurationInMs in the JavaScript
# implementation is ms in the Python implementation.
IMPROVEMENT_DIRECTION_DONT_CARE = ''
IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER = '_smallerIsBetter'
IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER = '_biggerIsBetter'
class LegacyUnit(object):
"""Simple object for storing data to improve readability."""
def __init__(self, name, improvement_direction, conversion_factor=1):
assert improvement_direction in [
IMPROVEMENT_DIRECTION_DONT_CARE,
IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER]
self._name = name
self._improvement_direction = improvement_direction
self._conversion_factor = conversion_factor
@property
def name(self):
return self._name + self._improvement_direction
@property
def conversion_factor(self):
return self._conversion_factor
def AsTuple(self):
return self.name, self.conversion_factor
LEGACY_UNIT_INFO = {
'%': LegacyUnit('n%', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_DONT_CARE),
'Celsius': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'Hz': LegacyUnit('Hz', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'KB': LegacyUnit('sizeInBytes', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=1024),
'MB': LegacyUnit('sizeInBytes', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=(1024 * 1024)),
'ObjectsAt30FPS': LegacyUnit('unitless',
IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'available_kB': LegacyUnit('sizeInBytes',
IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER,
conversion_factor=1024),
'bit/s': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'bytes': LegacyUnit('sizeInBytes', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'chars/s': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'commit_count': LegacyUnit('count', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'count': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'coverage%': LegacyUnit('n%', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'dB': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'files': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'fps': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'frame_count': LegacyUnit('count', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'frame_time': LegacyUnit('ms', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'frames': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'garbage_collections': LegacyUnit('count',
IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'idle%': LegacyUnit('n%', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'janks': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'lines': LegacyUnit('count', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'mWh': LegacyUnit('J', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=3.6),
'milliseconds': LegacyUnit('ms', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'milliseconds-per-frame': LegacyUnit(
'ms', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'minutes': LegacyUnit('msBestFitFormat',
IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=60000),
'mips': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'mpixels_sec': LegacyUnit('unitless',
IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'ms': LegacyUnit('ms', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'mtri_sec': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'mvtx_sec': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'objects (bigger is better)': LegacyUnit(
'count', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'packets': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'percent': LegacyUnit('n%', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'points': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'ports': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'reduction%': LegacyUnit('n%', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'relocs': LegacyUnit('count', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'runs/s': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'score (bigger is better)': LegacyUnit(
'unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'seconds': LegacyUnit('ms', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=1000),
'tokens/s': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_BIGGER_IS_BETTER),
'tasks': LegacyUnit('unitless', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER),
'us': LegacyUnit('msBestFitFormat', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=0.001),
'ns': LegacyUnit('msBestFitFormat', IMPROVEMENT_DIRECTION_SMALLER_IS_BETTER,
conversion_factor=0.000001),
}
# Add duplicate units here
LEGACY_UNIT_INFO['frames-per-second'] = LEGACY_UNIT_INFO['fps']
LEGACY_UNIT_INFO['kb'] = LEGACY_UNIT_INFO['KB']
LEGACY_UNIT_INFO['ms'] = LEGACY_UNIT_INFO['milliseconds']
LEGACY_UNIT_INFO['runs_per_s'] = LEGACY_UNIT_INFO['runs/s']
LEGACY_UNIT_INFO['runs_per_second'] = LEGACY_UNIT_INFO['runs/s']
LEGACY_UNIT_INFO['score'] = LEGACY_UNIT_INFO['score (bigger is better)']
LEGACY_UNIT_INFO['score_(bigger_is_better)'] = LEGACY_UNIT_INFO['score']
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.