content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class OpenAPISchemaError(Exception):
"""
Custom exception raised when package tests fail.
"""
pass
| class Openapischemaerror(Exception):
"""
Custom exception raised when package tests fail.
"""
pass |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of ltlf2dfa.
#
# ltlf2dfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ltlf2dfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ltlf2dfa. If not, see <https://www.gnu.org/licenses/>.
#
"""Declaration of metadata for the package."""
__title__ = "ltlf2dfa"
__description__ = "LTLf and PLTLf to Deterministic Finite-state Automata (DFA)"
__url__ = "https://github.com/whitemech/ltlf2dfa.git"
__version__ = "1.0.2"
__author__ = "Francesco Fuggitti"
__author_email__ = "fuggitti@diag.uniroma1.it"
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
__copyright__ = "2018-2022 WhiteMech"
| """Declaration of metadata for the package."""
__title__ = 'ltlf2dfa'
__description__ = 'LTLf and PLTLf to Deterministic Finite-state Automata (DFA)'
__url__ = 'https://github.com/whitemech/ltlf2dfa.git'
__version__ = '1.0.2'
__author__ = 'Francesco Fuggitti'
__author_email__ = 'fuggitti@diag.uniroma1.it'
__license__ = 'GNU Lesser General Public License v3 or later (LGPLv3+)'
__copyright__ = '2018-2022 WhiteMech' |
# my_script.py
# enlarge function
def enlarge(n):
return n * 100
| def enlarge(n):
return n * 100 |
DEFINE = 'define'
BEGIN = 'begin'
SET = 'set!'
LAMBDA = 'lambda'
LET = 'let'
LET_STAR = 'let*'
LET_REC = 'letrec'
OPEN_PARANT = '('
CLOSE_PARANT = ')'
ADD = '+'
SUB = '-'
MULT = '*'
DIV = '/'
DOT = '.'
QUOTE = 'quote'
QUASIQUOTE = 'quasiquote'
UNQUOTE = 'unquote'
UNQUOTE_SPLICING = 'unquote-splicing'
APPLY = 'apply'
IF = 'if'
COND = 'cond'
DELAY = 'delay'
FORCE = 'force'
DEFAULT = 'default'
SLEEP = 'sleep'
RANDOM = 'random'
| define = 'define'
begin = 'begin'
set = 'set!'
lambda = 'lambda'
let = 'let'
let_star = 'let*'
let_rec = 'letrec'
open_parant = '('
close_parant = ')'
add = '+'
sub = '-'
mult = '*'
div = '/'
dot = '.'
quote = 'quote'
quasiquote = 'quasiquote'
unquote = 'unquote'
unquote_splicing = 'unquote-splicing'
apply = 'apply'
if = 'if'
cond = 'cond'
delay = 'delay'
force = 'force'
default = 'default'
sleep = 'sleep'
random = 'random' |
"""
System configuration constants
"""
RANGE_MIN = 1
RANGE_MAX = 100000
ENTRY_SIZE = 3
MAX_INPUT_SIZE = 99
ERROR_MSG_INVALID_FILE_EXTENSION = "The provided file has an invalid format. Only text (.txt) files are accepted."
ERROR_MSG_EXCEEDED_MAX_INPUT_SIZE = "Number of entries bigger than the allowed maximum (%d)." % MAX_INPUT_SIZE
ERROR_MSG_INPUT_SIZE_MISMATCH = "Mismatch between informed and actual number of entries."
ERROR_MSG_INVALID_ENTRY_SIZE = "Invalid entry size at line %d. Expected: %d per entry."
ERROR_MSG_INVALID_ENTRY_RANGE = "Invalid entry range at line %d."
ERROR_MSG_INVALID_ENTRY_TYPE = "Invalid input format at line %d. Only integers are accepted."
| """
System configuration constants
"""
range_min = 1
range_max = 100000
entry_size = 3
max_input_size = 99
error_msg_invalid_file_extension = 'The provided file has an invalid format. Only text (.txt) files are accepted.'
error_msg_exceeded_max_input_size = 'Number of entries bigger than the allowed maximum (%d).' % MAX_INPUT_SIZE
error_msg_input_size_mismatch = 'Mismatch between informed and actual number of entries.'
error_msg_invalid_entry_size = 'Invalid entry size at line %d. Expected: %d per entry.'
error_msg_invalid_entry_range = 'Invalid entry range at line %d.'
error_msg_invalid_entry_type = 'Invalid input format at line %d. Only integers are accepted.' |
"""Library for wally.
This library provides an API for budgeting.
"""
| """Library for wally.
This library provides an API for budgeting.
""" |
###################################
# File Name : compare_identity_analysis.py
###################################
#!/usr/bin/python3
def main():
print ("=== compare identity ===")
print (999 is 999)
x = 999; y = 999;
print (x is y)
z = 999;
print (x is z)
print (id(x))
print (id(y))
print (id(z))
if __name__ == "__main__":
main()
| def main():
print('=== compare identity ===')
print(999 is 999)
x = 999
y = 999
print(x is y)
z = 999
print(x is z)
print(id(x))
print(id(y))
print(id(z))
if __name__ == '__main__':
main() |
#
# PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:12:20 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)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
fastPath, = mibBuilder.importSymbols("BROADCOM-REF-MIB", "fastPath")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Bits, NotificationType, ModuleIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, TimeTicks, iso, Counter64, Gauge32, Integer32, Unsigned32, IpAddress, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "NotificationType", "ModuleIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "TimeTicks", "iso", "Counter64", "Gauge32", "Integer32", "Unsigned32", "IpAddress", "Counter32")
RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention")
fastPathPFC = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47))
if mibBuilder.loadTexts: fastPathPFC.setLastUpdated('200905220000Z')
if mibBuilder.loadTexts: fastPathPFC.setOrganization('Broadcom Corporation')
if mibBuilder.loadTexts: fastPathPFC.setContactInfo(' Customer Support Postal: Broadcom Corporation 100 Perimeter Park Drive Suite H Morrisville, NC 27560 Tel: +1 919 865 2700')
if mibBuilder.loadTexts: fastPathPFC.setDescription('The MIB definitions Priority based Flow Control Feature.')
agentPfcCfgGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1))
agentPfcTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1), )
if mibBuilder.loadTexts: agentPfcTable.setStatus('current')
if mibBuilder.loadTexts: agentPfcTable.setDescription('A table providing configuration of PFC Profile per interface.')
agentPfcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"))
if mibBuilder.loadTexts: agentPfcEntry.setStatus('current')
if mibBuilder.loadTexts: agentPfcEntry.setDescription('PFC Profile configuration for a port.')
agentPfcIntfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: agentPfcIntfIndex.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfIndex.setDescription('This is a unique index for an entry in the agentPfcTable. A non-zero value indicates the ifIndex for the corresponding interface entry in the ifTable.')
agentPfcIntfAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentPfcIntfAdminMode.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfAdminMode.setDescription('Enables/disables PFC profile on an interface.')
agentPfcIntfPfcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2))).clone(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setDescription('Shows the operational-status of PFC on an interface.')
agentPfcTotalIntfPfcFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setStatus('current')
if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setDescription('Total Received PFC Frames on this interface.')
agentPfcTotalIntfPfcFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setStatus('current')
if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setDescription('Total Transmitted PFC Frames on this interface.')
agentPfcActionTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2), )
if mibBuilder.loadTexts: agentPfcActionTable.setStatus('current')
if mibBuilder.loadTexts: agentPfcActionTable.setDescription('A table providing priority and action mappings configuration of PFC.')
agentPfcActionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority"))
if mibBuilder.loadTexts: agentPfcActionEntry.setStatus('current')
if mibBuilder.loadTexts: agentPfcActionEntry.setDescription('PFC Action Profile configuration for a port.')
agentPfcPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7)))
if mibBuilder.loadTexts: agentPfcPriority.setStatus('current')
if mibBuilder.loadTexts: agentPfcPriority.setDescription('This is a unique index for an entry in the agentPfcActionTable. A non-zero value indicates the CosQueue Priority.')
agentPfcAction = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("drop", 1), ("nodrop", 2))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentPfcAction.setStatus('current')
if mibBuilder.loadTexts: agentPfcAction.setDescription('Set Drop/No-Drop action in PFC profile for the corresponding priority.')
agentPfcIntfStatsPerPriorityTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3), )
if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setDescription('A table providing statistics of PFC per interface per priority.')
agentPfcIntfStatsPerPriorityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority"))
if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setDescription('PFC Stats for a priority and for a port.')
agentPfcIntfPfcPriorityFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setStatus('current')
if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setDescription('Received PFC Frames on this interface for a priority.')
mibBuilder.exportSymbols("FASTPATH-PFC-MIB", agentPfcCfgGroup=agentPfcCfgGroup, agentPfcPriority=agentPfcPriority, agentPfcTotalIntfPfcFramesTx=agentPfcTotalIntfPfcFramesTx, agentPfcIntfIndex=agentPfcIntfIndex, agentPfcIntfStatsPerPriorityTable=agentPfcIntfStatsPerPriorityTable, agentPfcActionTable=agentPfcActionTable, agentPfcTable=agentPfcTable, agentPfcIntfStatsPerPriorityEntry=agentPfcIntfStatsPerPriorityEntry, PYSNMP_MODULE_ID=fastPathPFC, agentPfcIntfAdminMode=agentPfcIntfAdminMode, agentPfcAction=agentPfcAction, fastPathPFC=fastPathPFC, agentPfcTotalIntfPfcFramesRx=agentPfcTotalIntfPfcFramesRx, agentPfcIntfPfcPriorityFramesRx=agentPfcIntfPfcPriorityFramesRx, agentPfcEntry=agentPfcEntry, agentPfcIntfPfcStatus=agentPfcIntfPfcStatus, agentPfcActionEntry=agentPfcActionEntry)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection')
(fast_path,) = mibBuilder.importSymbols('BROADCOM-REF-MIB', 'fastPath')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(bits, notification_type, module_identity, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, time_ticks, iso, counter64, gauge32, integer32, unsigned32, ip_address, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'NotificationType', 'ModuleIdentity', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'TimeTicks', 'iso', 'Counter64', 'Gauge32', 'Integer32', 'Unsigned32', 'IpAddress', 'Counter32')
(row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention')
fast_path_pfc = module_identity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47))
if mibBuilder.loadTexts:
fastPathPFC.setLastUpdated('200905220000Z')
if mibBuilder.loadTexts:
fastPathPFC.setOrganization('Broadcom Corporation')
if mibBuilder.loadTexts:
fastPathPFC.setContactInfo(' Customer Support Postal: Broadcom Corporation 100 Perimeter Park Drive Suite H Morrisville, NC 27560 Tel: +1 919 865 2700')
if mibBuilder.loadTexts:
fastPathPFC.setDescription('The MIB definitions Priority based Flow Control Feature.')
agent_pfc_cfg_group = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1))
agent_pfc_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1))
if mibBuilder.loadTexts:
agentPfcTable.setStatus('current')
if mibBuilder.loadTexts:
agentPfcTable.setDescription('A table providing configuration of PFC Profile per interface.')
agent_pfc_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex'))
if mibBuilder.loadTexts:
agentPfcEntry.setStatus('current')
if mibBuilder.loadTexts:
agentPfcEntry.setDescription('PFC Profile configuration for a port.')
agent_pfc_intf_index = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
agentPfcIntfIndex.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfIndex.setDescription('This is a unique index for an entry in the agentPfcTable. A non-zero value indicates the ifIndex for the corresponding interface entry in the ifTable.')
agent_pfc_intf_admin_mode = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone(2)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentPfcIntfAdminMode.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfAdminMode.setDescription('Enables/disables PFC profile on an interface.')
agent_pfc_intf_pfc_status = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('inactive', 2))).clone(2)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentPfcIntfPfcStatus.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfPfcStatus.setDescription('Shows the operational-status of PFC on an interface.')
agent_pfc_total_intf_pfc_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentPfcTotalIntfPfcFramesRx.setStatus('current')
if mibBuilder.loadTexts:
agentPfcTotalIntfPfcFramesRx.setDescription('Total Received PFC Frames on this interface.')
agent_pfc_total_intf_pfc_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 5), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentPfcTotalIntfPfcFramesTx.setStatus('current')
if mibBuilder.loadTexts:
agentPfcTotalIntfPfcFramesTx.setDescription('Total Transmitted PFC Frames on this interface.')
agent_pfc_action_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2))
if mibBuilder.loadTexts:
agentPfcActionTable.setStatus('current')
if mibBuilder.loadTexts:
agentPfcActionTable.setDescription('A table providing priority and action mappings configuration of PFC.')
agent_pfc_action_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex'), (0, 'FASTPATH-PFC-MIB', 'agentPfcPriority'))
if mibBuilder.loadTexts:
agentPfcActionEntry.setStatus('current')
if mibBuilder.loadTexts:
agentPfcActionEntry.setDescription('PFC Action Profile configuration for a port.')
agent_pfc_priority = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 7)))
if mibBuilder.loadTexts:
agentPfcPriority.setStatus('current')
if mibBuilder.loadTexts:
agentPfcPriority.setDescription('This is a unique index for an entry in the agentPfcActionTable. A non-zero value indicates the CosQueue Priority.')
agent_pfc_action = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('drop', 1), ('nodrop', 2))).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentPfcAction.setStatus('current')
if mibBuilder.loadTexts:
agentPfcAction.setDescription('Set Drop/No-Drop action in PFC profile for the corresponding priority.')
agent_pfc_intf_stats_per_priority_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3))
if mibBuilder.loadTexts:
agentPfcIntfStatsPerPriorityTable.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfStatsPerPriorityTable.setDescription('A table providing statistics of PFC per interface per priority.')
agent_pfc_intf_stats_per_priority_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1)).setIndexNames((0, 'FASTPATH-PFC-MIB', 'agentPfcIntfIndex'), (0, 'FASTPATH-PFC-MIB', 'agentPfcPriority'))
if mibBuilder.loadTexts:
agentPfcIntfStatsPerPriorityEntry.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfStatsPerPriorityEntry.setDescription('PFC Stats for a priority and for a port.')
agent_pfc_intf_pfc_priority_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentPfcIntfPfcPriorityFramesRx.setStatus('current')
if mibBuilder.loadTexts:
agentPfcIntfPfcPriorityFramesRx.setDescription('Received PFC Frames on this interface for a priority.')
mibBuilder.exportSymbols('FASTPATH-PFC-MIB', agentPfcCfgGroup=agentPfcCfgGroup, agentPfcPriority=agentPfcPriority, agentPfcTotalIntfPfcFramesTx=agentPfcTotalIntfPfcFramesTx, agentPfcIntfIndex=agentPfcIntfIndex, agentPfcIntfStatsPerPriorityTable=agentPfcIntfStatsPerPriorityTable, agentPfcActionTable=agentPfcActionTable, agentPfcTable=agentPfcTable, agentPfcIntfStatsPerPriorityEntry=agentPfcIntfStatsPerPriorityEntry, PYSNMP_MODULE_ID=fastPathPFC, agentPfcIntfAdminMode=agentPfcIntfAdminMode, agentPfcAction=agentPfcAction, fastPathPFC=fastPathPFC, agentPfcTotalIntfPfcFramesRx=agentPfcTotalIntfPfcFramesRx, agentPfcIntfPfcPriorityFramesRx=agentPfcIntfPfcPriorityFramesRx, agentPfcEntry=agentPfcEntry, agentPfcIntfPfcStatus=agentPfcIntfPfcStatus, agentPfcActionEntry=agentPfcActionEntry) |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class X86SystemVParameterManager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
# NOTE: Only works if it is call before the stack frame is made.
esp = self.__emulator.registers['esp']
return self.__emulator.read_memory(esp + 4 * index + 0x4, 4)
def __setitem__(self, index, value):
# NOTE: Only works if it is call before the stack frame is made.
esp = self.__emulator.registers['esp']
return self.__emulator.write_memory(esp + 4 * index + 0x4, 4, value)
class X86SystemV(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = X86SystemVParameterManager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['eax']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['eax'] = value
class X86_64SystemVParameterManager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
if index == 0:
return self.__emulator.registers['rdi']
elif index == 1:
return self.__emulator.registers['rsi']
elif index == 2:
return self.__emulator.registers['rdx']
elif index == 3:
return self.__emulator.registers['rcx']
elif index == 4:
return self.__emulator.registers['r8']
elif index == 5:
return self.__emulator.registers['r9']
else:
raise NotImplementedError()
def __setitem__(self, index, value):
if index == 0:
self.__emulator.registers['rdi'] = value
elif index == 1:
self.__emulator.registers['rsi'] = value
elif index == 2:
self.__emulator.registers['rdx'] = value
elif index == 3:
self.__emulator.registers['rcx'] = value
elif index == 4:
self.__emulator.registers['r8'] = value
elif index == 5:
self.__emulator.registers['r9'] = value
else:
raise NotImplementedError()
class X86_64SystemV(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = X86_64SystemVParameterManager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['rax']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['rax'] = value
class ArmSystemVParameterManager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
if index == 0:
return self.__emulator.registers['r0']
elif index == 1:
return self.__emulator.registers['r1']
elif index == 2:
return self.__emulator.registers['r2']
elif index == 3:
return self.__emulator.registers['r3']
else:
raise NotImplementedError()
def __setitem__(self, index, value):
if index == 0:
self.__emulator.registers['r0'] = value
elif index == 1:
self.__emulator.registers['r1'] = value
elif index == 2:
self.__emulator.registers['r2'] = value
elif index == 3:
self.__emulator.registers['r3'] = value
else:
raise NotImplementedError()
class ArmSystemV(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = ArmSystemVParameterManager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['r0']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['r0'] = value
| class X86Systemvparametermanager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
esp = self.__emulator.registers['esp']
return self.__emulator.read_memory(esp + 4 * index + 4, 4)
def __setitem__(self, index, value):
esp = self.__emulator.registers['esp']
return self.__emulator.write_memory(esp + 4 * index + 4, 4, value)
class X86Systemv(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = x86_system_v_parameter_manager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['eax']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['eax'] = value
class X86_64Systemvparametermanager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
if index == 0:
return self.__emulator.registers['rdi']
elif index == 1:
return self.__emulator.registers['rsi']
elif index == 2:
return self.__emulator.registers['rdx']
elif index == 3:
return self.__emulator.registers['rcx']
elif index == 4:
return self.__emulator.registers['r8']
elif index == 5:
return self.__emulator.registers['r9']
else:
raise not_implemented_error()
def __setitem__(self, index, value):
if index == 0:
self.__emulator.registers['rdi'] = value
elif index == 1:
self.__emulator.registers['rsi'] = value
elif index == 2:
self.__emulator.registers['rdx'] = value
elif index == 3:
self.__emulator.registers['rcx'] = value
elif index == 4:
self.__emulator.registers['r8'] = value
elif index == 5:
self.__emulator.registers['r9'] = value
else:
raise not_implemented_error()
class X86_64Systemv(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = x86_64_system_v_parameter_manager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['rax']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['rax'] = value
class Armsystemvparametermanager(object):
def __init__(self, emulator):
self.__emulator = emulator
def __getitem__(self, index):
if index == 0:
return self.__emulator.registers['r0']
elif index == 1:
return self.__emulator.registers['r1']
elif index == 2:
return self.__emulator.registers['r2']
elif index == 3:
return self.__emulator.registers['r3']
else:
raise not_implemented_error()
def __setitem__(self, index, value):
if index == 0:
self.__emulator.registers['r0'] = value
elif index == 1:
self.__emulator.registers['r1'] = value
elif index == 2:
self.__emulator.registers['r2'] = value
elif index == 3:
self.__emulator.registers['r3'] = value
else:
raise not_implemented_error()
class Armsystemv(object):
def __init__(self, emulator):
self.__emulator = emulator
self.__parameters = arm_system_v_parameter_manager(emulator)
@property
def parameters(self):
return self.__parameters
@property
def return_value(self):
return self.__emulator.registers['r0']
@return_value.setter
def return_value(self, value):
self.__emulator.registers['r0'] = value |
def find_path(start, end, parents):
""" Constructs a path between two vertices, given the parents of all vertices. """
path, parent = [], end
while parent != parents[start]:
path.append(parent)
parent = parents[parent]
return path[::-1]
| def find_path(start, end, parents):
""" Constructs a path between two vertices, given the parents of all vertices. """
(path, parent) = ([], end)
while parent != parents[start]:
path.append(parent)
parent = parents[parent]
return path[::-1] |
def resolve():
'''
code here
'''
num_S, num_c = [int(item) for item in input().split()]
delta = num_c - num_S *2
scc = 0
if num_S != 0:
if num_c // 2 <= num_S :
scc = num_c//2
else:
scc = num_S
scc += delta//4
else:
scc = num_c//4
print(scc)
if __name__ == "__main__":
resolve()
| def resolve():
"""
code here
"""
(num_s, num_c) = [int(item) for item in input().split()]
delta = num_c - num_S * 2
scc = 0
if num_S != 0:
if num_c // 2 <= num_S:
scc = num_c // 2
else:
scc = num_S
scc += delta // 4
else:
scc = num_c // 4
print(scc)
if __name__ == '__main__':
resolve() |
class Template(object):
def __init__(self, usages, snippets, blocks):
self.usages = usages
self.snippets = snippets
self.blocks = blocks
def accept(self, visitor):
visitor.visit_template(self)
class Text(object):
def __init__(self, text_token):
self._token = text_token
def get_token(self):
return self._token
token = property(get_token)
def _get_content(self):
return self._token.lexeme
content = property(_get_content)
def accept(self, visitor):
visitor.visit_text(self)
class CondBlock(object):
def __init__(self, branches):
self.branches = branches
def accept(self, visitor):
visitor.visit_cond(self)
class ForBlock(object):
def __init__(self, item_ident, list_expr, blocks, filter_cond=None):
self.item_ident = item_ident
self.list_expr = list_expr
self.blocks = blocks
self.filter_cond = filter_cond
def accept(self, visitor):
visitor.visit_for(self)
class Snippet(object):
def __init__(self, snippet_name, params, blocks):
self.name = snippet_name
self.params = params
self.blocks = blocks
def accept(self, visitor):
visitor.visit_snippet(self)
class SnippetCall(object):
def __init__(self, snippet_name, args):
self.name = snippet_name
self.args = args
def accept(self, visitor):
visitor.visit_snippet_call(self)
class Call(object):
def __init__(self, callee, args):
self.callee = callee
self.args = args
def accept(self, visitor):
visitor.visit_call(self)
class Use(object):
def __init__(self, template_name, names):
self.template_name = template_name
self.names = names # names and aliases
def accept(self, visitor):
visitor.visit_use(self)
class SingleToken(object):
def __init__(self, token):
self.token = token
def accept(self, visitor):
visitor.visit_expr(self)
class Identifier(SingleToken):
def __init__(self, identifier_token):
SingleToken.__init__(self, identifier_token)
def get_name(self):
return self.token.lexeme
class SimpleValue(SingleToken):
def __init__(self, token):
SingleToken.__init__(self, token)
def get_value(self):
raise Exception("Not implemented")
class Bool(SimpleValue):
def __init__(self, bool_token):
SimpleValue.__init__(self, bool_token)
def get_value(self):
s = self.token.lexeme
return s == "true" or s == "else"
class String(SimpleValue):
def __init__(self, str_token):
SimpleValue.__init__(self, str_token)
def get_value(self):
return self.token.lexeme
def get_string(self):
return self.token.lexeme[1:-1].replace("\\'", "'")
class Int(SimpleValue):
def __init__(self, int_token):
SimpleValue.__init__(self, int_token)
def get_value(self):
return int(self.token.lexeme)
class Real(SimpleValue):
def __init__(self, real_token):
SimpleValue.__init__(self, real_token)
def get_value(self):
return float(self.token.lexeme)
class QualifiedName(object):
def __init__(self, identifier_tokens):
self.identifier_tokens = identifier_tokens
def accept(self, visitor):
visitor.visit_expr(self)
def get_name(self):
return str(self)
def __str__(self):
return ".".join(list(map(lambda ident: ident.lexeme, self.identifier_tokens)))
class LogicalBinExpr(object):
def __init__(self, op, left, right):
self.op = op
self.left = left
self.right = right
def accept(self, visitor):
visitor.visit_logical_bin(self)
class LogicalRelation(object):
def __init__(self, op, left, right):
self.op = op
self.left = left
self.right = right
def accept(self, visitor):
visitor.visit_logical_rel(self)
class Negation(object):
def __init__(self, expr):
self.expr = expr
def accept(self, visitor):
visitor.visit_negation(self)
class BaseVisitor(object):
def __init__(self):
pass
def visit_template(self, templ):
pass
def visit_text(self, text):
pass
def visit_cond(self, cond_block):
pass
def visit_for(self, for_block):
pass
def visit_snippet(self, snippet):
pass
def visit_snippet_call(self, snippet_call):
pass
def visit_use(self, use):
pass
def visit_call(self, func_call):
pass
def visit_expr(self, expr):
pass
def visit_logical_bin(self, logical_bin):
pass
def visit_logical_rel(self, logical_rel):
pass
def visit_negation(self, negation):
pass
| class Template(object):
def __init__(self, usages, snippets, blocks):
self.usages = usages
self.snippets = snippets
self.blocks = blocks
def accept(self, visitor):
visitor.visit_template(self)
class Text(object):
def __init__(self, text_token):
self._token = text_token
def get_token(self):
return self._token
token = property(get_token)
def _get_content(self):
return self._token.lexeme
content = property(_get_content)
def accept(self, visitor):
visitor.visit_text(self)
class Condblock(object):
def __init__(self, branches):
self.branches = branches
def accept(self, visitor):
visitor.visit_cond(self)
class Forblock(object):
def __init__(self, item_ident, list_expr, blocks, filter_cond=None):
self.item_ident = item_ident
self.list_expr = list_expr
self.blocks = blocks
self.filter_cond = filter_cond
def accept(self, visitor):
visitor.visit_for(self)
class Snippet(object):
def __init__(self, snippet_name, params, blocks):
self.name = snippet_name
self.params = params
self.blocks = blocks
def accept(self, visitor):
visitor.visit_snippet(self)
class Snippetcall(object):
def __init__(self, snippet_name, args):
self.name = snippet_name
self.args = args
def accept(self, visitor):
visitor.visit_snippet_call(self)
class Call(object):
def __init__(self, callee, args):
self.callee = callee
self.args = args
def accept(self, visitor):
visitor.visit_call(self)
class Use(object):
def __init__(self, template_name, names):
self.template_name = template_name
self.names = names
def accept(self, visitor):
visitor.visit_use(self)
class Singletoken(object):
def __init__(self, token):
self.token = token
def accept(self, visitor):
visitor.visit_expr(self)
class Identifier(SingleToken):
def __init__(self, identifier_token):
SingleToken.__init__(self, identifier_token)
def get_name(self):
return self.token.lexeme
class Simplevalue(SingleToken):
def __init__(self, token):
SingleToken.__init__(self, token)
def get_value(self):
raise exception('Not implemented')
class Bool(SimpleValue):
def __init__(self, bool_token):
SimpleValue.__init__(self, bool_token)
def get_value(self):
s = self.token.lexeme
return s == 'true' or s == 'else'
class String(SimpleValue):
def __init__(self, str_token):
SimpleValue.__init__(self, str_token)
def get_value(self):
return self.token.lexeme
def get_string(self):
return self.token.lexeme[1:-1].replace("\\'", "'")
class Int(SimpleValue):
def __init__(self, int_token):
SimpleValue.__init__(self, int_token)
def get_value(self):
return int(self.token.lexeme)
class Real(SimpleValue):
def __init__(self, real_token):
SimpleValue.__init__(self, real_token)
def get_value(self):
return float(self.token.lexeme)
class Qualifiedname(object):
def __init__(self, identifier_tokens):
self.identifier_tokens = identifier_tokens
def accept(self, visitor):
visitor.visit_expr(self)
def get_name(self):
return str(self)
def __str__(self):
return '.'.join(list(map(lambda ident: ident.lexeme, self.identifier_tokens)))
class Logicalbinexpr(object):
def __init__(self, op, left, right):
self.op = op
self.left = left
self.right = right
def accept(self, visitor):
visitor.visit_logical_bin(self)
class Logicalrelation(object):
def __init__(self, op, left, right):
self.op = op
self.left = left
self.right = right
def accept(self, visitor):
visitor.visit_logical_rel(self)
class Negation(object):
def __init__(self, expr):
self.expr = expr
def accept(self, visitor):
visitor.visit_negation(self)
class Basevisitor(object):
def __init__(self):
pass
def visit_template(self, templ):
pass
def visit_text(self, text):
pass
def visit_cond(self, cond_block):
pass
def visit_for(self, for_block):
pass
def visit_snippet(self, snippet):
pass
def visit_snippet_call(self, snippet_call):
pass
def visit_use(self, use):
pass
def visit_call(self, func_call):
pass
def visit_expr(self, expr):
pass
def visit_logical_bin(self, logical_bin):
pass
def visit_logical_rel(self, logical_rel):
pass
def visit_negation(self, negation):
pass |
#take user inputs for Item code
itemCode = input("Item Code : ")
while itemCode != "1" and itemCode != "2" and itemCode != "3":
print("Invalid Input!! Try again")
itemCode = input("Item Code : ")
#take user inputs for quantity
quantity = input("Quantity : ")
quantity = float(quantity)
#take user inputs for customer type
cType = input("Customer Type (L / N) : ")
while cType != "L" and cType != "l" and cType != "N" and cType != "n":
print("Invalid Input!! Try again")
cType = input("Customer Type (L / N) : ")
#calculate basic price
if itemCode == "1":
total = 530 * quantity
elif itemCode == "2":
total = 300 * quantity
elif itemCode == "3":
total = 950 * quantity
#calculate discount
if cType == "L" or cType == "l":
discount = float(total * 25 / 100)
else:
discount = float(total * 5 / 100)
#calculate total price
total = total - discount
#display the discount and total
print("Discount : " + str(discount))
print("Total bill after the discount : " + str(total)) | item_code = input('Item Code : ')
while itemCode != '1' and itemCode != '2' and (itemCode != '3'):
print('Invalid Input!! Try again')
item_code = input('Item Code : ')
quantity = input('Quantity : ')
quantity = float(quantity)
c_type = input('Customer Type (L / N) : ')
while cType != 'L' and cType != 'l' and (cType != 'N') and (cType != 'n'):
print('Invalid Input!! Try again')
c_type = input('Customer Type (L / N) : ')
if itemCode == '1':
total = 530 * quantity
elif itemCode == '2':
total = 300 * quantity
elif itemCode == '3':
total = 950 * quantity
if cType == 'L' or cType == 'l':
discount = float(total * 25 / 100)
else:
discount = float(total * 5 / 100)
total = total - discount
print('Discount : ' + str(discount))
print('Total bill after the discount : ' + str(total)) |
"""API operation on tags."""
class TagOperator(object):
"""Task tag settings."""
def __init__(self, connect):
"""Initialize instance.
Args:
connect (rayvision_api.api.connect.Connect): The connect instance.
"""
self._connect = connect
def add_label(self, new_name, status=1):
"""Add a custom label.
Args:
new_name (str): Label name.
status (int, optional): Label status,0 or 1,default is 1.
"""
data = {
'newName': new_name,
'status': int(status)
}
return self._connect.post(self._connect.url.add, data)
def delete_label(self, del_name):
"""Delete custom label.
Args:
del_name (str): The name of the label to be deleted.
"""
data = {'delName': del_name}
return self._connect.post(self._connect.url.delete, data)
def get_label_list(self):
"""Get custom labels.
Returns:
dict: Label list info.
e.g.:
{
"projectNameList": [
{
"projectId": 3671,
"projectName": "myLabel"
}
]
}
"""
return self._connect.post(self._connect.url.getList, validator=False)
def get_project_list(self):
"""Get custom labels.
Returns:
list: Label list info.
e.g.:
[
{
"projectId": 3671,
"projectName": "myLabel"
}
]
"""
return self.get_label_list()['projectNameList']
def add_task_tag(self, tag, task_ids):
"""Add a custom task tag.
Args:
tag (str): Label name.
task_ids (list[int], optional): task id list.
"""
data = {
"label": tag,
"taskIds": task_ids
}
return self._connect.post(self._connect.url.addTaskLabel, data)
def delete_task_tag(self, tag_ids):
"""del custom task label.
Args:
label_ids (list[int], optional): lable id list.
"""
data = {
"labelIds": tag_ids
}
return self._connect.post(self._connect.url.deleteTaskLabel, data)
def get_list(self, flag=0):
"""Get the project name based on the flag.
Args:
flag (int): 0. Query items under this account;
1. Query items under this account and under the master account;
2. Query all items associated with (all items under the same master account)
"""
data = {
'flag': flag,
}
return self._connect.post(self._connect.url.list, data) | """API operation on tags."""
class Tagoperator(object):
"""Task tag settings."""
def __init__(self, connect):
"""Initialize instance.
Args:
connect (rayvision_api.api.connect.Connect): The connect instance.
"""
self._connect = connect
def add_label(self, new_name, status=1):
"""Add a custom label.
Args:
new_name (str): Label name.
status (int, optional): Label status,0 or 1,default is 1.
"""
data = {'newName': new_name, 'status': int(status)}
return self._connect.post(self._connect.url.add, data)
def delete_label(self, del_name):
"""Delete custom label.
Args:
del_name (str): The name of the label to be deleted.
"""
data = {'delName': del_name}
return self._connect.post(self._connect.url.delete, data)
def get_label_list(self):
"""Get custom labels.
Returns:
dict: Label list info.
e.g.:
{
"projectNameList": [
{
"projectId": 3671,
"projectName": "myLabel"
}
]
}
"""
return self._connect.post(self._connect.url.getList, validator=False)
def get_project_list(self):
"""Get custom labels.
Returns:
list: Label list info.
e.g.:
[
{
"projectId": 3671,
"projectName": "myLabel"
}
]
"""
return self.get_label_list()['projectNameList']
def add_task_tag(self, tag, task_ids):
"""Add a custom task tag.
Args:
tag (str): Label name.
task_ids (list[int], optional): task id list.
"""
data = {'label': tag, 'taskIds': task_ids}
return self._connect.post(self._connect.url.addTaskLabel, data)
def delete_task_tag(self, tag_ids):
"""del custom task label.
Args:
label_ids (list[int], optional): lable id list.
"""
data = {'labelIds': tag_ids}
return self._connect.post(self._connect.url.deleteTaskLabel, data)
def get_list(self, flag=0):
"""Get the project name based on the flag.
Args:
flag (int): 0. Query items under this account;
1. Query items under this account and under the master account;
2. Query all items associated with (all items under the same master account)
"""
data = {'flag': flag}
return self._connect.post(self._connect.url.list, data) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Keyword
TOKEN_TYPE_IF = 0
TOKEN_TYPE_ELIF = 1
TOKEN_TYPE_ELSE = 2
TOKEN_TYPE_FOR = 3
TOKEN_TYPE_IN = 4
TOKEN_TYPE_WHILE = 5
TOKEN_TYPE_BREAK = 6
TOKEN_TYPE_NOT = 7
TOKEN_TYPE_AND = 8
TOKEN_TYPE_OR = 9
TOKEN_TYPE_RETURN = 10
TOKEN_TYPE_IMPORT = 11
TOKEN_TYPE_FUN = 12
TOKEN_TYPE_CLASS = 13
TOKEN_TYPE_LET = 14
TOKEN_TYPE_GLOBAL = 15
TOKEN_TYPE_TRUE = 16
TOKEN_TYPE_FALSE = 17
TOKEN_TYPE_CONTINUE = 18
TOKEN_TYPE_DEL = 19
keyword_strs = {
'if': TOKEN_TYPE_IF,
'elif': TOKEN_TYPE_ELIF,
'else': TOKEN_TYPE_ELSE,
'for': TOKEN_TYPE_FOR,
'in': TOKEN_TYPE_IN,
'while': TOKEN_TYPE_WHILE,
'break': TOKEN_TYPE_BREAK,
'not': TOKEN_TYPE_NOT,
'and': TOKEN_TYPE_AND,
'or': TOKEN_TYPE_OR,
'return': TOKEN_TYPE_RETURN,
'import': TOKEN_TYPE_IMPORT,
'fun': TOKEN_TYPE_FUN,
'class': TOKEN_TYPE_CLASS,
'let': TOKEN_TYPE_LET,
'global': TOKEN_TYPE_GLOBAL,
'True': TOKEN_TYPE_TRUE,
'False': TOKEN_TYPE_FALSE,
'continue': TOKEN_TYPE_CONTINUE,
'del': TOKEN_TYPE_DEL,
}
# Arithmetic operators
TOKEN_TYPE_ADD = 20
TOKEN_TYPE_SUB = 21
TOKEN_TYPE_MUL = 22
TOKEN_TYPE_DIV = 23
TOKEN_TYPE_MOD = 24 # %
TOKEN_TYPE_POWER = 25
# Logical operators
TOKEN_TYPE_EQU = 26
TOKEN_TYPE_NEQU = 27 # !=
TOKEN_TYPE_GT = 28
TOKEN_TYPE_LT = 29
TOKEN_TYPE_GE = 30
TOKEN_TYPE_LE = 31
# Assigning operator
TOKEN_TYPE_ASSIGN = 32
# Bitwise operator
TOKEN_TYPE_LOGIC_AND = 33
TOKEN_TYPE_LOGIC_OR = 34
TOKEN_TYPE_LOGIC_XOR = 35
TOKEN_TYPE_LOGIC_NOT = 36
TOKEN_TYPE_LOGIC_SHL = 37
TOKEN_TYPE_LOGIC_SHR = 38
# Data type
TOKEN_TYPE_NUM = 39
TOKEN_TYPE_STR = 40
# Others
TOKEN_TYPE_COMMA = 41
TOKEN_TYPE_POINT = 42
TOKEN_TYPE_COLON = 43 # :
TOKEN_TYPE_SEMICOLON = 44 # ;, ; is comment
TOKEN_TYPE_LEFT_PARENT = 45 # (
TOKEN_TYPE_RIGHT_PARENT = 46 # )
TOKEN_TYPE_LEFT_BRACKET = 47 # [
TOKEN_TYPE_RIGHT_BRACKET = 48 # ]
TOKEN_TYPE_LEFT_BRACE = 49 # {
TOKEN_TYPE_RIGHT_BRACE = 50 # }
TOKEN_TYPE_DOUBLE_QUOTATION = 51
TOKEN_TYPE_SINGLE_QUOTE = 52 # ' is anonymous function
TOKEN_TYPE_EOF = 53 # The end of file
TOKEN_TYPE_UNKNOWN = 54
# Extra
TOKEN_TYPE_NIL = 55 # File start sign
TOKEN_TYPE_ID = 56
TOKEN_TYPE_SPACER = 57 # `
TOKEN_TYPE_STR_LINES = 58
TOKEN_TYPE_SELF = 59
| token_type_if = 0
token_type_elif = 1
token_type_else = 2
token_type_for = 3
token_type_in = 4
token_type_while = 5
token_type_break = 6
token_type_not = 7
token_type_and = 8
token_type_or = 9
token_type_return = 10
token_type_import = 11
token_type_fun = 12
token_type_class = 13
token_type_let = 14
token_type_global = 15
token_type_true = 16
token_type_false = 17
token_type_continue = 18
token_type_del = 19
keyword_strs = {'if': TOKEN_TYPE_IF, 'elif': TOKEN_TYPE_ELIF, 'else': TOKEN_TYPE_ELSE, 'for': TOKEN_TYPE_FOR, 'in': TOKEN_TYPE_IN, 'while': TOKEN_TYPE_WHILE, 'break': TOKEN_TYPE_BREAK, 'not': TOKEN_TYPE_NOT, 'and': TOKEN_TYPE_AND, 'or': TOKEN_TYPE_OR, 'return': TOKEN_TYPE_RETURN, 'import': TOKEN_TYPE_IMPORT, 'fun': TOKEN_TYPE_FUN, 'class': TOKEN_TYPE_CLASS, 'let': TOKEN_TYPE_LET, 'global': TOKEN_TYPE_GLOBAL, 'True': TOKEN_TYPE_TRUE, 'False': TOKEN_TYPE_FALSE, 'continue': TOKEN_TYPE_CONTINUE, 'del': TOKEN_TYPE_DEL}
token_type_add = 20
token_type_sub = 21
token_type_mul = 22
token_type_div = 23
token_type_mod = 24
token_type_power = 25
token_type_equ = 26
token_type_nequ = 27
token_type_gt = 28
token_type_lt = 29
token_type_ge = 30
token_type_le = 31
token_type_assign = 32
token_type_logic_and = 33
token_type_logic_or = 34
token_type_logic_xor = 35
token_type_logic_not = 36
token_type_logic_shl = 37
token_type_logic_shr = 38
token_type_num = 39
token_type_str = 40
token_type_comma = 41
token_type_point = 42
token_type_colon = 43
token_type_semicolon = 44
token_type_left_parent = 45
token_type_right_parent = 46
token_type_left_bracket = 47
token_type_right_bracket = 48
token_type_left_brace = 49
token_type_right_brace = 50
token_type_double_quotation = 51
token_type_single_quote = 52
token_type_eof = 53
token_type_unknown = 54
token_type_nil = 55
token_type_id = 56
token_type_spacer = 57
token_type_str_lines = 58
token_type_self = 59 |
###############################################################################
''''''
###############################################################################
# import unittest
def testfunc(a, b,
c,
d=4, # another comment
/,
e: int = 5,
# stuff
f=6,
g=7,
h=8,
*args,
# morestuff
i,
j=10,
# k
k0=11,
k1=110,
k2=1100,
l=12, # noqa: E741
m=13,
# bonusstuff
n=14,
# morebonusstuff
o=15,
# ignore
fee='fee', fie='fie', foe='foe',
fum='fum',
# subignore
boo='boo',
p=16,
**kwargs,
):
print(
a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs
)
# class CascadeTest(unittest.TestCase):
# def test(self):
# inputs = Inputs(testfunc)
# self.assertEqual(inputs.stuff.f, 6)
# inputs.stuff.f = 'myval'
# self.assertEqual(inputs.stuff.f, 'myval')
# self.assertEqual(inputs.f, 'myval')
# inputs['k'] = 'myval'
# self.assertEqual(inputs.k, 'myval')
# self.assertEqual(inputs.morestuff.substuff.k, 'myval')
# self.assertTrue(not hasattr(inputs, 'foo'))
# self.assertTrue(not hasattr(inputs, '_c'))
#
# if __name__ == '__main__':
# unittest.main()
###############################################################################
###############################################################################
| """"""
def testfunc(a, b, c, d=4, /, e: int=5, f=6, g=7, h=8, *args, i, j=10, k0=11, k1=110, k2=1100, l=12, m=13, n=14, o=15, fee='fee', fie='fie', foe='foe', fum='fum', boo='boo', p=16, **kwargs):
print(a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs) |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
retlisthead, retlistpos = None, None
lv: int = 0
while l1 is not None or l2 is not None:
v1, l1 = (l1.val, l1.next) if l1 is not None else (0, None)
v2, l2 = (l2.val, l2.next) if l2 is not None else (0, None)
v = v1 + v2 + lv
lv = v // 10
node = ListNode(v % 10)
if retlisthead is None:
retlisthead = node
else:
retlistpos.next = node
retlistpos = node
if lv != 0:
retlistpos.next = ListNode(lv)
return retlisthead
def NodeToList(l: ListNode) -> list:
ret = list()
while l is not None:
ret.append(l.val)
l = l.next
return ret
def ListToNode(l: list) -> ListNode:
retlisthead, retlistpos = None, None
for v in l:
node = ListNode(v)
if retlisthead is None:
retlisthead = node
else:
retlistpos.next = node
retlistpos = node
return retlisthead
if __name__ == "__main__":
sol = Solution()
l1 = ListToNode([2, 4, 3])
l2 = ListToNode([5, 6, 4])
print(NodeToList(sol.addTwoNumbers(l1, l2)))
l1 = ListToNode([0])
l2 = ListToNode([0])
print(NodeToList(sol.addTwoNumbers(l1, l2)))
l1 = ListToNode([9, 9, 9, 9, 9, 9, 9])
l2 = ListToNode([9, 9, 9, 9])
print(NodeToList(sol.addTwoNumbers(l1, l2))) | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode:
(retlisthead, retlistpos) = (None, None)
lv: int = 0
while l1 is not None or l2 is not None:
(v1, l1) = (l1.val, l1.next) if l1 is not None else (0, None)
(v2, l2) = (l2.val, l2.next) if l2 is not None else (0, None)
v = v1 + v2 + lv
lv = v // 10
node = list_node(v % 10)
if retlisthead is None:
retlisthead = node
else:
retlistpos.next = node
retlistpos = node
if lv != 0:
retlistpos.next = list_node(lv)
return retlisthead
def node_to_list(l: ListNode) -> list:
ret = list()
while l is not None:
ret.append(l.val)
l = l.next
return ret
def list_to_node(l: list) -> ListNode:
(retlisthead, retlistpos) = (None, None)
for v in l:
node = list_node(v)
if retlisthead is None:
retlisthead = node
else:
retlistpos.next = node
retlistpos = node
return retlisthead
if __name__ == '__main__':
sol = solution()
l1 = list_to_node([2, 4, 3])
l2 = list_to_node([5, 6, 4])
print(node_to_list(sol.addTwoNumbers(l1, l2)))
l1 = list_to_node([0])
l2 = list_to_node([0])
print(node_to_list(sol.addTwoNumbers(l1, l2)))
l1 = list_to_node([9, 9, 9, 9, 9, 9, 9])
l2 = list_to_node([9, 9, 9, 9])
print(node_to_list(sol.addTwoNumbers(l1, l2))) |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
Len = 0
tmp = root
while tmp:
Len+=1
tmp = tmp.next
part_len = Len // k
remain = Len % k
res = []
for _ in range(k):
head = ListNode(0)
each = head
for _ in range(part_len):
node = ListNode(root.val)
each.next = node
each = each.next
root = root.next
if remain and root:
remain_node = ListNode(root.val)
each.next = remain_node
if root:
root = root.next
remain -= 1
res.append(head.next)
return res | class Solution:
def split_list_to_parts(self, root: ListNode, k: int) -> List[ListNode]:
len = 0
tmp = root
while tmp:
len += 1
tmp = tmp.next
part_len = Len // k
remain = Len % k
res = []
for _ in range(k):
head = list_node(0)
each = head
for _ in range(part_len):
node = list_node(root.val)
each.next = node
each = each.next
root = root.next
if remain and root:
remain_node = list_node(root.val)
each.next = remain_node
if root:
root = root.next
remain -= 1
res.append(head.next)
return res |
T = int(input())
for _ in range(T):
s = input()
n_1 = 0
for c in s:
if c == '1':
n_1 += 1
if n_1%2:
print('WIN')
else:
print('LOSE')
| t = int(input())
for _ in range(T):
s = input()
n_1 = 0
for c in s:
if c == '1':
n_1 += 1
if n_1 % 2:
print('WIN')
else:
print('LOSE') |
def obrnut(tekst):
return tekst[::-1]
def da_li_je_palindrom(tekst):
return tekst == obrnut(tekst)
nesto = input("Ukucja tekst: ")
if(da_li_je_palindrom(nesto)):
print("Da, to je palindrom")
else:
print("Ne to nije palindrom")
| def obrnut(tekst):
return tekst[::-1]
def da_li_je_palindrom(tekst):
return tekst == obrnut(tekst)
nesto = input('Ukucja tekst: ')
if da_li_je_palindrom(nesto):
print('Da, to je palindrom')
else:
print('Ne to nije palindrom') |
def arrayPartition(nums):
nums.sort()
suma=0
for i in range(0,len(nums),2):
suma+=min(nums[i],nums[i+1])
return suma
nums = [1,4,3,2]
print(arrayPartition(nums)) | def array_partition(nums):
nums.sort()
suma = 0
for i in range(0, len(nums), 2):
suma += min(nums[i], nums[i + 1])
return suma
nums = [1, 4, 3, 2]
print(array_partition(nums)) |
# Write your solution here
def spruce(n):
row = "*"
print("a spruce!")
while n > 0:
print(" " * (n-1) + row + " " * (n-1))
row += "**"
n -= 1
l = int((len(row)-3)/2)
print(" " * l + "*" + " " * l)
# You can test your function by callil
if __name__ == "__main__":
spruce(5)
spruce(4) | def spruce(n):
row = '*'
print('a spruce!')
while n > 0:
print(' ' * (n - 1) + row + ' ' * (n - 1))
row += '**'
n -= 1
l = int((len(row) - 3) / 2)
print(' ' * l + '*' + ' ' * l)
if __name__ == '__main__':
spruce(5)
spruce(4) |
"""
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
# OSBS2 TBD
def get_inspect_for_image(image):
# util.get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None)
# or use skopeo
# insecure = self.pull_registries[base_image.registry]['insecure']
# dockercfg_path = self.pull_registries[base_image.registry]['dockercfg_path']
# self._base_image_inspect =\
# atomic_reactor.util.get_inspect_for_image(base_image, base_image.registry, insecure,
# dockercfg_path)
return {}
def get_image_history(image):
# get image history with skopeo / registry api
return []
def inspect_built_image():
# get output image final/arch specific from somewhere
# and call get_inspect_for_image
return {}
def base_image_inspect():
# get base image from workflow.dockerfile_images
# and call get_inspect_for_image
return {}
def remove_image(image, force=False):
# self.tasker.remove_image(image, force=force)
# most likely won't be needed at all
return {}
def tag_image(image, new_image):
# self.tasker.tag_image(image, new_image)
return True
def get_image(image):
# self.tasker.get_image(image)
# use skopeo copy
return {}
| """
Copyright (c) 2021 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
def get_inspect_for_image(image):
return {}
def get_image_history(image):
return []
def inspect_built_image():
return {}
def base_image_inspect():
return {}
def remove_image(image, force=False):
return {}
def tag_image(image, new_image):
return True
def get_image(image):
return {} |
class Rule_Set:
def __init__(self):
"""Creates a single rule set for IP2 packets based on 10 fields.
Args:
- self: this index, the one to create. mandatory object reference.
Returns:
None.
"""
self.source_IP = {}
self.dest_IP = {}
self.source_Port = {}
self.dest_Port = {}
self.protocol = {}
self.count = 0
def get_rules(self, filepath):
with open(filepath) as file:
for iteration, line in enumerate(file):
line = line.split()
self.handle_Source_IP(line[0], iteration)
self.handle_Dest_IP(line[1], iteration)
self.handle_Source_Port(line[2]+line[3]+line[4], iteration)
self.handle_Dest_Port(line[5]+line[6]+line[7], iteration)
self.handle_protocol(line[8], iteration)
self.count = iteration
def handle_Source_IP(self, IP, iteration):
a, b, c, temp = IP[1:].split('.')
temp = temp.split('/')
d = temp[0]
x = temp[1]
IP = self.get_IP_int(int(a), int(b), int(c), int(d))
IP_bounds = self.get_IP_Bounds(IP, int(x))
self.source_IP[iteration] = [IP_bounds[0], IP_bounds[1]]
def handle_Dest_IP(self, IP, iteration):
a, b, c, temp = IP.split('.')
temp = temp.split('/')
d = temp[0]
x = temp[1]
IP = self.get_IP_int(int(a), int(b), int(c), int(d))
IP_bounds = self.get_IP_Bounds(IP, int(x))
self.dest_IP[iteration] = [IP_bounds[0], IP_bounds[1]]
def handle_Source_Port(self, port, iteration):
port = port.split(':')
self.source_Port[iteration] = [int(port[0]), int(port[1])]
def handle_Dest_Port(self, port, iteration):
port = port.split(':')
self.dest_Port[iteration] = [int(port[0]), int(port[1])]
def handle_protocol(self, protocol, iteration):
protocol = protocol.split('/')
self.protocol[iteration] = [self.hex_to_int(
protocol[0]), self.hex_to_int(protocol[1])]
def get_IP_int(self, a, b, c, d):
return d + (256 * c) + (65536 * b) + (16777216 * a)
def get_IP_Bounds(self, value, x):
LowerBound = value
LowerBound = LowerBound >> (32 - x)
LowerBound = LowerBound << (32 - x)
Power = int(32 - x)
UpperBound = LowerBound + pow(2, Power) - 1
return [LowerBound, UpperBound]
def hex_to_int(self, value):
return int(value, 16)
| class Rule_Set:
def __init__(self):
"""Creates a single rule set for IP2 packets based on 10 fields.
Args:
- self: this index, the one to create. mandatory object reference.
Returns:
None.
"""
self.source_IP = {}
self.dest_IP = {}
self.source_Port = {}
self.dest_Port = {}
self.protocol = {}
self.count = 0
def get_rules(self, filepath):
with open(filepath) as file:
for (iteration, line) in enumerate(file):
line = line.split()
self.handle_Source_IP(line[0], iteration)
self.handle_Dest_IP(line[1], iteration)
self.handle_Source_Port(line[2] + line[3] + line[4], iteration)
self.handle_Dest_Port(line[5] + line[6] + line[7], iteration)
self.handle_protocol(line[8], iteration)
self.count = iteration
def handle__source_ip(self, IP, iteration):
(a, b, c, temp) = IP[1:].split('.')
temp = temp.split('/')
d = temp[0]
x = temp[1]
ip = self.get_IP_int(int(a), int(b), int(c), int(d))
ip_bounds = self.get_IP_Bounds(IP, int(x))
self.source_IP[iteration] = [IP_bounds[0], IP_bounds[1]]
def handle__dest_ip(self, IP, iteration):
(a, b, c, temp) = IP.split('.')
temp = temp.split('/')
d = temp[0]
x = temp[1]
ip = self.get_IP_int(int(a), int(b), int(c), int(d))
ip_bounds = self.get_IP_Bounds(IP, int(x))
self.dest_IP[iteration] = [IP_bounds[0], IP_bounds[1]]
def handle__source__port(self, port, iteration):
port = port.split(':')
self.source_Port[iteration] = [int(port[0]), int(port[1])]
def handle__dest__port(self, port, iteration):
port = port.split(':')
self.dest_Port[iteration] = [int(port[0]), int(port[1])]
def handle_protocol(self, protocol, iteration):
protocol = protocol.split('/')
self.protocol[iteration] = [self.hex_to_int(protocol[0]), self.hex_to_int(protocol[1])]
def get_ip_int(self, a, b, c, d):
return d + 256 * c + 65536 * b + 16777216 * a
def get_ip__bounds(self, value, x):
lower_bound = value
lower_bound = LowerBound >> 32 - x
lower_bound = LowerBound << 32 - x
power = int(32 - x)
upper_bound = LowerBound + pow(2, Power) - 1
return [LowerBound, UpperBound]
def hex_to_int(self, value):
return int(value, 16) |
class Node:
def __init__(self,key):
self.left = None
self.right = None
self.val = key
def printInorder(root):
if root:
printInorder(root.left)
print(root.val),
printInorder(root.right)
def printPostorder(root):
if root:
printPostorder(root.left)
printPostorder(root.right)
print(root.val),
def printPreorder(root):
if root:
print(root.val),
printPreorder(root.left)
printPreorder(root.right)
root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)
print ("Preorder traversal of binary tree is")
printPreorder(root)
print ("\nInorder traversal of binary tree is")
printInorder(root)
print ("\nPostorder traversal of binary tree is")
printPostorder(root)
| class Node:
def __init__(self, key):
self.left = None
self.right = None
self.val = key
def print_inorder(root):
if root:
print_inorder(root.left)
(print(root.val),)
print_inorder(root.right)
def print_postorder(root):
if root:
print_postorder(root.left)
print_postorder(root.right)
(print(root.val),)
def print_preorder(root):
if root:
(print(root.val),)
print_preorder(root.left)
print_preorder(root.right)
root = node(1)
root.left = node(2)
root.right = node(3)
root.left.left = node(4)
root.left.right = node(5)
print('Preorder traversal of binary tree is')
print_preorder(root)
print('\nInorder traversal of binary tree is')
print_inorder(root)
print('\nPostorder traversal of binary tree is')
print_postorder(root) |
"""Example Sudoku problems and solutions."""
# keys of problems that are easy to solve by brute force
# used by the tests
TEST_KEYS = ['easy1', 'hard1', 'hard2', 'swordfish1']
# ##### Example Sudoku problems
# Notes:
# 1) 'swordfish1' requires the complicated swordfish manoeuver
# http://www.sudokuoftheday.com/pages/techniques-9.php
# 2) it takes a *long* time to 'minimal1' or 'minimal2' with
# my brute-force solver
sudoku_problems = {'easy1': [[0,0,3,7,0,0,0,5,0],
[0,7,0,0,5,0,8,0,0],
[1,0,0,0,0,6,0,0,4],
[5,0,2,0,0,0,0,0,0],
[8,0,0,9,0,4,0,0,6],
[0,0,0,0,0,0,9,0,2],
[3,0,0,5,0,0,0,0,7],
[0,0,4,0,9,0,0,6,0],
[0,2,0,0,0,7,4,0,0]],
'hard1': [[0,0,0,0,5,8,0,0,9],
[5,0,8,3,0,0,0,0,6],
[0,0,3,4,0,0,0,0,0],
[7,0,0,0,0,4,3,5,0],
[8,0,0,0,0,0,0,0,2],
[0,4,1,5,0,0,0,0,8],
[0,0,0,0,0,3,8,7,0],
[0,0,0,0,0,5,0,0,0],
[3,2,0,8,1,0,0,6,0]],
'hard2': [[5,0,1,2,8,0,0,0,0],
[8,0,0,0,0,0,7,0,2],
[2,0,0,0,0,0,1,8,5],
[0,1,4,7,0,0,5,0,0],
[0,0,0,4,0,0,0,2,0],
[0,2,6,0,0,0,0,0,0],
[1,0,0,0,3,6,0,0,0],
[4,0,0,0,0,0,0,5,1],
[6,0,0,0,4,1,0,0,0]],
'minimal1':
[[0,0,0,0,0,0,0,1,0],
[4,0,0,0,0,0,0,0,0],
[0,2,0,0,0,0,0,0,0],
[0,0,0,0,5,0,4,0,7],
[0,0,8,0,0,0,3,0,0],
[0,0,1,0,9,0,0,0,0],
[3,0,0,4,0,0,2,0,0],
[0,5,0,1,0,0,0,0,0],
[0,0,0,8,0,6,0,0,0]],
'minimal2':
[[2,0,0,4,0,8,0,0,0],
[1,0,0,0,0,0,0,3,0],
[0,0,0,0,0,0,0,0,0],
[0,6,0,0,4,0,0,0,0],
[0,0,0,2,0,0,0,5,0],
[0,8,5,0,0,0,0,0,0],
[0,0,0,1,0,0,2,0,0],
[7,0,0,3,0,0,0,0,0],
[0,0,0,0,0,0,5,0,8]],
'swordfish1':
[[0,0,0,4,7,0,6,0,0],
[0,0,4,0,0,0,3,0,5],
[9,2,0,0,0,0,0,0,0],
[0,3,1,0,0,0,0,0,0],
[0,0,0,9,3,6,0,0,0],
[0,0,0,0,0,0,2,8,0],
[0,0,0,0,0,0,0,1,6],
[4,0,8,0,0,0,9,0,0],
[0,0,7,0,5,2,0,0,0]]
}
# ##### Solutions to problems
sudoku_solutions = {'easy1': [[4,8,3,7,1,2,6,5,9],
[2,7,6,4,5,9,8,1,3],
[1,5,9,8,3,6,7,2,4],
[5,9,2,6,7,3,1,4,8],
[8,3,1,9,2,4,5,7,6],
[6,4,7,1,8,5,9,3,2],
[3,6,8,5,4,1,2,9,7],
[7,1,4,2,9,8,3,6,5],
[9,2,5,3,6,7,4,8,1 ]],
'hard1': [[4,6,2,7,5,8,1,3,9],
[5,7,8,3,9,1,4,2,6],
[9,1,3,4,6,2,5,8,7],
[7,9,6,2,8,4,3,5,1],
[8,3,5,1,7,9,6,4,2],
[2,4,1,5,3,6,7,9,8],
[1,5,9,6,2,3,8,7,4],
[6,8,7,9,4,5,2,1,3],
[3,2,4,8,1,7,9,6,5]],
'hard2': [[5,7,1,2,8,4,9,6,3],
[8,6,3,1,9,5,7,4,2],
[2,4,9,6,7,3,1,8,5],
[3,1,4,7,6,2,5,9,8],
[7,8,5,4,1,9,3,2,6],
[9,2,6,3,5,8,4,1,7],
[1,9,2,5,3,6,8,7,4],
[4,3,8,9,2,7,6,5,1],
[6,5,7,8,4,1,2,3,9]],
'minimal1':
[[6,9,3,7,8,4,5,1,2],
[4,8,7,5,1,2,9,3,6],
[1,2,5,9,6,3,8,7,4],
[9,3,2,6,5,1,4,8,7],
[5,6,8,2,4,7,3,9,1],
[7,4,1,3,9,8,6,2,5],
[3,1,9,4,7,5,2,6,8],
[8,5,6,1,2,9,7,4,3],
[2,7,4,8,3,6,1,5,9]],
'swordfish1':
[[3,1,5,4,7,9,6,2,8],
[7,8,4,2,6,1,3,9,5],
[9,2,6,5,8,3,1,4,7],
[5,3,1,7,2,8,4,6,9],
[8,4,2,9,3,6,5,7,1],
[6,7,9,1,4,5,2,8,3],
[2,5,3,8,9,4,7,1,6],
[4,6,8,3,1,7,9,5,2],
[1,9,7,6,5,2,8,3,4]]
}
| """Example Sudoku problems and solutions."""
test_keys = ['easy1', 'hard1', 'hard2', 'swordfish1']
sudoku_problems = {'easy1': [[0, 0, 3, 7, 0, 0, 0, 5, 0], [0, 7, 0, 0, 5, 0, 8, 0, 0], [1, 0, 0, 0, 0, 6, 0, 0, 4], [5, 0, 2, 0, 0, 0, 0, 0, 0], [8, 0, 0, 9, 0, 4, 0, 0, 6], [0, 0, 0, 0, 0, 0, 9, 0, 2], [3, 0, 0, 5, 0, 0, 0, 0, 7], [0, 0, 4, 0, 9, 0, 0, 6, 0], [0, 2, 0, 0, 0, 7, 4, 0, 0]], 'hard1': [[0, 0, 0, 0, 5, 8, 0, 0, 9], [5, 0, 8, 3, 0, 0, 0, 0, 6], [0, 0, 3, 4, 0, 0, 0, 0, 0], [7, 0, 0, 0, 0, 4, 3, 5, 0], [8, 0, 0, 0, 0, 0, 0, 0, 2], [0, 4, 1, 5, 0, 0, 0, 0, 8], [0, 0, 0, 0, 0, 3, 8, 7, 0], [0, 0, 0, 0, 0, 5, 0, 0, 0], [3, 2, 0, 8, 1, 0, 0, 6, 0]], 'hard2': [[5, 0, 1, 2, 8, 0, 0, 0, 0], [8, 0, 0, 0, 0, 0, 7, 0, 2], [2, 0, 0, 0, 0, 0, 1, 8, 5], [0, 1, 4, 7, 0, 0, 5, 0, 0], [0, 0, 0, 4, 0, 0, 0, 2, 0], [0, 2, 6, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 3, 6, 0, 0, 0], [4, 0, 0, 0, 0, 0, 0, 5, 1], [6, 0, 0, 0, 4, 1, 0, 0, 0]], 'minimal1': [[0, 0, 0, 0, 0, 0, 0, 1, 0], [4, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 0, 4, 0, 7], [0, 0, 8, 0, 0, 0, 3, 0, 0], [0, 0, 1, 0, 9, 0, 0, 0, 0], [3, 0, 0, 4, 0, 0, 2, 0, 0], [0, 5, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 8, 0, 6, 0, 0, 0]], 'minimal2': [[2, 0, 0, 4, 0, 8, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 3, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 0, 4, 0, 0, 0, 0], [0, 0, 0, 2, 0, 0, 0, 5, 0], [0, 8, 5, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 2, 0, 0], [7, 0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 5, 0, 8]], 'swordfish1': [[0, 0, 0, 4, 7, 0, 6, 0, 0], [0, 0, 4, 0, 0, 0, 3, 0, 5], [9, 2, 0, 0, 0, 0, 0, 0, 0], [0, 3, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 9, 3, 6, 0, 0, 0], [0, 0, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 0, 0, 0, 0, 1, 6], [4, 0, 8, 0, 0, 0, 9, 0, 0], [0, 0, 7, 0, 5, 2, 0, 0, 0]]}
sudoku_solutions = {'easy1': [[4, 8, 3, 7, 1, 2, 6, 5, 9], [2, 7, 6, 4, 5, 9, 8, 1, 3], [1, 5, 9, 8, 3, 6, 7, 2, 4], [5, 9, 2, 6, 7, 3, 1, 4, 8], [8, 3, 1, 9, 2, 4, 5, 7, 6], [6, 4, 7, 1, 8, 5, 9, 3, 2], [3, 6, 8, 5, 4, 1, 2, 9, 7], [7, 1, 4, 2, 9, 8, 3, 6, 5], [9, 2, 5, 3, 6, 7, 4, 8, 1]], 'hard1': [[4, 6, 2, 7, 5, 8, 1, 3, 9], [5, 7, 8, 3, 9, 1, 4, 2, 6], [9, 1, 3, 4, 6, 2, 5, 8, 7], [7, 9, 6, 2, 8, 4, 3, 5, 1], [8, 3, 5, 1, 7, 9, 6, 4, 2], [2, 4, 1, 5, 3, 6, 7, 9, 8], [1, 5, 9, 6, 2, 3, 8, 7, 4], [6, 8, 7, 9, 4, 5, 2, 1, 3], [3, 2, 4, 8, 1, 7, 9, 6, 5]], 'hard2': [[5, 7, 1, 2, 8, 4, 9, 6, 3], [8, 6, 3, 1, 9, 5, 7, 4, 2], [2, 4, 9, 6, 7, 3, 1, 8, 5], [3, 1, 4, 7, 6, 2, 5, 9, 8], [7, 8, 5, 4, 1, 9, 3, 2, 6], [9, 2, 6, 3, 5, 8, 4, 1, 7], [1, 9, 2, 5, 3, 6, 8, 7, 4], [4, 3, 8, 9, 2, 7, 6, 5, 1], [6, 5, 7, 8, 4, 1, 2, 3, 9]], 'minimal1': [[6, 9, 3, 7, 8, 4, 5, 1, 2], [4, 8, 7, 5, 1, 2, 9, 3, 6], [1, 2, 5, 9, 6, 3, 8, 7, 4], [9, 3, 2, 6, 5, 1, 4, 8, 7], [5, 6, 8, 2, 4, 7, 3, 9, 1], [7, 4, 1, 3, 9, 8, 6, 2, 5], [3, 1, 9, 4, 7, 5, 2, 6, 8], [8, 5, 6, 1, 2, 9, 7, 4, 3], [2, 7, 4, 8, 3, 6, 1, 5, 9]], 'swordfish1': [[3, 1, 5, 4, 7, 9, 6, 2, 8], [7, 8, 4, 2, 6, 1, 3, 9, 5], [9, 2, 6, 5, 8, 3, 1, 4, 7], [5, 3, 1, 7, 2, 8, 4, 6, 9], [8, 4, 2, 9, 3, 6, 5, 7, 1], [6, 7, 9, 1, 4, 5, 2, 8, 3], [2, 5, 3, 8, 9, 4, 7, 1, 6], [4, 6, 8, 3, 1, 7, 9, 5, 2], [1, 9, 7, 6, 5, 2, 8, 3, 4]]} |
with open("input.txt") as f:
p1 = []
f.readline()
line = f.readline()
while line != "\n":
p1.append(int(line.strip()))
line = f.readline()
f.readline()
p2 = []
line = f.readline()
while line != "":
p2.append(int(line.strip()))
line = f.readline()
game_history = {}
def serialize(hand):
return ",".join(str(x) for x in hand)
# returns 1 if p1 wins, 2 if p2 wins, 0 if p1 wins game immediately
def play_round(p1, p2, game):
entry = (serialize(p1), serialize(p2))
if entry in game_history[game]:
return 0
game_history[game].add(entry)
p1_card = p1.pop(0)
p2_card = p2.pop(0)
if len(p1) >= p1_card and len(p2) >= p2_card:
round_winner = play_game(p1[:p1_card], p2[:p2_card], game+1)
else:
round_winner = 1 if p1_card > p2_card else 2
if round_winner == 1:
p1.extend([p1_card, p2_card])
elif round_winner == 2:
p2.extend([p2_card, p1_card])
return round_winner
def play_game(p1, p2, game=0):
game_history[game] = set()
while len(p1) > 0 and len(p2) > 0:
if play_round(p1, p2, game) == 0:
return 1
return 1 if len(p1) > 0 else 2
winner = play_game(p1, p2)
winner_hand = p2 if winner == 2 else p1
print(winner)
print(p1)
print(p2)
print(sum(card * x for card, x in zip(winner_hand, range(len(winner_hand), 0, -1))))
| with open('input.txt') as f:
p1 = []
f.readline()
line = f.readline()
while line != '\n':
p1.append(int(line.strip()))
line = f.readline()
f.readline()
p2 = []
line = f.readline()
while line != '':
p2.append(int(line.strip()))
line = f.readline()
game_history = {}
def serialize(hand):
return ','.join((str(x) for x in hand))
def play_round(p1, p2, game):
entry = (serialize(p1), serialize(p2))
if entry in game_history[game]:
return 0
game_history[game].add(entry)
p1_card = p1.pop(0)
p2_card = p2.pop(0)
if len(p1) >= p1_card and len(p2) >= p2_card:
round_winner = play_game(p1[:p1_card], p2[:p2_card], game + 1)
else:
round_winner = 1 if p1_card > p2_card else 2
if round_winner == 1:
p1.extend([p1_card, p2_card])
elif round_winner == 2:
p2.extend([p2_card, p1_card])
return round_winner
def play_game(p1, p2, game=0):
game_history[game] = set()
while len(p1) > 0 and len(p2) > 0:
if play_round(p1, p2, game) == 0:
return 1
return 1 if len(p1) > 0 else 2
winner = play_game(p1, p2)
winner_hand = p2 if winner == 2 else p1
print(winner)
print(p1)
print(p2)
print(sum((card * x for (card, x) in zip(winner_hand, range(len(winner_hand), 0, -1))))) |
nota1 = int(input("escriba la prmera nota de su alumno:"))
nota2 = int(input("escriba la segunda nota de su alumno:"))
nota3 = int(input("escriba la tercera nota de su alumno:"))
nota4 = int(input("escriba la cuarta nota de su alumno:"))
media = (nota1 + nota2 + nota3 + nota4) / 4
print(media)
sapo = True
while sapo == True:
if media >= 15:
print("Alumno con talento")
sapo = False
if media in range(12,15):
print("Con capacidad")
if media < 12:
print("Debe reorientarse")
sapo = False
if media> 20:
print("esto es imposible ha debido haber un error introduciendo las notas")
sapo = False | nota1 = int(input('escriba la prmera nota de su alumno:'))
nota2 = int(input('escriba la segunda nota de su alumno:'))
nota3 = int(input('escriba la tercera nota de su alumno:'))
nota4 = int(input('escriba la cuarta nota de su alumno:'))
media = (nota1 + nota2 + nota3 + nota4) / 4
print(media)
sapo = True
while sapo == True:
if media >= 15:
print('Alumno con talento')
sapo = False
if media in range(12, 15):
print('Con capacidad')
if media < 12:
print('Debe reorientarse')
sapo = False
if media > 20:
print('esto es imposible ha debido haber un error introduciendo las notas')
sapo = False |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def minDepth(self, root):
if root is None:
return 0
# BFS
queue1 = []
queue2 = []
queue1.append(root)
queue2.append(1)
while queue1:
root = queue1.pop(0)
depth = queue2.pop(0)
if root.left is None and root.right is None:
return depth
if root.left is not None:
queue1.append(root.left)
queue2.append(depth + 1)
if root.right is not None:
queue1.append(root.right)
queue2.append(depth + 1)
| class Solution:
def min_depth(self, root):
if root is None:
return 0
queue1 = []
queue2 = []
queue1.append(root)
queue2.append(1)
while queue1:
root = queue1.pop(0)
depth = queue2.pop(0)
if root.left is None and root.right is None:
return depth
if root.left is not None:
queue1.append(root.left)
queue2.append(depth + 1)
if root.right is not None:
queue1.append(root.right)
queue2.append(depth + 1) |
# Python - 3.6.0
Test.describe('Basic tests')
Test.assert_equals(sequence_sum(2, 6, 2), 12)
Test.assert_equals(sequence_sum(1, 5, 1), 15)
Test.assert_equals(sequence_sum(1, 5, 3), 5)
Test.assert_equals(sequence_sum(0, 15, 3), 45)
Test.assert_equals(sequence_sum(16, 15, 3), 0)
Test.assert_equals(sequence_sum(2, 24, 22), 26)
Test.assert_equals(sequence_sum(2, 2, 2), 2)
Test.assert_equals(sequence_sum(2, 2, 1), 2)
Test.assert_equals(sequence_sum(1, 15, 3), 35)
Test.assert_equals(sequence_sum(15, 1, 3), 0)
| Test.describe('Basic tests')
Test.assert_equals(sequence_sum(2, 6, 2), 12)
Test.assert_equals(sequence_sum(1, 5, 1), 15)
Test.assert_equals(sequence_sum(1, 5, 3), 5)
Test.assert_equals(sequence_sum(0, 15, 3), 45)
Test.assert_equals(sequence_sum(16, 15, 3), 0)
Test.assert_equals(sequence_sum(2, 24, 22), 26)
Test.assert_equals(sequence_sum(2, 2, 2), 2)
Test.assert_equals(sequence_sum(2, 2, 1), 2)
Test.assert_equals(sequence_sum(1, 15, 3), 35)
Test.assert_equals(sequence_sum(15, 1, 3), 0) |
def test_atom_feed(app):
app.get("/stream.atom")
def test_rss_feed(app):
app.get("/stream.rss")
| def test_atom_feed(app):
app.get('/stream.atom')
def test_rss_feed(app):
app.get('/stream.rss') |
"""Constants for integration_blueprint."""
# Base component constants
NAME = "TuneBlade"
DOMAIN = "tuneblade"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.5"
ISSUE_URL = "https://github.com/spycle/tuneblade/issues"
# Icons
ICON = "mdi:cast-audio-variant"
# Device classes
MEDIA_PLAYER_DEVICE_CLASS = "speaker"
# Platforms
SWITCH = "switch"
MEDIA_PLAYER = "media_player"
PLATFORMS = [SWITCH, MEDIA_PLAYER]
# Configuration and options
CONF_ENABLED = "enabled"
CONF_USERNAME = "username"
CONF_PASSWORD = "password"
CONF_AIRPLAY_PASSWORD = "airplay_password"
CONF_DEVICE_ID = "device_id"
CONF_HOST = "host"
CONF_PORT = "port"
# Defaults
DEFAULT_NAME = DOMAIN
STARTUP_MESSAGE = f"""
-------------------------------------------------------------------
{NAME}
Version: {VERSION}
This is a custom integration!
If you have any issues with this you need to open an issue here:
{ISSUE_URL}
-------------------------------------------------------------------
"""
| """Constants for integration_blueprint."""
name = 'TuneBlade'
domain = 'tuneblade'
domain_data = f'{DOMAIN}_data'
version = '0.0.5'
issue_url = 'https://github.com/spycle/tuneblade/issues'
icon = 'mdi:cast-audio-variant'
media_player_device_class = 'speaker'
switch = 'switch'
media_player = 'media_player'
platforms = [SWITCH, MEDIA_PLAYER]
conf_enabled = 'enabled'
conf_username = 'username'
conf_password = 'password'
conf_airplay_password = 'airplay_password'
conf_device_id = 'device_id'
conf_host = 'host'
conf_port = 'port'
default_name = DOMAIN
startup_message = f'\n-------------------------------------------------------------------\n{NAME}\nVersion: {VERSION}\nThis is a custom integration!\nIf you have any issues with this you need to open an issue here:\n{ISSUE_URL}\n-------------------------------------------------------------------\n' |
age = 12
if age < 4:
print("Your admission cost is $0.")
elif age < 18:
print("Your admission cost is $25.")
else:
print("Your admission cost is $40.")
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
print(f"Your admission cost is ${price}.")
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
elif age < 65:
price = 40
else:
price = 20
print(f"Your admission cost is ${price}.")
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
elif age < 65:
price = 40
elif age >= 65:
price = 20
print(f"Your admission cost is ${price}.")
| age = 12
if age < 4:
print('Your admission cost is $0.')
elif age < 18:
print('Your admission cost is $25.')
else:
print('Your admission cost is $40.')
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
print(f'Your admission cost is ${price}.')
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
elif age < 65:
price = 40
else:
price = 20
print(f'Your admission cost is ${price}.')
age = 12
if age < 4:
price = 0
elif age < 18:
price = 25
elif age < 65:
price = 40
elif age >= 65:
price = 20
print(f'Your admission cost is ${price}.') |
class Updated:
def __init__(self, payload):
self.tiers_added = payload['tiersAdded']
self.orb_count_diff = payload['orbCountDiff']
self.inventory_updates = payload['inventoryUpdates']
| class Updated:
def __init__(self, payload):
self.tiers_added = payload['tiersAdded']
self.orb_count_diff = payload['orbCountDiff']
self.inventory_updates = payload['inventoryUpdates'] |
#2XX Success
SUCESS_OK = 200
#4XX Error
ERROR_BAD_REQUEST = 400
ERROR_UNAUTHORIZED = 401
ERROR_FORBIDDEN = 403
ERROR_NOT_FOUND = 404
#5xx
ERROR_SERVER = 500
| sucess_ok = 200
error_bad_request = 400
error_unauthorized = 401
error_forbidden = 403
error_not_found = 404
error_server = 500 |
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz"
s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb"
# take 2 strings s1 and s2 including only letters from ato z.
# Return a new sorted string, the longest possible, containing distinct letters
def longest(s1, s2):
s = sorted(set(s1 + s2))
return s | s1 = 'xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz'
s2 = 'xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb'
def longest(s1, s2):
s = sorted(set(s1 + s2))
return s |
def fc(claim, s=None):
suffix = ('-'+s) if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim)
def fdlc(claim):
return fc(claim, s='dl')
def scope(scope, s=None):
suffix = ('-'+s) if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope)
| def fc(claim, s=None):
suffix = '-' + s if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim)
def fdlc(claim):
return fc(claim, s='dl')
def scope(scope, s=None):
suffix = '-' + s if s else ''
return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope) |
# Given a string, use recursion to output a list of all the possible permutations of a string
# If a character is repeated, treat all versions as distinct
# Itertools does permutations
def permute(s):
out = []
# Base case is when there is only one letter
if len(s) < 2:
out = [s]
else:
# For every letter in string
for i, letter in enumerate(s):
# For every permutation resultingfromstep2 a nd3
for perm in permute(s[:i] + s[i+1:]):
# add it to the output
out += [let+perm]
return out
s = "abc"
print(permute(s)) | def permute(s):
out = []
if len(s) < 2:
out = [s]
else:
for (i, letter) in enumerate(s):
for perm in permute(s[:i] + s[i + 1:]):
out += [let + perm]
return out
s = 'abc'
print(permute(s)) |
# from https://github.com/peteboyd/lammps_interface.git
ATOMIC_MASSES = {
"H": 1.00794,
"He": 4.002602,
"Li": 6.941,
"Be": 9.012182,
"B": 10.811,
"C": 12.0107,
"N": 14.0067,
"O": 15.9994,
"F": 18.9984032,
"Ne": 20.1797,
"Na": 22.98976928,
"Mg": 24.3050,
"Al": 26.9815386,
"Si": 28.0855,
"P": 30.973762,
"S": 32.065,
"Cl": 35.453,
"Ar": 39.948,
"K": 39.0983,
"Ca": 40.078,
"Sc": 44.955912,
"Ti": 47.867,
"V": 50.9415,
"Cr": 51.9961,
"Mn": 54.938045,
"Fe": 55.845,
"Co": 58.933195,
"Ni": 58.6934,
"Cu": 63.546,
"Zn": 65.38,
"Ga": 69.723,
"Ge": 72.64,
"As": 74.92160,
"Se": 78.96,
"Br": 79.904,
"Kr": 83.798,
"Rb": 85.4678,
"Sr": 87.62,
"Y": 88.90585,
"Zr": 91.224,
"Nb": 92.90638,
"Mo": 95.96,
"Tc": 98,
"Ru": 101.07,
"Rh": 102.90550,
"Pd": 106.42,
"Ag": 107.8682,
"Cd": 112.411,
"In": 114.818,
"Sn": 118.710,
"Sb": 121.760,
"Te": 127.60,
"I": 126.90447,
"Xe": 131.293,
"Cs": 132.9054519,
"Ba": 137.327,
"La": 138.90547,
"Ce": 140.116,
"Pr": 140.90765,
"Nd": 144.242,
"Pm": 145,
"Sm": 150.36,
"Eu": 151.964,
"Gd": 157.25,
"Tb": 158.92535,
"Dy": 162.500,
"Ho": 164.93032,
"Er": 167.259,
"Tm": 168.93421,
"Yb": 173.054,
"Lu": 174.9668,
"Hf": 178.49,
"Ta": 180.94788,
"W": 183.84,
"Re": 186.207,
"Os": 190.23,
"Ir": 192.217,
"Pt": 195.084,
"Au": 196.966569,
"Hg": 200.59,
"Tl": 204.3833,
"Pb": 207.2,
"Bi": 208.98040,
"Po": 209,
"At": 210,
"Rn": 222,
"Fr": 223,
"Ra": 226,
"Ac": 227,
"Th": 232.03806,
"Pa": 231.03588,
"U": 238.02891,
"Np": 237,
"Pu": 244,
"Am": 243,
"Cm": 247,
"Bk": 247,
"Cf": 251,
"Es": 252,
"Fm": 257,
"Md": 258,
"No": 259,
"Lr": 262,
"Rf": 265,
"Db": 268,
"Sg": 271,
"Bh": 272,
"Hs": 270,
"Mt": 276,
"Ds": 281,
"Rg": 280,
"Cn": 285,
"Uut": 284,
"Uuq": 289,
"Uup": 288,
"Uuh": 293,
"Uuo": 294
}
| atomic_masses = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.0107, 'N': 14.0067, 'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815386, 'Si': 28.0855, 'P': 30.973762, 'S': 32.065, 'Cl': 35.453, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': 44.955912, 'Ti': 47.867, 'V': 50.9415, 'Cr': 51.9961, 'Mn': 54.938045, 'Fe': 55.845, 'Co': 58.933195, 'Ni': 58.6934, 'Cu': 63.546, 'Zn': 65.38, 'Ga': 69.723, 'Ge': 72.64, 'As': 74.9216, 'Se': 78.96, 'Br': 79.904, 'Kr': 83.798, 'Rb': 85.4678, 'Sr': 87.62, 'Y': 88.90585, 'Zr': 91.224, 'Nb': 92.90638, 'Mo': 95.96, 'Tc': 98, 'Ru': 101.07, 'Rh': 102.9055, 'Pd': 106.42, 'Ag': 107.8682, 'Cd': 112.411, 'In': 114.818, 'Sn': 118.71, 'Sb': 121.76, 'Te': 127.6, 'I': 126.90447, 'Xe': 131.293, 'Cs': 132.9054519, 'Ba': 137.327, 'La': 138.90547, 'Ce': 140.116, 'Pr': 140.90765, 'Nd': 144.242, 'Pm': 145, 'Sm': 150.36, 'Eu': 151.964, 'Gd': 157.25, 'Tb': 158.92535, 'Dy': 162.5, 'Ho': 164.93032, 'Er': 167.259, 'Tm': 168.93421, 'Yb': 173.054, 'Lu': 174.9668, 'Hf': 178.49, 'Ta': 180.94788, 'W': 183.84, 'Re': 186.207, 'Os': 190.23, 'Ir': 192.217, 'Pt': 195.084, 'Au': 196.966569, 'Hg': 200.59, 'Tl': 204.3833, 'Pb': 207.2, 'Bi': 208.9804, 'Po': 209, 'At': 210, 'Rn': 222, 'Fr': 223, 'Ra': 226, 'Ac': 227, 'Th': 232.03806, 'Pa': 231.03588, 'U': 238.02891, 'Np': 237, 'Pu': 244, 'Am': 243, 'Cm': 247, 'Bk': 247, 'Cf': 251, 'Es': 252, 'Fm': 257, 'Md': 258, 'No': 259, 'Lr': 262, 'Rf': 265, 'Db': 268, 'Sg': 271, 'Bh': 272, 'Hs': 270, 'Mt': 276, 'Ds': 281, 'Rg': 280, 'Cn': 285, 'Uut': 284, 'Uuq': 289, 'Uup': 288, 'Uuh': 293, 'Uuo': 294} |
#
# pkpgcounter : a generic Page Description Language parser
#
# (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# $Id: version.py 376 2007-12-09 20:32:26Z jerome $
#
"""This modules defines some important constants used in this software."""
__version__ = "3.50"
__doc__ = """pkpgcounter : a generic Page Description Languages parser."""
__author__ = "Jerome Alet"
__authoremail__ = "alet@librelogiciel.com"
__years__ = "2003, 2004, 2005, 2006, 2007"
__gplblurb__ = """This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>."""
| """This modules defines some important constants used in this software."""
__version__ = '3.50'
__doc__ = 'pkpgcounter : a generic Page Description Languages parser.'
__author__ = 'Jerome Alet'
__authoremail__ = 'alet@librelogiciel.com'
__years__ = '2003, 2004, 2005, 2006, 2007'
__gplblurb__ = 'This program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <http://www.gnu.org/licenses/>.' |
"""
Entradas ---
Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7
Numeros --> int --> A
"""
# Caja negra
A = 1
for i in range(50):
if (A%7) != 0:
print(A) # Salida
A += 2
else:
A += 2 | """
Entradas ---
Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7
Numeros --> int --> A
"""
a = 1
for i in range(50):
if A % 7 != 0:
print(A)
a += 2
else:
a += 2 |
def func():
print('func')
def func2():
print('func2')
def func3():
print('func3')
__all__ = ['func2', 'func3'] | def func():
print('func')
def func2():
print('func2')
def func3():
print('func3')
__all__ = ['func2', 'func3'] |
class BaseArray(Element, IDisposable):
""" An abstract base class that represents an array within the Revit project. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self, *args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def GetCopiedMemberIds(self):
"""
GetCopiedMemberIds(self: BaseArray) -> ICollection[ElementId]
Retrieves the copied member Ids of the Array.
Returns: The copied member Ids of the Array
"""
pass
def GetOriginalMemberIds(self):
"""
GetOriginalMemberIds(self: BaseArray) -> ICollection[ElementId]
Retrieves the original member Ids of the Array.
Returns: The original member Ids of the Array
"""
pass
def ReleaseUnmanagedResources(self, *args):
""" ReleaseUnmanagedResources(self: Element,disposing: bool) """
pass
def setElementType(self, *args):
""" setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
Label = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""The family parameter label of the BaseArray.
Get: Label(self: BaseArray) -> FamilyParameter
Set: Label(self: BaseArray)=value
"""
Name = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get and Set the Name property
Set: Name(self: BaseArray)=value
"""
NumMembers = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Retrieves or changes the number of the arrayed members.
Get: NumMembers(self: BaseArray) -> int
Set: NumMembers(self: BaseArray)=value
"""
| class Basearray(Element, IDisposable):
""" An abstract base class that represents an array within the Revit project. """
def dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def get_bounding_box(self, *args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def get_copied_member_ids(self):
"""
GetCopiedMemberIds(self: BaseArray) -> ICollection[ElementId]
Retrieves the copied member Ids of the Array.
Returns: The copied member Ids of the Array
"""
pass
def get_original_member_ids(self):
"""
GetOriginalMemberIds(self: BaseArray) -> ICollection[ElementId]
Retrieves the original member Ids of the Array.
Returns: The original member Ids of the Array
"""
pass
def release_unmanaged_resources(self, *args):
""" ReleaseUnmanagedResources(self: Element,disposing: bool) """
pass
def set_element_type(self, *args):
""" setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
label = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The family parameter label of the BaseArray.\n\n\n\nGet: Label(self: BaseArray) -> FamilyParameter\n\n\n\nSet: Label(self: BaseArray)=value\n\n'
name = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get and Set the Name property\n\n\n\nSet: Name(self: BaseArray)=value\n\n'
num_members = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Retrieves or changes the number of the arrayed members.\n\n\n\nGet: NumMembers(self: BaseArray) -> int\n\n\n\nSet: NumMembers(self: BaseArray)=value\n\n' |
"""
Q701
Insert into a Binary Search Tree
Medium
Given the root node of a binary search tree (BST) and a value
to be inserted into the tree, insert the value into the BST.
Return the root node of the BST after the insertion. It is
guaranteed that the new value does not exist in the original
BST.
Note that there may exist multiple valid ways for the insertion,
as long as the tree remains a BST after insertion. You can
return any of them.
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode:
def insert_(root, val):
if root.left is None and root.right is None:
if root.val > val:
root.left = TreeNode(val)
else:
root.right = TreeNode(val)
return None
if root.val > val:
if root.left is not None:
insert_(root.left, val)
else:
root.left = TreeNode(val)
else:
if root.right is not None:
insert_(root.right, val)
else:
root.right = TreeNode(val)
return None
insert_(root, val)
return root
a1 = TreeNode(1)
a2 = TreeNode(2)
a3 = TreeNode(3)
a2.left = a1
a2.right = a3
sol = Solution()
def preorder(tree):
if tree is not None:
print(tree.val)
preorder(tree.left)
preorder(tree.right)
sol.insertIntoBST(a2, 4)
preorder(a2)
| """
Q701
Insert into a Binary Search Tree
Medium
Given the root node of a binary search tree (BST) and a value
to be inserted into the tree, insert the value into the BST.
Return the root node of the BST after the insertion. It is
guaranteed that the new value does not exist in the original
BST.
Note that there may exist multiple valid ways for the insertion,
as long as the tree remains a BST after insertion. You can
return any of them.
"""
class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def insert_into_bst(self, root: TreeNode, val: int) -> TreeNode:
def insert_(root, val):
if root.left is None and root.right is None:
if root.val > val:
root.left = tree_node(val)
else:
root.right = tree_node(val)
return None
if root.val > val:
if root.left is not None:
insert_(root.left, val)
else:
root.left = tree_node(val)
elif root.right is not None:
insert_(root.right, val)
else:
root.right = tree_node(val)
return None
insert_(root, val)
return root
a1 = tree_node(1)
a2 = tree_node(2)
a3 = tree_node(3)
a2.left = a1
a2.right = a3
sol = solution()
def preorder(tree):
if tree is not None:
print(tree.val)
preorder(tree.left)
preorder(tree.right)
sol.insertIntoBST(a2, 4)
preorder(a2) |
__all__ = ('func', 'C')
def func():
pass
class C:
pass | __all__ = ('func', 'C')
def func():
pass
class C:
pass |
DBPEDIA_URI = "http://dbpedia.org/sparql"
# dsbox02.isi.edu
# ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search"
# SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql"
# IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties"
# DataMachines Nov 2019
ELASTICSEARCH_URI = "http://10.108.20.4:9200/my_wiki_content_first/_search"
SPARQL_URI = "http://10.108.20.4:9966/bigdata/namespace/wdq/sparql"
IDENTIFIER_WIKIFIER = "http://10.108.20.4:9000/get_properties"
# old
# sparql = SPARQLWrapper("http://sitaware.isi.edu:8080/bigdata/namespace/wdq/sparql")
# sparql = SPARQLWrapper("https://query.wikidata.org/sparql")
# sparqldb = SPARQLWrapper("http://dbpedia.org/sparql")
| dbpedia_uri = 'http://dbpedia.org/sparql'
elasticsearch_uri = 'http://10.108.20.4:9200/my_wiki_content_first/_search'
sparql_uri = 'http://10.108.20.4:9966/bigdata/namespace/wdq/sparql'
identifier_wikifier = 'http://10.108.20.4:9000/get_properties' |
"""
Python Fundamentals 2
@author: Balint Szoke
@date: 2/11/2017
"""
"""---------------------------------------------------
REVIEW
---------------------------------------------------"""
# Assignment
x = 3.14
# Strings
s = 'this is a string'
type(s)
len(s)
# Lists
l = [1, 'help', 12.14]
print('This is a', type(l), 'containing', len(l), 'items')
#change types with str(), int(), float()
#Methods
's is {t} with {c} chars'.format(t=type(s), c=len(s))
l.append(x)
print(l)
# Tab completion!
#%%
"""---------------------------------------------------
OTHER NATIVE PYTHON DATA TYPES
---------------------------------------------------"""
#====================
# Dictionary
#====================
dict1 = {'first': 12, 'second': 20, 3: 'first'}
print(dict1)
type(dict1)
# Unordered, access values through keys
dict1['first']
dict1[3]
# dict1[0] # indexing doesn't work
#Key must be unique (only keeps last one)
dict2 = {'first': 12, 'first': [4, 1]}
print(dict2)
# Key must be inmutable! What's the problem?
#dict3 = {[1, 2]: 4}
# Methods
dict1.keys()
dict1.values()
list(dict1)
list(dict1.values())
#==========================
# Boolean (comparisons)
#==========================
# Yes/no questions
4 < 5 # interpreted as: is 5 greater than 4?
x > 5 # can involve variables
type(x > 5)
z = x > 5 # True/False value can be assigned
# Basic comparison operators
x == 3 # equal to?
5 >= 5 # greater than or equal to?
x != 3 # not equal to?
# True == 1, False == 0
int(z)
# can reverse comparisons with "not"
not 3 > 5
# Use it the usual way
x, y = 4*2, 2**3
"x={x}, y={y}, so x>y is {s}".format(x=x, y=y, s=x>y)
type('Sarah') == str # can involve "type checking"
len('Sarah') >= 3
# Tricky one
name1 = 'Chase'
name2 = 'Spencer'
name1 > name2
name1 < name2
# what's going on? try
'a' < 'b'
# Handy alternatives: "is" and "is not"
x is y # "equal to"?
x is not y
# Clear syntax
1 in [1, 4, 5]
3 not in [1, 4, 5]
# Standard Boolean logic to combine comparisons
print(True and True,
True and False,
False and False)
print(True or True,
True or False,
False or False)
#%%
"""---------------------------------------------------
SLICING : access a range of items from a container
---------------------------------------------------"""
x = [4, 1, 5, 2, 10, 23]
x[3] # indexing
x[:3] # everything to the left (3 NOT included)
x[3:] # everything to the right (3 included)
x[1:4]
"""
Rule:
x[n_start:n_end] gives
[x[n_start], x[n_start + 1], ..., x[n_end-1]]
"""
# Counting backward
x[-1] # last element
x[-2] # second to last
x[2:-2] # combined
# not only lists
name = 'python'
# how to get 'py' from name?
name[:2]
#%%
"""===================================================
FLOW CONTROL
control which commands are executed and the
order in which they are processed
==================================================="""
"""---------------------------------------------------
(1) CONDITIONALS (if and else)
tell Python to do things depending on the
value of a Boolean
---------------------------------------------------"""
this = True
if this is True: # don't forget the colon
print("hello") # don't forget the indentation
that = False
#that = 5 # careful with negation!
if that is not True:
print("bye")
# Indentation inticates an "inner code"
x = 2
if x > 0:
x = x + 1
x = x * 5
print(x)
"""
Structure matters! different branches
"""
x = 2
if x > 0:
# first branch starts here
print(x)
x = x + 1
print(x)
if x < 5:
# conditional second branch starts here
print(x)
x = x * 5
x = x**3
# second branch ends here
print(x) # back to the first branch
# ELSE - what to do if the condition is false
if this is True:
print('this is true')
else:
print('this is false')
# ELIF - add more branches to the decision tree
if x < 2:
print("x < 2")
elif x == 2:
print("x == 2")
else:
print("x > 2")
'''---------------------------------------------------
(2) Loops (over containers):
do the same thing many times
---------------------------------------------------'''
# Print out list of names one at a time
namelist = ['Chase', 'Anne', 'Josh', 'Alberto']
for i in namelist:
print(i)
"""
Iterables:
def: An object capable of returning its members
one at a time.
e.g.: list, str, tuple, dict
"""
for i in "hello":
print(i)
'''
i is just a dummy! It can be anything, but be careful
with using already defined var names
'''
x = 5
print('before the loop x is', x)
for x in '01234':
print('in the loop, x is', int(x))
print('after the loop x is', x)
# Compute the sum of the elements of a list of nums
numlist = [-2, 3.1, 10, 23]
summ = 0
for i in numlist:
summ = summ + i
print(summ)
#=================================================
# Loops over counters
# loop over something a fixed number of times
#=================================================
how_many = 10
for i in range(how_many):
print("boring")
# or we can use the elements of range()
# range(n) gives all integers from 0 to n-1
for i in range(5):
print(i)
# different starting point
for i in range(2, 8):
print(i)
# print the squares of integers up to 10
for number in range(10):
square = number**2
print('Number and its square:', number, square)
# combine loop with conditional
for num in range(10):
if num > 5:
print(num)
# we might want to break the loop if something happens
maxnum = 20
total = 0
for num in range(maxnum):
total = total + num
if total > 100:
break # exit loop
print('At num =', num, 'we had total =', total)
#==========================================
# List comprehensions =
# create list using implicit loops
#==========================================
# Compare
for item in namelist:
print(item.upper())
#with
[item2.upper() for item2 in namelist]
# list comprehension with condition
fruits = ['apple', 'banana', 'orange']
fruits6 = [i for i in fruits if len(i)>=6]
print(fruits6)
#%%
'''==================================================
DEFINING OUR OWN FUNCTIONS
=================================================='''
#--------------------------
# Function with no output
#--------------------------
def hello(firstname):
print("Hello,", firstname)
hello('Balint')
def silly():
print("the same")
#--------------------------------------------------------
# Function creates a new value that Python can work with
# RETURN - sends output back to the main program
#--------------------------------------------------------
def square_me(number):
"""
Takes numerical input and returns its square
"""
square = number**2
return square
#Test
square_me(7)
def nextyear(string_year):
"""
Takes a string year and returns a string of next year
"""
int_year = int(string_year)
next_year = int_year + 1
return str(next_year)
nextyear('2016')
# use it just like the built-in functions
for i in range(2010, 2016):
year = str(i)
next_year = nextyear(year)
print('year is', year, 'Next year is', next_year)
| """
Python Fundamentals 2
@author: Balint Szoke
@date: 2/11/2017
"""
'---------------------------------------------------\nREVIEW\n---------------------------------------------------'
x = 3.14
s = 'this is a string'
type(s)
len(s)
l = [1, 'help', 12.14]
print('This is a', type(l), 'containing', len(l), 'items')
's is {t} with {c} chars'.format(t=type(s), c=len(s))
l.append(x)
print(l)
'---------------------------------------------------\nOTHER NATIVE PYTHON DATA TYPES\n---------------------------------------------------'
dict1 = {'first': 12, 'second': 20, 3: 'first'}
print(dict1)
type(dict1)
dict1['first']
dict1[3]
dict2 = {'first': 12, 'first': [4, 1]}
print(dict2)
dict1.keys()
dict1.values()
list(dict1)
list(dict1.values())
4 < 5
x > 5
type(x > 5)
z = x > 5
x == 3
5 >= 5
x != 3
int(z)
not 3 > 5
(x, y) = (4 * 2, 2 ** 3)
'x={x}, y={y}, so x>y is {s}'.format(x=x, y=y, s=x > y)
type('Sarah') == str
len('Sarah') >= 3
name1 = 'Chase'
name2 = 'Spencer'
name1 > name2
name1 < name2
'a' < 'b'
x is y
x is not y
1 in [1, 4, 5]
3 not in [1, 4, 5]
print(True and True, True and False, False and False)
print(True or True, True or False, False or False)
'---------------------------------------------------\nSLICING : access a range of items from a container\n---------------------------------------------------'
x = [4, 1, 5, 2, 10, 23]
x[3]
x[:3]
x[3:]
x[1:4]
'\nRule:\n\nx[n_start:n_end] gives \n [x[n_start], x[n_start + 1], ..., x[n_end-1]]\n'
x[-1]
x[-2]
x[2:-2]
name = 'python'
name[:2]
'===================================================\nFLOW CONTROL\n control which commands are executed and the\n order in which they are processed\n==================================================='
'---------------------------------------------------\n(1) CONDITIONALS (if and else)\n tell Python to do things depending on the \n value of a Boolean\n---------------------------------------------------'
this = True
if this is True:
print('hello')
that = False
if that is not True:
print('bye')
x = 2
if x > 0:
x = x + 1
x = x * 5
print(x)
'\nStructure matters! different branches\n'
x = 2
if x > 0:
print(x)
x = x + 1
print(x)
if x < 5:
print(x)
x = x * 5
x = x ** 3
print(x)
if this is True:
print('this is true')
else:
print('this is false')
if x < 2:
print('x < 2')
elif x == 2:
print('x == 2')
else:
print('x > 2')
'---------------------------------------------------\n(2) Loops (over containers):\n do the same thing many times\n---------------------------------------------------'
namelist = ['Chase', 'Anne', 'Josh', 'Alberto']
for i in namelist:
print(i)
'\nIterables: \n def: An object capable of returning its members \n one at a time.\n e.g.: list, str, tuple, dict\n'
for i in 'hello':
print(i)
'\ni is just a dummy! It can be anything, but be careful\nwith using already defined var names\n'
x = 5
print('before the loop x is', x)
for x in '01234':
print('in the loop, x is', int(x))
print('after the loop x is', x)
numlist = [-2, 3.1, 10, 23]
summ = 0
for i in numlist:
summ = summ + i
print(summ)
how_many = 10
for i in range(how_many):
print('boring')
for i in range(5):
print(i)
for i in range(2, 8):
print(i)
for number in range(10):
square = number ** 2
print('Number and its square:', number, square)
for num in range(10):
if num > 5:
print(num)
maxnum = 20
total = 0
for num in range(maxnum):
total = total + num
if total > 100:
break
print('At num =', num, 'we had total =', total)
for item in namelist:
print(item.upper())
[item2.upper() for item2 in namelist]
fruits = ['apple', 'banana', 'orange']
fruits6 = [i for i in fruits if len(i) >= 6]
print(fruits6)
'==================================================\nDEFINING OUR OWN FUNCTIONS\n=================================================='
def hello(firstname):
print('Hello,', firstname)
hello('Balint')
def silly():
print('the same')
def square_me(number):
"""
Takes numerical input and returns its square
"""
square = number ** 2
return square
square_me(7)
def nextyear(string_year):
"""
Takes a string year and returns a string of next year
"""
int_year = int(string_year)
next_year = int_year + 1
return str(next_year)
nextyear('2016')
for i in range(2010, 2016):
year = str(i)
next_year = nextyear(year)
print('year is', year, 'Next year is', next_year) |
class Config(object):
c_dim = 5
c2_dim = 8
celeba_crop_size = 178
rafd_crop_size = 256
image_size = 128
g_conv_dim = 64
d_conv_dim = 64
g_repeat_num = 6
d_repeat_num = 6
lambda_cls = 1
lambda_rec = 10
lambda_gp = 10
dataset = 'CelebA'
batch_size = 16
num_iters = 200000
num_iters_decay = 100000
g_lr = 0.0001
d_lr = 0.0001
n_critic = 5
beta1 = 0.5
beta2 = 0.999
resume_iters = None
selected_attrs = ['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young']
# Test configuration.
test_iters = 200000
# Miscellaneous.
num_workers = 1
mode = 'train'
use_tensorboard = True
# Directories.
celeba_image_dir = 'data/CelebA_nocrop/images'
attr_path = 'data/list_attr_celeba.txt'
rafd_image_di = 'data/RaFD/train'
log_dir = 'stargan/logs'
model_save_dir = 'stargan/models'
sample_dir = 'stargan/samples'
result_dir = 'stargan/results'
# Step size.
log_step = 10
sample_step = 1000
model_save_step = 10000
lr_update_step = 1000
config = Config() | class Config(object):
c_dim = 5
c2_dim = 8
celeba_crop_size = 178
rafd_crop_size = 256
image_size = 128
g_conv_dim = 64
d_conv_dim = 64
g_repeat_num = 6
d_repeat_num = 6
lambda_cls = 1
lambda_rec = 10
lambda_gp = 10
dataset = 'CelebA'
batch_size = 16
num_iters = 200000
num_iters_decay = 100000
g_lr = 0.0001
d_lr = 0.0001
n_critic = 5
beta1 = 0.5
beta2 = 0.999
resume_iters = None
selected_attrs = ['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young']
test_iters = 200000
num_workers = 1
mode = 'train'
use_tensorboard = True
celeba_image_dir = 'data/CelebA_nocrop/images'
attr_path = 'data/list_attr_celeba.txt'
rafd_image_di = 'data/RaFD/train'
log_dir = 'stargan/logs'
model_save_dir = 'stargan/models'
sample_dir = 'stargan/samples'
result_dir = 'stargan/results'
log_step = 10
sample_step = 1000
model_save_step = 10000
lr_update_step = 1000
config = config() |
"""
This package contains exceptions that may be raised by the CHARMM components of
the OpenMM Application layer
This file is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of Biological
Structures at Stanford, funded under the NIH Roadmap for Medical Research,
grant U54 GM072970. See https://simtk.org. This code was originally part of
the ParmEd program and was ported for use with OpenMM.
Copyright (c) 2014 the Authors
Author: Jason M. Swails
Contributors:
Date: April 18, 2014
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
class CharmmError(Exception):
""" Base class for all exceptions raised in this package """
class CharmmWarning(Warning):
""" Base class for all warnings emitted in this package """
class CharmmPSFError(CharmmError):
""" If there is a problem parsing CHARMM PSF files """
class CharmmPsfEOF(CharmmError):
""" Raised when the end-of-file is reached on a CHARMM PSF file """
class SplitResidueWarning(CharmmWarning):
""" For if a residue with the same number but different names is split """
class ResidueError(CharmmError):
""" For when there are problems defining a residue """
class CharmmPSFWarning(CharmmWarning):
""" For non-fatal PSF parsing issues """
class CharmmFileError(CharmmError):
""" If there is a problem parsing CHARMM files """
class MissingParameter(CharmmError):
""" If a parameter is missing from a database """
class CmapError(CharmmError):
""" For an error arising from CMAP grid incompatibilities """
class BondError(CharmmError):
""" Prevent an atom from bonding to itself """
class MoleculeError(CharmmError):
""" For (impossibly) messed up connectivity """
| """
This package contains exceptions that may be raised by the CHARMM components of
the OpenMM Application layer
This file is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of Biological
Structures at Stanford, funded under the NIH Roadmap for Medical Research,
grant U54 GM072970. See https://simtk.org. This code was originally part of
the ParmEd program and was ported for use with OpenMM.
Copyright (c) 2014 the Authors
Author: Jason M. Swails
Contributors:
Date: April 18, 2014
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
class Charmmerror(Exception):
""" Base class for all exceptions raised in this package """
class Charmmwarning(Warning):
""" Base class for all warnings emitted in this package """
class Charmmpsferror(CharmmError):
""" If there is a problem parsing CHARMM PSF files """
class Charmmpsfeof(CharmmError):
""" Raised when the end-of-file is reached on a CHARMM PSF file """
class Splitresiduewarning(CharmmWarning):
""" For if a residue with the same number but different names is split """
class Residueerror(CharmmError):
""" For when there are problems defining a residue """
class Charmmpsfwarning(CharmmWarning):
""" For non-fatal PSF parsing issues """
class Charmmfileerror(CharmmError):
""" If there is a problem parsing CHARMM files """
class Missingparameter(CharmmError):
""" If a parameter is missing from a database """
class Cmaperror(CharmmError):
""" For an error arising from CMAP grid incompatibilities """
class Bonderror(CharmmError):
""" Prevent an atom from bonding to itself """
class Moleculeerror(CharmmError):
""" For (impossibly) messed up connectivity """ |
li = input().split()
dicti={}
for i in li:
if i not in dicti:
dicti[i]=1
else:
print(i) | li = input().split()
dicti = {}
for i in li:
if i not in dicti:
dicti[i] = 1
else:
print(i) |
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable
print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234
print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four
print(formatter.format(True, False, False, True)) #this fills the slots with true false false true
print(formatter.format(formatter, formatter, formatter, formatter)) #this calls the variable 4 times but does not fill, so 16 {} show up
print(formatter.format(
"Try your",
"Own text here",
"Maybe a poem",
"Or a song about fear"
)) #this calls up four different strings to fill the slots in the variable
| formatter = '{} {} {} {}'
print(formatter.format(1, 2, 3, 4))
print(formatter.format('one', 'two', 'three', 'four'))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format('Try your', 'Own text here', 'Maybe a poem', 'Or a song about fear')) |
class LavadoraFacade(object):
def lavar(self):
self._lavar = Lavar()
self._lavar.subsistema_operation()
def enjuagar(self):
self._enjuagar = Enjuagar()
self._enjuagar.subsistema_operation()
def centrifugado(self):
self._centrifugado = Centrifugado()
self._centrifugado.subsistema_operation()
def ciclo_completo(self):
self._ciclo_completo = Completo()
self._ciclo_completo.subsistema_operation()
class Lavar(object):
def subsistema_operation(self):
print("Lavando...\nFinalizado!")
class Enjuagar(object):
def subsistema_operation(self):
print("Enjuagando...\nFinalizado!")
class Centrifugado(object):
def subsistema_operation(self):
print("Centrifugando...\nFinalizado!")
class Completo(object):
def subsistema_operation(self):
print ("Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!")
if __name__ == "__main__":
print(LavadoraFacade().ciclo_completo())
| class Lavadorafacade(object):
def lavar(self):
self._lavar = lavar()
self._lavar.subsistema_operation()
def enjuagar(self):
self._enjuagar = enjuagar()
self._enjuagar.subsistema_operation()
def centrifugado(self):
self._centrifugado = centrifugado()
self._centrifugado.subsistema_operation()
def ciclo_completo(self):
self._ciclo_completo = completo()
self._ciclo_completo.subsistema_operation()
class Lavar(object):
def subsistema_operation(self):
print('Lavando...\nFinalizado!')
class Enjuagar(object):
def subsistema_operation(self):
print('Enjuagando...\nFinalizado!')
class Centrifugado(object):
def subsistema_operation(self):
print('Centrifugando...\nFinalizado!')
class Completo(object):
def subsistema_operation(self):
print('Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!')
if __name__ == '__main__':
print(lavadora_facade().ciclo_completo()) |
#Given an array of integers, find and print the maximum number of integers you
#can select from the array such that the absolute difference between any two of
#the chosen integers is less than or equal to . For example, if your array is ,
#you can create two subarrays meeting the criterion: and . The maximum length
#subarray has elements.
list = input().split()
list = [int(i) for i in list]
list.sort()
print(list)
def pickingNumbers(list):
# Write your code here
maximum = []
maxim = 0
while len(list) > 1:
if len(list) != 0:
A = max(list)
count_max = list.count(A)
for j in range(count_max):
list.remove(max(list))
maxim += count_max
if len(list) == 0 and len(maximum) == 0:
return count_max
if len(list) != 0:
B = max(list)
count_max = list.count(B)
maxim += count_max
check = abs(A - B)
if check <= 1:
maximum.append(maxim)
maxim = 0
return max(maximum)
print(pickingNumbers(list)) | list = input().split()
list = [int(i) for i in list]
list.sort()
print(list)
def picking_numbers(list):
maximum = []
maxim = 0
while len(list) > 1:
if len(list) != 0:
a = max(list)
count_max = list.count(A)
for j in range(count_max):
list.remove(max(list))
maxim += count_max
if len(list) == 0 and len(maximum) == 0:
return count_max
if len(list) != 0:
b = max(list)
count_max = list.count(B)
maxim += count_max
check = abs(A - B)
if check <= 1:
maximum.append(maxim)
maxim = 0
return max(maximum)
print(picking_numbers(list)) |
# Python lists can be used as Arrays in Python
# Creating an array
things = ['pen', 'car', 'books']
print(things)
# accessing the array element
print(things[0]) # prints the first element of the array things
# modifying the value of the array element
things[1] = 'pencil' # second element of things, gets changed to pencil
print(things[1])
# length/size of the array
length = len(things)
print(length) # length variable holds the size of the array which is in this case, 3
# looping through the array/lists
for a in things: # iterating over each element of the array
print(a)
for i in range(len(things)): # iterating the variable i upto the length of array
print(things[i]) # and then accessing the array element present at index i
| things = ['pen', 'car', 'books']
print(things)
print(things[0])
things[1] = 'pencil'
print(things[1])
length = len(things)
print(length)
for a in things:
print(a)
for i in range(len(things)):
print(things[i]) |
def isDivisibleBy(int, divisor):
return int % divisor == 0;
def doFizzBuzz():
for i in range(1, 101):
isDivisibleByThree = isDivisibleBy(i, 3)
isDivisibleByFive = isDivisibleBy(i, 5)
if (isDivisibleByThree and isDivisibleByFive):
print('fizzbuzz')
elif isDivisibleByThree:
print('fizz')
elif isDivisibleByFive:
print('buzz')
else:
print(i)
doFizzBuzz()
| def is_divisible_by(int, divisor):
return int % divisor == 0
def do_fizz_buzz():
for i in range(1, 101):
is_divisible_by_three = is_divisible_by(i, 3)
is_divisible_by_five = is_divisible_by(i, 5)
if isDivisibleByThree and isDivisibleByFive:
print('fizzbuzz')
elif isDivisibleByThree:
print('fizz')
elif isDivisibleByFive:
print('buzz')
else:
print(i)
do_fizz_buzz() |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 21 15:38:43 2019
@author: Mijael
"""
vnclass_dict = {
'stop-55.4': ['causer', 'theme', 'location'],
'masquerade-29.6': ['agent', 'attribute', 'location'],
'masquerade-29.6-1': ['agent', 'attribute', 'location'],
'masquerade-29.6-2': ['agent', 'attribute', 'location'],
'captain-29.8': ['agent', 'beneficiary', 'location'],
'captain-29.8-1': ['agent', 'beneficiary', 'location'],
'captain-29.8-1-1': ['agent', 'beneficiary', 'location'],
'preparing-26.3': ['agent', 'product', 'material', 'beneficiary', 'location'],
'defend-72.3': ['agent', 'beneficiary', 'theme', 'location'],
'help-72.1': ['agent', 'beneficiary', 'theme', 'location'],
'help-72.1-1': ['agent', 'beneficiary', 'theme', 'location'],
'help-72.1-1-1': ['agent', 'beneficiary', 'theme', 'location'],
'help-72.1-2': ['agent', 'beneficiary', 'theme', 'location'],
'interact-36.6': ['agent', 'co_agent', 'location'],
'marry-36.2': ['agent', 'co_agent', 'location'],
'meet-36.3': ['agent', 'co_agent', 'location'],
'meet-36.3-1': ['agent', 'co_agent', 'location'],
'meet-36.3-2': ['agent', 'co_agent', 'location'],
'subordinate-95.2.1': ['agent', 'co_agent', 'location'],
'supervision-95.2.2': ['agent', 'co_agent', 'location'],
'cooperate-73.1': ['agent', 'co_agent', 'theme', 'location'],
'cooperate-73.1-1': ['agent', 'co_agent', 'theme', 'location'],
'cooperate-73.1-2': ['agent', 'co_agent', 'theme', 'location'],
'cooperate-73.1-3': ['agent', 'co_agent', 'theme', 'location'],
'correspond-36.1.1': ['agent', 'co_agent', 'topic', 'location'],
'correspond-36.1.1-1': ['agent', 'co_agent', 'topic', 'location'],
'correspond-36.1.1-1-1': ['agent', 'co_agent', 'topic', 'location'],
'conspire-71': ['agent', 'co_agent', ['theme', 'beneficiary'], 'location'],
'battle-36.4': ['agent', 'co_agent', ['theme', 'topic'], ['location']],
'battle-36.4-1': ['agent', 'co_agent', ['theme', 'topic'], ['location']],
'settle-36.1.2': ['agent', 'co_agent', ['topic', 'goal'], 'location'],
'settle-36.1.2-1': ['agent', 'co_agent', ['topic', 'goal'], 'location'],
'butter-9.9': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'],
'fill-9.8': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'],
'fill-9.8-1': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'],
'spend_time-104': ['agent', 'duration', 'attribute', 'location'],
'touch-20': ['agent', 'theme', 'experiencer', 'instrument', 'location'],
'touch-20-1': ['agent', 'theme', 'experiencer', 'instrument', 'location'],
'assuming_position-50': ['agent', 'location'],
'gobble-39.3': ['agent', 'patient', 'location'],
'hiccup-40.1.1': ['agent', 'location'],
'snooze-40.4': ['agent', 'location'],
'concealment-16': ['agent', 'patient', 'beneficiary', 'location'],
'concealment-16-1': ['agent', 'patient', 'beneficiary', 'location'],
#'tape-22.4-1': ['agent', 'patient', 'co_patient', 'instrument', 'location'],
'hit-18.1': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'],
'tape-22.4': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'],
'amalgamate-22.2': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-1': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-1-1': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-2': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-2-1': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-3': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-3-1': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-3-1-1': ['agent', 'patient', 'co_patient', 'location'],
'amalgamate-22.2-3-2': ['agent', 'patient', 'co_patient', 'location'],
'disassemble-23.3': ['agent', 'patient', 'co_patient', 'location'],
'mix-22.1': ['agent', 'patient', 'co_patient', 'location'],
'mix-22.1-1': ['agent', 'patient', 'co_patient', 'location'],
'mix-22.1-1-1': ['agent', 'patient', 'co_patient', 'location'],
'mix-22.1-2': ['agent', 'patient', 'co_patient', 'location'],
'mix-22.1-2-1': ['agent', 'patient', 'co_patient', 'location'],
'separate-23.1': ['agent', 'patient', 'co_patient', 'location'],
'separate-23.1-1': ['agent', 'patient', 'co_patient', 'location'],
'separate-23.1-2': ['agent', 'patient', 'co_patient', 'location'],
'shake-22.3': ['agent', 'patient', 'co_patient', 'location'],
'shake-22.3-1': ['agent', 'patient', 'co_patient', 'location'],
'shake-22.3-1-1': ['agent', 'patient', 'co_patient', 'location'],
'shake-22.3-2': ['agent', 'patient', 'co_patient', 'location'],
'shake-22.3-2-1': ['agent', 'patient', 'co_patient', 'location'],
'split-23.2': ['agent', 'patient', 'co_patient', 'location'],
'adjust-26.9': ['agent', 'patient', 'goal', 'source', 'location'],
'swat-18.2': ['agent', 'patient', 'instrument', 'result', 'location'],
'bend-45.2': ['agent', 'patient', 'instrument', 'location'],
'carve-21.2': ['agent', 'patient', 'instrument', 'location'],
'carve-21.2-1': ['agent', 'patient', 'instrument', 'location'],
'carve-21.2-2': ['agent', 'patient', 'instrument', 'location'],
'cooking-45.3': ['agent', 'patient', 'instrument', 'location'],
'cut-21.1-1': [['agent', 'causer'], 'patient', 'experiencer', 'instrument', 'movement', 'location'],
'destroy-44': ['agent', 'patient', 'instrument', 'location'],
'floss-41.2.1': ['agent', 'patient', 'instrument', 'final_state', 'location'],
'hit-18.1-1': ['agent', 'patient', 'instrument', 'location'],
'murder-42.1': ['agent', 'patient', 'instrument', 'location'],
'murder-42.1-1': ['agent', 'patient', 'instrument', 'location'],
'other_cos-45.4': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'],
'remedy-45.7': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'],
'remedy-45.7-1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'],
'subjugate-42.3': ['agent', 'patient', 'instrument', 'location'],
'break-45.1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'],
'poison-42.2': ['agent', 'patient', 'instrument', 'result', 'location'],
'spank-18.3': ['agent', 'patient', 'instrument', 'result', 'location'],
'cut-21.1': ['agent', 'patient', 'instrument', 'source', ['goal', 'result'], 'movement', 'location'],
'attack-60.1': ['agent', 'patient', 'location'],
'attack-60.1-1': ['agent', 'patient', 'location'],
'birth-28.2': ['agent', 'patient', 'location'],
'birth-28.2-1': ['agent', 'patient', 'location'],
'body_internal_motion-49.1': ['agent', 'patient', 'location'],
'braid-41.2.2': ['agent', 'patient', 'final_state', 'location'],
'calve-28.1': ['agent', 'patient', 'location'],
'chew-39.2': ['agent', 'patient', 'location'],
'chew-39.2-1': ['agent', 'patient', 'location'],
'chew-39.2-2': ['agent', 'patient', 'location'],
'dine-39.5': ['agent', 'patient', 'location'],
'dress-41.1.1': ['agent', 'patient', 'location'],
'dressing_well-41.3.2': [['agent', 'patient'], 'location'],
'eat-39.1-3': ['agent', 'patient', 'location'],
'gobble-39.3-1': ['agent', 'patient', 'location'],
'gobble-39.3-2': ['agent', 'patient', 'location'],
'gorge-39.6': ['agent', 'patient', 'location'],
'groom-41.1.2': ['agent', 'patient', 'location'],
'urge-58.1': ['agent', 'patient', 'result', 'location'],
'void-106': ['agent', 'patient', 'result', 'location'],
'coloring-24': ['agent', 'patient', 'material', 'result', 'location'],
'compel-59.1': ['agent', 'patient', 'predicate', 'location'],
'lure-59.3': ['agent', 'patient', 'predicate', 'location'],
'stimulate-59.4': ['agent', 'patient', 'predicate', 'location'],
'grow-26.2.1': ['agent', 'patient', 'product', 'location'],
'rear-26.2.2': ['agent', 'patient', 'product', 'location'],
'rear-26.2.2-1': ['agent', 'patient', 'product', 'location'],
'turn-26.6.1': ['agent', 'patient', 'result', 'initial_state', 'location'],
'turn-26.6.1-1': ['agent', 'patient', 'result', 'initial_state', 'location'],
'beg-58.2': ['agent', 'patient', 'result', 'location'],
'beg-58.2-1': ['agent', 'patient', 'result', 'location'],
'beg-58.2-1-1': ['agent', 'patient', 'result', 'location'],
'bully-59.5': ['agent', 'patient', 'result', 'location'],
'order-58.3': ['agent', 'patient', 'result', 'location'],
'order-58.3-1': ['agent', 'patient', 'result', 'location'],
'other_cos-45.4-1': ['agent', 'patient', 'result', 'location'],
'suffocate-40.7': ['agent', 'patient', 'result', 'location'],
'render-29.90-1': ['agent', 'patient', 'result', 'source', 'location'],
'render-29.90-2': ['agent', 'patient', 'result', 'source', 'location'],
'devour-39.4': ['agent', 'patient', 'source', 'location'],
'eat-39.1': ['agent', 'patient', 'source', 'location'],
'eat-39.1-1': ['agent', 'patient', 'source', 'location'],
'eat-39.1-2': ['agent', 'patient', 'source', 'location'],
'prosecute-33.2-1': ['agent', 'patient', 'theme', 'attribute', 'location'],
'prosecute-33.2': ['agent', 'patient', 'theme', 'location'],
'trick-59.2': ['agent', 'patient', ['predicate', 'result'], 'location'],
'convert-26.6.2-1-1': ['agent', 'patient', ['result', 'goal'], 'initial_state', 'location'],
'urge-58.1-1': ['agent', 'patient', ['topic', 'result'], 'location'],
'urge-58.1-1-1': ['agent', 'patient', ['topic', 'result'], 'location'],
'act-114': ['agent', 'predicate', 'location'],
'act-114-1': ['agent', 'predicate', 'location'],
'act-114-1-1': ['agent', 'predicate', 'location'],
'preparing-26.3-1': ['agent', 'product', 'material', 'beneficiary', 'location'],
'preparing-26.3-2': ['agent', 'product', 'material', 'beneficiary', 'location'],
'build-26.1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'],
'build-26.1-1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'],
'knead-26.5': ['agent', 'product', 'material', 'location'],
'bill-54.5': ['agent', 'recipient', 'asset', 'location'],
'animal_sounds-38': ['agent', 'recipient', 'theme', 'location'],
'create-26.4-1': ['agent', 'result', 'beneficiary', 'location'],
'create-26.4': ['agent', 'result', 'material', 'beneficiary', 'location'],
'create-26.4-1-1': ['agent', 'result', 'material', 'beneficiary', 'location'],
'resign-10.11': ['agent', 'source', 'goal', 'location'],
'resign-10.11-1': ['agent', 'source', 'goal', 'location'],
'resign-10.11-2': ['agent', 'source', 'goal', 'location'],
'withdraw-82': ['agent', 'source', 'location'],
'withdraw-82-1': ['agent', 'source', 'location'],
'withdraw-82-2': ['agent', 'source', 'location'],
'withdraw-82-3': ['agent', 'source', 'location'],
'substance_emission-43.4-1-1': ['agent', 'source', 'theme', 'location'],
'assessment-34.1': ['agent', 'theme', 'attribute', 'location'],
'characterize-29.2': ['agent', 'theme', 'attribute', 'location'],
'characterize-29.2-1': ['agent', 'theme', 'attribute', 'location'],
'characterize-29.2-1-1': ['agent', 'theme', 'attribute', 'location'],
'characterize-29.2-1-2': ['agent', 'theme', 'attribute', 'location'],
'consider-29.9': ['agent', 'theme', 'attribute', 'location'],
'consider-29.9-1': ['agent', 'theme', 'attribute', 'location'],
'consider-29.9-1-1': ['agent', 'theme', 'attribute', 'location'],
'consider-29.9-1-1-1': ['agent', 'theme', 'attribute', 'location'],
'consider-29.9-2': ['agent', 'theme', 'attribute', 'location'],
'hire-13.5.3': ['agent', 'theme', 'attribute', 'location'],
'judgment-33.1': ['agent', 'theme', 'attribute', 'location'],
'judgment-33.1-1': ['agent', 'theme', 'attribute', 'location'],
'judgment-33.1-1-1': ['agent', 'theme', 'attribute', 'location'],
'pronounce-29.3.1': ['agent', 'theme', 'attribute', 'location'],
'suspect-81': ['agent', 'theme', 'attribute', 'location'],
'sustain-55.6-1': ['agent', 'theme', 'attribute', 'location'],
'volunteer-95.4-1': ['agent', 'theme', 'attribute', 'location'],
'register-54.1-1': ['agent', 'theme', 'attribute', 'value', 'location'],
'allow-64.1': ['agent', 'theme', 'beneficiary', 'location'],
'allow-64.1-1': ['agent', 'theme', 'beneficiary', 'location'],
'conduct-111.1': ['agent', 'theme', 'beneficiary', 'location'],
'forbid-64.4': ['agent', 'theme', 'beneficiary', 'location'],
'forbid-64.4-1': ['agent', 'theme', 'beneficiary', 'location'],
'let-64.2': ['agent', 'theme', 'beneficiary', 'location'],
'performance-26.7': ['agent', 'theme', 'beneficiary', 'location'],
'performance-26.7-1': ['agent', 'theme', 'beneficiary', 'location'],
'employment-95.3': ['agent', 'theme', 'co_agent', 'attribute', 'location'],
'play-114.2': ['agent', 'theme', 'co_agent', 'location'],
'play-114.2-1': ['agent', 'theme', 'co_agent', 'location'],
'work-73.2': ['agent', 'theme', 'co_agent', 'location'],
'correlate-86.1': ['agent', 'theme', 'co_theme', 'location'],
'herd-47.5.2': ['agent', 'theme', 'co_theme', 'location'],
'multiply-108': ['agent', 'theme', 'co_theme', 'location'],
'multiply-108-1': ['agent', 'theme', 'co_theme', 'location'],
'multiply-108-2': ['agent', 'theme', 'co_theme', 'location'],
'multiply-108-3': ['agent', 'theme', 'co_theme', 'location'],
'carry-11.4': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'carry-11.4-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'carry-11.4-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'coil-9.6': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'confine-92': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'confine-92-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'drive-11.5': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'drive-11.5-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'funnel-9.3': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'funnel-9.3-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'funnel-9.3-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'pelt-17.2': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'pocket-9.10': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'pocket-9.10-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'put-9.1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'put-9.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'put-9.1-2': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'put_direction-9.4': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'put_spatial-9.2': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'send-11.1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'send-11.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'slide-11.2-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'spray-9.7': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'spray-9.7-1': ['agent', 'theme', 'destination', 'initial_location', 'location'],
'accompany-51.7': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'],
'nonvehicle-51.4.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'],
'run-51.3.2-2-1': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'],
'slide-11.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'],
'illustrate-25.3': ['agent', 'theme', 'destination', 'location'],
'image_impression-25.1': ['agent', 'theme', 'destination', 'location'],
'scribble-25.2': ['agent', 'theme', 'destination', 'location'],
'scribble-25.2-1': ['agent', 'theme', 'destination', 'location'],
'spray-9.7-1-1': ['agent', 'theme', 'destination', 'location'],
'spray-9.7-2': ['agent', 'theme', 'destination', 'location'],
'transcribe-25.4': ['agent', 'theme', 'destination', 'location'],
'pit-10.7': ['agent', 'theme', 'destination', 'source', 'location'],
'rotate-51.9.1-1': ['agent', 'theme', 'extent', 'initial_location', 'location'],
'classify-29.10': ['agent', 'theme', 'goal', 'location'],
'dedicate-79': ['agent', 'theme', 'goal', 'location'],
'exclude-107.3': ['agent', 'theme', 'goal', 'location'],
'exclude-107.3-1': ['agent', 'theme', 'goal', 'location'],
'involve-107.1': ['agent', 'theme', 'goal', 'location'],
'body_motion-49.2': ['agent', 'theme', 'goal', 'path', 'location'],
'body_motion-49.2-1': ['agent', 'theme', 'goal', 'path', 'location'],
'push-12-1-1': ['agent', 'theme', 'goal', 'source', 'trajectory', 'location'],
'wipe_instr-10.4.2': ['agent', 'theme', 'initial_location', 'destination', 'instrument', 'result', 'location'],
'pour-9.5': ['agent', 'theme', 'initial_location', 'destination', 'location'],
'wipe_instr-10.4.2-1': ['agent', 'theme', 'initial_location', 'destination', 'location'],
'chase-51.6': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'],
'vehicle_path-51.4.3': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'],
'distinguish-23.5': ['agent', 'theme', 'instrument', 'co_theme', 'location'],
'distinguish-23.5-1': ['agent', 'theme', 'instrument', 'co_theme', 'location'],
'begin-55.1': ['agent', 'theme', 'instrument', 'location'],
'begin-55.1-1-1': ['agent', 'theme', 'instrument', 'location'],
'confront-98': ['agent', 'theme', 'instrument', 'location'],
'establish-55.5-1': ['agent', 'theme', 'instrument', 'location'],
'satisfy-55.7': ['agent', 'theme', 'instrument', 'location'],
'support-15.3': ['agent', 'theme', 'instrument', 'location'],
'support-15.3-1': ['agent', 'theme', 'instrument', 'location'],
'sustain-55.6': ['agent', 'theme', 'instrument', 'location'],
'accept-77.1': ['agent', 'theme', 'location'],
'admit-64.3': ['agent', 'theme', 'location'],
'admit-64.3-1': ['agent', 'theme', 'location'],
'adopt-93': ['agent', 'theme', 'location'],
'begin-55.1-1': ['agent', 'theme', 'location'],
'being_dressed-41.3.3': ['agent', 'theme', 'location'],
'breathe-40.1.2-1': ['agent', 'theme', 'location'],
'caring-75.2': ['agent', 'theme', 'location'],
'caring-75.2-1': ['agent', 'theme', 'location'],
'caring-75.2-1-1': ['agent', 'theme', 'location'],
'caring-75.2-2': ['agent', 'theme', 'location'],
'complete-55.2': ['agent', 'theme', 'location'],
'complete-55.2-1': ['agent', 'theme', 'location'],
'cope-83': ['agent', 'theme', 'location'],
'cope-83-1': ['agent', 'theme', 'location'],
'cope-83-1-1': ['agent', 'theme', 'location'],
'declare-29.4-1-1': ['agent', 'theme', 'location'],
'declare-29.4-1-1-1': ['agent', 'theme', 'location'],
'declare-29.4-1-1-2': ['agent', 'theme', 'location'],
'declare-29.4-1-1-3': ['agent', 'theme', 'location'],
'declare-29.4-2': ['agent', 'theme', 'location'],
'enforce-63': ['agent', 'theme', 'location'],
'establish-55.5': ['agent', 'theme', 'location'],
'hold-15.1': ['agent', 'theme', 'location'],
'hunt-35.1': ['agent', 'theme', 'location'],
'investigate-35.4': ['agent', 'theme', 'location'],
'keep-15.2': ['agent', 'theme', 'location'],
'light_emission-43.1': ['agent', 'theme', 'location'],
'linger-53.1': ['agent', 'theme', 'location'],
'linger-53.1-1': ['agent', 'theme', 'location'],
'modes_of_being_with_motion-47.3': ['agent', 'theme', 'location'],
'neglect-75.1': ['agent', 'theme', 'location'],
'neglect-75.1-1': ['agent', 'theme', 'location'],
'orphan-29.7': ['agent', 'theme', 'location'],
'patent-101': ['agent', 'theme', 'location'],
'peer-30.3': ['agent', 'theme', 'location'],
'promote-102': ['agent', 'theme', 'location'],
'push-12': ['agent', 'theme', 'location'],
'refrain-69': ['agent', 'theme', 'location'],
'rehearse-26.8': ['agent', 'theme', 'location'],
'rehearse-26.8-1': ['agent', 'theme', 'location'],
'reject-77.2': ['agent', 'theme', 'location'],
'reject-77.2-1': ['agent', 'theme', 'location'],
'rely-70': ['agent', 'theme', 'location'],
'risk-94': ['agent', 'theme', 'location'],
'risk-94-1': ['agent', 'theme', 'location'],
'rummage-35.5': ['agent', 'theme', 'location'],
'rummage-35.5-1': ['agent', 'theme', 'location'],
'rush-53.2': ['agent', 'theme', 'location'],
'search-35.2': ['agent', 'theme', 'location'],
'simple_dressing-41.3.1': ['agent', 'theme', 'location'],
'snooze-40.4-1': ['agent', 'theme', 'location'],
'sound_emission-43.2': ['agent', 'theme', 'location'],
'spatial_configuration-47.6-1': ['agent', 'theme', 'location'],
'stalk-35.3': ['agent', 'theme', 'location'],
'stop-55.4-1-1': ['agent', 'theme', 'location'],
'succeed-74': ['agent', 'theme', 'location'],
'succeed-74-1': ['agent', 'theme', 'location'],
'succeed-74-1-1': ['agent', 'theme', 'location'],
'succeed-74-2': ['agent', 'theme', 'location'],
'succeed-74-3': ['agent', 'theme', 'location'],
'succeed-74-3-1': ['agent', 'theme', 'location'],
'succeed-74-3-1-1': ['agent', 'theme', 'location'],
'trifle-105.3': ['agent', 'theme', 'location'],
'try-61.1': ['agent', 'theme', 'location'],
'vehicle-51.4.1-1': ['agent', 'theme', 'location'],
'body_motion-49.2-1-1': ['agent', 'theme', 'path', 'location'],
'volunteer-95.4': ['agent', 'pivot', 'theme', 'location'],
'conjecture-29.5': ['agent', 'theme', 'predicate', 'location'],
'conjecture-29.5-1': ['agent', 'theme', 'predicate', 'location'],
'conjecture-29.5-2': ['agent', 'theme', 'predicate', 'location'],
'reciprocate-112': ['agent', 'theme', 'predicate', 'location'],
'reciprocate-112-1': ['agent', 'theme', 'predicate', 'location'],
'respond-113': ['agent', 'theme', 'predicate', 'location'],
'use-105.1': ['agent', 'theme', 'predicate', 'location'],
'coil-9.6-1': ['agent', 'theme', 'prop', 'location'],
'feeding-39.7': ['agent', 'theme', 'recipient', 'location'],
'reflexive_appearance-48.1.2': ['agent', 'theme', 'recipient', 'location'],
'appoint-29.1': ['agent', 'theme', 'result', 'location'],
'declare-29.4': ['agent', 'theme', 'result', 'location'],
'declare-29.4-1': ['agent', 'theme', 'result', 'location'],
'dub-29.3.2': ['agent', 'theme', 'result', 'location'],
'push-12-1': ['agent', 'theme', 'result', 'location'],
'banish-10.2': ['agent', 'theme', 'source', 'destination', 'location'],
'clear-10.3': ['agent', 'theme', 'source', 'destination', 'location'],
'clear-10.3-1': ['agent', 'theme', 'source', 'destination', 'location'],
'debone-10.8': ['agent', 'theme', 'source', 'destination', 'location'],
'wipe_manner-10.4.1': ['agent', 'theme', 'source', 'destination', 'location'],
'fire-10.10': ['agent', 'theme', 'source', 'goal', 'attribute', 'location'],
'remove-10.1': ['agent', 'theme', 'source', 'goal', 'location'],
'base-97.1': ['agent', 'theme', 'source', 'location'],
'deduce-97.2': ['agent', 'theme', 'source', 'location'],
'discover-84': ['agent', 'theme', 'source', 'location'],
'discover-84-1': ['agent', 'theme', 'source', 'location'],
'discover-84-1-1': ['agent', 'theme', 'source', 'location'],
'ferret-35.6': ['agent', 'theme', 'source', 'location'],
'wipe_manner-10.4.1-1': ['agent', 'theme', 'source', 'location'],
'estimate-34.2': ['agent', 'theme', 'value', 'location'],
'estimate-34.2-1': ['agent', 'theme', 'value', 'location'],
'price-54.4': ['agent', 'theme', 'value', 'location'],
'bring-11.3-1': ['agent', 'theme', ['destination', 'co_theme'], 'location'],
'roll-51.3.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'],
'run-51.3.2-2': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'],
'vehicle-51.4.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'],
'continue-55.3': ['agent', 'theme', ['final_time', 'time'], 'location'],
'waltz-51.5': ['agent', 'theme', ['initial_location', 'source'], 'goal', 'trajectory', 'location'],
'mine-10.9': ['agent', 'theme', 'initial_location', 'destination', 'location'],
'intend-61.2': ['agent', 'topic', 'attribute', 'location'],
'focus-87.1': ['agent', 'topic', 'location'],
'focus-87.1-1': ['agent', 'topic', 'location'],
'intend-61.2-1': ['agent', 'topic', 'location'],
'intend-61.2-1-1': ['agent', 'topic', 'location'],
'fit-54.3': ['agent', 'value', 'goal', 'location'],
'poke-19': ['agent', ['patient', 'destination'], 'instrument', 'location'],
'addict-96': ['agent', ['patient', 'experiencer'], 'stimulus', 'location'],
'acquiesce-95.1': ['agent', ['theme', 'co_agent'], 'location'],
'acquiesce-95.1-1': ['agent', ['theme', 'co_agent'], 'location'],
'invest-13.5.4': ['agent', ['theme', 'goal'], 'asset', 'location'],
'invest-13.5.4-1': ['agent', ['theme', 'goal'], 'asset', 'location'],
'avoid-52': ['agent', 'theme', 'location'],
'benefit-72.2': ['beneficiary', 'causer', 'location'],
'cost-54.2': ['beneficiary', 'theme', 'value', 'location'],
'caused_calibratable_cos-45.6.2': ['causer', 'patient', 'attribute', 'extent', 'source', 'goal', 'location'],
'limit-76': ['causer', 'patient', 'goal', 'location'],
'indicate-78': ['causer', 'recipient', 'topic', 'location'],
'indicate-78-1': ['causer', 'recipient', 'topic', 'location'],
'indicate-78-1-1': ['causer', 'recipient', 'topic', 'location'],
'free-10.6.3': ['causer', 'source', 'theme', 'location'],
'free-10.6.3-1': ['causer', 'source', 'theme', 'location'],
'free-10.6.3-1-1': ['causer', 'source', 'theme', 'location'],
'engender-27.1': ['causer', 'theme', 'location'],
'engender-27.1-1': ['causer', 'theme', 'location'],
'result-27.2': ['causer', 'theme', 'location'],
'hurt-40.8.3': ['experiencer', 'patient', 'location'],
'hurt-40.8.3-1': ['experiencer', 'patient', 'location'],
'hurt-40.8.3-1-1': ['experiencer', 'patient', 'location'],
'hurt-40.8.3-2': ['experiencer', 'patient', 'location'],
'pain-40.8.1': ['experiencer', 'patient', 'stimulus', 'location'],
'tingle-40.8.2': ['experiencer', 'patient', 'stimulus', 'location'],
'admire-31.2': ['experiencer', 'stimulus', 'attribute', 'location'],
'comprehend-87.2': ['experiencer', 'stimulus', 'attribute', 'location'],
'comprehend-87.2-1': ['experiencer', 'stimulus', 'attribute', 'location'],
'admire-31.2-1': ['experiencer', 'stimulus', 'location'],
'appeal-31.4': ['experiencer', 'stimulus', 'location'],
'appeal-31.4-1': ['experiencer', 'stimulus', 'location'],
'appeal-31.4-2': ['experiencer', 'stimulus', 'location'],
'appeal-31.4-3': ['experiencer', 'stimulus', 'location'],
'body_internal_states-40.6': ['experiencer', 'stimulus', 'location'],
'care-88.1': ['experiencer', 'stimulus', 'emotion', 'location'],
'care-88.1-1': ['experiencer', 'stimulus', 'emotion', 'location'],
'change_bodily_state-40.8.4': ['experiencer', 'stimulus', 'final_state', 'location'],
'cognize-85': ['experiencer', 'stimulus', 'location'],
'comprehend-87.2-1-1': ['experiencer', 'stimulus', 'location'],
'comprehend-87.2-1-1-1': ['experiencer', 'stimulus', 'location'],
'empathize-88.2': ['experiencer', 'stimulus', 'location'],
'encounter-30.5': ['experiencer', 'stimulus', 'location'],
'flinch-40.5': ['experiencer', 'stimulus', 'position', 'location'],
'marvel-31.3': ['experiencer', 'stimulus', 'emotion', 'location'],
'matter-91': ['experiencer', 'stimulus', 'location'],
'see-30.1': ['experiencer', 'stimulus', 'location'],
'see-30.1-1': ['experiencer', 'stimulus', 'location'],
'see-30.1-1-1': ['experiencer', 'stimulus', 'location'],
'see-30.1-1-1-1': ['experiencer', 'stimulus', 'location'],
'sight-30.2': ['experiencer', 'stimulus', 'location'],
'stimulus_subject-30.4': ['experiencer', 'stimulus', 'location'],
'wish-62': ['experiencer', 'stimulus', 'location'],
'bulge-47.5.3': [['agent', 'destination'], 'theme', 'location'],
'calibratable_cos-45.6.1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'],
'calibratable_cos-45.6.1-1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'],
'die-42.4': ['patient', 'causer', 'location'],
'die-42.4-1': ['patient', 'causer', 'location'],
'caused_calibratable_cos-45.6.2-1': ['patient', 'extent', 'source', 'goal', 'attribute', 'direction', 'location'],
'disappearance-48.2': ['theme', 'initial_location', 'location'],
'disappearance-48.2-1': ['theme', 'initial_location', 'location'],
'entity_specific_cos-45.5': ['patient', 'final_state', 'location'],
'break_down-45.8': ['patient', 'location'],
'convert-26.6.2': ['patient', 'result', 'initial_state', 'location'],
'convert-26.6.2-1': ['patient', 'result', 'initial_state', 'location'],
'become-109.1': ['patient', 'result', 'location'],
'become-109.1-1': ['patient', 'result', 'location'],
'become-109.1-1-1': ['patient', 'result', 'location'],
'contain-15.4': ['pivot', 'theme', 'location'],
'exhale-40.1.3': ['pivot', 'theme', 'location'],
'exhale-40.1.3-1': ['pivot', 'theme', 'location'],
'exhale-40.1.3-2': ['pivot', 'theme', 'location'],
'long-32.2': ['pivot', 'theme', 'location'],
'long-32.2-1': ['pivot', 'theme', 'location'],
'long-32.2-2': ['pivot', 'theme', 'location'],
'own-100.1': ['pivot', 'theme', 'location'],
'want-32.1': ['pivot', 'theme', 'location'],
'want-32.1-1': ['pivot', 'theme', 'location'],
'want-32.1-1-1': ['pivot', 'theme', 'location'],
'require-103': ['pivot', 'theme', 'source', 'location'],
'require-103-1': ['pivot', 'theme', 'source', 'location'],
'require-103-2': ['pivot', 'theme', 'source', 'location'],
'ensure-99': ['precondition', 'theme', 'beneficiary', 'location'],
'equip-13.4.2-1-1': ['recipient', 'theme', 'location'],
'substance_emission-43.4': ['source', 'theme', 'location'],
'substance_emission-43.4-1': ['source', 'theme', 'location'],
'amuse-31.1': ['stimulus', 'experiencer', 'location'],
'earn-54.6': ['theme', 'asset', 'location'],
'comprise-107.2': ['theme', 'attribute', 'location'],
'comprise-107.2-1': ['theme', 'attribute', 'location'],
'seem-109': ['theme', 'attribute', 'location'],
'seem-109-1': ['theme', 'attribute', 'location'],
'seem-109-1-1': ['theme', 'attribute', 'location'],
'seem-109-1-1-1': ['theme', 'attribute', 'location'],
'exceed-90': ['theme', 'co_theme', 'attribute', 'location'],
'representation-110.1': ['theme', 'co_theme', 'context', 'location'],
'bump-18.4': ['theme', 'co_theme', 'location'],
'bump-18.4-1': ['theme', 'co_theme', 'location'],
'cling-22.5': ['theme', 'co_theme', 'location'],
'contiguous_location-47.8': ['theme', 'co_theme', 'location'],
'contiguous_location-47.8-1': ['theme', 'co_theme', 'location'],
'contiguous_location-47.8-2': ['theme', 'co_theme', 'location'],
'differ-23.4': ['theme', 'co_theme', 'location'],
'harmonize-22.6': ['theme', 'co_theme', 'location'],
'relate-86.2': ['theme', 'co_theme', 'location'],
'relate-86.2-1': ['theme', 'co_theme', 'location'],
'relate-86.2-2': ['theme', 'co_theme', 'location'],
'substitute-13.6.2': ['theme', 'co_theme', ['source', 'co_goal'], ['co_source', 'goal'], ['location']],
'substitute-13.6.2-1': ['theme', 'co_theme', ['source', 'goal'], ['co_source', 'co_goal'], ['location']],
'escape-51.1-1-2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'],
'nonvehicle-51.4.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'],
'run-51.3.2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'],
'run-51.3.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'],
'rotate-51.9.1': ['theme', 'extent', 'initial_location', 'trajectory', 'location'],
'attend-107.4': ['theme', 'goal', 'location'],
'attend-107.4-1': ['theme', 'goal', 'location'],
'attend-107.4-2': ['theme', 'goal', 'location'],
'reach-51.8': ['theme', 'goal', 'source', 'trajectory', 'location'],
'escape-51.1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'],
'escape-51.1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'],
'escape-51.1-1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'],
'appear-48.1.1': ['theme', 'location'],
'disfunction-105.2.2': ['theme', 'location'],
'entity_specific_modes_being-47.2': ['theme', 'location'],
'exist-47.1': ['theme', 'location'],
'function-105.2.1': ['theme', 'location'],
'lodge-46': ['theme', 'location'],
'meander-47.7': ['theme', 'location'],
'meander-47.7-1': ['theme', 'location'],
'occur-48.3': ['theme', 'location'],
'occur-48.3-1': ['theme', 'location'],
'occur-48.3-2': ['theme', 'location'],
'smell_emission-43.3': ['theme', 'location'],
'sound_existence-47.4': ['theme', 'location'],
'stop-55.4-1': ['theme', 'location'],
'swarm-47.5.1': ['theme', 'location'],
'swarm-47.5.1-1': ['theme', 'location'],
'swarm-47.5.1-2': ['theme', 'location'],
'swarm-47.5.1-2-1': ['theme', 'location'],
#
'terminus-47.9': ['theme', 'destination', 'location'],
#
'weather-57': ['theme', 'location'],
'weekend-56': ['theme', 'location'],
'spatial_configuration-47.6': ['theme', 'pos', 'location'],
'function-105.2.1-1': ['theme', 'predicate', 'location'],
'leave-51.2': ['theme', 'source', 'goal', 'trajectory', 'location'],
'leave-51.2-1': ['theme', 'source', 'goal', 'trajectory', 'location'],
'escape-51.1-1-3': ['theme', 'trajectory', 'destination', 'initial_location', 'location'],
'register-54.1': ['theme', 'value', 'location'],
'register-54.1-1-1': ['theme', 'value', 'location'],
'exist-47.1-1': ['theme', ['pivot', 'manner'], 'location'],
'rob-10.6.4': [['agent', 'beneficiary'], 'theme', 'source', 'location'],
'steal-10.5': [['agent', 'beneficiary'], 'theme', 'source', 'location'],
'steal-10.5-1': [['agent', 'beneficiary'], 'theme', 'source', 'location'],
'render-29.90': [['agent', 'causer'], 'patient', 'result', 'source', 'location'],
'throw-17.1-1-1': [['agent', 'causer'], 'theme', 'result', 'location'],
'exchange-13.6.1': [['agent', 'co_goal', 'source'], ['co_agent', 'goal', 'co_source'], 'theme', 'co_theme', 'location'],
'talk-37.5': [['agent', 'co_recipient', 'source'], ['co_agent', 'co_source', 'recipient'], 'topic', 'location'],
'get-13.5.1': [['agent', 'goal'], 'theme', 'beneficiary', 'source', 'asset', 'location'],
'absorb-39.8': [['agent', 'goal'], 'theme', 'source', 'location'],
'cheat-10.6.1': [['agent', 'goal'], 'theme', 'source', 'location'],
'cheat-10.6.1-1': [['agent', 'goal'], 'theme', 'source', 'location'],
'cheat-10.6.1-1-1': [['agent', 'goal'], 'theme', 'source', 'location'],
'deprive-10.6.2': [['agent', 'goal'], 'theme', 'source', 'location'],
'get-13.5.1-1': [['agent', 'goal'], 'theme', 'source', 'location'],
'learn-14': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'],
'learn-14-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'],
'learn-14-2': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'],
'learn-14-2-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'],
'interrogate-37.1.3': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'attribute', 'location'],
'inquire-37.1.2': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'location'],
'throw-17.1': [['agent', 'initial_location'], 'theme', 'destination', 'location'],
'throw-17.1-1': [['agent', 'initial_location'], 'theme', 'destination', 'location'],
'bring-11.3': [['agent', 'instrument'], 'theme', 'destination', 'initial_location', 'location'],
'obtain-13.5.2-1': [['agent', 'recipient'], 'theme', 'source', 'asset', 'location'],
'berry-13.7': [['agent', 'recipient'], 'theme', 'source', 'location'],
'obtain-13.5.2': [['agent', 'recipient'], 'theme', 'source', 'location'],
'chit_chat-37.6': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'],
'chit_chat-37.6-1': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'],
'consume-66': [['agent', 'source'], 'asset', 'goal', 'location'],
'consume-66-1': [['agent', 'source'], 'asset', 'goal', 'location'],
'wink-40.3.1': [['agent', 'source'], 'patient', 'recipient', 'theme', 'location'],
'crane-40.3.2': [['agent', 'source'], 'patient', 'recipient', 'topic', 'location'],
'contribute-13.2': [['agent', 'source'], 'recipient', 'theme', 'location'],
'contribute-13.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'],
'contribute-13.2-1-1': [['agent', 'source'], 'recipient', 'theme', 'location'],
'contribute-13.2-2': [['agent', 'source'], 'recipient', 'theme', 'location'],
'contribute-13.2-2-1': [['agent', 'source'], 'recipient', 'theme', 'location'],
'equip-13.4.2': [['agent', 'source'], 'recipient', 'theme', 'location'],
'equip-13.4.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'],
'nonverbal_expression-40.2': [['agent', 'source'], 'recipient', 'theme', 'location'],
'advise-37.9': [['agent', 'source'], 'recipient', 'topic', 'location'],
'advise-37.9-1': [['agent', 'source'], 'recipient', 'topic', 'location'],
'complain-37.8': [['agent', 'source'], 'recipient', 'topic', 'location'],
'confess-37.10': [['agent', 'source'], 'recipient', 'topic', 'location'],
'curtsey-40.3.3': [['agent', 'source'], 'recipient', 'topic', 'location'],
'initiate_communication-37.4.2': [['agent', 'source'], 'recipient', 'topic', 'location'],
'initiate_communication-37.4.2-1': [['agent', 'source'], 'recipient', 'topic', 'location'],
'promise-37.13': [['agent', 'source'], 'recipient', 'topic', 'location'],
'transfer_mesg-37.1.1': [['agent', 'source'], 'recipient', 'topic', 'location'],
'transfer_mesg-37.1.1-1': [['agent', 'source'], 'recipient', 'topic', 'location'],
'transfer_mesg-37.1.1-1-1': [['agent', 'source'], 'recipient', 'topic', 'location'],
'pay-68': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'],
'pay-68-1': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'],
'breathe-40.1.2': [['agent', 'source'], 'theme', 'destination', 'location'],
'give-13.1-1': [['agent', 'source'], 'theme', 'recipient', 'asset', 'location'],
'fulfilling-13.4.1': [['agent', 'source'], 'theme', 'recipient', 'location'],
'fulfilling-13.4.1-1': [['agent', 'source'], 'theme', 'recipient', 'location'],
'fulfilling-13.4.1-2': [['agent', 'source'], 'theme', 'recipient', 'location'],
'give-13.1': [['agent', 'source'], 'theme', 'recipient', 'location'],
'future_having-13.3': [['agent', 'source'], 'theme', ['beneficiary', 'goal'], 'location'],
'instr_communication-37.4.1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'lecture-37.11': [['agent', 'source'], 'topic', 'recipient', 'location'],
'lecture-37.11-1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'lecture-37.11-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'lecture-37.11-2': [['agent', 'source'], 'topic', 'recipient', 'location'],
'manner_speaking-37.3': [['agent', 'source'], 'topic', 'recipient', 'manner', 'location'],
'say-37.7': [['agent', 'source'], 'topic', 'recipient', 'location'],
'say-37.7-1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'say-37.7-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'say-37.7-1-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'],
'say-37.7-1-2': [['agent', 'source'], 'topic', 'recipient', 'location'],
'tell-37.2': [['agent', 'source'], 'topic', 'recipient', 'location'],
'overstate-37.12': [['agent', 'source'], ['theme', 'topic'], 'recipient', 'location'],
'orbit-51.9.2': [['theme', 'axis'], ['destination', 'initial_location'], 'trajectory', 'location']
}
| """
Created on Thu Nov 21 15:38:43 2019
@author: Mijael
"""
vnclass_dict = {'stop-55.4': ['causer', 'theme', 'location'], 'masquerade-29.6': ['agent', 'attribute', 'location'], 'masquerade-29.6-1': ['agent', 'attribute', 'location'], 'masquerade-29.6-2': ['agent', 'attribute', 'location'], 'captain-29.8': ['agent', 'beneficiary', 'location'], 'captain-29.8-1': ['agent', 'beneficiary', 'location'], 'captain-29.8-1-1': ['agent', 'beneficiary', 'location'], 'preparing-26.3': ['agent', 'product', 'material', 'beneficiary', 'location'], 'defend-72.3': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-1-1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-2': ['agent', 'beneficiary', 'theme', 'location'], 'interact-36.6': ['agent', 'co_agent', 'location'], 'marry-36.2': ['agent', 'co_agent', 'location'], 'meet-36.3': ['agent', 'co_agent', 'location'], 'meet-36.3-1': ['agent', 'co_agent', 'location'], 'meet-36.3-2': ['agent', 'co_agent', 'location'], 'subordinate-95.2.1': ['agent', 'co_agent', 'location'], 'supervision-95.2.2': ['agent', 'co_agent', 'location'], 'cooperate-73.1': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-1': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-2': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-3': ['agent', 'co_agent', 'theme', 'location'], 'correspond-36.1.1': ['agent', 'co_agent', 'topic', 'location'], 'correspond-36.1.1-1': ['agent', 'co_agent', 'topic', 'location'], 'correspond-36.1.1-1-1': ['agent', 'co_agent', 'topic', 'location'], 'conspire-71': ['agent', 'co_agent', ['theme', 'beneficiary'], 'location'], 'battle-36.4': ['agent', 'co_agent', ['theme', 'topic'], ['location']], 'battle-36.4-1': ['agent', 'co_agent', ['theme', 'topic'], ['location']], 'settle-36.1.2': ['agent', 'co_agent', ['topic', 'goal'], 'location'], 'settle-36.1.2-1': ['agent', 'co_agent', ['topic', 'goal'], 'location'], 'butter-9.9': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'fill-9.8': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'fill-9.8-1': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'spend_time-104': ['agent', 'duration', 'attribute', 'location'], 'touch-20': ['agent', 'theme', 'experiencer', 'instrument', 'location'], 'touch-20-1': ['agent', 'theme', 'experiencer', 'instrument', 'location'], 'assuming_position-50': ['agent', 'location'], 'gobble-39.3': ['agent', 'patient', 'location'], 'hiccup-40.1.1': ['agent', 'location'], 'snooze-40.4': ['agent', 'location'], 'concealment-16': ['agent', 'patient', 'beneficiary', 'location'], 'concealment-16-1': ['agent', 'patient', 'beneficiary', 'location'], 'hit-18.1': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'], 'tape-22.4': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'], 'amalgamate-22.2': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-1-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-2': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-2-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-1-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-2': ['agent', 'patient', 'co_patient', 'location'], 'disassemble-23.3': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-1-1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-2': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-2-1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1-1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1-2': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-1': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-1-1': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-2': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-2-1': ['agent', 'patient', 'co_patient', 'location'], 'split-23.2': ['agent', 'patient', 'co_patient', 'location'], 'adjust-26.9': ['agent', 'patient', 'goal', 'source', 'location'], 'swat-18.2': ['agent', 'patient', 'instrument', 'result', 'location'], 'bend-45.2': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2-1': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2-2': ['agent', 'patient', 'instrument', 'location'], 'cooking-45.3': ['agent', 'patient', 'instrument', 'location'], 'cut-21.1-1': [['agent', 'causer'], 'patient', 'experiencer', 'instrument', 'movement', 'location'], 'destroy-44': ['agent', 'patient', 'instrument', 'location'], 'floss-41.2.1': ['agent', 'patient', 'instrument', 'final_state', 'location'], 'hit-18.1-1': ['agent', 'patient', 'instrument', 'location'], 'murder-42.1': ['agent', 'patient', 'instrument', 'location'], 'murder-42.1-1': ['agent', 'patient', 'instrument', 'location'], 'other_cos-45.4': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'remedy-45.7': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'remedy-45.7-1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'subjugate-42.3': ['agent', 'patient', 'instrument', 'location'], 'break-45.1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'poison-42.2': ['agent', 'patient', 'instrument', 'result', 'location'], 'spank-18.3': ['agent', 'patient', 'instrument', 'result', 'location'], 'cut-21.1': ['agent', 'patient', 'instrument', 'source', ['goal', 'result'], 'movement', 'location'], 'attack-60.1': ['agent', 'patient', 'location'], 'attack-60.1-1': ['agent', 'patient', 'location'], 'birth-28.2': ['agent', 'patient', 'location'], 'birth-28.2-1': ['agent', 'patient', 'location'], 'body_internal_motion-49.1': ['agent', 'patient', 'location'], 'braid-41.2.2': ['agent', 'patient', 'final_state', 'location'], 'calve-28.1': ['agent', 'patient', 'location'], 'chew-39.2': ['agent', 'patient', 'location'], 'chew-39.2-1': ['agent', 'patient', 'location'], 'chew-39.2-2': ['agent', 'patient', 'location'], 'dine-39.5': ['agent', 'patient', 'location'], 'dress-41.1.1': ['agent', 'patient', 'location'], 'dressing_well-41.3.2': [['agent', 'patient'], 'location'], 'eat-39.1-3': ['agent', 'patient', 'location'], 'gobble-39.3-1': ['agent', 'patient', 'location'], 'gobble-39.3-2': ['agent', 'patient', 'location'], 'gorge-39.6': ['agent', 'patient', 'location'], 'groom-41.1.2': ['agent', 'patient', 'location'], 'urge-58.1': ['agent', 'patient', 'result', 'location'], 'void-106': ['agent', 'patient', 'result', 'location'], 'coloring-24': ['agent', 'patient', 'material', 'result', 'location'], 'compel-59.1': ['agent', 'patient', 'predicate', 'location'], 'lure-59.3': ['agent', 'patient', 'predicate', 'location'], 'stimulate-59.4': ['agent', 'patient', 'predicate', 'location'], 'grow-26.2.1': ['agent', 'patient', 'product', 'location'], 'rear-26.2.2': ['agent', 'patient', 'product', 'location'], 'rear-26.2.2-1': ['agent', 'patient', 'product', 'location'], 'turn-26.6.1': ['agent', 'patient', 'result', 'initial_state', 'location'], 'turn-26.6.1-1': ['agent', 'patient', 'result', 'initial_state', 'location'], 'beg-58.2': ['agent', 'patient', 'result', 'location'], 'beg-58.2-1': ['agent', 'patient', 'result', 'location'], 'beg-58.2-1-1': ['agent', 'patient', 'result', 'location'], 'bully-59.5': ['agent', 'patient', 'result', 'location'], 'order-58.3': ['agent', 'patient', 'result', 'location'], 'order-58.3-1': ['agent', 'patient', 'result', 'location'], 'other_cos-45.4-1': ['agent', 'patient', 'result', 'location'], 'suffocate-40.7': ['agent', 'patient', 'result', 'location'], 'render-29.90-1': ['agent', 'patient', 'result', 'source', 'location'], 'render-29.90-2': ['agent', 'patient', 'result', 'source', 'location'], 'devour-39.4': ['agent', 'patient', 'source', 'location'], 'eat-39.1': ['agent', 'patient', 'source', 'location'], 'eat-39.1-1': ['agent', 'patient', 'source', 'location'], 'eat-39.1-2': ['agent', 'patient', 'source', 'location'], 'prosecute-33.2-1': ['agent', 'patient', 'theme', 'attribute', 'location'], 'prosecute-33.2': ['agent', 'patient', 'theme', 'location'], 'trick-59.2': ['agent', 'patient', ['predicate', 'result'], 'location'], 'convert-26.6.2-1-1': ['agent', 'patient', ['result', 'goal'], 'initial_state', 'location'], 'urge-58.1-1': ['agent', 'patient', ['topic', 'result'], 'location'], 'urge-58.1-1-1': ['agent', 'patient', ['topic', 'result'], 'location'], 'act-114': ['agent', 'predicate', 'location'], 'act-114-1': ['agent', 'predicate', 'location'], 'act-114-1-1': ['agent', 'predicate', 'location'], 'preparing-26.3-1': ['agent', 'product', 'material', 'beneficiary', 'location'], 'preparing-26.3-2': ['agent', 'product', 'material', 'beneficiary', 'location'], 'build-26.1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'], 'build-26.1-1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'], 'knead-26.5': ['agent', 'product', 'material', 'location'], 'bill-54.5': ['agent', 'recipient', 'asset', 'location'], 'animal_sounds-38': ['agent', 'recipient', 'theme', 'location'], 'create-26.4-1': ['agent', 'result', 'beneficiary', 'location'], 'create-26.4': ['agent', 'result', 'material', 'beneficiary', 'location'], 'create-26.4-1-1': ['agent', 'result', 'material', 'beneficiary', 'location'], 'resign-10.11': ['agent', 'source', 'goal', 'location'], 'resign-10.11-1': ['agent', 'source', 'goal', 'location'], 'resign-10.11-2': ['agent', 'source', 'goal', 'location'], 'withdraw-82': ['agent', 'source', 'location'], 'withdraw-82-1': ['agent', 'source', 'location'], 'withdraw-82-2': ['agent', 'source', 'location'], 'withdraw-82-3': ['agent', 'source', 'location'], 'substance_emission-43.4-1-1': ['agent', 'source', 'theme', 'location'], 'assessment-34.1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1-1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1-2': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1-1-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-2': ['agent', 'theme', 'attribute', 'location'], 'hire-13.5.3': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1-1': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1-1-1': ['agent', 'theme', 'attribute', 'location'], 'pronounce-29.3.1': ['agent', 'theme', 'attribute', 'location'], 'suspect-81': ['agent', 'theme', 'attribute', 'location'], 'sustain-55.6-1': ['agent', 'theme', 'attribute', 'location'], 'volunteer-95.4-1': ['agent', 'theme', 'attribute', 'location'], 'register-54.1-1': ['agent', 'theme', 'attribute', 'value', 'location'], 'allow-64.1': ['agent', 'theme', 'beneficiary', 'location'], 'allow-64.1-1': ['agent', 'theme', 'beneficiary', 'location'], 'conduct-111.1': ['agent', 'theme', 'beneficiary', 'location'], 'forbid-64.4': ['agent', 'theme', 'beneficiary', 'location'], 'forbid-64.4-1': ['agent', 'theme', 'beneficiary', 'location'], 'let-64.2': ['agent', 'theme', 'beneficiary', 'location'], 'performance-26.7': ['agent', 'theme', 'beneficiary', 'location'], 'performance-26.7-1': ['agent', 'theme', 'beneficiary', 'location'], 'employment-95.3': ['agent', 'theme', 'co_agent', 'attribute', 'location'], 'play-114.2': ['agent', 'theme', 'co_agent', 'location'], 'play-114.2-1': ['agent', 'theme', 'co_agent', 'location'], 'work-73.2': ['agent', 'theme', 'co_agent', 'location'], 'correlate-86.1': ['agent', 'theme', 'co_theme', 'location'], 'herd-47.5.2': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-1': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-2': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-3': ['agent', 'theme', 'co_theme', 'location'], 'carry-11.4': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'carry-11.4-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'carry-11.4-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'coil-9.6': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'confine-92': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'confine-92-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'drive-11.5': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'drive-11.5-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pelt-17.2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pocket-9.10': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pocket-9.10-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1-2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put_direction-9.4': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put_spatial-9.2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'send-11.1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'send-11.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'slide-11.2-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'spray-9.7': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'spray-9.7-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'accompany-51.7': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'nonvehicle-51.4.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2-2-1': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'slide-11.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'illustrate-25.3': ['agent', 'theme', 'destination', 'location'], 'image_impression-25.1': ['agent', 'theme', 'destination', 'location'], 'scribble-25.2': ['agent', 'theme', 'destination', 'location'], 'scribble-25.2-1': ['agent', 'theme', 'destination', 'location'], 'spray-9.7-1-1': ['agent', 'theme', 'destination', 'location'], 'spray-9.7-2': ['agent', 'theme', 'destination', 'location'], 'transcribe-25.4': ['agent', 'theme', 'destination', 'location'], 'pit-10.7': ['agent', 'theme', 'destination', 'source', 'location'], 'rotate-51.9.1-1': ['agent', 'theme', 'extent', 'initial_location', 'location'], 'classify-29.10': ['agent', 'theme', 'goal', 'location'], 'dedicate-79': ['agent', 'theme', 'goal', 'location'], 'exclude-107.3': ['agent', 'theme', 'goal', 'location'], 'exclude-107.3-1': ['agent', 'theme', 'goal', 'location'], 'involve-107.1': ['agent', 'theme', 'goal', 'location'], 'body_motion-49.2': ['agent', 'theme', 'goal', 'path', 'location'], 'body_motion-49.2-1': ['agent', 'theme', 'goal', 'path', 'location'], 'push-12-1-1': ['agent', 'theme', 'goal', 'source', 'trajectory', 'location'], 'wipe_instr-10.4.2': ['agent', 'theme', 'initial_location', 'destination', 'instrument', 'result', 'location'], 'pour-9.5': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'wipe_instr-10.4.2-1': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'chase-51.6': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'], 'vehicle_path-51.4.3': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'], 'distinguish-23.5': ['agent', 'theme', 'instrument', 'co_theme', 'location'], 'distinguish-23.5-1': ['agent', 'theme', 'instrument', 'co_theme', 'location'], 'begin-55.1': ['agent', 'theme', 'instrument', 'location'], 'begin-55.1-1-1': ['agent', 'theme', 'instrument', 'location'], 'confront-98': ['agent', 'theme', 'instrument', 'location'], 'establish-55.5-1': ['agent', 'theme', 'instrument', 'location'], 'satisfy-55.7': ['agent', 'theme', 'instrument', 'location'], 'support-15.3': ['agent', 'theme', 'instrument', 'location'], 'support-15.3-1': ['agent', 'theme', 'instrument', 'location'], 'sustain-55.6': ['agent', 'theme', 'instrument', 'location'], 'accept-77.1': ['agent', 'theme', 'location'], 'admit-64.3': ['agent', 'theme', 'location'], 'admit-64.3-1': ['agent', 'theme', 'location'], 'adopt-93': ['agent', 'theme', 'location'], 'begin-55.1-1': ['agent', 'theme', 'location'], 'being_dressed-41.3.3': ['agent', 'theme', 'location'], 'breathe-40.1.2-1': ['agent', 'theme', 'location'], 'caring-75.2': ['agent', 'theme', 'location'], 'caring-75.2-1': ['agent', 'theme', 'location'], 'caring-75.2-1-1': ['agent', 'theme', 'location'], 'caring-75.2-2': ['agent', 'theme', 'location'], 'complete-55.2': ['agent', 'theme', 'location'], 'complete-55.2-1': ['agent', 'theme', 'location'], 'cope-83': ['agent', 'theme', 'location'], 'cope-83-1': ['agent', 'theme', 'location'], 'cope-83-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1-2': ['agent', 'theme', 'location'], 'declare-29.4-1-1-3': ['agent', 'theme', 'location'], 'declare-29.4-2': ['agent', 'theme', 'location'], 'enforce-63': ['agent', 'theme', 'location'], 'establish-55.5': ['agent', 'theme', 'location'], 'hold-15.1': ['agent', 'theme', 'location'], 'hunt-35.1': ['agent', 'theme', 'location'], 'investigate-35.4': ['agent', 'theme', 'location'], 'keep-15.2': ['agent', 'theme', 'location'], 'light_emission-43.1': ['agent', 'theme', 'location'], 'linger-53.1': ['agent', 'theme', 'location'], 'linger-53.1-1': ['agent', 'theme', 'location'], 'modes_of_being_with_motion-47.3': ['agent', 'theme', 'location'], 'neglect-75.1': ['agent', 'theme', 'location'], 'neglect-75.1-1': ['agent', 'theme', 'location'], 'orphan-29.7': ['agent', 'theme', 'location'], 'patent-101': ['agent', 'theme', 'location'], 'peer-30.3': ['agent', 'theme', 'location'], 'promote-102': ['agent', 'theme', 'location'], 'push-12': ['agent', 'theme', 'location'], 'refrain-69': ['agent', 'theme', 'location'], 'rehearse-26.8': ['agent', 'theme', 'location'], 'rehearse-26.8-1': ['agent', 'theme', 'location'], 'reject-77.2': ['agent', 'theme', 'location'], 'reject-77.2-1': ['agent', 'theme', 'location'], 'rely-70': ['agent', 'theme', 'location'], 'risk-94': ['agent', 'theme', 'location'], 'risk-94-1': ['agent', 'theme', 'location'], 'rummage-35.5': ['agent', 'theme', 'location'], 'rummage-35.5-1': ['agent', 'theme', 'location'], 'rush-53.2': ['agent', 'theme', 'location'], 'search-35.2': ['agent', 'theme', 'location'], 'simple_dressing-41.3.1': ['agent', 'theme', 'location'], 'snooze-40.4-1': ['agent', 'theme', 'location'], 'sound_emission-43.2': ['agent', 'theme', 'location'], 'spatial_configuration-47.6-1': ['agent', 'theme', 'location'], 'stalk-35.3': ['agent', 'theme', 'location'], 'stop-55.4-1-1': ['agent', 'theme', 'location'], 'succeed-74': ['agent', 'theme', 'location'], 'succeed-74-1': ['agent', 'theme', 'location'], 'succeed-74-1-1': ['agent', 'theme', 'location'], 'succeed-74-2': ['agent', 'theme', 'location'], 'succeed-74-3': ['agent', 'theme', 'location'], 'succeed-74-3-1': ['agent', 'theme', 'location'], 'succeed-74-3-1-1': ['agent', 'theme', 'location'], 'trifle-105.3': ['agent', 'theme', 'location'], 'try-61.1': ['agent', 'theme', 'location'], 'vehicle-51.4.1-1': ['agent', 'theme', 'location'], 'body_motion-49.2-1-1': ['agent', 'theme', 'path', 'location'], 'volunteer-95.4': ['agent', 'pivot', 'theme', 'location'], 'conjecture-29.5': ['agent', 'theme', 'predicate', 'location'], 'conjecture-29.5-1': ['agent', 'theme', 'predicate', 'location'], 'conjecture-29.5-2': ['agent', 'theme', 'predicate', 'location'], 'reciprocate-112': ['agent', 'theme', 'predicate', 'location'], 'reciprocate-112-1': ['agent', 'theme', 'predicate', 'location'], 'respond-113': ['agent', 'theme', 'predicate', 'location'], 'use-105.1': ['agent', 'theme', 'predicate', 'location'], 'coil-9.6-1': ['agent', 'theme', 'prop', 'location'], 'feeding-39.7': ['agent', 'theme', 'recipient', 'location'], 'reflexive_appearance-48.1.2': ['agent', 'theme', 'recipient', 'location'], 'appoint-29.1': ['agent', 'theme', 'result', 'location'], 'declare-29.4': ['agent', 'theme', 'result', 'location'], 'declare-29.4-1': ['agent', 'theme', 'result', 'location'], 'dub-29.3.2': ['agent', 'theme', 'result', 'location'], 'push-12-1': ['agent', 'theme', 'result', 'location'], 'banish-10.2': ['agent', 'theme', 'source', 'destination', 'location'], 'clear-10.3': ['agent', 'theme', 'source', 'destination', 'location'], 'clear-10.3-1': ['agent', 'theme', 'source', 'destination', 'location'], 'debone-10.8': ['agent', 'theme', 'source', 'destination', 'location'], 'wipe_manner-10.4.1': ['agent', 'theme', 'source', 'destination', 'location'], 'fire-10.10': ['agent', 'theme', 'source', 'goal', 'attribute', 'location'], 'remove-10.1': ['agent', 'theme', 'source', 'goal', 'location'], 'base-97.1': ['agent', 'theme', 'source', 'location'], 'deduce-97.2': ['agent', 'theme', 'source', 'location'], 'discover-84': ['agent', 'theme', 'source', 'location'], 'discover-84-1': ['agent', 'theme', 'source', 'location'], 'discover-84-1-1': ['agent', 'theme', 'source', 'location'], 'ferret-35.6': ['agent', 'theme', 'source', 'location'], 'wipe_manner-10.4.1-1': ['agent', 'theme', 'source', 'location'], 'estimate-34.2': ['agent', 'theme', 'value', 'location'], 'estimate-34.2-1': ['agent', 'theme', 'value', 'location'], 'price-54.4': ['agent', 'theme', 'value', 'location'], 'bring-11.3-1': ['agent', 'theme', ['destination', 'co_theme'], 'location'], 'roll-51.3.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'run-51.3.2-2': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'vehicle-51.4.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'continue-55.3': ['agent', 'theme', ['final_time', 'time'], 'location'], 'waltz-51.5': ['agent', 'theme', ['initial_location', 'source'], 'goal', 'trajectory', 'location'], 'mine-10.9': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'intend-61.2': ['agent', 'topic', 'attribute', 'location'], 'focus-87.1': ['agent', 'topic', 'location'], 'focus-87.1-1': ['agent', 'topic', 'location'], 'intend-61.2-1': ['agent', 'topic', 'location'], 'intend-61.2-1-1': ['agent', 'topic', 'location'], 'fit-54.3': ['agent', 'value', 'goal', 'location'], 'poke-19': ['agent', ['patient', 'destination'], 'instrument', 'location'], 'addict-96': ['agent', ['patient', 'experiencer'], 'stimulus', 'location'], 'acquiesce-95.1': ['agent', ['theme', 'co_agent'], 'location'], 'acquiesce-95.1-1': ['agent', ['theme', 'co_agent'], 'location'], 'invest-13.5.4': ['agent', ['theme', 'goal'], 'asset', 'location'], 'invest-13.5.4-1': ['agent', ['theme', 'goal'], 'asset', 'location'], 'avoid-52': ['agent', 'theme', 'location'], 'benefit-72.2': ['beneficiary', 'causer', 'location'], 'cost-54.2': ['beneficiary', 'theme', 'value', 'location'], 'caused_calibratable_cos-45.6.2': ['causer', 'patient', 'attribute', 'extent', 'source', 'goal', 'location'], 'limit-76': ['causer', 'patient', 'goal', 'location'], 'indicate-78': ['causer', 'recipient', 'topic', 'location'], 'indicate-78-1': ['causer', 'recipient', 'topic', 'location'], 'indicate-78-1-1': ['causer', 'recipient', 'topic', 'location'], 'free-10.6.3': ['causer', 'source', 'theme', 'location'], 'free-10.6.3-1': ['causer', 'source', 'theme', 'location'], 'free-10.6.3-1-1': ['causer', 'source', 'theme', 'location'], 'engender-27.1': ['causer', 'theme', 'location'], 'engender-27.1-1': ['causer', 'theme', 'location'], 'result-27.2': ['causer', 'theme', 'location'], 'hurt-40.8.3': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-1': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-1-1': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-2': ['experiencer', 'patient', 'location'], 'pain-40.8.1': ['experiencer', 'patient', 'stimulus', 'location'], 'tingle-40.8.2': ['experiencer', 'patient', 'stimulus', 'location'], 'admire-31.2': ['experiencer', 'stimulus', 'attribute', 'location'], 'comprehend-87.2': ['experiencer', 'stimulus', 'attribute', 'location'], 'comprehend-87.2-1': ['experiencer', 'stimulus', 'attribute', 'location'], 'admire-31.2-1': ['experiencer', 'stimulus', 'location'], 'appeal-31.4': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-1': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-2': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-3': ['experiencer', 'stimulus', 'location'], 'body_internal_states-40.6': ['experiencer', 'stimulus', 'location'], 'care-88.1': ['experiencer', 'stimulus', 'emotion', 'location'], 'care-88.1-1': ['experiencer', 'stimulus', 'emotion', 'location'], 'change_bodily_state-40.8.4': ['experiencer', 'stimulus', 'final_state', 'location'], 'cognize-85': ['experiencer', 'stimulus', 'location'], 'comprehend-87.2-1-1': ['experiencer', 'stimulus', 'location'], 'comprehend-87.2-1-1-1': ['experiencer', 'stimulus', 'location'], 'empathize-88.2': ['experiencer', 'stimulus', 'location'], 'encounter-30.5': ['experiencer', 'stimulus', 'location'], 'flinch-40.5': ['experiencer', 'stimulus', 'position', 'location'], 'marvel-31.3': ['experiencer', 'stimulus', 'emotion', 'location'], 'matter-91': ['experiencer', 'stimulus', 'location'], 'see-30.1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1-1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1-1-1': ['experiencer', 'stimulus', 'location'], 'sight-30.2': ['experiencer', 'stimulus', 'location'], 'stimulus_subject-30.4': ['experiencer', 'stimulus', 'location'], 'wish-62': ['experiencer', 'stimulus', 'location'], 'bulge-47.5.3': [['agent', 'destination'], 'theme', 'location'], 'calibratable_cos-45.6.1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'], 'calibratable_cos-45.6.1-1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'], 'die-42.4': ['patient', 'causer', 'location'], 'die-42.4-1': ['patient', 'causer', 'location'], 'caused_calibratable_cos-45.6.2-1': ['patient', 'extent', 'source', 'goal', 'attribute', 'direction', 'location'], 'disappearance-48.2': ['theme', 'initial_location', 'location'], 'disappearance-48.2-1': ['theme', 'initial_location', 'location'], 'entity_specific_cos-45.5': ['patient', 'final_state', 'location'], 'break_down-45.8': ['patient', 'location'], 'convert-26.6.2': ['patient', 'result', 'initial_state', 'location'], 'convert-26.6.2-1': ['patient', 'result', 'initial_state', 'location'], 'become-109.1': ['patient', 'result', 'location'], 'become-109.1-1': ['patient', 'result', 'location'], 'become-109.1-1-1': ['patient', 'result', 'location'], 'contain-15.4': ['pivot', 'theme', 'location'], 'exhale-40.1.3': ['pivot', 'theme', 'location'], 'exhale-40.1.3-1': ['pivot', 'theme', 'location'], 'exhale-40.1.3-2': ['pivot', 'theme', 'location'], 'long-32.2': ['pivot', 'theme', 'location'], 'long-32.2-1': ['pivot', 'theme', 'location'], 'long-32.2-2': ['pivot', 'theme', 'location'], 'own-100.1': ['pivot', 'theme', 'location'], 'want-32.1': ['pivot', 'theme', 'location'], 'want-32.1-1': ['pivot', 'theme', 'location'], 'want-32.1-1-1': ['pivot', 'theme', 'location'], 'require-103': ['pivot', 'theme', 'source', 'location'], 'require-103-1': ['pivot', 'theme', 'source', 'location'], 'require-103-2': ['pivot', 'theme', 'source', 'location'], 'ensure-99': ['precondition', 'theme', 'beneficiary', 'location'], 'equip-13.4.2-1-1': ['recipient', 'theme', 'location'], 'substance_emission-43.4': ['source', 'theme', 'location'], 'substance_emission-43.4-1': ['source', 'theme', 'location'], 'amuse-31.1': ['stimulus', 'experiencer', 'location'], 'earn-54.6': ['theme', 'asset', 'location'], 'comprise-107.2': ['theme', 'attribute', 'location'], 'comprise-107.2-1': ['theme', 'attribute', 'location'], 'seem-109': ['theme', 'attribute', 'location'], 'seem-109-1': ['theme', 'attribute', 'location'], 'seem-109-1-1': ['theme', 'attribute', 'location'], 'seem-109-1-1-1': ['theme', 'attribute', 'location'], 'exceed-90': ['theme', 'co_theme', 'attribute', 'location'], 'representation-110.1': ['theme', 'co_theme', 'context', 'location'], 'bump-18.4': ['theme', 'co_theme', 'location'], 'bump-18.4-1': ['theme', 'co_theme', 'location'], 'cling-22.5': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8-1': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8-2': ['theme', 'co_theme', 'location'], 'differ-23.4': ['theme', 'co_theme', 'location'], 'harmonize-22.6': ['theme', 'co_theme', 'location'], 'relate-86.2': ['theme', 'co_theme', 'location'], 'relate-86.2-1': ['theme', 'co_theme', 'location'], 'relate-86.2-2': ['theme', 'co_theme', 'location'], 'substitute-13.6.2': ['theme', 'co_theme', ['source', 'co_goal'], ['co_source', 'goal'], ['location']], 'substitute-13.6.2-1': ['theme', 'co_theme', ['source', 'goal'], ['co_source', 'co_goal'], ['location']], 'escape-51.1-1-2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'nonvehicle-51.4.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'rotate-51.9.1': ['theme', 'extent', 'initial_location', 'trajectory', 'location'], 'attend-107.4': ['theme', 'goal', 'location'], 'attend-107.4-1': ['theme', 'goal', 'location'], 'attend-107.4-2': ['theme', 'goal', 'location'], 'reach-51.8': ['theme', 'goal', 'source', 'trajectory', 'location'], 'escape-51.1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'escape-51.1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'escape-51.1-1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'appear-48.1.1': ['theme', 'location'], 'disfunction-105.2.2': ['theme', 'location'], 'entity_specific_modes_being-47.2': ['theme', 'location'], 'exist-47.1': ['theme', 'location'], 'function-105.2.1': ['theme', 'location'], 'lodge-46': ['theme', 'location'], 'meander-47.7': ['theme', 'location'], 'meander-47.7-1': ['theme', 'location'], 'occur-48.3': ['theme', 'location'], 'occur-48.3-1': ['theme', 'location'], 'occur-48.3-2': ['theme', 'location'], 'smell_emission-43.3': ['theme', 'location'], 'sound_existence-47.4': ['theme', 'location'], 'stop-55.4-1': ['theme', 'location'], 'swarm-47.5.1': ['theme', 'location'], 'swarm-47.5.1-1': ['theme', 'location'], 'swarm-47.5.1-2': ['theme', 'location'], 'swarm-47.5.1-2-1': ['theme', 'location'], 'terminus-47.9': ['theme', 'destination', 'location'], 'weather-57': ['theme', 'location'], 'weekend-56': ['theme', 'location'], 'spatial_configuration-47.6': ['theme', 'pos', 'location'], 'function-105.2.1-1': ['theme', 'predicate', 'location'], 'leave-51.2': ['theme', 'source', 'goal', 'trajectory', 'location'], 'leave-51.2-1': ['theme', 'source', 'goal', 'trajectory', 'location'], 'escape-51.1-1-3': ['theme', 'trajectory', 'destination', 'initial_location', 'location'], 'register-54.1': ['theme', 'value', 'location'], 'register-54.1-1-1': ['theme', 'value', 'location'], 'exist-47.1-1': ['theme', ['pivot', 'manner'], 'location'], 'rob-10.6.4': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'steal-10.5': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'steal-10.5-1': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'render-29.90': [['agent', 'causer'], 'patient', 'result', 'source', 'location'], 'throw-17.1-1-1': [['agent', 'causer'], 'theme', 'result', 'location'], 'exchange-13.6.1': [['agent', 'co_goal', 'source'], ['co_agent', 'goal', 'co_source'], 'theme', 'co_theme', 'location'], 'talk-37.5': [['agent', 'co_recipient', 'source'], ['co_agent', 'co_source', 'recipient'], 'topic', 'location'], 'get-13.5.1': [['agent', 'goal'], 'theme', 'beneficiary', 'source', 'asset', 'location'], 'absorb-39.8': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1-1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'deprive-10.6.2': [['agent', 'goal'], 'theme', 'source', 'location'], 'get-13.5.1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'learn-14': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-2': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-2-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'interrogate-37.1.3': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'attribute', 'location'], 'inquire-37.1.2': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'location'], 'throw-17.1': [['agent', 'initial_location'], 'theme', 'destination', 'location'], 'throw-17.1-1': [['agent', 'initial_location'], 'theme', 'destination', 'location'], 'bring-11.3': [['agent', 'instrument'], 'theme', 'destination', 'initial_location', 'location'], 'obtain-13.5.2-1': [['agent', 'recipient'], 'theme', 'source', 'asset', 'location'], 'berry-13.7': [['agent', 'recipient'], 'theme', 'source', 'location'], 'obtain-13.5.2': [['agent', 'recipient'], 'theme', 'source', 'location'], 'chit_chat-37.6': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'], 'chit_chat-37.6-1': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'], 'consume-66': [['agent', 'source'], 'asset', 'goal', 'location'], 'consume-66-1': [['agent', 'source'], 'asset', 'goal', 'location'], 'wink-40.3.1': [['agent', 'source'], 'patient', 'recipient', 'theme', 'location'], 'crane-40.3.2': [['agent', 'source'], 'patient', 'recipient', 'topic', 'location'], 'contribute-13.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-1-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'equip-13.4.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'equip-13.4.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'nonverbal_expression-40.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'advise-37.9': [['agent', 'source'], 'recipient', 'topic', 'location'], 'advise-37.9-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'complain-37.8': [['agent', 'source'], 'recipient', 'topic', 'location'], 'confess-37.10': [['agent', 'source'], 'recipient', 'topic', 'location'], 'curtsey-40.3.3': [['agent', 'source'], 'recipient', 'topic', 'location'], 'initiate_communication-37.4.2': [['agent', 'source'], 'recipient', 'topic', 'location'], 'initiate_communication-37.4.2-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'promise-37.13': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1-1-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'pay-68': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'], 'pay-68-1': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'], 'breathe-40.1.2': [['agent', 'source'], 'theme', 'destination', 'location'], 'give-13.1-1': [['agent', 'source'], 'theme', 'recipient', 'asset', 'location'], 'fulfilling-13.4.1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'fulfilling-13.4.1-1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'fulfilling-13.4.1-2': [['agent', 'source'], 'theme', 'recipient', 'location'], 'give-13.1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'future_having-13.3': [['agent', 'source'], 'theme', ['beneficiary', 'goal'], 'location'], 'instr_communication-37.4.1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'manner_speaking-37.3': [['agent', 'source'], 'topic', 'recipient', 'manner', 'location'], 'say-37.7': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'tell-37.2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'overstate-37.12': [['agent', 'source'], ['theme', 'topic'], 'recipient', 'location'], 'orbit-51.9.2': [['theme', 'axis'], ['destination', 'initial_location'], 'trajectory', 'location']} |
__all__ = ["analyze_traffic",
"utils",
"manage_resolutions",
"url_regex_resolver",
"get_popular_urls",
"funnel_in_outs",
"funnel_stats",
"sankey_funnel",
"frequent_funnel",
"analyze_clicks",
"analyze_timing"]
| __all__ = ['analyze_traffic', 'utils', 'manage_resolutions', 'url_regex_resolver', 'get_popular_urls', 'funnel_in_outs', 'funnel_stats', 'sankey_funnel', 'frequent_funnel', 'analyze_clicks', 'analyze_timing'] |
#
# PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 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)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint")
ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment")
DomainId, FcNameIdOrZero, FcNameId = mibBuilder.importSymbols("CISCO-ST-TC", "DomainId", "FcNameIdOrZero", "FcNameId")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
Integer32, ModuleIdentity, NotificationType, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Gauge32, Unsigned32, TimeTicks, IpAddress, MibIdentifier, Counter32, ObjectIdentity, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "ModuleIdentity", "NotificationType", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Gauge32", "Unsigned32", "TimeTicks", "IpAddress", "MibIdentifier", "Counter32", "ObjectIdentity", "iso")
RowStatus, DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention", "TruthValue")
ciscoFcipMgmtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 96))
ciscoFcipMgmtMIB.setRevisions(('2003-05-19 00:00', '2002-10-05 00:00',))
if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setLastUpdated('200305190000Z')
if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setOrganization('Cisco Systems Inc.')
ciscoFcipObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1))
cfmFcipConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2))
cfmFcipConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1))
cfmFcipNotification = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2))
cfmFcipNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2, 0))
class CfmFcEntityMode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("ePortMode", 1), ("bPortMode", 2), ("other", 3))
cfmFcipDynIpConfType = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("slpv2", 1), ("none", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cfmFcipDynIpConfType.setStatus('current')
cfmFcipFabricWWN = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 2), FcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipFabricWWN.setStatus('current')
cfmFcipEntityInstanceTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3), )
if mibBuilder.loadTexts: cfmFcipEntityInstanceTable.setStatus('current')
cfmFcipEntityInstanceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"))
if mibBuilder.loadTexts: cfmFcipEntityInstanceEntry.setStatus('current')
cfmFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 1), Unsigned32())
if mibBuilder.loadTexts: cfmFcipEntityId.setStatus('current')
cfmFcipEntityAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 2), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipEntityAddressType.setStatus('current')
cfmFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 3), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipEntityAddress.setStatus('current')
cfmFcipEntityTcpConnPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipEntityTcpConnPort.setStatus('current')
cfmFcipEntitySACKOption = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipEntitySACKOption.setStatus('current')
cfmFcipEntitySeqNumWrap = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipEntitySeqNumWrap.setStatus('current')
cfmFcipEntityPHBSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 7), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipEntityPHBSupport.setStatus('current')
cfmFcipEntityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipEntityStatus.setStatus('current')
cfmFcipLinkTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4), )
if mibBuilder.loadTexts: cfmFcipLinkTable.setStatus('current')
cfmFcipLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex"))
if mibBuilder.loadTexts: cfmFcipLinkEntry.setStatus('current')
cfmFcipLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 1), Unsigned32())
if mibBuilder.loadTexts: cfmFcipLinkIndex.setStatus('current')
cfmFcipLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkIfIndex.setStatus('current')
cfmFcipLinkCost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkCost.setStatus('current')
cfmFcipLinkLocalFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 4), CfmFcEntityMode()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkLocalFcipEntityMode.setStatus('current')
cfmFcipLinkRemFcipEntityWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 5), FcNameIdOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityWWN.setStatus('current')
cfmFcipLinkRemFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityId.setStatus('current')
cfmFcipLinkRemFcipEntityAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 7), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddrType.setStatus('current')
cfmFcipLinkRemFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 8), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddress.setStatus('current')
cfmFcipLinkRemFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 9), CfmFcEntityMode()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityMode.setStatus('current')
cfmFcipLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipLinkStatus.setStatus('current')
cfmFcipTcpConnTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5), )
if mibBuilder.loadTexts: cfmFcipTcpConnTable.setStatus('current')
cfmFcipTcpConnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnLocalPort"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRemPort"))
if mibBuilder.loadTexts: cfmFcipTcpConnEntry.setStatus('current')
cfmFcipTcpConnLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)))
if mibBuilder.loadTexts: cfmFcipTcpConnLocalPort.setStatus('current')
cfmFcipTcpConnRemPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)))
if mibBuilder.loadTexts: cfmFcipTcpConnRemPort.setStatus('current')
cfmFcipTcpConnPurpose = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("control", 1), ("data", 2), ("both", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipTcpConnPurpose.setStatus('current')
cfmFcipTcpConnRWSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipTcpConnRWSize.setStatus('current')
cfmFcipTcpConnMSS = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipTcpConnMSS.setStatus('current')
cfmFcipTcpConnTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 6), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipTcpConnTimeOut.setStatus('current')
cfmFcipDynamicRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6), )
if mibBuilder.loadTexts: cfmFcipDynamicRouteTable.setStatus('current')
cfmFcipDynamicRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteIndex"))
if mibBuilder.loadTexts: cfmFcipDynamicRouteEntry.setStatus('current')
cfmFcipDynamicRouteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 1), Unsigned32())
if mibBuilder.loadTexts: cfmFcipDynamicRouteIndex.setStatus('current')
cfmFcipDynamicRouteDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 2), DomainId())
if mibBuilder.loadTexts: cfmFcipDynamicRouteDID.setStatus('current')
cfmFcipDynamicRouteLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipDynamicRouteLinkIndex.setStatus('current')
cfmFcipStaticRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7), )
if mibBuilder.loadTexts: cfmFcipStaticRouteTable.setStatus('current')
cfmFcipStaticRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtIndex"))
if mibBuilder.loadTexts: cfmFcipStaticRouteEntry.setStatus('current')
cfmFcipStaRtIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 1), Unsigned32())
if mibBuilder.loadTexts: cfmFcipStaRtIndex.setStatus('current')
cfmFcipStaRtDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 2), DomainId())
if mibBuilder.loadTexts: cfmFcipStaRtDID.setStatus('current')
cfmFcipStaRtRemFcipEntWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 3), FcNameId()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntWWN.setStatus('current')
cfmFcipStaRtRemFcipEntId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 4), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntId.setStatus('current')
cfmFcipStaRtRemFcipEntAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 5), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddrType.setStatus('current')
cfmFcipStaRtRemFcipEntAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 6), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddr.setStatus('current')
cfmFcipStaRtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cfmFcipStaRtStatus.setStatus('current')
cfmFcipLinkErrorsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8), )
if mibBuilder.loadTexts: cfmFcipLinkErrorsTable.setStatus('current')
cfmFcipLinkErrorsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex"))
if mibBuilder.loadTexts: cfmFcipLinkErrorsEntry.setStatus('current')
cfmFcipLinkFcipLossofFcSynchs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 1), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipLossofFcSynchs.setStatus('current')
cfmFcipLinkFcipSfNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSfNotRcv.setStatus('current')
cfmFcipLinkFcipSfRespNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespNotRcv.setStatus('current')
cfmFcipLinkFcipSfRespMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespMismatch.setStatus('current')
cfmFcipLinkFcipSfInvalidNonce = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidNonce.setStatus('current')
cfmFcipLinkFcipDuplicateSfRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 6), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipDuplicateSfRcv.setStatus('current')
cfmFcipLinkFcipSfInvalidWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 7), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidWWN.setStatus('current')
cfmFcipLinkFcipBB2LkaTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 8), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipBB2LkaTimeOut.setStatus('current')
cfmFcipLinkFcipSntpTimeStampExp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 9), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkFcipSntpTimeStampExp.setStatus('current')
cfmFcipLinkTcpTooManyErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 10), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkTcpTooManyErrors.setStatus('current')
cfmFcipLinkTcpKeepAliveTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 11), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkTcpKeepAliveTimeOut.setStatus('current')
cfmFcipLinkTcpExDatagramsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 12), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkTcpExDatagramsDropped.setStatus('current')
cfmFcipLinkTcpSaParamMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 13), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cfmFcipLinkTcpSaParamMismatch.setStatus('current')
cfmFcipCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1))
cfmFcipGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2))
cfmFcipCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityScalarGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityInstanceGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaticRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkErrorsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipCompliance = cfmFcipCompliance.setStatus('current')
cfmFcipEntityScalarGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynIpConfType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipFabricWWN"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipEntityScalarGroup = cfmFcipEntityScalarGroup.setStatus('current')
cfmFcipEntityInstanceGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 2)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddressType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityTcpConnPort"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySACKOption"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySeqNumWrap"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityPHBSupport"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipEntityInstanceGroup = cfmFcipEntityInstanceGroup.setStatus('current')
cfmFcipLinkGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 3)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIfIndex"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkCost"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkLocalFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipLinkGroup = cfmFcipLinkGroup.setStatus('current')
cfmFcipTcpConnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 4)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnPurpose"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRWSize"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnMSS"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnTimeOut"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipTcpConnGroup = cfmFcipTcpConnGroup.setStatus('current')
cfmFcipDynamicRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 5)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteLinkIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipDynamicRouteGroup = cfmFcipDynamicRouteGroup.setStatus('current')
cfmFcipStaticRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 6)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddr"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipStaticRouteGroup = cfmFcipStaticRouteGroup.setStatus('current')
cfmFcipLinkErrorsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 7)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipLossofFcSynchs"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespMismatch"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidNonce"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipDuplicateSfRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipBB2LkaTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSntpTimeStampExp"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpTooManyErrors"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpKeepAliveTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpExDatagramsDropped"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpSaParamMismatch"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfmFcipLinkErrorsGroup = cfmFcipLinkErrorsGroup.setStatus('current')
mibBuilder.exportSymbols("CISCO-FCIP-MGMT-MIB", cfmFcipLinkFcipBB2LkaTimeOut=cfmFcipLinkFcipBB2LkaTimeOut, PYSNMP_MODULE_ID=ciscoFcipMgmtMIB, cfmFcipLinkTable=cfmFcipLinkTable, cfmFcipStaRtRemFcipEntAddrType=cfmFcipStaRtRemFcipEntAddrType, cfmFcipLinkRemFcipEntityAddrType=cfmFcipLinkRemFcipEntityAddrType, cfmFcipTcpConnPurpose=cfmFcipTcpConnPurpose, cfmFcipEntityStatus=cfmFcipEntityStatus, cfmFcipLinkFcipSfInvalidWWN=cfmFcipLinkFcipSfInvalidWWN, cfmFcipTcpConnTimeOut=cfmFcipTcpConnTimeOut, cfmFcipLinkTcpTooManyErrors=cfmFcipLinkTcpTooManyErrors, cfmFcipLinkGroup=cfmFcipLinkGroup, cfmFcipLinkEntry=cfmFcipLinkEntry, cfmFcipEntityAddress=cfmFcipEntityAddress, cfmFcipStaRtDID=cfmFcipStaRtDID, cfmFcipLinkErrorsEntry=cfmFcipLinkErrorsEntry, cfmFcipFabricWWN=cfmFcipFabricWWN, cfmFcipCompliance=cfmFcipCompliance, cfmFcipDynamicRouteEntry=cfmFcipDynamicRouteEntry, cfmFcipTcpConnEntry=cfmFcipTcpConnEntry, cfmFcipGroups=cfmFcipGroups, cfmFcipDynamicRouteDID=cfmFcipDynamicRouteDID, CfmFcEntityMode=CfmFcEntityMode, cfmFcipLinkStatus=cfmFcipLinkStatus, cfmFcipNotifications=cfmFcipNotifications, cfmFcipLinkRemFcipEntityId=cfmFcipLinkRemFcipEntityId, cfmFcipTcpConnGroup=cfmFcipTcpConnGroup, cfmFcipTcpConnMSS=cfmFcipTcpConnMSS, cfmFcipStaRtRemFcipEntAddr=cfmFcipStaRtRemFcipEntAddr, cfmFcipLinkErrorsTable=cfmFcipLinkErrorsTable, cfmFcipEntityPHBSupport=cfmFcipEntityPHBSupport, cfmFcipTcpConnRemPort=cfmFcipTcpConnRemPort, cfmFcipDynamicRouteTable=cfmFcipDynamicRouteTable, cfmFcipLinkLocalFcipEntityMode=cfmFcipLinkLocalFcipEntityMode, ciscoFcipMgmtMIB=ciscoFcipMgmtMIB, cfmFcipLinkFcipSfRespNotRcv=cfmFcipLinkFcipSfRespNotRcv, cfmFcipEntityId=cfmFcipEntityId, cfmFcipLinkTcpSaParamMismatch=cfmFcipLinkTcpSaParamMismatch, cfmFcipLinkFcipDuplicateSfRcv=cfmFcipLinkFcipDuplicateSfRcv, cfmFcipEntityInstanceTable=cfmFcipEntityInstanceTable, cfmFcipConfig=cfmFcipConfig, cfmFcipEntityAddressType=cfmFcipEntityAddressType, cfmFcipLinkFcipSntpTimeStampExp=cfmFcipLinkFcipSntpTimeStampExp, cfmFcipLinkFcipSfInvalidNonce=cfmFcipLinkFcipSfInvalidNonce, ciscoFcipObjects=ciscoFcipObjects, cfmFcipDynamicRouteLinkIndex=cfmFcipDynamicRouteLinkIndex, cfmFcipTcpConnLocalPort=cfmFcipTcpConnLocalPort, cfmFcipEntitySeqNumWrap=cfmFcipEntitySeqNumWrap, cfmFcipLinkRemFcipEntityWWN=cfmFcipLinkRemFcipEntityWWN, cfmFcipConformance=cfmFcipConformance, cfmFcipTcpConnRWSize=cfmFcipTcpConnRWSize, cfmFcipStaRtIndex=cfmFcipStaRtIndex, cfmFcipLinkRemFcipEntityAddress=cfmFcipLinkRemFcipEntityAddress, cfmFcipNotification=cfmFcipNotification, cfmFcipLinkTcpKeepAliveTimeOut=cfmFcipLinkTcpKeepAliveTimeOut, cfmFcipEntitySACKOption=cfmFcipEntitySACKOption, cfmFcipDynIpConfType=cfmFcipDynIpConfType, cfmFcipStaRtRemFcipEntWWN=cfmFcipStaRtRemFcipEntWWN, cfmFcipLinkFcipSfRespMismatch=cfmFcipLinkFcipSfRespMismatch, cfmFcipLinkFcipLossofFcSynchs=cfmFcipLinkFcipLossofFcSynchs, cfmFcipEntityInstanceEntry=cfmFcipEntityInstanceEntry, cfmFcipLinkTcpExDatagramsDropped=cfmFcipLinkTcpExDatagramsDropped, cfmFcipStaticRouteEntry=cfmFcipStaticRouteEntry, cfmFcipEntityScalarGroup=cfmFcipEntityScalarGroup, cfmFcipLinkRemFcipEntityMode=cfmFcipLinkRemFcipEntityMode, cfmFcipCompliances=cfmFcipCompliances, cfmFcipLinkIndex=cfmFcipLinkIndex, cfmFcipTcpConnTable=cfmFcipTcpConnTable, cfmFcipLinkCost=cfmFcipLinkCost, cfmFcipStaRtStatus=cfmFcipStaRtStatus, cfmFcipDynamicRouteGroup=cfmFcipDynamicRouteGroup, cfmFcipDynamicRouteIndex=cfmFcipDynamicRouteIndex, cfmFcipLinkFcipSfNotRcv=cfmFcipLinkFcipSfNotRcv, cfmFcipEntityTcpConnPort=cfmFcipEntityTcpConnPort, cfmFcipEntityInstanceGroup=cfmFcipEntityInstanceGroup, cfmFcipStaticRouteGroup=cfmFcipStaticRouteGroup, cfmFcipLinkErrorsGroup=cfmFcipLinkErrorsGroup, cfmFcipLinkIfIndex=cfmFcipLinkIfIndex, cfmFcipStaRtRemFcipEntId=cfmFcipStaRtRemFcipEntId, cfmFcipStaticRouteTable=cfmFcipStaticRouteTable)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint')
(cisco_experiment,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoExperiment')
(domain_id, fc_name_id_or_zero, fc_name_id) = mibBuilder.importSymbols('CISCO-ST-TC', 'DomainId', 'FcNameIdOrZero', 'FcNameId')
(inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType')
(object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup')
(integer32, module_identity, notification_type, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, gauge32, unsigned32, time_ticks, ip_address, mib_identifier, counter32, object_identity, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'ModuleIdentity', 'NotificationType', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Gauge32', 'Unsigned32', 'TimeTicks', 'IpAddress', 'MibIdentifier', 'Counter32', 'ObjectIdentity', 'iso')
(row_status, display_string, textual_convention, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention', 'TruthValue')
cisco_fcip_mgmt_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 10, 96))
ciscoFcipMgmtMIB.setRevisions(('2003-05-19 00:00', '2002-10-05 00:00'))
if mibBuilder.loadTexts:
ciscoFcipMgmtMIB.setLastUpdated('200305190000Z')
if mibBuilder.loadTexts:
ciscoFcipMgmtMIB.setOrganization('Cisco Systems Inc.')
cisco_fcip_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1))
cfm_fcip_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2))
cfm_fcip_config = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1))
cfm_fcip_notification = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2))
cfm_fcip_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2, 0))
class Cfmfcentitymode(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('ePortMode', 1), ('bPortMode', 2), ('other', 3))
cfm_fcip_dyn_ip_conf_type = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('slpv2', 1), ('none', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cfmFcipDynIpConfType.setStatus('current')
cfm_fcip_fabric_wwn = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 2), fc_name_id_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipFabricWWN.setStatus('current')
cfm_fcip_entity_instance_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3))
if mibBuilder.loadTexts:
cfmFcipEntityInstanceTable.setStatus('current')
cfm_fcip_entity_instance_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'))
if mibBuilder.loadTexts:
cfmFcipEntityInstanceEntry.setStatus('current')
cfm_fcip_entity_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 1), unsigned32())
if mibBuilder.loadTexts:
cfmFcipEntityId.setStatus('current')
cfm_fcip_entity_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 2), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipEntityAddressType.setStatus('current')
cfm_fcip_entity_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 3), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipEntityAddress.setStatus('current')
cfm_fcip_entity_tcp_conn_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipEntityTcpConnPort.setStatus('current')
cfm_fcip_entity_sack_option = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipEntitySACKOption.setStatus('current')
cfm_fcip_entity_seq_num_wrap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipEntitySeqNumWrap.setStatus('current')
cfm_fcip_entity_phb_support = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 7), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipEntityPHBSupport.setStatus('current')
cfm_fcip_entity_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 8), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipEntityStatus.setStatus('current')
cfm_fcip_link_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4))
if mibBuilder.loadTexts:
cfmFcipLinkTable.setStatus('current')
cfm_fcip_link_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex'))
if mibBuilder.loadTexts:
cfmFcipLinkEntry.setStatus('current')
cfm_fcip_link_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 1), unsigned32())
if mibBuilder.loadTexts:
cfmFcipLinkIndex.setStatus('current')
cfm_fcip_link_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkIfIndex.setStatus('current')
cfm_fcip_link_cost = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkCost.setStatus('current')
cfm_fcip_link_local_fcip_entity_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 4), cfm_fc_entity_mode()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkLocalFcipEntityMode.setStatus('current')
cfm_fcip_link_rem_fcip_entity_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 5), fc_name_id_or_zero()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkRemFcipEntityWWN.setStatus('current')
cfm_fcip_link_rem_fcip_entity_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkRemFcipEntityId.setStatus('current')
cfm_fcip_link_rem_fcip_entity_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 7), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkRemFcipEntityAddrType.setStatus('current')
cfm_fcip_link_rem_fcip_entity_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 8), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkRemFcipEntityAddress.setStatus('current')
cfm_fcip_link_rem_fcip_entity_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 9), cfm_fc_entity_mode()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkRemFcipEntityMode.setStatus('current')
cfm_fcip_link_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 10), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipLinkStatus.setStatus('current')
cfm_fcip_tcp_conn_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5))
if mibBuilder.loadTexts:
cfmFcipTcpConnTable.setStatus('current')
cfm_fcip_tcp_conn_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnLocalPort'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnRemPort'))
if mibBuilder.loadTexts:
cfmFcipTcpConnEntry.setStatus('current')
cfm_fcip_tcp_conn_local_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)))
if mibBuilder.loadTexts:
cfmFcipTcpConnLocalPort.setStatus('current')
cfm_fcip_tcp_conn_rem_port = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)))
if mibBuilder.loadTexts:
cfmFcipTcpConnRemPort.setStatus('current')
cfm_fcip_tcp_conn_purpose = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('control', 1), ('data', 2), ('both', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipTcpConnPurpose.setStatus('current')
cfm_fcip_tcp_conn_rw_size = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipTcpConnRWSize.setStatus('current')
cfm_fcip_tcp_conn_mss = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 5), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipTcpConnMSS.setStatus('current')
cfm_fcip_tcp_conn_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 6), unsigned32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipTcpConnTimeOut.setStatus('current')
cfm_fcip_dynamic_route_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6))
if mibBuilder.loadTexts:
cfmFcipDynamicRouteTable.setStatus('current')
cfm_fcip_dynamic_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteDID'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteIndex'))
if mibBuilder.loadTexts:
cfmFcipDynamicRouteEntry.setStatus('current')
cfm_fcip_dynamic_route_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 1), unsigned32())
if mibBuilder.loadTexts:
cfmFcipDynamicRouteIndex.setStatus('current')
cfm_fcip_dynamic_route_did = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 2), domain_id())
if mibBuilder.loadTexts:
cfmFcipDynamicRouteDID.setStatus('current')
cfm_fcip_dynamic_route_link_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipDynamicRouteLinkIndex.setStatus('current')
cfm_fcip_static_route_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7))
if mibBuilder.loadTexts:
cfmFcipStaticRouteTable.setStatus('current')
cfm_fcip_static_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtDID'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtIndex'))
if mibBuilder.loadTexts:
cfmFcipStaticRouteEntry.setStatus('current')
cfm_fcip_sta_rt_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 1), unsigned32())
if mibBuilder.loadTexts:
cfmFcipStaRtIndex.setStatus('current')
cfm_fcip_sta_rt_did = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 2), domain_id())
if mibBuilder.loadTexts:
cfmFcipStaRtDID.setStatus('current')
cfm_fcip_sta_rt_rem_fcip_ent_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 3), fc_name_id()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipStaRtRemFcipEntWWN.setStatus('current')
cfm_fcip_sta_rt_rem_fcip_ent_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 4), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipStaRtRemFcipEntId.setStatus('current')
cfm_fcip_sta_rt_rem_fcip_ent_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 5), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipStaRtRemFcipEntAddrType.setStatus('current')
cfm_fcip_sta_rt_rem_fcip_ent_addr = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 6), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipStaRtRemFcipEntAddr.setStatus('current')
cfm_fcip_sta_rt_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cfmFcipStaRtStatus.setStatus('current')
cfm_fcip_link_errors_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8))
if mibBuilder.loadTexts:
cfmFcipLinkErrorsTable.setStatus('current')
cfm_fcip_link_errors_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1)).setIndexNames((0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityId'), (0, 'CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIndex'))
if mibBuilder.loadTexts:
cfmFcipLinkErrorsEntry.setStatus('current')
cfm_fcip_link_fcip_lossof_fc_synchs = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 1), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipLossofFcSynchs.setStatus('current')
cfm_fcip_link_fcip_sf_not_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 2), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSfNotRcv.setStatus('current')
cfm_fcip_link_fcip_sf_resp_not_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 3), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSfRespNotRcv.setStatus('current')
cfm_fcip_link_fcip_sf_resp_mismatch = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSfRespMismatch.setStatus('current')
cfm_fcip_link_fcip_sf_invalid_nonce = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 5), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSfInvalidNonce.setStatus('current')
cfm_fcip_link_fcip_duplicate_sf_rcv = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 6), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipDuplicateSfRcv.setStatus('current')
cfm_fcip_link_fcip_sf_invalid_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 7), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSfInvalidWWN.setStatus('current')
cfm_fcip_link_fcip_bb2_lka_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 8), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipBB2LkaTimeOut.setStatus('current')
cfm_fcip_link_fcip_sntp_time_stamp_exp = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 9), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkFcipSntpTimeStampExp.setStatus('current')
cfm_fcip_link_tcp_too_many_errors = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 10), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkTcpTooManyErrors.setStatus('current')
cfm_fcip_link_tcp_keep_alive_time_out = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 11), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkTcpKeepAliveTimeOut.setStatus('current')
cfm_fcip_link_tcp_ex_datagrams_dropped = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 12), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkTcpExDatagramsDropped.setStatus('current')
cfm_fcip_link_tcp_sa_param_mismatch = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 13), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cfmFcipLinkTcpSaParamMismatch.setStatus('current')
cfm_fcip_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1))
cfm_fcip_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2))
cfm_fcip_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1, 1)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityScalarGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityInstanceGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaticRouteGroup'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkErrorsGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_compliance = cfmFcipCompliance.setStatus('current')
cfm_fcip_entity_scalar_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 1)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynIpConfType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipFabricWWN'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_entity_scalar_group = cfmFcipEntityScalarGroup.setStatus('current')
cfm_fcip_entity_instance_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 2)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityAddressType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityAddress'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityTcpConnPort'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntitySACKOption'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntitySeqNumWrap'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityPHBSupport'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipEntityStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_entity_instance_group = cfmFcipEntityInstanceGroup.setStatus('current')
cfm_fcip_link_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 3)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkIfIndex'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkCost'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkLocalFcipEntityMode'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityId'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityAddrType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityAddress'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkRemFcipEntityMode'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_link_group = cfmFcipLinkGroup.setStatus('current')
cfm_fcip_tcp_conn_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 4)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnPurpose'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnRWSize'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnMSS'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipTcpConnTimeOut'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_tcp_conn_group = cfmFcipTcpConnGroup.setStatus('current')
cfm_fcip_dynamic_route_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 5)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipDynamicRouteLinkIndex'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_dynamic_route_group = cfmFcipDynamicRouteGroup.setStatus('current')
cfm_fcip_static_route_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 6)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntId'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntAddrType'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtRemFcipEntAddr'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipStaRtStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_static_route_group = cfmFcipStaticRouteGroup.setStatus('current')
cfm_fcip_link_errors_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 7)).setObjects(('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipLossofFcSynchs'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfNotRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfRespNotRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfRespMismatch'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfInvalidNonce'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipDuplicateSfRcv'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSfInvalidWWN'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipBB2LkaTimeOut'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkFcipSntpTimeStampExp'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpTooManyErrors'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpKeepAliveTimeOut'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpExDatagramsDropped'), ('CISCO-FCIP-MGMT-MIB', 'cfmFcipLinkTcpSaParamMismatch'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cfm_fcip_link_errors_group = cfmFcipLinkErrorsGroup.setStatus('current')
mibBuilder.exportSymbols('CISCO-FCIP-MGMT-MIB', cfmFcipLinkFcipBB2LkaTimeOut=cfmFcipLinkFcipBB2LkaTimeOut, PYSNMP_MODULE_ID=ciscoFcipMgmtMIB, cfmFcipLinkTable=cfmFcipLinkTable, cfmFcipStaRtRemFcipEntAddrType=cfmFcipStaRtRemFcipEntAddrType, cfmFcipLinkRemFcipEntityAddrType=cfmFcipLinkRemFcipEntityAddrType, cfmFcipTcpConnPurpose=cfmFcipTcpConnPurpose, cfmFcipEntityStatus=cfmFcipEntityStatus, cfmFcipLinkFcipSfInvalidWWN=cfmFcipLinkFcipSfInvalidWWN, cfmFcipTcpConnTimeOut=cfmFcipTcpConnTimeOut, cfmFcipLinkTcpTooManyErrors=cfmFcipLinkTcpTooManyErrors, cfmFcipLinkGroup=cfmFcipLinkGroup, cfmFcipLinkEntry=cfmFcipLinkEntry, cfmFcipEntityAddress=cfmFcipEntityAddress, cfmFcipStaRtDID=cfmFcipStaRtDID, cfmFcipLinkErrorsEntry=cfmFcipLinkErrorsEntry, cfmFcipFabricWWN=cfmFcipFabricWWN, cfmFcipCompliance=cfmFcipCompliance, cfmFcipDynamicRouteEntry=cfmFcipDynamicRouteEntry, cfmFcipTcpConnEntry=cfmFcipTcpConnEntry, cfmFcipGroups=cfmFcipGroups, cfmFcipDynamicRouteDID=cfmFcipDynamicRouteDID, CfmFcEntityMode=CfmFcEntityMode, cfmFcipLinkStatus=cfmFcipLinkStatus, cfmFcipNotifications=cfmFcipNotifications, cfmFcipLinkRemFcipEntityId=cfmFcipLinkRemFcipEntityId, cfmFcipTcpConnGroup=cfmFcipTcpConnGroup, cfmFcipTcpConnMSS=cfmFcipTcpConnMSS, cfmFcipStaRtRemFcipEntAddr=cfmFcipStaRtRemFcipEntAddr, cfmFcipLinkErrorsTable=cfmFcipLinkErrorsTable, cfmFcipEntityPHBSupport=cfmFcipEntityPHBSupport, cfmFcipTcpConnRemPort=cfmFcipTcpConnRemPort, cfmFcipDynamicRouteTable=cfmFcipDynamicRouteTable, cfmFcipLinkLocalFcipEntityMode=cfmFcipLinkLocalFcipEntityMode, ciscoFcipMgmtMIB=ciscoFcipMgmtMIB, cfmFcipLinkFcipSfRespNotRcv=cfmFcipLinkFcipSfRespNotRcv, cfmFcipEntityId=cfmFcipEntityId, cfmFcipLinkTcpSaParamMismatch=cfmFcipLinkTcpSaParamMismatch, cfmFcipLinkFcipDuplicateSfRcv=cfmFcipLinkFcipDuplicateSfRcv, cfmFcipEntityInstanceTable=cfmFcipEntityInstanceTable, cfmFcipConfig=cfmFcipConfig, cfmFcipEntityAddressType=cfmFcipEntityAddressType, cfmFcipLinkFcipSntpTimeStampExp=cfmFcipLinkFcipSntpTimeStampExp, cfmFcipLinkFcipSfInvalidNonce=cfmFcipLinkFcipSfInvalidNonce, ciscoFcipObjects=ciscoFcipObjects, cfmFcipDynamicRouteLinkIndex=cfmFcipDynamicRouteLinkIndex, cfmFcipTcpConnLocalPort=cfmFcipTcpConnLocalPort, cfmFcipEntitySeqNumWrap=cfmFcipEntitySeqNumWrap, cfmFcipLinkRemFcipEntityWWN=cfmFcipLinkRemFcipEntityWWN, cfmFcipConformance=cfmFcipConformance, cfmFcipTcpConnRWSize=cfmFcipTcpConnRWSize, cfmFcipStaRtIndex=cfmFcipStaRtIndex, cfmFcipLinkRemFcipEntityAddress=cfmFcipLinkRemFcipEntityAddress, cfmFcipNotification=cfmFcipNotification, cfmFcipLinkTcpKeepAliveTimeOut=cfmFcipLinkTcpKeepAliveTimeOut, cfmFcipEntitySACKOption=cfmFcipEntitySACKOption, cfmFcipDynIpConfType=cfmFcipDynIpConfType, cfmFcipStaRtRemFcipEntWWN=cfmFcipStaRtRemFcipEntWWN, cfmFcipLinkFcipSfRespMismatch=cfmFcipLinkFcipSfRespMismatch, cfmFcipLinkFcipLossofFcSynchs=cfmFcipLinkFcipLossofFcSynchs, cfmFcipEntityInstanceEntry=cfmFcipEntityInstanceEntry, cfmFcipLinkTcpExDatagramsDropped=cfmFcipLinkTcpExDatagramsDropped, cfmFcipStaticRouteEntry=cfmFcipStaticRouteEntry, cfmFcipEntityScalarGroup=cfmFcipEntityScalarGroup, cfmFcipLinkRemFcipEntityMode=cfmFcipLinkRemFcipEntityMode, cfmFcipCompliances=cfmFcipCompliances, cfmFcipLinkIndex=cfmFcipLinkIndex, cfmFcipTcpConnTable=cfmFcipTcpConnTable, cfmFcipLinkCost=cfmFcipLinkCost, cfmFcipStaRtStatus=cfmFcipStaRtStatus, cfmFcipDynamicRouteGroup=cfmFcipDynamicRouteGroup, cfmFcipDynamicRouteIndex=cfmFcipDynamicRouteIndex, cfmFcipLinkFcipSfNotRcv=cfmFcipLinkFcipSfNotRcv, cfmFcipEntityTcpConnPort=cfmFcipEntityTcpConnPort, cfmFcipEntityInstanceGroup=cfmFcipEntityInstanceGroup, cfmFcipStaticRouteGroup=cfmFcipStaticRouteGroup, cfmFcipLinkErrorsGroup=cfmFcipLinkErrorsGroup, cfmFcipLinkIfIndex=cfmFcipLinkIfIndex, cfmFcipStaRtRemFcipEntId=cfmFcipStaRtRemFcipEntId, cfmFcipStaticRouteTable=cfmFcipStaticRouteTable) |
class unionFindSet:
def __init__(self, S):
self.S = {i: i for i in S}
self.size = {i: 1 for i in S}
def find(self, x):
if x != self.S[x]:
self.S[x] = self.find(self.S[x])
return self.S[x]
def union(self, a, b, key=lambda x: x):
x, y = sorted((self.find(a), self.find(b)), key=key)
self.S[y] = x
if x != y:
self.size[x] += self.size[y]
def getSize(self, x):
return self.size[self.find(x)]
| class Unionfindset:
def __init__(self, S):
self.S = {i: i for i in S}
self.size = {i: 1 for i in S}
def find(self, x):
if x != self.S[x]:
self.S[x] = self.find(self.S[x])
return self.S[x]
def union(self, a, b, key=lambda x: x):
(x, y) = sorted((self.find(a), self.find(b)), key=key)
self.S[y] = x
if x != y:
self.size[x] += self.size[y]
def get_size(self, x):
return self.size[self.find(x)] |
"""
---For Bolinger Trade Strategy---
1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not
2. If Yes then returns TRUE else returns FALSE
"""
def check_data(product,time_start,time_end,date1,session,mid_price,side):
query_fetch_tick_data="select type,price,is_block from data where xric=? and date1=? and time1>=? and time1<=? allow filtering"
p = session.prepare(query_fetch_tick_data)
tick_data = session.execute(p,(product,date1,time_start,time_end))
for item in tick_data:
if item[1]!=None and item[2]!=True:
if item[0]=='Trade':
if side=='buy':
if item[1]<=mid_price:
return True
else:
return False
else:
if item[1]>=mid_price:
return True
else:
return False
return False
| """
---For Bolinger Trade Strategy---
1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not
2. If Yes then returns TRUE else returns FALSE
"""
def check_data(product, time_start, time_end, date1, session, mid_price, side):
query_fetch_tick_data = 'select type,price,is_block from data where xric=? and date1=? and time1>=? and time1<=? allow filtering'
p = session.prepare(query_fetch_tick_data)
tick_data = session.execute(p, (product, date1, time_start, time_end))
for item in tick_data:
if item[1] != None and item[2] != True:
if item[0] == 'Trade':
if side == 'buy':
if item[1] <= mid_price:
return True
else:
return False
elif item[1] >= mid_price:
return True
else:
return False
return False |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 9 15:15:50 2020
@author: Patrick
"""
"""Implementation of Fast Orthogonal Search"""
#==============================================
#candidates_generation.py
#==============================================
def CandidatePool_Generation(x_train, y_train, K, L):
Candidates = []
# x[n-l], l = 0,...,10 (11 Candidates)
for l in range(0, L+1):
zero_list = l * [0]
data_list = x_train[:len(x_train)-l]
xn_l = [*zero_list, *data_list]
Candidates.append(xn_l)
# y[n-k], l = 1,...,10 (10 Candidates)
for k in range(1, K+1):
zero_list = k * [0]
data_list = y_train[:len(y_train)-k]
yn_k = [*zero_list, *data_list]
Candidates.append(yn_k)
# x[n-l1]x[n-l2], l1 = 0,...,10
# l2 = l1,...,10 (66 Candidates)
for l1 in range(0, L+1):
for l2 in range(l1, L+1):
zero_list_l1 = l1 * [0]
zero_list_l2 = l2 * [0]
data_list_l1 = x_train[:len(x_train)-l1]
data_list_l2 = x_train[:len(x_train)-l2]
xn_l1 = [*zero_list_l1, *data_list_l1]
xn_l2 = [*zero_list_l2, *data_list_l2]
Candidates.append([i*j for i,j in zip(xn_l1,xn_l2)])
# y[n-l1]y[n-l2], k1 = 1,...,10
# k2 = k1,...,10 (55 Candidates)
for k1 in range(1, K+1):
for k2 in range(k1, K+1):
zero_list_k1 = k1 * [0]
zero_list_k2 = k2 * [0]
data_list_k1 = y_train[:len(y_train)-k1]
data_list_k2 = y_train[:len(y_train)-k2]
yn_k1 = [*zero_list_k1, *data_list_k1]
yn_k2 = [*zero_list_k2, *data_list_k2]
Candidates.append([i*j for i,j in zip(yn_k1,yn_k2)])
# x[n-l]y[n-k], l = 1,...,10
# k = 1,...,10 (110 Candidates)
for l in range(0, L+1):
for k in range(1, K+1):
zero_list_l = l * [0]
zero_list_k = k * [0]
data_list_l = x_train[:len(x_train)-l]
data_list_k = y_train[:len(y_train)-k]
xn_l = [*zero_list_l, *data_list_l]
yn_k = [*zero_list_k, *data_list_k]
Candidates.append([i*j for i,j in zip(xn_l,yn_k)])
return Candidates
#
| """
Created on Tue Apr 9 15:15:50 2020
@author: Patrick
"""
'Implementation of Fast Orthogonal Search'
def candidate_pool__generation(x_train, y_train, K, L):
candidates = []
for l in range(0, L + 1):
zero_list = l * [0]
data_list = x_train[:len(x_train) - l]
xn_l = [*zero_list, *data_list]
Candidates.append(xn_l)
for k in range(1, K + 1):
zero_list = k * [0]
data_list = y_train[:len(y_train) - k]
yn_k = [*zero_list, *data_list]
Candidates.append(yn_k)
for l1 in range(0, L + 1):
for l2 in range(l1, L + 1):
zero_list_l1 = l1 * [0]
zero_list_l2 = l2 * [0]
data_list_l1 = x_train[:len(x_train) - l1]
data_list_l2 = x_train[:len(x_train) - l2]
xn_l1 = [*zero_list_l1, *data_list_l1]
xn_l2 = [*zero_list_l2, *data_list_l2]
Candidates.append([i * j for (i, j) in zip(xn_l1, xn_l2)])
for k1 in range(1, K + 1):
for k2 in range(k1, K + 1):
zero_list_k1 = k1 * [0]
zero_list_k2 = k2 * [0]
data_list_k1 = y_train[:len(y_train) - k1]
data_list_k2 = y_train[:len(y_train) - k2]
yn_k1 = [*zero_list_k1, *data_list_k1]
yn_k2 = [*zero_list_k2, *data_list_k2]
Candidates.append([i * j for (i, j) in zip(yn_k1, yn_k2)])
for l in range(0, L + 1):
for k in range(1, K + 1):
zero_list_l = l * [0]
zero_list_k = k * [0]
data_list_l = x_train[:len(x_train) - l]
data_list_k = y_train[:len(y_train) - k]
xn_l = [*zero_list_l, *data_list_l]
yn_k = [*zero_list_k, *data_list_k]
Candidates.append([i * j for (i, j) in zip(xn_l, yn_k)])
return Candidates |
"""
This package includes the internal APIs for PySpark about interoperability
between pandas, PySpark and PyArrow. This package should not be directly
imported and used.
"""
| """
This package includes the internal APIs for PySpark about interoperability
between pandas, PySpark and PyArrow. This package should not be directly
imported and used.
""" |
class Solution:
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
ret = []
curr = []
def generate(curr_pos):
if len(curr) == k:
ret.append(curr[:])
else:
for i in range(curr_pos, n):
curr.append(i + 1)
generate(i + 1)
curr.pop()
generate(0)
return ret
| class Solution:
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
ret = []
curr = []
def generate(curr_pos):
if len(curr) == k:
ret.append(curr[:])
else:
for i in range(curr_pos, n):
curr.append(i + 1)
generate(i + 1)
curr.pop()
generate(0)
return ret |
registered = False
api_key = None
environment = None
log_404 = False
log_403 = False
log_405 = False
use_ssl = False | registered = False
api_key = None
environment = None
log_404 = False
log_403 = False
log_405 = False
use_ssl = False |
pytest_plugins = [
"polygon.tests.fixtures",
"polygon.plugins.tests.fixtures",
"polygon.graphql.tests.fixtures",
]
| pytest_plugins = ['polygon.tests.fixtures', 'polygon.plugins.tests.fixtures', 'polygon.graphql.tests.fixtures'] |
ry = 0
def setup():
size(800, 800, P3D)
global obj, texture1
texture1 = loadImage("texture.jpg")
obj = loadShape("man.obj")
def draw():
global ry
background(0)
lights()
translate(width / 2, height / 2 + 200, -200)
rotateZ(PI)
rotateY(ry)
scale(25)
# Orange point light on the right
pointLight(150, 100, 0, # Color
200, -150, 0) # Position
# Blue directional light from the left
directionalLight(0, 102, 255, # Color
1, 0, 0) # The x-, y-, z-axis direction
# Yellow spotlight from the front
spotLight(255, 255, 109, # Color
0, 40, 200, # Position
0, 10, 5, # Direction
90, 2) # Angle, concentration
ambientLight(255, 0, 0);
texture(texture1)
shape(obj)
box(100, 100, 200)
ry += 0.02
| ry = 0
def setup():
size(800, 800, P3D)
global obj, texture1
texture1 = load_image('texture.jpg')
obj = load_shape('man.obj')
def draw():
global ry
background(0)
lights()
translate(width / 2, height / 2 + 200, -200)
rotate_z(PI)
rotate_y(ry)
scale(25)
point_light(150, 100, 0, 200, -150, 0)
directional_light(0, 102, 255, 1, 0, 0)
spot_light(255, 255, 109, 0, 40, 200, 0, 10, 5, 90, 2)
ambient_light(255, 0, 0)
texture(texture1)
shape(obj)
box(100, 100, 200)
ry += 0.02 |
"""*****************************************************************************
* Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to comply with third party license terms applicable to your
* use of third party software (including open source software) that may
* accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
* BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
* ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*****************************************************************************"""
global flashNames
global ram_start
global ram_size
global flash_start
global flash_size
global flash_erase_size
global btl_start
flash_start = 0
flash_size = 0
flash_erase_size = 0
btl_start = "0x0"
NvmMemoryNames = ["NVM", "NVMCTRL", "EFC", "HEFC"]
FlashNames = ["FLASH", "IFLASH"]
RamNames = ["HSRAM", "HRAMC0", "HMCRAMC0", "IRAM", "FlexRAM"]
addr_space = ATDF.getNode("/avr-tools-device-file/devices/device/address-spaces/address-space")
addr_space_children = addr_space.getChildren()
periphNode = ATDF.getNode("/avr-tools-device-file/devices/device/peripherals")
peripherals = periphNode.getChildren()
for mem_idx in range(0, len(addr_space_children)):
mem_seg = addr_space_children[mem_idx].getAttribute("name")
mem_type = addr_space_children[mem_idx].getAttribute("type")
if ((any(x == mem_seg for x in FlashNames) == True) and (mem_type == "flash")):
flash_start = int(addr_space_children[mem_idx].getAttribute("start"), 16)
flash_size = int(addr_space_children[mem_idx].getAttribute("size"), 16)
if ((any(x == mem_seg for x in RamNames) == True) and (mem_type == "ram")):
ram_start = addr_space_children[mem_idx].getAttribute("start")
ram_size = addr_space_children[mem_idx].getAttribute("size")
btl_start = str(flash_start)
def activateAndConnectDependencies(component):
nvmMemoryName = ""
for module in range (0, len(peripherals)):
periphName = str(peripherals[module].getAttribute("name"))
if ((any(x == periphName for x in NvmMemoryNames) == True)):
nvmMemoryName = periphName.lower()
break
nvmMemoryCapabilityId = nvmMemoryName.upper() + "_MEMORY"
btlActivateTable = [nvmMemoryName]
btlConnectTable = [
[component, "btl_MEMORY_dependency", nvmMemoryName, nvmMemoryCapabilityId]
]
res = Database.activateComponents(btlActivateTable)
res = Database.connectDependencies(btlConnectTable)
def calcBootloaderSize():
global flash_erase_size
coreArch = Database.getSymbolValue("core", "CoreArchitecture")
# Get the Maximum bootloader size value defined in bootloader protocol python file
if (coreArch in btlSizes):
max_usb_btl_size = btlSizes[coreArch][0]
else:
return 0
btl_size = 0
if (flash_erase_size != 0):
if (flash_erase_size >= max_usb_btl_size):
btl_size = flash_erase_size
else:
btl_size = max_usb_btl_size
return btl_size
def setBootloaderSize(symbol, event):
btl_size = str(calcBootloaderSize())
symbol.setValue(btl_size)
if (btl_size != 0):
symbol.setVisible(True)
else:
symbol.setVisible(False)
def setAppStartAndCommentVisible(symbol, event):
global flash_start
global flash_size
global flash_erase_size
if (event["id"] == "BTL_SIZE"):
btlSize = int(event["value"],10)
if ((btlSize != 0) and (flash_erase_size != 0)):
appStartAligned = btlSize
# If the bootloader size is not aligned to Erase Block Size
if ((btlSize % flash_erase_size) != 0):
appStartAligned = btlSize + (flash_erase_size - (btlSize % flash_erase_size))
custom_app_start_addr = str(hex(flash_start + appStartAligned))
else:
custom_app_start_addr = str(hex(flash_start))
Database.setSymbolValue("core", "APP_START_ADDRESS", custom_app_start_addr[2:])
else:
comment_enable = True
custom_app_start_addr = int(Database.getSymbolValue("core", "APP_START_ADDRESS"), 16)
btl_size = calcBootloaderSize()
if (custom_app_start_addr < (flash_start + btl_size)):
symbol.setLabel("WARNING!!! Application Start Address Should be equal to or Greater than Bootloader Size !!!")
elif (custom_app_start_addr >= (flash_start + flash_size)):
symbol.setLabel("WARNING!!! Application Start Address is exceeding the Flash Memory Space !!!")
elif ((flash_erase_size != 0) and (custom_app_start_addr % flash_erase_size != 0)):
symbol.setLabel("WARNING!!! Application Start Address should be aligned to Erase block size ( "+ str(flash_erase_size) + " bytes ) of Flash memory !!!")
else:
comment_enable = False
symbol.setVisible(comment_enable)
def setTriggerLenVisible(symbol, event):
symbol.setVisible(event["value"])
def generateCommonSymbols(bootloaderComponent):
global ram_start
global ram_size
global btl_start
global btl_type
btlMemUsed = bootloaderComponent.createStringSymbol("MEM_USED", None)
btlMemUsed.setLabel("Bootloader Memory Used")
btlMemUsed.setReadOnly(True)
btlMemUsed.setDefaultValue("")
btlType = bootloaderComponent.createStringSymbol("BTL_TYPE", None)
btlType.setLabel("Bootloader Type")
btlType.setReadOnly(True)
btlType.setVisible(False)
btlType.setDefaultValue(btl_type)
btlStart = bootloaderComponent.createStringSymbol("BTL_START", None)
btlStart.setLabel("Bootloader Start Address")
btlStart.setVisible(False)
btlStart.setDefaultValue(btl_start)
btl_size = calcBootloaderSize()
btlSize = bootloaderComponent.createStringSymbol("BTL_SIZE", None)
btlSize.setLabel("Bootloader Size (Bytes)")
btlSize.setVisible(False)
btlSize.setDefaultValue(str(btl_size))
btlSize.setDependencies(setBootloaderSize, ["MEM_USED"])
btlAppAddrComment = bootloaderComponent.createCommentSymbol("BTL_APP_START_ADDR_COMMENT", None)
btlAppAddrComment.setVisible(False)
btlAppAddrComment.setDependencies(setAppStartAndCommentVisible, ["core.APP_START_ADDRESS", "BTL_SIZE"])
btlTriggerEnable = bootloaderComponent.createBooleanSymbol("BTL_TRIGGER_ENABLE", None)
btlTriggerEnable.setLabel("Enable Bootloader Trigger From Firmware")
btlTriggerEnable.setDescription("This Option can be used to Force Trigger bootloader from application firmware after a soft reset.")
btlTriggerLenDesc = "This option adds the provided offset to RAM Start address in bootloader linker script. \
Application firmware can store some pattern in the reserved bytes region from RAM start for bootloader \
to check at reset."
btlTriggerLen = bootloaderComponent.createStringSymbol("BTL_TRIGGER_LEN", btlTriggerEnable)
btlTriggerLen.setLabel("Number Of Bytes To Reserve From Start Of RAM")
btlTriggerLen.setVisible((btlTriggerEnable.getValue() == True))
btlTriggerLen.setDefaultValue("0")
btlTriggerLen.setDependencies(setTriggerLenVisible, ["BTL_TRIGGER_ENABLE"])
btlTriggerLen.setDescription(btlTriggerLenDesc)
btlRamStart = bootloaderComponent.createStringSymbol("BTL_RAM_START", None)
btlRamStart.setDefaultValue(ram_start)
btlRamStart.setReadOnly(True)
btlRamStart.setVisible(False)
btlRamSize = bootloaderComponent.createStringSymbol("BTL_RAM_SIZE", None)
btlRamSize.setDefaultValue(ram_size)
btlRamSize.setReadOnly(True)
btlRamSize.setVisible(False)
def generateHwCRCGeneratorSymbol(bootloaderComponent):
crcEnable = False
coreComponent = Database.getComponentByID("core")
# Enable PAC and DSU component if present
for module in range (0, len(peripherals)):
periphName = str(peripherals[module].getAttribute("name"))
if (periphName == "PAC"):
coreComponent.getSymbolByID("PAC_USE").setValue(True)
if (Database.getSymbolValue("core", "PAC_INTERRRUPT_MODE") != None):
coreComponent.getSymbolByID("PAC_INTERRRUPT_MODE").setValue(False)
elif (periphName == "DSU"):
res = Database.activateComponents(["dsu"])
crcEnable = True
btlHwCrc = bootloaderComponent.createBooleanSymbol("BTL_HW_CRC_GEN", None)
btlHwCrc.setLabel("Bootloader Hardware CRC Generator")
btlHwCrc.setReadOnly(True)
btlHwCrc.setVisible(False)
btlHwCrc.setDefaultValue(crcEnable)
def generateLinkerFileSymbol(bootloaderComponent):
# Disable Default linker script generation
Database.setSymbolValue("core", "ADD_LINKER_FILE", False)
# Generate Bootloader Linker Script
btlLinkerPath = "../bootloader/templates/arm/bootloader_linker_optimized.ld.ftl"
# Generate Bootloader Linker Script
btlLinkerFile = bootloaderComponent.createFileSymbol("BOOTLOADER_LINKER_FILE", None)
btlLinkerFile.setSourcePath(btlLinkerPath)
btlLinkerFile.setOutputName("btl.ld")
btlLinkerFile.setMarkup(True)
btlLinkerFile.setOverwrite(True)
btlLinkerFile.setType("LINKER")
def generateXC32SettingsAndFileSymbol(bootloaderComponent):
configName = Variables.get("__CONFIGURATION_NAME")
# generate startup_xc32.c file
btlStartSourceFile = bootloaderComponent.createFileSymbol("STARTUP_BOOTLOADER_C", None)
btlStartSourceFile.setSourcePath("../bootloader/templates/arm/startup_xc32_optimized.c.ftl")
btlStartSourceFile.setOutputName("startup_xc32.c")
btlStartSourceFile.setMarkup(True)
btlStartSourceFile.setOverwrite(True)
btlStartSourceFile.setDestPath("")
btlStartSourceFile.setProjectPath("config/" + configName + "/")
btlStartSourceFile.setType("SOURCE")
# set XC32 option to not use the CRT0 startup code
xc32NoCRT0StartupCodeSym = bootloaderComponent.createSettingSymbol("XC32_NO_CRT0_STARTUP_CODE", None)
xc32NoCRT0StartupCodeSym.setCategory("C32-LD")
xc32NoCRT0StartupCodeSym.setKey("no-startup-files")
xc32NoCRT0StartupCodeSym.setValue("true")
# Clear Placing data into its own section
xc32ClearDataSection = bootloaderComponent.createSettingSymbol("XC32_CLEAR_DATA_SECTION", None)
xc32ClearDataSection.setCategory("C32")
xc32ClearDataSection.setKey("place-data-into-section")
xc32ClearDataSection.setValue("false")
| """*****************************************************************************
* Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to comply with third party license terms applicable to your
* use of third party software (including open source software) that may
* accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
* INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
* WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
* BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
* FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
* ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*****************************************************************************"""
global flashNames
global ram_start
global ram_size
global flash_start
global flash_size
global flash_erase_size
global btl_start
flash_start = 0
flash_size = 0
flash_erase_size = 0
btl_start = '0x0'
nvm_memory_names = ['NVM', 'NVMCTRL', 'EFC', 'HEFC']
flash_names = ['FLASH', 'IFLASH']
ram_names = ['HSRAM', 'HRAMC0', 'HMCRAMC0', 'IRAM', 'FlexRAM']
addr_space = ATDF.getNode('/avr-tools-device-file/devices/device/address-spaces/address-space')
addr_space_children = addr_space.getChildren()
periph_node = ATDF.getNode('/avr-tools-device-file/devices/device/peripherals')
peripherals = periphNode.getChildren()
for mem_idx in range(0, len(addr_space_children)):
mem_seg = addr_space_children[mem_idx].getAttribute('name')
mem_type = addr_space_children[mem_idx].getAttribute('type')
if any((x == mem_seg for x in FlashNames)) == True and mem_type == 'flash':
flash_start = int(addr_space_children[mem_idx].getAttribute('start'), 16)
flash_size = int(addr_space_children[mem_idx].getAttribute('size'), 16)
if any((x == mem_seg for x in RamNames)) == True and mem_type == 'ram':
ram_start = addr_space_children[mem_idx].getAttribute('start')
ram_size = addr_space_children[mem_idx].getAttribute('size')
btl_start = str(flash_start)
def activate_and_connect_dependencies(component):
nvm_memory_name = ''
for module in range(0, len(peripherals)):
periph_name = str(peripherals[module].getAttribute('name'))
if any((x == periphName for x in NvmMemoryNames)) == True:
nvm_memory_name = periphName.lower()
break
nvm_memory_capability_id = nvmMemoryName.upper() + '_MEMORY'
btl_activate_table = [nvmMemoryName]
btl_connect_table = [[component, 'btl_MEMORY_dependency', nvmMemoryName, nvmMemoryCapabilityId]]
res = Database.activateComponents(btlActivateTable)
res = Database.connectDependencies(btlConnectTable)
def calc_bootloader_size():
global flash_erase_size
core_arch = Database.getSymbolValue('core', 'CoreArchitecture')
if coreArch in btlSizes:
max_usb_btl_size = btlSizes[coreArch][0]
else:
return 0
btl_size = 0
if flash_erase_size != 0:
if flash_erase_size >= max_usb_btl_size:
btl_size = flash_erase_size
else:
btl_size = max_usb_btl_size
return btl_size
def set_bootloader_size(symbol, event):
btl_size = str(calc_bootloader_size())
symbol.setValue(btl_size)
if btl_size != 0:
symbol.setVisible(True)
else:
symbol.setVisible(False)
def set_app_start_and_comment_visible(symbol, event):
global flash_start
global flash_size
global flash_erase_size
if event['id'] == 'BTL_SIZE':
btl_size = int(event['value'], 10)
if btlSize != 0 and flash_erase_size != 0:
app_start_aligned = btlSize
if btlSize % flash_erase_size != 0:
app_start_aligned = btlSize + (flash_erase_size - btlSize % flash_erase_size)
custom_app_start_addr = str(hex(flash_start + appStartAligned))
else:
custom_app_start_addr = str(hex(flash_start))
Database.setSymbolValue('core', 'APP_START_ADDRESS', custom_app_start_addr[2:])
else:
comment_enable = True
custom_app_start_addr = int(Database.getSymbolValue('core', 'APP_START_ADDRESS'), 16)
btl_size = calc_bootloader_size()
if custom_app_start_addr < flash_start + btl_size:
symbol.setLabel('WARNING!!! Application Start Address Should be equal to or Greater than Bootloader Size !!!')
elif custom_app_start_addr >= flash_start + flash_size:
symbol.setLabel('WARNING!!! Application Start Address is exceeding the Flash Memory Space !!!')
elif flash_erase_size != 0 and custom_app_start_addr % flash_erase_size != 0:
symbol.setLabel('WARNING!!! Application Start Address should be aligned to Erase block size ( ' + str(flash_erase_size) + ' bytes ) of Flash memory !!!')
else:
comment_enable = False
symbol.setVisible(comment_enable)
def set_trigger_len_visible(symbol, event):
symbol.setVisible(event['value'])
def generate_common_symbols(bootloaderComponent):
global ram_start
global ram_size
global btl_start
global btl_type
btl_mem_used = bootloaderComponent.createStringSymbol('MEM_USED', None)
btlMemUsed.setLabel('Bootloader Memory Used')
btlMemUsed.setReadOnly(True)
btlMemUsed.setDefaultValue('')
btl_type = bootloaderComponent.createStringSymbol('BTL_TYPE', None)
btlType.setLabel('Bootloader Type')
btlType.setReadOnly(True)
btlType.setVisible(False)
btlType.setDefaultValue(btl_type)
btl_start = bootloaderComponent.createStringSymbol('BTL_START', None)
btlStart.setLabel('Bootloader Start Address')
btlStart.setVisible(False)
btlStart.setDefaultValue(btl_start)
btl_size = calc_bootloader_size()
btl_size = bootloaderComponent.createStringSymbol('BTL_SIZE', None)
btlSize.setLabel('Bootloader Size (Bytes)')
btlSize.setVisible(False)
btlSize.setDefaultValue(str(btl_size))
btlSize.setDependencies(setBootloaderSize, ['MEM_USED'])
btl_app_addr_comment = bootloaderComponent.createCommentSymbol('BTL_APP_START_ADDR_COMMENT', None)
btlAppAddrComment.setVisible(False)
btlAppAddrComment.setDependencies(setAppStartAndCommentVisible, ['core.APP_START_ADDRESS', 'BTL_SIZE'])
btl_trigger_enable = bootloaderComponent.createBooleanSymbol('BTL_TRIGGER_ENABLE', None)
btlTriggerEnable.setLabel('Enable Bootloader Trigger From Firmware')
btlTriggerEnable.setDescription('This Option can be used to Force Trigger bootloader from application firmware after a soft reset.')
btl_trigger_len_desc = 'This option adds the provided offset to RAM Start address in bootloader linker script. Application firmware can store some pattern in the reserved bytes region from RAM start for bootloader to check at reset.'
btl_trigger_len = bootloaderComponent.createStringSymbol('BTL_TRIGGER_LEN', btlTriggerEnable)
btlTriggerLen.setLabel('Number Of Bytes To Reserve From Start Of RAM')
btlTriggerLen.setVisible(btlTriggerEnable.getValue() == True)
btlTriggerLen.setDefaultValue('0')
btlTriggerLen.setDependencies(setTriggerLenVisible, ['BTL_TRIGGER_ENABLE'])
btlTriggerLen.setDescription(btlTriggerLenDesc)
btl_ram_start = bootloaderComponent.createStringSymbol('BTL_RAM_START', None)
btlRamStart.setDefaultValue(ram_start)
btlRamStart.setReadOnly(True)
btlRamStart.setVisible(False)
btl_ram_size = bootloaderComponent.createStringSymbol('BTL_RAM_SIZE', None)
btlRamSize.setDefaultValue(ram_size)
btlRamSize.setReadOnly(True)
btlRamSize.setVisible(False)
def generate_hw_crc_generator_symbol(bootloaderComponent):
crc_enable = False
core_component = Database.getComponentByID('core')
for module in range(0, len(peripherals)):
periph_name = str(peripherals[module].getAttribute('name'))
if periphName == 'PAC':
coreComponent.getSymbolByID('PAC_USE').setValue(True)
if Database.getSymbolValue('core', 'PAC_INTERRRUPT_MODE') != None:
coreComponent.getSymbolByID('PAC_INTERRRUPT_MODE').setValue(False)
elif periphName == 'DSU':
res = Database.activateComponents(['dsu'])
crc_enable = True
btl_hw_crc = bootloaderComponent.createBooleanSymbol('BTL_HW_CRC_GEN', None)
btlHwCrc.setLabel('Bootloader Hardware CRC Generator')
btlHwCrc.setReadOnly(True)
btlHwCrc.setVisible(False)
btlHwCrc.setDefaultValue(crcEnable)
def generate_linker_file_symbol(bootloaderComponent):
Database.setSymbolValue('core', 'ADD_LINKER_FILE', False)
btl_linker_path = '../bootloader/templates/arm/bootloader_linker_optimized.ld.ftl'
btl_linker_file = bootloaderComponent.createFileSymbol('BOOTLOADER_LINKER_FILE', None)
btlLinkerFile.setSourcePath(btlLinkerPath)
btlLinkerFile.setOutputName('btl.ld')
btlLinkerFile.setMarkup(True)
btlLinkerFile.setOverwrite(True)
btlLinkerFile.setType('LINKER')
def generate_xc32_settings_and_file_symbol(bootloaderComponent):
config_name = Variables.get('__CONFIGURATION_NAME')
btl_start_source_file = bootloaderComponent.createFileSymbol('STARTUP_BOOTLOADER_C', None)
btlStartSourceFile.setSourcePath('../bootloader/templates/arm/startup_xc32_optimized.c.ftl')
btlStartSourceFile.setOutputName('startup_xc32.c')
btlStartSourceFile.setMarkup(True)
btlStartSourceFile.setOverwrite(True)
btlStartSourceFile.setDestPath('')
btlStartSourceFile.setProjectPath('config/' + configName + '/')
btlStartSourceFile.setType('SOURCE')
xc32_no_crt0_startup_code_sym = bootloaderComponent.createSettingSymbol('XC32_NO_CRT0_STARTUP_CODE', None)
xc32NoCRT0StartupCodeSym.setCategory('C32-LD')
xc32NoCRT0StartupCodeSym.setKey('no-startup-files')
xc32NoCRT0StartupCodeSym.setValue('true')
xc32_clear_data_section = bootloaderComponent.createSettingSymbol('XC32_CLEAR_DATA_SECTION', None)
xc32ClearDataSection.setCategory('C32')
xc32ClearDataSection.setKey('place-data-into-section')
xc32ClearDataSection.setValue('false') |
def ft_filter(function_to_apply, list_of_inputs):
for elem in list_of_inputs:
res = function_to_apply(elem)
if res is True:
yield elem
| def ft_filter(function_to_apply, list_of_inputs):
for elem in list_of_inputs:
res = function_to_apply(elem)
if res is True:
yield elem |
STX: bytes = b"\x02" # Start of text, indicates the start of a message.
ETX: bytes = b"\x03" # End of text, indicates the end of a message
ENQ: bytes = b"\x05" # Enquiry about the PC interface being ready to receive a new message.
ACK: bytes = b"\x06" # Positive acknowledgement to a PMS message or enquiry (ENQ).
NAK: bytes = b"\x15" # Negative acknowledgement to a PMS message or enquiry (ENQ).
LRC_SKIP: bytes = b"\x0D" # The PMS can avoid LRC calculation by sending a 0DH value (return character)
def lrc(message: bytes) -> bytes:
result = 0
for b in message + ETX: # LRC message must not include STX and should include ETX
result ^= b
return bytes([result])
| stx: bytes = b'\x02'
etx: bytes = b'\x03'
enq: bytes = b'\x05'
ack: bytes = b'\x06'
nak: bytes = b'\x15'
lrc_skip: bytes = b'\r'
def lrc(message: bytes) -> bytes:
result = 0
for b in message + ETX:
result ^= b
return bytes([result]) |
class Interval:
def __init__(self, start, end):
if start < end:
self.start = start
self.end = end
else:
self.start = end
self.end = start
def overlap(self, other):
if self.start > other.start and self.start < other.end:
return True
if self.end > other.start and self.end < other.end:
return True
return False
def __repr__(self):
return "Interval(start={}, end={})".format(self.start, self.end)
def __add__(self, other):
return Interval(start=min(self.start, other.start), end=max(self.end, other.end))
| class Interval:
def __init__(self, start, end):
if start < end:
self.start = start
self.end = end
else:
self.start = end
self.end = start
def overlap(self, other):
if self.start > other.start and self.start < other.end:
return True
if self.end > other.start and self.end < other.end:
return True
return False
def __repr__(self):
return 'Interval(start={}, end={})'.format(self.start, self.end)
def __add__(self, other):
return interval(start=min(self.start, other.start), end=max(self.end, other.end)) |
# create a loop
counter = 10
while counter > 0:
print(counter)
counter = counter -1
print('Blastoff!!') | counter = 10
while counter > 0:
print(counter)
counter = counter - 1
print('Blastoff!!') |
"""Providers for interop between JS rules.
This file has to live in the built-in so that all rules can load() the providers
even if users haven't installed any of the packages/*
These providers allows rules to interoperate without knowledge
of each other.
You can think of a provider as a message bus.
A rule "publishes" a message as an instance of the provider, and some other rule
subscribes to these by having a (possibly transitive) dependency on the publisher.
## Debugging
Debug output is considered orthogonal to these providers.
Any output may or may not have user debugging affordances provided, such as
readable minification.
We expect that rules will have a boolean `debug` attribute, and/or accept the `DEBUG`
environment variable.
Note that this means a given build either produces debug or non-debug output.
If users really need to produce both in a single build, they'll need two rules with
differing 'debug' attributes.
"""
JSEcmaScriptModuleInfo = provider(
doc = """JavaScript files (and sourcemaps) that are intended to be consumed by downstream tooling.
They should use modern syntax and ESModules.
These files should typically be named "foo.mjs"
TODO: should we require that?
Historical note: this was the typescript.es6_sources output""",
fields = {
"sources": "depset of direct and transitive JavaScript files and sourcemaps",
},
)
def transitive_js_ecma_script_module_info(sources, deps = []):
"""Constructs a JSEcmaScriptModuleInfo including all transitive sources from JSEcmaScriptModuleInfo providers in a list of deps.
Returns a single JSEcmaScriptModuleInfo.
"""
return combine_js_ecma_script_module_info([JSEcmaScriptModuleInfo(sources = sources)] + collect_js_ecma_script_module_infos(deps))
def combine_js_ecma_script_module_info(modules):
"""Combines all JavaScript sources and sourcemaps from a list of JSEcmaScriptModuleInfo providers.
Returns a single JSEcmaScriptModuleInfo.
"""
sources_depsets = []
for module in modules:
sources_depsets.extend([module.sources])
return JSEcmaScriptModuleInfo(
sources = depset(transitive = sources_depsets),
)
def collect_js_ecma_script_module_infos(deps):
"""Collects all JSEcmaScriptModuleInfo providers from a list of deps.
Returns a list of JSEcmaScriptModuleInfo providers.
"""
modules = []
for dep in deps:
if JSEcmaScriptModuleInfo in dep:
modules.extend([dep[JSEcmaScriptModuleInfo]])
return modules
| """Providers for interop between JS rules.
This file has to live in the built-in so that all rules can load() the providers
even if users haven't installed any of the packages/*
These providers allows rules to interoperate without knowledge
of each other.
You can think of a provider as a message bus.
A rule "publishes" a message as an instance of the provider, and some other rule
subscribes to these by having a (possibly transitive) dependency on the publisher.
## Debugging
Debug output is considered orthogonal to these providers.
Any output may or may not have user debugging affordances provided, such as
readable minification.
We expect that rules will have a boolean `debug` attribute, and/or accept the `DEBUG`
environment variable.
Note that this means a given build either produces debug or non-debug output.
If users really need to produce both in a single build, they'll need two rules with
differing 'debug' attributes.
"""
js_ecma_script_module_info = provider(doc='JavaScript files (and sourcemaps) that are intended to be consumed by downstream tooling.\n\nThey should use modern syntax and ESModules.\nThese files should typically be named "foo.mjs"\nTODO: should we require that?\n\nHistorical note: this was the typescript.es6_sources output', fields={'sources': 'depset of direct and transitive JavaScript files and sourcemaps'})
def transitive_js_ecma_script_module_info(sources, deps=[]):
"""Constructs a JSEcmaScriptModuleInfo including all transitive sources from JSEcmaScriptModuleInfo providers in a list of deps.
Returns a single JSEcmaScriptModuleInfo.
"""
return combine_js_ecma_script_module_info([js_ecma_script_module_info(sources=sources)] + collect_js_ecma_script_module_infos(deps))
def combine_js_ecma_script_module_info(modules):
"""Combines all JavaScript sources and sourcemaps from a list of JSEcmaScriptModuleInfo providers.
Returns a single JSEcmaScriptModuleInfo.
"""
sources_depsets = []
for module in modules:
sources_depsets.extend([module.sources])
return js_ecma_script_module_info(sources=depset(transitive=sources_depsets))
def collect_js_ecma_script_module_infos(deps):
"""Collects all JSEcmaScriptModuleInfo providers from a list of deps.
Returns a list of JSEcmaScriptModuleInfo providers.
"""
modules = []
for dep in deps:
if JSEcmaScriptModuleInfo in dep:
modules.extend([dep[JSEcmaScriptModuleInfo]])
return modules |
# Hacer un programa que pida un caracter e indique si es una boca o no
caracter = input("Digite un caracter: ").lower()# para mayusculas
#caracter = caracter.lower()
#caracter = caracter.upper()
if caracter =="a" or caracter =="b" or caracter =="c" or caracter =="d" or caracter =="e":
print("Es Una vocal")
else:
print("No es una vocal")
| caracter = input('Digite un caracter: ').lower()
if caracter == 'a' or caracter == 'b' or caracter == 'c' or (caracter == 'd') or (caracter == 'e'):
print('Es Una vocal')
else:
print('No es una vocal') |
grocery_list = ["fish", "tomato", "apples"] # Create new list
print("tomato" in grocery_list) # Check that grocery_list contains "tomato" item
grocery_dict = {"fish": 1, "tomato": 6, "apples": 3} # create new dictionary
print("fish" in grocery_dict)
| grocery_list = ['fish', 'tomato', 'apples']
print('tomato' in grocery_list)
grocery_dict = {'fish': 1, 'tomato': 6, 'apples': 3}
print('fish' in grocery_dict) |
def _impl(ctx):
args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks]
args_file = ctx.actions.declare_file(ctx.label.name + ".args")
ctx.actions.write(
output = args_file,
content = "\n".join(args),
)
ctx.actions.run(
mnemonic = "Concat",
inputs = ctx.files.chunks + [args_file],
outputs = [ctx.outputs.out],
arguments = ["@" + args_file.path],
executable = ctx.executable.merge_tool,
execution_requirements = {
"supports-workers": "1",
"requires-worker-protocol": "json",
},
)
concat = rule(
implementation = _impl,
attrs = {
"chunks": attr.label_list(allow_files = True),
"out": attr.output(mandatory = True),
"merge_tool": attr.label(
executable = True,
cfg = "exec",
allow_files = True,
default = Label("//:persistent_worker"),
),
},
)
| def _impl(ctx):
args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks]
args_file = ctx.actions.declare_file(ctx.label.name + '.args')
ctx.actions.write(output=args_file, content='\n'.join(args))
ctx.actions.run(mnemonic='Concat', inputs=ctx.files.chunks + [args_file], outputs=[ctx.outputs.out], arguments=['@' + args_file.path], executable=ctx.executable.merge_tool, execution_requirements={'supports-workers': '1', 'requires-worker-protocol': 'json'})
concat = rule(implementation=_impl, attrs={'chunks': attr.label_list(allow_files=True), 'out': attr.output(mandatory=True), 'merge_tool': attr.label(executable=True, cfg='exec', allow_files=True, default=label('//:persistent_worker'))}) |
k = int(input())
r = list(map(int, input().split()))
p = set(r)
# stores the sum of all unique elements x total no of groups
a = sum(p)*k
# stores the sum of element in the list
b = sum(r)
# (a - b) = (k - 1)*captains_room_no
# prints the the difference of a and b divided by k-1
print((a-b)//(k-1))
| k = int(input())
r = list(map(int, input().split()))
p = set(r)
a = sum(p) * k
b = sum(r)
print((a - b) // (k - 1)) |
"""
Tema: Herencia.
Curso: Curso de python, video 31.
Plataforma: Youtube.
Profesor: Juan diaz - Pildoras informaticas.
Alumno: @edinsonrequena.
"""
class Vehiculo:
def __init__(self, marca, modelo):
self.marca = marca
self.modelo = modelo
self.enmarcha = False
self.acelera = False
self.frena = False
def arrancar(self): self.enmarcha = True
def acelerar(self): self.acelera = True
def frenar(self): self.frena = True
def estado(self):
print(f"""Marca: {self.marca} \n Modelo: {self.modelo} \n En marcha:
{self.enmarcha} \nAcelera: {self.acelera},\n Frena: {self.frena} \n""") # TODO #13
class Moto(Vehiculo):
hcaballito = ''
def caballito(self): self.hcaballito = 'Voy haciendo caballito'
def estado(self):
super().estado()
print(f'Caballito: {self.hcaballito}')
class VElecetricos(Vehiculo):
def __init__(self, autonomia, marcaElec, modeloElec):
super().__init__(marcaElec, modeloElec)
self.autonomia = autonomia
def estado(self):
super().estado()
print(f'Autonomia: {self.autonomia}')
def cargarEnergia(self): self.cargando = True
class BiciElectrica(VElecetricos, Vehiculo): pass
class Furgoneta(Vehiculo):
def llevaCarga(self, carga):
self.carga = carga
self.siCarga = 'La furgoneta esta cargada'
self.noCarga = 'La furgoneta no esta cargada'
return self.siCarga if self.carga else self.noCarga
def estado(self): # TODO #22
super().estado()
print(f'Lleva carga?: ')
class App: # TODO #16
def crear(self):
# Objeto bici
bici = BiciElectrica(100, 'Test marca', 'Test Modelo')
bici.estado()
# Objeto Furgoneta
furgoneta = Furgoneta('Test', 'Test2')
furgoneta.estado()
# Objeto Moto
moto = Moto('Test Moto', 'Test moto')
moto.caballito()
moto.estado()
if __name__ == '__main__':
App().crear()
| """
Tema: Herencia.
Curso: Curso de python, video 31.
Plataforma: Youtube.
Profesor: Juan diaz - Pildoras informaticas.
Alumno: @edinsonrequena.
"""
class Vehiculo:
def __init__(self, marca, modelo):
self.marca = marca
self.modelo = modelo
self.enmarcha = False
self.acelera = False
self.frena = False
def arrancar(self):
self.enmarcha = True
def acelerar(self):
self.acelera = True
def frenar(self):
self.frena = True
def estado(self):
print(f'Marca: {self.marca} \n Modelo: {self.modelo} \n En marcha: \n {self.enmarcha} \nAcelera: {self.acelera},\n Frena: {self.frena} \n')
class Moto(Vehiculo):
hcaballito = ''
def caballito(self):
self.hcaballito = 'Voy haciendo caballito'
def estado(self):
super().estado()
print(f'Caballito: {self.hcaballito}')
class Velecetricos(Vehiculo):
def __init__(self, autonomia, marcaElec, modeloElec):
super().__init__(marcaElec, modeloElec)
self.autonomia = autonomia
def estado(self):
super().estado()
print(f'Autonomia: {self.autonomia}')
def cargar_energia(self):
self.cargando = True
class Bicielectrica(VElecetricos, Vehiculo):
pass
class Furgoneta(Vehiculo):
def lleva_carga(self, carga):
self.carga = carga
self.siCarga = 'La furgoneta esta cargada'
self.noCarga = 'La furgoneta no esta cargada'
return self.siCarga if self.carga else self.noCarga
def estado(self):
super().estado()
print(f'Lleva carga?: ')
class App:
def crear(self):
bici = bici_electrica(100, 'Test marca', 'Test Modelo')
bici.estado()
furgoneta = furgoneta('Test', 'Test2')
furgoneta.estado()
moto = moto('Test Moto', 'Test moto')
moto.caballito()
moto.estado()
if __name__ == '__main__':
app().crear() |
def swap(arr, i, j):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def selectionSort(arr):
for i in range(len(arr)):
smallest = arr[i]
for j in range(i+1, len(arr)):
print(i)
if smallest > arr[j]:
print(f"replacing {j} th position with {i}th position")
swap(arr, j, i)
smallest = arr[i]
else:
print('This is the smallest')
return arr
# Driver code
array = [10, 7, 8, 9, 1, 5]
print(f'Given array: {array}')
selectionSort(array)
print(f'Sorted array: {array}')
| def swap(arr, i, j):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def selection_sort(arr):
for i in range(len(arr)):
smallest = arr[i]
for j in range(i + 1, len(arr)):
print(i)
if smallest > arr[j]:
print(f'replacing {j} th position with {i}th position')
swap(arr, j, i)
smallest = arr[i]
else:
print('This is the smallest')
return arr
array = [10, 7, 8, 9, 1, 5]
print(f'Given array: {array}')
selection_sort(array)
print(f'Sorted array: {array}') |
with open('input.txt', 'r') as reader:
input = [line for line in reader.read().splitlines()]
def part1(numbers):
length = len(numbers[0])
sums = [0] * length
for number in numbers:
for i in range(length):
sums[i] += int(number[i])
gamma = [1 if v > len(numbers) / 2 else 0 for v in sums]
gammaV = bin_arr_to_int(gamma)
return gammaV * (gammaV ^ int("".join([str(1)]*length), 2))
def part2(numbers):
idx = range(len(numbers))
current = 0
while(len(idx) > 1):
sum_current = sum([int(numbers[i][current]) for i in idx])
most_common = "1" if sum_current >= len(idx)/ 2 else "0"
idx = list(filter(lambda i: numbers[i][current] == most_common, idx))
current += 1
oxygen_generator_rating = bin_arr_to_int(numbers[idx[0]])
idx = range(len(numbers))
current = 0
while(len(idx) > 1):
sum_current = sum([int(numbers[i][current]) for i in idx])
least_common = "1" if sum_current < len(idx)/ 2 else "0"
idx = list(filter(lambda i: numbers[i][current] == least_common, idx))
current += 1
CO2_scrubber_rating = bin_arr_to_int(numbers[idx[0]])
return oxygen_generator_rating * CO2_scrubber_rating
def bin_arr_to_int(binary):
return int("".join([str(v) for v in binary]), 2)
print(part1(input))
print(part2(input))
| with open('input.txt', 'r') as reader:
input = [line for line in reader.read().splitlines()]
def part1(numbers):
length = len(numbers[0])
sums = [0] * length
for number in numbers:
for i in range(length):
sums[i] += int(number[i])
gamma = [1 if v > len(numbers) / 2 else 0 for v in sums]
gamma_v = bin_arr_to_int(gamma)
return gammaV * (gammaV ^ int(''.join([str(1)] * length), 2))
def part2(numbers):
idx = range(len(numbers))
current = 0
while len(idx) > 1:
sum_current = sum([int(numbers[i][current]) for i in idx])
most_common = '1' if sum_current >= len(idx) / 2 else '0'
idx = list(filter(lambda i: numbers[i][current] == most_common, idx))
current += 1
oxygen_generator_rating = bin_arr_to_int(numbers[idx[0]])
idx = range(len(numbers))
current = 0
while len(idx) > 1:
sum_current = sum([int(numbers[i][current]) for i in idx])
least_common = '1' if sum_current < len(idx) / 2 else '0'
idx = list(filter(lambda i: numbers[i][current] == least_common, idx))
current += 1
co2_scrubber_rating = bin_arr_to_int(numbers[idx[0]])
return oxygen_generator_rating * CO2_scrubber_rating
def bin_arr_to_int(binary):
return int(''.join([str(v) for v in binary]), 2)
print(part1(input))
print(part2(input)) |
class Solution(object):
def isPowerOfThree(self, n):
"""
:type n: int
:rtype: bool
"""
left, right = 0, 19
while left <= right:
mid = left + (right - left) / 2
if 3 ** mid == n:
return True
elif 3 ** mid > n:
right = mid - 1
else:
left = mid + 1
return False
def isPowerOfThree2(self, n):
"""
:type n: int
:rtype: bool
"""
while n > 1 and n % 3 == 0:
n /= 3
return n == 1 | class Solution(object):
def is_power_of_three(self, n):
"""
:type n: int
:rtype: bool
"""
(left, right) = (0, 19)
while left <= right:
mid = left + (right - left) / 2
if 3 ** mid == n:
return True
elif 3 ** mid > n:
right = mid - 1
else:
left = mid + 1
return False
def is_power_of_three2(self, n):
"""
:type n: int
:rtype: bool
"""
while n > 1 and n % 3 == 0:
n /= 3
return n == 1 |
"""Top-level package for QBOB."""
__author__ = """Guen Prawiroatmodjo"""
__email__ = 'guenp@microsoft.com'
__version__ = '0.1.0'
| """Top-level package for QBOB."""
__author__ = 'Guen Prawiroatmodjo'
__email__ = 'guenp@microsoft.com'
__version__ = '0.1.0' |
def sieve(n):
checkArray = [1] * (n+1)
checkArray[0] = 0
checkArray[1] = 0
for i in range(2,n+1):
j = i + i
step = j + i
for j in range(j,n+1,i):
checkArray[j] = 0
for i in range(0,n+1):
if checkArray[i] != 0:
print(i)
if __name__ == "__main__":
n = int(input())
sieve(n) | def sieve(n):
check_array = [1] * (n + 1)
checkArray[0] = 0
checkArray[1] = 0
for i in range(2, n + 1):
j = i + i
step = j + i
for j in range(j, n + 1, i):
checkArray[j] = 0
for i in range(0, n + 1):
if checkArray[i] != 0:
print(i)
if __name__ == '__main__':
n = int(input())
sieve(n) |
"""Different environment settings."""
# TODO: Add correct objects
LOCATION_TYPE_MAP = {
"floor": {"color": "gray", "gray_color": "gray", "mesh": ":/objects/floor.obj",},
"rack": {"color": "#62ca5f", "gray_color": "gray", "mesh": ":/objects/rack.obj",},
"wall": {"color": "black", "gray_color": "black", "mesh": ":/objects/floor.obj",},
"inbound_door": {
"color": "#fde724",
"gray_color": "#222",
"mesh": ":/objects/floor.obj",
},
"outbound_door": {
"color": "#fd8a24",
"gray_color": "#aaa",
"mesh": ":/objects/floor.obj",
},
"staging_area": {
"color": "#2c728e",
"gray_color": "#ddd",
"mesh": ":/objects/floor.obj",
},
"custom": {
"color": "#ca5f5f",
"gray_color": "white",
"mesh": ":/objects/floor.obj",
},
}
| """Different environment settings."""
location_type_map = {'floor': {'color': 'gray', 'gray_color': 'gray', 'mesh': ':/objects/floor.obj'}, 'rack': {'color': '#62ca5f', 'gray_color': 'gray', 'mesh': ':/objects/rack.obj'}, 'wall': {'color': 'black', 'gray_color': 'black', 'mesh': ':/objects/floor.obj'}, 'inbound_door': {'color': '#fde724', 'gray_color': '#222', 'mesh': ':/objects/floor.obj'}, 'outbound_door': {'color': '#fd8a24', 'gray_color': '#aaa', 'mesh': ':/objects/floor.obj'}, 'staging_area': {'color': '#2c728e', 'gray_color': '#ddd', 'mesh': ':/objects/floor.obj'}, 'custom': {'color': '#ca5f5f', 'gray_color': 'white', 'mesh': ':/objects/floor.obj'}} |
#Printing 'reverse Pyramid Shape !
'''
* * * * *
* * * *
* * *
* *
*
'''
n=int(input())
for i in range(n,0,-1): #for rows
for j in range(0,n-i): # for space
print(end=' ')
for j in range(0,i): # creating star
print("*",end=' ')
print()
#other method
n=int(input())
for i in range(n, 0, -1):
print(' ' * (n - i) + '* ' * (i))
| """
* * * * *
* * * *
* * *
* *
*
"""
n = int(input())
for i in range(n, 0, -1):
for j in range(0, n - i):
print(end=' ')
for j in range(0, i):
print('*', end=' ')
print()
n = int(input())
for i in range(n, 0, -1):
print(' ' * (n - i) + '* ' * i) |
class StepParseError(Exception):
pass
class RatDisconnectedError(Exception):
pass
class InvalidTimeoutExceptionError(Exception):
pass
class RatCallbackTimeoutError(Exception):
pass
class MissingFileError(Exception):
pass
| class Stepparseerror(Exception):
pass
class Ratdisconnectederror(Exception):
pass
class Invalidtimeoutexceptionerror(Exception):
pass
class Ratcallbacktimeouterror(Exception):
pass
class Missingfileerror(Exception):
pass |
def max_of_maximums(dTEmax, dsRNAmax):
print('Finding max of maximums')
dmax = {}
for i in list(dTEmax.keys()):
for j in list(dsRNAmax.keys()):
try:
dTEmax[j]
except:
dmax[j] = dsRNAmax[j]
else:
dmax[j] = max(dTEmax[j], dsRNAmax[j])
try:
dsRNAmax[i]
except:
dmax[i] = dTEmax[i] # if no i in dsRNAmax
else: # if scaffold is present in both dictionaries, find the max between them, i and j should be same
dmax[i] = max(dTEmax[i], dsRNAmax[i])
for k, v in list(dmax.items()):
if v == 0:
print(k)
return dmax
def max_coords_per_scaffold(d):
print('Calcualting maximum coordinates per scaffold')
dmax_coords = {}
dscaff_max = {}
for scaff in list(d.keys()):
# collect all coordinates in list, for each scaffold
for line in d[scaff]:
dmax_coords.setdefault(scaff, []).append(int(line.split('\t')[3]))
for scaff in list(dmax_coords.keys()):
# get maximum coordinate per scaffold
dscaff_max[scaff] = max(dmax_coords[scaff])
return dscaff_max | def max_of_maximums(dTEmax, dsRNAmax):
print('Finding max of maximums')
dmax = {}
for i in list(dTEmax.keys()):
for j in list(dsRNAmax.keys()):
try:
dTEmax[j]
except:
dmax[j] = dsRNAmax[j]
else:
dmax[j] = max(dTEmax[j], dsRNAmax[j])
try:
dsRNAmax[i]
except:
dmax[i] = dTEmax[i]
else:
dmax[i] = max(dTEmax[i], dsRNAmax[i])
for (k, v) in list(dmax.items()):
if v == 0:
print(k)
return dmax
def max_coords_per_scaffold(d):
print('Calcualting maximum coordinates per scaffold')
dmax_coords = {}
dscaff_max = {}
for scaff in list(d.keys()):
for line in d[scaff]:
dmax_coords.setdefault(scaff, []).append(int(line.split('\t')[3]))
for scaff in list(dmax_coords.keys()):
dscaff_max[scaff] = max(dmax_coords[scaff])
return dscaff_max |
# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
# See LICENSE in the project root for license information.
# Client ID and secret.
client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84'
client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
| client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84'
client_secret = '7CmTo1brGWMmh5RoFiTdO0n' |
registry = {
"centivize_service": {
"grpc": 7003,
},
}
| registry = {'centivize_service': {'grpc': 7003}} |
''' additional_datastructures.py: File containing custom utility data structures for use in simple_rl. '''
class SimpleRLStack(object):
''' Implementation for a basic Stack data structure '''
def __init__(self, _list=None):
'''
Args:
_list (list) : underlying elements in the stack
'''
self._list = _list if _list is not None else []
def __repr__(self):
r = ''
for element in self._list:
r += str(element) + ', '
return r
def push(self, element):
return self._list.append(element)
def pop(self):
if len(self._list) > 0:
return self._list.pop()
return None
def peek(self):
if len(self._list) > 0:
return self._list[-1]
return None
def is_empty(self):
return len(self._list) == 0
def size(self):
return len(self._list)
| """ additional_datastructures.py: File containing custom utility data structures for use in simple_rl. """
class Simplerlstack(object):
""" Implementation for a basic Stack data structure """
def __init__(self, _list=None):
"""
Args:
_list (list) : underlying elements in the stack
"""
self._list = _list if _list is not None else []
def __repr__(self):
r = ''
for element in self._list:
r += str(element) + ', '
return r
def push(self, element):
return self._list.append(element)
def pop(self):
if len(self._list) > 0:
return self._list.pop()
return None
def peek(self):
if len(self._list) > 0:
return self._list[-1]
return None
def is_empty(self):
return len(self._list) == 0
def size(self):
return len(self._list) |
# RUN: llvmPy %s > %t1
# RUN: cat -n %t1 >&2
# RUN: cat %t1 | FileCheck %s
print(1 * 2)
# CHECK: 2
print(2 * 2)
# CHECK-NEXT: 4
print(0 * 2)
# CHECK-NEXT: 0
| print(1 * 2)
print(2 * 2)
print(0 * 2) |
# 1st solution
class Solution:
def nthMagicalNumber(self, n: int, a: int, b: int) -> int:
g = self.gcd(a, b)
largest = a // g * b
lst = []
numOne, numTwo = a, b
while numOne <= largest and numTwo <= largest:
if numOne < numTwo:
lst.append(numOne)
numOne += a
elif numOne > numTwo:
lst.append(numTwo)
numTwo += b
else:
lst.append(numOne)
numOne += a
numTwo += b
mod = 10**9 + 7
k, r = n // len(lst), n % len(lst)
if r == 0:
ans = k * lst[-1]
else:
ans = k * lst[-1] + lst[r - 1]
return ans % mod
def gcd(self, a, b):
while a:
a, b = b % a, a
return b
# 2nd solution, binary search
# O(log(N*min(a, b))) time | O(1) space
class Solution:
def nthMagicalNumber(self, n: int, a: int, b: int) -> int:
mod = 10 **9 + 7
g = self.gcd(a, b)
largest = a // g * b
def largeEnough(x):
return x // a + x // b - x // largest >= n
left, right = 0, n * min(a, b)
while left < right:
middle = left + (right - left) // 2
if largeEnough(middle):
right = middle
else:
left = middle + 1
return left % mod
def gcd(self, a, b):
while a:
a, b = b % a, a
return b
# 3rd solution, mathematical
# O(a + b) time | O(1) space
class Solution:
def nthMagicalNumber(self, n: int, a: int, b: int) -> int:
mod = 10**9 + 7
g = self.gcd(a, b)
largest = a // g * b
m = largest // a + largest // b - 1
q, r = divmod(n, m)
if r == 0:
return q * largest % mod
heads = [a, b]
for _ in range(r - 1):
if heads[0] <= heads[1]:
heads[0] += a
else:
heads[1] += b
return (q * largest + min(heads)) % mod
def gcd(self, a, b):
while a:
a, b = b % a, a
return b | class Solution:
def nth_magical_number(self, n: int, a: int, b: int) -> int:
g = self.gcd(a, b)
largest = a // g * b
lst = []
(num_one, num_two) = (a, b)
while numOne <= largest and numTwo <= largest:
if numOne < numTwo:
lst.append(numOne)
num_one += a
elif numOne > numTwo:
lst.append(numTwo)
num_two += b
else:
lst.append(numOne)
num_one += a
num_two += b
mod = 10 ** 9 + 7
(k, r) = (n // len(lst), n % len(lst))
if r == 0:
ans = k * lst[-1]
else:
ans = k * lst[-1] + lst[r - 1]
return ans % mod
def gcd(self, a, b):
while a:
(a, b) = (b % a, a)
return b
class Solution:
def nth_magical_number(self, n: int, a: int, b: int) -> int:
mod = 10 ** 9 + 7
g = self.gcd(a, b)
largest = a // g * b
def large_enough(x):
return x // a + x // b - x // largest >= n
(left, right) = (0, n * min(a, b))
while left < right:
middle = left + (right - left) // 2
if large_enough(middle):
right = middle
else:
left = middle + 1
return left % mod
def gcd(self, a, b):
while a:
(a, b) = (b % a, a)
return b
class Solution:
def nth_magical_number(self, n: int, a: int, b: int) -> int:
mod = 10 ** 9 + 7
g = self.gcd(a, b)
largest = a // g * b
m = largest // a + largest // b - 1
(q, r) = divmod(n, m)
if r == 0:
return q * largest % mod
heads = [a, b]
for _ in range(r - 1):
if heads[0] <= heads[1]:
heads[0] += a
else:
heads[1] += b
return (q * largest + min(heads)) % mod
def gcd(self, a, b):
while a:
(a, b) = (b % a, a)
return b |
class Stopper:
"""Base class for implementing a Tune experiment stopper.
Allows users to implement experiment-level stopping via ``stop_all``. By
default, this class does not stop any trials. Subclasses need to
implement ``__call__`` and ``stop_all``.
.. code-block:: python
import time
from ray import tune
from ray.tune import Stopper
class TimeStopper(Stopper):
def __init__(self):
self._start = time.time()
self._deadline = 300
def __call__(self, trial_id, result):
return False
def stop_all(self):
return time.time() - self._start > self.deadline
tune.run(Trainable, num_samples=200, stop=TimeStopper())
"""
def __call__(self, trial_id, result):
"""Returns true if the trial should be terminated given the result."""
raise NotImplementedError
def stop_all(self):
"""Returns true if the experiment should be terminated."""
raise NotImplementedError
class NoopStopper(Stopper):
def __call__(self, trial_id, result):
return False
def stop_all(self):
return False
class FunctionStopper(Stopper):
def __init__(self, function):
self._fn = function
def __call__(self, trial_id, result):
return self._fn(trial_id, result)
def stop_all(self):
return False
@classmethod
def is_valid_function(cls, fn):
is_function = callable(fn) and not issubclass(type(fn), Stopper)
if is_function and hasattr(fn, "stop_all"):
raise ValueError(
"Stop object must be ray.tune.Stopper subclass to be detected "
"correctly.")
return is_function
| class Stopper:
"""Base class for implementing a Tune experiment stopper.
Allows users to implement experiment-level stopping via ``stop_all``. By
default, this class does not stop any trials. Subclasses need to
implement ``__call__`` and ``stop_all``.
.. code-block:: python
import time
from ray import tune
from ray.tune import Stopper
class TimeStopper(Stopper):
def __init__(self):
self._start = time.time()
self._deadline = 300
def __call__(self, trial_id, result):
return False
def stop_all(self):
return time.time() - self._start > self.deadline
tune.run(Trainable, num_samples=200, stop=TimeStopper())
"""
def __call__(self, trial_id, result):
"""Returns true if the trial should be terminated given the result."""
raise NotImplementedError
def stop_all(self):
"""Returns true if the experiment should be terminated."""
raise NotImplementedError
class Noopstopper(Stopper):
def __call__(self, trial_id, result):
return False
def stop_all(self):
return False
class Functionstopper(Stopper):
def __init__(self, function):
self._fn = function
def __call__(self, trial_id, result):
return self._fn(trial_id, result)
def stop_all(self):
return False
@classmethod
def is_valid_function(cls, fn):
is_function = callable(fn) and (not issubclass(type(fn), Stopper))
if is_function and hasattr(fn, 'stop_all'):
raise value_error('Stop object must be ray.tune.Stopper subclass to be detected correctly.')
return is_function |
def old_exponent(n, k):
"""
n is base, k is exponent
"""
answer = 1
for i in range(k):
answer *= n
print(answer)
def newExponent(n, k):
"""
n is base, k is exponent
"""
print("newExponent({0}, {1})".format(n, k))
if k == 1:
return n
elif k == 0:
return 1
left = int(k/2)
right = k - left
return newExponent(n, left) * newExponent(n, right)
| def old_exponent(n, k):
"""
n is base, k is exponent
"""
answer = 1
for i in range(k):
answer *= n
print(answer)
def new_exponent(n, k):
"""
n is base, k is exponent
"""
print('newExponent({0}, {1})'.format(n, k))
if k == 1:
return n
elif k == 0:
return 1
left = int(k / 2)
right = k - left
return new_exponent(n, left) * new_exponent(n, right) |
#default parameters
#you can make default parameter(last_name= 'unknown') in last like after age
#if we make all parameters defalut than ouput is unknowndef user_info(first_name='unknown', last_name= 'unknown',age = None)
# None is used for numbers
#'unknown' is used for string
def user_info(first_name, last_name,age): #None is a special in python
print(f"Your First name is: {first_name} ")
print(f"Your last name is: {last_name} ")
print(f"Your age is: {age} ")
user_info("Beenash","Pervaiz", 20) | def user_info(first_name, last_name, age):
print(f'Your First name is: {first_name} ')
print(f'Your last name is: {last_name} ')
print(f'Your age is: {age} ')
user_info('Beenash', 'Pervaiz', 20) |
'''
Calculate an optimized configuration based on overall memory, cpu, and sensible defaults.
Will configure spark and yarn.
The formula will be run on 5 node t2.large cluster hosted in AWS. t2.large nodes have 2 vcpus, and 8gb of memory each.
4 nodes are designed as yarn node managers. The formula will run with default values.
'''
def constants(cluster, log):
'''
Sets the constants needed for calculating the formula.
:param cluster: Cluster configuration connection
:param log: simple log interface with log.info, log.error, log.warning, log.fatal, log.debug
:return: a dictionary with all constants
'''
const = {
"NUM_NM_WORKERS": len(cluster.yarn.nodemanager.hosts.all),
#The number of workers with the node manager role
#4 in our sample cluster
"NM_WORKER_CORES": cluster.yarn.nodemanager.hosts.max_cores,
#The max number of cores for any node manager host
# 2 in our sample cluster
"NM_WORKER_MEM": cluster.yarn.nodemanager.hosts.max_memory,
#The max amount of memory available on any node manager host
# 4gb or 7933714432 bytes in our sample cluster
"MIN_NM_MEMORY": gb_to_bytes(2),
"MEM_FRACTION_FOR_OTHER_SERVICES": lambda x: x if x is not None and x >= 0 and x < 1 else 0.125,
#percentage of overall system memory that should be preserved for other services besides yarn.
#Default is 12.5 %
"MAPREDUCE_JOB_COUNTERS_MAX": lambda x: x if x is not None and x >= 120 else 500,
#max number number of map reduce counters. The yarn default is 120, we recommend 500.
"SPARK_DRIVER_MAXPERMSIZE": lambda x: x if x is not None and x >= 512 else 512,
#The spark drivers max perm size
#spark-submit --driver-java-options " -XX:MaxPermSize=SOME_SIZE M "
"ENABLE_SPARK_SHUFFLE_SERVICE": lambda x: False if str(x).lower() == "false" else True,
#Enable spark shuffle service so we can use dynamic allocation
"NUM_THREADS": lambda x: x if x is not None and x > 0 else 1,
#The number of threads being supported by this configuration
"YARN_SCHEDULER_MINIMUM_ALLOCATION_MB": lambda x: x if x is not None and x >= 1024 else 1024,
"MAPREDUCE_MINIMUM_AM_MEMORY_MB": lambda x: (x / 512) * 512 if x is not None and x >= 1024 else 1024,
#The amount of memory the MR AppMaster needs.
#https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml
"MAX_HEAP_PERCENT": lambda x: x if x is not None else 0.75,
#how much memory should be allocated to java heap. i.e. mapreduce.map.memory.mb * 0.75,
# mapreduce.reduce.java.opts.max.heap * 0.75
"MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB": lambda x: (x / 512) * 512 if x is not None and x >= 1024 else 1024,
#minimum executor memory
"SPARK_MEMORY_OVERHEAD_MIN": 384,
#minimum amount of memory allocated for spark overhead
"MEMORY_OVERHEAD": 0.10,
#The amount of off-heap memory (in megabytes) to be allocated for
# spark.yarn.executor.memoryOverhead, spark.yarn.driver.memoryOverhead, spark.yarn.am.memoryOverhead.
# variable from 6 to 10 percent
# http://spark.apache.org/docs/latest/running-on-yarn.html#spark-properties
"YARN_INCREMENT_ALLOCATION_MB": 512
#memory increment when requesting containers
}
if (const["NM_WORKER_MEM"] < (const["MIN_NM_MEMORY"])):
log.fatal(
"Running the toolkit with less than {0}GB memory for YARN is not supported.".format(const["MIN_NM_MEMORY"]))
elif (const["NM_WORKER_MEM"] <= (gb_to_bytes(256))):
const["MAX_JVM_MEMORY"] = const["NM_WORKER_MEM"] / 4
'''
Java Heap Size should not go over 25% of total memory per node manager
In our sample cluster this would be 7933714432 / 4 = 1983428608
'''
else:
# for node managers with greater than 256 GB RAM, JVM memory should still be at most 64GB
const["MAX_JVM_MEMORY"] = gb_to_bytes(64)
return const
def formula(cluster, log, constants):
"""
formula for calculating the optimized configuration
:param cluster: Cluster configuration connection
:param log: simple log interface with log.info, log.error, log.warning, log.fatal, log.debug
:param constants: the calculated constants with any user overrides from formula-args
:return: a dictionary with cdh configurations
"""
cdh = {}
# Validate user defined parameters in forumual-args.yaml file
if (bytes_to_mb(constants["MAX_JVM_MEMORY"]) < constants["MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB"]):
'''
Make sure the user provided value is within the bounds of the cluster resources.
'''
log.warning("Container larger than {0}MB are not supported".format(constants["MAX_JVM_MEMORY"]))
if constants["MEM_FRACTION_FOR_OTHER_SERVICES"] < 0:
log.fatal("{0} must be non-nagative".format("MEM_FRACTION_FOR_OTHER_SERVICES"))
constants["SPARK_YARN_DRIVER_MEMORYOVERHEAD"] = \
max(constants["SPARK_MEMORY_OVERHEAD_MIN"], constants["MAPREDUCE_MINIMUM_AM_MEMORY_MB"] * constants["MEMORY_OVERHEAD"])
'''
6-10 percent of driver memory with a minimum of 384
in our sample cluster
max(384, 1024 * 0.10) = 384
'''
constants["SPARK_YARN_EXECUTOR_MEMORYOVERHEAD"] = \
max(constants["SPARK_MEMORY_OVERHEAD_MIN"], constants["MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB"] * constants["MEMORY_OVERHEAD"])
'''
6-10 percent of executor memory with a minimum of 384
in our sample cluster
max(384, 1024 * 0.10 ) = 384
'''
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_CPU_VCORES"] = constants["NM_WORKER_CORES"]
'''
yarn.nodemanager.resource.cpu-vcores
Number of CPU cores that can be allocated for containers. Typically set to the number of physical cores on each machine.
in our sample cluster
2
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_CPU_VCORES"] = 1
'''
yarn.app.mapreduce.am.resource.cpu-vcores
The number of virtual cores the mapreduce application master needs
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_JOB_COUNTERS_LIMIT"] = constants["MAPREDUCE_JOB_COUNTERS_MAX"]
'''
mapreduce.job.counters.limit
yarns defaults is 120 our default is 500.
Limit on the number of user counters allowed per job.
(https://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)
'''
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE"] = \
"<property><name>mapreduce.job.counters.max</name><value>%d</value></property>" % (
constants["MAPREDUCE_JOB_COUNTERS_MAX"])
'''
mapreduce.job.counters.max
yarns defaults is 120 our default is 500. This sets the old max counters value from hadoop 1.x.
Limit on the number of user counters allowed per job.
(https://hadoop.apache.org/docs/r2.4.1/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)
'''
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.RESOURCEMANAGER_MAPRED_SAFETY_VALVE"] = \
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE"]
'''
Set the same old counters max value for resource managers
'''
cdh["YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_MAPRED_SAFETY_VALVE"] = \
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE"]
'''
Set the same old counters max value for job history server
'''
MEM_FOR_OTHER_SERVICES = int(constants["NM_WORKER_MEM"] * constants["MEM_FRACTION_FOR_OTHER_SERVICES"])
'''
Memory reserved for other cluster services.
the default will be calucation is total worker memory * 0.125
in our sample cluster
(7933714432 * 0.125 )= 991714304
'''
MEM_PER_NM = constants["NM_WORKER_MEM"] - MEM_FOR_OTHER_SERVICES
'''
Total worker memory minus the percentage reserved for other services
in our sample cluster
7933714432 - 991714304 = 6942000128
'''
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"] = constants["YARN_INCREMENT_ALLOCATION_MB"]
'''
yarn.scheduler.increment-allocation-mb
https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
in our sample cluster
512
'''
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB"] = \
(
int(bytes_to_mb(MEM_PER_NM) -
max(
constants["SPARK_DRIVER_MAXPERMSIZE"],
constants["SPARK_YARN_DRIVER_MEMORYOVERHEAD"],
constants["SPARK_YARN_EXECUTOR_MEMORYOVERHEAD"]
) * 3
) / cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]
) * cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]
'''
yarn.scheduler.maximum-allocation-mb
take available worker memory account for memory overheads and round to the nearest yarn.scheduler.increment-allocation-mb.
(https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml)
in our sample cluster
( int( 6620 - max( 512, 512, 384) * 3 )/ 512 ) * 512 = 4608
'''
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_MEMORY_MB"] = \
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB"]
'''
yarn.nodemanager.resource.memory-mb
Amount of physical memory, in MB, that can be allocated for containers. we use the previous calculation from
yarn.scheduler.maximum-allocation-mb
https://hadoop.apache.org/docs/r2.6.1/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
in our sample cluster
4608
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB"] = \
max(
min((
(cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB"] /constants["NM_WORKER_CORES"]) /
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]) *
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"],
bytes_to_mb(constants["MAX_JVM_MEMORY"])
),
constants["MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB"]
)
'''
mapreduce.map.memory.mb
The amount of memory to request from the scheduler for each map task.
https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml
result,MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB
In our sample cluster
max( min( ( ( 4608/4 ) / 512 ) * 512, 1891), 1024) = 1891
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_REDUCE_MEMORY_MB"] = \
2 * min(
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB"],
bytes_to_mb(constants["MAX_JVM_MEMORY"])
)
'''
mapreduce.reduce.memory.mb
The amount of memory to request from the scheduler for each reduce task.
(https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)
in our sample cluster
2 * min( 1891, 1891 ) = 3782
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_JAVA_OPTS_MAX_HEAP"] = \
mb_to_bytes(int(cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB"] * constants["MAX_HEAP_PERCENT"]))
'''
mapreduce.map.java.opts.max.heap
max java heap size for the map task. Standard practice is to make this 75 percent of mapreduce.reduce.memory.mb.
in our sample cluster
mb_to_bytes(int( 1891 * 0.75 )) = 1486880768 bytes or 1418 MB
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_REDUCE_JAVA_OPTS_MAX_HEAP"] = \
2 * cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_JAVA_OPTS_MAX_HEAP"]
'''
mapreduce.reduce.java.opts.max.heap
max java heap size for the reduce task. Standard practice is to make this 75 percent of mapreduce.reduce.java.opts.max.heap
in our sample cluster
2 * 1486880768 = 2973761536 or 2836
'''
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MINIMUM_ALLOCATION_MB"] = \
constants["YARN_SCHEDULER_MINIMUM_ALLOCATION_MB"]
'''
yarn.scheduler.minimum-allocation-mb
The minimum allocation for every container request at the RM, in MBs.
Memory requests lower than this won't take effect, and the specified value will get allocated at minimum.
https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
in our cluster
1024
'''
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_VCORES"] = \
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_CPU_VCORES"]
'''
yarn.scheduler.maximum-allocation-vcores
The maximum allocation for every container request at the RM, in terms of virtual CPU cores.
Requests higher than this won't take effect, and will get capped to this value.
https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
in our cluster
2
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_MB"] = \
constants["MAPREDUCE_MINIMUM_AM_MEMORY_MB"]
'''
yarn.app.mapreduce.am.resource.mb
The amount of memory the MR AppMaster needs.
https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml
in our sample cluster
1024
'''
cdh["YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_MAX_HEAP"] = \
mb_to_bytes(
int(cdh["YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_MB"] * constants["MAX_HEAP_PERCENT"]))
'''
YARN_APP_MAPREDUCE_AM_MAX_HEAP
The maximum heap size, in bytes, of the Java MapReduce ApplicationMaster.
https://www.cloudera.com/documentation/enterprise/5-7-x/topics/cm_props_cdh570_yarn_mr2included_.html
in our sample cluster
mb_to_bytes(int( 1024 * 0.75)) = 805306368
'''
CONTAINERS_ACCROSS_CLUSTER = \
int(cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_MEMORY_MB"] \
/ (
(
cdh["YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB"] + (
2 *
max(
constants["SPARK_YARN_DRIVER_MEMORYOVERHEAD"],
constants["SPARK_YARN_EXECUTOR_MEMORYOVERHEAD"],
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]
) / cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]
) * cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB"]
)
) * constants["NUM_NM_WORKERS"])
'''
calculate the total number of containers that can run across the cluster. This value is not used in this formula but
it's useful as a reference if you want to create yarn client configuration and need to know how many containers
you can request.
in our sample cluster
int(4608 / ( (1891 + (2 * max(384, 384, 512) / 512) * 512 ) ) * 4) = 4
'''
'''
Check if the user provided num threads falls with in the capacity of the cluster.
'''
if constants["NUM_THREADS"] > (CONTAINERS_ACCROSS_CLUSTER / 2):
log.fatal("Number of concurrent threads should be at most {0}"
.format((min(CONTAINERS_ACCROSS_CLUSTER, CONTAINERS_ACCROSS_CLUSTER) / 2)))
log.info("{0} could be as large as {1} for multi-tenacty".format("NUM_THREADS", (CONTAINERS_ACCROSS_CLUSTER / 2)))
EXECUTORS_PER_THREAD = int((CONTAINERS_ACCROSS_CLUSTER - constants["NUM_THREADS"]) / constants["NUM_THREADS"])
if (constants["ENABLE_SPARK_SHUFFLE_SERVICE"]):
cdh["YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE"] = \
"{0}\n{1}".format(
"<property>"
"<name>""yarn.nodemanager.aux-services""</name>"
"<value>""spark_shuffle,mapreduce_shuffle""</value>"
"</property>",
"<property>"
"<name>yarn.nodemanager.aux-services.spark_shuffle.class</name>"
"<value>""org.apache.spark.network.yarn.YarnShuffleService</value>"
"</property>")
'''
Set the configuration for the spark shuffle service if enabled
'''
cdh["YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_CONFIG_SAFETY_VALVE"] = \
cdh["YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE"]
cdh["YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.RESOURCEMANAGER_CONFIG_SAFETY_VALVE"] = \
cdh["YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE"]
return {"cdh": cdh } | """
Calculate an optimized configuration based on overall memory, cpu, and sensible defaults.
Will configure spark and yarn.
The formula will be run on 5 node t2.large cluster hosted in AWS. t2.large nodes have 2 vcpus, and 8gb of memory each.
4 nodes are designed as yarn node managers. The formula will run with default values.
"""
def constants(cluster, log):
"""
Sets the constants needed for calculating the formula.
:param cluster: Cluster configuration connection
:param log: simple log interface with log.info, log.error, log.warning, log.fatal, log.debug
:return: a dictionary with all constants
"""
const = {'NUM_NM_WORKERS': len(cluster.yarn.nodemanager.hosts.all), 'NM_WORKER_CORES': cluster.yarn.nodemanager.hosts.max_cores, 'NM_WORKER_MEM': cluster.yarn.nodemanager.hosts.max_memory, 'MIN_NM_MEMORY': gb_to_bytes(2), 'MEM_FRACTION_FOR_OTHER_SERVICES': lambda x: x if x is not None and x >= 0 and (x < 1) else 0.125, 'MAPREDUCE_JOB_COUNTERS_MAX': lambda x: x if x is not None and x >= 120 else 500, 'SPARK_DRIVER_MAXPERMSIZE': lambda x: x if x is not None and x >= 512 else 512, 'ENABLE_SPARK_SHUFFLE_SERVICE': lambda x: False if str(x).lower() == 'false' else True, 'NUM_THREADS': lambda x: x if x is not None and x > 0 else 1, 'YARN_SCHEDULER_MINIMUM_ALLOCATION_MB': lambda x: x if x is not None and x >= 1024 else 1024, 'MAPREDUCE_MINIMUM_AM_MEMORY_MB': lambda x: x / 512 * 512 if x is not None and x >= 1024 else 1024, 'MAX_HEAP_PERCENT': lambda x: x if x is not None else 0.75, 'MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB': lambda x: x / 512 * 512 if x is not None and x >= 1024 else 1024, 'SPARK_MEMORY_OVERHEAD_MIN': 384, 'MEMORY_OVERHEAD': 0.1, 'YARN_INCREMENT_ALLOCATION_MB': 512}
if const['NM_WORKER_MEM'] < const['MIN_NM_MEMORY']:
log.fatal('Running the toolkit with less than {0}GB memory for YARN is not supported.'.format(const['MIN_NM_MEMORY']))
elif const['NM_WORKER_MEM'] <= gb_to_bytes(256):
const['MAX_JVM_MEMORY'] = const['NM_WORKER_MEM'] / 4
'\n Java Heap Size should not go over 25% of total memory per node manager\n In our sample cluster this would be 7933714432 / 4 = 1983428608\n '
else:
const['MAX_JVM_MEMORY'] = gb_to_bytes(64)
return const
def formula(cluster, log, constants):
"""
formula for calculating the optimized configuration
:param cluster: Cluster configuration connection
:param log: simple log interface with log.info, log.error, log.warning, log.fatal, log.debug
:param constants: the calculated constants with any user overrides from formula-args
:return: a dictionary with cdh configurations
"""
cdh = {}
if bytes_to_mb(constants['MAX_JVM_MEMORY']) < constants['MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB']:
'\n Make sure the user provided value is within the bounds of the cluster resources.\n '
log.warning('Container larger than {0}MB are not supported'.format(constants['MAX_JVM_MEMORY']))
if constants['MEM_FRACTION_FOR_OTHER_SERVICES'] < 0:
log.fatal('{0} must be non-nagative'.format('MEM_FRACTION_FOR_OTHER_SERVICES'))
constants['SPARK_YARN_DRIVER_MEMORYOVERHEAD'] = max(constants['SPARK_MEMORY_OVERHEAD_MIN'], constants['MAPREDUCE_MINIMUM_AM_MEMORY_MB'] * constants['MEMORY_OVERHEAD'])
'\n 6-10 percent of driver memory with a minimum of 384\n\n in our sample cluster\n max(384, 1024 * 0.10) = 384\n '
constants['SPARK_YARN_EXECUTOR_MEMORYOVERHEAD'] = max(constants['SPARK_MEMORY_OVERHEAD_MIN'], constants['MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB'] * constants['MEMORY_OVERHEAD'])
'\n 6-10 percent of executor memory with a minimum of 384\n\n in our sample cluster\n max(384, 1024 * 0.10 ) = 384\n '
cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_CPU_VCORES'] = constants['NM_WORKER_CORES']
'\n yarn.nodemanager.resource.cpu-vcores\n\n Number of CPU cores that can be allocated for containers. Typically set to the number of physical cores on each machine.\n\n in our sample cluster\n 2\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_CPU_VCORES'] = 1
'\n yarn.app.mapreduce.am.resource.cpu-vcores\n\n The number of virtual cores the mapreduce application master needs\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_JOB_COUNTERS_LIMIT'] = constants['MAPREDUCE_JOB_COUNTERS_MAX']
'\n mapreduce.job.counters.limit\n\n yarns defaults is 120 our default is 500.\n\n Limit on the number of user counters allowed per job.\n (https://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)\n '
cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE'] = '<property><name>mapreduce.job.counters.max</name><value>%d</value></property>' % constants['MAPREDUCE_JOB_COUNTERS_MAX']
'\n mapreduce.job.counters.max\n\n yarns defaults is 120 our default is 500. This sets the old max counters value from hadoop 1.x.\n\n Limit on the number of user counters allowed per job.\n (https://hadoop.apache.org/docs/r2.4.1/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)\n '
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.RESOURCEMANAGER_MAPRED_SAFETY_VALVE'] = cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE']
'\n Set the same old counters max value for resource managers\n '
cdh['YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_MAPRED_SAFETY_VALVE'] = cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_MAPRED_SAFETY_VALVE']
'\n Set the same old counters max value for job history server\n '
mem_for_other_services = int(constants['NM_WORKER_MEM'] * constants['MEM_FRACTION_FOR_OTHER_SERVICES'])
'\n Memory reserved for other cluster services.\n the default will be calucation is total worker memory * 0.125\n\n in our sample cluster\n (7933714432 * 0.125 )= 991714304\n '
mem_per_nm = constants['NM_WORKER_MEM'] - MEM_FOR_OTHER_SERVICES
'\n Total worker memory minus the percentage reserved for other services\n\n in our sample cluster\n 7933714432 - 991714304 = 6942000128\n '
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB'] = constants['YARN_INCREMENT_ALLOCATION_MB']
'\n yarn.scheduler.increment-allocation-mb\n\n https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml\n\n in our sample cluster\n 512\n '
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB'] = int(bytes_to_mb(MEM_PER_NM) - max(constants['SPARK_DRIVER_MAXPERMSIZE'], constants['SPARK_YARN_DRIVER_MEMORYOVERHEAD'], constants['SPARK_YARN_EXECUTOR_MEMORYOVERHEAD']) * 3) / cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB'] * cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB']
'\n yarn.scheduler.maximum-allocation-mb\n\n take available worker memory account for memory overheads and round to the nearest yarn.scheduler.increment-allocation-mb.\n\n (https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml)\n\n in our sample cluster\n ( int( 6620 - max( 512, 512, 384) * 3 )/ 512 ) * 512 = 4608\n '
cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_MEMORY_MB'] = cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB']
'\n yarn.nodemanager.resource.memory-mb\n\n Amount of physical memory, in MB, that can be allocated for containers. we use the previous calculation from\n yarn.scheduler.maximum-allocation-mb\n\n https://hadoop.apache.org/docs/r2.6.1/hadoop-yarn/hadoop-yarn-common/yarn-default.xml\n\n in our sample cluster\n 4608\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB'] = max(min(cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_MB'] / constants['NM_WORKER_CORES'] / cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB'] * cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB'], bytes_to_mb(constants['MAX_JVM_MEMORY'])), constants['MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB'])
'\n mapreduce.map.memory.mb\n\n The amount of memory to request from the scheduler for each map task.\n\n https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml\n\n result,MAPREDUCE_MINIMUM_EXECUTOR_MEMORY_MB\n\n In our sample cluster\n max( min( ( ( 4608/4 ) / 512 ) * 512, 1891), 1024) = 1891\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_REDUCE_MEMORY_MB'] = 2 * min(cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB'], bytes_to_mb(constants['MAX_JVM_MEMORY']))
'\n mapreduce.reduce.memory.mb\n\n The amount of memory to request from the scheduler for each reduce task.\n\n (https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml)\n\n in our sample cluster\n 2 * min( 1891, 1891 ) = 3782\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_JAVA_OPTS_MAX_HEAP'] = mb_to_bytes(int(cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB'] * constants['MAX_HEAP_PERCENT']))
'\n mapreduce.map.java.opts.max.heap\n\n max java heap size for the map task. Standard practice is to make this 75 percent of mapreduce.reduce.memory.mb.\n\n in our sample cluster\n mb_to_bytes(int( 1891 * 0.75 )) = 1486880768 bytes or 1418 MB\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_REDUCE_JAVA_OPTS_MAX_HEAP'] = 2 * cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_JAVA_OPTS_MAX_HEAP']
'\n mapreduce.reduce.java.opts.max.heap\n\n max java heap size for the reduce task. Standard practice is to make this 75 percent of mapreduce.reduce.java.opts.max.heap\n\n in our sample cluster\n 2 * 1486880768 = 2973761536 or 2836\n '
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MINIMUM_ALLOCATION_MB'] = constants['YARN_SCHEDULER_MINIMUM_ALLOCATION_MB']
"\n yarn.scheduler.minimum-allocation-mb\n\n The minimum allocation for every container request at the RM, in MBs.\n Memory requests lower than this won't take effect, and the specified value will get allocated at minimum.\n\n https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml\n\n in our cluster\n 1024\n "
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_MAXIMUM_ALLOCATION_VCORES'] = cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_CPU_VCORES']
"\n yarn.scheduler.maximum-allocation-vcores\n\n The maximum allocation for every container request at the RM, in terms of virtual CPU cores.\n Requests higher than this won't take effect, and will get capped to this value.\n\n https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml\n\n in our cluster\n 2\n "
cdh['YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_MB'] = constants['MAPREDUCE_MINIMUM_AM_MEMORY_MB']
'\n yarn.app.mapreduce.am.resource.mb\n\n The amount of memory the MR AppMaster needs.\n\n https://hadoop.apache.org/docs/stable/hadoop-mapreduce-client/hadoop-mapreduce-client-core/mapred-default.xml\n\n in our sample cluster\n 1024\n '
cdh['YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_MAX_HEAP'] = mb_to_bytes(int(cdh['YARN.GATEWAY.GATEWAY_BASE.YARN_APP_MAPREDUCE_AM_RESOURCE_MB'] * constants['MAX_HEAP_PERCENT']))
'\n YARN_APP_MAPREDUCE_AM_MAX_HEAP\n\n The maximum heap size, in bytes, of the Java MapReduce ApplicationMaster.\n\n https://www.cloudera.com/documentation/enterprise/5-7-x/topics/cm_props_cdh570_yarn_mr2included_.html\n\n in our sample cluster\n mb_to_bytes(int( 1024 * 0.75)) = 805306368\n '
containers_accross_cluster = int(cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.YARN_NODEMANAGER_RESOURCE_MEMORY_MB'] / (cdh['YARN.GATEWAY.GATEWAY_BASE.MAPREDUCE_MAP_MEMORY_MB'] + 2 * max(constants['SPARK_YARN_DRIVER_MEMORYOVERHEAD'], constants['SPARK_YARN_EXECUTOR_MEMORYOVERHEAD'], cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB']) / cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB'] * cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.YARN_SCHEDULER_INCREMENT_ALLOCATION_MB']) * constants['NUM_NM_WORKERS'])
"\n calculate the total number of containers that can run across the cluster. This value is not used in this formula but\n it's useful as a reference if you want to create yarn client configuration and need to know how many containers\n you can request.\n\n in our sample cluster\n int(4608 / ( (1891 + (2 * max(384, 384, 512) / 512) * 512 ) ) * 4) = 4\n "
'\n Check if the user provided num threads falls with in the capacity of the cluster.\n '
if constants['NUM_THREADS'] > CONTAINERS_ACCROSS_CLUSTER / 2:
log.fatal('Number of concurrent threads should be at most {0}'.format(min(CONTAINERS_ACCROSS_CLUSTER, CONTAINERS_ACCROSS_CLUSTER) / 2))
log.info('{0} could be as large as {1} for multi-tenacty'.format('NUM_THREADS', CONTAINERS_ACCROSS_CLUSTER / 2))
executors_per_thread = int((CONTAINERS_ACCROSS_CLUSTER - constants['NUM_THREADS']) / constants['NUM_THREADS'])
if constants['ENABLE_SPARK_SHUFFLE_SERVICE']:
cdh['YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE'] = '{0}\n{1}'.format('<property><name>yarn.nodemanager.aux-services</name><value>spark_shuffle,mapreduce_shuffle</value></property>', '<property><name>yarn.nodemanager.aux-services.spark_shuffle.class</name><value>org.apache.spark.network.yarn.YarnShuffleService</value></property>')
'\n Set the configuration for the spark shuffle service if enabled\n '
cdh['YARN.NODEMANAGER.NODEMANAGER_BASE.NODEMANAGER_CONFIG_SAFETY_VALVE'] = cdh['YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE']
cdh['YARN.RESOURCEMANAGER.RESOURCEMANAGER_BASE.RESOURCEMANAGER_CONFIG_SAFETY_VALVE'] = cdh['YARN.JOBHISTORY.JOBHISTORY_BASE.JOBHISTORY_CONFIG_SAFETY_VALVE']
return {'cdh': cdh} |
def total(lists):
array = []
sum = 0
for i in lists:
sum += i
array.append(sum)
return array
listss = [1,2,3,5,5,4]
print(total(listss))
| def total(lists):
array = []
sum = 0
for i in lists:
sum += i
array.append(sum)
return array
listss = [1, 2, 3, 5, 5, 4]
print(total(listss)) |
description = 'Setup for the ma11 dom motor'
devices = dict(
dom = device('nicos_ess.devices.epics.motor.EpicsMotor',
description = 'Sample stick rotation',
motorpv = 'SQ:SANS:ma11:dom',
errormsgpv = 'SQ:SANS:ma11:dom-MsgTxt',
precision = 0.1,
),
)
| description = 'Setup for the ma11 dom motor'
devices = dict(dom=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Sample stick rotation', motorpv='SQ:SANS:ma11:dom', errormsgpv='SQ:SANS:ma11:dom-MsgTxt', precision=0.1)) |
with open("input.txt", "r") as f:
values = [int(e) for e in f.readlines()]
windowsSum = list()
index = 0
for value in values:
if(index+2 < len(values)):
sum = value
sum += values[index+1]
sum += values[index+2]
windowsSum.append(sum)
index += 1
isFirst = True
cValue = 0
counter = 0
for value in windowsSum :
if isFirst: isFirst = False
else:
if cValue < value :
counter += 1
cValue = value
print("Total increment = ", counter)
| with open('input.txt', 'r') as f:
values = [int(e) for e in f.readlines()]
windows_sum = list()
index = 0
for value in values:
if index + 2 < len(values):
sum = value
sum += values[index + 1]
sum += values[index + 2]
windowsSum.append(sum)
index += 1
is_first = True
c_value = 0
counter = 0
for value in windowsSum:
if isFirst:
is_first = False
elif cValue < value:
counter += 1
c_value = value
print('Total increment = ', counter) |
TOKEN = "<Your Bot Token Here>"
LOG_LEVEL_STDOUT = "DEBUG" # Console log level
LOG_LEVEL_FILE = "INFO" # File log level
| token = '<Your Bot Token Here>'
log_level_stdout = 'DEBUG'
log_level_file = 'INFO' |
# Bus Routes
# each routes[i] is a bus route that the i-th bus repeats forever
# we start at bus stop S and we want to go to bus stop T
# rravelling by buses only, find the least number of buses to take
class Solution(object):
def numBusesToDestination(self, routes, S, T):
"""
:type routes: List[List[int]]
:type S: int
:type T: int
:rtype: int
"""
stop_to_routes = collections.defaultdict(set)
for i, route in enumerate(routes):
for stop in route:
stop_to_routes[stop].add(i)
visited_stops = set([S])
visited_routes = set()
queue = collections.deque([(S, 0)])
while queue:
stop, routes_taken = queue.popleft()
if stop == T:
return routes_taken
for route_id in stop_to_routes[stop]:
if route_id not in visited_routes:
for next_stop in routes[route_id]:
if next_stop not in visited_stops:
queue.append((next_stop, routes_taken + 1))
visited_stops.add(next_stop)
visited_routes.add(route_id)
return -1
| class Solution(object):
def num_buses_to_destination(self, routes, S, T):
"""
:type routes: List[List[int]]
:type S: int
:type T: int
:rtype: int
"""
stop_to_routes = collections.defaultdict(set)
for (i, route) in enumerate(routes):
for stop in route:
stop_to_routes[stop].add(i)
visited_stops = set([S])
visited_routes = set()
queue = collections.deque([(S, 0)])
while queue:
(stop, routes_taken) = queue.popleft()
if stop == T:
return routes_taken
for route_id in stop_to_routes[stop]:
if route_id not in visited_routes:
for next_stop in routes[route_id]:
if next_stop not in visited_stops:
queue.append((next_stop, routes_taken + 1))
visited_stops.add(next_stop)
visited_routes.add(route_id)
return -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.