content
stringlengths
7
1.05M
# Leo colorizer control file for factor mode. # This file is in the public domain. # Properties for factor mode. properties = { "commentEnd": ")", "commentStart": "(", "doubleBracketIndent": "true", "indentCloseBrackets": "]", "indentNextLines": "^(\\*<<|:).*", "indentOpenBrackets": "[", "lineComment": "!", "lineUpClosingBracket": "true", "noWordSep": "+-*=><;.?/'", } # Attributes dict for factor_main ruleset. factor_main_attributes_dict = { "default": "null", "digit_re": "-?\\d+([./]\\d+)?", "escape": "\\", "highlight_digits": "true", "ignore_case": "false", "no_word_sep": "+-*=><;.?/'", } # Attributes dict for factor_stack_effect ruleset. factor_stack_effect_attributes_dict = { "default": "COMMENT4", "digit_re": "-?\\d+([./]\\d+)?", "escape": "\\", "highlight_digits": "true", "ignore_case": "false", "no_word_sep": "+-*=><;.?/'", } # Dictionary of attributes dictionaries for factor mode. attributesDictDict = { "factor_main": factor_main_attributes_dict, "factor_stack_effect": factor_stack_effect_attributes_dict, } # Keywords dict for factor_main ruleset. factor_main_keywords_dict = { "#{": "operator", "--": "label", ";": "markup", "<": "label", ">": "label", "[": "operator", "]": "operator", "f": "literal4", "r": "keyword1", "t": "literal3", "{": "operator", "|": "operator", "}": "operator", "~": "label", } # Keywords dict for factor_stack_effect ruleset. factor_stack_effect_keywords_dict = {} # Dictionary of keywords dictionaries for factor mode. keywordsDictDict = { "factor_main": factor_main_keywords_dict, "factor_stack_effect": factor_stack_effect_keywords_dict, } # Rules for factor_main ruleset. def factor_rule0(colorer, s, i): return colorer.match_eol_span(s, i, kind="comment2", seq="#!", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="", exclude_match=False) def factor_rule1(colorer, s, i): return colorer.match_eol_span(s, i, kind="comment1", seq="!", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="", exclude_match=False) def factor_rule2(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="markup", regexp=":\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule3(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="markup", regexp="IN:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule4(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="markup", regexp="USE:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule5(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="markup", regexp="DEFER:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule6(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="markup", regexp="POSTPONE:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule7(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="literal2", regexp="CHAR:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule8(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="literal2", regexp="BIN:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule9(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="literal2", regexp="OCT:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule10(colorer, s, i): return colorer.match_seq_regexp(s, i, kind="literal2", regexp="HEX:\\s+(\\S+)", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") def factor_rule11(colorer, s, i): return colorer.match_span(s, i, kind="comment3", begin="(", end=")", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="factor::stack_effect",exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False) def factor_rule12(colorer, s, i): return colorer.match_span(s, i, kind="literal1", begin="\"", end="\"", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="",exclude_match=False, no_escape=False, no_line_break=True, no_word_break=False) def factor_rule13(colorer, s, i): return colorer.match_keywords(s, i) # Rules dict for factor_main ruleset. rulesDict1 = { "!": [factor_rule1,], "\"": [factor_rule12,], "#": [factor_rule0,factor_rule13,], "(": [factor_rule11,], "-": [factor_rule13,], "0": [factor_rule13,], "1": [factor_rule13,], "2": [factor_rule13,], "3": [factor_rule13,], "4": [factor_rule13,], "5": [factor_rule13,], "6": [factor_rule13,], "7": [factor_rule13,], "8": [factor_rule13,], "9": [factor_rule13,], ":": [factor_rule2,], ";": [factor_rule13,], "<": [factor_rule13,], ">": [factor_rule13,], "@": [factor_rule13,], "A": [factor_rule13,], "B": [factor_rule8,factor_rule13,], "C": [factor_rule7,factor_rule13,], "D": [factor_rule5,factor_rule13,], "E": [factor_rule13,], "F": [factor_rule13,], "G": [factor_rule13,], "H": [factor_rule10,factor_rule13,], "I": [factor_rule3,factor_rule13,], "J": [factor_rule13,], "K": [factor_rule13,], "L": [factor_rule13,], "M": [factor_rule13,], "N": [factor_rule13,], "O": [factor_rule9,factor_rule13,], "P": [factor_rule6,factor_rule13,], "Q": [factor_rule13,], "R": [factor_rule13,], "S": [factor_rule13,], "T": [factor_rule13,], "U": [factor_rule4,factor_rule13,], "V": [factor_rule13,], "W": [factor_rule13,], "X": [factor_rule13,], "Y": [factor_rule13,], "Z": [factor_rule13,], "[": [factor_rule13,], "]": [factor_rule13,], "a": [factor_rule13,], "b": [factor_rule13,], "c": [factor_rule13,], "d": [factor_rule13,], "e": [factor_rule13,], "f": [factor_rule13,], "g": [factor_rule13,], "h": [factor_rule13,], "i": [factor_rule13,], "j": [factor_rule13,], "k": [factor_rule13,], "l": [factor_rule13,], "m": [factor_rule13,], "n": [factor_rule13,], "o": [factor_rule13,], "p": [factor_rule13,], "q": [factor_rule13,], "r": [factor_rule13,], "s": [factor_rule13,], "t": [factor_rule13,], "u": [factor_rule13,], "v": [factor_rule13,], "w": [factor_rule13,], "x": [factor_rule13,], "y": [factor_rule13,], "z": [factor_rule13,], "{": [factor_rule13,], "|": [factor_rule13,], "}": [factor_rule13,], "~": [factor_rule13,], } # Rules for factor_stack_effect ruleset. def factor_rule14(colorer, s, i): return colorer.match_seq(s, i, kind="comment3", seq="--", at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate="") # Rules dict for factor_stack_effect ruleset. rulesDict2 = { "-": [factor_rule14,], } # x.rulesDictDict for factor mode. rulesDictDict = { "factor_main": rulesDict1, "factor_stack_effect": rulesDict2, } # Import dict for factor mode. importDict = {}
#%% """ - Lonely Pixel I - https://leetcode.com/problems/lonely-pixel-i/ - Medium """ #%% """ Given a picture consisting of black and white pixels, find the number of black lonely pixels. The picture is represented by a 2D char array consisting of 'B' and 'W', which means black and white pixels respectively. A black lonely pixel is character 'B' that located at a specific position where the same row and same column don't have any other black pixels. Example: Input: [['W', 'W', 'B'], ['W', 'B', 'W'], ['B', 'W', 'W']] Output: 3 Explanation: All the three 'B's are black lonely pixels. Note: The range of width and height of the input 2D array is [1,500]. """ #%% class S1: def findLonelyPixel(self, picture): return sum(col.count('B') == 1 == picture[col.index('B')].count('B') for col in zip(*picture))
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2022/2/9 17:05 # @Author : Gene Jiang # @File : dict_changan_vehicle.py # @Description: vehicles = [ { "Year": 2021, "Model": "UNI", "Series": "UNI-V", "Make": "Changan" }, { "Year": 2021, "Model": "UNI", "Series": "UNI-K iDD", "Make": "Changan" }, { "Year": 2021, "Model": "UNI", "Series": "UNI-K", "Make": "Changan" }, { "Year": 2021, "Model": "UNI", "Series": "UNI-T", "Make": "Changan" }, { "Year": 2021, "Model": "Car", "Series": "新锐程CC蓝鲸版", "Make": "Changan" }, { "Year": 2021, "Model": "Car", "Series": "逸动plus", "Make": "Changan" }, { "Year": 2021, "Model": "Car", "Series": "第三地锐翔", "Make": "Changan" }, { "Year": 2021, "Model": "Car", "Series": "逸动DT", "Make": "Changan" }, { "Year": 2021, "Model": "SUV", "Series": "CS95", "Make": "Changan" }, { "Year": 2021, "Model": "SUV", "Series": "CS85COUPLE", "Make": "Changan" }, { "Year": 2021, "Model": "SUV", "Series": "第二代CS75Plus", "Make": "Changan" }, { "Year": 2021, "Model": "SUV", "Series": "CS75Plus", "Make": "Changan" }, { "Year": 2021, "Model": "SUV", "Series": "新CS75蓝鲸版", "Make": "Changan" }, { "Year": 2021, "Model": "New Energy", "Series": "CS55纯电版", "Make": "Changan" }, { "Year": 2021, "Model": "New Energy", "Series": "CS15 E-Pro", "Make": "Changan" } ]
""" How to Use this File. participants is a dictionary where a key is the name of the participant and the value is a set of all the invalid selections for that participant. participants = {'Bob': {'Sue', 'Jim'}, 'Jim': {'Bob', 'Betty'}, } # And so on. history is a dictionary where a key is the name of the participant and the value is a list of tuples that contain a year and that participant's recipient for that year. history = {'Bob': [(2010, 'Betty'), (2011, 'Freddie')], 'Jim': [(2011, 'Sue'] # And so on. } """ participants = {'Adam': {'Adam', 'Jeff', 'Joe', 'David'}, 'Adrienne': {'Adrienne', 'Joe'}, 'Amanda': {'Amanda', 'Stefan' ,'Angela'}, 'Angela': {'Angela', 'Renee', 'Jeff', 'Nanna', 'Stefan', 'Justin', 'Amanda'}, 'David': {'David', 'Jeff', 'Joe', 'Adam', 'Shaina'}, 'Francesca': {'Francesca', 'Renee', 'George'}, 'George': {'George', 'Renee', 'Francesca'}, 'Jeff': {'Jeff', 'Renee', 'Angela', 'Nanna', 'Joe', 'Adam', 'David'}, 'Joe': {'Joe', 'Jeff', 'David', 'Adam', 'Adrienne'}, 'Justin': {'Justin', 'Angela', 'Stefan'}, 'Nanna': {'Nanna', 'Jeff', 'Angela', 'Renee'}, 'Renee': {'Renee', 'Jeff', 'Angela', 'Nanna', 'Francesca', 'George'}, 'Shaina': {'Shaina', 'David'}, 'Stefan': {'Stefan', 'Angela', 'Justin', 'Amanda'}, } history = {'Adam': [(2015, 'Justin'), (2016, 'Amanda'), (2017, 'Angela'), (2018, 'Stefan')], 'Adrienne': [(2016, 'Jeff'), (2017, 'Stefan'), (2018, 'Justin')], 'Amanda': [(2015, 'Adam'), (2016, 'Adrienne'), (2017, 'Jeff'), (2018, 'George')], 'Angela': [(2015, 'Joe'), (2016, 'David'), (2017, 'Francesca'), (2018, 'Adrienne')], 'David': [(2015, 'Stefan'), (2016, 'Francesca'), (2017, 'Renee')], 'Francesca': [(2015, 'Angela'), (2016, 'Joe'), (2017, 'Adam'), (2018, 'Jeff')], 'George': [(2015, 'Jeff'), (2016, 'Angela'), (2017, 'Adrienne'), (2018, 'Joe')], 'Jeff': [(2015, 'Nanna'), (2016, 'Justin'), (2017, 'Shaina'), (2018, 'Amanda')], 'Joe': [(2015, 'Renee'), (2016, 'George'), (2017, 'Justin'), (2018, 'Angela')], 'Justin': [(2015, 'Francesca'), (2016, 'Adam'), (2017, 'George'), (2018, 'Renee')], 'Nanna': [(2015, 'David')], 'Renee': [(2015, 'Amanda'), (2016, 'Stefan'), (2017, 'David'), (2018, 'Adam')], 'Shaina': [(2017, 'Amanda')], 'Stefan': [(2015, 'George'), (2016, 'Renee'), (2017, 'Joe'), (2018, 'Francesca')], } class Participant: """The class for individual participants that contains their attributes.""" def __init__(self, name, restricted_set=None, giving_to=None): self.name = name self.restricted_set = restricted_set self.restricted_set = participants.get(self.name)|set([y[1] for y in history.get(self.name)]) self.giving_to = giving_to def main(): return sorted([Participant(p) for p in participants.keys()], key=lambda p: len(p.restricted_set), reverse=True) if __name__ == '__main__': main()
# Source : https://leetcode.com/problems/find-the-highest-altitude/ # Author : foxfromworld # Date : 13/11/2021 # First attempt class Solution: def largestAltitude(self, gain: List[int]) -> int: alt, ret = 0, 0 for g in gain: alt = alt + g ret = max(alt, ret) return ret
def type_I(A, i, j): # Swap two rows A[i], A[j] = np.copy(A[j]), np.copy(A[i]) def type_II(A, i, const): # Multiply row j of A by const A[i] *= const def type_III(A, i, j, const): # Add a constant times row j to row i A[i] += const*A[j]
class Justifier: def justify(self, textIn): width = max(map(len, textIn)) return map(lambda s: s.rjust(width), textIn)
tournament = input() total_played = 0 total_won = 0 total_lost = 0 while tournament != "End of tournaments": games_per_tournament = int(input()) games_counter = 0 total_played += games_per_tournament for games in range(1, games_per_tournament + 1): desi_team = int(input()) other_team = int(input()) games_counter += 1 if desi_team > other_team: total_won += 1 diff = desi_team - other_team print(f"Game {games_counter} of tournament {tournament}: win with {diff} points.") elif desi_team < other_team: total_lost += 1 diff = other_team - desi_team print(f"Game {games_counter} of tournament {tournament}: lost with {diff} points.") tournament = input() #if tournament == "End of tournaments": print(f"{((total_won / total_played) * 100):.2f}% matches win") print(f"{((total_lost / total_played) * 100):.2f}% matches lost")
class Bootstrap: '''Essential bootstrap cross validator, consistent with other splitter classes in sklearn.model_selection. Example: boot = Bootstrap(n_bootstraps = 3, random_state=1) for train, test in boot.split(X): print("Train:", X[train]," Test:", X[test]) ''' def __init__(self,n_bootstraps=5, random_state=None): self.nb = n_bootstraps self.rs = random_state def split(self, X, y=None): '''"""Generate indices to split data into training and test set.''' rng = check_random_state(self.rs) iX = np.mgrid[0:X.shape[0]] for i in range(self.nb): train = resample(iX, random_state=rng) test = [item for item in iX if item not in train] yield (train,test)
CHECKPOINT = 'model/checkpoint.bin' MODEL_PATH = 'model/model.bin' input_path = 'input/train.csv' LR = 0.01 scheduler_threshold = 0.001 scheduler_patience = 2 scheduler_decay_factor = 0.5 embed_dims = 128 hidden_dims = 128 num_layers = 1 bidirectional = False dropout = 0.2 out_dims = 128 Batch_Size = 64 Epochs = 100 similarity_thresh = 0.75 margin = 0.25
BASE_URL = "https://www.zhixue.com" # BASE_URL = "http://localhost:8080" INFO_URL = f"{BASE_URL}/container/container/student/account/" # Login SERVICE_URL = f"{BASE_URL}:443/ssoservice.jsp" SSO_URL = f"https://open.changyan.com/sso/login?sso_from=zhixuesso&service={SERVICE_URL}" CHANGE_PASSWORD_URL = f"{BASE_URL}/portalcenter/home/updatePassword/" TEST_PASSWORD_URL = f"{BASE_URL}/weakPwdLogin/?from=web_login" TEST_URL = f"{BASE_URL}/container/container/teacher/teacherAccountNew" # Exam XTOKEN_URL = f"{BASE_URL}/addon/error/book/index" GET_EXAM_URL = f"{BASE_URL}/zhixuebao/zhixuebao/main/getUserExamList/" GET_MARK_URL = f"{BASE_URL}/zhixuebao/zhixuebao/feesReport/getStuSingleReportDataForPK/" GET_PAPERID_URL = f"{BASE_URL}/zhixuebao/report/exam/getReportMain" GET_ORIGINAL_URL = f"{BASE_URL}/zhixuebao/report/checksheet/" GET_LOST_TOPIC = f"{BASE_URL}/zhixuebao/report/paper/getExamPointsAndScoringAbility" GET_LEVEL_TREND = f"{BASE_URL}/zhixuebao/report/paper/getLevelTrend" # Person GET_FRIEND_URL = f"{BASE_URL}/zhixuebao/zhixuebao/friendmanage/" INVITE_FRIEND_URL = f"{BASE_URL}/zhixuebao/zhixuebao/addFriend/" DELETE_FRIEND_URL = f"{BASE_URL}/zhixuebao/zhixuebao/delFriend/" GET_CLAZZS_URL = GET_FRIEND_URL # GET_CLASSMATES_URL = f"{BASE_URL}/zhixuebao/zhixuebao/getClassStudent/" GET_CLASSMATES_URL = f"{BASE_URL}/container/contact/student/students" # Get_ErrorBook GET_ERRORBOOK = f"{BASE_URL}/zhixuebao/report/paper/getLostTopicAndAnalysis"
print('----------------------------------------') print('PROCURANDO ALGARISMOS VIZINHOS IGUAIS...') print('----------------------------------------\n') print('Vamos brincar de detetive de algarismos?') x = input('s/n: ') if x == 'n': print('Então vai tomar no cu e chupar meu piru ..|.,') else: print('Ok! Vamos lá...') n = int(input('Digite o número que deseja investigar: ')) n2 = n div = 1 restAnt = 99 alg = False while (div != 0) and not alg: div = n // 10 rest = n % 10 n = div if rest == restAnt: alg = True else: restAnt = rest if alg: print('O número [{}] possui algarismos adjacentes repetidos! [algarismo {}]'.format(n2,rest)) else: print('O número [{}] não possui algarismos adjacentes repetidos!'.format(n2))
debug_defs = select({ "//:debug-ast": ["DEBUG_AST"], "//conditions:default": [] }) + select({ "//:debug-bindings": ["DEBUG_BINDINGS"], "//conditions:default": [] }) + select({ "//:debug-ctors": ["DEBUG_CTORS"], "//conditions:default": [] }) + select({ "//:debug-filters": ["DEBUG_FILTERS"], "//conditions:default": [] }) + select({ "//:debug-format": ["DEBUG_FORMAT"], "//conditions:default": [] }) + select({ "//:debug-load": ["DEBUG_LOAD"], "//conditions:default": [] }) + select({ "//:debug-loads": ["DEBUG_LOADS"], "//conditions:default": [] }) + select({ "//:debug-mem": ["DEBUG_MEM"], "//conditions:default": [] }) + select({ "//:debug-mutators": ["DEBUG_MUTATORS"], "//conditions:default": [] }) + select({ "//:debug-paths": ["DEBUG_PATHS"], "//conditions:default": [] }) + select({ "//:debug-preds": ["DEBUG_PREDICATES"], "//conditions:default": [] }) + select({ "//:debug-properties": ["DEBUG_PROPERTIES"], "//conditions:default": [] }) + select({ "//:debug-queries": ["DEBUG_QUERY"], "//conditions:default": [] }) + select({ "//:debug-s7-api": ["DEBUG_S7_API"], "//conditions:default": [] }) + select({ "//:debug-set": ["DEBUG_SET"], "//conditions:default": [] }) + select({ "//:debug-serializers": ["DEBUG_SERIALIZERS"], "//conditions:default": [] }) + select({ "//:debug-targets": ["DEBUG_TARGETS"], "//conditions:default": [] }) + select({ "//:debug-trace": ["DEBUG_TRACE"], "//conditions:default": [] }) + select({ "//:debug-utarrays": ["DEBUG_UTARRAYS"], "//conditions:default": [] }) + select({ "//:debug-vectors": ["DEBUG_VECTORS"], "//conditions:default": [] }) + select({ "//:debug-yytrace": ["DEBUG_YYTRACE"], "//conditions:default": [] })
# -*- coding: utf-8 -*- """ ASGI """
_prefix = 'MC__' JOB_DIR_COMPONENT_PATHS = { 'job_key': _prefix + 'JOB_KEY', 'job_meta': _prefix + 'JOB_META.json', 'job_spec': 'job_spec.json', 'entrypoint': 'entrypoint.sh', 'work_dir': 'work_dir', 'executed_checkpoint': _prefix + 'EXECUTED', 'completed_checkpoint': _prefix + 'COMPLETED', 'failure_checkpoint': _prefix + 'FAILED', 'failed_checkpoint': _prefix + 'FAILED', 'stdout_log': _prefix + 'STDOUT.log', 'stderr_log': _prefix + 'STDERR.log', }
p=int(input('enter the principal amount')) n=int(input('enter the number of year')) r=int(input('enter the rate of interest')) d=p*n*r/100 print('simple interest=',d)
''' 删除二叉搜索树中的节点 给定一个二叉搜索树的根节点 root 和一个值 key,删除二叉搜索树中的 key 对应的节点,并保证二叉搜索树的性质不变。 返回二叉搜索树(有可能被更新)的根节点的引用。 一般来说,删除节点可分为两个步骤: 首先找到需要删除的节点; 如果找到了,删除它。 说明: 要求算法时间复杂度为 O(h),h 为树的高度。 ''' # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right ''' 思路:递归 按照二叉搜索树的性质,先查找节点,(大于当前节点搜索右子树,小于当前节点搜索左子树) 找到节点后, > 如果左右子树都存在,将当前节点的左子树设置为当前树根节点,然后将右子树设置为原左子树的最大节点的右子树(因为右子树所有元素均大于左子树,这样能保持搜索树的性质) > 如果只有1个子树,将该子树设置为根节点 时间复杂度:O(h) 空间复杂度:O(h) ''' class Solution: def deleteNode(self, root: TreeNode, key: int) -> TreeNode: if not root: return root # 改变树的最大节点 def changeMax(node, maxNode): if node.right: changeMax(node.right, maxNode) else: node.right = maxNode # 删除指定节点 def delete(node): if node.val > key: # 小于当前节点,搜索左子树 if node.left: node.left = delete(node.left) elif node.val < key: # 大于当前节点,搜索右子树 if node.right: node.right = delete(node.right) else: # 找到当前节点,当前树的根节点需要变更 if not node.right or not node.left: return node.right if node.right else node.left else: # 左右子树都存在,将当前节点的左子树设置为当前树根节点,然后将右子树设置为左子树的最大节点的右子树 changeMax(node.left, node.right) return node.left return node return delete(root)
def add_to_parser(parser): parser.add_argument("-c", "--channel", type=str, dest="channel", help=""" If the CAN interface supports multiple channels, select which one you are after here. For example on linux this might be 1 """, default='0') parser.add_argument("-b", "--bitrate", type=int, dest="bitrate", help="CAN bus bitrate", default=1000000) parser.add_argument("--tseg1", type=int, dest="tseg1", help="CAN bus tseg1", default=4) parser.add_argument("--tseg2", type=int, dest="tseg2", help="CAN bus tseg2", default=3) parser.add_argument("--sjw", type=int, dest="sjw", help="Synchronisation Jump Width decides the maximum number of time quanta that the controller can resynchronise every bit.", default=1) parser.add_argument("-n", "--num_samples", type=int, dest="no_samp", help="""Some CAN controllers can also sample each bit three times. In this case, the bit will be sampled three quanta in a row, with the last sample being taken in the edge between TSEG1 and TSEG2. Three samples should only be used for relatively slow baudrates.""", default=1)
c = get_config() c.NotebookApp.ip = '{{IPYTHON_NB_LISTEN_ADDR}}' c.NotebookApp.port = {{IPYTHON_NB_LISTEN_PORT}} c.NotebookApp.open_browser = False c.NotebookApp.notebook_dir = u'{{IPYTHON_NB_DIR}}' c.NotebookApp.base_url = '{{HTTP_BASE_URL}}/{{IPYTHON_NB_PREFIX}}' c.NotebookApp.tornado_settings = {'static_url_prefix':'{{HTTP_BASE_URL}}/{{IPYTHON_NB_PREFIX}}/static/'} # Disable token auth for now c.NotebookApp.token = '' c.NotebookApp.password = ''
class Solution: def XXX(self, intervals: List[List[int]]) -> List[List[int]]: res=[] intervals.sort() res.append(intervals[0]) for i in range(1,len(intervals)): t=res[-1] if intervals[i][0]<=t[1]: res[-1][1]=max(intervals[i][1],res[-1][1]) else: res.append(intervals[i]) return res
# Construa agora um algoritmo para implementação de um Pilha. Lembrando que na Pilha o último # elemento adicionado, será o primeiro elemento removido. class No: def __init__(self, dado): self.dado = dado self.proximo = None #valor nulo
#!/usr/bin/env python print("Hello World!") # commnads # $python hello.py # Hello World! # $python hello.py > output.txt # if file exists, old file is deleted, new file created with same name # if file doesn't exits, then new file is created # $python hello.py >> output.txt # if file exists, then result is appended # if file doesn't exists, then new file is created.
n = int(input('\033[3;30;32mDigite um número para ver a sua tabuada: \033[m')) print('''--------------- {} x 1 = {} {} x 2 = {} {} x 3 = {} {} x 4 = {} {} x 5 = {} {} x 6 = {} {} x 7 = {} {} x 8 = {} {} x 9 = {} {} x 10 = {} ---------------'''.format(n, n, n, (n*2), n, (n*3), n, (n*4), n, (n*5), n, (n*6), n, (n*7), n, (n*8), n, (n*9), n, (n*10)))
#!/usr/bin/env python3 def solution(n: int, a: list) -> list: """ >>> solution(5, [3, 4, 4, 6, 1, 4, 4]) [3, 2, 2, 4, 2] """ counters = [0] * n max_counter = n + 1 cur_max = 0 for num in a: if num == max_counter: counters = [cur_max] * n else: counters[num - 1] += 1 if counters[num - 1] > cur_max: cur_max += 1 return counters
nota1 = float(input('Digite a Primeira Nota: ')) nota2 = float(input('Digite a Segunda Nota: ')) n = (nota1 + nota2) / 2 print(f'Você tirou {n}') if n < 5.0: print('REPROVADO:') elif n > 6.9: print('APROVADO') else: print('RECUPERAÇÃO')
# Separate the construction of a complex object from its # representation so that the same construction process can create different representations. # Parse a complex representation, create one of several targets. # Allows you to build different kind of object by implementing the Steps, # to build on particular object # * Building an object requires steps # Abstract <anything> class Anything(object): def __init__(self): self.build_step_1() self.build_step_2() def build_step_1(self): raise NotImplementedError def build_step_2(self): raise NotImplementedError # Concrete implementations class AnythingA(Anything): def build_step_1(self): pass def build_step_2(self): pass class AnythingB(Anything): def build_step_1(self): pass def build_step_2(self): pass
""" Contains modules related to the import of the data and formatting of the target Modules : - Start - Encode_Target """ __all__ = ['Load', 'Encode_Target']
""" 0914. X of a Kind in a Deck of Cards Easy In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in each group have the same integer. Example 1: Input: deck = [1,2,3,4,4,3,2,1] Output: true Explanation: Possible partition [1,1],[2,2],[3,3],[4,4]. Example 2: Input: deck = [1,1,1,2,2,2,3,3] Output: false´ Explanation: No possible partition. Example 3: Input: deck = [1] Output: false Explanation: No possible partition. Example 4: Input: deck = [1,1] Output: true Explanation: Possible partition [1,1]. Example 5: Input: deck = [1,1,2,2,2,2] Output: true Explanation: Possible partition [1,1],[2,2],[2,2]. Constraints: 1 <= deck.length <= 10^4 0 <= deck[i] < 10^4 """ class Solution: def hasGroupsSizeX(self, deck: List[int]) -> bool: return reduce(fractions.gcd, collections.Counter(deck).values()) > 1
def dict_extract(value, var, ret_dict=None): """Search a list of nested dictionaries Args: value(obj): Object being searched for var(iterable): iterable containing dictionaries or lists ret_dict(dict): Highest depth dictionary containing value Yield: Dictionary containing desired values Notes: Find highest depth dictionary in the lowest depth list that contains the desired value """ try: for v in var.values(): if v == value and ret_dict is not None: yield ret_dict elif v == value and ret_dict is None: yield var # lists should be caugt by the except elif isinstance(v, (dict, list)): for result in dict_extract(value, v, ret_dict): yield result except AttributeError: if isinstance(var, list): for d in var: ret_dict = d for result in dict_extract(value, d, ret_dict): yield result
""" 16. 3Sum Closest Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution. My opnion: I searched the internet for what the problem means. I didn't understand the problem. """ class Solution: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() closest_num = float('inf') for i in range(len(nums) - 2): l = i + 1 r = len(nums) - 1 while l < r: total = nums[i] + nums[l] + nums[r] if total == target: return target if abs(total-target) < abs(closest_num-target): closest_num = total if total > target: r -= 1 elif total < target: l += 1 return closest_num
def high_and_low(numbers): # In this little assignment you are given a string of space separated numbers, # and have to return the highest and lowest number. result = [int(x) for x in numbers.split()] string = str(max(result)) + " " + str(min(result)) return string print(high_and_low("4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"))
class Clustering: def __init__(self): self._cluster = {} def _query(self, jpt): return self._cluster[jpt]
# https://codeforces.com/problemset/problem/705/A n = int(input()) love = 'I love it' hate = 'I hate it' result = '' if n == 1: print('I hate it') else: for num in range(1, n + 1): if num == n: if num % 2 != 0: result += hate else: result += love break if num % 2 != 0: result += 'I hate that' + ' ' else: result += 'I love that' + ' ' print(result)
#!/usr/bin/python S = input() P_score= S.split(" ") #print (S) for i in range (0,len(P_score)): P_score[i]= int(P_score[i]) List_J=[1 for m in range(0,len(P_score))]## set default List_J as "1" for i in range(0,(len(P_score)-1)): if P_score[i] < P_score[i+1]: List_J[i+1] = List_J[i]+1 i += 1 elif P_score[i]>P_score[i+1]: if List_J[i]== List_J[i+1]: List_J[i]+=1 k=i-1 q=i while i<len(P_score)-1: if P_score[k]<=P_score[q]: i +=1 break if P_score[k]>P_score[q]: if List_J[k]>List_J[q]: break if List_J[k]==List_J[q]: List_J[k]+= 1 k -= 1 q -= 1 i += 1 print(sum(List_J))
"""A series of modules containing dictionaries that can be used in run.py""" def test_movie_set_1(): movie1 = { "name": "Apollo11", "rating": "G", "genre": "documentary", "length": 93 } movie2 = { "name": "Cars", "rating": "G", "genre": "comedy", "length": 117 } movie3 = { "name": "Pride and Prejudice", "rating": "PG13", "genre": "romance", "length": 135 } movie4 = { "name": "Avengers: Infinity War", "rating": "PG13", "genre": "action", "length": 149 } movie5 = { "name": "The Conjuring", "rating": "R", "genre": "horror", "length": 112 } movies = [movie1, movie2, movie3, movie4, movie5] return movies
# June 2021 # Author: J. Rossbroich """ misc.py Contains functions used by the adelie package """ def getattr_deep(obj, attrs): """ Like getattr(), but checks in children objects Example: X = object() X.Y = childobject() X.Y.variable = 5 getattr(X, 'Y.variable') -> AttributeError getattr_deep(X, 'Y.variable') -> 5 :param obj: object :param attrs: attribute (string) :return: attribute """ for attr in attrs.split("."): obj = getattr(obj, attr) return obj def hasattr_deep(obj, attrs): """ Like hasattr(), but checks in children objects Example: X = object() X.Y = childobject() X.Y.variable = 5 hasattr(X, 'Y.variable') -> False hasattr_deep(X, 'Y.variable') -> True :param obj: object :param attrs: attribute (string) :return: bool """ try: getattr_deep(obj, attrs) return True except AttributeError: return False
''' Contains keyword arguments and their default values for workflows. Used to auto-complete arguments that are missing in submitted workflows. Workflow items with all the given arguments are then parsed into actual Celery workflows by the workflow designer. 2020 Benjamin Kellenberger ''' DEFAULT_WORKFLOW_ARGS = { 'train': { 'min_timestamp': 'lastState', 'min_anno_per_image': 0, 'include_golden_questions': False, #TODO 'max_num_images': -1, 'max_num_workers': -1 }, 'inference': { 'force_unlabeled': False, #TODO 'golden_questions_only': False, #TODO 'max_num_images': -1, 'max_num_workers': -1 }, #TODO }
feed_template = ''' <html> <head> <title>Carbon Black {{integration_name}} Feed</title> <style type="text/css"> A:link {color: black;} A:visited {color: black;} A:active {color: black;} A:hover {underline; color: #d02828;} </style> <style> #config { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; } #config td, #config th { font-size:1em; border:1px solid #000000; padding:3px 7px 2px 7px; } #config th { font-size:1.1em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#d02828; color:#ffffff; } #config tr.alt td { color:#000000; background-color:#666666; } </style> </head> <body bgcolor='white'> <table align='center'> <tr> <td> <h3> Feed Reports </h3> <table id="config" align='center'> <tr> <th><b>ReportId</b></td> <th><b>ReportTitle</b></td> <th><b>Timestamp</b></td> <th><b>Score</b></td> <th><b>IOCs</b></td> </tr> {% for report in feed['reports'] %} <tr class={{loop.cycle('', 'alt')}}> <td><a href={{report['link']}}>{{report['id']}}</a></td> <td>{{report['title']}}</td> <td>{{report['timestamp']}}</td> <td>{{report['score']}}</td> <td> {% for md5 in report.get('iocs', {}).get('md5', []) %} {{md5}}<br> {% endfor %} {% for dns in report.get('iocs', {}).get('dns', []) %} {{dns}}<br> {% endfor %} {% for ipv4 in report.get('iocs', {}).get('ipv4', []) %} {{ipv4}}<br> {% endfor %} </td> </tr> {% endfor %} </table> <br> <tr> <td>Copyright Carbon Black 2015 All Rights Reserved</td> </tr> </table> </body> </html> ''' index_template = ''' <html> <head> <title>Carbon Black <-> {{integration_name}} Bridge</title> <style type="text/css"> A:link {color: black;} A:visited {color: black;} A:active {color: black;} A:hover {color: #d02828;} </style> <style> #config { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; } #config td, #config th { font-size:1em; border:1px solid #000000; padding:3px 7px 2px 7px; } #config th { font-size:1.1em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#d02828; color:#ffffff; } #config tr.alt td { color:#000000; background-color:#666666; } </style> </head> <body bgcolor='white'> <table align='center' width='600'> <tr> <td align='center'><img src='{{cb_image_path}}'></td> <td align='center'><img src='{{integration_image_path}}' width='400'></td> </tr> </table> <br> <table align='center' width='600'> <tr> <td> <h3> Bridge Configuration </h3> <table id="config" align='center'> <tr> <th width='200'><b>Config Option</b></td> <th width='300'><b>Value</b></td> </tr> {% for option in options.keys() %} <tr class={{loop.cycle('', 'alt')}}> <td>{{option}}</td> <td>{{options[option]}}</td> </tr> {% endfor %} </table> <br> <h3> Feed Information </h3> <table id="config" align='center'> <tr> <th width='200'><b>Feed Param Name</b></td> <th width-'300'><b>Feed Param Value</b></td> </tr> {% for feedparamname in feed['feedinfo'].keys() %} <tr class={{ loop.cycle('', 'alt') }}> <td width='200'>{{feedparamname}}</td> <td width='300'>{{feed['feedinfo'][feedparamname]}}</td> </tr> {% endfor %} </table> <br> <h3> Feed Contents </h3> <table id="config" align='center'> <tr> <th width='200'>Format</td> <th width='300'>Description</td> </tr> <tr> <td width='200'><a href='{{json_feed_path}}'>JSON</a></td> <td width='300'>Designed for programmatic consumption; used by Carbon Black Enterprise Server</td> </tr> <tr class='alt'> <td width='200'><a href='feed.html'>HTML</a></td> <td width='300'>Designed for human consumption; used to explore feed contents and for troubleshooting</td> </tr> </table> </td> </tr> <tr> <td><br></td> </tr> <tr> <td>Copyright Carbon Black 2013 All Rights Reserved</td> </tr> </table> </body> </html> ''' binary_template = ''' <html> <head> <title>Carbon Black {{integration_name}} Feed</title> <style type="text/css"> A:link {color: black;} A:visited {color: black;} A:active {color: black;} A:hover {underline; color: #d02828;} </style> <style> #config { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; width:100%; border-collapse:collapse; } #config td, #config th { font-size:1em; border:1px solid #000000; padding:3px 7px 2px 7px; } #config th { font-size:1.1em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#d02828; color:#ffffff; } #config tr.alt td { color:#000000; background-color:#666666; } </style> </head> <body bgcolor='white'> <table align='center'> <tr> <td> <h3> Feed Reports </h3> <table id="config" align='center'> <tr> <th><b>MD5sum</b></td> <th><b>Short Result</b></td> <th><b>Long Result</b></td> <th><b>Score</b></td> </tr> {% for binary in binaries %} <tr class={{loop.cycle('', 'alt')}}> <td>{{binary['md5sum']}}</td> <td>{{binary['short_result']}}</td> <td>{{binary['detailed_result']}}</td> <td>{{binary['score']}}</td> </tr> {% endfor %} </table> <br> <tr> <td>Copyright Carbon Black 2015 All Rights Reserved</td> </tr> </table> </body> </html> '''
x=[9,2,10,1,-1,0,0,1] for i in range(len(x)-1): for j in range(len(x)-1): if x[j] > x[j+1]: x[j],x[j+1] = x[j+1],x[j] print(x) x=input() y={} for i in range(len(x)): if not x[i] in y : y[x[i]]=0 y[x[i]]+=1 print(y) x=input() y=len(x) y-=1 for i in range(round(len(x)/2)): if not x[i] == x[y]: print("false") break y-=1 if y+i == len(x)-2: print ("true")
# # PySNMP MIB module IPV4-RIP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPV4-RIP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:45:29 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) # apIpv4Rip, = mibBuilder.importSymbols("APENT-MIB", "apIpv4Rip") Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Bits, Unsigned32, MibIdentifier, ModuleIdentity, Counter32, Integer32, Counter64, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, IpAddress, TimeTicks, Gauge32, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Unsigned32", "MibIdentifier", "ModuleIdentity", "Counter32", "Integer32", "Counter64", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "IpAddress", "TimeTicks", "Gauge32", "ObjectIdentity") TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString") apIpv4RipMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 1)) if mibBuilder.loadTexts: apIpv4RipMib.setLastUpdated('9805112000Z') if mibBuilder.loadTexts: apIpv4RipMib.setOrganization('ArrowPoint Communications Inc.') apIpv4RipRedistributeStatic = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipRedistributeStatic.setStatus('current') apIpv4RipStaticMetric = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipStaticMetric.setStatus('current') apIpv4RipRedistributeOspf = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipRedistributeOspf.setStatus('current') apIpv4RipOspfMetric = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipOspfMetric.setStatus('current') apIpv4RipRedistributeLocal = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipRedistributeLocal.setStatus('current') apIpv4RipLocalMetric = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipLocalMetric.setStatus('current') apIpv4RipEqualCostRoutes = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipEqualCostRoutes.setStatus('current') apIpv4RipRedistributeFirewall = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipRedistributeFirewall.setStatus('current') apIpv4RipFirewallMetric = MibScalar((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: apIpv4RipFirewallMetric.setStatus('current') apIpv4RipAdvRouteTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8), ) if mibBuilder.loadTexts: apIpv4RipAdvRouteTable.setStatus('current') apIpv4RipAdvRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8, 1), ).setIndexNames((0, "IPV4-RIP-MIB", "apIpv4RipAdvRoutePrefix"), (0, "IPV4-RIP-MIB", "apIpv4RipAdvRoutePrefixLen")) if mibBuilder.loadTexts: apIpv4RipAdvRouteEntry.setStatus('current') apIpv4RipAdvRoutePrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipAdvRoutePrefix.setStatus('current') apIpv4RipAdvRoutePrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipAdvRoutePrefixLen.setStatus('current') apIpv4RipAdvRouteMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipAdvRouteMetric.setStatus('current') apIpv4RipAdvRouteStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 8, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipAdvRouteStatus.setStatus('current') apIpv4RipIfAdvRouteTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9), ) if mibBuilder.loadTexts: apIpv4RipIfAdvRouteTable.setStatus('current') apIpv4RipIfAdvRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1), ).setIndexNames((0, "IPV4-RIP-MIB", "apIpv4RipIfAdvRouteAddress"), (0, "IPV4-RIP-MIB", "apIpv4RipIfAdvRoutePrefix"), (0, "IPV4-RIP-MIB", "apIpv4RipIfAdvRoutePrefixLen")) if mibBuilder.loadTexts: apIpv4RipIfAdvRouteEntry.setStatus('current') apIpv4RipIfAdvRouteAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipIfAdvRouteAddress.setStatus('current') apIpv4RipIfAdvRoutePrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipIfAdvRoutePrefix.setStatus('current') apIpv4RipIfAdvRoutePrefixLen = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipIfAdvRoutePrefixLen.setStatus('current') apIpv4RipIfAdvRouteMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipIfAdvRouteMetric.setStatus('current') apIpv4RipIfAdvRouteStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 9, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipIfAdvRouteStatus.setStatus('current') apIpv4RipIfTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 10), ) if mibBuilder.loadTexts: apIpv4RipIfTable.setStatus('current') apIpv4RipIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 10, 1), ).setIndexNames((0, "IPV4-RIP-MIB", "apIpv4RipIfAddress")) if mibBuilder.loadTexts: apIpv4RipIfEntry.setStatus('current') apIpv4RipIfAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 10, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: apIpv4RipIfAddress.setStatus('current') apIpv4RipIfLogTx = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 10, 1, 2), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipIfLogTx.setStatus('current') apIpv4RipIfLogRx = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 9, 3, 1, 10, 1, 3), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apIpv4RipIfLogRx.setStatus('current') mibBuilder.exportSymbols("IPV4-RIP-MIB", apIpv4RipIfLogRx=apIpv4RipIfLogRx, apIpv4RipRedistributeFirewall=apIpv4RipRedistributeFirewall, apIpv4RipIfAdvRouteMetric=apIpv4RipIfAdvRouteMetric, apIpv4RipIfAdvRoutePrefix=apIpv4RipIfAdvRoutePrefix, apIpv4RipRedistributeLocal=apIpv4RipRedistributeLocal, PYSNMP_MODULE_ID=apIpv4RipMib, apIpv4RipIfAddress=apIpv4RipIfAddress, apIpv4RipIfLogTx=apIpv4RipIfLogTx, apIpv4RipIfAdvRoutePrefixLen=apIpv4RipIfAdvRoutePrefixLen, apIpv4RipEqualCostRoutes=apIpv4RipEqualCostRoutes, apIpv4RipIfAdvRouteEntry=apIpv4RipIfAdvRouteEntry, apIpv4RipAdvRoutePrefixLen=apIpv4RipAdvRoutePrefixLen, apIpv4RipAdvRoutePrefix=apIpv4RipAdvRoutePrefix, apIpv4RipRedistributeOspf=apIpv4RipRedistributeOspf, apIpv4RipAdvRouteTable=apIpv4RipAdvRouteTable, apIpv4RipMib=apIpv4RipMib, apIpv4RipFirewallMetric=apIpv4RipFirewallMetric, apIpv4RipAdvRouteEntry=apIpv4RipAdvRouteEntry, apIpv4RipAdvRouteMetric=apIpv4RipAdvRouteMetric, apIpv4RipIfAdvRouteTable=apIpv4RipIfAdvRouteTable, apIpv4RipLocalMetric=apIpv4RipLocalMetric, apIpv4RipRedistributeStatic=apIpv4RipRedistributeStatic, apIpv4RipIfTable=apIpv4RipIfTable, apIpv4RipStaticMetric=apIpv4RipStaticMetric, apIpv4RipIfAdvRouteStatus=apIpv4RipIfAdvRouteStatus, apIpv4RipIfEntry=apIpv4RipIfEntry, apIpv4RipAdvRouteStatus=apIpv4RipAdvRouteStatus, apIpv4RipIfAdvRouteAddress=apIpv4RipIfAdvRouteAddress, apIpv4RipOspfMetric=apIpv4RipOspfMetric)
# print "Hello" N times n=int(input()) if n>=0: for i in range(n): print("Hello") else: print("Invalid input")
############################################################################## # # Copyright (C) BBC 2018 # ############################################################################## events = [ { "prodState": "Maintenance", "firstTime": 1494707632.238, "device_uuid": "3cb330f3-afb0-4e25-99ef-1902403b9be1", "eventClassKey": null, "severity": 5, "agent": "zenperfsnmp", "dedupid": "rpm01.rbsov.bbc.co.uk||/Status/Snmp|snmp_error|5", "Location": [ { "uid": "/zport/dmd/Locations/RBSOV", "name": "/RBSOV" } ], "component_url": null, "ownerid": null, "eventClassMapping_url": null, "eventClass": "/Status/Snmp", "eventState": "New", "id": "0242ac11-0008-8c73-11e7-381b7d3bc1c5", "device_title": "rpm01.rbsov.bbc.co.uk", "DevicePriority": null, "log": [ [ "admin", "2017-05-17 05:14:39", "Please refer Case3 <a href=\"https://confluence.dev.bbc.co.uk/display/men/Auto+Closing+and+Unacknowledging+events+in+zenoss\"><b> here</b> </a>" ], [ "admin", "2017-05-17 05:14:39", "state changed to New" ], [ "[email protected]", "2017-05-13 23:02:06", "state changed to Acknowledged" ] ], "facility": null, "eventClass_url": "/zport/dmd/Events/Status/Snmp", "priority": null, "device_url": "/zport/dmd/goto?guid=3cb330f3-afb0-4e25-99ef-1902403b9be1", "DeviceClass": [ { "uid": "/zport/dmd/Devices/Network/RPM Probes", "name": "/Network/RPM Probes" } ], "details": [ { "value": "a72e9aea2240", "key": "manager" }, { "value": "/Network/RPM Probes", "key": "zenoss.device.device_class" }, { "value": "/Platform/Network Equipment/Routers_Firewalls", "key": "zenoss.device.groups" }, { "value": "172.31.193.90", "key": "zenoss.device.ip_address" }, { "value": "/RBSOV", "key": "zenoss.device.location" }, { "value": "300", "key": "zenoss.device.production_state" }, { "value": "/ReleaseEnvironment/Live", "key": "zenoss.device.systems" } ], "evid": "0242ac11-0008-8c73-11e7-381b7d3bc1c5", "component_uuid": null, "eventClassMapping": null, "component": null, "clearid": null, "DeviceGroups": [ { "uid": "/zport/dmd/Groups/Platform/Network Equipment/Routers_Firewalls", "name": "/Platform/Network Equipment/Routers_Firewalls" } ], "eventGroup": "SnmpTest", "device": "rpm01.rbsov.bbc.co.uk", "component_title": null, "monitor": "TELHC-Collector", "count": 13361, "stateChange": 1494998079.655, "ntevid": null, "summary": "Cannot connect to SNMP agent on rpm01.rbsov.bbc.co.uk: Session.get: snmp_send cliberr=0, snmperr=-27, errstring=No securityName specified", "message": "Cannot connect to SNMP agent on rpm01.rbsov.bbc.co.uk: Session.get: snmp_send cliberr=0, snmperr=-27, errstring=No securityName specified<br/><a href=\"https://confluence.dev.bbc.co.uk/label/zenoss_evtclass_status_snmp\"><b> Event Class Run Book</b> </a><br/><b>Confluence Label</b>: <i>zenoss_evtclass_status_snmp</i>", "eventKey": "snmp_error", "lastTime": 1498735871.863, "ipAddress": [ "172.31.193.90" ], "Systems": [ { "uid": "/zport/dmd/Systems/ReleaseEnvironment/Live", "name": "/ReleaseEnvironment/Live" } ] }, { "prodState": "Maintenance", "firstTime": 1494707633.109, "device_uuid": "61266bba-2a7d-4551-a778-22171ffec006", "eventClassKey": null, "severity": 5, "agent": "zenping", "dedupid": "g7-0-sas2.oob.cwwtf.local||/Status/Ping|5|g7-0-sas2.oob.cwwtf.local is DOWN!", "Location": [ { "uid": "/zport/dmd/Locations/Watford/Rack_G7", "name": "/Watford/Rack_G7" } ], "component_url": null, "ownerid": null, "eventClassMapping_url": null, "eventClass": "/Status/Ping", "eventState": "New", "id": "0242ac11-0008-8c73-11e7-381b7b7a148e", "device_title": "g7-0-sas2.oob.cwwtf.local", "DevicePriority": "Normal", "log": [], "facility": null, "eventClass_url": "/zport/dmd/Events/Status/Ping", "priority": null, "device_url": "/zport/dmd/goto?guid=61266bba-2a7d-4551-a778-22171ffec006", "DeviceClass": [ { "uid": "/zport/dmd/Devices/Storage/HP/Switches", "name": "/Storage/HP/Switches" } ], "details": [ { "value": "True", "key": "isManageIp" }, { "value": "65e386ce4c65", "key": "manager" }, { "value": "/Storage/HP/Switches", "key": "zenoss.device.device_class" }, { "value": "172.31.127.128", "key": "zenoss.device.ip_address" }, { "value": "/Watford/Rack_G7", "key": "zenoss.device.location" }, { "value": "3", "key": "zenoss.device.priority" }, { "value": "300", "key": "zenoss.device.production_state" }, { "value": "/Infrastructure/Storage", "key": "zenoss.device.systems" }, { "value": "/Platform/Forge/Live", "key": "zenoss.device.systems" }, { "value": "/ReleaseEnvironment/Live", "key": "zenoss.device.systems" } ], "evid": "0242ac11-0008-8c73-11e7-381b7b7a148e", "component_uuid": null, "eventClassMapping": null, "component": null, "clearid": null, "DeviceGroups": [], "eventGroup": "Ping", "device": "g7-0-sas2.oob.cwwtf.local", "component_title": null, "monitor": "CWWTF-Collector", "count": 33388, "stateChange": 1494707633.109, "ntevid": null, "summary": "g7-0-sas2.oob.cwwtf.local is DOWN!", "message": "g7-0-sas2.oob.cwwtf.local is DOWN!<br/><a href=\"https://confluence.dev.bbc.co.uk/label/zenoss_evtclass_status_ping\"><b> Event Class Run Book</b> </a><br/><b>Confluence Label</b>: <i>zenoss_evtclass_status_ping</i>", "eventKey": "", "lastTime": 1498736083.126, "ipAddress": [ "172.31.127.128" ], "Systems": [ { "uid": "/zport/dmd/Systems/Infrastructure/Storage", "name": "/Infrastructure/Storage" }, { "uid": "/zport/dmd/Systems/Platform/Forge/Live", "name": "/Platform/Forge/Live" }, { "uid": "/zport/dmd/Systems/ReleaseEnvironment/Live", "name": "/ReleaseEnvironment/Live" } ] }, { "prodState": "Maintenance", "firstTime": 1494707633.11, "device_uuid": "2f454a17-ce6d-4138-8609-86eab9ab4d44", "eventClassKey": null, "severity": 5, "agent": "zenping", "dedupid": "g9-0-sas2.oob.cwwtf.local||/Status/Ping|5|g9-0-sas2.oob.cwwtf.local is DOWN!", "Location": [ { "uid": "/zport/dmd/Locations/Watford/Rack_G9", "name": "/Watford/Rack_G9" } ], "component_url": null, "ownerid": null, "eventClassMapping_url": null, "eventClass": "/Status/Ping", "eventState": "New", "id": "0242ac11-0008-8c73-11e7-381b7b7ab0d1", "device_title": "g9-0-sas2.oob.cwwtf.local", "DevicePriority": "Normal", "log": [], "facility": null, "eventClass_url": "/zport/dmd/Events/Status/Ping", "priority": null, "device_url": "/zport/dmd/goto?guid=2f454a17-ce6d-4138-8609-86eab9ab4d44", "DeviceClass": [ { "uid": "/zport/dmd/Devices/Storage/HP/Switches", "name": "/Storage/HP/Switches" } ], "details": [ { "value": "True", "key": "isManageIp" }, { "value": "65e386ce4c65", "key": "manager" }, { "value": "/Storage/HP/Switches", "key": "zenoss.device.device_class" }, { "value": "172.31.127.132", "key": "zenoss.device.ip_address" }, { "value": "/Watford/Rack_G9", "key": "zenoss.device.location" }, { "value": "3", "key": "zenoss.device.priority" }, { "value": "300", "key": "zenoss.device.production_state" }, { "value": "/Infrastructure/Storage", "key": "zenoss.device.systems" }, { "value": "/Platform/Forge/Live", "key": "zenoss.device.systems" }, { "value": "/ReleaseEnvironment/Live", "key": "zenoss.device.systems" } ], "evid": "0242ac11-0008-8c73-11e7-381b7b7ab0d1", "component_uuid": null, "eventClassMapping": null, "component": null, "clearid": null, "DeviceGroups": [], "eventGroup": "Ping", "device": "g9-0-sas2.oob.cwwtf.local", "component_title": null, "monitor": "CWWTF-Collector", "count": 33389, "stateChange": 1494707633.11, "ntevid": null, "summary": "g9-0-sas2.oob.cwwtf.local is DOWN!", "message": "g9-0-sas2.oob.cwwtf.local is DOWN!<br/><a href=\"https://confluence.dev.bbc.co.uk/label/zenoss_evtclass_status_ping\"><b> Event Class Run Book</b> </a><br/><b>Confluence Label</b>: <i>zenoss_evtclass_status_ping</i>", "eventKey": "", "lastTime": 1498736083.125, "ipAddress": [ "172.31.127.132" ], "Systems": [ { "uid": "/zport/dmd/Systems/Infrastructure/Storage", "name": "/Infrastructure/Storage" }, { "uid": "/zport/dmd/Systems/Platform/Forge/Live", "name": "/Platform/Forge/Live" }, { "uid": "/zport/dmd/Systems/ReleaseEnvironment/Live", "name": "/ReleaseEnvironment/Live" } ] } ]
# Commodity and Equity Sector mappings sectmap = { 'commodity_sector_mappings':{ '&6A_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'AUD'), # AUD '&6B_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'GBP'), # GBP '&6C_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'CAD'), # CAD '&6E_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'EUR'), # EUR '&6J_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'JPY'), # JPY '&6M_CCB':('Currencies', 'EM Currencies', 'EM Currencies', 'EM Currencies', 'MXN'), # MXN '&6N_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'NZD'), # NZD '&6S_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'CHF'), # CHF '&AFB_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Eastern Australia Feed Barley'), # Eastern Australia Feed Barley '&AWM_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Eastern Australia Wheat'), # Eastern Australia Wheat '&BAX_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Canadian Bankers Acceptance'), # Canadian Bankers Acceptance '&BRN_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Brent Crude Oil'), # Brent Crude Oil '&BTC_CCB':('Currencies', 'Crypto Currencies', 'Crypto Currencies', 'Crypto Currencies', 'Bitcoin'), # Bitcoin '&CC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Cocoa'), # Cocoa '&CGB_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Canadian 10y'), # Canadian 10 Yr Govt Bond '&CL_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil - Light Sweet'), # Crude Oil - Light Sweet '&CT_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Cotton #2'), # Cotton #2 '&DC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Milk - Class III'), # Milk - Class III '&DX_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'Benchmark'), # US Dollar Index '&EH_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Ethanol'), # Ethanol '&EMD_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P MidCap 400 E-mini'), # S&P MidCap 400 E-mini '&ES_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P 500 E-mini'), # S&P 500 E-mini '&EUA_CCB':('Commodities', 'Energy', 'Energy', 'Energy', 'EUA (Carbon Emissions)'), # EUA (Carbon Emissions) '&FBTP_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-BTP Long Term'), # Euro-BTP Long Term '&FCE_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'CAC 40'), # CAC 40 '&FDAX_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'DAX'), # DAX '&FDAX9_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'DAX'), # DAX, Last in Close field '&FESX_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'EURO STOXX 50'), # EURO STOXX 50 '&FESX9_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'EURO STOXX 50'), # EURO STOXX 50, Last in Close field '&FGBL_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Bund - 10 Yr'), # Euro-Bund - 10 Yr '&FGBM_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Bobl - 5 Yr'), # Euro-Bobl - 5 Yr '&FGBS_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Schatz - 2 Yr'), # Euro-Schatz - 2 Yr '&FGBX_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Buxl - 30 Yr'), # Euro-Buxl - 30 Yr '&FOAT_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro-OAT Continuous Contract'), # Euro-OAT Continuous Contract '&FOAT9_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro-OAT(L) Continuous Contract'), # Euro-OAT(L) Continuous Contract '&FSMI_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Swiss Market Index'), # Swiss Market Index '&FTDX_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'TecDAX'), # TecDAX '&GAS_CCB':('Commodities', 'Energy', 'Energy', 'Energy', 'Gas Oil'), # Gas Oil '&GC_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold'), # Gold '&GD_CCB':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # GS&P GSCI '&GE_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Eurodollar'), # Eurodollar '&GF_CCB':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Feeder Cattle'), # Feeder Cattle '&GWM_CCB':('Commodities', 'Energy', 'Energy', 'Energy', 'UK Natural Gas'), # UK Natural Gas '&HE_CCB':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Lean Hogs'), # Lean Hogs '&HG_CCB':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper '&HO_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'NY Harbor ULSD'), # NY Harbor ULSD '&HSI_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Hang Seng Index'), # Hang Seng Index '&HTW_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Taiwan Index'), # MSCI Taiwan Index '&KC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Coffee C'), # Coffee C '&KE_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'KC HRW Wheat'), # KC HRW Wheat '&KOS_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'KOSPI 200'), # KOSPI 200 '&LBS_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Lumber'), # Lumber '&LCC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'London Cocoa'), # London Cocoa '&LE_CCB':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Live Cattle'), # Live Cattle '&LES_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro Swiss'), # Euro Swiss '&LEU_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euribor'), # Euribor '&LEU9_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euribor'), # Euribor, Official Close '&LFT_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE 100'), # FTSE 100 '&LFT9_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE 100'), # FTSE 100, Official Close '&LLG_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Long Gilt'), # Long Gilt '&LRC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Robusta Coffee'), # Robusta Coffee '&LSS_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Short Sterling'), # Short Sterling '&LSU_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'White Sugar'), # White Sugar '&LWB_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Feed Wheat'), # Feed Wheat '&MHI_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Hang Seng Index'), # Hang Seng Index - Mini '&MWE_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Hard Red Spring Wheat'), # Hard Red Spring Wheat '&NG_CCB':('Commodities', 'Energy', 'Energy', 'Energy', 'Henry Hub Natural Gas'), # Henry Hub Natural Gas '&NIY_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 Yen '&NKD_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 Dollar '&NQ_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nasdaq-100 - E-mini'), # Nasdaq-100 - E-mini '&OJ_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Frozen Concentrated Orange Juice'), # Frozen Concentrated Orange Juice '&PA_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Palladium'), # Palladium '&PL_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Platinum'), # Platinum '&RB_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'RBOB Gasoline'), # RBOB Gasoline '&RS_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Canola'), # Canola '&RTY_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Russell 2000 - E-mini'), # Russell 2000 - E-mini '&SB_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Sugar No. 11'), # Sugar No. 11 '&SCN_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE China A50 Index'), # FTSE China A50 Index '&SI_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver'), # Silver '&SIN_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'SGX Nifty 50 Index'), # SGX Nifty 50 Index '&SJB_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Japanese Govt Bond - Mini'), # Japanese Govt Bond - Mini '&SNK_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 (SGX) '&SP_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P 500'), # S&P 500 '&SR3_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', '3M SOFR Continuous Contract'), # 3M SOFR Continuous Contract '&SSG_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Singapore Index'), # MSCI Singapore Index '&STW_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Taiwan Index'), # MSCI Taiwan Index, Discontinued '&SXF_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P/TSX 60 Index'), # S&P/TSX 60 Index '&TN_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Ultra 10 Year U.S. T-Note'), # Ultra 10 Year U.S. T-Note '&UB_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Ultra U.S. T-Bond'), # Ultra U.S. T-Bond '&VX_CCB':('Volatility', 'Volatility', 'Volatility', 'Volatility', 'Cboe Volatility Index'), # Cboe Volatility Index '&WBS_CCB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'WTI Crude Oil'), # WTI Crude Oil '&YAP_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200 '&YAP4_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200, Day '&YAP10_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200, Night '&YG_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold - Mini'), # Gold - Mini '&YI_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver - Mini'), # Silver - Mini '&YIB_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'ASX 30 Day Interbank Cash Rate'), # ASX 30 Day Interbank Cash Rate '&YIR_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'ASX 90 Day Bank Accepted Bills'), # ASX 90 Day Bank Accepted Bills '&YM_CCB':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'E-mini Dow'), # E-mini Dow '&YXT_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'ASX 10 Year Treasury Bond'), # ASX 10 Year Treasury Bond '&YYT_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'ASX 3 Year Treasury Bond'), # ASX 3 Year Treasury Bond '&ZB_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'U.S. T-Bond'), # U.S. T-Bond '&ZC_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Corn'), # Corn '&ZF_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', '5-Year US T-Note'), # 5-Year US T-Note '&ZG_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold'), # Gold 100oz, Discountinued '&ZI_CCB':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver'), # Silver 5000oz, Discontinued '&ZL_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybean Oil'), # Soybean Oil '&ZM_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybean Meal'), # Soybean Meal '&ZN_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', '10-Year US T-Note'), # 10-Year US T-Note '&ZO_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Oats'), # Oats '&ZQ_CCB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', '30 Day Federal Funds'), # 30 Day Federal Funds '&ZR_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Rough Rice'), # Rough Rice '&ZS_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybeans'), # Soybeans '&ZT_CCB':('Bonds','Government Bonds','Government Bonds','Government Bonds', '2-Year US T-Note'), # 2-Year US T-Note '&ZW_CCB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Chicago SRW Wheat'), # Chicago SRW Wheat '&6A':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'AUD'), # AUD '&6B':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'GBP'), # GBP '&6C':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'CAD'), # CAD '&6E':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'EUR'), # EUR '&6J':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'JPY'), # JPY '&6M':('Currencies', 'EM Currencies', 'EM Currencies', 'EM Currencies', 'MXN'), # MXN '&6N':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'NZD'), # NZD '&6S':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'CHF'), # CHF '&AFB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Eastern Australia Feed Barley'), # Eastern Australia Feed Barley '&AWM':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Eastern Australia Wheat'), # Eastern Australia Wheat '&BAX':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Canadian Bankers Acceptance'), # Canadian Bankers Acceptance '&BRN':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Brent Crude Oil'), # Brent Crude Oil '&BTC':('Currencies', 'Crypto Currencies', 'Crypto Currencies', 'Crypto Currencies', 'Bitcoin'), # Bitcoin '&CC':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Cocoa'), # Cocoa '&CGB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Canadian 10y'), # Canadian 10 Yr Govt Bond '&CL':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil - Light Sweet'), # Crude Oil - Light Sweet '&CT':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Cotton #2'), # Cotton #2 '&DC':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Milk - Class III'), # Milk - Class III '&DX':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'Benchmark'), # US Dollar Index '&EH':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Ethanol'), # Ethanol '&EMD':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P MidCap 400 E-mini'), # S&P MidCap 400 E-mini '&ES':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P 500 E-mini'), # S&P 500 E-mini '&EUA':('Commodities', 'Energy', 'Energy', 'Energy', 'EUA (Carbon Emissions)'), # EUA (Carbon Emissions) '&FBTP':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-BTP Long Term'), # Euro-BTP Long Term '&FCE':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'CAC 40'), # CAC 40 '&FDAX':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'DAX'), # DAX '&FDAX9':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'DAX'), # DAX, Last in Close field '&FESX':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'EURO STOXX 50'), # EURO STOXX 50 '&FESX9':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'EURO STOXX 50'), # EURO STOXX 50, Last in Close field '&FGBL':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Bund - 10 Yr'), # Euro-Bund - 10 Yr '&FGBM':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Bobl - 5 Yr'), # Euro-Bobl - 5 Yr '&FGBS':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Schatz - 2 Yr'), # Euro-Schatz - 2 Yr '&FGBX':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Euro-Buxl - 30 Yr'), # Euro-Buxl - 30 Yr '&FOAT':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro-OAT Continuous Contract'), # Euro-OAT Continuous Contract '&FOAT9':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro-OAT(L) Continuous Contract'), # Euro-OAT(L) Continuous Contract '&FSMI':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Swiss Market Index'), # Swiss Market Index '&FTDX':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'TecDAX'), # TecDAX '&GAS':('Commodities', 'Energy', 'Energy', 'Energy', 'Gas Oil'), # Gas Oil '&GC':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold'), # Gold '&GD':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # GS&P GSCI '&GE':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Eurodollar'), # Eurodollar '&GF':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Feeder Cattle'), # Feeder Cattle '&GWM':('Commodities', 'Energy', 'Energy', 'Energy', 'UK Natural Gas'), # UK Natural Gas '&HE':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Lean Hogs'), # Lean Hogs '&HG':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper '&HO':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'NY Harbor ULSD'), # NY Harbor ULSD '&HSI':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Hang Seng Index'), # Hang Seng Index '&HTW':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Taiwan Index'), # MSCI Taiwan Index '&KC':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Coffee C'), # Coffee C '&KE':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'KC HRW Wheat'), # KC HRW Wheat '&KOS':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'KOSPI 200'), # KOSPI 200 '&LBS':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Lumber'), # Lumber '&LCC':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'London Cocoa'), # London Cocoa '&LE':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Live Cattle'), # Live Cattle '&LES':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euro Swiss'), # Euro Swiss '&LEU':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euribor'), # Euribor '&LEU9':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Euribor'), # Euribor, Official Close '&LFT':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE 100'), # FTSE 100 '&LFT9':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE 100'), # FTSE 100, Official Close '&LLG':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Long Gilt'), # Long Gilt '&LRC':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Robusta Coffee'), # Robusta Coffee '&LSS':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'Short Sterling'), # Short Sterling '&LSU':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'White Sugar'), # White Sugar '&LWB':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Feed Wheat'), # Feed Wheat '&MHI':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Hang Seng Index'), # Hang Seng Index - Mini '&MWE':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Hard Red Spring Wheat'), # Hard Red Spring Wheat '&NG':('Commodities', 'Energy', 'Energy', 'Energy', 'Henry Hub Natural Gas'), # Henry Hub Natural Gas '&NIY':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 Yen '&NKD':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 Dollar '&NQ':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nasdaq-100 - E-mini'), # Nasdaq-100 - E-mini '&OJ':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Frozen Concentrated Orange Juice'), # Frozen Concentrated Orange Juice '&PA':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Palladium'), # Palladium '&PL':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Platinum'), # Platinum '&RB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'RBOB Gasoline'), # RBOB Gasoline '&RS':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Canola'), # Canola '&RTY':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Russell 2000 - E-mini'), # Russell 2000 - E-mini '&SB':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Sugar No. 11'), # Sugar No. 11 '&SCN':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'FTSE China A50 Index'), # FTSE China A50 Index '&SI':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver'), # Silver '&SIN':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'SGX Nifty 50 Index'), # SGX Nifty 50 Index '&SJB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Japanese Govt Bond - Mini'), # Japanese Govt Bond - Mini '&SNK':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'Nikkei 225'), # Nikkei 225 (SGX) '&SP':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P 500'), # S&P 500 '&SR3':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', '3M SOFR Continuous Contract'), # 3M SOFR Continuous Contract '&SSG':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Singapore Index'), # MSCI Singapore Index '&STW':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'MSCI Taiwan Index'), # MSCI Taiwan Index, Discontinued '&SXF':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'S&P/TSX 60 Index'), # S&P/TSX 60 Index '&TN':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Ultra 10 Year U.S. T-Note'), # Ultra 10 Year U.S. T-Note '&UB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'Ultra U.S. T-Bond'), # Ultra U.S. T-Bond '&VX':('Volatility', 'Volatility', 'Volatility', 'Volatility', 'Cboe Volatility Index'), # Cboe Volatility Index '&WBS':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'WTI Crude Oil'), # WTI Crude Oil '&YAP':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200 '&YAP4':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200, Day '&YAP10':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'ASX SPI 200'), # ASX SPI 200, Night '&YG':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold - Mini'), # Gold - Mini '&YI':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver - Mini'), # Silver - Mini '&YIB':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'ASX 30 Day Interbank Cash Rate'), # ASX 30 Day Interbank Cash Rate '&YIR':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', 'ASX 90 Day Bank Accepted Bills'), # ASX 90 Day Bank Accepted Bills '&YM':('Equity Indices', 'Equity Indices','Equity Indices','Equity Indices', 'E-mini Dow'), # E-mini Dow '&YXT':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'ASX 10 Year Treasury Bond'), # ASX 10 Year Treasury Bond '&YYT':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'ASX 3 Year Treasury Bond'), # ASX 3 Year Treasury Bond '&ZB':('Bonds','Government Bonds','Government Bonds','Government Bonds', 'U.S. T-Bond'), # U.S. T-Bond '&ZC':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Corn'), # Corn '&ZF':('Bonds','Government Bonds','Government Bonds','Government Bonds', '5-Year US T-Note'), # 5-Year US T-Note '&ZG':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold'), # Gold 100oz, Discountinued '&ZI':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver'), # Silver 5000oz, Discontinued '&ZL':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybean Oil'), # Soybean Oil '&ZM':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybean Meal'), # Soybean Meal '&ZN':('Bonds','Government Bonds','Government Bonds','Government Bonds', '10-Year US T-Note'), # 10-Year US T-Note '&ZO':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Oats'), # Oats '&ZQ':('Interest Rates', 'Interest Rates', 'Interest Rates', 'Interest Rates', '30 Day Federal Funds'), # 30 Day Federal Funds '&ZR':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Rough Rice'), # Rough Rice '&ZS':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybeans'), # Soybeans '&ZT':('Bonds','Government Bonds','Government Bonds','Government Bonds', '2-Year US T-Note'), # 2-Year US T-Note '&ZW':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Chicago SRW Wheat'), # Chicago SRW Wheat '#GSR':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Benchmark'), # Gold/Silver Ratio '$BCOM':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # Bloomberg Commodity Index '$BCOMAG':('Commodities','Diversified Agriculture', 'Agriculture', 'Agriculture', 'Benchmark'), # Bloomberg Agriculture Sub-Index '$BCOMEN':('Commodities', 'Energy', 'Energy', 'Energy', 'Benchmark'), # Bloomberg Energy Sub-Index '$BCOMGR':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Benchmark'), # Bloomberg Grains Sub-Index '$BCOMIN':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Benchmark'), # Bloomberg Industrial Metals Sub-Index '$BCOMLI':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Benchmark'), # Bloomberg Livestock Sub-Index '$BCOMPE':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Benchmark') , # Bloomberg Petroleum Sub-Index '$BCOMPR':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Benchmark'), # Bloomberg Precious Metals Sub-Index '$BCOMSO':('Commodities','Diversified Agriculture', 'Agriculture', 'Softs', 'Benchmark'), # Bloomberg Softs Sub-Index '$BCOMTR':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # Bloomberg Commodity Total Return Index '$BCOMXE':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # Bloomberg Ex-Energy Sub-Index '$CRB':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # Refinitiv/CoreCommodity CRB Index '$FC':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Feeder Cattle'), # CME Feeder Cattle Index '$LH':('Commodities','Diversified Agriculture', 'Livestock', 'Livestock', 'Lean Hogs'), # CME Lean Hogs Index '$LMEX':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Benchmark'), # LMEX Index '$RBABCA':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Bulk Commodities Sub-Index (AUD) '$RBABCU':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Bulk Commodities Sub-Index (USD) '$RBABMA':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Benchmark'), # RBA Base Metals Sub-Index (AUD) '$RBABMU':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Benchmark'), # RBA Base Metals Sub-Index (USD) '$RBACPA':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Commodity Prices Index (AUD) '$RBACPU':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Commodity Prices Index (USD) '$RBANRCPA':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Non-Rural Commodity Prices Sub-Index (AUD) '$RBANRCPU':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # RBA Non-Rural Commodity Prices Sub-Index (USD) '$RBARCPA':('Commodities', 'Diversified Agriculture', 'Diversified Agriculture', 'Diversified Agriculture', 'Benchmark'), # RBA Rural Commodity Prices Sub-Index (AUD) '$RBARCPU':('Commodities', 'Diversified Agriculture', 'Diversified Agriculture', 'Diversified Agriculture', 'Benchmark'), # RBA Rural Commodity Prices Sub-Index (USD) '$SPGSCI':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # S&P GSCI Spot Index '$SPGSCITR':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # S&P GSCI Total Return Index '$SPGSEW':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # S&P GSCI Select Equal Weight Spot Index '$SPGSEWTR':('Commodities', 'Commodities', 'Commodities', 'Commodities', 'Benchmark'), # S&P GSCI Select Equal Weight Total Return Index '@AA':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy - LME Official Cash '@AA03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy - LME 03 Months Seller '@AAWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy - LME Warehouse Opening Stocks '@AL':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium - LME Official Cash '@AL03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium - LME 03 Months Seller '@ALAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium - LME Official Cash (AUD) '@ALCAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium - LME Official Cash (CAD) '@ALWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium - LME Warehouse Opening Stocks '@BFOE':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil'), # Brent Crude Europe FOB Spot '@C2Y':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Corn'), # Corn #2 Yellow Central Illinois Average Price Spot '@CO':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Cobalt'), # Cobalt - LME Official Cash '@CO03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Cobalt'), # Cobalt - LME 03 Months Seller '@CO15S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Cobalt'), # Cobalt - LME 15 Months Seller '@COWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Cobalt'), # Cobalt - LME Warehouse Opening Stocks '@CU':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper - LME Official Cash '@CU03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper - LME 03 Months Seller '@CUAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper - LME Official Cash (AUD) '@CUCAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper - LME Official Cash (CAD) '@CUWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Copper'), # Copper - LME Warehouse Opening Stocks '@FE':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Iron Ore'), # Iron Ore CFR China 62% Fe Spot '@FEAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Iron Ore'), # Iron Ore CFR China 62% Fe Spot (AUD) '@FECAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Iron Ore'), # Iron Ore CFR China 62% Fe Spot (CAD) '@GC':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Gold'), # Gold - London PM Fix '@HHNG':('Commodities', 'Energy', 'Energy', 'Energy', 'Natural Gas'), # Henry Hub Natural Gas Spot '@HO':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Heating Oil'), # Heating Oil Spot '@NA':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy (NASAAC) - LME Official Cash '@NA03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy (NASAAC) - LME 03 Months Seller '@NAWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Aluminium'), # Aluminium Alloy (NASAAC) - LME Warehouse Opening Stocks '@NI':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Nickel'), # Nickel - LME Official Cash '@NI03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Nickel'), # Nickel - LME 03 Months Seller '@NIAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Nickel'), # Nickel - LME Official Cash (AUD) '@NICAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Nickel'), # Nickel - LME Official Cash (CAD) '@NIWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Nickel'), # Nickel - LME Warehouse Opening Stocks '@PA':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Palladium'), # Palladium - London PM Fix '@PAAUD':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Palladium'), # Palladium - London PM Fix (AUD) '@PACAD':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Palladium'), # Palladium - London PM Fix (CAD) '@PB':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Lead'), # Lead - LME Official Cash '@PB03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Lead'), # Lead - LME 03 Months Seller '@PBAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Lead'), # Lead - LME Official Cash (AUD) '@PBCAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Lead'), # Lead - LME Official Cash (CAD) '@PBWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Lead'), # Lead - LME Warehouse Opening Stocks '@PL':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Platinum'), # Platinum - London PM Fix '@PLAUD':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Platinum'), # Platinum - London PM Fix (AUD) '@PLCAD':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Platinum'), # Platinum - London PM Fix (CAD) '@RBOB':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'RBOB Gasoline'), # RBOB Gasoline Spot '@S1Y':('Commodities','Diversified Agriculture', 'Agriculture', 'Grains', 'Soybeans'), # Soybeans #1 Yellow Central Illinois Average Price Spot '@SI':('Commodities', 'Metals', 'Precious Metals', 'Precious Metals', 'Silver'), # Silver - London Fix '@SN':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME Official Cash '@SN03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME 03 Months Seller '@SN15S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME 15 Months Seller '@SNAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME Official Cash (AUD) '@SNCAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME Official Cash (CAD) '@SNWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Tin'), # Tin - LME Warehouse Opening Stocks '@U3O8':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Uranium'), # Uranium Spot '@U3O8AUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Uranium'), # Uranium Spot (AUD) '@U3O8CAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Uranium'), # Uranium Spot (CAD) '@WTI':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil'), # West Texas Intermediate Crude Oil Spot '@WTIAUD':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil'), # West Texas Intermediate Crude Oil Spot (AUD) '@WTICAD':('Commodities', 'Energy', 'Petroleum', 'Petroleum', 'Crude Oil'), # West Texas Intermediate Crude Oil Spot (CAD) '@YCX':('Commodities', 'Energy', 'Energy', 'Energy', 'Thermal Coal'), # Thermal Coal Spot '@YCXAUD':('Commodities', 'Energy', 'Energy', 'Energy', 'Thermal Coal'), # Thermal Coal Spot (AUD) '@YCXCAD':('Commodities', 'Energy', 'Energy', 'Energy', 'Thermal Coal'), # Thermal Coal Spot (CAD) '@ZN':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Zinc'), # Zinc - LME Official Cash '@ZN03S':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Zinc'), # Zinc - LME 03 Months Seller '@ZNAUD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Zinc'), # Zinc - LME Official Cash (AUD) '@ZNCAD':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Zinc'), # Zinc - LME Official Cash (CAD) '@ZNWS':('Commodities', 'Metals', 'Industrial Metals', 'Industrial Metals', 'Zinc'), # Zinc - LME Warehouse Opening Stocks }, 'equity_sector_mappings':{ 'Oil & Gas Drilling':('Energy','Energy','Energy Equipment & Services'), 'Oil & Gas Equipment & Services':('Energy','Energy','Energy Equipment & Services'), 'Integrated Oil & Gas':('Energy','Energy','Oil, Gas & Consumable Fuels'), 'Oil & Gas Exploration & Production':('Energy','Energy','Oil, Gas & Consumable Fuels'), 'Oil & Gas Refining & Marketing':('Energy','Energy','Oil, Gas & Consumable Fuels'), 'Oil & Gas Storage & Transportation':('Energy','Energy','Oil, Gas & Consumable Fuels'), 'Coal & Consumable Fuels':('Energy','Energy','Oil, Gas & Consumable Fuels'), 'Commodity Chemicals':('Materials','Materials','Chemicals'), 'Diversified Chemicals':('Materials','Materials','Chemicals'), 'Fertilizers & Agricultural Chemicals':('Materials','Materials','Chemicals'), 'Industrial Gases':('Materials','Materials','Chemicals'), 'Specialty Chemicals':('Materials','Materials','Chemicals'), 'Construction Materials':('Materials','Materials','Construction Materials'), 'Metal & Glass Containers':('Materials','Materials','Containers & Packaging'), 'Paper Packaging':('Materials','Materials','Containers & Packaging'), 'Aluminum':('Materials','Materials','Metals & Mining'), 'Diversified Metals & Mining':('Materials','Materials','Metals & Mining'), 'Copper':('Materials','Materials','Metals & Mining'), 'Gold':('Materials','Materials','Metals & Mining'), 'Precious Metals & Minerals':('Materials','Materials','Metals & Mining'), 'Silver':('Materials','Materials','Metals & Mining'), 'Steel':('Materials','Materials','Metals & Mining'), 'Forest Products':('Materials','Materials','Paper & Forest Products'), 'Paper Products':('Materials','Materials','Paper & Forest Products'), 'Aerospace & Defense':('Industrials','Capital Goods','Aerospace & Defense'), 'Building Products':('Industrials','Capital Goods','Building Products'), 'Construction & Engineering':('Industrials','Capital Goods','Construction & Engineering'), 'Electrical Components & Equipment':('Industrials','Capital Goods','Electrical Equipment'), 'Heavy Electrical Equipment':('Industrials','Capital Goods','Electrical Equipment'), 'Industrial Conglomerates':('Industrials','Capital Goods','Industrial Conglomerates'), 'Construction Machinery & Heavy Trucks':('Industrials','Capital Goods','Machinery'), 'Agricultural & Farm Machinery':('Industrials','Capital Goods','Machinery'), 'Industrial Machinery':('Industrials','Capital Goods','Machinery'), 'Trading Companies & Distributors':('Industrials','Capital Goods','Trading Companies & Distributors'), 'Commercial Printing':('Industrials','Commercial & Professional Services','Commercial Services & Supplies'), 'Environmental & Facilities Services':('Industrials','Commercial & Professional Services','Commercial Services & Supplies'), 'Office Services & Supplies':('Industrials','Commercial & Professional Services','Commercial Services & Supplies'), 'Diversified Support Services':('Industrials','Commercial & Professional Services','Commercial Services & Supplies'), 'Security & Alarm Services':('Industrials','Commercial & Professional Services','Commercial Services & Supplies'), 'Human Resource & Employment Services':('Industrials','Commercial & Professional Services','Professional Services'), 'Research & Consulting Services':('Industrials','Commercial & Professional Services','Professional Services'), 'Air Freight & Logistics':('Industrials','Transportation','Air Freight & Logistics'), 'Airlines':('Industrials','Transportation','Airlines'), 'Marine':('Industrials','Transportation','Marine'), 'Railroads':('Industrials','Transportation','Road & Rail'), 'Trucking':('Industrials','Transportation','Road & Rail'), 'Airport Services':('Industrials','Transportation','Transportation Infrastructure'), 'Highways & Railtracks':('Industrials','Transportation','Transportation Infrastructure'), 'Marine Ports & Services':('Industrials','Transportation','Transportation Infrastructure'), 'Auto Parts & Equipment':('Consumer Discretionary','Automobiles & Components','Auto Components'), 'Tires & Rubber':('Consumer Discretionary','Automobiles & Components','Auto Components'), 'Automobile Manufacturers':('Consumer Discretionary','Automobiles & Components','Automobiles'), 'Motorcycle Manufacturers':('Consumer Discretionary','Automobiles & Components','Automobiles'), 'Consumer Electronics':('Consumer Discretionary','Consumer Durables & Apparel','Household Durables'), 'Home Furnishings':('Consumer Discretionary','Consumer Durables & Apparel','Household Durables'), 'Homebuilding':('Consumer Discretionary','Consumer Durables & Apparel','Household Durables'), 'Household Appliances':('Consumer Discretionary','Consumer Durables & Apparel','Household Durables'), 'Housewares & Specialties':('Consumer Discretionary','Consumer Durables & Apparel','Household Durables'), 'Leisure Products':('Consumer Discretionary','Consumer Durables & Apparel','Leisure Products'), 'Apparel, Accessories & Luxury Goods':('Consumer Discretionary','Consumer Durables & Apparel','Textiles, Apparel & Luxury Goods'), 'Footwear':('Consumer Discretionary','Consumer Durables & Apparel','Textiles, Apparel & Luxury Goods'), 'Textiles':('Consumer Discretionary','Consumer Durables & Apparel','Textiles, Apparel & Luxury Goods'), 'Casinos & Gaming':('Consumer Discretionary','Consumer Services','Hotels, Restaurants & Leisure'), 'Hotels, Resorts & Cruise Lines':('Consumer Discretionary','Consumer Services','Hotels, Restaurants & Leisure'), 'Leisure Facilities':('Consumer Discretionary','Consumer Services','Hotels, Restaurants & Leisure'), 'Restaurants':('Consumer Discretionary','Consumer Services','Hotels, Restaurants & Leisure'), 'Education Services':('Consumer Discretionary','Consumer Services','Diversified Consumer Services'), 'Specialized Consumer Services':('Consumer Discretionary','Consumer Services','Diversified Consumer Services'), 'Distributors':('Consumer Discretionary','Retailing','Distributors'), 'Internet & Direct Marketing Retail':('Consumer Discretionary','Retailing','Internet & Direct Marketing Retail'), 'Department Stores':('Consumer Discretionary','Retailing','Multiline Retail'), 'General Merchandise Stores':('Consumer Discretionary','Retailing','Multiline Retail'), 'Apparel Retail':('Consumer Discretionary','Retailing','Specialty Retail'), 'Computer & Electronics Retail':('Consumer Discretionary','Retailing','Specialty Retail'), 'Home Improvement Retail':('Consumer Discretionary','Retailing','Specialty Retail'), 'Specialty Stores':('Consumer Discretionary','Retailing','Specialty Retail'), 'Automotive Retail':('Consumer Discretionary','Retailing','Specialty Retail'), 'Homefurnishing Retail':('Consumer Discretionary','Retailing','Specialty Retail'), 'Drug Retail':('Consumer Staples','Food & Staples Retailing','Food & Staples Retailing'), 'Food Distributors':('Consumer Staples','Food & Staples Retailing','Food & Staples Retailing'), 'Food Retail':('Consumer Staples','Food & Staples Retailing','Food & Staples Retailing'), 'Hypermarkets & Super Centers':('Consumer Staples','Food & Staples Retailing','Food & Staples Retailing'), 'Brewers':('Consumer Staples','Food, Beverage & Tobacco','Beverages'), 'Distillers & Vintners':('Consumer Staples','Food, Beverage & Tobacco','Beverages'), 'Soft Drinks':('Consumer Staples','Food, Beverage & Tobacco','Beverages'), 'Agricultural Products':('Consumer Staples','Food, Beverage & Tobacco','Food Products'), 'Packaged Foods & Meats':('Consumer Staples','Food, Beverage & Tobacco','Food Products'), 'Tobacco':('Consumer Staples','Food, Beverage & Tobacco','Tobacco'), 'Household Products':('Consumer Staples','Household & Personal Products','Household Products'), 'Personal Products':('Consumer Staples','Household & Personal Products','Personal Products'), 'Health Care Equipment':('Health Care','Health Care Equipment & Services','Health Care Equipment & Supplies'), 'Health Care Supplies':('Health Care','Health Care Equipment & Services','Health Care Equipment & Supplies'), 'Health Care Distributors':('Health Care','Health Care Equipment & Services','Health Care Providers & Services'), 'Health Care Services':('Health Care','Health Care Equipment & Services','Health Care Providers & Services'), 'Health Care Facilities':('Health Care','Health Care Equipment & Services','Health Care Providers & Services'), 'Managed Health Care':('Health Care','Health Care Equipment & Services','Health Care Providers & Services'), 'Health Care Technology':('Health Care','Health Care Equipment & Services','Health Care Technology'), 'Biotechnology':('Health Care','Pharmaceuticals, Biotechnology & Life Sciences','Biotechnology'), 'Pharmaceuticals':('Health Care','Pharmaceuticals, Biotechnology & Life Sciences','Pharmaceuticals'), 'Life Sciences Tools & Services':('Health Care','Pharmaceuticals, Biotechnology & Life Sciences','Life Sciences Tools & Services'), 'Diversified Banks':('Financials','Banks','Banks'), 'Regional Banks':('Financials','Banks','Banks'), 'Thrifts & Mortgage Finance':('Financials','Banks','Thrifts & Mortgage Finance'), 'Other Diversified Financial Services':('Financials','Diversified Financials','Diversified Financial Services'), 'Multi-Sector Holdings':('Financials','Diversified Financials','Diversified Financial Services'), 'Specialized Finance':('Financials','Diversified Financials','Diversified Financial Services'), 'Consumer Finance':('Financials','Diversified Financials','Consumer Finance'), 'Asset Management & Custody Banks':('Financials','Diversified Financials','Capital Markets'), 'Investment Banking & Brokerage':('Financials','Diversified Financials','Capital Markets'), 'Diversified Capital Markets':('Financials','Diversified Financials','Capital Markets'), 'Financial Exchanges & Data':('Financials','Diversified Financials','Capital Markets'), 'Mortgage REITs':('Financials','Diversified Financials','Mortgage Real Estate Investment Trusts (REITs)'), 'Insurance Brokers':('Financials','Insurance','Insurance'), 'Life & Health Insurance':('Financials','Insurance','Insurance'), 'Multi-line Insurance':('Financials','Insurance','Insurance'), 'Property & Casualty Insurance':('Financials','Insurance','Insurance'), 'Reinsurance':('Financials','Insurance','Insurance'), 'IT Consulting & Other Services':('Information Technology','Software & Services','IT Services'), 'Data Processing & Outsourced Services':('Information Technology','Software & Services','IT Services'), 'Internet Services & Infrastructure':('Information Technology','Software & Services','IT Services'), 'Application Software':('Information Technology','Software & Services','Software'), 'Systems Software':('Information Technology','Software & Services','Software'), 'Communications Equipment':('Information Technology','Technology Hardware & Equipment','Communications Equipment'), 'Technology Hardware, Storage & Peripherals':('Information Technology','Technology Hardware & Equipment','Technology Hardware, Storage & Peripherals'), 'Electronic Equipment & Instruments':('Information Technology','Technology Hardware & Equipment','Electronic Equipment, Instruments & Components'), 'Electronic Components':('Information Technology','Technology Hardware & Equipment','Electronic Equipment, Instruments & Components'), 'Electronic Manufacturing Services':('Information Technology','Technology Hardware & Equipment','Electronic Equipment, Instruments & Components'), 'Technology Distributors':('Information Technology','Technology Hardware & Equipment','Electronic Equipment, Instruments & Components'), 'Semiconductor Equipment':('Information Technology','Semiconductors & Semiconductor Equipment','Semiconductors & Semiconductor Equipment'), 'Semiconductors':('Information Technology','Semiconductors & Semiconductor Equipment','Semiconductors & Semiconductor Equipment'), 'Alternative Carriers':('Communication Services','Communication Services','Diversified Telecommunication Services'), 'Integrated Telecommunication Services':('Communication Services','Communication Services','Diversified Telecommunication Services'), 'Wireless Telecommunication Services':('Communication Services','Communication Services','Wireless Telecommunication Services'), 'Advertising':('Communication Services','Media & Entertainment','Media'), 'Broadcasting':('Communication Services','Media & Entertainment','Media'), 'Cable & Satellite':('Communication Services','Media & Entertainment','Media'), 'Publishing':('Communication Services','Media & Entertainment','Media'), 'Movies & Entertainment':('Communication Services','Media & Entertainment','Entertainment'), 'Interactive Home Entertainment':('Communication Services','Media & Entertainment','Entertainment'), 'Interactive Media & Services':('Communication Services','Media & Entertainment','Interactive Media & Services'), 'Electric Utilities':('Utilities','Utilities','Electric Utilities'), 'Gas Utilities':('Utilities','Utilities','Gas Utilities'), 'Multi-Utilities':('Utilities','Utilities','Multi-Utilities'), 'Water Utilities':('Utilities','Utilities','Water Utilities'), 'Independent Power Producers & Energy Traders':('Utilities','Utilities','Independent Power and Renewable Electricity Producers'), 'Renewable Electricity':('Utilities','Utilities','Independent Power and Renewable Electricity Producers'), 'Diversified REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Industrial REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Hotel & Resort REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Office REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Health Care REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Residential REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Retail REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Specialized REITs':('Real Estate','Real Estate','Equity Real Estate Investment Trusts (REITs)'), 'Diversified Real Estate Activities':('Real Estate','Real Estate','Real Estate Management & Development'), 'Real Estate Operating Companies':('Real Estate','Real Estate','Real Estate Management & Development'), 'Real Estate Development':('Real Estate','Real Estate','Real Estate Management & Development'), 'Real Estate Services':('Real Estate','Real Estate','Real Estate Management & Development'), }, }
# https://app.codesignal.com/arcade/intro/level-1/jwr339Kq6e3LQTsfa # Write a function that returns the sum of two numbers. def add(param1: int = 0, param2: int = 0) -> int: if ( isinstance(param1, int) and isinstance(param2, int) and -1000 <= param1 <= 1000 and -1000 <= param2 <= 1000 ): return param1 + param2 return 0
n=int(input()) cus=[int(input()) for i in range(n)] m=int(input()) price=[int(input()) for i in range(m)] price.sort(reverse=True) cus.sort(reverse=True) answer=0 C,P=0,0 while C<n and P<m: if cus[C]>=price[P]: answer+=price[P] C+=1 P+=1 else: P+=1 print(answer)
# https://adventofcode.com/2021/day/17#part2 def solve(target): (x1, x2), (y1, y2) = target count = 0 for i in range(-1000, 1000): # wew, try bruteforce for j in range(1, x2+1): hit = check(j, i, target) if hit: count += 1 return count def check(a, b, target): (x1, x2), (y1, y2) = target x, y = 0, 0 vx, vy = a, b while True: # Update current position x = x + vx y = y + vy # Update velocity change after this step vx = vx - 1 if vx > 0 else 0 if vx == 0 else vx + 1 vy = vy - 1 if x >= x1 and x <= x2 and y >= y1 and y <= y2: return True if x > x2 or y < y1: return False def input_processing(content): content = content[len('target area: '):] x_coords, y_coords = content.split(',') x1, x2 = x_coords.strip()[len('x='):].split('..') y1, y2 = y_coords.strip()[len('y='):].split('..') return ((int(x1), int(x2)), (int(y1), int(y2))) if __name__ == '__main__': f = open('input.txt') target = input_processing(f.read()) print(target) res = solve(target) print(res)
vegetables = [ { "type":"fruit", "items":[ { "color":"green", "items":[ "kiwi", "grape" ] }, { "color":"red", "items":[ "strawberry", "apple" ] } ] }, { "type":"vegs", "items":[ { "color":"green", "items":[ "lettuce" ] }, { "color":"red", "items":[ "pepper", ] } ] } ] a = list(filter(lambda i: i[ 'type' ] == 'fruit', vegetables)) print (a[0]['items'][0]['items'][0])
__all__ = ["reservation", "user_info", "calendar"] for _import in __all__: __import__(f"{__package__}.{_import}")
# Generated by h2py from Include\scintilla.h # Included from BaseTsd.h def HandleToUlong(h): return HandleToULong(h) def UlongToHandle(ul): return ULongToHandle(ul) def UlongToPtr(ul): return ULongToPtr(ul) def UintToPtr(ui): return UIntToPtr(ui) INVALID_POSITION = -1 SCI_START = 2000 SCI_OPTIONAL_START = 3000 SCI_LEXER_START = 4000 SCI_ADDTEXT = 2001 SCI_ADDSTYLEDTEXT = 2002 SCI_INSERTTEXT = 2003 SCI_CLEARALL = 2004 SCI_CLEARDOCUMENTSTYLE = 2005 SCI_GETLENGTH = 2006 SCI_GETCHARAT = 2007 SCI_GETCURRENTPOS = 2008 SCI_GETANCHOR = 2009 SCI_GETSTYLEAT = 2010 SCI_REDO = 2011 SCI_SETUNDOCOLLECTION = 2012 SCI_SELECTALL = 2013 SCI_SETSAVEPOINT = 2014 SCI_GETSTYLEDTEXT = 2015 SCI_CANREDO = 2016 SCI_MARKERLINEFROMHANDLE = 2017 SCI_MARKERDELETEHANDLE = 2018 SCI_GETUNDOCOLLECTION = 2019 SCWS_INVISIBLE = 0 SCWS_VISIBLEALWAYS = 1 SCWS_VISIBLEAFTERINDENT = 2 SCI_GETVIEWWS = 2020 SCI_SETVIEWWS = 2021 SCI_POSITIONFROMPOINT = 2022 SCI_POSITIONFROMPOINTCLOSE = 2023 SCI_GOTOLINE = 2024 SCI_GOTOPOS = 2025 SCI_SETANCHOR = 2026 SCI_GETCURLINE = 2027 SCI_GETENDSTYLED = 2028 SC_EOL_CRLF = 0 SC_EOL_CR = 1 SC_EOL_LF = 2 SCI_CONVERTEOLS = 2029 SCI_GETEOLMODE = 2030 SCI_SETEOLMODE = 2031 SCI_STARTSTYLING = 2032 SCI_SETSTYLING = 2033 SCI_GETBUFFEREDDRAW = 2034 SCI_SETBUFFEREDDRAW = 2035 SCI_SETTABWIDTH = 2036 SCI_GETTABWIDTH = 2121 SC_CP_UTF8 = 65001 SC_CP_DBCS = 1 SCI_SETCODEPAGE = 2037 SCI_SETUSEPALETTE = 2039 MARKER_MAX = 31 SC_MARK_CIRCLE = 0 SC_MARK_ROUNDRECT = 1 SC_MARK_ARROW = 2 SC_MARK_SMALLRECT = 3 SC_MARK_SHORTARROW = 4 SC_MARK_EMPTY = 5 SC_MARK_ARROWDOWN = 6 SC_MARK_MINUS = 7 SC_MARK_PLUS = 8 SC_MARK_VLINE = 9 SC_MARK_LCORNER = 10 SC_MARK_TCORNER = 11 SC_MARK_BOXPLUS = 12 SC_MARK_BOXPLUSCONNECTED = 13 SC_MARK_BOXMINUS = 14 SC_MARK_BOXMINUSCONNECTED = 15 SC_MARK_LCORNERCURVE = 16 SC_MARK_TCORNERCURVE = 17 SC_MARK_CIRCLEPLUS = 18 SC_MARK_CIRCLEPLUSCONNECTED = 19 SC_MARK_CIRCLEMINUS = 20 SC_MARK_CIRCLEMINUSCONNECTED = 21 SC_MARK_BACKGROUND = 22 SC_MARK_DOTDOTDOT = 23 SC_MARK_ARROWS = 24 SC_MARK_PIXMAP = 25 SC_MARK_CHARACTER = 10000 SC_MARKNUM_FOLDEREND = 25 SC_MARKNUM_FOLDEROPENMID = 26 SC_MARKNUM_FOLDERMIDTAIL = 27 SC_MARKNUM_FOLDERTAIL = 28 SC_MARKNUM_FOLDERSUB = 29 SC_MARKNUM_FOLDER = 30 SC_MARKNUM_FOLDEROPEN = 31 SC_MASK_FOLDERS = (-33554432) SCI_MARKERDEFINE = 2040 SCI_MARKERSETFORE = 2041 SCI_MARKERSETBACK = 2042 SCI_MARKERADD = 2043 SCI_MARKERDELETE = 2044 SCI_MARKERDELETEALL = 2045 SCI_MARKERGET = 2046 SCI_MARKERNEXT = 2047 SCI_MARKERPREVIOUS = 2048 SCI_MARKERDEFINEPIXMAP = 2049 SC_MARGIN_SYMBOL = 0 SC_MARGIN_NUMBER = 1 SCI_SETMARGINTYPEN = 2240 SCI_GETMARGINTYPEN = 2241 SCI_SETMARGINWIDTHN = 2242 SCI_GETMARGINWIDTHN = 2243 SCI_SETMARGINMASKN = 2244 SCI_GETMARGINMASKN = 2245 SCI_SETMARGINSENSITIVEN = 2246 SCI_GETMARGINSENSITIVEN = 2247 STYLE_DEFAULT = 32 STYLE_LINENUMBER = 33 STYLE_BRACELIGHT = 34 STYLE_BRACEBAD = 35 STYLE_CONTROLCHAR = 36 STYLE_INDENTGUIDE = 37 STYLE_LASTPREDEFINED = 39 STYLE_MAX = 127 SC_CHARSET_ANSI = 0 SC_CHARSET_DEFAULT = 1 SC_CHARSET_BALTIC = 186 SC_CHARSET_CHINESEBIG5 = 136 SC_CHARSET_EASTEUROPE = 238 SC_CHARSET_GB2312 = 134 SC_CHARSET_GREEK = 161 SC_CHARSET_HANGUL = 129 SC_CHARSET_MAC = 77 SC_CHARSET_OEM = 255 SC_CHARSET_RUSSIAN = 204 SC_CHARSET_SHIFTJIS = 128 SC_CHARSET_SYMBOL = 2 SC_CHARSET_TURKISH = 162 SC_CHARSET_JOHAB = 130 SC_CHARSET_HEBREW = 177 SC_CHARSET_ARABIC = 178 SC_CHARSET_VIETNAMESE = 163 SC_CHARSET_THAI = 222 SCI_STYLECLEARALL = 2050 SCI_STYLESETFORE = 2051 SCI_STYLESETBACK = 2052 SCI_STYLESETBOLD = 2053 SCI_STYLESETITALIC = 2054 SCI_STYLESETSIZE = 2055 SCI_STYLESETFONT = 2056 SCI_STYLESETEOLFILLED = 2057 SCI_STYLERESETDEFAULT = 2058 SCI_STYLESETUNDERLINE = 2059 SC_CASE_MIXED = 0 SC_CASE_UPPER = 1 SC_CASE_LOWER = 2 SCI_STYLESETCASE = 2060 SCI_STYLESETCHARACTERSET = 2066 SCI_STYLESETHOTSPOT = 2409 SCI_SETSELFORE = 2067 SCI_SETSELBACK = 2068 SCI_SETCARETFORE = 2069 SCI_ASSIGNCMDKEY = 2070 SCI_CLEARCMDKEY = 2071 SCI_CLEARALLCMDKEYS = 2072 SCI_SETSTYLINGEX = 2073 SCI_STYLESETVISIBLE = 2074 SCI_GETCARETPERIOD = 2075 SCI_SETCARETPERIOD = 2076 SCI_SETWORDCHARS = 2077 SCI_BEGINUNDOACTION = 2078 SCI_ENDUNDOACTION = 2079 INDIC_MAX = 7 INDIC_PLAIN = 0 INDIC_SQUIGGLE = 1 INDIC_TT = 2 INDIC_DIAGONAL = 3 INDIC_STRIKE = 4 INDIC_HIDDEN = 5 INDIC_BOX = 6 INDIC0_MASK = 0x20 INDIC1_MASK = 0x40 INDIC2_MASK = 0x80 INDICS_MASK = 0xE0 SCI_INDICSETSTYLE = 2080 SCI_INDICGETSTYLE = 2081 SCI_INDICSETFORE = 2082 SCI_INDICGETFORE = 2083 SCI_SETWHITESPACEFORE = 2084 SCI_SETWHITESPACEBACK = 2085 SCI_SETSTYLEBITS = 2090 SCI_GETSTYLEBITS = 2091 SCI_SETLINESTATE = 2092 SCI_GETLINESTATE = 2093 SCI_GETMAXLINESTATE = 2094 SCI_GETCARETLINEVISIBLE = 2095 SCI_SETCARETLINEVISIBLE = 2096 SCI_GETCARETLINEBACK = 2097 SCI_SETCARETLINEBACK = 2098 SCI_STYLESETCHANGEABLE = 2099 SCI_AUTOCSHOW = 2100 SCI_AUTOCCANCEL = 2101 SCI_AUTOCACTIVE = 2102 SCI_AUTOCPOSSTART = 2103 SCI_AUTOCCOMPLETE = 2104 SCI_AUTOCSTOPS = 2105 SCI_AUTOCSETSEPARATOR = 2106 SCI_AUTOCGETSEPARATOR = 2107 SCI_AUTOCSELECT = 2108 SCI_AUTOCSETCANCELATSTART = 2110 SCI_AUTOCGETCANCELATSTART = 2111 SCI_AUTOCSETFILLUPS = 2112 SCI_AUTOCSETCHOOSESINGLE = 2113 SCI_AUTOCGETCHOOSESINGLE = 2114 SCI_AUTOCSETIGNORECASE = 2115 SCI_AUTOCGETIGNORECASE = 2116 SCI_USERLISTSHOW = 2117 SCI_AUTOCSETAUTOHIDE = 2118 SCI_AUTOCGETAUTOHIDE = 2119 SCI_AUTOCSETDROPRESTOFWORD = 2270 SCI_AUTOCGETDROPRESTOFWORD = 2271 SCI_REGISTERIMAGE = 2405 SCI_CLEARREGISTEREDIMAGES = 2408 SCI_AUTOCGETTYPESEPARATOR = 2285 SCI_AUTOCSETTYPESEPARATOR = 2286 SCI_SETINDENT = 2122 SCI_GETINDENT = 2123 SCI_SETUSETABS = 2124 SCI_GETUSETABS = 2125 SCI_SETLINEINDENTATION = 2126 SCI_GETLINEINDENTATION = 2127 SCI_GETLINEINDENTPOSITION = 2128 SCI_GETCOLUMN = 2129 SCI_SETHSCROLLBAR = 2130 SCI_GETHSCROLLBAR = 2131 SCI_SETINDENTATIONGUIDES = 2132 SCI_GETINDENTATIONGUIDES = 2133 SCI_SETHIGHLIGHTGUIDE = 2134 SCI_GETHIGHLIGHTGUIDE = 2135 SCI_GETLINEENDPOSITION = 2136 SCI_GETCODEPAGE = 2137 SCI_GETCARETFORE = 2138 SCI_GETUSEPALETTE = 2139 SCI_GETREADONLY = 2140 SCI_SETCURRENTPOS = 2141 SCI_SETSELECTIONSTART = 2142 SCI_GETSELECTIONSTART = 2143 SCI_SETSELECTIONEND = 2144 SCI_GETSELECTIONEND = 2145 SCI_SETPRINTMAGNIFICATION = 2146 SCI_GETPRINTMAGNIFICATION = 2147 SC_PRINT_NORMAL = 0 SC_PRINT_INVERTLIGHT = 1 SC_PRINT_BLACKONWHITE = 2 SC_PRINT_COLOURONWHITE = 3 SC_PRINT_COLOURONWHITEDEFAULTBG = 4 SCI_SETPRINTCOLOURMODE = 2148 SCI_GETPRINTCOLOURMODE = 2149 SCFIND_WHOLEWORD = 2 SCFIND_MATCHCASE = 4 SCFIND_WORDSTART = 0x00100000 SCFIND_REGEXP = 0x00200000 SCFIND_POSIX = 0x00400000 SCI_FINDTEXT = 2150 SCI_FORMATRANGE = 2151 SCI_GETFIRSTVISIBLELINE = 2152 SCI_GETLINE = 2153 SCI_GETLINECOUNT = 2154 SCI_SETMARGINLEFT = 2155 SCI_GETMARGINLEFT = 2156 SCI_SETMARGINRIGHT = 2157 SCI_GETMARGINRIGHT = 2158 SCI_GETMODIFY = 2159 SCI_SETSEL = 2160 SCI_GETSELTEXT = 2161 SCI_GETTEXTRANGE = 2162 SCI_HIDESELECTION = 2163 SCI_POINTXFROMPOSITION = 2164 SCI_POINTYFROMPOSITION = 2165 SCI_LINEFROMPOSITION = 2166 SCI_POSITIONFROMLINE = 2167 SCI_LINESCROLL = 2168 SCI_SCROLLCARET = 2169 SCI_REPLACESEL = 2170 SCI_SETREADONLY = 2171 SCI_NULL = 2172 SCI_CANPASTE = 2173 SCI_CANUNDO = 2174 SCI_EMPTYUNDOBUFFER = 2175 SCI_UNDO = 2176 SCI_CUT = 2177 SCI_COPY = 2178 SCI_PASTE = 2179 SCI_CLEAR = 2180 SCI_SETTEXT = 2181 SCI_GETTEXT = 2182 SCI_GETTEXTLENGTH = 2183 SCI_GETDIRECTFUNCTION = 2184 SCI_GETDIRECTPOINTER = 2185 SCI_SETOVERTYPE = 2186 SCI_GETOVERTYPE = 2187 SCI_SETCARETWIDTH = 2188 SCI_GETCARETWIDTH = 2189 SCI_SETTARGETSTART = 2190 SCI_GETTARGETSTART = 2191 SCI_SETTARGETEND = 2192 SCI_GETTARGETEND = 2193 SCI_REPLACETARGET = 2194 SCI_REPLACETARGETRE = 2195 SCI_SEARCHINTARGET = 2197 SCI_SETSEARCHFLAGS = 2198 SCI_GETSEARCHFLAGS = 2199 SCI_CALLTIPSHOW = 2200 SCI_CALLTIPCANCEL = 2201 SCI_CALLTIPACTIVE = 2202 SCI_CALLTIPPOSSTART = 2203 SCI_CALLTIPSETHLT = 2204 SCI_CALLTIPSETBACK = 2205 SCI_CALLTIPSETFORE = 2206 SCI_CALLTIPSETFOREHLT = 2207 SCI_VISIBLEFROMDOCLINE = 2220 SCI_DOCLINEFROMVISIBLE = 2221 SC_FOLDLEVELBASE = 0x400 SC_FOLDLEVELWHITEFLAG = 0x1000 SC_FOLDLEVELHEADERFLAG = 0x2000 SC_FOLDLEVELBOXHEADERFLAG = 0x4000 SC_FOLDLEVELBOXFOOTERFLAG = 0x8000 SC_FOLDLEVELCONTRACTED = 0x10000 SC_FOLDLEVELUNINDENT = 0x20000 SC_FOLDLEVELNUMBERMASK = 0x0FFF SCI_SETFOLDLEVEL = 2222 SCI_GETFOLDLEVEL = 2223 SCI_GETLASTCHILD = 2224 SCI_GETFOLDPARENT = 2225 SCI_SHOWLINES = 2226 SCI_HIDELINES = 2227 SCI_GETLINEVISIBLE = 2228 SCI_SETFOLDEXPANDED = 2229 SCI_GETFOLDEXPANDED = 2230 SCI_TOGGLEFOLD = 2231 SCI_ENSUREVISIBLE = 2232 SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002 SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004 SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008 SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010 SC_FOLDFLAG_LEVELNUMBERS = 0x0040 SC_FOLDFLAG_BOX = 0x0001 SCI_SETFOLDFLAGS = 2233 SCI_ENSUREVISIBLEENFORCEPOLICY = 2234 SCI_SETTABINDENTS = 2260 SCI_GETTABINDENTS = 2261 SCI_SETBACKSPACEUNINDENTS = 2262 SCI_GETBACKSPACEUNINDENTS = 2263 SC_TIME_FOREVER = 10000000 SCI_SETMOUSEDWELLTIME = 2264 SCI_GETMOUSEDWELLTIME = 2265 SCI_WORDSTARTPOSITION = 2266 SCI_WORDENDPOSITION = 2267 SC_WRAP_NONE = 0 SC_WRAP_WORD = 1 SCI_SETWRAPMODE = 2268 SCI_GETWRAPMODE = 2269 SC_CACHE_NONE = 0 SC_CACHE_CARET = 1 SC_CACHE_PAGE = 2 SC_CACHE_DOCUMENT = 3 SCI_SETLAYOUTCACHE = 2272 SCI_GETLAYOUTCACHE = 2273 SCI_SETSCROLLWIDTH = 2274 SCI_GETSCROLLWIDTH = 2275 SCI_TEXTWIDTH = 2276 SCI_SETENDATLASTLINE = 2277 SCI_GETENDATLASTLINE = 2278 SCI_TEXTHEIGHT = 2279 SCI_SETVSCROLLBAR = 2280 SCI_GETVSCROLLBAR = 2281 SCI_APPENDTEXT = 2282 SCI_GETTWOPHASEDRAW = 2283 SCI_SETTWOPHASEDRAW = 2284 SCI_TARGETFROMSELECTION = 2287 SCI_LINESJOIN = 2288 SCI_LINESSPLIT = 2289 SCI_SETFOLDMARGINCOLOUR = 2290 SCI_SETFOLDMARGINHICOLOUR = 2291 SCI_LINEDOWN = 2300 SCI_LINEDOWNEXTEND = 2301 SCI_LINEUP = 2302 SCI_LINEUPEXTEND = 2303 SCI_CHARLEFT = 2304 SCI_CHARLEFTEXTEND = 2305 SCI_CHARRIGHT = 2306 SCI_CHARRIGHTEXTEND = 2307 SCI_WORDLEFT = 2308 SCI_WORDLEFTEXTEND = 2309 SCI_WORDRIGHT = 2310 SCI_WORDRIGHTEXTEND = 2311 SCI_HOME = 2312 SCI_HOMEEXTEND = 2313 SCI_LINEEND = 2314 SCI_LINEENDEXTEND = 2315 SCI_DOCUMENTSTART = 2316 SCI_DOCUMENTSTARTEXTEND = 2317 SCI_DOCUMENTEND = 2318 SCI_DOCUMENTENDEXTEND = 2319 SCI_PAGEUP = 2320 SCI_PAGEUPEXTEND = 2321 SCI_PAGEDOWN = 2322 SCI_PAGEDOWNEXTEND = 2323 SCI_EDITTOGGLEOVERTYPE = 2324 SCI_CANCEL = 2325 SCI_DELETEBACK = 2326 SCI_TAB = 2327 SCI_BACKTAB = 2328 SCI_NEWLINE = 2329 SCI_FORMFEED = 2330 SCI_VCHOME = 2331 SCI_VCHOMEEXTEND = 2332 SCI_ZOOMIN = 2333 SCI_ZOOMOUT = 2334 SCI_DELWORDLEFT = 2335 SCI_DELWORDRIGHT = 2336 SCI_LINECUT = 2337 SCI_LINEDELETE = 2338 SCI_LINETRANSPOSE = 2339 SCI_LINEDUPLICATE = 2404 SCI_LOWERCASE = 2340 SCI_UPPERCASE = 2341 SCI_LINESCROLLDOWN = 2342 SCI_LINESCROLLUP = 2343 SCI_DELETEBACKNOTLINE = 2344 SCI_HOMEDISPLAY = 2345 SCI_HOMEDISPLAYEXTEND = 2346 SCI_LINEENDDISPLAY = 2347 SCI_LINEENDDISPLAYEXTEND = 2348 SCI_HOMEWRAP = 2349 SCI_HOMEWRAPEXTEND = 2450 SCI_LINEENDWRAP = 2451 SCI_LINEENDWRAPEXTEND = 2452 SCI_VCHOMEWRAP = 2453 SCI_VCHOMEWRAPEXTEND = 2454 SCI_LINECOPY = 2455 SCI_MOVECARETINSIDEVIEW = 2401 SCI_LINELENGTH = 2350 SCI_BRACEHIGHLIGHT = 2351 SCI_BRACEBADLIGHT = 2352 SCI_BRACEMATCH = 2353 SCI_GETVIEWEOL = 2355 SCI_SETVIEWEOL = 2356 SCI_GETDOCPOINTER = 2357 SCI_SETDOCPOINTER = 2358 SCI_SETMODEVENTMASK = 2359 EDGE_NONE = 0 EDGE_LINE = 1 EDGE_BACKGROUND = 2 SCI_GETEDGECOLUMN = 2360 SCI_SETEDGECOLUMN = 2361 SCI_GETEDGEMODE = 2362 SCI_SETEDGEMODE = 2363 SCI_GETEDGECOLOUR = 2364 SCI_SETEDGECOLOUR = 2365 SCI_SEARCHANCHOR = 2366 SCI_SEARCHNEXT = 2367 SCI_SEARCHPREV = 2368 SCI_LINESONSCREEN = 2370 SCI_USEPOPUP = 2371 SCI_SELECTIONISRECTANGLE = 2372 SCI_SETZOOM = 2373 SCI_GETZOOM = 2374 SCI_CREATEDOCUMENT = 2375 SCI_ADDREFDOCUMENT = 2376 SCI_RELEASEDOCUMENT = 2377 SCI_GETMODEVENTMASK = 2378 SCI_SETFOCUS = 2380 SCI_GETFOCUS = 2381 SCI_SETSTATUS = 2382 SCI_GETSTATUS = 2383 SCI_SETMOUSEDOWNCAPTURES = 2384 SCI_GETMOUSEDOWNCAPTURES = 2385 SC_CURSORNORMAL = -1 SC_CURSORWAIT = 4 SCI_SETCURSOR = 2386 SCI_GETCURSOR = 2387 SCI_SETCONTROLCHARSYMBOL = 2388 SCI_GETCONTROLCHARSYMBOL = 2389 SCI_WORDPARTLEFT = 2390 SCI_WORDPARTLEFTEXTEND = 2391 SCI_WORDPARTRIGHT = 2392 SCI_WORDPARTRIGHTEXTEND = 2393 VISIBLE_SLOP = 0x01 VISIBLE_STRICT = 0x04 SCI_SETVISIBLEPOLICY = 2394 SCI_DELLINELEFT = 2395 SCI_DELLINERIGHT = 2396 SCI_SETXOFFSET = 2397 SCI_GETXOFFSET = 2398 SCI_CHOOSECARETX = 2399 SCI_GRABFOCUS = 2400 CARET_SLOP = 0x01 CARET_STRICT = 0x04 CARET_JUMPS = 0x10 CARET_EVEN = 0x08 SCI_SETXCARETPOLICY = 2402 SCI_SETYCARETPOLICY = 2403 SCI_SETPRINTWRAPMODE = 2406 SCI_GETPRINTWRAPMODE = 2407 SCI_SETHOTSPOTACTIVEFORE = 2410 SCI_SETHOTSPOTACTIVEBACK = 2411 SCI_SETHOTSPOTACTIVEUNDERLINE = 2412 SCI_SETHOTSPOTSINGLELINE = 2421 SCI_PARADOWN = 2413 SCI_PARADOWNEXTEND = 2414 SCI_PARAUP = 2415 SCI_PARAUPEXTEND = 2416 SCI_POSITIONBEFORE = 2417 SCI_POSITIONAFTER = 2418 SCI_COPYRANGE = 2419 SCI_COPYTEXT = 2420 SC_SEL_STREAM = 0 SC_SEL_RECTANGLE = 1 SC_SEL_LINES = 2 SCI_SETSELECTIONMODE = 2422 SCI_GETSELECTIONMODE = 2423 SCI_GETLINESELSTARTPOSITION = 2424 SCI_GETLINESELENDPOSITION = 2425 SCI_LINEDOWNRECTEXTEND = 2426 SCI_LINEUPRECTEXTEND = 2427 SCI_CHARLEFTRECTEXTEND = 2428 SCI_CHARRIGHTRECTEXTEND = 2429 SCI_HOMERECTEXTEND = 2430 SCI_VCHOMERECTEXTEND = 2431 SCI_LINEENDRECTEXTEND = 2432 SCI_PAGEUPRECTEXTEND = 2433 SCI_PAGEDOWNRECTEXTEND = 2434 SCI_STUTTEREDPAGEUP = 2435 SCI_STUTTEREDPAGEUPEXTEND = 2436 SCI_STUTTEREDPAGEDOWN = 2437 SCI_STUTTEREDPAGEDOWNEXTEND = 2438 SCI_WORDLEFTEND = 2439 SCI_WORDLEFTENDEXTEND = 2440 SCI_WORDRIGHTEND = 2441 SCI_WORDRIGHTENDEXTEND = 2442 SCI_SETWHITESPACECHARS = 2443 SCI_SETCHARSDEFAULT = 2444 SCI_STARTRECORD = 3001 SCI_STOPRECORD = 3002 SCI_SETLEXER = 4001 SCI_GETLEXER = 4002 SCI_COLOURISE = 4003 SCI_SETPROPERTY = 4004 KEYWORDSET_MAX = 8 SCI_SETKEYWORDS = 4005 SCI_SETLEXERLANGUAGE = 4006 SCI_LOADLEXERLIBRARY = 4007 SC_MOD_INSERTTEXT = 0x1 SC_MOD_DELETETEXT = 0x2 SC_MOD_CHANGESTYLE = 0x4 SC_MOD_CHANGEFOLD = 0x8 SC_PERFORMED_USER = 0x10 SC_PERFORMED_UNDO = 0x20 SC_PERFORMED_REDO = 0x40 SC_LASTSTEPINUNDOREDO = 0x100 SC_MOD_CHANGEMARKER = 0x200 SC_MOD_BEFOREINSERT = 0x400 SC_MOD_BEFOREDELETE = 0x800 SC_MODEVENTMASKALL = 0xF77 SCEN_CHANGE = 768 SCEN_SETFOCUS = 512 SCEN_KILLFOCUS = 256 SCK_DOWN = 300 SCK_UP = 301 SCK_LEFT = 302 SCK_RIGHT = 303 SCK_HOME = 304 SCK_END = 305 SCK_PRIOR = 306 SCK_NEXT = 307 SCK_DELETE = 308 SCK_INSERT = 309 SCK_ESCAPE = 7 SCK_BACK = 8 SCK_TAB = 9 SCK_RETURN = 13 SCK_ADD = 310 SCK_SUBTRACT = 311 SCK_DIVIDE = 312 SCMOD_SHIFT = 1 SCMOD_CTRL = 2 SCMOD_ALT = 4 SCN_STYLENEEDED = 2000 SCN_CHARADDED = 2001 SCN_SAVEPOINTREACHED = 2002 SCN_SAVEPOINTLEFT = 2003 SCN_MODIFYATTEMPTRO = 2004 SCN_KEY = 2005 SCN_DOUBLECLICK = 2006 SCN_UPDATEUI = 2007 SCN_MODIFIED = 2008 SCN_MACRORECORD = 2009 SCN_MARGINCLICK = 2010 SCN_NEEDSHOWN = 2011 SCN_PAINTED = 2013 SCN_USERLISTSELECTION = 2014 SCN_URIDROPPED = 2015 SCN_DWELLSTART = 2016 SCN_DWELLEND = 2017 SCN_ZOOM = 2018 SCN_HOTSPOTCLICK = 2019 SCN_HOTSPOTDOUBLECLICK = 2020 SCN_CALLTIPCLICK = 2021 SCI_SETCARETPOLICY = 2369 CARET_CENTER = 0x02 CARET_XEVEN = 0x08 CARET_XJUMPS = 0x10 SCN_POSCHANGED = 2012 SCN_CHECKBRACE = 2007 # Generated by h2py from Include\scilexer.h SCLEX_CONTAINER = 0 SCLEX_NULL = 1 SCLEX_PYTHON = 2 SCLEX_CPP = 3 SCLEX_HTML = 4 SCLEX_XML = 5 SCLEX_PERL = 6 SCLEX_SQL = 7 SCLEX_VB = 8 SCLEX_PROPERTIES = 9 SCLEX_ERRORLIST = 10 SCLEX_MAKEFILE = 11 SCLEX_BATCH = 12 SCLEX_XCODE = 13 SCLEX_LATEX = 14 SCLEX_LUA = 15 SCLEX_DIFF = 16 SCLEX_CONF = 17 SCLEX_PASCAL = 18 SCLEX_AVE = 19 SCLEX_ADA = 20 SCLEX_LISP = 21 SCLEX_RUBY = 22 SCLEX_EIFFEL = 23 SCLEX_EIFFELKW = 24 SCLEX_TCL = 25 SCLEX_NNCRONTAB = 26 SCLEX_BULLANT = 27 SCLEX_VBSCRIPT = 28 SCLEX_ASP = 29 SCLEX_PHP = 30 SCLEX_BAAN = 31 SCLEX_MATLAB = 32 SCLEX_SCRIPTOL = 33 SCLEX_ASM = 34 SCLEX_CPPNOCASE = 35 SCLEX_FORTRAN = 36 SCLEX_F77 = 37 SCLEX_CSS = 38 SCLEX_POV = 39 SCLEX_LOUT = 40 SCLEX_ESCRIPT = 41 SCLEX_PS = 42 SCLEX_NSIS = 43 SCLEX_MMIXAL = 44 SCLEX_CLW = 45 SCLEX_CLWNOCASE = 46 SCLEX_LOT = 47 SCLEX_YAML = 48 SCLEX_TEX = 49 SCLEX_METAPOST = 50 SCLEX_POWERBASIC = 51 SCLEX_FORTH = 52 SCLEX_ERLANG = 53 SCLEX_AUTOMATIC = 1000 SCE_P_DEFAULT = 0 SCE_P_COMMENTLINE = 1 SCE_P_NUMBER = 2 SCE_P_STRING = 3 SCE_P_CHARACTER = 4 SCE_P_WORD = 5 SCE_P_TRIPLE = 6 SCE_P_TRIPLEDOUBLE = 7 SCE_P_CLASSNAME = 8 SCE_P_DEFNAME = 9 SCE_P_OPERATOR = 10 SCE_P_IDENTIFIER = 11 SCE_P_COMMENTBLOCK = 12 SCE_P_STRINGEOL = 13 SCE_C_DEFAULT = 0 SCE_C_COMMENT = 1 SCE_C_COMMENTLINE = 2 SCE_C_COMMENTDOC = 3 SCE_C_NUMBER = 4 SCE_C_WORD = 5 SCE_C_STRING = 6 SCE_C_CHARACTER = 7 SCE_C_UUID = 8 SCE_C_PREPROCESSOR = 9 SCE_C_OPERATOR = 10 SCE_C_IDENTIFIER = 11 SCE_C_STRINGEOL = 12 SCE_C_VERBATIM = 13 SCE_C_REGEX = 14 SCE_C_COMMENTLINEDOC = 15 SCE_C_WORD2 = 16 SCE_C_COMMENTDOCKEYWORD = 17 SCE_C_COMMENTDOCKEYWORDERROR = 18 SCE_C_GLOBALCLASS = 19 SCE_H_DEFAULT = 0 SCE_H_TAG = 1 SCE_H_TAGUNKNOWN = 2 SCE_H_ATTRIBUTE = 3 SCE_H_ATTRIBUTEUNKNOWN = 4 SCE_H_NUMBER = 5 SCE_H_DOUBLESTRING = 6 SCE_H_SINGLESTRING = 7 SCE_H_OTHER = 8 SCE_H_COMMENT = 9 SCE_H_ENTITY = 10 SCE_H_TAGEND = 11 SCE_H_XMLSTART = 12 SCE_H_XMLEND = 13 SCE_H_SCRIPT = 14 SCE_H_ASP = 15 SCE_H_ASPAT = 16 SCE_H_CDATA = 17 SCE_H_QUESTION = 18 SCE_H_VALUE = 19 SCE_H_XCCOMMENT = 20 SCE_H_SGML_DEFAULT = 21 SCE_H_SGML_COMMAND = 22 SCE_H_SGML_1ST_PARAM = 23 SCE_H_SGML_DOUBLESTRING = 24 SCE_H_SGML_SIMPLESTRING = 25 SCE_H_SGML_ERROR = 26 SCE_H_SGML_SPECIAL = 27 SCE_H_SGML_ENTITY = 28 SCE_H_SGML_COMMENT = 29 SCE_H_SGML_1ST_PARAM_COMMENT = 30 SCE_H_SGML_BLOCK_DEFAULT = 31 SCE_HJ_START = 40 SCE_HJ_DEFAULT = 41 SCE_HJ_COMMENT = 42 SCE_HJ_COMMENTLINE = 43 SCE_HJ_COMMENTDOC = 44 SCE_HJ_NUMBER = 45 SCE_HJ_WORD = 46 SCE_HJ_KEYWORD = 47 SCE_HJ_DOUBLESTRING = 48 SCE_HJ_SINGLESTRING = 49 SCE_HJ_SYMBOLS = 50 SCE_HJ_STRINGEOL = 51 SCE_HJ_REGEX = 52 SCE_HJA_START = 55 SCE_HJA_DEFAULT = 56 SCE_HJA_COMMENT = 57 SCE_HJA_COMMENTLINE = 58 SCE_HJA_COMMENTDOC = 59 SCE_HJA_NUMBER = 60 SCE_HJA_WORD = 61 SCE_HJA_KEYWORD = 62 SCE_HJA_DOUBLESTRING = 63 SCE_HJA_SINGLESTRING = 64 SCE_HJA_SYMBOLS = 65 SCE_HJA_STRINGEOL = 66 SCE_HJA_REGEX = 67 SCE_HB_START = 70 SCE_HB_DEFAULT = 71 SCE_HB_COMMENTLINE = 72 SCE_HB_NUMBER = 73 SCE_HB_WORD = 74 SCE_HB_STRING = 75 SCE_HB_IDENTIFIER = 76 SCE_HB_STRINGEOL = 77 SCE_HBA_START = 80 SCE_HBA_DEFAULT = 81 SCE_HBA_COMMENTLINE = 82 SCE_HBA_NUMBER = 83 SCE_HBA_WORD = 84 SCE_HBA_STRING = 85 SCE_HBA_IDENTIFIER = 86 SCE_HBA_STRINGEOL = 87 SCE_HP_START = 90 SCE_HP_DEFAULT = 91 SCE_HP_COMMENTLINE = 92 SCE_HP_NUMBER = 93 SCE_HP_STRING = 94 SCE_HP_CHARACTER = 95 SCE_HP_WORD = 96 SCE_HP_TRIPLE = 97 SCE_HP_TRIPLEDOUBLE = 98 SCE_HP_CLASSNAME = 99 SCE_HP_DEFNAME = 100 SCE_HP_OPERATOR = 101 SCE_HP_IDENTIFIER = 102 SCE_HPA_START = 105 SCE_HPA_DEFAULT = 106 SCE_HPA_COMMENTLINE = 107 SCE_HPA_NUMBER = 108 SCE_HPA_STRING = 109 SCE_HPA_CHARACTER = 110 SCE_HPA_WORD = 111 SCE_HPA_TRIPLE = 112 SCE_HPA_TRIPLEDOUBLE = 113 SCE_HPA_CLASSNAME = 114 SCE_HPA_DEFNAME = 115 SCE_HPA_OPERATOR = 116 SCE_HPA_IDENTIFIER = 117 SCE_HPHP_DEFAULT = 118 SCE_HPHP_HSTRING = 119 SCE_HPHP_SIMPLESTRING = 120 SCE_HPHP_WORD = 121 SCE_HPHP_NUMBER = 122 SCE_HPHP_VARIABLE = 123 SCE_HPHP_COMMENT = 124 SCE_HPHP_COMMENTLINE = 125 SCE_HPHP_HSTRING_VARIABLE = 126 SCE_HPHP_OPERATOR = 127 SCE_PL_DEFAULT = 0 SCE_PL_ERROR = 1 SCE_PL_COMMENTLINE = 2 SCE_PL_POD = 3 SCE_PL_NUMBER = 4 SCE_PL_WORD = 5 SCE_PL_STRING = 6 SCE_PL_CHARACTER = 7 SCE_PL_PUNCTUATION = 8 SCE_PL_PREPROCESSOR = 9 SCE_PL_OPERATOR = 10 SCE_PL_IDENTIFIER = 11 SCE_PL_SCALAR = 12 SCE_PL_ARRAY = 13 SCE_PL_HASH = 14 SCE_PL_SYMBOLTABLE = 15 SCE_PL_REGEX = 17 SCE_PL_REGSUBST = 18 SCE_PL_LONGQUOTE = 19 SCE_PL_BACKTICKS = 20 SCE_PL_DATASECTION = 21 SCE_PL_HERE_DELIM = 22 SCE_PL_HERE_Q = 23 SCE_PL_HERE_QQ = 24 SCE_PL_HERE_QX = 25 SCE_PL_STRING_Q = 26 SCE_PL_STRING_QQ = 27 SCE_PL_STRING_QX = 28 SCE_PL_STRING_QR = 29 SCE_PL_STRING_QW = 30 SCE_B_DEFAULT = 0 SCE_B_COMMENT = 1 SCE_B_NUMBER = 2 SCE_B_KEYWORD = 3 SCE_B_STRING = 4 SCE_B_PREPROCESSOR = 5 SCE_B_OPERATOR = 6 SCE_B_IDENTIFIER = 7 SCE_B_DATE = 8 SCE_PROPS_DEFAULT = 0 SCE_PROPS_COMMENT = 1 SCE_PROPS_SECTION = 2 SCE_PROPS_ASSIGNMENT = 3 SCE_PROPS_DEFVAL = 4 SCE_L_DEFAULT = 0 SCE_L_COMMAND = 1 SCE_L_TAG = 2 SCE_L_MATH = 3 SCE_L_COMMENT = 4 SCE_LUA_DEFAULT = 0 SCE_LUA_COMMENT = 1 SCE_LUA_COMMENTLINE = 2 SCE_LUA_COMMENTDOC = 3 SCE_LUA_NUMBER = 4 SCE_LUA_WORD = 5 SCE_LUA_STRING = 6 SCE_LUA_CHARACTER = 7 SCE_LUA_LITERALSTRING = 8 SCE_LUA_PREPROCESSOR = 9 SCE_LUA_OPERATOR = 10 SCE_LUA_IDENTIFIER = 11 SCE_LUA_STRINGEOL = 12 SCE_LUA_WORD2 = 13 SCE_LUA_WORD3 = 14 SCE_LUA_WORD4 = 15 SCE_LUA_WORD5 = 16 SCE_LUA_WORD6 = 17 SCE_LUA_WORD7 = 18 SCE_LUA_WORD8 = 19 SCE_ERR_DEFAULT = 0 SCE_ERR_PYTHON = 1 SCE_ERR_GCC = 2 SCE_ERR_MS = 3 SCE_ERR_CMD = 4 SCE_ERR_BORLAND = 5 SCE_ERR_PERL = 6 SCE_ERR_NET = 7 SCE_ERR_LUA = 8 SCE_ERR_CTAG = 9 SCE_ERR_DIFF_CHANGED = 10 SCE_ERR_DIFF_ADDITION = 11 SCE_ERR_DIFF_DELETION = 12 SCE_ERR_DIFF_MESSAGE = 13 SCE_ERR_PHP = 14 SCE_ERR_ELF = 15 SCE_ERR_IFC = 16 SCE_BAT_DEFAULT = 0 SCE_BAT_COMMENT = 1 SCE_BAT_WORD = 2 SCE_BAT_LABEL = 3 SCE_BAT_HIDE = 4 SCE_BAT_COMMAND = 5 SCE_BAT_IDENTIFIER = 6 SCE_BAT_OPERATOR = 7 SCE_MAKE_DEFAULT = 0 SCE_MAKE_COMMENT = 1 SCE_MAKE_PREPROCESSOR = 2 SCE_MAKE_IDENTIFIER = 3 SCE_MAKE_OPERATOR = 4 SCE_MAKE_TARGET = 5 SCE_MAKE_IDEOL = 9 SCE_DIFF_DEFAULT = 0 SCE_DIFF_COMMENT = 1 SCE_DIFF_COMMAND = 2 SCE_DIFF_HEADER = 3 SCE_DIFF_POSITION = 4 SCE_DIFF_DELETED = 5 SCE_DIFF_ADDED = 6 SCE_CONF_DEFAULT = 0 SCE_CONF_COMMENT = 1 SCE_CONF_NUMBER = 2 SCE_CONF_IDENTIFIER = 3 SCE_CONF_EXTENSION = 4 SCE_CONF_PARAMETER = 5 SCE_CONF_STRING = 6 SCE_CONF_OPERATOR = 7 SCE_CONF_IP = 8 SCE_CONF_DIRECTIVE = 9 SCE_AVE_DEFAULT = 0 SCE_AVE_COMMENT = 1 SCE_AVE_NUMBER = 2 SCE_AVE_WORD = 3 SCE_AVE_STRING = 6 SCE_AVE_ENUM = 7 SCE_AVE_STRINGEOL = 8 SCE_AVE_IDENTIFIER = 9 SCE_AVE_OPERATOR = 10 SCE_AVE_WORD1 = 11 SCE_AVE_WORD2 = 12 SCE_AVE_WORD3 = 13 SCE_AVE_WORD4 = 14 SCE_AVE_WORD5 = 15 SCE_AVE_WORD6 = 16 SCE_ADA_DEFAULT = 0 SCE_ADA_WORD = 1 SCE_ADA_IDENTIFIER = 2 SCE_ADA_NUMBER = 3 SCE_ADA_DELIMITER = 4 SCE_ADA_CHARACTER = 5 SCE_ADA_CHARACTEREOL = 6 SCE_ADA_STRING = 7 SCE_ADA_STRINGEOL = 8 SCE_ADA_LABEL = 9 SCE_ADA_COMMENTLINE = 10 SCE_ADA_ILLEGAL = 11 SCE_BAAN_DEFAULT = 0 SCE_BAAN_COMMENT = 1 SCE_BAAN_COMMENTDOC = 2 SCE_BAAN_NUMBER = 3 SCE_BAAN_WORD = 4 SCE_BAAN_STRING = 5 SCE_BAAN_PREPROCESSOR = 6 SCE_BAAN_OPERATOR = 7 SCE_BAAN_IDENTIFIER = 8 SCE_BAAN_STRINGEOL = 9 SCE_BAAN_WORD2 = 10 SCE_LISP_DEFAULT = 0 SCE_LISP_COMMENT = 1 SCE_LISP_NUMBER = 2 SCE_LISP_KEYWORD = 3 SCE_LISP_STRING = 6 SCE_LISP_STRINGEOL = 8 SCE_LISP_IDENTIFIER = 9 SCE_LISP_OPERATOR = 10 SCE_EIFFEL_DEFAULT = 0 SCE_EIFFEL_COMMENTLINE = 1 SCE_EIFFEL_NUMBER = 2 SCE_EIFFEL_WORD = 3 SCE_EIFFEL_STRING = 4 SCE_EIFFEL_CHARACTER = 5 SCE_EIFFEL_OPERATOR = 6 SCE_EIFFEL_IDENTIFIER = 7 SCE_EIFFEL_STRINGEOL = 8 SCE_NNCRONTAB_DEFAULT = 0 SCE_NNCRONTAB_COMMENT = 1 SCE_NNCRONTAB_TASK = 2 SCE_NNCRONTAB_SECTION = 3 SCE_NNCRONTAB_KEYWORD = 4 SCE_NNCRONTAB_MODIFIER = 5 SCE_NNCRONTAB_ASTERISK = 6 SCE_NNCRONTAB_NUMBER = 7 SCE_NNCRONTAB_STRING = 8 SCE_NNCRONTAB_ENVIRONMENT = 9 SCE_NNCRONTAB_IDENTIFIER = 10 SCE_FORTH_DEFAULT = 0 SCE_FORTH_COMMENT = 1 SCE_FORTH_COMMENT_ML = 2 SCE_FORTH_IDENTIFIER = 3 SCE_FORTH_CONTROL = 4 SCE_FORTH_KEYWORD = 5 SCE_FORTH_DEFWORD = 6 SCE_FORTH_PREWORD1 = 7 SCE_FORTH_PREWORD2 = 8 SCE_FORTH_NUMBER = 9 SCE_FORTH_STRING = 10 SCE_FORTH_LOCALE = 11 SCE_MATLAB_DEFAULT = 0 SCE_MATLAB_COMMENT = 1 SCE_MATLAB_COMMAND = 2 SCE_MATLAB_NUMBER = 3 SCE_MATLAB_KEYWORD = 4 SCE_MATLAB_STRING = 5 SCE_MATLAB_OPERATOR = 6 SCE_MATLAB_IDENTIFIER = 7 SCE_SCRIPTOL_DEFAULT = 0 SCE_SCRIPTOL_WHITE = 1 SCE_SCRIPTOL_COMMENTLINE = 2 SCE_SCRIPTOL_PERSISTENT = 3 SCE_SCRIPTOL_CSTYLE = 4 SCE_SCRIPTOL_COMMENTBLOCK = 5 SCE_SCRIPTOL_NUMBER = 6 SCE_SCRIPTOL_STRING = 7 SCE_SCRIPTOL_CHARACTER = 8 SCE_SCRIPTOL_STRINGEOL = 9 SCE_SCRIPTOL_KEYWORD = 10 SCE_SCRIPTOL_OPERATOR = 11 SCE_SCRIPTOL_IDENTIFIER = 12 SCE_SCRIPTOL_TRIPLE = 13 SCE_SCRIPTOL_CLASSNAME = 14 SCE_SCRIPTOL_PREPROCESSOR = 15 SCE_ASM_DEFAULT = 0 SCE_ASM_COMMENT = 1 SCE_ASM_NUMBER = 2 SCE_ASM_STRING = 3 SCE_ASM_OPERATOR = 4 SCE_ASM_IDENTIFIER = 5 SCE_ASM_CPUINSTRUCTION = 6 SCE_ASM_MATHINSTRUCTION = 7 SCE_ASM_REGISTER = 8 SCE_ASM_DIRECTIVE = 9 SCE_ASM_DIRECTIVEOPERAND = 10 SCE_ASM_COMMENTBLOCK = 11 SCE_ASM_CHARACTER = 12 SCE_ASM_STRINGEOL = 13 SCE_ASM_EXTINSTRUCTION = 14 SCE_F_DEFAULT = 0 SCE_F_COMMENT = 1 SCE_F_NUMBER = 2 SCE_F_STRING1 = 3 SCE_F_STRING2 = 4 SCE_F_STRINGEOL = 5 SCE_F_OPERATOR = 6 SCE_F_IDENTIFIER = 7 SCE_F_WORD = 8 SCE_F_WORD2 = 9 SCE_F_WORD3 = 10 SCE_F_PREPROCESSOR = 11 SCE_F_OPERATOR2 = 12 SCE_F_LABEL = 13 SCE_F_CONTINUATION = 14 SCE_CSS_DEFAULT = 0 SCE_CSS_TAG = 1 SCE_CSS_CLASS = 2 SCE_CSS_PSEUDOCLASS = 3 SCE_CSS_UNKNOWN_PSEUDOCLASS = 4 SCE_CSS_OPERATOR = 5 SCE_CSS_IDENTIFIER = 6 SCE_CSS_UNKNOWN_IDENTIFIER = 7 SCE_CSS_VALUE = 8 SCE_CSS_COMMENT = 9 SCE_CSS_ID = 10 SCE_CSS_IMPORTANT = 11 SCE_CSS_DIRECTIVE = 12 SCE_CSS_DOUBLESTRING = 13 SCE_CSS_SINGLESTRING = 14 SCE_POV_DEFAULT = 0 SCE_POV_COMMENT = 1 SCE_POV_COMMENTLINE = 2 SCE_POV_NUMBER = 3 SCE_POV_OPERATOR = 4 SCE_POV_IDENTIFIER = 5 SCE_POV_STRING = 6 SCE_POV_STRINGEOL = 7 SCE_POV_DIRECTIVE = 8 SCE_POV_BADDIRECTIVE = 9 SCE_POV_WORD2 = 10 SCE_POV_WORD3 = 11 SCE_POV_WORD4 = 12 SCE_POV_WORD5 = 13 SCE_POV_WORD6 = 14 SCE_POV_WORD7 = 15 SCE_POV_WORD8 = 16 SCE_LOUT_DEFAULT = 0 SCE_LOUT_COMMENT = 1 SCE_LOUT_NUMBER = 2 SCE_LOUT_WORD = 3 SCE_LOUT_WORD2 = 4 SCE_LOUT_WORD3 = 5 SCE_LOUT_WORD4 = 6 SCE_LOUT_STRING = 7 SCE_LOUT_OPERATOR = 8 SCE_LOUT_IDENTIFIER = 9 SCE_LOUT_STRINGEOL = 10 SCE_ESCRIPT_DEFAULT = 0 SCE_ESCRIPT_COMMENT = 1 SCE_ESCRIPT_COMMENTLINE = 2 SCE_ESCRIPT_COMMENTDOC = 3 SCE_ESCRIPT_NUMBER = 4 SCE_ESCRIPT_WORD = 5 SCE_ESCRIPT_STRING = 6 SCE_ESCRIPT_OPERATOR = 7 SCE_ESCRIPT_IDENTIFIER = 8 SCE_ESCRIPT_BRACE = 9 SCE_ESCRIPT_WORD2 = 10 SCE_ESCRIPT_WORD3 = 11 SCE_PS_DEFAULT = 0 SCE_PS_COMMENT = 1 SCE_PS_DSC_COMMENT = 2 SCE_PS_DSC_VALUE = 3 SCE_PS_NUMBER = 4 SCE_PS_NAME = 5 SCE_PS_KEYWORD = 6 SCE_PS_LITERAL = 7 SCE_PS_IMMEVAL = 8 SCE_PS_PAREN_ARRAY = 9 SCE_PS_PAREN_DICT = 10 SCE_PS_PAREN_PROC = 11 SCE_PS_TEXT = 12 SCE_PS_HEXSTRING = 13 SCE_PS_BASE85STRING = 14 SCE_PS_BADSTRINGCHAR = 15 SCE_NSIS_DEFAULT = 0 SCE_NSIS_COMMENT = 1 SCE_NSIS_STRINGDQ = 2 SCE_NSIS_STRINGLQ = 3 SCE_NSIS_STRINGRQ = 4 SCE_NSIS_FUNCTION = 5 SCE_NSIS_VARIABLE = 6 SCE_NSIS_LABEL = 7 SCE_NSIS_USERDEFINED = 8 SCE_NSIS_SECTIONDEF = 9 SCE_NSIS_SUBSECTIONDEF = 10 SCE_NSIS_IFDEFINEDEF = 11 SCE_NSIS_MACRODEF = 12 SCE_NSIS_STRINGVAR = 13 SCE_MMIXAL_LEADWS = 0 SCE_MMIXAL_COMMENT = 1 SCE_MMIXAL_LABEL = 2 SCE_MMIXAL_OPCODE = 3 SCE_MMIXAL_OPCODE_PRE = 4 SCE_MMIXAL_OPCODE_VALID = 5 SCE_MMIXAL_OPCODE_UNKNOWN = 6 SCE_MMIXAL_OPCODE_POST = 7 SCE_MMIXAL_OPERANDS = 8 SCE_MMIXAL_NUMBER = 9 SCE_MMIXAL_REF = 10 SCE_MMIXAL_CHAR = 11 SCE_MMIXAL_STRING = 12 SCE_MMIXAL_REGISTER = 13 SCE_MMIXAL_HEX = 14 SCE_MMIXAL_OPERATOR = 15 SCE_MMIXAL_SYMBOL = 16 SCE_MMIXAL_INCLUDE = 17 SCE_CLW_DEFAULT = 0 SCE_CLW_LABEL = 1 SCE_CLW_COMMENT = 2 SCE_CLW_STRING = 3 SCE_CLW_USER_IDENTIFIER = 4 SCE_CLW_INTEGER_CONSTANT = 5 SCE_CLW_REAL_CONSTANT = 6 SCE_CLW_PICTURE_STRING = 7 SCE_CLW_KEYWORD = 8 SCE_CLW_COMPILER_DIRECTIVE = 9 SCE_CLW_BUILTIN_PROCEDURES_FUNCTION = 10 SCE_CLW_STRUCTURE_DATA_TYPE = 11 SCE_CLW_ATTRIBUTE = 12 SCE_CLW_STANDARD_EQUATE = 13 SCE_CLW_ERROR = 14 SCE_LOT_DEFAULT = 0 SCE_LOT_HEADER = 1 SCE_LOT_BREAK = 2 SCE_LOT_SET = 3 SCE_LOT_PASS = 4 SCE_LOT_FAIL = 5 SCE_LOT_ABORT = 6 SCE_YAML_DEFAULT = 0 SCE_YAML_COMMENT = 1 SCE_YAML_IDENTIFIER = 2 SCE_YAML_KEYWORD = 3 SCE_YAML_NUMBER = 4 SCE_YAML_REFERENCE = 5 SCE_YAML_DOCUMENT = 6 SCE_YAML_TEXT = 7 SCE_YAML_ERROR = 8 SCE_TEX_DEFAULT = 0 SCE_TEX_SPECIAL = 1 SCE_TEX_GROUP = 2 SCE_TEX_SYMBOL = 3 SCE_TEX_COMMAND = 4 SCE_TEX_TEXT = 5 SCE_METAPOST_DEFAULT = 0 SCE_METAPOST_SPECIAL = 1 SCE_METAPOST_GROUP = 2 SCE_METAPOST_SYMBOL = 3 SCE_METAPOST_COMMAND = 4 SCE_METAPOST_TEXT = 5 SCE_METAPOST_EXTRA = 6 SCE_ERLANG_DEFAULT = 0 SCE_ERLANG_COMMENT = 1 SCE_ERLANG_VARIABLE = 2 SCE_ERLANG_NUMBER = 3 SCE_ERLANG_KEYWORD = 4 SCE_ERLANG_STRING = 5 SCE_ERLANG_OPERATOR = 6 SCE_ERLANG_ATOM = 7 SCE_ERLANG_FUNCTION_NAME = 8 SCE_ERLANG_CHARACTER = 9 SCE_ERLANG_MACRO = 10 SCE_ERLANG_RECORD = 11 SCE_ERLANG_SEPARATOR = 12 SCE_ERLANG_NODE_NAME = 13 SCE_ERLANG_UNKNOWN = 31
# # @lc app=leetcode id=970 lang=python3 # # [970] Powerful Integers # # @lc code=start class Solution(object): def powerfulIntegers(self, x, y, bound): """ :type x: int :type y: int :type bound: int :rtype: List[int] """ r = [] if bound < 2: return r else: i = 0 while x ** i + y ** 0 <= bound: j = 0 while x ** i + y ** j <= bound: r.append(x ** i + y ** j) if y == 1: break j += 1 if x == 1: break i += 1 return set(r) # @lc code=end
class Environment(): """ This is used as an input to contruct the graph. """ def __init__(self, names, matrix, alpha, prop): self.names = names # Names of Subclone Colony (List) self.relations = matrix # Adj Matrix representing relations self.alpha = alpha self.prop = prop def log(self): print('Logging Environment:') items = [f' --> {d}' for d in zip(self.names, self.alpha, self.prop)] for i in items: print(i) print(20 * '-*') def get_env_data(self): return [d for d in zip(self.names, self.alpha, self.prop)]
"""Toyota Connected Services API exceptions.""" class ToyotaLocaleNotValid(Exception): """Raise if locale string is not valid.""" class ToyotaLoginError(Exception): """Raise if a login error happens.""" class ToyotaInvalidToken(Exception): """Raise if token is invalid""" class ToyotaInvalidUsername(Exception): """Raise if username is invalid""" class ToyotaRegionNotSupported(Exception): """Raise if region is not supported""" class ToyotaApiError(Exception): """Raise if a API error occurres.""" class ToyotaInternalError(Exception): """Raise if an internal server error occurres from Toyota."""
#Split string = "Teste de split dividindo por espaço" lista = string.split(' ') print(lista) for valor in lista: print(valor) juntarLista = ' '.join(lista) #juntando lista print(juntarLista) for indice , valor in enumerate(lista): print(indice , valor)
""" 警察vs土匪 """ class Gun(object): def __init__(self, model, damage): # 型号 self.model = model # 杀伤力 self.damage = damage # 子弹数量,默认为0 self.bullet_count = 0 # 重写str def __str__(self): return "型号:%s, 杀伤力:%s, 子弹数量:%s" % ( self.model, self.damage, self.bullet_count ) # 填充子弹 def add_bullets(self, bullet_count): self.bullet_count += bullet_count print("填充子弹完成,当前数量为:%s" % bullet_count) # gun发射子弹打击土匪 def shoot(self, enemy): # 判断当前枪是否有子弹 if self.bullet_count <= 0: print("%s 没有子弹, 请填充子弹" % self.model) else: # 如果有子弹,更新子弹数量 self.bullet_count -= 1 # 判断是否击中土匪 if enemy is not None: enemy.hurt(self) print("发射了一颗子弹 %s 剩余子弹:%d" % (self.model, self.bullet_count)) class Player(object): def __init__(self, name, hp=100): # 玩家名字 self.name = name # 血量 self.hp = hp # 使用的枪械 self.gun = None def __str__(self): # 如果土匪的学量小于0 if self.hp <= 0: return "%s 已经挂掉了..." % self.name else: # 没枪是土匪,只有警察有枪 if self.gun is None: return "%s [%d]没有佩戴枪" % (self.name, self.hp) else: return "%s [%d] 枪:%s" % (self.name, self.hp, self.gun) # 土匪受伤的方法 def hurt(self, enemy_gun): # 击中更新血量 self.hp -= enemy_gun.damage # 判断剩余血量 if self.hp <= 0: print("%s 已经挂掉了..." % self.name) else: print("%s 被 %s 击中,剩余血量: %d" % (self.name, enemy_gun.model, self.hp)) # 警察开火 def fire(self, enemy): # 警察判断自己有无武器 if self.gun is None: print("%s 没有佩戴枪, 请佩戴枪" % self.name) return # 判断有无子弹 if self.gun.bullet_count <= 0: # 自动填充子弹 self.gun.add_bullets(10) # 射击土匪 self.gun.shoot(enemy) print("%s 正在向 %s 开火..." % (self.name, enemy.name)) # 测试main()函数 def main(): # 创建一个警察 police_man = Player("警察") # 创建一个土匪 bad_man = Player("土匪", 70) # 枪打土匪(无枪) police_man.fire(bad_man) # 使用枪类创建一把AK47 ak47 = Gun("AK47", 50) # 给警察配枪 police_man.gun = ak47 # 枪打土匪(有枪) police_man.fire(bad_man) police_man.fire(bad_man) # # 填充子弹 # ak47.add_bullets(50) main()
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1296/A def odd(a,n): odd1 = a[0]%2 if odd1==1 and n%2==1: return 'YES' for i in range(1,n): if a[i]%2 != odd1: return 'YES' return 'NO' t = int(input()) for _ in range(t): n = int(input()) al = list(map(int,input().split())) print(odd(al,n))
def play_game(turns, start, nodes, max_cup_label): current_cup = start_label move = 0 while move < turns: # Snip out a sub graph of length 3 sub_graph_start = nodes[current_cup] pickup = [] cur = sub_graph_start for _ in range(3): pickup.append(cur) cur = nodes[cur] # Find the next destination cup dest_cup = current_cup - 1 while dest_cup in pickup or dest_cup < 1: dest_cup -= 1 if dest_cup < 1: dest_cup = max_cup_label # remove subgraph, by updating nodes nodes[current_cup] = cur # Put back in after dest_cup temp = nodes[dest_cup] nodes[dest_cup] = sub_graph_start nodes[nodes[nodes[sub_graph_start]]] = temp # Move onto the next cup current_cup = cur move += 1 #### PART 1 day23_input = [int(x) for x in "389125467"] #day23_input = [int(x) for x in "562893147"] start_label = day23_input[0] # Create the mapping node -> node nodes = {day23_input[0]: day23_input[1]} for x in range(1, len(day23_input)-1): nodes[day23_input[x]] = day23_input[x+1] # Create the cycle nodes[day23_input[-1]] = day23_input[0] play_game(100, start_label, nodes, max(day23_input)) # Solution start = nodes[1] nums = [] for _ in range(len(day23_input)-1): nums.append(str(start)) start = nodes[start] print("part 1", "".join(nums)) #### PART 2 #day23_input = [int(x) for x in "389125467"] day23_input = [int(x) for x in "562893147"] max_cup_label = max(day23_input) start_label = day23_input[0] nodes = { day23_input[0]: day23_input[1]} for x in range(1, len(day23_input)-1): nodes[day23_input[x]] = day23_input[x+1] for i in range(max_cup_label+1,1000000+1): nodes[i] = i+1 # connect the two graphs nodes[day23_input[-1]] = max_cup_label+1 # make it cyclical nodes[1000000] = start_label play_game(10000000, start_label, nodes, 1000000) # Part 2 print("part 2", nodes[1] * nodes[nodes[1]])
# # @lc app=leetcode id=708 lang=python3 # # [708] Insert into a Sorted Circular Linked List # # https://leetcode.com/problems/insert-into-a-sorted-circular-linked-list/description/ # # algorithms # Medium (31.27%) # Likes: 269 # Dislikes: 283 # Total Accepted: 32K # Total Submissions: 102.5K # Testcase Example: '[3,4,1]\n2' # # Given a node from a Circular Linked List which is sorted in ascending order, # write a function to insert a value insertVal into the list such that it # remains a sorted circular list. The given node can be a reference to any # single node in the list, and may not be necessarily the smallest value in the # circular list. # # If there are multiple suitable places for insertion, you may choose any place # to insert the new value. After the insertion, the circular list should remain # sorted. # # If the list is empty (i.e., given node is null), you should create a new # single circular list and return the reference to that single node. Otherwise, # you should return the original given node. # # # Example 1: # # # # Input: head = [3,4,1], insertVal = 2 # Output: [3,4,1,2] # Explanation: In the figure above, there is a sorted circular list of three # elements. You are given a reference to the node with value 3, and we need to # insert 2 into the list. The new node should be inserted between node 1 and # node 3. After the insertion, the list should look like this, and we should # still return node 3. # # # # # # Example 2: # # # Input: head = [], insertVal = 1 # Output: [1] # Explanation: The list is empty (given head is null). We create a new single # circular list and return the reference to that single node. # # # Example 3: # # # Input: head = [1], insertVal = 0 # Output: [1,0] # # # # Constraints: # # # 0 <= Number of Nodes <= 5 * 10^4 # -10^6 <= Node.val <= 10^6 # -10^6 <= insertVal <= 10^6 # # # # @lc code=start """ # Definition for a Node. class Node: def __init__(self, val, next): self.val = val self.next = next """ class Solution: def insert(self, head: 'Node', insertVal: 'int') -> 'Node': if head is None: head = Node(insertVal, None) head.next = head return head iter_node = head tipping_point_passed = False while iter_node: if (not tipping_point_passed and (head.val > iter_node.next.val or iter_node.next == head) and \ ((iter_node.val >= insertVal and insertVal <= iter_node.next.val) or \ (iter_node.val <= insertVal and iter_node.next.val <= insertVal))) or \ (iter_node.val <= insertVal and insertVal <= iter_node.next.val): iter_node.next = Node(insertVal, iter_node.next) iter_node = None break elif not tipping_point_passed and (head.val > iter_node.next.val or iter_node.next == head): tipping_point_passed = True iter_node = iter_node.next return head # @lc code=end
listTotal = [] listPar = [] listImpar = [] for c in range(1, 21): n = int(input("Digite um numero: ")) if n % 2 == 0: listTotal.append(n) listPar.append(n) else: listImpar.append(n) listTotal.append(n) print(f'{listTotal}\n{listPar}\n{listImpar}')
# -*- coding:utf-8 -*- # 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. class EspecificacaoGrupoVirtual(object): """Classe auxiliar para construção dos parâmetros das chamadas para provisionar ou remover grupo virtual.""" def __init__(self): '''Contrutor da classe. Inicializa todas as listas com o valor []. ''' self.lista_equipamentos = [] self.lista_vip = [] self.lista_equipamentos_remove = [] self.lista_vip_remove = [] def add_equipamento( self, id_tipo_equipamento, id_modelo, prefixo, id_grupo, id_vlan, descricao_vlan): """Adiciona um equipamento na lista de equipamentos para operação de inserir/alterar um grupo virtual. :param id_tipo_equipamento: Identificador do tipo de equipamento. :param id_modelo: Identificador do modelo do equipamento. :param prefixo: Prefixo do nome do equipamento. :param id_grupo: Identificador do grupo do equipamento. :param id_vlan: Identificador da VLAN para criar um IP para o equipamento. :param descricao_vlan: Descrição do IP que será criado. :return: None """ equipamento_map = dict() equipamento_map['id_tipo_equipamento'] = id_tipo_equipamento equipamento_map['id_modelo'] = id_modelo equipamento_map['prefixo'] = prefixo equipamento_map['id_grupo'] = id_grupo equipamento_map['ip'] = { 'id_vlan': id_vlan, 'descricao': descricao_vlan} self.lista_equipamentos.append(equipamento_map) def add_equipamento_remove(self, id, id_ip, ids_ips_vips): '''Adiciona um equipamento na lista de equipamentos para operação de remover um grupo virtual. :param id: Identificador do equipamento. :param id_ip: Identificador do IP do equipamento. :param ids_ips_vips: Lista com os identificadores de IPs criados para cada VIP e associados ao equipamento. :return: None ''' equipament_map = dict() equipament_map['id'] = id equipament_map['id_ip'] = id_ip equipament_map['vips'] = {'id_ip_vip': ids_ips_vips} self.lista_equipamentos_remove.append(equipament_map) def add_vip( self, id, real_name_sufixo, id_vlan, descricao_vlan, id_vlan_real, descricao_vlan_real, balanceadores, id_healthcheck_expect, finalidade, cliente, ambiente, cache, metodo_bal, persistencia, healthcheck_type, healthcheck, timeout, host, maxcon, dsr, bal_ativo, transbordos, portas, real_maps, id_requisicao_vip, areanegocio='Orquestra', nome_servico='Orquestra', l7_filter=None, reals_prioritys=None, reals_weights=None): """Adiciona um VIP na lista de VIPs para operação de inserir/alterar um grupo virtual. Os parâmetros abaixo somente são necessários para a operação de alteração: - 'real_maps': Deverá conter os reals atualmente criados para a requisição de VIP. - 'id_requisicao_vip': O identificador da requisição que deverá ser alterada. Os parâmetros abaixo somente são necessários para a operação de inserção: - 'id_vlan': Identificador da VLAN para criar o IP do VIP. - 'descricao_vlan': Descrição do IP do VIP. - balanceadores: Lista com os identificadores dos balanceadores que serão associados ao IP do VIP. :param id: Identificador do VIP utilizado pelo sistema de orquestração. :param real_name_sufixo: Sufixo utilizado para criar os reals_names dos equipamentos na requisição de VIP. :param id_vlan: Identificador da VLAN para criar um IP para o VIP. :param descricao_vlan: Descrição do IP que será criado para o VIP. :param id_vlan_real: Identificador da VLAN para criar os IPs dos equipamentos no VIP. :param descricao_vlan_real: Descrição dos IPs que serão criados para os equipamentos no VIP. :param balanceadores: Lista com os identificadores dos balanceadores que serão associados ao IP do VIP. :param id_healthcheck_expect: Identificador do healthcheck_expect para criar a requisição de VIP. :param finalidade: Finalidade da requisição de VIP. :param cliente: Cliente da requisição de VIP. :param ambiente: Ambiente da requisição de VIP. :param cache: Cache da requisição de VIP. :param metodo_bal: Método de balanceamento da requisição de VIP. :param persistencia: Persistência da requisição de VIP. :param healthcheck_type: Healthcheck_type da requisição de VIP. :param healthcheck: Healthcheck da requisição de VIP. :param timeout: Timeout da requisição de VIP. :param host: Host da requisição de VIP. :param maxcon: Máximo número de conexão da requisição de VIP. :param dsr: DSR da requisição de VIP. :param bal_ativo: Balanceador ativo da requisição de VIP. :param transbordos: Lista com os IPs dos transbordos da requisição de VIP. :param portas: Lista com as portas da requisição de VIP. :param real_maps: Lista dos mapas com os dados dos reals da requisição de VIP. Cada mapa deverá ter a estrutura: {'real_name':< real_name>, 'real_ip':< real_ip>} :param id_requisicao_vip: Identificador da requisição de VIP para operação de alterar um grupo virtual. :param areanegocio: Área de negócio para a requisição de VIP (é utilizado 'Orquestra' caso seja None). :param nome_servico: Nome do serviço para a requisição de VIP (é utilizado 'Orquestra' caso seja None). :param l7_filter: Filtro L7 para a requisição de VIP. :param reals_prioritys: Lista dos dados de prioridade dos reals da requisição de VIP (lista de zeros, caso seja None). :param reals_weights: Lista dos dados de pesos dos reals da requisição de VIP (lista de zeros, caso seja None). :return: None """ vip_map = dict() vip_map['id'] = id # Causa erro na hora de validar os nomes de equipamentos (real servers) #vip_map['real_name_sufixo'] = real_name_sufixo vip_map['ip_real'] = { 'id_vlan': id_vlan_real, 'descricao': descricao_vlan_real} vip_map['ip'] = {'id_vlan': id_vlan, 'descricao': descricao_vlan} vip_map['balanceadores'] = {'id_equipamento': balanceadores} vip_map['id_healthcheck_expect'] = id_healthcheck_expect vip_map['finalidade'] = finalidade vip_map['cliente'] = cliente vip_map['ambiente'] = ambiente vip_map['cache'] = cache vip_map['metodo_bal'] = metodo_bal vip_map['persistencia'] = persistencia vip_map['healthcheck_type'] = healthcheck_type vip_map['healthcheck'] = healthcheck vip_map['timeout'] = timeout vip_map['host'] = host vip_map['maxcon'] = maxcon vip_map['dsr'] = dsr # Nao sao mais utilizados (bal_ativo e transbordos) #vip_map['bal_ativo'] = bal_ativo #vip_map['transbordos'] = {'transbordo': transbordos} vip_map['portas_servicos'] = {'porta': portas} vip_map['reals'] = {'real': real_maps} vip_map['areanegocio'] = areanegocio vip_map['nome_servico'] = nome_servico vip_map['l7_filter'] = l7_filter if reals_prioritys is not None: vip_map['reals_prioritys'] = {'reals_priority': reals_prioritys} else: vip_map['reals_prioritys'] = None if metodo_bal.upper() == 'WEIGHTED': if reals_weights is not None: vip_map['reals_weights'] = {'reals_weight': reals_weights} else: vip_map['reals_weights'] = None if id_requisicao_vip is not None: vip_map['requisicao_vip'] = {'id': id_requisicao_vip} self.lista_vip.append(vip_map) def add_vip_remove(self, id_ip, id_equipamentos): '''Adiciona um VIP na lista de VIPs para operação de remover um grupo virtual. :param id_ip: Identificador do IP criado para o VIP. :param id_equipamentos: Lista com os identificadores dos balanceadores associados ao IP do VIP. :return: None ''' vip_map = dict() vip_map['id_ip'] = id_ip vip_map['balanceadores'] = {'id_equipamento': id_equipamentos} self.lista_vip_remove.append(vip_map) def add_vip_incremento(self, id): """Adiciona um vip à especificação do grupo virtual. :param id: Identificador de referencia do VIP. """ vip_map = dict() vip_map['id'] = id self.lista_vip.append(vip_map) def get_equipamentos(self): """Obtem a lista de Equipamentos.""" return self.lista_equipamentos def get_vips(self): """Obtem a lista de VIPs.""" return self.lista_vip def get_equipamentos_remove(self): """Obtem a lista de equipamentos a serem removidos.""" return self.lista_equipamentos_remove def get_vips_remove(self): """Obtem a lista de VIPs a serem removidos.""" return self.lista_vip_remove
# Copyright (c) 2018 Huawei Technologies Co., Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class SDKException(Exception): def __init__(self, code=None, message=None): self._code = code self._message = message def __str__(self): return "[SDKException] Message:%s Code:%s ." % (self.message, self.code) @property def code(self): return self._code @property def message(self): return self._message class EndpointResolveException(SDKException): def __init__(self, message): message = "Failed to resolve endpoint: {}".format(message) super(EndpointResolveException, self).__init__(code=None, message=message) class ValueException(SDKException): def __init__(self, message): message = "Unexpected parameters are specified: {}.".format(message) super(ValueException, self).__init__(code=None, message=message) class RequestException(SDKException): def __init__(self, message): message = "Failed to proceed request to service " \ "endpoint, could be a low level error: {}.".format(message) super(RequestException, self).__init__(code=None, message=message) class AuthException(SDKException): def __init__(self, message, credential): message = "Failed to authorize with provided " \ "information {}, message: {}.".format(credential, message) super(AuthException, self).__init__(code=None, message=message) class InvalidConfigException(SDKException): def __init__(self, message): message = "Invalid configurations: {}.".format(message) super(SDKException, self).__init__(code=None, message=message)
# Definition for singly-linked list with a random pointer. # class RandomListNode(object): # def __init__(self, x): # self.label = x # self.next = None # self.random = None class Solution(object): def copyRandomList(self, head): """ :type head: RandomListNode :rtype: RandomListNode """ if head is None: return None # append copy node behind its orignal one # 1 -> 1' -> 2 -> 2' -> .... -> n -> n' -> None current = head while (current is not None): node = RandomListNode(current.label) node.next = current.next current.next = node current = current.next.next # copy random pointers current = head while(current is not None): if current.random is not None: current.next.random = current.random.next current = current.next.next # construct new linked list new_head = head.next new_cur = new_head old_cur = head while(new_cur is not None): old_cur.next = new_cur.next if new_cur.next is not None: new_cur.next = new_cur.next.next new_cur = new_cur.next old_cur = old_cur.next return new_head
# -*- coding: utf-8 -*- """ @author: [email protected] @site: e-smartdata.org """ class Czlowiek: def __init__(self, imie, nazwisko): self.imie = imie self.nazwisko = nazwisko def info(self): print(f'{self.imie} {self.nazwisko}') class Pilkarz(Czlowiek): def __init__(self, imie, nazwisko, klub): super().__init__(imie, nazwisko) self.klub = klub def info(self): super().info() print(f'Klub: {self.klub}') # %% pilkarz_1 = Pilkarz('Robert', 'Lewandowski', 'Bayern') pilkarz_2 = Pilkarz('Krzysztof', 'Piątek', 'AC Milan') # %% pilkarz_1.info() pilkarz_2.info()
# Задача 4. Вариант 45. # Напишите программу, которая выводит имя, под которым скрывается Борис Николаевич Кампов. Дополнительно необходимо вывести область интересов указанной личности, место рождения, годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти). Для хранения всех необходимых данных требуется использовать переменные. После вывода информации программа должна дожидаться пока пользователь нажмет Enter для выхода. # Burmistrov V.D. # 17.03.2016 print("Борис Николаевич Кампов более известен, как российский журналист.") year_of_birth = 1908 age = 1981 - year_of_birth birthplace = "Москва, Российская империя" interess = "журналист" print("Место рождения:", birthplace) print("Год рождения:", year_of_birth) print("Возраст при смерти: ", age) print("Область интересов: ", interess) input("\n\nНажмите Enter для выхода.")
class A: def f1(self): print("F1 is working") def f2(self): print("F2 is working") class B(): def f3(self): print("F3 is working") def f4(self): print("F4 is working") class C(A,B): #Multiple Inheriatance def f5(self): print("F5 is working") a1=A() a1.f1() a1.f2() b1=B() b1.f3() b1.f4() #calling inherit method from A f4 c1=C() c1.f5() #Inherits from A<-B<-C c1.f1()
''' x=5 def verificar(): listaNomes=[''] while True: if x==0: listaNomes= [input(print("Digite um nome: "))] x-=1 else: print("Obrigado") break verificar() print(listaNomes) ''' #Variáveis em funções #Variáveis -> Globais ou externas -> locais ou internas ''' nome= "Pedro Rocha" def imprime(): print("*"*len(nome)) a= 5 def muda_e_imprime(): global a a=7 print(f"Variável a dentro da função: {a}") print(f"Variável antes de mudar: {a}") muda_e_imprime() print(f"Variável após a mudança: {a}") ''' ''' valor=int(input("Digite ae seu merda: ")) def faixa_int(minimo,maximo): while True: v= valor if v < minimo or v>maximo: print(f"Valor inválido. Digite um valor entre {minimo} e {maximo}") break else: print(f"{v} OK") break faixa_int(1,100) ''' def soma(a,b): return a+b def subtracao(a,b): return a-b def imprime(a,b,funcao): print(funcao(a,b)) imprime(5,4,soma) imprime(10,1,subtracao)
# Input Cases t = int(input("\nTotal Test Cases : ")) for i in range(1,t+1): print(f"\n------------ CASE #{i} -------------") n = int(input("\nTotal Items : ")) m = int(input("Max Capacity : ")) v = [int(i) for i in input("\nValues : ").split(" ")] w = [int(i) for i in input("Weights : ").split(" ")] # Tabulation (DP) dp = [[0 for x in range(m+1)] for x in range(n+1)] for i in range(n+1): for j in range(m+1): if i == 0 or j == 0: dp[i][j] = 0 elif w[i-1]<=j: dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]) else: dp[i][j] = dp[i-1][j] print(f"\nMax Value Picked : {dp[n][m]}")
# https://www.hackerrank.com/challenges/candies/problem n = int(input()) arr = [int(input()) for _ in range(n)] candies = [1] * n for i in range(1, n): if arr[i - 1] < arr[i]: candies[i] = candies[i - 1] + 1 for i in range(n - 2, -1, -1): if arr[i + 1] < arr[i]: if i - 1 >= 0 and arr[i - 1] < arr[i]: candies[i] = max(candies[i + 1], candies[i - 1]) + 1 else: candies[i] = candies[i + 1] + 1 print(sum(candies))
"""A simple example for how to replace the provided artifact macro""" load("@mabel//rules/maven_deps:mabel.bzl", "artifact") def g_artifact(coordinate): return artifact(coordinate = coordinate, repositories = ["https://maven.google.com/"], type = "naive")
class DataFragment(object): def length(self): return 0; class ConstDataFragment(object): def __init__(self, name, data): self.data = data self.name = name def length(self): return len(self.data) class ChoiceDataFragment(object): def __init__(self): pass class StatisticsDataFragment(object): @staticmethod def create_length_statistics(name, depends): pass @staticmethod def create_cs_statistics(name, depends): pass def __init__(self,name, depends): self.name = name self.depends = depends class FixedLengthDataFragment(object): def __init__(self, name, length, default_value): self.name = name self.length = length self.default_value = default_value class VariableDataFragment(object): def __init__(self, name, depends): self.name = name self.depends = depends # receive_str+="68 10 01 02 03 04 05 06 07 81 16 90 1F 96 00 55 55 05 2C 00 55 55 05 2C 00 00 00 00 00 00 00 00 00 26 16" class CJT188Protocol(object): def __init__(self): self.name = "CJT188" self.fragments = [] self.add_fragment(ConstDataFragment("head", chr(0x68))) self.add_fragment(ConstDataFragment("type", chr(0x01))) self.add_fragment(FixedLengthDataFragment("address", 7, chr(0xaa) * 7)) self.add_fragment(FixedLengthDataFragment("cmd", 1, chr(0x02))) self.add_fragment(StatisticsDataFragment.create_length_statistics("length", 1, ("didunit",))) self.add_fragment(VariableDataFragment("didunit", "length")) self.add_fragment(StatisticsDataFragment.create_cs_statistics("cs", 1, ("head", "type", "address", "cmd", "didunit"))) self.add_fragment(ConstDataFragment("tail", chr(0x16))) def add_fragment(self, fragment): self.fragments.append(fragment)
#https://www.acmicpc.net/problem/1259 #자릿수 1개, 짝수개 홀수개 while True: n = input() if n == '0': break isPal = True for i in range(len(n)//2): if n[i] == n[-(i+1)]: continue else: isPal = False break if isPal: print('yes') else: print('no')
""" There is a ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through the empty spaces by rolling up, down, left or right, but it won't stop rolling until hitting a wall. When the ball stops, it could choose the next direction. Given the maze, the ball's start position and the destination, where start = [startrow, startcol] and destination = [destinationrow, destinationcol], return true if the ball can stop at the destination, otherwise return false. You may assume that the borders of the maze are all walls (see examples) IDEA: almost pure BFS, with additional code to calc stable position """ class Solution490: pass
class HttpStyleUriParser(UriParser): """ A customizable parser based on the HTTP scheme. HttpStyleUriParser() """
# -*- coding: utf-8 -*- """ Created on Mon Feb 5 19:13:44 2018 @author: farhan """ def draw(n): if n == 1: print(''' ------ | | | | ------ ''') if n ==2: print(''' ------ | | | | ------ | | | | ''') if n == 3: print(''' ------ | | | | ------ | /| / | | ''') if n == 4: print(''' ------ | | | | ------ | /|\ / | \ | ''') if n == 5: print(''' ------ | | | | ------ | /|\ / | \ | / / ''') if n == 6: print(''' ------ | | | | ------ | /|\ / | \ | / \ / \ ''')
class SecretsManager: _boto3 = None _environment = None _secrets_manager = None def __init__(self, boto3, environment): self._boto3 = boto3 self._environment = environment if not self._environment.get('AWS_REGION', True): raise ValueError("To use secrets manager you must use set the 'AWS_REGION' environment variable") self._secrets_manager = self._boto3.client('secretsmanager', region_name=self._environment.get('AWS_REGION')) def get(self, secret_id, version_id=None, version_stage=None): calling_parameters = { 'SecretId': secret_id, 'VersionId': version_id, 'VersionStage': version_stage, } calling_parameters = {key: value for (key, value) in calling_parameters.items() if value} result = self._secrets_manager.get_secret_value(**calling_parameters) if result.get('SecretString'): return result.get('SecretString') return result.get('SecretBinary') def list_secrets(self, path): raise NotImplementedError() def update(self, path, value): raise NotImplementedError()
# coding: utf-8 #----------------------------------------------------------------- # Um programa que recebe o sexo de uma pessoa mas só # aceite os valores 'M' 'F'. Caso esteja errado o programa # deverá pedir a digitação até receber um valor correto. #------------------------------------------------------------------ # Validação de Dados - Exercício #057 #------------------------------------------------------------------ sexo = str(input('Por favor informe seu sexo [F/M]: ')).strip().upper()[0] while sexo not in 'FM': sexo = str(input('Opção Inválida! Por favor informe seu sexo: [F/M]')).strip().upper()[0] print(f'Sexo {sexo} registrado com sucesso.')
''' Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine, 'E' represents an unrevealed empty square, 'B' represents a revealed blank square that has no adjacent (above, below, left, right, and all 4 diagonals) mines, digit ('1' to '8') represents how many mines are adjacent to this revealed square, and finally 'X' represents a revealed mine. Now given the next click position (row and column indices) among all the unrevealed squares ('M' or 'E'), return the board after revealing this position according to the following rules: If a mine ('M') is revealed, then the game is over - change it to 'X'. If an empty square ('E') with no adjacent mines is revealed, then change it to revealed blank ('B') and all of its adjacent unrevealed squares should be revealed recursively. If an empty square ('E') with at least one adjacent mine is revealed, then change it to a digit ('1' to '8') representing the number of adjacent mines. Return the board when no more squares will be revealed. Example 1: Input: [['E', 'E', 'E', 'E', 'E'], ['E', 'E', 'M', 'E', 'E'], ['E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E']] Click : [3,0] Output: [['B', '1', 'E', '1', 'B'], ['B', '1', 'M', '1', 'B'], ['B', '1', '1', '1', 'B'], ['B', 'B', 'B', 'B', 'B']] Explanation: Example 2: Input: [['B', '1', 'E', '1', 'B'], ['B', '1', 'M', '1', 'B'], ['B', '1', '1', '1', 'B'], ['B', 'B', 'B', 'B', 'B']] Click : [1,2] Output: [['B', '1', 'E', '1', 'B'], ['B', '1', 'X', '1', 'B'], ['B', '1', '1', '1', 'B'], ['B', 'B', 'B', 'B', 'B']] Explanation: Note: The range of the input matrix's height and width is [1,50]. The click position will only be an unrevealed square ('M' or 'E'), which also means the input board contains at least one clickable square. The input board won't be a stage when game is over (some mines have been revealed). For simplicity, not mentioned rules should be ignored in this problem. For example, you don't need to reveal all the unrevealed mines when the game is over, consider any cases that you will win the game or flag any squares. ''' class Solution(object): def updateBoard(self, board, click): """ :type board: List[List[str]] :type click: List[int] :rtype: List[List[str]] """ grid = [[board[i][j] for j in xrange(len(board[i]))] for i in xrange(len(board))] if grid[click[0]][click[1]] == 'M': grid[click[0]][click[1]] = 'X' else: # get number of mines in neighbors for each cell count = [[0 for j in xrange(len(board[i]))] for i in xrange(len(board))] for x in xrange(len(board)): for y in xrange(len(board[i])): tmp = 0 for i, j in [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)]: xx, yy = x+i, y+j if 0 <= xx < len(board) and 0 <= yy < len(board[0]): if board[xx][yy] == 'M': tmp += 1 count[x][y] = tmp vec = [(click)] while vec: next_vec = [] for x, y in vec: if grid[x][y] == 'E': if count[x][y] == 0: grid[x][y] = 'B' for i, j in [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, -1), (-1, 1)]: xx, yy = x+i, y+j if 0 <= xx < len(board) and 0 <= yy < len(board[0]): if grid[xx][yy] == 'E': next_vec.append((xx, yy)) else: grid[x][y] = str(count[x][y]) vec = next_vec return grid
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_Pbr_01_ape.py" OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_lmPbr_SO/cat" DATASETS = dict(TRAIN=("lm_pbr_cat_train",), TEST=("lm_real_cat_test",)) # bbnc10 # objects cat Avg(1) # ad_2 21.06 21.06 # ad_5 62.67 62.67 # ad_10 92.61 92.61 # rete_2 78.04 78.04 # rete_5 99.20 99.20 # rete_10 100.00 100.00 # re_2 78.34 78.34 # re_5 99.20 99.20 # re_10 100.00 100.00 # te_2 99.10 99.10 # te_5 100.00 100.00 # te_10 100.00 100.00 # proj_2 85.83 85.83 # proj_5 99.10 99.10 # proj_10 100.00 100.00 # re 1.49 1.49 # te 0.01 0.01
# -*- coding: utf-8 -*- # index.urls def make_rules(): return [] all_views = {}
data = input() forum_dict = {} while not data == 'filter': topic = data.split(' -> ')[0] hashtags = data.split(' -> ')[1].split(', ') if topic in forum_dict.keys(): forum_dict[topic].extend(hashtags) else: forum_dict[topic] = hashtags data = input() hashtags_reg = input().split(', ') for topic, hashtags in forum_dict.items(): unique_tags_list = sorted(set(hashtags), key=hashtags.index) forum_dict[topic] = unique_tags_list hashtags_reg_set = set(hashtags_reg) if hashtags_reg_set.issubset(hashtags): print(f'{topic} | ', end='') print(f'''{", ".join(list(map(lambda x:'#'+x, unique_tags_list)))}''')
def fector(x: int): if x == 0: return 1 else: return x * fector(x - 1) N = int(input()) print(fector(N))
a = 0 while a <= 10: print(a) a = a + 1 if True: pass # Operadores de comparação # Retorna verdadeiro (True) e falso (False) # igualdade (==) # atribuição (=) # diferenciação (!=) # marioridade (>) # maior e igual (>=) # menor e igual (<=)
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 判断列表的所有数是否是素数(函数式) 将所有素数的元素打印为字典(函数式) author: gxcuizy date: 2018-10-19 """ def is_prime(num_list): """判断列表的数字是否为素数""" prime_result = [] for number_val in num_list: # 判断是否为素数 prime_status = get_is_prime(number_val) # 结果添加到列表中 prime_result.append(prime_status) return prime_result def get_is_prime(num): """判断一个数是否为素数""" if num < 2: return False # 中间整数 number_center = int(num / 2) # 最小数只能为2以上 start = 2 # 是否为素数 prime_status = True # 循环整除中间数以下的数字 while start <= number_center: # 能整除,不是素数 if num % start == 0: prime_status = False break start += 1 return prime_status def print_dict(num_dict): """打印字典的key、value信息""" for key, value in num_dict.items(): print(str(key) + '是素数吗?:' + str(value)) def get_prime(num_dict): """获取字典里所有的素数""" prime_dict = {} for key, value in num_dict.items(): if value: prime_dict.update({key: key}) return prime_dict # 程序主入口 if __name__ == '__main__': # 数字列表 number = [2, 6, 7, 9, 17] # 判断素数结果 result = is_prime(number) # 数字和素数结果合并为字典 number_dict = dict(zip(number, result)) # 打印结果 print_dict(number_dict) # 获取素数元素的字典 prime = get_prime(number_dict) # 打印素数字典 print(prime)
filename=os.path.join(path,'Output','Data','xls','WALIS_spreadsheet.xlsx') print('Your file will be created in {} '.format(path+'/Output/Data/')) ###### Prepare messages for the readme ###### # First cell date_string = date.strftime("%d %m %Y") msg1='This file was exported from WALIS on '+date_string # Second cell msg2= ("The data in this file were compiled in WALIS, the World Atlas of Last Interglacial Shorelines. " "WALIS is a product of the ERC project WARMCOASTS (ERC-StG-802414). " "Bugs and suggestions for improvements can be sent to [email protected]") # Third cell if not Summary.empty: bit1=(" - Summary RSL datapoints: RSL datapoints from stratigraphic records, U-Series from corals and U-Series from speleothems. Rows with common RSL ID (but different ages available) are highlighted with alternating gray and white colors. \n") else: bit1=("") if not useries_corals_RSL.empty: bit2=(" - RSL from single coral: RSL datapoints from dated corals, for which paleo water depth is estimated \n") else: bit2=("") if not useries_speleo_RSL.empty: bit3=(" - RSL from single speleothem: RSL datapoints from dated speleothems, for which paleo RSL is estimated \n") else: bit3=("") if not RSL_Datapoints.empty: bit4=(" - RSL proxies: RSL indicators from stratigraphic information, with grouped age details \n") else: bit4=("") if not RSL_Ind.empty: bit5=(" - RSL indicators: list of types of RSL indicators used in the 'RSL proxies' sheet \n") else: bit5=("") if not vrt_meas.empty: bit6=(" - Elevation measurement techniques: list of elevation survey methods used both in the 'RSL proxies' sheet and in the elevation fields of dated samples \n") else: bit6=("") if not hrz_meas.empty: bit7=(" - Geographic positioning: list of geographic positioning methods used in the 'RSL proxies' sheet \n") else: bit7=("") if not sl_datum.empty: bit8=(" - Sea level datums: list of datums used both in the 'RSL proxies' sheet and in the datums fields of dated samples \n") else: bit8=("") if not useries_corals.empty: bit9=(" - U-Series (corals): list of all the coral samples dated with U-Series. This sheet contains all U-Series coral ages created by the user or falling within the region of interest, all U-Series coral ages reported in the 'RSL proxies' sheet and all the U-Series coral ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit9=("") if not useries_moll.empty: bit10=(" - U-Series (mollusks): list of all the mollusks (or algae) samples dated with U-Series. This sheet contains all U-Series mollusk/algal ages created by the user or falling within the region of interest, all U-Series mollusk/algal ages reported in the 'RSL proxies' sheet and all the U-Series mollusk/algal ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit10=("") if not useries_oolite.empty: bit10a=(" - U-Series (mollusks): list of all the mollusks (or algae) samples dated with U-Series. This sheet contains all U-Series mollusk/algal ages created by the user or falling within the region of interest, all U-Series mollusk/algal ages reported in the 'RSL proxies' sheet and all the U-Series mollusk/algal ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit10a=("") if not useries_speleo.empty: bit11=(" - U-Series (speleothems): list of all the speleothem samples dated with U-Series. This sheet contains all U-Series speleothem ages created by the user or falling within the region of interest, all U-Series speleothem ages reported in the 'RSL proxies' sheet and all the U-Series speleothem ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit11=("") if not aar.empty: bit12=(" - Amino Acid Racemization: list of all the samples dated with AAR. This sheet contains all AAR ages created by the user or falling within the region of interest and all AAR ages reported in the 'RSL proxies' sheet. \n") else: bit12=("") if not esr.empty: bit13=(" - Electron Spin Resonance: list of all the samples dated with ESR. This sheet contains all ESR ages created by the user or falling within the region of interest, all ESR ages reported in the 'RSL proxies' sheet and all the ESR ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit13=("") if not lum.empty: bit14=(" - Luminescence: list of all the samples dated with luminescence. This sheet contains all luminescence ages created by the user or falling within the region of interest, all luminescence ages reported in the 'RSL proxies' sheet and all the luminescence ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit14=(" ") if not strat.empty: bit15=(" - Chronostratigraphy: list of all the chronostratigraphic age constraints. This sheet contains all constraints created by the user or falling within the region of interest, all chronostratigraphic constraints reported in the 'RSL proxies' sheet and all the chronostratigraphic constraints ages used as age banchmarks to AAR ages contained in the 'RSL proxies tab' \n") else: bit15=("") if not other.empty: bit16=(" - Other age constraints: list of all the other age constraints. This sheet contains all constraints created by the user or falling within the region of interest and all other age constraints reported in the 'RSL proxies' sheet \n") else: bit16=("") bit17=(" - References: list of all references contained in the culled database. \n") msg3= ("The sheets in this file contain the following information (if available): \n"+bit1+bit2+bit3+bit4+bit5+bit6+bit7+bit8+bit9+bit10+bit10a+bit11+bit12+bit13+bit14+bit15+bit16+bit17) #Fourth cell msg4= ("Information on each field can be found at: https://walis-help.readthedocs.io/en/latest/ \n" "Information on WALIS (Including data download) can be found at: https://warmcoasts.eu/world-atlas.html \n") #Fifth cell people=str(user_contrib_df['index'].values.tolist()).replace("'", '').replace("[", '').replace("]", '') msg5=("Suggested acknowledgments: The data used in this study were [extracted from / compiled in] WALIS, a sea-level database interface developed by the ERC Starting Grant WARMCOASTS (ERC-StG-802414), in collaboration with PALSEA (PAGES / INQUA) working group. The database structure was designed by A. Rovere, D. Ryan, T. Lorscheid, A. Dutton, P. Chutcharavan, D. Brill, N. Jankowski, D. Mueller, M. Bartz, E. Gowan and K. Cohen. The data points used in this study were contributed to WALIS by: "+people+" (in order of numbers of records inserted).") #Create and give format to xls file writer = pd.ExcelWriter(filename, engine='xlsxwriter',options={'strings_to_numbers': True,'strings_to_formulas': False}) workbook=writer.book wrap = workbook.add_format({'text_wrap': True, 'valign':'vcenter','align':'center'}) wrap2 = workbook.add_format({'text_wrap': True, 'valign':'vcenter','align':'left'}) header_format = workbook.add_format({'bold': True,'text_wrap': True,'valign': 'vcenter','align':'center','fg_color':'#C0C0C0','border': 1}) ###### Write the readme in the first sheet ###### column_names = ['WALIS spreadsheet'] df = pd.DataFrame(columns = column_names) df.to_excel(writer, sheet_name='README',index=False) worksheet = writer.sheets['README'] worksheet.write('A2', msg1) worksheet.write('A4', msg2) worksheet.write('A6', msg3) worksheet.write_string('A8', msg4) worksheet.write_string('A9', msg5) worksheet.set_column('A:A',180,wrap2) ###### Summary sheets ###### Summary=Summary.sort_values(by=['Nation','WALIS_ID']) #Create Summary sheet if not Summary.empty: filename_csv=os.path.join(path,'Output','Data','csv','Summary.csv') Summary.to_csv(filename_csv,index = False,encoding='utf-8-sig') Summary.to_excel(writer, sheet_name='Summary of RSL datapoints',index=False) worksheet = writer.sheets['Summary of RSL datapoints'] worksheet.set_column('A:XFD',20,wrap) worksheet.set_column('ZZ:ZZ',0,wrap) worksheet.set_column('AB:AB', 30,wrap) for row in range(1, 10000): worksheet.set_row(row, 50) worksheet.freeze_panes(1, 4) # Write the column headers with the defined format. for col_num, value in enumerate(Summary.columns.values): worksheet.write(0, col_num, value, header_format) index = Summary.index number_of_rows = len(index) worksheet.write('AF2', 0) for k in range(3, number_of_rows+2): i=k-1 k=str(k) i=str(i) cell='ZZ'+k formula='=MOD(IF(A'+k+'=A'+i+',0,1)+ZZ'+i+',2)' worksheet.write_formula(cell,formula) format1 = workbook.add_format({'bg_color': '#D3D3D3'}) worksheet.conditional_format("$A$1:$ZZ$%d" % (number_of_rows+1),{"type": "formula","criteria": '=INDIRECT("ZZ"&ROW())=0',"format": format1}) ###### RSL datapoints from U-Series ###### #RSL from corals useries_corals_RSL = useries_corals_RSL.sort_values(by=['Analysis ID']) if not useries_corals_RSL.empty: filename_csv=os.path.join(path,'Output','Data','csv','RSL_from_single_coral.csv') useries_corals_RSL.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_corals_RSL.to_excel(writer, sheet_name='RSL from single coral',index=False) #Define fields for corals worksheet = writer.sheets['RSL from single coral'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_corals_RSL.columns.values): worksheet.write(0, col_num, value, header_format) ###### RSL datapoints from Speleothems ###### useries_speleo_RSL = useries_speleo_RSL.sort_values(by=['Analysis ID']) if not useries_speleo_RSL.empty: filename_csv=os.path.join(path,'Output','Data','csv','RSL_from_single_speleothem.csv') useries_corals_RSL.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_speleo_RSL.to_excel(writer, sheet_name='RSL from single speleothem',index=False) #Define fields for corals worksheet = writer.sheets['RSL from single speleothem'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_speleo_RSL.columns.values): worksheet.write(0, col_num, value, header_format) ###### RSL datapoints ###### if not RSL_Datapoints.empty: RSL_Datapoints.sort_values(by=['Nation','Region'],inplace=True) filename_csv=os.path.join(path,'Output','Data','csv','RSL_proxies.csv') RSL_Datapoints.to_csv(filename_csv,index = False,encoding='utf-8-sig') RSL_Datapoints.to_excel(writer, sheet_name='RSL proxies',index=False) worksheet = writer.sheets['RSL proxies'] worksheet.set_column('A:XFD',20,wrap) for row in range(1, 10000): worksheet.set_row(row, 50) worksheet.freeze_panes(1, 1) # Add a header format. header_format = workbook.add_format({'bold': True,'text_wrap': True,'valign': 'vcenter','align':'center', 'fg_color':'#C0C0C0','border': 1}) # Write the column headers with the defined format. for col_num, value in enumerate(RSL_Datapoints.columns.values): worksheet.write(0, col_num, value, header_format) ###### RSL indicators ###### if not RSL_Ind.empty: filename_csv=os.path.join(path,'Output','Data','csv','RSL_indicators.csv') RSL_Ind.to_csv(filename_csv,index = False,encoding='utf-8-sig') RSL_Ind=RSL_Ind.sort_values(by=['Name of RSL indicator']) RSL_Ind.to_excel(writer, sheet_name='RSL indicators',index=False) worksheet = writer.sheets['RSL indicators'] worksheet.set_column('A:K',50,wrap) for row in range(1, 5000): worksheet.set_row(row, 80) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(RSL_Ind.columns.values): worksheet.write(0, col_num, value, header_format) ###### Elevation measurement techniques ###### if not vrt_meas.empty: vrt_meas=vrt_meas.sort_values(by=['Measurement technique']) vrt_meas.reset_index(inplace=True,drop=True) filename_csv=os.path.join(path,'Output','Data','csv','Elevation_measurement.csv') vrt_meas.to_csv(filename_csv,index = False,encoding='utf-8-sig') vrt_meas.to_excel(writer, sheet_name='Elevation measurement',index=False) worksheet = writer.sheets['Elevation measurement'] worksheet.set_column('A:G',50,wrap) for row in range(1, 5000): worksheet.set_row(row, 80) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(vrt_meas.columns.values): worksheet.write(0, col_num, value, header_format) ###### Geographic positioning techniques ###### if not hrz_meas.empty: hrz_meas=hrz_meas.sort_values(by=['Measurement technique']) filename_csv=os.path.join(path,'Output','Data','csv','Geographic_positioning.csv') hrz_meas.to_csv(filename_csv,index = False,encoding='utf-8-sig') hrz_meas.to_excel(writer,sheet_name='Geographic positioning',index=False) worksheet = writer.sheets['Geographic positioning'] worksheet.set_column('A:G',50,wrap) for row in range(1, 5000): worksheet.set_row(row, 80) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(hrz_meas.columns.values): worksheet.write(0, col_num, value, header_format) ###### Sea level datum ###### if not sl_datum.empty: sl_datum=sl_datum.sort_values(by=['Datum name']) filename_csv=os.path.join(path,'Output','Data','csv','Sea_level_datums.csv') sl_datum.to_csv(filename_csv,index = False,encoding='utf-8-sig') sl_datum.to_excel(writer,sheet_name='Sea level datums',index=False) worksheet = writer.sheets['Sea level datums'] worksheet.set_column('A:H',50,wrap) for row in range(1, 5000): worksheet.set_row(row, 80) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(sl_datum.columns.values): worksheet.write(0, col_num, value, header_format) ###### U-Series ###### #Corals useries_corals=useries_corals.sort_values(by=['Analysis ID']) if not useries_corals.empty: filename_csv=os.path.join(path,'Output','Data','csv','USeries_corals.csv') useries_corals.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_corals.to_excel(writer, sheet_name='U-Series (corals)',index=False) #Define fields for corals worksheet = writer.sheets['U-Series (corals)'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_corals.columns.values): worksheet.write(0, col_num, value, header_format) #Mollusks useries_moll = useries_moll.sort_values(by=['Analysis ID']) if not useries_moll.empty: filename_csv=os.path.join(path,'Output','Data','csv','USeries_mollusks.csv') useries_moll.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_moll.to_excel(writer,sheet_name='U-Series (mollusks)',index=False) #Define fields for mollusks worksheet = writer.sheets['U-Series (mollusks)'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_moll.columns.values): worksheet.write(0, col_num, value, header_format) #Speleothem useries_speleo = useries_speleo.sort_values(by=['Analysis ID']) if not useries_speleo.empty: filename_csv=os.path.join(path,'Output','Data','csv','USeries_speleo.csv') useries_speleo.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_speleo.to_excel(writer,sheet_name='U-Series (speleothems)',index=False) #Define fields for mollusks worksheet = writer.sheets['U-Series (speleothems)'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_speleo.columns.values): worksheet.write(0, col_num, value, header_format) #Oolites useries_oolite = useries_oolite.sort_values(by=['Analysis ID']) if not useries_oolite.empty: filename_csv=os.path.join(path,'Output','Data','csv','USeries_oolite.csv') useries_oolite.to_csv(filename_csv,index = False,encoding='utf-8-sig') useries_oolite.to_excel(writer,sheet_name='U-Series (Oolites)',index=False) #Define fields for mollusks worksheet = writer.sheets['U-Series (Oolites)'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) # Write the column headers with the defined format. for col_num, value in enumerate(useries_oolite.columns.values): worksheet.write(0, col_num, value, header_format) ###### AAR ###### aar=aar.sort_values(by=['Analysis ID']) if not aar.empty: filename_csv=os.path.join(path,'Output','Data','csv','Amino_Acid_Racemization.csv') aar.to_csv(filename_csv,index = False,encoding='utf-8-sig') aar.to_excel(writer, sheet_name='Amino Acid Racemization',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['Amino Acid Racemization'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(aar.columns.values): worksheet.write(0, col_num, value, header_format) ###### ESR ###### esr=esr.sort_values(by=['Analysis ID']) if not esr.empty: filename_csv=os.path.join(path,'Output','Data','csv','Electron_Spin_Resonance.csv') esr.to_csv(filename_csv,index = False,encoding='utf-8-sig') esr.to_excel(writer, sheet_name='Electron Spin Resonance',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['Electron Spin Resonance'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(esr.columns.values): worksheet.write(0, col_num, value, header_format) ###### LUM ###### lum=lum.sort_values(by=['Analysis ID']) if not lum.empty: filename_csv=os.path.join(path,'Output','Data','csv','Luminescence.csv') lum.to_csv(filename_csv,index = False,encoding='utf-8-sig') lum.to_excel(writer, sheet_name='Luminescence',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['Luminescence'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(lum.columns.values): worksheet.write(0, col_num, value, header_format) ###### Stratigraphic constraints ###### strat=strat.sort_values(by=['Chronostratigraphy ID']) if not strat.empty: filename_csv=os.path.join(path,'Output','Data','csv','Chronostratigrapy.csv') strat.to_csv(filename_csv,index = False,encoding='utf-8-sig') strat.to_excel(writer, sheet_name='Chronostratigraphy',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['Chronostratigraphy'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(strat.columns.values): worksheet.write(0, col_num, value, header_format) ###### Other constraints ###### other=other.sort_values(by=['WALIS Other chronology ID']) if not other.empty: filename_csv=os.path.join(path,'Output','Data','csv','Other_age_constraints.csv') other.to_csv(filename_csv,index = False,encoding='utf-8-sig') other.to_excel(writer, sheet_name='Other age constraints',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['Other age constraints'] worksheet.set_column('A:ZZ',20,wrap) for row in range(1, 5000): worksheet.set_row(row, 45) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(other.columns.values): worksheet.write(0, col_num, value, header_format) ###### References_query ###### References_query.drop(columns=['Abstract'],inplace=True) References_query=References_query.sort_values(by=['Reference']) if not References_query.empty: filename_csv=os.path.join(path,'Output','Data','csv','References.csv') References_query.to_csv(filename_csv,index = False,encoding='utf-8-sig') References_query.to_excel(writer, sheet_name='References',index=False) # Write the column headers with the defined format. worksheet = writer.sheets['References'] worksheet.set_column('A:A', 15,wrap) worksheet.set_column('B:B', 35,wrap) worksheet.set_column('C:C', 150,wrap) worksheet.set_column('D:D', 30,wrap) worksheet.set_column('E:E', 10,wrap) worksheet.set_column('F:ZZ', 30,wrap) worksheet.freeze_panes(1, 1) for col_num, value in enumerate(References_query.columns.values): worksheet.write(0, col_num, value, header_format) writer.save()
board_bounding_box = [[[-1245, -795], [-410, 310], [-455, 500.0]],\ [[-1245, -795], [-410, 310], [-545, 500.0]],\ [[-1245, -595], [-410, 310], [-585, 500.0]],\ [[-1345, -595], [-410, 310], [-642, 500.0]]] min_point_before_moving = [[-1245, -354.048022, -417],\ [-1201.1969772, -300, -539],\ [-1155, -248.09308728, -570],\ [-1145, -373.39387246, -642]] def distorb0(points): points[:,0] = (points[:,0] + 0.04 * points[:,1] + 0.05 * points[:,2])*1.02 points[:,1] = (points[:,1] - 0.1 * points[:,2] - 0.03 * points[:,0]) * 0.9239 points[:,2] = (points[:,1]*0.07 + points[:,2]) * 1.1 return points def distorb1(points): points[:,0] = (points[:,0] + 0.13 * points[:,2]) * 0.98 points[:,1] = (points[:,1] + 0.02 * points[:,0]- 0.10 * points[:,2]) * 1.09 points[:,2] = points[:,2] * 1.02146386 return points def distorb2(points): points[:,0] = (points[:,0] - 0.1 * points[:,1] + 0.1 *points[:,2]) * 1.035 points[:,1] = (points[:,1] + 0 * points[:,0] + 0.03 * points[:,2]) * 1.02 points[:,2] = (points[:,2] + 0.07 * points[:,0] + 0*points[:,1]) * 0.99 points[:] = points[:] - points.min(axis = 0) return points def distorb3(points): points[:,0] = (points[:,0] - 0 * points[:,1] + 0.05 * points[:,2]) * 1.09627 points[:,1] = (points[:,1] - 0.08 * points[:,0] - 0.05 * points[:,2]) * 1.0126 points[:,2] = (points[:,2] + 0 * points[:,1]- 0 * points [:,0]) * 0.92 return points distorb_function_list = [distorb0,distorb1,distorb2,distorb3] Jointlists = ["-54.259,48.396,-73.360,116.643,0,0",\ "-79.785,60.523,-45.213,89.762,0,0",\ "-132.513,67.412,-61.807,44.201,0,0",\ "-159.362,-28.596,-132.738,40.801,0,0",\ "-87.73,22.19,-68.21,86.53,0,0"] Jointlists2 = ["-65,42,-82,78,10,123",\ "-83,41,-72,1,-12,177",\ "-103,45,-70,1,-12,177",\ "-120,49,-61,3,-18,158", "0,0,0,0,0,0",\ "0,-30,-60,0,30,0",\ "-20,-40,-90,0,50,-20"] #for scanning inside the blue tape area Jointlists3 = ["-46.210,55.918,-49.154,-132.490,12.763,-15.858",\ "-87.449,70.578,-19.635,-173.968,21.964,-14.013",\ "-123.609,44.375,-67.215,-181.781,1.13,-35.786",\ "-87.859,-16.706,-142.57,-173.117,-61.720,-3.253"]
"""Semantic versioning for the package qtools3.""" VERSION = (0, 3, 6) __version__ = '.'.join(map(str, VERSION))
class Door: status = 'undefined' def __init__(self, number, status, lock): self.number = number self.status = status self.lock = lock def open(self): """Door opened""" if self.lock == 'unlocked': self.status = 'opened' def close(self): """Door closed""" self.status = 'closed' def onLock(self): """Door locked""" self.lock = 'locked' def unLock(self): """Door unlocked""" self.lock = 'unlocked' @classmethod def knock(cls): print("Knock!") door1 = Door(1, 'closed', 'unlocked') door1.open() print(door1.status) door1.close() print(door1.status) door1.onLock() print(door1.lock) door1.open() print(door1.status) door1.unLock() door1.open() print(door1.status) class ColouredDoor: def __init__(self, number, colour, status='closed'): self.number = number self.status = status self.colour = colour def open(self): """Door opened""" self.status = 'opened' def close(self): """Door closed""" self.status = 'closed' cdoor1 = ColouredDoor(1, 'opened', 'black') print(cdoor1.colour) cdoor1.colour = 'white' print(cdoor1.colour) cdoor2 = ColouredDoor(2, 'orange') print(cdoor2.colour) cdoor2.status print(cdoor2.status) cdoor2.open() print(cdoor2.status) class ToggleDoor: def __init__(self, number, status): self.number = number self.status = status def toggle(self): """Door toggled""" tog_dict = {'closed': 'opened', 'opened': 'closed'} self.status = tog_dict[self.status] tdoors1 = ToggleDoor(1, 'opened') print(tdoors1.status) tdoors1.toggle() print(tdoors1.status) door1 = Door(1, 'closed', 'locked') door1.knock()
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/icefire/ws/src/gscam/include;/usr/include/gstreamer-1.0;/usr/include/glib-2.0;/usr/lib/aarch64-linux-gnu/glib-2.0/include".split(';') if "/home/icefire/ws/src/gscam/include;/usr/include/gstreamer-1.0;/usr/include/glib-2.0;/usr/lib/aarch64-linux-gnu/glib-2.0/include" != "" else [] PROJECT_CATKIN_DEPENDS = "roscpp;nodelet;image_transport;sensor_msgs;camera_calibration_parsers;camera_info_manager".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lgscam;-lgstapp-1.0;-lgstbase-1.0;-lgstreamer-1.0;-lgobject-2.0;-lglib-2.0".split(';') if "-lgscam;-lgstapp-1.0;-lgstbase-1.0;-lgstreamer-1.0;-lgobject-2.0;-lglib-2.0" != "" else [] PROJECT_NAME = "gscam" PROJECT_SPACE_DIR = "/home/icefire/ws/devel" PROJECT_VERSION = "1.0.1"
_NORMALIZING_FLOWS = {} class RegisterFlow(object): """Decorator to registor NormalizingFlow classes. Parameters ---------- flow_cls_name : str name of the NormalizingFlow class. This will be used in the `get_flow` method as the key for the class. Usage ----- >>> @flow_lib.RegisterFlow('MyFlow') >>> class MyFlow(NormalizingFlow) >>> ... """ def __init__(self, flow_cls_name): self._key = flow_cls_name def __call__(self, flow_cls): if not hasattr(flow_cls, 'transform'): raise TypeError("flow_cls must implement a `transform` method, " "recieved %s" % flow_cls) if self._key in _NORMALIZING_FLOWS: raise ValueError("%s has already been registered to : %s" % (self._key, _NORMALIZING_FLOWS[self._key])) _NORMALIZING_FLOWS[self._key] = flow_cls return flow_cls def _registered_flow(name): """Get the normalizing flow class registered to `name`.""" return _NORMALIZING_FLOWS.get(name, None) def get_flow(name, n_iter=2, random_state=123): flow_class = _registered_flow(name) if flow_class is None: raise NotImplementedError( "No Normalizing Flow registered with name %s" % name) return flow_class(n_iter=n_iter, random_state=random_state)
n = int(input()) ans = (n * (n + 1)) // 2 ans = 4 * ans ans = ans - 4 * n ans = 1 + ans print(ans)
# # -*- coding: utf-8 -*- # # Copyright 2015-2020 NETCAT (www.netcat.pl) # # 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. # # @author NETCAT <[email protected]> # @copyright 2015-2020 NETCAT (www.netcat.pl) # @license http://www.apache.org/licenses/LICENSE-2.0 # class Error: """ NIP24 error codes """ NIP_EMPTY = 1 NIP_UNKNOWN= 2 GUS_LOGIN = 3 GUS_CAPTCHA = 4 GUS_SYNC = 5 NIP_UPDATE = 6 NIP_BAD = 7 CONTENT_SYNTAX = 8 NIP_NOT_ACTIVE = 9 INVALID_PATH = 10 EXCEPTION = 11 NO_PERMISSION = 12 GEN_INVOICES = 13 GEN_SPEC_INV = 14 SEND_INVOICE = 15 PREMIUM_FEATURE = 16 SEND_ANNOUNCEMENT = 17 INVOICE_PAYMENT = 18 REGON_BAD = 19 SEARCH_KEY_EMPTY = 20 KRS_BAD = 21 EUVAT_BAD = 22 VIES_SYNC = 23 CEIDG_SYNC = 24 RANDOM_NUMBER = 25 PLAN_FEATURE = 26 SEARCH_TYPE = 27 PPUMF_SYNC = 28 PPUMF_DIRECT = 29 NIP_FEATURE = 30 REGON_FEATURE = 31 KRS_FEATURE = 32 TEST_MODE = 33 ACTIVITY_CHECK = 34 ACCESS_DENIED = 35 MAINTENANCE = 36 BILLING_PLANS = 37 DOCUMENT_PDF = 38 EXPORT_PDF = 39 RANDOM_TYPE = 40 LEGAL_FORM = 41 GROUP_CHECKS = 42 CLIENT_COUNTERS = 43 URE_SYNC = 44 URE_DATA = 45 DKN_BAD = 46 SEND_REMAINDER = 47 EXPORT_JPK = 48 GEN_ORDER_INV = 49 SEND_EXPIRATION = 50 IBAN_SYNC = 51 ORDER_CANCEL = 52 WHITELIST_CHECK = 53 AUTH_TIMESTAMP = 54 AUTH_MAC = 55 IBAN_BAD = 56 DB_AUTH_IP = 101 DB_AUTH_KEY_STATUS = 102 DB_AUTH_KEY_VALUE = 103 DB_AUTH_OVER_PLAN = 104 DB_CLIENT_LOCKED = 105 DB_CLIENT_TYPE = 106 DB_CLIENT_NOT_PAID = 107 DB_AUTH_KEYID_VALUE = 108 CLI_CONNECT = 201 CLI_RESPONSE = 202 CLI_NUMBER = 203 CLI_NIP = 204 CLI_REGON = 205 CLI_KRS = 206 CLI_EUVAT = 207 CLI_IBAN = 208 CLI_EXCEPTION = 209 CLI_DATEFORMAT = 210 CLI_INPUT = 211 __codes__ = { CLI_CONNECT: 'Nie udało się nawiązać połączenia z serwisem NIP24', CLI_RESPONSE: 'Odpowiedź serwisu NIP24 ma nieprawidłowy format', CLI_NUMBER: 'Nieprawidłowy typ numeru', CLI_NIP: 'Numer NIP jest nieprawidłowy', CLI_REGON: 'Numer REGON jest nieprawidłowy', CLI_KRS: 'Numer KRS jest nieprawidłowy', CLI_EUVAT: 'Numer EU VAT ID jest nieprawidłowy', CLI_IBAN: 'Numer IBAN jest nieprawidłowy', CLI_EXCEPTION: 'Funkcja wygenerowała wyjątek', CLI_DATEFORMAT: 'Podana data ma nieprawidłowy format', CLI_INPUT: 'Nieprawidłowy parametr wejściowy funkcji' } @staticmethod def message(code): """ Get error message :param code: error code :type code: int :return: error message :rtype: str """ if code < Error.CLI_CONNECT or code > Error.CLI_INPUT: return None return Error.__codes__[code]
# ------------------------------ # 486. Predict the Winner # # Description: # Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not be available for the next player. This continues until all the scores have been chosen. The player with the maximum score wins. # Given an array of scores, predict whether player 1 is the winner. You can assume each player plays to maximize his score. # # Example 1: # Input: [1, 5, 2] # Output: False # Explanation: Initially, player 1 can choose between 1 and 2. # If he chooses 2 (or 1), then player 2 can choose from 1 (or 2) and 5. If player 2 chooses 5, then player 1 will be left with 1 (or 2). # So, final score of player 1 is 1 + 2 = 3, and player 2 is 5. # Hence, player 1 will never be the winner and you need to return False. # # Note: # 1 <= length of the array <= 20. # Any scores in the given array are non-negative integers and will not exceed 10,000,000. # If the scores of both players are equal, then player 1 is still the winner. # # Version: 1.0 # 10/17/18 by Jianfa # ------------------------------ class Solution: def PredictTheWinner(self, nums): """ :type nums: List[int] :rtype: bool """ # Dynamic Programming solution # O(n^2) space complexity, O(n^2) time complexity if len(nums) == 1: return True dp = [[-1 for _ in range(len(nums))] for _ in range(len(nums))] currSum = sum(nums) player1 = self.helper(nums, dp, currSum, 0, len(nums) - 1) player2 = currSum - player1 return player1 >= player2 def helper(self, nums, dp, currSum, s, e): # Return the max price for one player when he starts to pick number between nums[s] and nums[e] if s == e: dp[s][e] = nums[s] return dp[s][e] if dp[s+1][e] >= 0: # candidate1: dp[s][e] = nums[s] + dp[s+1][e] maxCandidate1 = currSum - dp[s+1][e] else: maxCandidate1 = currSum - self.helper(nums, dp, currSum - nums[s], s+1, e) if dp[s][e-1] >= 0: # candidate2: dp[s][e] = nums[e] + dp[s][e-1] maxCandidate2 = currSum - dp[s][e-1] else: maxCandidate2 = currSum - self.helper(nums, dp, currSum - nums[e], s, e-1) dp[s][e] = max(maxCandidate1, maxCandidate2) return dp[s][e] # Used for testing if __name__ == "__main__": test = Solution() # ------------------------------ # Summary: # Dynamic programming solution.
def power_supply(network: list[list], plant: dict, lis=None) -> set: if not lis: lis = [] net = network.copy() for key, value in plant.items(): for [a, b] in tuple(net): if key in [a, b]: net.remove([a, b]) if value > 0: lis.append(a if key == b else b) if value > 1: power_supply(net, {lis[-1]: value - 1}, lis) return set([item for net in network for item in net]) - set(lis) - set(plant.keys()) # def power_supply(network, power_plants): # out = {x for y in network for x in y} # queue = list(power_plants.items()) # for k, v in ((x, y) for x, y in queue if y >= 0): # queue += [(j if k == i else i, v-1) for i, j in network if k in (i, j)] # out -= {k} # return out if __name__ == '__main__': print(power_supply([['p0', 'c1'], ['p0', 'c2'], ['p0', 'c3'], ['p0', 'c4'], ['c4', 'c9'], ['c4', 'c10'], ['c10', 'c11'], ['c11', 'p12'], ['c2', 'c5'], ['c2', 'c6'], ['c5', 'c7'], ['c5', 'p8']], {'p0': 1, 'p12': 4, 'p8': 1})) # set(['c0', 'c3']
# 6. (Função sem retorno com parâmetro) Faça uma função/método para a partir de um valor inicial e um valor final realizar o acumulo desse valores e apresentar o resultado. Não use vetor. Aqui deverá ocorrer para as duas variáveis, PASSAGEM DE PARÂMETRO POR VALOR. def somar(a, b): soma = a while a < b: a = a + 1 soma = soma + a print() print('Soma: {}'.format(soma)) def main(): a1 = int(input('Digite o primeiro número: ')) b1 = int(input('Digite o segundo número: ')) somar(a1, b1) main()
class Contact: all_contacts = [] def __init__(self, name, email): self.name = name self.email = email Contact.all_contacts.append(self) class Supplier(Contact): def order(self, order): print("if this were a real system we would send " f"{order} order to {self.name}")
# 将一些姓名存储在列表中 names = ["Yang yahu","Gao tong","Hu jin","LI liusheng"] # 创建消息 message_0 = names[0] + "!" + "Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life. " message_1 = names[1] + "!" + "Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life. " message_2 = names[2] + "!" + "Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life. " message_3 = names[3] + "!" + "Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life. " # 为每人都打印一条问候语 print(message_0) print(message_1) print(message_2) print(message_3) # 使用f字符串 message_0 = f"{names[0]}! Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life." message_1 = f"{names[1]}! Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life." message_2 = f"{names[2]}! Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life." message_3 = f"{names[3]}! Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life." # 为每人都打印一条问候语 print(message_0) print(message_1) print(message_2) print(message_3)
''' Created on Oct 22, 2018 @author: casey ''' class Segment(object): # # * Segments make up the tree. There is a base segment, then a root segment, then the tree expands into internal segments, until it gets to leaf segments. # * These segment types make it easier to traverse the tree during building and during evaluation # def __init__(self, l=0): self.left = l self.right = -1 self.link = None def set_link(self, link): self.link = link def get_link(self): return self.link def get_left(self): return self.left def get_right(self): return -1 def put(self, branch, w): return None def find_index(self, word): return 0 def find_branch(self, ind): return None def set_count(self, d): pass def get_count(self): return 0.0 def span(self): return self.get_right() - self.get_left() def increment(self, d): pass def num_children(self): return 0 def __str__(self): return str((self.__class__.__name__, self.left, self.right, str(self.link))) class InternalSegment(Segment): def __init__(self, l): super(InternalSegment, self).__init__(l) self.children = dict() self.set_count(0.0) def find_branch(self, w): if len(self.children) == 0: return None i = self.find_index(w) if i == -2: return None return self.children[i] def find_index(self, i): if i in self.children: return i return -2 def get_right(self): return self.children[self.right].get_left() def update_count(self): self.set_count(0.0) for s in self.children.keys(): self.increment(self.children[s].get_count()) def get_count(self): return self.count def set_count(self, d): self.count = d def increment(self, d): self.count += d def num_children(self): return len(self.children) def put(self, branch, w): i = self.find_index(w) if i == -2: if len(self.children) == 0: self.right = w self.children[w] = branch return None else: old = self.children[w] self.children[w] = branch return old class RootSegment(InternalSegment): def __init__(self, text): super(RootSegment, self).__init__(-1) self.text = text def get_right(self): return 0 def increment(self, d): pass def get_count(self): return self.text.size() class BaseSegment(InternalSegment): def __init__(self, root): super(BaseSegment, self).__init__(-2) self.root = root def find_branch(self, word): return self.root class LeafSegment(Segment): def __init__(self, text, l): super(LeafSegment, self).__init__(l) self.text = text def get_right(self): return self.text.size() def num_children(self): return 0 def find_index(self, word): return -2 def get_count(self): return 1.0 def find_branch(self, word): return None
class SingleLinkedNode: def __init__(self, datum): """Node in a single linked list :param datum: the datum associated with this node """ self.next_node = None self.datum = datum def __str__(self): return "datum={}; next={}".format( self.datum, "None" if self.next_node is None else self.next_node.datum) def __lt__(self, other): return self.datum < other.datum def __eq__(self, other): return self.datum == other.datum def __hash__(self): return hash(self.datum) class DoubleLinkedNode(SingleLinkedNode): def __init__(self, datum=None): """Node in a doubly linked list""" super().__init__(datum) self.previous_node = None def __str__(self): return "previous={}; {}".format( "None" if self.previous_node is None else self.previous_node.datum, super().__str__())
num = int(input("enter the number")) for i in range(2,num): if num%i==0: print("not prime") break else: print("prime")
class TicTacToe: def __init__(self): self.tab = ['.','.','.','.','.','.','.','.','.','.'] def curr_state(self): #obecny stan tablicy return ''.join(self.tab) def postaw_znak_o(self, x, y): #interfejs dla stawiania znaku przez gracza if x < 0 or x > 2 or y < 0 or y > 2 or self.tab[ x + (y*3) ] != '.': return 1 #kod bledu 1 - podano zla liczbe self.tab[ x + (y*3) ] = 'O' self.tab[9] = 'O' return 0 def wyswietl_tab(self): #wyswietla tablice for i in range(0, 7, 3): print( self.tab[ i : (i+3) ] ) def reset(self): self.tab = ['.','.','.','.','.','.','.','.','.','.'] def check_state(self, state): #sprawdza wygrana # 1 = wygral x, 0 = remis, -1 = wygral O, -2 for i in range(0, 7, 3): if state[i:(i+3)] == ['X', 'X', 'X']: return 1 if state[i:(i+3)] == ['O', 'O', 'O']: return -1 for i in range(0,3): if state[i] == 'X' and state[(i+3)] == 'X' and state[(i+6)] == 'X': return 1 if state[i] == 'O' and state[(i+3)] == 'O' and state[(i+6)] == 'O': return -1 if state[0] == 'X' and state[4] == 'X' and state[8] == 'X': return 1 elif state[0] == 'O' and state[4] == 'O' and state[8] == 'O': return -1 elif state[2] == 'X' and state[4] == 'X' and state[6] == 'X': return 1 elif state[2] == 'O' and state[4] == 'O' and state[6] == 'O': return -1 elif '.' not in state: return 0 #w razie remisu return 0 return -2 def next_state_x(self): #wyswietl mozliwe stany dla gracza x possibilities = [] for i in range(0, 9): if self.tab[i] == '.': possibility = [] possibility.extend(self.tab) possibility[9] = 'X' possibility[i] = 'X' possibilities.append(''.join(possibility)) return possibilities #wyswietl mozliwe nastepne stany dla state przyjmuje stan jako string def next_state_x_for(self, state): state = list(state) possibilities = [] for i in range(0, 9): if state[i] == '.': possibility = [] possibility.extend(self.tab) possibility[9] = 'X' possibility[i] = 'X' possibilities.append(''.join(possibility)) return possibilities #zasadnicza roznica miedzy obydwiema powyzszymi funkcjami jest taka ze ta #pierwsza dziala dla game.tab a druga dla dowolnego stanu, napisalem ja #poniewaz musze dostac kolejne stany po danym w rekurencyjnym policy evaluation def next_state_o(self): #wyswietl mozliwe stany dla gracza o possibilities = [] for i in range(0,9): if self.tab[i] == '.': possibility = [] possibility.extend(self.tab) possibility[9] = 'O' possibility[i] = 'O' possibilities.append(''.join(possibility)) return possibilities
ERR_EXCEED_LIMIT = "Not enough space" class NotEnoughSpace(Exception): pass