content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module CISCO-ATM-SWITCH-CUG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-SWITCH-CUG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:33:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") TimeTicks, MibIdentifier, Gauge32, Unsigned32, Counter64, Bits, NotificationType, IpAddress, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, ModuleIdentity, Integer32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "MibIdentifier", "Gauge32", "Unsigned32", "Counter64", "Bits", "NotificationType", "IpAddress", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "ModuleIdentity", "Integer32", "Counter32") RowStatus, DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TruthValue", "TextualConvention") csCugMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 89)) if mibBuilder.loadTexts: csCugMIB.setLastUpdated('9707070000Z') if mibBuilder.loadTexts: csCugMIB.setOrganization('Cisco Systems, Inc.') class CsCugInterlockCode(TextualConvention, OctetString): reference = 'Atm Forum Contribution 96-1347.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(24, 24), ) class Unsigned32(TextualConvention, Gauge32): status = 'current' csCugMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 1)) csCugInterlockCodeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1), ) if mibBuilder.loadTexts: csCugInterlockCodeTable.setStatus('current') csCugInterlockCodeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1), ).setIndexNames((0, "CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCode")) if mibBuilder.loadTexts: csCugInterlockCodeEntry.setStatus('current') csCugInterlockCode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 1), CsCugInterlockCode()) if mibBuilder.loadTexts: csCugInterlockCode.setStatus('current') csCugInterlockCodeAliasName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 30))).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugInterlockCodeAliasName.setStatus('current') csCugInterlockCodeRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugInterlockCodeRowStatus.setStatus('current') csCugIfTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2), ) if mibBuilder.loadTexts: csCugIfTable.setStatus('current') csCugIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: csCugIfEntry.setStatus('current') csCugIfAccessEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 1), TruthValue().clone('true')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfAccessEnable.setStatus('current') csCugIfPermitUnknownCugsToUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 2), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfPermitUnknownCugsToUser.setStatus('current') csCugIfPermitUnknownCugsFromUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("deny", 1), ("permitPerCall", 2), ("permitPermanently", 3))).clone('deny')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfPermitUnknownCugsFromUser.setStatus('current') csCugIfRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfRowStatus.setStatus('current') csCugTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3), ) if mibBuilder.loadTexts: csCugTable.setStatus('current') csCugEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCode")) if mibBuilder.loadTexts: csCugEntry.setStatus('current') csCugIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIndex.setStatus('current') csCugPreferential = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 2), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugPreferential.setStatus('current') csCugDenySameGroupToUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 3), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugDenySameGroupToUser.setStatus('current') csCugDenySameGroupFromUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 4), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugDenySameGroupFromUser.setStatus('current') csCugRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugRowStatus.setStatus('current') csCugMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3)) csCugMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1)) csCugMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2)) csCugMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1, 1)).setObjects(("CISCO-ATM-SWITCH-CUG-MIB", "csCugMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): csCugMIBCompliance = csCugMIBCompliance.setStatus('current') csCugMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2, 1)).setObjects(("CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCodeAliasName"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCodeRowStatus"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfAccessEnable"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfPermitUnknownCugsToUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfPermitUnknownCugsFromUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfRowStatus"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIndex"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugPreferential"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugDenySameGroupToUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugDenySameGroupFromUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): csCugMIBGroup = csCugMIBGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-ATM-SWITCH-CUG-MIB", csCugMIBGroup=csCugMIBGroup, csCugInterlockCode=csCugInterlockCode, csCugIfTable=csCugIfTable, csCugIfAccessEnable=csCugIfAccessEnable, csCugEntry=csCugEntry, csCugIfRowStatus=csCugIfRowStatus, csCugMIBConformance=csCugMIBConformance, Unsigned32=Unsigned32, CsCugInterlockCode=CsCugInterlockCode, csCugMIBCompliance=csCugMIBCompliance, csCugRowStatus=csCugRowStatus, PYSNMP_MODULE_ID=csCugMIB, csCugIfPermitUnknownCugsFromUser=csCugIfPermitUnknownCugsFromUser, csCugIfEntry=csCugIfEntry, csCugDenySameGroupFromUser=csCugDenySameGroupFromUser, csCugDenySameGroupToUser=csCugDenySameGroupToUser, csCugMIBCompliances=csCugMIBCompliances, csCugMIBObjects=csCugMIBObjects, csCugMIB=csCugMIB, csCugInterlockCodeRowStatus=csCugInterlockCodeRowStatus, csCugPreferential=csCugPreferential, csCugMIBGroups=csCugMIBGroups, csCugIndex=csCugIndex, csCugIfPermitUnknownCugsToUser=csCugIfPermitUnknownCugsToUser, csCugInterlockCodeAliasName=csCugInterlockCodeAliasName, csCugInterlockCodeTable=csCugInterlockCodeTable, csCugInterlockCodeEntry=csCugInterlockCodeEntry, csCugTable=csCugTable)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint') (cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup') (time_ticks, mib_identifier, gauge32, unsigned32, counter64, bits, notification_type, ip_address, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, module_identity, integer32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'MibIdentifier', 'Gauge32', 'Unsigned32', 'Counter64', 'Bits', 'NotificationType', 'IpAddress', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'ModuleIdentity', 'Integer32', 'Counter32') (row_status, display_string, truth_value, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TruthValue', 'TextualConvention') cs_cug_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 89)) if mibBuilder.loadTexts: csCugMIB.setLastUpdated('9707070000Z') if mibBuilder.loadTexts: csCugMIB.setOrganization('Cisco Systems, Inc.') class Cscuginterlockcode(TextualConvention, OctetString): reference = 'Atm Forum Contribution 96-1347.' status = 'current' subtype_spec = OctetString.subtypeSpec + constraints_union(value_size_constraint(4, 4), value_size_constraint(24, 24)) class Unsigned32(TextualConvention, Gauge32): status = 'current' cs_cug_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 1)) cs_cug_interlock_code_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1)) if mibBuilder.loadTexts: csCugInterlockCodeTable.setStatus('current') cs_cug_interlock_code_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1)).setIndexNames((0, 'CISCO-ATM-SWITCH-CUG-MIB', 'csCugInterlockCode')) if mibBuilder.loadTexts: csCugInterlockCodeEntry.setStatus('current') cs_cug_interlock_code = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 1), cs_cug_interlock_code()) if mibBuilder.loadTexts: csCugInterlockCode.setStatus('current') cs_cug_interlock_code_alias_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 30))).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugInterlockCodeAliasName.setStatus('current') cs_cug_interlock_code_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 3), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugInterlockCodeRowStatus.setStatus('current') cs_cug_if_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2)) if mibBuilder.loadTexts: csCugIfTable.setStatus('current') cs_cug_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: csCugIfEntry.setStatus('current') cs_cug_if_access_enable = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 1), truth_value().clone('true')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugIfAccessEnable.setStatus('current') cs_cug_if_permit_unknown_cugs_to_user = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 2), truth_value().clone('false')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugIfPermitUnknownCugsToUser.setStatus('current') cs_cug_if_permit_unknown_cugs_from_user = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('deny', 1), ('permitPerCall', 2), ('permitPermanently', 3))).clone('deny')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugIfPermitUnknownCugsFromUser.setStatus('current') cs_cug_if_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugIfRowStatus.setStatus('current') cs_cug_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3)) if mibBuilder.loadTexts: csCugTable.setStatus('current') cs_cug_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'CISCO-ATM-SWITCH-CUG-MIB', 'csCugInterlockCode')) if mibBuilder.loadTexts: csCugEntry.setStatus('current') cs_cug_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugIndex.setStatus('current') cs_cug_preferential = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 2), truth_value().clone('false')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugPreferential.setStatus('current') cs_cug_deny_same_group_to_user = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 3), truth_value().clone('false')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugDenySameGroupToUser.setStatus('current') cs_cug_deny_same_group_from_user = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 4), truth_value().clone('false')).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugDenySameGroupFromUser.setStatus('current') cs_cug_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: csCugRowStatus.setStatus('current') cs_cug_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3)) cs_cug_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1)) cs_cug_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2)) cs_cug_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1, 1)).setObjects(('CISCO-ATM-SWITCH-CUG-MIB', 'csCugMIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cs_cug_mib_compliance = csCugMIBCompliance.setStatus('current') cs_cug_mib_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2, 1)).setObjects(('CISCO-ATM-SWITCH-CUG-MIB', 'csCugInterlockCodeAliasName'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugInterlockCodeRowStatus'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugIfAccessEnable'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugIfPermitUnknownCugsToUser'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugIfPermitUnknownCugsFromUser'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugIfRowStatus'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugIndex'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugPreferential'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugDenySameGroupToUser'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugDenySameGroupFromUser'), ('CISCO-ATM-SWITCH-CUG-MIB', 'csCugRowStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cs_cug_mib_group = csCugMIBGroup.setStatus('current') mibBuilder.exportSymbols('CISCO-ATM-SWITCH-CUG-MIB', csCugMIBGroup=csCugMIBGroup, csCugInterlockCode=csCugInterlockCode, csCugIfTable=csCugIfTable, csCugIfAccessEnable=csCugIfAccessEnable, csCugEntry=csCugEntry, csCugIfRowStatus=csCugIfRowStatus, csCugMIBConformance=csCugMIBConformance, Unsigned32=Unsigned32, CsCugInterlockCode=CsCugInterlockCode, csCugMIBCompliance=csCugMIBCompliance, csCugRowStatus=csCugRowStatus, PYSNMP_MODULE_ID=csCugMIB, csCugIfPermitUnknownCugsFromUser=csCugIfPermitUnknownCugsFromUser, csCugIfEntry=csCugIfEntry, csCugDenySameGroupFromUser=csCugDenySameGroupFromUser, csCugDenySameGroupToUser=csCugDenySameGroupToUser, csCugMIBCompliances=csCugMIBCompliances, csCugMIBObjects=csCugMIBObjects, csCugMIB=csCugMIB, csCugInterlockCodeRowStatus=csCugInterlockCodeRowStatus, csCugPreferential=csCugPreferential, csCugMIBGroups=csCugMIBGroups, csCugIndex=csCugIndex, csCugIfPermitUnknownCugsToUser=csCugIfPermitUnknownCugsToUser, csCugInterlockCodeAliasName=csCugInterlockCodeAliasName, csCugInterlockCodeTable=csCugInterlockCodeTable, csCugInterlockCodeEntry=csCugInterlockCodeEntry, csCugTable=csCugTable)
__author__ = 'rramchandani' class TimeOutException(Exception): message = "There was a system timeout before operation could be able to complete." class BuildError(Exception): message = "Invalid Build ID" class LoginError(Exception): message = "It's mandatory be logged in; to execute this operation." class RacetrackError(Exception): pass class ProgramNotExecuted(Exception): message = "Program couldn't be executed within the Guest." class TaskExecutionFailed(Exception): message = "Task couldn't get executed."
__author__ = 'rramchandani' class Timeoutexception(Exception): message = 'There was a system timeout before operation could be able to complete.' class Builderror(Exception): message = 'Invalid Build ID' class Loginerror(Exception): message = "It's mandatory be logged in; to execute this operation." class Racetrackerror(Exception): pass class Programnotexecuted(Exception): message = "Program couldn't be executed within the Guest." class Taskexecutionfailed(Exception): message = "Task couldn't get executed."
#Program to implement Round Robin print("Round Robin Scheduling algorithm") print("================================") headers = ['Processes','Arrival Time','Burst Time','Completion Time','Waiting Time', 'Turn-Around Time'] out = [] quantum = int(input("Enter value for quantum := ")) N = int(input("Enter number of processes := ")) bt = [] t = 0 for i in range(N): k = f'P{i+1}' a = int(input(f"Enter arrival time of process {k} := ")) b = int(input(f"Enter burst time of process {k} := ")) out.append([k,[a,b,0,0,0],0]) bt.append(b) out.sort(key=lambda i: i[1][1], reverse=True) while True: done = True for i in range(N): if bt[i] > 0: done = False if bt[i] > quantum: t += quantum bt[i] -= quantum else: if out[i][2] != 1: t += bt[i] out[i][1][2] += t - out[i][1][1] - out[i][1][0] bt[i] = 0 out[i][2] = 1 if done == True: break for i in range(N): out[i][1][3] = out[i][1][1] + out[i][1][2] for i in range(N): out[i][1][4] = out[i][1][3] + out[i][1][0] avgWT = 0 avgTAT = 0 for i in range(N): avgWT += out[i][1][2] avgTAT += out[i][1][3] avgWT /= N avgTAT /= N print(f"{headers[0]:^15}{headers[1]:^15}{headers[2]:^15}{headers[3]:^15}{headers[4]:^15}{headers[5]:^15}") for a in out: print(f"{a[0]:^15}{a[1][0]:^15}{a[1][1]:^15}{a[1][4]:^15}{a[1][2]:^15}{a[1][3]:^15}") print(f"Average Waiting Time : {avgWT}\nAverage Turn-Around time : {avgTAT}")
print('Round Robin Scheduling algorithm') print('================================') headers = ['Processes', 'Arrival Time', 'Burst Time', 'Completion Time', 'Waiting Time', 'Turn-Around Time'] out = [] quantum = int(input('Enter value for quantum := ')) n = int(input('Enter number of processes := ')) bt = [] t = 0 for i in range(N): k = f'P{i + 1}' a = int(input(f'Enter arrival time of process {k} := ')) b = int(input(f'Enter burst time of process {k} := ')) out.append([k, [a, b, 0, 0, 0], 0]) bt.append(b) out.sort(key=lambda i: i[1][1], reverse=True) while True: done = True for i in range(N): if bt[i] > 0: done = False if bt[i] > quantum: t += quantum bt[i] -= quantum elif out[i][2] != 1: t += bt[i] out[i][1][2] += t - out[i][1][1] - out[i][1][0] bt[i] = 0 out[i][2] = 1 if done == True: break for i in range(N): out[i][1][3] = out[i][1][1] + out[i][1][2] for i in range(N): out[i][1][4] = out[i][1][3] + out[i][1][0] avg_wt = 0 avg_tat = 0 for i in range(N): avg_wt += out[i][1][2] avg_tat += out[i][1][3] avg_wt /= N avg_tat /= N print(f'{headers[0]:^15}{headers[1]:^15}{headers[2]:^15}{headers[3]:^15}{headers[4]:^15}{headers[5]:^15}') for a in out: print(f'{a[0]:^15}{a[1][0]:^15}{a[1][1]:^15}{a[1][4]:^15}{a[1][2]:^15}{a[1][3]:^15}') print(f'Average Waiting Time : {avgWT}\nAverage Turn-Around time : {avgTAT}')
conjunto = set() print(conjunto) conjunto = {1,2,3} conjunto.add(4) conjunto.add(0) conjunto.add('H') conjunto.add('A') conjunto.add('Z') print(conjunto) grupo = {'Hector', 'Juan', 'Mario'} print('Hector' in grupo) test = {'Hector', 'Hector', 'Hector'} print(test) # CASTEO l = [1,2,3,3,2,1] c = set(l) print(c) l = [1,2,3,3,2,1] l = list(set(l)) print(l)
conjunto = set() print(conjunto) conjunto = {1, 2, 3} conjunto.add(4) conjunto.add(0) conjunto.add('H') conjunto.add('A') conjunto.add('Z') print(conjunto) grupo = {'Hector', 'Juan', 'Mario'} print('Hector' in grupo) test = {'Hector', 'Hector', 'Hector'} print(test) l = [1, 2, 3, 3, 2, 1] c = set(l) print(c) l = [1, 2, 3, 3, 2, 1] l = list(set(l)) print(l)
""" Contains mocks for testing purposes. """ mock_get = { '/computes/local': '{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}', '/version': '{"local": true, "version": "2.0.3"}', '/computes': '[{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}, {"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}]', '/computes/11df1f68-23ab-42f5-9a93-af65b7daad2a': '{"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}', '/projects': '[{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}, {"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/drawings': '[{"drawing_id": "dc218a7f-221d-4340-9902-4d2c1726e081", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.8/30</text></svg>", "x": -298, "y": -16, "z": 1}, {"drawing_id": "43cbd5ca-5da7-43fb-92bf-525cb7b4ee98", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC2 \\nIP/MASK 192.168.20.1/24 \\nGATEWAY 192.168.20.254 \\nMAC 00:50:79:66:68:00 \\nDNS</text></svg>", "x": 428, "y": 116, "z": 1}, {"drawing_id": "1dbed980-73d4-4dc1-afc6-149d559fb5ce", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.0/30</text></svg>", "x": -113, "y": -171, "z": 1}, {"drawing_id": "a2f423d3-c30c-40cd-85dc-824d5ffa0cc3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"73\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.12/30</text></svg>", "x": -109, "y": 129, "z": 1}, {"drawing_id": "a9c0d8b8-f66f-4ddb-be1a-6a0730c83aa3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.4/30</text></svg>", "x": 80, "y": -16, "z": 1}, {"drawing_id": "5a751cb0-cb68-451c-a88d-58bb6c25f605", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC1 \\nIP/MASK 192.168.10.1/24 \\nGATEWAY 192.168.10.254 \\nMAC 00:50:79:66:68:01 \\nDNS</text></svg>", "x": -696, "y": -184, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/links': '[{"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "ec8cc0f1-455a-4c85-adf6-dc1083721cc5", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": 33, "y": 62}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 1}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 45, "y": -26}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "1ba79bea-9d55-40d2-9bd0-9e86975cf87a", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 74, "y": -7}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": -41, "y": -7}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "7ef771d2-ac8f-46eb-a61b-f1d851fdd952", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 79, "y": 32}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": -36, "y": 32}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 1}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "56814a58-c7cd-4384-9a2d-69b80e55d49c", "link_type": "ethernet", "nodes": [{"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": 74, "y": 30}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": -17, "y": 33}, "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "582f802b-641f-44a7-bd9e-de1ecb60196c", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": 72, "y": 29}, "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "port_number": 0}, {"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": -40, "y": -8}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "008c61c2-d247-4e61-b8a8-1b816c4278ca", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 48, "y": 52}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}, {"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": -11, "y": -28}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/df2f8f9c-23cf-4001-a1d1-834f0ff66436': '{"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/7e6c9433-dbab-4b34-a731-2b43a7f77fef': '{"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/61c67710-3c63-4f0d-bc4c-9680593e1a19': '{"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/a73e4d0e-2572-4945-8777-2b64919eba95': '{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a': '{"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/be1673f7-b534-4263-bf83-ac05eb618360': '{"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes': '[{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/snapshots': '[{"created_at": 1502551604, "name": "Test Snapshot", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "snapshot_id": "de81908c-94f0-449d-bb03-79b82b0adf05"}]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/drawings': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/links': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/nodes': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/snapshots': '[]'}
""" Contains mocks for testing purposes. """ mock_get = {'/computes/local': '{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}', '/version': '{"local": true, "version": "2.0.3"}', '/computes': '[{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}, {"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}]', '/computes/11df1f68-23ab-42f5-9a93-af65b7daad2a': '{"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}', '/projects': '[{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}, {"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/drawings': '[{"drawing_id": "dc218a7f-221d-4340-9902-4d2c1726e081", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.8/30</text></svg>", "x": -298, "y": -16, "z": 1}, {"drawing_id": "43cbd5ca-5da7-43fb-92bf-525cb7b4ee98", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC2 \\nIP/MASK 192.168.20.1/24 \\nGATEWAY 192.168.20.254 \\nMAC 00:50:79:66:68:00 \\nDNS</text></svg>", "x": 428, "y": 116, "z": 1}, {"drawing_id": "1dbed980-73d4-4dc1-afc6-149d559fb5ce", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.0/30</text></svg>", "x": -113, "y": -171, "z": 1}, {"drawing_id": "a2f423d3-c30c-40cd-85dc-824d5ffa0cc3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"73\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.12/30</text></svg>", "x": -109, "y": 129, "z": 1}, {"drawing_id": "a9c0d8b8-f66f-4ddb-be1a-6a0730c83aa3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.4/30</text></svg>", "x": 80, "y": -16, "z": 1}, {"drawing_id": "5a751cb0-cb68-451c-a88d-58bb6c25f605", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC1 \\nIP/MASK 192.168.10.1/24 \\nGATEWAY 192.168.10.254 \\nMAC 00:50:79:66:68:01 \\nDNS</text></svg>", "x": -696, "y": -184, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/links': '[{"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "ec8cc0f1-455a-4c85-adf6-dc1083721cc5", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": 33, "y": 62}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 1}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 45, "y": -26}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "1ba79bea-9d55-40d2-9bd0-9e86975cf87a", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 74, "y": -7}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": -41, "y": -7}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "7ef771d2-ac8f-46eb-a61b-f1d851fdd952", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 79, "y": 32}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": -36, "y": 32}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 1}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "56814a58-c7cd-4384-9a2d-69b80e55d49c", "link_type": "ethernet", "nodes": [{"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": 74, "y": 30}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": -17, "y": 33}, "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "582f802b-641f-44a7-bd9e-de1ecb60196c", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": 72, "y": 29}, "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "port_number": 0}, {"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": -40, "y": -8}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "008c61c2-d247-4e61-b8a8-1b816c4278ca", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 48, "y": 52}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}, {"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": -11, "y": -28}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/df2f8f9c-23cf-4001-a1d1-834f0ff66436': '{"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/7e6c9433-dbab-4b34-a731-2b43a7f77fef': '{"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/61c67710-3c63-4f0d-bc4c-9680593e1a19': '{"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/a73e4d0e-2572-4945-8777-2b64919eba95': '{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a': '{"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/be1673f7-b534-4263-bf83-ac05eb618360': '{"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes': '[{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/snapshots': '[{"created_at": 1502551604, "name": "Test Snapshot", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "snapshot_id": "de81908c-94f0-449d-bb03-79b82b0adf05"}]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/drawings': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/links': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/nodes': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/snapshots': '[]'}
def _mask_border_keypoints(image, keypoints, dist): """Removes keypoints that are within dist pixels from the image border.""" width = image.shape[0] height = image.shape[1] keypoints_filtering_mask = ((dist - 1 < keypoints[:, 0]) & (keypoints[:, 0] < width - dist + 1) & (dist - 1 < keypoints[:, 1]) & (keypoints[:, 1] < height - dist + 1)) return keypoints_filtering_mask def pairwise_hamming_distance(array1, array2): """**Experimental function**. Calculate hamming dissimilarity measure between two sets of vectors. Parameters ---------- array1 : (P1, D) array P1 vectors of size D. array2 : (P2, D) array P2 vectors of size D. Returns ------- distance : (P1, P2) array of dtype float 2D ndarray with value at an index (i, j) representing the hamming distance in the range [0, 1] between ith vector in array1 and jth vector in array2. """ distance = (array1[:, None] != array2[None]).mean(axis=2) return distance
def _mask_border_keypoints(image, keypoints, dist): """Removes keypoints that are within dist pixels from the image border.""" width = image.shape[0] height = image.shape[1] keypoints_filtering_mask = (dist - 1 < keypoints[:, 0]) & (keypoints[:, 0] < width - dist + 1) & (dist - 1 < keypoints[:, 1]) & (keypoints[:, 1] < height - dist + 1) return keypoints_filtering_mask def pairwise_hamming_distance(array1, array2): """**Experimental function**. Calculate hamming dissimilarity measure between two sets of vectors. Parameters ---------- array1 : (P1, D) array P1 vectors of size D. array2 : (P2, D) array P2 vectors of size D. Returns ------- distance : (P1, P2) array of dtype float 2D ndarray with value at an index (i, j) representing the hamming distance in the range [0, 1] between ith vector in array1 and jth vector in array2. """ distance = (array1[:, None] != array2[None]).mean(axis=2) return distance
class Solution: """ @param L: Given n pieces of wood with length L[i] @param k: An integer @return: The maximum length of the small pieces """ def woodCut(self, L, k): # write your code here if L is None or len(L) == 0: return 0 start = 0 end = max(L) while(start + 1 < end): mid = start + (end - start) / 2 if self.is_sufficent(L, mid, k): start = mid else: end = mid return end if self.is_sufficent(L, end, k) else start def is_sufficent(self, L, length, nums): if length == 0: return False ans = 0 for i in range(len(L)): ans += L[i] // length return ans >= nums
class Solution: """ @param L: Given n pieces of wood with length L[i] @param k: An integer @return: The maximum length of the small pieces """ def wood_cut(self, L, k): if L is None or len(L) == 0: return 0 start = 0 end = max(L) while start + 1 < end: mid = start + (end - start) / 2 if self.is_sufficent(L, mid, k): start = mid else: end = mid return end if self.is_sufficent(L, end, k) else start def is_sufficent(self, L, length, nums): if length == 0: return False ans = 0 for i in range(len(L)): ans += L[i] // length return ans >= nums
# -*- coding: utf-8 -*- """ Created on Mon Mar 1 20:59:20 2021 @author: remotelab """ q1 = d[2]+1j*d[3] # Complex phasor for Channel 1 q2 = d[4]+1j*d[5] # Complex phasor for Channel 2 q1r = q1*abs(q2)/q2 # q1 but with phase relative to that of q2 x = ( d[1] ) # Frequency for the x-data y = ( abs(q1r), angle(q1r) ) # Scaled magnitude and phase for Channel 1 xlabels = 'Frequency (Hz)' ylabels = ( 'Magnitude', 'Relative Phase' )
""" Created on Mon Mar 1 20:59:20 2021 @author: remotelab """ q1 = d[2] + 1j * d[3] q2 = d[4] + 1j * d[5] q1r = q1 * abs(q2) / q2 x = d[1] y = (abs(q1r), angle(q1r)) xlabels = 'Frequency (Hz)' ylabels = ('Magnitude', 'Relative Phase')
class Token(object): def __init__(self, token_type, value): """Initialize with token type and value""" self.token_type = token_type self.value = value def __eq__(self, other): return self.token_type == other.token_type and self.value == other.value def __str__(self): """String representation of the token""" return str(self.token_type) + " | " + str(self.value) def get_token_type(string, types): """Match the token with it's type""" # Get the token type from the dictionary token_type = types.get(string) # If there's nothing, it's either an num literal or an identifier if token_type == None: try: float(string) return "NUM_LITERAL" except: return "IDENTIFIER" else: return token_type def clean(arr): """Clean excess whitespace out of array""" for i in range(len(arr)): if(arr[i].isspace()): arr.pop(i) def tokenize(program): """Splits the input program into a series of tokens""" program = program.split() clean(program) tokens = [] inComment = False for string in program: # Check for (descriptor or comment) if string[0] == "(": inComment = True elif string[-1] == ")": inComment = False continue # Otherwhise just make the token if not inComment: tokens.append(Token(get_token_type(string, types), string)) return tokens types = { # Operations "+" : "OP", "-" : "OP", "/" : "OP", "*" : "OP", "dup" : "OP", "drop" : "OP", "swap" : "OP", "over" : "OP", "rot" : "OP", "?" : "OP", "emit" : "OP", "cr" : "OP", "=" : "OP", "." : "OP", ">" : "OP", "<" : "OP", "and" : "OP", "or" : "OP", "invert" : "OP", "mod" : "OP", "random" : "OP", # Numeric input "input" : "OP", # Conditional "if" : "IF", "then" : "THEN", "else" : "ELSE", # Loops "do" : "DO", "loop" : "LOOP", "begin" : "BEGIN", "until" : "UNTIL", # Variables and memory "variable" : "VAR_DECLARATION", "constant" : "CONST_DECLARATION", "cells" : "CELLS", "alloc" : "ALLOC", "!" : "STORE_MEMORY", "@" : "FETCH_MEMORY", # Function declaration ":" : "DEF_START", ";" : "DEF_END", # String output ".\"" : "QUOTE", # Import statement "import" : "IMPORT", # Clear stack "clear" : "OP", # Save results "save" : "OP", # Exit "exit" : "OP" }
class Token(object): def __init__(self, token_type, value): """Initialize with token type and value""" self.token_type = token_type self.value = value def __eq__(self, other): return self.token_type == other.token_type and self.value == other.value def __str__(self): """String representation of the token""" return str(self.token_type) + ' | ' + str(self.value) def get_token_type(string, types): """Match the token with it's type""" token_type = types.get(string) if token_type == None: try: float(string) return 'NUM_LITERAL' except: return 'IDENTIFIER' else: return token_type def clean(arr): """Clean excess whitespace out of array""" for i in range(len(arr)): if arr[i].isspace(): arr.pop(i) def tokenize(program): """Splits the input program into a series of tokens""" program = program.split() clean(program) tokens = [] in_comment = False for string in program: if string[0] == '(': in_comment = True elif string[-1] == ')': in_comment = False continue if not inComment: tokens.append(token(get_token_type(string, types), string)) return tokens types = {'+': 'OP', '-': 'OP', '/': 'OP', '*': 'OP', 'dup': 'OP', 'drop': 'OP', 'swap': 'OP', 'over': 'OP', 'rot': 'OP', '?': 'OP', 'emit': 'OP', 'cr': 'OP', '=': 'OP', '.': 'OP', '>': 'OP', '<': 'OP', 'and': 'OP', 'or': 'OP', 'invert': 'OP', 'mod': 'OP', 'random': 'OP', 'input': 'OP', 'if': 'IF', 'then': 'THEN', 'else': 'ELSE', 'do': 'DO', 'loop': 'LOOP', 'begin': 'BEGIN', 'until': 'UNTIL', 'variable': 'VAR_DECLARATION', 'constant': 'CONST_DECLARATION', 'cells': 'CELLS', 'alloc': 'ALLOC', '!': 'STORE_MEMORY', '@': 'FETCH_MEMORY', ':': 'DEF_START', ';': 'DEF_END', '."': 'QUOTE', 'import': 'IMPORT', 'clear': 'OP', 'save': 'OP', 'exit': 'OP'}
n = list() def notas(notes,sit=False): report = dict() report['Total'] = len(notes) report['Highest'] = max(notes) report['Lowest'] = min(notes) report['Avg'] = sum(notes)/len(notes) return report quant = int(input("How many notes do you want to register: ")) for c in range(0,quant): n.append(int(input("Type a numeric value: "))) print(notas(n,sit=True))
n = list() def notas(notes, sit=False): report = dict() report['Total'] = len(notes) report['Highest'] = max(notes) report['Lowest'] = min(notes) report['Avg'] = sum(notes) / len(notes) return report quant = int(input('How many notes do you want to register: ')) for c in range(0, quant): n.append(int(input('Type a numeric value: '))) print(notas(n, sit=True))
# -*- coding: utf-8 -*- class Solution: def totalHammingDistance(self, nums): result = 0 for digit in range(32): partial = 0 for num in nums: partial += (num >> digit) & 1 result += partial * (len(nums) - partial) return result if __name__ == '__main__': solution = Solution() assert 6 == solution.totalHammingDistance([4, 14, 2])
class Solution: def total_hamming_distance(self, nums): result = 0 for digit in range(32): partial = 0 for num in nums: partial += num >> digit & 1 result += partial * (len(nums) - partial) return result if __name__ == '__main__': solution = solution() assert 6 == solution.totalHammingDistance([4, 14, 2])
""" Write a program that accepts a year as input and outputs the century the year belongs in (e.g. 18th century's year ranges are 1701 to 1800) and whether or not the year is a leap year. Pseudocode for leap year can be found here[https://en.wikipedia.org/wiki/Leap_year#Algorithm]. Sample run: Enter Year: 1996 Century: 20 Leap Year: Yes Enter Year: 1900 Century: 19 Leap Year: No """ def leap(year): if not year % 4 == 0: return False elif not year % 100 == 0: return True elif not year % 400 == 0: return False else: return True def century(year): if year % 100: return (year // 100) + 1 else: return year // 100 if __name__ == '__main__': while True: inp = int(input('Enter Year: ')) print('Century: {}'.format(century(inp))) print('Leap Year: {}\n'.format(leap(inp)))
""" Write a program that accepts a year as input and outputs the century the year belongs in (e.g. 18th century's year ranges are 1701 to 1800) and whether or not the year is a leap year. Pseudocode for leap year can be found here[https://en.wikipedia.org/wiki/Leap_year#Algorithm]. Sample run: Enter Year: 1996 Century: 20 Leap Year: Yes Enter Year: 1900 Century: 19 Leap Year: No """ def leap(year): if not year % 4 == 0: return False elif not year % 100 == 0: return True elif not year % 400 == 0: return False else: return True def century(year): if year % 100: return year // 100 + 1 else: return year // 100 if __name__ == '__main__': while True: inp = int(input('Enter Year: ')) print('Century: {}'.format(century(inp))) print('Leap Year: {}\n'.format(leap(inp)))
# -*- coding: utf-8 -*- # 0xCCCCCCCC # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None def sorted_array_2_bst(nums): """ :type nums: List[int] :rtype: TreeNode """ if len(nums) == 0: return None return gen_bst(nums, 0, len(nums)) def gen_bst(nums, l, r): cnt = r - l if cnt == 0: return None if cnt == 1: return TreeNode(nums[l]) lc = cnt // 2 rc = cnt - lc - 1 mid = l + lc parent = TreeNode(nums[mid]) parent.left = gen_bst(nums, l, mid) parent.right = gen_bst(nums, mid+1, r) return parent
class Treenode(object): def __init__(self, x): self.val = x self.left = None self.right = None def sorted_array_2_bst(nums): """ :type nums: List[int] :rtype: TreeNode """ if len(nums) == 0: return None return gen_bst(nums, 0, len(nums)) def gen_bst(nums, l, r): cnt = r - l if cnt == 0: return None if cnt == 1: return tree_node(nums[l]) lc = cnt // 2 rc = cnt - lc - 1 mid = l + lc parent = tree_node(nums[mid]) parent.left = gen_bst(nums, l, mid) parent.right = gen_bst(nums, mid + 1, r) return parent
# initialize objects that control robot components left_motor = Motor(1) right_motor = Motor(2) gyro = Gyro() # create a controller object and set its goal controller = PID(0.2, 0.002, 0.015, time, gyro) controller.set_goal(0) # the goal is 0 because we want to head straight while True: # get the controller value controller_value = controller.get_value() # drive the robot using arcade drive controlled by the controller value arcade_drive(controller_value, 0, left_motor, right_motor)
left_motor = motor(1) right_motor = motor(2) gyro = gyro() controller = pid(0.2, 0.002, 0.015, time, gyro) controller.set_goal(0) while True: controller_value = controller.get_value() arcade_drive(controller_value, 0, left_motor, right_motor)
def ask(prompt): '''Get a number from the user.''' while True: ans = input(prompt) if ans.upper().startswith("Q"): return "Q" if ans.isdigit(): return int(ans) print("Sorry, invalid response. Please try again.")
def ask(prompt): """Get a number from the user.""" while True: ans = input(prompt) if ans.upper().startswith('Q'): return 'Q' if ans.isdigit(): return int(ans) print('Sorry, invalid response. Please try again.')
word = input("Enter your string: ") dic = {} length = len(word) count = 0 lcount = 2 while True: for elm in range(count,length): if lcount >length: break temp = word[count:lcount] if len(temp)%2 == 0: atemp = temp[0:(len(temp)//2)] btemp = temp[(len(temp)//2)::] acount = atemp.count("A") bcount = btemp.count("B") #print(count) #print(lcount) #print(atemp) #print(btemp) #print("--------") if acount == bcount and acount == len(atemp) and bcount == len(btemp): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k else: acount = atemp.count("B") bcount = btemp.count("A") if acount == bcount and acount == len(atemp) and bcount == len(btemp): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k lcount += 1 count += 1 lcount = count + 2 if count >= length: break print(dic) maxseq = None maxnum = None for key,val in dic.items(): if maxnum == None: maxseq = key maxnum = len(key) elif len(key) > maxnum: maxseq = key maxnum = len(key) print(f"{key} - {val} times") print("Longest Pattern -",maxseq)
word = input('Enter your string: ') dic = {} length = len(word) count = 0 lcount = 2 while True: for elm in range(count, length): if lcount > length: break temp = word[count:lcount] if len(temp) % 2 == 0: atemp = temp[0:len(temp) // 2] btemp = temp[len(temp) // 2:] acount = atemp.count('A') bcount = btemp.count('B') if acount == bcount and acount == len(atemp) and (bcount == len(btemp)): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k else: acount = atemp.count('B') bcount = btemp.count('A') if acount == bcount and acount == len(atemp) and (bcount == len(btemp)): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k lcount += 1 count += 1 lcount = count + 2 if count >= length: break print(dic) maxseq = None maxnum = None for (key, val) in dic.items(): if maxnum == None: maxseq = key maxnum = len(key) elif len(key) > maxnum: maxseq = key maxnum = len(key) print(f'{key} - {val} times') print('Longest Pattern -', maxseq)
""" a SQLAlchemy based implementation...so an engine string could be used. Not fully implemented """ stype = 'SQLAlchemy' renew = True class Source(object): def __init__(self, ses, **kwargs): NotImplementedError("SQLAlchemy") def getseries(self, ses, **kwargs): NotImplementedError("SQLAlchemy") return data
""" a SQLAlchemy based implementation...so an engine string could be used. Not fully implemented """ stype = 'SQLAlchemy' renew = True class Source(object): def __init__(self, ses, **kwargs): not_implemented_error('SQLAlchemy') def getseries(self, ses, **kwargs): not_implemented_error('SQLAlchemy') return data
class Menu: def __init__(self, rdoc, on_add=None): self.rdoc = rdoc self.element = rdoc.element('nav') vn = '#' + self.element.varname self.rule_menu = rdoc.stylesheet.rule(vn) self.rule_item = rdoc.stylesheet.rule(vn + ' > li') self.rule_item_hover = rdoc.stylesheet.rule(vn + ' > li:hover') self.rule_item_selected = rdoc.stylesheet.rule(vn + ' > li.selected') self.rule_item_selected_hover = rdoc.stylesheet.rule(vn + ' > li.selected:hover') self.on_add = on_add self.id_dict = {} def add_item(self, *varargs): for text in varargs: i = self.rdoc.element('li', text) self.id_dict[i.att.varname] = i self.element.append(i) if self.on_add: self.on_add(i)
class Menu: def __init__(self, rdoc, on_add=None): self.rdoc = rdoc self.element = rdoc.element('nav') vn = '#' + self.element.varname self.rule_menu = rdoc.stylesheet.rule(vn) self.rule_item = rdoc.stylesheet.rule(vn + ' > li') self.rule_item_hover = rdoc.stylesheet.rule(vn + ' > li:hover') self.rule_item_selected = rdoc.stylesheet.rule(vn + ' > li.selected') self.rule_item_selected_hover = rdoc.stylesheet.rule(vn + ' > li.selected:hover') self.on_add = on_add self.id_dict = {} def add_item(self, *varargs): for text in varargs: i = self.rdoc.element('li', text) self.id_dict[i.att.varname] = i self.element.append(i) if self.on_add: self.on_add(i)
word1 = 'ox' word2 = 'owl' word3 = 'cow' word4 = 'sheep' word5 = 'flies' word6 = 'trots' word7 = 'runs' word8 = 'blue' word9 = 'red' word10 = 'yellow' word9 = 'The ' + word9 passcode = word8 passcode = word9 passcode = passcode + ' f' passcode = passcode + word1 passcode = passcode + ' ' passcode = passcode + word6 print(passcode)
word1 = 'ox' word2 = 'owl' word3 = 'cow' word4 = 'sheep' word5 = 'flies' word6 = 'trots' word7 = 'runs' word8 = 'blue' word9 = 'red' word10 = 'yellow' word9 = 'The ' + word9 passcode = word8 passcode = word9 passcode = passcode + ' f' passcode = passcode + word1 passcode = passcode + ' ' passcode = passcode + word6 print(passcode)
class Solution(object): def myAtoi(self, string): """ :type str: str :rtype: int """ # round 0: handle special case, preprocess if len(string)==0: return 0 string = string.strip() # round 1: filtering res = [] for (k,token) in enumerate(string): if k==0 and (token=='+' or token=='-'): res.append(token) continue else: if token.isdigit(): res.append(token) else: break # round 2: assemble, handle special condition and parse res = ''.join(res) if len(res)==0: return 0 if res=='+': return 0 if res=='-': return 0 if int(res)>2147483647: return 2147483647 # int32 upper bound if int(res)<-2147483648: return -2147483648 # int32 lower bound return int(res) solution = Solution() print(solution.myAtoi('23234')) print(solution.myAtoi('-23234')) print(solution.myAtoi('232asdf34')) print(solution.myAtoi('232-34')) # Accepted
class Solution(object): def my_atoi(self, string): """ :type str: str :rtype: int """ if len(string) == 0: return 0 string = string.strip() res = [] for (k, token) in enumerate(string): if k == 0 and (token == '+' or token == '-'): res.append(token) continue elif token.isdigit(): res.append(token) else: break res = ''.join(res) if len(res) == 0: return 0 if res == '+': return 0 if res == '-': return 0 if int(res) > 2147483647: return 2147483647 if int(res) < -2147483648: return -2147483648 return int(res) solution = solution() print(solution.myAtoi('23234')) print(solution.myAtoi('-23234')) print(solution.myAtoi('232asdf34')) print(solution.myAtoi('232-34'))
sigma_s = 1 N_d = 32 N_c = 8 K = 50 P_FA = 0.05 SNR = 10 SNR_LOW = -20 SNR_UP = 6 SNR_STEP = 2 SNR_NOISE = 1 P_H1 = 0.2 NUM_STATISTICS = 1000 #NUM_STATISTICS = 100000
sigma_s = 1 n_d = 32 n_c = 8 k = 50 p_fa = 0.05 snr = 10 snr_low = -20 snr_up = 6 snr_step = 2 snr_noise = 1 p_h1 = 0.2 num_statistics = 1000
#Open file and store data data = [] with open('inputs\input5.txt') as f: data = f.readlines() data = [line.strip() for line in data] #Define Functions with Binary Conversions def splitRowCol(boardingPass): return(boardingPass[0:7],boardingPass[7:]) def convToBinary(inputStr,convToZero=["F","L"],convToOne=["B","R"]): inputStr = list(inputStr) for charIndex in range(len(inputStr)): if inputStr[charIndex] in convToZero: inputStr[charIndex] = "0" elif inputStr[charIndex] in convToOne: inputStr[charIndex] = "1" return "".join(inputStr) def getRowCol(boardingPass): rowStr,colStr = splitRowCol(boardingPass) rowBinary = convToBinary(rowStr) colBinary = convToBinary(colStr) row = int(rowBinary,2) col = int(colBinary,2) return row,col def calcSeatID(row,col): return (row*8)+col #Solution 1 with Binary conversions seatIDs = [] for boardingPass in data: row,col = getRowCol(boardingPass) seatIDs.append(calcSeatID(row,col)) print(max(seatIDs)) #Solution 2 with Binary conversions seatIDs = [] for boardingPass in data: row,col = getRowCol(boardingPass) seatIDs.append(calcSeatID(row,col)) seatIDs.sort() for i in range(len(seatIDs)-1): if seatIDs[i]+1 != seatIDs[i+1]: print(seatIDs[i],seatIDs[i+1]) #sanity check print statement print("Solution: " + str(seatIDs[i]+1))
data = [] with open('inputs\\input5.txt') as f: data = f.readlines() data = [line.strip() for line in data] def split_row_col(boardingPass): return (boardingPass[0:7], boardingPass[7:]) def conv_to_binary(inputStr, convToZero=['F', 'L'], convToOne=['B', 'R']): input_str = list(inputStr) for char_index in range(len(inputStr)): if inputStr[charIndex] in convToZero: inputStr[charIndex] = '0' elif inputStr[charIndex] in convToOne: inputStr[charIndex] = '1' return ''.join(inputStr) def get_row_col(boardingPass): (row_str, col_str) = split_row_col(boardingPass) row_binary = conv_to_binary(rowStr) col_binary = conv_to_binary(colStr) row = int(rowBinary, 2) col = int(colBinary, 2) return (row, col) def calc_seat_id(row, col): return row * 8 + col seat_i_ds = [] for boarding_pass in data: (row, col) = get_row_col(boardingPass) seatIDs.append(calc_seat_id(row, col)) print(max(seatIDs)) seat_i_ds = [] for boarding_pass in data: (row, col) = get_row_col(boardingPass) seatIDs.append(calc_seat_id(row, col)) seatIDs.sort() for i in range(len(seatIDs) - 1): if seatIDs[i] + 1 != seatIDs[i + 1]: print(seatIDs[i], seatIDs[i + 1]) print('Solution: ' + str(seatIDs[i] + 1))
doc+='''<head>\n <title>Privacy Policy</title>\n <meta charset="utf-8">\n <meta name="format-detection" content="telephone=no">\n <link rel="icon" href="images/favicon.ico" type="image/x-icon">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/grid.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/style.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/google-map.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/mailform.css">\n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/jquery.js"></script>\n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/jquery-migrate-1.2.1.js"></script>\n \n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/device.min.js"></script>\n <head>\n <title>Administrador</title>\n <meta charset="utf-8">\n <meta http-equiv="pragma" content="no-cache">\n <link rel="icon" type="image/png" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/imgs/logos/logoZtec.png" />\n <link rel="shortcut icon" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/imgs/logos/logoZtec.png" />\n <script src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/jquery-3.1.0.js"></script>\n <link rel="stylesheet" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/jquery.mCustomScrollbar.css" />\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/jquery.mCustomScrollbar.js"></script>\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/estilos.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/bootstrap.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/flexboxgrid.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/ff.css">\n \n \n <link href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/perfect-scrollbar.min.css" rel="stylesheet">\n \n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/script/file=Config.js&manager=True"></script>\n \n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/Codificador.js"></script>\n \n <!--<script type="text/python3" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/brython/nuclear.by"></script>-->\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/py_datos.js"></script>\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/nuclear.js"></script>\n \n <meta name="viewport" content="width=device-width, initial-scale=1">\n \n\n \n''' try: if "vars" in data: doc+='''\n\n''' try: for elem in data["vars"]: doc+="""\n<var name='""" try: doc+=str(elem) except Exception as e: doc+=str(e) doc+="""' style="display: none">""" try: doc+=str(decode(str(data["vars"][elem]))) except Exception as e: doc+=str(e) doc+='''</var>\n''' pass except Exception as e: doc+=str(e) doc+='''\n''' pass except Exception as e: doc+=str(e) doc+='''\n\n\n\n\n\n\n\n </head>\n\n'''
doc += '<head>\n <title>Privacy Policy</title>\n <meta charset="utf-8">\n <meta name="format-detection" content="telephone=no">\n <link rel="icon" href="images/favicon.ico" type="image/x-icon">\n <link rel="stylesheet" href="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/css/grid.css">\n <link rel="stylesheet" href="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/css/style.css">\n <link rel="stylesheet" href="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/css/google-map.css">\n <link rel="stylesheet" href="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/css/mailform.css">\n <script src="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/js/jquery.js"></script>\n <script src="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/js/jquery-migrate-1.2.1.js"></script>\n \n <script src="' try: doc += str(data['base_url']) except Exception as e: doc += str(e) doc += 'static/js/device.min.js"></script>\n <head>\n <title>Administrador</title>\n <meta charset="utf-8">\n <meta http-equiv="pragma" content="no-cache">\n <link rel="icon" type="image/png" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/imgs/logos/logoZtec.png" />\n <link rel="shortcut icon" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/imgs/logos/logoZtec.png" />\n <script src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/js/jquery-3.1.0.js"></script>\n <link rel="stylesheet" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/jquery.mCustomScrollbar.css" />\n <script type="text/javascript" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/js/jquery.mCustomScrollbar.js"></script>\n <link rel="stylesheet" type="text/css" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/estilos.css">\n <link rel="stylesheet" type="text/css" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/bootstrap.css">\n <link rel="stylesheet" type="text/css" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/flexboxgrid.css">\n <link rel="stylesheet" type="text/css" href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/ff.css">\n \n \n <link href="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/css/perfect-scrollbar.min.css" rel="stylesheet">\n \n <script type="text/javascript" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/script/file=Config.js&manager=True"></script>\n \n <script type="text/javascript" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/js/python/__javascript__/Codificador.js"></script>\n \n <!--<script type="text/python3" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/brython/nuclear.by"></script>-->\n <script type="text/javascript" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/js/python/__javascript__/py_datos.js"></script>\n <script type="text/javascript" src="' try: doc += str(config.base_url) except Exception as e: doc += str(e) doc += 'static/js/python/__javascript__/nuclear.js"></script>\n \n <meta name="viewport" content="width=device-width, initial-scale=1">\n \n\n \n' try: if 'vars' in data: doc += '\n\n' try: for elem in data['vars']: doc += "\n<var name='" try: doc += str(elem) except Exception as e: doc += str(e) doc += '\' style="display: none">' try: doc += str(decode(str(data['vars'][elem]))) except Exception as e: doc += str(e) doc += '</var>\n' pass except Exception as e: doc += str(e) doc += '\n' pass except Exception as e: doc += str(e) doc += '\n\n\n\n\n\n\n\n </head>\n\n'
class ViewModel: def __init__(self): self._is_valid = None """ should contain entries of form {'control_id': 'error message'}. entries may contain the same value for 'control_id' if there are muliple errors pertaining to that particular 'control_id' """ self._errors = [] def validate(self): """ should be overriden by subclasses should set self._is_valid to True/False Returns self._is_valid """ raise NotImplementedError() def is_valid(self): """ self._is_valid should be True/False. But if this is None, that may mean that self.validate() was not called yet. """ if self._is_valid is None: return self.validate() else: return self._is_valid def _append_error(self, err): self._errors.append(err) def errors(self): return self._errors
class Viewmodel: def __init__(self): self._is_valid = None "\n should contain entries of form {'control_id': 'error message'}.\n entries may contain the same value for 'control_id' if there are\n muliple errors pertaining to that particular 'control_id'\n " self._errors = [] def validate(self): """ should be overriden by subclasses should set self._is_valid to True/False Returns self._is_valid """ raise not_implemented_error() def is_valid(self): """ self._is_valid should be True/False. But if this is None, that may mean that self.validate() was not called yet. """ if self._is_valid is None: return self.validate() else: return self._is_valid def _append_error(self, err): self._errors.append(err) def errors(self): return self._errors
class Core(object): def foo(self): pass c = Core()
class Core(object): def foo(self): pass c = core()
"""This is the player.""" class Player: """This is a player class.""" def __init__(self, name): """Initiate the player.""" self._name = name self._score = 0 @property def name(self): """Get player's name.""" return self._name @property def score(self): """Get player's score.""" return self._score def add_score(self, add): """Add to player's score.""" self._score += add
"""This is the player.""" class Player: """This is a player class.""" def __init__(self, name): """Initiate the player.""" self._name = name self._score = 0 @property def name(self): """Get player's name.""" return self._name @property def score(self): """Get player's score.""" return self._score def add_score(self, add): """Add to player's score.""" self._score += add
microcode = ''' def macroop VPADDD_XMM_XMM { vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=16 }; def macroop VPADDD_XMM_M { ldfp128 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=16 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16 }; def macroop VPADDD_XMM_P { rdip t7 ldfp128 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=16 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16 }; def macroop VPADDD_YMM_YMM { vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=32 }; def macroop VPADDD_YMM_M { ldfp256 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=32 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=32 }; def macroop VPADDD_YMM_P { rdip t7 ldfp256 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=32 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=32 }; def macroop VPADDD_ZMM_ZMM { vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=64 }; def macroop VPADDD_ZMM_M { ldfp512 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=64 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=64 }; def macroop VPADDD_ZMM_P { rdip t7 ldfp512 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=64 vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=64 }; '''
microcode = '\ndef macroop VPADDD_XMM_XMM {\n vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=16\n};\n\ndef macroop VPADDD_XMM_M {\n ldfp128 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=16\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16\n};\n\ndef macroop VPADDD_XMM_P {\n rdip t7\n ldfp128 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=16\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=16\n};\n\ndef macroop VPADDD_YMM_YMM {\n vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=32\n};\n\ndef macroop VPADDD_YMM_M {\n ldfp256 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=32\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=32\n};\n\ndef macroop VPADDD_YMM_P {\n rdip t7\n ldfp256 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=32\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=32\n};\n\ndef macroop VPADDD_ZMM_ZMM {\n vaddi dest=xmm0, src1=xmm0v, src2=xmm0m, size=4, VL=64\n};\n\ndef macroop VPADDD_ZMM_M {\n ldfp512 ufp1, seg, sib, "DISPLACEMENT + 0", dataSize=64\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=64\n};\n\ndef macroop VPADDD_ZMM_P {\n rdip t7\n ldfp512 ufp1, seg, riprel, "DISPLACEMENT + 0", dataSize=64\n vaddi dest=xmm0, src1=xmm0v, src2=ufp1, size=4, VL=64\n};\n'
# -*- coding: utf-8 -*- ''' @author: Andreas Peldszus ''' folds = [ ['micro_k009', 'micro_b050', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_d20', 'micro_k012', 'micro_d13', 'micro_b010', 'micro_k029', 'micro_d14', 'micro_b024', 'micro_b009', 'micro_k011'], ['micro_k001', 'micro_d11', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_k023', 'micro_b049', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_k024', 'micro_k017', 'micro_b054', 'micro_b012', 'micro_b062', 'micro_b052', 'micro_k008', 'micro_d21', 'micro_b016'], ['micro_k031', 'micro_b018', 'micro_k010', 'micro_k025', 'micro_b040', 'micro_d06', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_b047', 'micro_k002', 'micro_b053', 'micro_b044', 'micro_b023', 'micro_d19', 'micro_b030', 'micro_b025', 'micro_b003'], ['micro_b051', 'micro_k007', 'micro_k019', 'micro_b019', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k020', 'micro_b001', 'micro_b028', 'micro_b011', 'micro_b017', 'micro_k022', 'micro_b013'], ['micro_b056', 'micro_d23', 'micro_b038', 'micro_d04', 'micro_d05', 'micro_b005', 'micro_k027', 'micro_b026', 'micro_k004', 'micro_b020', 'micro_b014', 'micro_d22', 'micro_b021', 'micro_b048', 'micro_b022', 'micro_k015', 'micro_b037', 'micro_b035', 'micro_d10', 'micro_d09', 'micro_k016', 'micro_b064'], ['micro_b056', 'micro_b018', 'micro_b058', 'micro_k025', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_d01', 'micro_b060', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_b004', 'micro_k012', 'micro_d10', 'micro_b035', 'micro_b009', 'micro_b064', 'micro_k016', 'micro_d21'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k014', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_k029', 'micro_k024', 'micro_b001', 'micro_b052', 'micro_b010', 'micro_d14', 'micro_b023', 'micro_b003', 'micro_b025', 'micro_b016'], ['micro_k001', 'micro_d23', 'micro_k010', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_k027', 'micro_k023', 'micro_b014', 'micro_b047', 'micro_k006', 'micro_b021', 'micro_b048', 'micro_d13', 'micro_k020', 'micro_b037', 'micro_k015', 'micro_b028', 'micro_b030', 'micro_d09', 'micro_b013'], ['micro_b051', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k013', 'micro_b022', 'micro_k017', 'micro_b017', 'micro_b062', 'micro_k008', 'micro_k022', 'micro_b012'], ['micro_k009', 'micro_b050', 'micro_k019', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_k002', 'micro_d22', 'micro_b044', 'micro_d19', 'micro_b024', 'micro_b011', 'micro_k011'], ['micro_k001', 'micro_d11', 'micro_b038', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_k021', 'micro_k027', 'micro_b002', 'micro_b045', 'micro_d01', 'micro_b060', 'micro_d15', 'micro_k029', 'micro_d08', 'micro_k020', 'micro_d10', 'micro_b044', 'micro_b028', 'micro_d19', 'micro_b064', 'micro_b003'], ['micro_k031', 'micro_b050', 'micro_k019', 'micro_b019', 'micro_b036', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_k023', 'micro_b049', 'micro_b008', 'micro_k006', 'micro_b021', 'micro_d20', 'micro_k012', 'micro_b054', 'micro_d22', 'micro_b052', 'micro_d14', 'micro_b024', 'micro_k008', 'micro_b062', 'micro_b012'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b014', 'micro_b047', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_d13', 'micro_b010', 'micro_b009', 'micro_b017', 'micro_k022', 'micro_b016', 'micro_d21'], ['micro_b051', 'micro_d23', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_b031', 'micro_b048', 'micro_b022', 'micro_k015', 'micro_k017', 'micro_b035', 'micro_b013', 'micro_d09', 'micro_b030', 'micro_k011'], ['micro_b056', 'micro_b018', 'micro_k010', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k002', 'micro_b001', 'micro_b037', 'micro_b023', 'micro_b011', 'micro_b025', 'micro_k016'], ['micro_k031', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b006', 'micro_b014', 'micro_b015', 'micro_d15', 'micro_d17', 'micro_k017', 'micro_b001', 'micro_k022', 'micro_b017', 'micro_d19', 'micro_b023', 'micro_b011', 'micro_b013', 'micro_d21'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b026', 'micro_d02', 'micro_b049', 'micro_b047', 'micro_b032', 'micro_b059', 'micro_k012', 'micro_k018', 'micro_d13', 'micro_b009', 'micro_k002', 'micro_b044', 'micro_k008', 'micro_b030', 'micro_b025'], ['micro_b051', 'micro_d11', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b008', 'micro_b031', 'micro_k013', 'micro_d20', 'micro_b037', 'micro_k020', 'micro_d22', 'micro_d18', 'micro_k015', 'micro_b035', 'micro_k016', 'micro_b064'], ['micro_k009', 'micro_d23', 'micro_b038', 'micro_k014', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b039', 'micro_k004', 'micro_b020', 'micro_b034', 'micro_k003', 'micro_b021', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_b028', 'micro_b003', 'micro_k011'], ['micro_k001', 'micro_b018', 'micro_b058', 'micro_k025', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b045', 'micro_d01', 'micro_k006', 'micro_b022', 'micro_k029', 'micro_k024', 'micro_d12', 'micro_b004', 'micro_b010', 'micro_d10', 'micro_b024', 'micro_b012', 'micro_d09', 'micro_b016'], ['micro_b051', 'micro_d11', 'micro_b058', 'micro_k025', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b020', 'micro_k003', 'micro_k018', 'micro_d17', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_d10', 'micro_b035', 'micro_k015', 'micro_b024', 'micro_b001', 'micro_d09'], ['micro_b056', 'micro_d23', 'micro_k010', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_d01', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k012', 'micro_k002', 'micro_b013', 'micro_b052', 'micro_d18', 'micro_b023', 'micro_b012', 'micro_d21', 'micro_k011'], ['micro_k031', 'micro_k007', 'micro_b055', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b008', 'micro_b031', 'micro_k006', 'micro_k013', 'micro_b047', 'micro_k020', 'micro_b009', 'micro_b017', 'micro_b028', 'micro_b016', 'micro_k008', 'micro_b025', 'micro_b030'], ['micro_k009', 'micro_b050', 'micro_k019', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b006', 'micro_b034', 'micro_b015', 'micro_b021', 'micro_k029', 'micro_b022', 'micro_b044', 'micro_k017', 'micro_b004', 'micro_b062', 'micro_d14', 'micro_b064', 'micro_b003'], ['micro_k001', 'micro_b018', 'micro_b038', 'micro_d04', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b026', 'micro_k004', 'micro_b049', 'micro_b014', 'micro_d22', 'micro_d15', 'micro_d12', 'micro_k024', 'micro_d13', 'micro_b037', 'micro_b010', 'micro_b011', 'micro_d19', 'micro_k022', 'micro_k016'], ['micro_k031', 'micro_d23', 'micro_k010', 'micro_b019', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_b032', 'micro_b015', 'micro_d17', 'micro_b059', 'micro_k024', 'micro_b001', 'micro_b004', 'micro_d18', 'micro_b028', 'micro_d19', 'micro_b030', 'micro_k011', 'micro_b003'], ['micro_k009', 'micro_b018', 'micro_b038', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b026', 'micro_k023', 'micro_b014', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_d08', 'micro_b037', 'micro_d10', 'micro_b035', 'micro_k015', 'micro_b064', 'micro_b016', 'micro_d21'], ['micro_b051', 'micro_d11', 'micro_b058', 'micro_d04', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_k018', 'micro_k003', 'micro_b022', 'micro_b011', 'micro_d13', 'micro_k020', 'micro_k029', 'micro_b044', 'micro_b023', 'micro_b009', 'micro_k016', 'micro_b025'], ['micro_b056', 'micro_b050', 'micro_b055', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_b034', 'micro_d22', 'micro_d15', 'micro_d20', 'micro_k013', 'micro_k012', 'micro_b010', 'micro_b013', 'micro_b017', 'micro_d09', 'micro_k022', 'micro_b012'], ['micro_k001', 'micro_k007', 'micro_k019', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_b008', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_b047', 'micro_k002', 'micro_k017', 'micro_b052', 'micro_d14', 'micro_b024', 'micro_k008', 'micro_b062'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_d04', 'micro_b040', 'micro_d06', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b014', 'micro_d01', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k013', 'micro_b022', 'micro_k017', 'micro_b017', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003'], ['micro_k001', 'micro_b050', 'micro_k019', 'micro_k025', 'micro_d05', 'micro_b005', 'micro_d07', 'micro_b026', 'micro_k023', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_k024', 'micro_d22', 'micro_b052', 'micro_d09', 'micro_b035', 'micro_b011', 'micro_b024', 'micro_b012'], ['micro_k031', 'micro_d11', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k002', 'micro_b009', 'micro_b044', 'micro_b010', 'micro_k008', 'micro_d19', 'micro_b025', 'micro_b016'], ['micro_b056', 'micro_d23', 'micro_b038', 'micro_b019', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_b002', 'micro_b045', 'micro_b008', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_b004', 'micro_k012', 'micro_d10', 'micro_b023', 'micro_b030', 'micro_b064', 'micro_k016', 'micro_k011'], ['micro_b051', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_k020', 'micro_b001', 'micro_b037', 'micro_b028', 'micro_k015', 'micro_d21', 'micro_b013'], ['micro_b051', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b045', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d20', 'micro_k012', 'micro_b022', 'micro_k008', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003', 'micro_b016'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k002', 'micro_b009', 'micro_b044', 'micro_b028', 'micro_b030', 'micro_d19', 'micro_b025'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b026', 'micro_b002', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_b004', 'micro_k020', 'micro_d22', 'micro_d09', 'micro_b037', 'micro_b023', 'micro_b012', 'micro_b064'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b036', 'micro_b007', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_b010', 'micro_b001', 'micro_k017', 'micro_b035', 'micro_k015', 'micro_d21', 'micro_b013', 'micro_k011'], ['micro_k001', 'micro_d23', 'micro_b058', 'micro_d04', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b014', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_b054', 'micro_d10', 'micro_b017', 'micro_b024', 'micro_b011', 'micro_k016'], ['micro_k001', 'micro_b018', 'micro_k010', 'micro_b019', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b006', 'micro_b008', 'micro_b032', 'micro_k006', 'micro_k017', 'micro_b047', 'micro_k020', 'micro_k029', 'micro_b044', 'micro_b028', 'micro_b011', 'micro_k022', 'micro_b003'], ['micro_b056', 'micro_k007', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b020', 'micro_k003', 'micro_k018', 'micro_d17', 'micro_k013', 'micro_b022', 'micro_b001', 'micro_k002', 'micro_k015', 'micro_d14', 'micro_b023', 'micro_b013', 'micro_k016'], ['micro_k031', 'micro_b050', 'micro_k019', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_d01', 'micro_b031', 'micro_b059', 'micro_k012', 'micro_k024', 'micro_d12', 'micro_d18', 'micro_b052', 'micro_b035', 'micro_d10', 'micro_b017', 'micro_d21'], ['micro_b051', 'micro_d23', 'micro_b038', 'micro_d04', 'micro_b040', 'micro_b005', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b060', 'micro_b014', 'micro_d22', 'micro_b021', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_b004', 'micro_b062', 'micro_k008', 'micro_d09', 'micro_b030', 'micro_b064', 'micro_k011'], ['micro_k009', 'micro_d11', 'micro_b058', 'micro_k025', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_k004', 'micro_b049', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_d20', 'micro_b037', 'micro_d13', 'micro_b010', 'micro_b009', 'micro_d19', 'micro_b024', 'micro_b012', 'micro_b025', 'micro_b016'], ['micro_k001', 'micro_d23', 'micro_b058', 'micro_d04', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k020', 'micro_b009', 'micro_b044', 'micro_b037', 'micro_b024', 'micro_d19', 'micro_b025'], ['micro_b051', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_b054', 'micro_d10', 'micro_b017', 'micro_b023', 'micro_b012', 'micro_k011'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_k023', 'micro_b014', 'micro_d01', 'micro_k006', 'micro_b021', 'micro_d20', 'micro_k012', 'micro_b022', 'micro_k008', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003', 'micro_b016'], ['micro_k009', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b031', 'micro_b048', 'micro_d08', 'micro_b010', 'micro_d22', 'micro_d09', 'micro_b030', 'micro_b028', 'micro_b011', 'micro_b064', 'micro_k016'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k002', 'micro_b001', 'micro_k017', 'micro_b035', 'micro_k015', 'micro_d21', 'micro_b013'] ] tids = sorted(list(set([tid for fold in folds for tid in fold]))) def get_static_folds(): for i, test_tids in enumerate(folds): train_tids = [tid for tid in tids if tid not in test_tids] yield train_tids, test_tids, i
""" @author: Andreas Peldszus """ folds = [['micro_k009', 'micro_b050', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_d20', 'micro_k012', 'micro_d13', 'micro_b010', 'micro_k029', 'micro_d14', 'micro_b024', 'micro_b009', 'micro_k011'], ['micro_k001', 'micro_d11', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_k023', 'micro_b049', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_k024', 'micro_k017', 'micro_b054', 'micro_b012', 'micro_b062', 'micro_b052', 'micro_k008', 'micro_d21', 'micro_b016'], ['micro_k031', 'micro_b018', 'micro_k010', 'micro_k025', 'micro_b040', 'micro_d06', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_b047', 'micro_k002', 'micro_b053', 'micro_b044', 'micro_b023', 'micro_d19', 'micro_b030', 'micro_b025', 'micro_b003'], ['micro_b051', 'micro_k007', 'micro_k019', 'micro_b019', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k020', 'micro_b001', 'micro_b028', 'micro_b011', 'micro_b017', 'micro_k022', 'micro_b013'], ['micro_b056', 'micro_d23', 'micro_b038', 'micro_d04', 'micro_d05', 'micro_b005', 'micro_k027', 'micro_b026', 'micro_k004', 'micro_b020', 'micro_b014', 'micro_d22', 'micro_b021', 'micro_b048', 'micro_b022', 'micro_k015', 'micro_b037', 'micro_b035', 'micro_d10', 'micro_d09', 'micro_k016', 'micro_b064'], ['micro_b056', 'micro_b018', 'micro_b058', 'micro_k025', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_d01', 'micro_b060', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_b004', 'micro_k012', 'micro_d10', 'micro_b035', 'micro_b009', 'micro_b064', 'micro_k016', 'micro_d21'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k014', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_k029', 'micro_k024', 'micro_b001', 'micro_b052', 'micro_b010', 'micro_d14', 'micro_b023', 'micro_b003', 'micro_b025', 'micro_b016'], ['micro_k001', 'micro_d23', 'micro_k010', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_k027', 'micro_k023', 'micro_b014', 'micro_b047', 'micro_k006', 'micro_b021', 'micro_b048', 'micro_d13', 'micro_k020', 'micro_b037', 'micro_k015', 'micro_b028', 'micro_b030', 'micro_d09', 'micro_b013'], ['micro_b051', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k013', 'micro_b022', 'micro_k017', 'micro_b017', 'micro_b062', 'micro_k008', 'micro_k022', 'micro_b012'], ['micro_k009', 'micro_b050', 'micro_k019', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_k002', 'micro_d22', 'micro_b044', 'micro_d19', 'micro_b024', 'micro_b011', 'micro_k011'], ['micro_k001', 'micro_d11', 'micro_b038', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_k021', 'micro_k027', 'micro_b002', 'micro_b045', 'micro_d01', 'micro_b060', 'micro_d15', 'micro_k029', 'micro_d08', 'micro_k020', 'micro_d10', 'micro_b044', 'micro_b028', 'micro_d19', 'micro_b064', 'micro_b003'], ['micro_k031', 'micro_b050', 'micro_k019', 'micro_b019', 'micro_b036', 'micro_b027', 'micro_b046', 'micro_b057', 'micro_k023', 'micro_b049', 'micro_b008', 'micro_k006', 'micro_b021', 'micro_d20', 'micro_k012', 'micro_b054', 'micro_d22', 'micro_b052', 'micro_d14', 'micro_b024', 'micro_k008', 'micro_b062', 'micro_b012'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b014', 'micro_b047', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_d13', 'micro_b010', 'micro_b009', 'micro_b017', 'micro_k022', 'micro_b016', 'micro_d21'], ['micro_b051', 'micro_d23', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_b031', 'micro_b048', 'micro_b022', 'micro_k015', 'micro_k017', 'micro_b035', 'micro_b013', 'micro_d09', 'micro_b030', 'micro_k011'], ['micro_b056', 'micro_b018', 'micro_k010', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k002', 'micro_b001', 'micro_b037', 'micro_b023', 'micro_b011', 'micro_b025', 'micro_k016'], ['micro_k031', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b006', 'micro_b014', 'micro_b015', 'micro_d15', 'micro_d17', 'micro_k017', 'micro_b001', 'micro_k022', 'micro_b017', 'micro_d19', 'micro_b023', 'micro_b011', 'micro_b013', 'micro_d21'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_d04', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b026', 'micro_d02', 'micro_b049', 'micro_b047', 'micro_b032', 'micro_b059', 'micro_k012', 'micro_k018', 'micro_d13', 'micro_b009', 'micro_k002', 'micro_b044', 'micro_k008', 'micro_b030', 'micro_b025'], ['micro_b051', 'micro_d11', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b008', 'micro_b031', 'micro_k013', 'micro_d20', 'micro_b037', 'micro_k020', 'micro_d22', 'micro_d18', 'micro_k015', 'micro_b035', 'micro_k016', 'micro_b064'], ['micro_k009', 'micro_d23', 'micro_b038', 'micro_k014', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b039', 'micro_k004', 'micro_b020', 'micro_b034', 'micro_k003', 'micro_b021', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_b028', 'micro_b003', 'micro_k011'], ['micro_k001', 'micro_b018', 'micro_b058', 'micro_k025', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b045', 'micro_d01', 'micro_k006', 'micro_b022', 'micro_k029', 'micro_k024', 'micro_d12', 'micro_b004', 'micro_b010', 'micro_d10', 'micro_b024', 'micro_b012', 'micro_d09', 'micro_b016'], ['micro_b051', 'micro_d11', 'micro_b058', 'micro_k025', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b020', 'micro_k003', 'micro_k018', 'micro_d17', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_d10', 'micro_b035', 'micro_k015', 'micro_b024', 'micro_b001', 'micro_d09'], ['micro_b056', 'micro_d23', 'micro_k010', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_d01', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k012', 'micro_k002', 'micro_b013', 'micro_b052', 'micro_d18', 'micro_b023', 'micro_b012', 'micro_d21', 'micro_k011'], ['micro_k031', 'micro_k007', 'micro_b055', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b060', 'micro_b008', 'micro_b031', 'micro_k006', 'micro_k013', 'micro_b047', 'micro_k020', 'micro_b009', 'micro_b017', 'micro_b028', 'micro_b016', 'micro_k008', 'micro_b025', 'micro_b030'], ['micro_k009', 'micro_b050', 'micro_k019', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b006', 'micro_b034', 'micro_b015', 'micro_b021', 'micro_k029', 'micro_b022', 'micro_b044', 'micro_k017', 'micro_b004', 'micro_b062', 'micro_d14', 'micro_b064', 'micro_b003'], ['micro_k001', 'micro_b018', 'micro_b038', 'micro_d04', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b026', 'micro_k004', 'micro_b049', 'micro_b014', 'micro_d22', 'micro_d15', 'micro_d12', 'micro_k024', 'micro_d13', 'micro_b037', 'micro_b010', 'micro_b011', 'micro_d19', 'micro_k022', 'micro_k016'], ['micro_k031', 'micro_d23', 'micro_k010', 'micro_b019', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_b032', 'micro_b015', 'micro_d17', 'micro_b059', 'micro_k024', 'micro_b001', 'micro_b004', 'micro_d18', 'micro_b028', 'micro_d19', 'micro_b030', 'micro_k011', 'micro_b003'], ['micro_k009', 'micro_b018', 'micro_b038', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b026', 'micro_k023', 'micro_b014', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_d08', 'micro_b037', 'micro_d10', 'micro_b035', 'micro_k015', 'micro_b064', 'micro_b016', 'micro_d21'], ['micro_b051', 'micro_d11', 'micro_b058', 'micro_d04', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_k018', 'micro_k003', 'micro_b022', 'micro_b011', 'micro_d13', 'micro_k020', 'micro_k029', 'micro_b044', 'micro_b023', 'micro_b009', 'micro_k016', 'micro_b025'], ['micro_b056', 'micro_b050', 'micro_b055', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_b034', 'micro_d22', 'micro_d15', 'micro_d20', 'micro_k013', 'micro_k012', 'micro_b010', 'micro_b013', 'micro_b017', 'micro_d09', 'micro_k022', 'micro_b012'], ['micro_k001', 'micro_k007', 'micro_k019', 'micro_b041', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_b008', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_b047', 'micro_k002', 'micro_k017', 'micro_b052', 'micro_d14', 'micro_b024', 'micro_k008', 'micro_b062'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_d04', 'micro_b040', 'micro_d06', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b014', 'micro_d01', 'micro_b032', 'micro_b059', 'micro_d20', 'micro_k013', 'micro_b022', 'micro_k017', 'micro_b017', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003'], ['micro_k001', 'micro_b050', 'micro_k019', 'micro_k025', 'micro_d05', 'micro_b005', 'micro_d07', 'micro_b026', 'micro_k023', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_k024', 'micro_d22', 'micro_b052', 'micro_d09', 'micro_b035', 'micro_b011', 'micro_b024', 'micro_b012'], ['micro_k031', 'micro_d11', 'micro_b058', 'micro_k014', 'micro_b029', 'micro_d03', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k002', 'micro_b009', 'micro_b044', 'micro_b010', 'micro_k008', 'micro_d19', 'micro_b025', 'micro_b016'], ['micro_b056', 'micro_d23', 'micro_b038', 'micro_b019', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_b002', 'micro_b045', 'micro_b008', 'micro_k006', 'micro_b031', 'micro_d12', 'micro_b054', 'micro_b004', 'micro_k012', 'micro_d10', 'micro_b023', 'micro_b030', 'micro_b064', 'micro_k016', 'micro_k011'], ['micro_b051', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_k020', 'micro_b001', 'micro_b037', 'micro_b028', 'micro_k015', 'micro_d21', 'micro_b013'], ['micro_b051', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b042', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b045', 'micro_d01', 'micro_k006', 'micro_b031', 'micro_d20', 'micro_k012', 'micro_b022', 'micro_k008', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003', 'micro_b016'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k002', 'micro_b009', 'micro_b044', 'micro_b028', 'micro_b030', 'micro_d19', 'micro_b025'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b026', 'micro_b002', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b021', 'micro_b048', 'micro_b004', 'micro_k020', 'micro_d22', 'micro_d09', 'micro_b037', 'micro_b023', 'micro_b012', 'micro_b064'], ['micro_k009', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b036', 'micro_b007', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_k018', 'micro_k003', 'micro_d17', 'micro_d18', 'micro_d08', 'micro_b010', 'micro_b001', 'micro_k017', 'micro_b035', 'micro_k015', 'micro_d21', 'micro_b013', 'micro_k011'], ['micro_k001', 'micro_d23', 'micro_b058', 'micro_d04', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b039', 'micro_d02', 'micro_b014', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_b054', 'micro_d10', 'micro_b017', 'micro_b024', 'micro_b011', 'micro_k016'], ['micro_k001', 'micro_b018', 'micro_k010', 'micro_b019', 'micro_b042', 'micro_b007', 'micro_b046', 'micro_d08', 'micro_b033', 'micro_b006', 'micro_b008', 'micro_b032', 'micro_k006', 'micro_k017', 'micro_b047', 'micro_k020', 'micro_k029', 'micro_b044', 'micro_b028', 'micro_b011', 'micro_k022', 'micro_b003'], ['micro_b056', 'micro_k007', 'micro_b055', 'micro_b041', 'micro_b036', 'micro_b027', 'micro_k021', 'micro_b057', 'micro_k023', 'micro_b020', 'micro_k003', 'micro_k018', 'micro_d17', 'micro_k013', 'micro_b022', 'micro_b001', 'micro_k002', 'micro_k015', 'micro_d14', 'micro_b023', 'micro_b013', 'micro_k016'], ['micro_k031', 'micro_b050', 'micro_k019', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_k027', 'micro_b039', 'micro_d02', 'micro_b045', 'micro_d01', 'micro_b031', 'micro_b059', 'micro_k012', 'micro_k024', 'micro_d12', 'micro_d18', 'micro_b052', 'micro_b035', 'micro_d10', 'micro_b017', 'micro_d21'], ['micro_b051', 'micro_d23', 'micro_b038', 'micro_d04', 'micro_b040', 'micro_b005', 'micro_d07', 'micro_b002', 'micro_d16', 'micro_b060', 'micro_b014', 'micro_d22', 'micro_b021', 'micro_b048', 'micro_b054', 'micro_b053', 'micro_b004', 'micro_b062', 'micro_k008', 'micro_d09', 'micro_b030', 'micro_b064', 'micro_k011'], ['micro_k009', 'micro_d11', 'micro_b058', 'micro_k025', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_k004', 'micro_b049', 'micro_b034', 'micro_b015', 'micro_d15', 'micro_d20', 'micro_b037', 'micro_d13', 'micro_b010', 'micro_b009', 'micro_d19', 'micro_b024', 'micro_b012', 'micro_b025', 'micro_b016'], ['micro_k001', 'micro_d23', 'micro_b058', 'micro_d04', 'micro_b042', 'micro_b027', 'micro_b046', 'micro_k027', 'micro_d16', 'micro_b006', 'micro_b034', 'micro_k003', 'micro_d15', 'micro_k029', 'micro_d13', 'micro_k020', 'micro_b009', 'micro_b044', 'micro_b037', 'micro_b024', 'micro_d19', 'micro_b025'], ['micro_b051', 'micro_k007', 'micro_b055', 'micro_b019', 'micro_b029', 'micro_d03', 'micro_b061', 'micro_b026', 'micro_d02', 'micro_b045', 'micro_b008', 'micro_b032', 'micro_b059', 'micro_k013', 'micro_k024', 'micro_d12', 'micro_b054', 'micro_d10', 'micro_b017', 'micro_b023', 'micro_b012', 'micro_k011'], ['micro_b056', 'micro_b050', 'micro_k019', 'micro_k014', 'micro_d05', 'micro_d06', 'micro_d07', 'micro_b039', 'micro_k023', 'micro_b014', 'micro_d01', 'micro_k006', 'micro_b021', 'micro_d20', 'micro_k012', 'micro_b022', 'micro_k008', 'micro_b052', 'micro_b062', 'micro_d14', 'micro_k022', 'micro_b003', 'micro_b016'], ['micro_k009', 'micro_b018', 'micro_k010', 'micro_b041', 'micro_b036', 'micro_b007', 'micro_k021', 'micro_b057', 'micro_b002', 'micro_b049', 'micro_b047', 'micro_b060', 'micro_b031', 'micro_b048', 'micro_d08', 'micro_b010', 'micro_d22', 'micro_d09', 'micro_b030', 'micro_b028', 'micro_b011', 'micro_b064', 'micro_k016'], ['micro_k031', 'micro_d11', 'micro_b038', 'micro_k025', 'micro_b040', 'micro_b005', 'micro_b053', 'micro_b020', 'micro_b033', 'micro_k004', 'micro_k018', 'micro_b015', 'micro_d17', 'micro_d18', 'micro_b004', 'micro_k002', 'micro_b001', 'micro_k017', 'micro_b035', 'micro_k015', 'micro_d21', 'micro_b013']] tids = sorted(list(set([tid for fold in folds for tid in fold]))) def get_static_folds(): for (i, test_tids) in enumerate(folds): train_tids = [tid for tid in tids if tid not in test_tids] yield (train_tids, test_tids, i)
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories") def rules_web_dependencies(): sass_repositories()
load('@io_bazel_rules_sass//:defs.bzl', 'sass_repositories') def rules_web_dependencies(): sass_repositories()
count = 0 inputNum = 1 prevInput = -1 while (inputNum > 0): inputNum = int(input()) if inputNum == prevInput: count += 1 prevInput = inputNum print (f'{count}')
count = 0 input_num = 1 prev_input = -1 while inputNum > 0: input_num = int(input()) if inputNum == prevInput: count += 1 prev_input = inputNum print(f'{count}')
def snail(h, a, b): now_high = 0 d = 0 while now_high < h: now_high += a if now_high < h: now_high -= b d += 1 print(d) snail(int(input()), int(input()), int(input()))
def snail(h, a, b): now_high = 0 d = 0 while now_high < h: now_high += a if now_high < h: now_high -= b d += 1 print(d) snail(int(input()), int(input()), int(input()))
""" http://community.topcoder.com/stat?c=problem_statement&pm=1708 Single Round Match 144 Round 1 - Division II, Level One """ class Time: def whatTime(self, seconds): return ':'.join(map(str, [int(seconds / 3600), int(seconds % 3600 / 60), seconds % 60]))
""" http://community.topcoder.com/stat?c=problem_statement&pm=1708 Single Round Match 144 Round 1 - Division II, Level One """ class Time: def what_time(self, seconds): return ':'.join(map(str, [int(seconds / 3600), int(seconds % 3600 / 60), seconds % 60]))
""" Just a placeholder """ class TestDummy: """ Dummy test """ @staticmethod def test_do_nothing() -> None: """Do nothing""" assert True @staticmethod def test_do_nothing2() -> None: """Do nothing""" assert True
""" Just a placeholder """ class Testdummy: """ Dummy test """ @staticmethod def test_do_nothing() -> None: """Do nothing""" assert True @staticmethod def test_do_nothing2() -> None: """Do nothing""" assert True
apiAttachAvailable = u'API tillg\xe4ngligt' apiAttachNotAvailable = u'Inte tillg\xe4ngligt' apiAttachPendingAuthorization = u'Godk\xe4nnande avvaktas' apiAttachRefused = u'Nekades' apiAttachSuccess = u'Det lyckades' apiAttachUnknown = u'Ok\xe4nd' budDeletedFriend = u'Borttagen fr\xe5n kontaktlistan' budFriend = u'V\xe4n' budNeverBeenFriend = u'Aldrig varit i kontaktlistan' budPendingAuthorization = u'Godk\xe4nnande avvaktas' budUnknown = u'Ok\xe4nd' cfrBlockedByRecipient = u'Samtalet blockerades av mottagaren' cfrMiscError = u'Div fel' cfrNoCommonCodec = u'Gemensam codec saknas' cfrNoProxyFound = u'Mellanserver finns inte' cfrNotAuthorizedByRecipient = u'Aktuell anv\xe4ndare inte godk\xe4nd av mottagaren' cfrRecipientNotFriend = u'Mottagaren ej en v\xe4n' cfrRemoteDeviceError = u'Det har uppst\xe5tt problem med motpartens ljudenhet' cfrSessionTerminated = u'Sessionen avslutad' cfrSoundIOError = u'I/O-fel p\xe5 ljudet' cfrSoundRecordingError = u'Ljudinspelningsfel' cfrUnknown = u'Ok\xe4nd' cfrUserDoesNotExist = u'Anv\xe4ndaren/telefonnumret finns inte' cfrUserIsOffline = u'Anv\xe4ndaren \xe4r offline' chsAllCalls = u'Legacy-dialog' chsDialog = u'Dialog' chsIncomingCalls = u'Kr\xe4ver multi-godk\xe4nnande' chsLegacyDialog = u'Legacy-dialog' chsMissedCalls = u'Dialog' chsMultiNeedAccept = u'Kr\xe4ver multi-godk\xe4nnande' chsMultiSubscribed = u'Multi-abonnerade' chsOutgoingCalls = u'Multi-abonnerade' chsUnknown = u'Ok\xe4nd' chsUnsubscribed = u'Avabonnerad' clsBusy = u'Upptaget' clsCancelled = u'Avbruten' clsEarlyMedia = u'Spelar Early Media' clsFailed = u'Samtalet kunde inte kopplas' clsFinished = u'Avslutat' clsInProgress = u'P\xe5g\xe5ende samtal' clsLocalHold = u'Lokalt parkerat samtal' clsMissed = u'missat samtal' clsOnHold = u'Parkerad' clsRefused = u'Nekades' clsRemoteHold = u'Fj\xe4rrparkerat samtal' clsRinging = u'pratat' clsRouting = u'Routar' clsTransferred = u'Ok\xe4nd' clsTransferring = u'Ok\xe4nd' clsUnknown = u'Ok\xe4nd' clsUnplaced = u'Inte uppringt' clsVoicemailBufferingGreeting = u'Buffrar h\xe4lsningen' clsVoicemailCancelled = u'R\xf6stmeddelandet avbr\xf6ts' clsVoicemailFailed = u'R\xf6stmeddelandet misslyckades' clsVoicemailPlayingGreeting = u'Spelar h\xe4lsningen' clsVoicemailRecording = u'Spelar in r\xf6stmeddelande' clsVoicemailSent = u'R\xf6stmeddelandet skickades' clsVoicemailUploading = u'Laddar upp r\xf6stmeddelande' cltIncomingP2P = u'Inkommande P2P-samtal' cltIncomingPSTN = u'Inkommande telefonsamtal' cltOutgoingP2P = u'Utg\xe5ende P2P-samtal' cltOutgoingPSTN = u'Utg\xe5ende telefonsamtal' cltUnknown = u'Ok\xe4nd' cmeAddedMembers = u'Medlemmar lades till' cmeCreatedChatWith = u'Startade chatt med' cmeEmoted = u'Ok\xe4nd' cmeLeft = u'L\xe4mnade' cmeSaid = u'Redan sagt' cmeSawMembers = u'S\xe5g medlemmar' cmeSetTopic = u'Ange \xe4mne' cmeUnknown = u'Ok\xe4nd' cmsRead = u'L\xe4stes' cmsReceived = u'Togs emot' cmsSending = u'S\xe4nder...' cmsSent = u'Skickades' cmsUnknown = u'Ok\xe4nd' conConnecting = u'Ansluter...' conOffline = u'Offline' conOnline = u'Online' conPausing = u'Pauserar' conUnknown = u'Ok\xe4nd' cusAway = u'Tillf\xe4lligt borta' cusDoNotDisturb = u'St\xf6r ej' cusInvisible = u'Osynlig' cusLoggedOut = u'Offline' cusNotAvailable = u'Inte tillg\xe4ngligt' cusOffline = u'Offline' cusOnline = u'Online' cusSkypeMe = u'Skype Me' cusUnknown = u'Ok\xe4nd' cvsBothEnabled = u'Skickar och tar emot video' cvsNone = u'Ingen video' cvsReceiveEnabled = u'Tar emot video' cvsSendEnabled = u'Skickar video' cvsUnknown = u'' grpAllFriends = u'Alla kontakter' grpAllUsers = u'Alla anv\xe4ndare' grpCustomGroup = u'S\xe4rskild' grpOnlineFriends = u'Online-v\xe4nner' grpPendingAuthorizationFriends = u'Godk\xe4nnande avvaktas' grpProposedSharedGroup = u'Proposed Shared Group' grpRecentlyContactedUsers = u'Nyligen kontaktade anv\xe4ndare' grpSharedGroup = u'Shared Group' grpSkypeFriends = u'Skype-kontakter' grpSkypeOutFriends = u'SkypeOut-kontakter' grpUngroupedFriends = u'Icke grupperade kontakter' grpUnknown = u'Ok\xe4nd' grpUsersAuthorizedByMe = u'Godk\xe4nda av mig' grpUsersBlockedByMe = u'Blockerade av mig' grpUsersWaitingMyAuthorization = u'Avvaktar mitt godk\xe4nnande' leaAddDeclined = u'Till\xe4gg nekades' leaAddedNotAuthorized = u'Den som l\xe4ggs till m\xe5ste vara godk\xe4nd' leaAdderNotFriend = u'Den som l\xe4gger till m\xe5ste vara en v\xe4n' leaUnknown = u'Ok\xe4nd' leaUnsubscribe = u'Avabonnerad' leaUserIncapable = u'Anv\xe4ndaren kan inte' leaUserNotFound = u'Anv\xe4ndaren finns inte' olsAway = u'Tillf\xe4lligt borta' olsDoNotDisturb = u'St\xf6r ej' olsNotAvailable = u'Inte tillg\xe4ngligt' olsOffline = u'Offline' olsOnline = u'Online' olsSkypeMe = u'Skype Me' olsSkypeOut = u'SkypeOut' olsUnknown = u'Ok\xe4nd' smsMessageStatusComposing = u'Composing' smsMessageStatusDelivered = u'Delivered' smsMessageStatusFailed = u'Failed' smsMessageStatusRead = u'Read' smsMessageStatusReceived = u'Received' smsMessageStatusSendingToServer = u'Sending to Server' smsMessageStatusSentToServer = u'Sent to Server' smsMessageStatusSomeTargetsFailed = u'Some Targets Failed' smsMessageStatusUnknown = u'Unknown' smsMessageTypeCCRequest = u'Confirmation Code Request' smsMessageTypeCCSubmit = u'Confirmation Code Submit' smsMessageTypeIncoming = u'Incoming' smsMessageTypeOutgoing = u'Outgoing' smsMessageTypeUnknown = u'Unknown' smsTargetStatusAcceptable = u'Acceptable' smsTargetStatusAnalyzing = u'Analyzing' smsTargetStatusDeliveryFailed = u'Delivery Failed' smsTargetStatusDeliveryPending = u'Delivery Pending' smsTargetStatusDeliverySuccessful = u'Delivery Successful' smsTargetStatusNotRoutable = u'Not Routable' smsTargetStatusUndefined = u'Undefined' smsTargetStatusUnknown = u'Unknown' usexFemale = u'Kvinna' usexMale = u'Man' usexUnknown = u'Ok\xe4nd' vmrConnectError = u'Anslutningsfel' vmrFileReadError = u'Fill\xe4sningsfel' vmrFileWriteError = u'Filskrivningsfel' vmrMiscError = u'Div fel' vmrNoError = u'Inget fel' vmrNoPrivilege = u'Voicemail-beh\xf6righet saknas' vmrNoVoicemail = u'R\xf6stmeddelande saknas' vmrPlaybackError = u'Uppspelningsfel' vmrRecordingError = u'Inspelningsfel' vmrUnknown = u'Ok\xe4nd' vmsBlank = u'Tomt' vmsBuffering = u'Buffrar' vmsDeleting = u'Tar bort' vmsDownloading = u'Laddar ner' vmsFailed = u'Misslyckades' vmsNotDownloaded = u'Inte nerladdat' vmsPlayed = u'Uppspelat' vmsPlaying = u'Spelar upp' vmsRecorded = u'Inspelat' vmsRecording = u'Spelar in r\xf6stmeddelande' vmsUnknown = u'Ok\xe4nd' vmsUnplayed = u'Inte uppspelat' vmsUploaded = u'Uppladdat' vmsUploading = u'Laddar upp' vmtCustomGreeting = u'S\xe4rskild h\xe4lsning' vmtDefaultGreeting = u'Standardh\xe4lsning' vmtIncoming = u'Nytt r\xf6stmeddelande' vmtOutgoing = u'Utg\xe5ende' vmtUnknown = u'Ok\xe4nd' vssAvailable = u'Tillg\xe4ngligt' vssNotAvailable = u'Inte tillg\xe4ngligt' vssPaused = u'Pausat' vssRejected = u'Nekades' vssRunning = u'P\xe5g\xe5r' vssStarting = u'Startar' vssStopping = u'Stannar' vssUnknown = u'Ok\xe4nd'
api_attach_available = u'API tillgängligt' api_attach_not_available = u'Inte tillgängligt' api_attach_pending_authorization = u'Godkännande avvaktas' api_attach_refused = u'Nekades' api_attach_success = u'Det lyckades' api_attach_unknown = u'Okänd' bud_deleted_friend = u'Borttagen från kontaktlistan' bud_friend = u'Vän' bud_never_been_friend = u'Aldrig varit i kontaktlistan' bud_pending_authorization = u'Godkännande avvaktas' bud_unknown = u'Okänd' cfr_blocked_by_recipient = u'Samtalet blockerades av mottagaren' cfr_misc_error = u'Div fel' cfr_no_common_codec = u'Gemensam codec saknas' cfr_no_proxy_found = u'Mellanserver finns inte' cfr_not_authorized_by_recipient = u'Aktuell användare inte godkänd av mottagaren' cfr_recipient_not_friend = u'Mottagaren ej en vän' cfr_remote_device_error = u'Det har uppstått problem med motpartens ljudenhet' cfr_session_terminated = u'Sessionen avslutad' cfr_sound_io_error = u'I/O-fel på ljudet' cfr_sound_recording_error = u'Ljudinspelningsfel' cfr_unknown = u'Okänd' cfr_user_does_not_exist = u'Användaren/telefonnumret finns inte' cfr_user_is_offline = u'Användaren är offline' chs_all_calls = u'Legacy-dialog' chs_dialog = u'Dialog' chs_incoming_calls = u'Kräver multi-godkännande' chs_legacy_dialog = u'Legacy-dialog' chs_missed_calls = u'Dialog' chs_multi_need_accept = u'Kräver multi-godkännande' chs_multi_subscribed = u'Multi-abonnerade' chs_outgoing_calls = u'Multi-abonnerade' chs_unknown = u'Okänd' chs_unsubscribed = u'Avabonnerad' cls_busy = u'Upptaget' cls_cancelled = u'Avbruten' cls_early_media = u'Spelar Early Media' cls_failed = u'Samtalet kunde inte kopplas' cls_finished = u'Avslutat' cls_in_progress = u'Pågående samtal' cls_local_hold = u'Lokalt parkerat samtal' cls_missed = u'missat samtal' cls_on_hold = u'Parkerad' cls_refused = u'Nekades' cls_remote_hold = u'Fjärrparkerat samtal' cls_ringing = u'pratat' cls_routing = u'Routar' cls_transferred = u'Okänd' cls_transferring = u'Okänd' cls_unknown = u'Okänd' cls_unplaced = u'Inte uppringt' cls_voicemail_buffering_greeting = u'Buffrar hälsningen' cls_voicemail_cancelled = u'Röstmeddelandet avbröts' cls_voicemail_failed = u'Röstmeddelandet misslyckades' cls_voicemail_playing_greeting = u'Spelar hälsningen' cls_voicemail_recording = u'Spelar in röstmeddelande' cls_voicemail_sent = u'Röstmeddelandet skickades' cls_voicemail_uploading = u'Laddar upp röstmeddelande' clt_incoming_p2_p = u'Inkommande P2P-samtal' clt_incoming_pstn = u'Inkommande telefonsamtal' clt_outgoing_p2_p = u'Utgående P2P-samtal' clt_outgoing_pstn = u'Utgående telefonsamtal' clt_unknown = u'Okänd' cme_added_members = u'Medlemmar lades till' cme_created_chat_with = u'Startade chatt med' cme_emoted = u'Okänd' cme_left = u'Lämnade' cme_said = u'Redan sagt' cme_saw_members = u'Såg medlemmar' cme_set_topic = u'Ange ämne' cme_unknown = u'Okänd' cms_read = u'Lästes' cms_received = u'Togs emot' cms_sending = u'Sänder...' cms_sent = u'Skickades' cms_unknown = u'Okänd' con_connecting = u'Ansluter...' con_offline = u'Offline' con_online = u'Online' con_pausing = u'Pauserar' con_unknown = u'Okänd' cus_away = u'Tillfälligt borta' cus_do_not_disturb = u'Stör ej' cus_invisible = u'Osynlig' cus_logged_out = u'Offline' cus_not_available = u'Inte tillgängligt' cus_offline = u'Offline' cus_online = u'Online' cus_skype_me = u'Skype Me' cus_unknown = u'Okänd' cvs_both_enabled = u'Skickar och tar emot video' cvs_none = u'Ingen video' cvs_receive_enabled = u'Tar emot video' cvs_send_enabled = u'Skickar video' cvs_unknown = u'' grp_all_friends = u'Alla kontakter' grp_all_users = u'Alla användare' grp_custom_group = u'Särskild' grp_online_friends = u'Online-vänner' grp_pending_authorization_friends = u'Godkännande avvaktas' grp_proposed_shared_group = u'Proposed Shared Group' grp_recently_contacted_users = u'Nyligen kontaktade användare' grp_shared_group = u'Shared Group' grp_skype_friends = u'Skype-kontakter' grp_skype_out_friends = u'SkypeOut-kontakter' grp_ungrouped_friends = u'Icke grupperade kontakter' grp_unknown = u'Okänd' grp_users_authorized_by_me = u'Godkända av mig' grp_users_blocked_by_me = u'Blockerade av mig' grp_users_waiting_my_authorization = u'Avvaktar mitt godkännande' lea_add_declined = u'Tillägg nekades' lea_added_not_authorized = u'Den som läggs till måste vara godkänd' lea_adder_not_friend = u'Den som lägger till måste vara en vän' lea_unknown = u'Okänd' lea_unsubscribe = u'Avabonnerad' lea_user_incapable = u'Användaren kan inte' lea_user_not_found = u'Användaren finns inte' ols_away = u'Tillfälligt borta' ols_do_not_disturb = u'Stör ej' ols_not_available = u'Inte tillgängligt' ols_offline = u'Offline' ols_online = u'Online' ols_skype_me = u'Skype Me' ols_skype_out = u'SkypeOut' ols_unknown = u'Okänd' sms_message_status_composing = u'Composing' sms_message_status_delivered = u'Delivered' sms_message_status_failed = u'Failed' sms_message_status_read = u'Read' sms_message_status_received = u'Received' sms_message_status_sending_to_server = u'Sending to Server' sms_message_status_sent_to_server = u'Sent to Server' sms_message_status_some_targets_failed = u'Some Targets Failed' sms_message_status_unknown = u'Unknown' sms_message_type_cc_request = u'Confirmation Code Request' sms_message_type_cc_submit = u'Confirmation Code Submit' sms_message_type_incoming = u'Incoming' sms_message_type_outgoing = u'Outgoing' sms_message_type_unknown = u'Unknown' sms_target_status_acceptable = u'Acceptable' sms_target_status_analyzing = u'Analyzing' sms_target_status_delivery_failed = u'Delivery Failed' sms_target_status_delivery_pending = u'Delivery Pending' sms_target_status_delivery_successful = u'Delivery Successful' sms_target_status_not_routable = u'Not Routable' sms_target_status_undefined = u'Undefined' sms_target_status_unknown = u'Unknown' usex_female = u'Kvinna' usex_male = u'Man' usex_unknown = u'Okänd' vmr_connect_error = u'Anslutningsfel' vmr_file_read_error = u'Filläsningsfel' vmr_file_write_error = u'Filskrivningsfel' vmr_misc_error = u'Div fel' vmr_no_error = u'Inget fel' vmr_no_privilege = u'Voicemail-behörighet saknas' vmr_no_voicemail = u'Röstmeddelande saknas' vmr_playback_error = u'Uppspelningsfel' vmr_recording_error = u'Inspelningsfel' vmr_unknown = u'Okänd' vms_blank = u'Tomt' vms_buffering = u'Buffrar' vms_deleting = u'Tar bort' vms_downloading = u'Laddar ner' vms_failed = u'Misslyckades' vms_not_downloaded = u'Inte nerladdat' vms_played = u'Uppspelat' vms_playing = u'Spelar upp' vms_recorded = u'Inspelat' vms_recording = u'Spelar in röstmeddelande' vms_unknown = u'Okänd' vms_unplayed = u'Inte uppspelat' vms_uploaded = u'Uppladdat' vms_uploading = u'Laddar upp' vmt_custom_greeting = u'Särskild hälsning' vmt_default_greeting = u'Standardhälsning' vmt_incoming = u'Nytt röstmeddelande' vmt_outgoing = u'Utgående' vmt_unknown = u'Okänd' vss_available = u'Tillgängligt' vss_not_available = u'Inte tillgängligt' vss_paused = u'Pausat' vss_rejected = u'Nekades' vss_running = u'Pågår' vss_starting = u'Startar' vss_stopping = u'Stannar' vss_unknown = u'Okänd'
class Student: def __init__(self, name, school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) @classmethod def friend(cls, origin, friend_name, *args, **kwargs): return cls(friend_name, origin.school, *args, **kwargs) # def schools(self, schools_name): # return Student(self.name, schools_name) # anna = Student("Anna", "MIT") # friend = anna.friend("Greg") # john = Student("John", "MIT") # schools = john.schools("Oxford") # print(friend.name) # print(friend.school) # print(schools.name) # print(schools.school) # def friend(self, friend_name): # return Student(friend_name, self.school) ## class WorkingStudent(Student): def __init__(self, name, school, salary, job_title): super().__init__(name, school) self.salary = salary self.job_title = job_title anna = WorkingStudent("Anna", "MIT", 30.00, "software dewloper") print(anna.salary) friend = WorkingStudent.friend(anna, "Greg", 20.00, "software developer") # anna is the origin, "Greg" is friend_name, 20.00 is *args, job_title="software deweloper" is ** kwargs print(friend.name) print(friend.school) print(friend.salary)
class Student: def __init__(self, name, school): self.name = name self.school = school self.marks = [] def average(self): return sum(self.marks) / len(self.marks) @classmethod def friend(cls, origin, friend_name, *args, **kwargs): return cls(friend_name, origin.school, *args, **kwargs) class Workingstudent(Student): def __init__(self, name, school, salary, job_title): super().__init__(name, school) self.salary = salary self.job_title = job_title anna = working_student('Anna', 'MIT', 30.0, 'software dewloper') print(anna.salary) friend = WorkingStudent.friend(anna, 'Greg', 20.0, 'software developer') print(friend.name) print(friend.school) print(friend.salary)
def round_counter(): RCi = 0 RCi_list = [] # print(type(RCi)) l = 0 for l in range (48): # print(type(RCi)) RCi = bin(RCi)[2:].zfill(6) RCi_one_list = [int(d) for d in str((RCi))] # print(RCi_one_list) t = 1 + RCi_one_list[0] + RCi_one_list[1] t = t % 2 RCi_one_list.append(RCi_one_list.pop(0)) # print(RCi_one_list) RCi_one_list[5] = t RCi = ''.join((str(e) for e in RCi_one_list)) RCi_list.append(RCi) # print(RCi, i, "bin") RCi = int(RCi, 2) # print(RCi, i, "dec") return RCi_list # RCi = 0 # # print(type(RCi)) # # for i in range(16): # a = round_counter() # print(a)
def round_counter(): r_ci = 0 r_ci_list = [] l = 0 for l in range(48): r_ci = bin(RCi)[2:].zfill(6) r_ci_one_list = [int(d) for d in str(RCi)] t = 1 + RCi_one_list[0] + RCi_one_list[1] t = t % 2 RCi_one_list.append(RCi_one_list.pop(0)) RCi_one_list[5] = t r_ci = ''.join((str(e) for e in RCi_one_list)) RCi_list.append(RCi) r_ci = int(RCi, 2) return RCi_list
# enter your file path DATA_PATH = "./lab1/data" # file names IN_FILE = "input.txt" OUT_FILE = "output.txt" def main(): lines = [] # open input file with open("{}/{}".format(DATA_PATH, IN_FILE), "r") as file: # reach each line for line in file: # print removing newline print(line.strip()) # append to table lines.append(line) # invert line order lines = lines[-1::-1] # open output file with open("{}/{}".format(DATA_PATH, OUT_FILE), "w") as file: for line in lines: file.write(line) if __name__ == "__main__": main()
data_path = './lab1/data' in_file = 'input.txt' out_file = 'output.txt' def main(): lines = [] with open('{}/{}'.format(DATA_PATH, IN_FILE), 'r') as file: for line in file: print(line.strip()) lines.append(line) lines = lines[-1::-1] with open('{}/{}'.format(DATA_PATH, OUT_FILE), 'w') as file: for line in lines: file.write(line) if __name__ == '__main__': main()
#!/usr/bin/python # Copyright 2017 Hewlett-Packard Enterprise Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. def Integer(value): return value def ObjectName(value): return (value,) PHY_DRIVE_MIB_OUTPUT = { 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.0': { 'cpqDaPhyDrvCntlrIndex': {ObjectName('2.0'): Integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.1': { 'cpqDaPhyDrvCntlrIndex': {ObjectName('2.1'): Integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.2': { 'cpqDaPhyDrvCntlrIndex': {ObjectName('2.2'): Integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.3': { 'cpqDaPhyDrvCntlrIndex': {ObjectName('2.3'): Integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.0': { 'cpqDaPhyDrvIndex': {ObjectName('2.0'): Integer(0)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.1': { 'cpqDaPhyDrvIndex': {ObjectName('2.1'): Integer(1)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.2': { 'cpqDaPhyDrvIndex': {ObjectName('2.2'): Integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.3': { 'cpqDaPhyDrvIndex': {ObjectName('2.3'): Integer(3)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.0': { 'cpqDaPhyDrvSize': {ObjectName('2.0'): Integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.1': { 'cpqDaPhyDrvSize': {ObjectName('2.1'): Integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.2': { 'cpqDaPhyDrvSize': {ObjectName('2.2'): Integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.3': { 'cpqDaPhyDrvSize': {ObjectName('2.3'): Integer(286102)}} }
def integer(value): return value def object_name(value): return (value,) phy_drive_mib_output = {'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.0': {'cpqDaPhyDrvCntlrIndex': {object_name('2.0'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.1': {'cpqDaPhyDrvCntlrIndex': {object_name('2.1'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.2': {'cpqDaPhyDrvCntlrIndex': {object_name('2.2'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.1.2.3': {'cpqDaPhyDrvCntlrIndex': {object_name('2.3'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.0': {'cpqDaPhyDrvIndex': {object_name('2.0'): integer(0)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.1': {'cpqDaPhyDrvIndex': {object_name('2.1'): integer(1)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.2': {'cpqDaPhyDrvIndex': {object_name('2.2'): integer(2)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.2.2.3': {'cpqDaPhyDrvIndex': {object_name('2.3'): integer(3)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.0': {'cpqDaPhyDrvSize': {object_name('2.0'): integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.1': {'cpqDaPhyDrvSize': {object_name('2.1'): integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.2': {'cpqDaPhyDrvSize': {object_name('2.2'): integer(286102)}}, 'SNMPv2-SMI::enterprises.232.3.2.5.1.1.45.2.3': {'cpqDaPhyDrvSize': {object_name('2.3'): integer(286102)}}}
# Simple account class with balance class Account: def __init__(self, name, balance): self.name = name self.balance = balance print("Account is created for {}".format(self.name)) def deposit(self, amount): if amount > 0: self.balance += amount def withdraw(self, amount): if 0 < amount < self.balance: self.balance -= amount else: print("You dont have sufficient balance to withdraw") def show_balance(self): print('Your current balance is {}'.format(self.balance)) if __name__ == "__main__": name=str(input("Please Enter Your name:\n")) act_balance = 100.0 name1 = Account(name, act_balance) name1.show_balance() payment = float(input("Enter the ammount, which has to be deposited:\n")) name1.deposit(payment) name1.show_balance() payment = float(input("Enter the ammount, How much you need withdraw:\n")) name1.withdraw(payment) name1.show_balance()
class Account: def __init__(self, name, balance): self.name = name self.balance = balance print('Account is created for {}'.format(self.name)) def deposit(self, amount): if amount > 0: self.balance += amount def withdraw(self, amount): if 0 < amount < self.balance: self.balance -= amount else: print('You dont have sufficient balance to withdraw') def show_balance(self): print('Your current balance is {}'.format(self.balance)) if __name__ == '__main__': name = str(input('Please Enter Your name:\n')) act_balance = 100.0 name1 = account(name, act_balance) name1.show_balance() payment = float(input('Enter the ammount, which has to be deposited:\n')) name1.deposit(payment) name1.show_balance() payment = float(input('Enter the ammount, How much you need withdraw:\n')) name1.withdraw(payment) name1.show_balance()
def isPrime(number): prime = True global code for c in range(2, number): if number % c == 0: prime = False if prime is True and len(str(number)) == 3: code = number code = counter = 0 while True: isPrime(counter) if counter == 1000: break counter += 1 print(code) # OUTPUT: 997 # The code was correct!
def is_prime(number): prime = True global code for c in range(2, number): if number % c == 0: prime = False if prime is True and len(str(number)) == 3: code = number code = counter = 0 while True: is_prime(counter) if counter == 1000: break counter += 1 print(code)
""" Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Example 2: Input: height = [4,2,0,3,2,5] Output: 9 Constraints: n == height.length 1 <= n <= 2 * 104 0 <= height[i] <= 105 """ """ Complextiy Time Complexity: O(n^2) Space Complexity: O(1) """ def trap(self, bars): # base case if no bars are present or are less than 3 if not bars or len(bars) < 3: return 0 volume = 0 # start pointers from both ends left, right = 0, len(bars) - 1 # current left and right max as the ones initiated l_max, r_max = bars[left], bars[right] # While left and right pointers have not crossed each other while left < right: # Get left max and right max l_max, r_max = max(bars[left], l_max), max(bars[right], r_max) # if left max is less than equal to right max if l_max <= r_max: # volume is on left side of the bars volume += l_max - bars[left] left += 1 # if left max is greater than right max else: # volume is on the right side of the bars volume += r_max - bars[right] right -= 1 return volume """ Complexity analysis Time complexity: O(n). Single iteration of O(n). Space complexity: O(1) extra space. Only constant space required for left, right, left_max and right_max. """ class Solution: def trap(self, height): """ :type height: List[int] :rtype: int """ areas = 0 max_l = max_r = 0 l = 0 r = len(height)-1 while l < r: if height[l] < height[r]: if height[l] > max_l: max_l = height[l] else: areas += max_l - height[l] l += 1 else: if height[r] > max_r: max_r = height[r] else: areas += max_r - height[r] r -= 1 return areas
""" Trapping Rain Water Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Example 1: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Example 2: Input: height = [4,2,0,3,2,5] Output: 9 Constraints: n == height.length 1 <= n <= 2 * 104 0 <= height[i] <= 105 """ '\n\nComplextiy\n\nTime Complexity: O(n^2)\nSpace Complexity: O(1)\n\n' def trap(self, bars): if not bars or len(bars) < 3: return 0 volume = 0 (left, right) = (0, len(bars) - 1) (l_max, r_max) = (bars[left], bars[right]) while left < right: (l_max, r_max) = (max(bars[left], l_max), max(bars[right], r_max)) if l_max <= r_max: volume += l_max - bars[left] left += 1 else: volume += r_max - bars[right] right -= 1 return volume '\n\nComplexity analysis\n\nTime complexity: O(n). Single iteration of O(n).\nSpace complexity: O(1) extra space. Only constant space required \nfor left, right, left_max and right_max.\n\n' class Solution: def trap(self, height): """ :type height: List[int] :rtype: int """ areas = 0 max_l = max_r = 0 l = 0 r = len(height) - 1 while l < r: if height[l] < height[r]: if height[l] > max_l: max_l = height[l] else: areas += max_l - height[l] l += 1 else: if height[r] > max_r: max_r = height[r] else: areas += max_r - height[r] r -= 1 return areas
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'ole' class Message: irc = None propagate = True # IRC-protocol attributes prefix = "" command = [] content = "" # IRC-command dependent attributes cmd = [] # bot-command within message nick = "" channel = None def __init__(self, irc, message): self.irc = irc # get prefix (hostname, etc.) prefix_end = 0 if len(message) > 0 and message[0] == ":": prefix_end = message.find(" ") self.prefix = message[1:prefix_end] prefix_end += 1 # get content content_start = message.find(" :") if ~content_start: self.content = message[content_start + 2:] self.command = message[prefix_end:content_start].split(" ") else: self.command = message[prefix_end:].split(" ") # get channel and/or nick if len(self.command) > 1 and len(self.command[1]) > 0 and self.command[1][0] == "#": self.channel = self.command[1] nick_end = self.prefix.find("!") if ~nick_end: self.nick = self.prefix[0:nick_end] # get command if self.content[0:irc.command_prefix_len] == irc.command_prefix: self.cmd = self.content[irc.command_prefix_len:].split() def get_events(self): events = ['on_receive'] if self.command[0] == "PRIVMSG": assert len(self.command) > 1 events.append('on_message') if self.command[1] == self.irc.ircNick: events.append('on_private_message') elif self.channel: events.append('on_channel_message') if len(self.cmd): events.append('on_command') elif self.command[0] == "KICK": assert len(self.command) > 2 if self.command[2] == self.irc.ircNick: events.append('on_kick') elif self.command[0] == "JOIN": events.append('on_join') elif self.command[0] == "PING": events.append('on_ping') elif self.command[0] == "NOTICE": events.append('on_notice') elif self.command[0] in ["QUIT", "PART"]: events.append('on_quit') return events def __str__(self): return "Message[{0}] <{1}>: {2}".format(" ".join(self.command), self.prefix, self.content)
__author__ = 'ole' class Message: irc = None propagate = True prefix = '' command = [] content = '' cmd = [] nick = '' channel = None def __init__(self, irc, message): self.irc = irc prefix_end = 0 if len(message) > 0 and message[0] == ':': prefix_end = message.find(' ') self.prefix = message[1:prefix_end] prefix_end += 1 content_start = message.find(' :') if ~content_start: self.content = message[content_start + 2:] self.command = message[prefix_end:content_start].split(' ') else: self.command = message[prefix_end:].split(' ') if len(self.command) > 1 and len(self.command[1]) > 0 and (self.command[1][0] == '#'): self.channel = self.command[1] nick_end = self.prefix.find('!') if ~nick_end: self.nick = self.prefix[0:nick_end] if self.content[0:irc.command_prefix_len] == irc.command_prefix: self.cmd = self.content[irc.command_prefix_len:].split() def get_events(self): events = ['on_receive'] if self.command[0] == 'PRIVMSG': assert len(self.command) > 1 events.append('on_message') if self.command[1] == self.irc.ircNick: events.append('on_private_message') elif self.channel: events.append('on_channel_message') if len(self.cmd): events.append('on_command') elif self.command[0] == 'KICK': assert len(self.command) > 2 if self.command[2] == self.irc.ircNick: events.append('on_kick') elif self.command[0] == 'JOIN': events.append('on_join') elif self.command[0] == 'PING': events.append('on_ping') elif self.command[0] == 'NOTICE': events.append('on_notice') elif self.command[0] in ['QUIT', 'PART']: events.append('on_quit') return events def __str__(self): return 'Message[{0}] <{1}>: {2}'.format(' '.join(self.command), self.prefix, self.content)
# Done by Carlos Amaral (2020/09/22) # SCU 4.7 - Range Function with a For Loop for i in range(1,10): print(i, " squared is ", i**2)
for i in range(1, 10): print(i, ' squared is ', i ** 2)
DEBUG = True DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } INSTALLED_APPS = [ 'tests.testapp', ] ROOT_URLCONF = 'tests.urls'
debug = True databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} installed_apps = ['tests.testapp'] root_urlconf = 'tests.urls'
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "nebula" class BeFilteredException(Exception): def __init__(self, t): self._t = t @property def type(self): return self._t
__author__ = 'nebula' class Befilteredexception(Exception): def __init__(self, t): self._t = t @property def type(self): return self._t
""" * Load and Display * * Images can be loaded and displayed to the screen at their actual size * or any other size. """ def setup(): size(640, 360) # The image file must be in the data folder of the current sketch # to load successfully global img img = loadImage("moonwalk.jpg") # Load the image into the program noLoop() def draw(): # Displays the image at its actual size at point (0,0) image(img, 0, 0) # Displays the image at point (0, height/2) at half of its size image(img, 0, height / 2, img.width / 2, img.height / 2)
""" * Load and Display * * Images can be loaded and displayed to the screen at their actual size * or any other size. """ def setup(): size(640, 360) global img img = load_image('moonwalk.jpg') no_loop() def draw(): image(img, 0, 0) image(img, 0, height / 2, img.width / 2, img.height / 2)
def gcd_iter(u, v): while v: u, v = v, u % v return abs(u)
def gcd_iter(u, v): while v: (u, v) = (v, u % v) return abs(u)
# Silvio Dunst # Variables can be of type function, and we can call those variables. # This means that lists, tuples and dicts can have variables of type function in them, # so we could have a dict that stores the letter of the menu and the function associated with that letter. # We could access that function by that letter. (NOTE: that this is not more efficient to run, just more efficient to write) def fun1(): print("this is fun1") def fun2(): print("this is fun2") whichFun = fun1 whichFun() whichFun = fun2 whichFun()
def fun1(): print('this is fun1') def fun2(): print('this is fun2') which_fun = fun1 which_fun() which_fun = fun2 which_fun()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 5 16:02:48 2018 @author: matteo """
""" Created on Thu Apr 5 16:02:48 2018 @author: matteo """
def isInterleave(s1: str, s2: str, s3: str) -> bool: def dfs(i, j, k): # dfs with memo if i == len(s1): return s2[j:] == s3[k:] if j == len(s2): return s1[i:] == s3[k:] if (i, j) in memo: return memo[(i, j)] res = False if s1[i] == s3[k] and dfs(i + 1, j, k + 1) or s2[j] == s3[k] and dfs(i, j + 1, k + 1): res = True memo[(i, j)] = res return memo[(i,j)] if len(s1) + len(s2) != len(s3): return False memo = {} return dfs(0, 0, 0) def interleave(s1, s2, s3): m, n = len(s1), len(s2) if m + n != len(s3): return False dp = [[False for _ in range(n + 1)] for _ in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 and j == 0: # both are empty dp[i][j] = True elif i == 0: dp[i][j] = dp[i][j - 1] and s2[j - 1] == s3[i + j - 1] elif j == 0: dp[i][j] = dp[i - 1][j] and s1[i - 1] == s3[i + j - 1] else: dp[i][j] = dp[i - 1][j] and s1[i - 1] == s3[i + j - 1] or dp[i][j - 1] and s2[j - 1] == s3[i + j - 1] return dp[m][n]
def is_interleave(s1: str, s2: str, s3: str) -> bool: def dfs(i, j, k): if i == len(s1): return s2[j:] == s3[k:] if j == len(s2): return s1[i:] == s3[k:] if (i, j) in memo: return memo[i, j] res = False if s1[i] == s3[k] and dfs(i + 1, j, k + 1) or (s2[j] == s3[k] and dfs(i, j + 1, k + 1)): res = True memo[i, j] = res return memo[i, j] if len(s1) + len(s2) != len(s3): return False memo = {} return dfs(0, 0, 0) def interleave(s1, s2, s3): (m, n) = (len(s1), len(s2)) if m + n != len(s3): return False dp = [[False for _ in range(n + 1)] for _ in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 and j == 0: dp[i][j] = True elif i == 0: dp[i][j] = dp[i][j - 1] and s2[j - 1] == s3[i + j - 1] elif j == 0: dp[i][j] = dp[i - 1][j] and s1[i - 1] == s3[i + j - 1] else: dp[i][j] = dp[i - 1][j] and s1[i - 1] == s3[i + j - 1] or (dp[i][j - 1] and s2[j - 1] == s3[i + j - 1]) return dp[m][n]
# S and T are strings composed of lowercase letters. In S, no letter occurs more # than once. # S was sorted in some custom order previously. We want to permute the characters # of T so that they match the order that S was sorted. More specifically, if x # occurs before y in S, then x should occur before y in the returned string. # Return any permutation of T (as a string) that satisfies this property. # Example : # Input: # S = "cba" # T = "abcd" # Output: "cbad" # Explanation: # "a", "b", "c" appear in S, so the order of "a", "b", "c" should be "c", # "b", and "a". Since "d" does not appear in S, it can be at any position # in T. "dcba", "cdba", "cbda" are also valid outputs. # Note: # S has length at most 26, and no character is repeated in S. # T has length at most 200. # S and T consist of lowercase letters only. class Solution: def customSortString(self, S, T): """ :type S: str :type T: str :rtype: str """ return "".join(sorted(T, key=S.find)) sol = Solution().customSortString print(sol("cba", "abcd"))
class Solution: def custom_sort_string(self, S, T): """ :type S: str :type T: str :rtype: str """ return ''.join(sorted(T, key=S.find)) sol = solution().customSortString print(sol('cba', 'abcd'))
with open("inputs/6.txt") as f: input = f.read() groups = [group.split() for group in input.split('\n\n')] total_answers = 0 for group in groups: total_answers += len(set(''.join(group))) print("Part 1 answer:", total_answers) total_answers = 0 for group in groups: sets = list(map(set, group)) total_answers += len(sets[0].intersection(*sets)) print("Part 2 answer:", total_answers)
with open('inputs/6.txt') as f: input = f.read() groups = [group.split() for group in input.split('\n\n')] total_answers = 0 for group in groups: total_answers += len(set(''.join(group))) print('Part 1 answer:', total_answers) total_answers = 0 for group in groups: sets = list(map(set, group)) total_answers += len(sets[0].intersection(*sets)) print('Part 2 answer:', total_answers)
#disorder def distinct_list(a): return list(set(a))
def distinct_list(a): return list(set(a))
class CreditCard: """ A consumer credit card.""" def __init__(self, customer, bank, acnt, limit): """Create a new credit card instance. The initial balance is zero. customer the name of the customer (e.g., 'John Bowman') bank the name of the bank (e.g., 'California Savings') acnt the acoount identifier (e.g., '1023 1023 1023 1023') limit credit limit (measured in dollars) """ self._customer = customer self._bank = bank self._account = acnt self._limit = limit self._balance = 0 def get_customer(self): """Return name of the customer.""" return self._customer def get_bank(self): """Return the bank's name""" return self._bank def get_account(self): """Return the card identifying number (typically stored as a string).""" return self._account def get_limit(self): """Return current credit limit.""" return self._limit def get_balance(self): """Return current balance.""" return self._balance def charge(self, price): """Charge given price to the card, assuming sufficient credit limit. Return true if charge was processed: False if charge was denied. """ if price + self._balance > self._limit: return False else: self._balance += price return True def make_payment(self, amount): """Process customer payment that reduces balance.""" self._balance -= amount if __name__ == '__main__': wallet = [] wallet.append(CreditCard('John Bowman', 'California Savings', '0000 0000 0000 0001', 1000)) wallet.append(CreditCard('John Bowman', 'California Federal', '0000 0000 0000 0002', 2000)) wallet.append(CreditCard('John Bowman', 'California Finance', '0000 0000 0000 0003', 3000)) for val in range(1, 17): wallet[0].charge(val) wallet[1].charge(2*val) wallet[2].charge(3*val) for c in range(3): print('Customer =', wallet[c].get_customer()) print('Bank =', wallet[c].get_bank()) print('Account =', wallet[c].get_account()) print('Limit =', wallet[c].get_limit()) print('Balance =', wallet[c].get_balance()) while wallet[c].get_balance() > 100: wallet[c].make_payment(100) print('New Balance =', wallet[c].get_balance()) print() class PredatoryCreditCard(CreditCard): """ An extension to CreditCard that componds interest and fees.""" def __init__(self, customer, bank, acnt, limit, apr): """ Create a new predatory credit card instance. The initial balance is zero. customer the name of the customer (e.g., 'John Bowman') bank the name of the bank (e.g., 'California Savings') acnt the acoount identifier (e.g., '1023 1023 1023 1023') limit credit limit (measured in dollars) apr annual percentage rate (e.g., 0.0825 for 8.25% APR) """ super().__init__(customer, bank, acnt, limit) # call super class constructor self._apr = apr def charge(self, price): """ Charge given price to the card, assuming sufficient credit limit. Return True if charge was processed. Return False and assess $5 fee if the charge is denied. """ success = super().charge(price) if not success: self._balance += 5 return True def process_month(self): """ Assess monthly interest on the outstanding balance.""" if self._balance > 0: monthly_factor = pow(1 + self._apr, 1/12) self._balance *= monthly_factor
class Creditcard: """ A consumer credit card.""" def __init__(self, customer, bank, acnt, limit): """Create a new credit card instance. The initial balance is zero. customer the name of the customer (e.g., 'John Bowman') bank the name of the bank (e.g., 'California Savings') acnt the acoount identifier (e.g., '1023 1023 1023 1023') limit credit limit (measured in dollars) """ self._customer = customer self._bank = bank self._account = acnt self._limit = limit self._balance = 0 def get_customer(self): """Return name of the customer.""" return self._customer def get_bank(self): """Return the bank's name""" return self._bank def get_account(self): """Return the card identifying number (typically stored as a string).""" return self._account def get_limit(self): """Return current credit limit.""" return self._limit def get_balance(self): """Return current balance.""" return self._balance def charge(self, price): """Charge given price to the card, assuming sufficient credit limit. Return true if charge was processed: False if charge was denied. """ if price + self._balance > self._limit: return False else: self._balance += price return True def make_payment(self, amount): """Process customer payment that reduces balance.""" self._balance -= amount if __name__ == '__main__': wallet = [] wallet.append(credit_card('John Bowman', 'California Savings', '0000 0000 0000 0001', 1000)) wallet.append(credit_card('John Bowman', 'California Federal', '0000 0000 0000 0002', 2000)) wallet.append(credit_card('John Bowman', 'California Finance', '0000 0000 0000 0003', 3000)) for val in range(1, 17): wallet[0].charge(val) wallet[1].charge(2 * val) wallet[2].charge(3 * val) for c in range(3): print('Customer =', wallet[c].get_customer()) print('Bank =', wallet[c].get_bank()) print('Account =', wallet[c].get_account()) print('Limit =', wallet[c].get_limit()) print('Balance =', wallet[c].get_balance()) while wallet[c].get_balance() > 100: wallet[c].make_payment(100) print('New Balance =', wallet[c].get_balance()) print() class Predatorycreditcard(CreditCard): """ An extension to CreditCard that componds interest and fees.""" def __init__(self, customer, bank, acnt, limit, apr): """ Create a new predatory credit card instance. The initial balance is zero. customer the name of the customer (e.g., 'John Bowman') bank the name of the bank (e.g., 'California Savings') acnt the acoount identifier (e.g., '1023 1023 1023 1023') limit credit limit (measured in dollars) apr annual percentage rate (e.g., 0.0825 for 8.25% APR) """ super().__init__(customer, bank, acnt, limit) self._apr = apr def charge(self, price): """ Charge given price to the card, assuming sufficient credit limit. Return True if charge was processed. Return False and assess $5 fee if the charge is denied. """ success = super().charge(price) if not success: self._balance += 5 return True def process_month(self): """ Assess monthly interest on the outstanding balance.""" if self._balance > 0: monthly_factor = pow(1 + self._apr, 1 / 12) self._balance *= monthly_factor
class SingleLinkedList(object): """ simple implimentation of a linked singly linked list """ def __init__(self): """ initializes a new node with none values """ self.next = None self.data = None def set_value(self, value): """ sets the data value of the current node """ self.data = value def get_value(self): """ returns the value of the current node """ return self.data def set_next(self, next_node): """ sets the next node """ self.next = next_node def get_next(self): """ returns the next node """ return self.next def has_next(self): """ returns boolean if the current node has a next node or not """ if self.next: return True return False
class Singlelinkedlist(object): """ simple implimentation of a linked singly linked list """ def __init__(self): """ initializes a new node with none values """ self.next = None self.data = None def set_value(self, value): """ sets the data value of the current node """ self.data = value def get_value(self): """ returns the value of the current node """ return self.data def set_next(self, next_node): """ sets the next node """ self.next = next_node def get_next(self): """ returns the next node """ return self.next def has_next(self): """ returns boolean if the current node has a next node or not """ if self.next: return True return False
f = open('in_domain_dev.tsv', 'r').readlines() g1 = open('val.src', 'w') g2 = open('val.tgt', 'w') for line in f: line = line.split('\t') _, label, _, text = line g1.write('{}'.format(text)) g2.write('{}\n'.format(label))
f = open('in_domain_dev.tsv', 'r').readlines() g1 = open('val.src', 'w') g2 = open('val.tgt', 'w') for line in f: line = line.split('\t') (_, label, _, text) = line g1.write('{}'.format(text)) g2.write('{}\n'.format(label))
matriz = [[0,0,0],[0,0,0],[0,0,0]] for l in range(0,3): for c in range(0,3): matriz[l][c] = int(input(f'Digite os valores para [{l}, {c}]: ')) print('=-='*30) for l in range(0,3): for c in range(0,3): print(f'[{matriz[l][c]: ^5}', end = '') print()
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for l in range(0, 3): for c in range(0, 3): matriz[l][c] = int(input(f'Digite os valores para [{l}, {c}]: ')) print('=-=' * 30) for l in range(0, 3): for c in range(0, 3): print(f'[{matriz[l][c]: ^5}', end='') print()
def node_to_string(node, layer = 0): message = '|' * layer + repr(node) + '\n' for child in node.children: message += node_to_string(child, layer + 1) return message
def node_to_string(node, layer=0): message = '|' * layer + repr(node) + '\n' for child in node.children: message += node_to_string(child, layer + 1) return message
config = { "host_server": "<host_address>", 'token_request':{ 'client_id': '<client_id>', 'client_secret': '<client_secret>', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For Access Token', }, 'ecom':{ 'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For the eCommerce product', }, 'ecom_initiate_payment_body':{ "merchantInfo": { "merchantSerialNumber": "<merchantSerialNumber>", }, } }
config = {'host_server': '<host_address>', 'token_request': {'client_id': '<client_id>', 'client_secret': '<client_secret>', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For Access Token'}, 'ecom': {'Content-Type': 'application/json', 'Ocp-Apim-Subscription-Key': '<Ocp-Apim-Subscription-Key> For the eCommerce product'}, 'ecom_initiate_payment_body': {'merchantInfo': {'merchantSerialNumber': '<merchantSerialNumber>'}}}
def calc(n): if n<12: return n if dp[n]: return dp[n] x=calc(n//2)+calc(n//3)+calc(n//4) dp[n]=max(n,x) return dp[n] dp=[0 for i in range(1000000)] n=int(input()) print(calc(n)) #============================== def decode(s): for i in range(2,len(s)+1): prev=int(s[i-2]) cur=int(s[i-1]) if prev>=3 or prev==0: dp[i]=dp[i-1] else: if cur==0: dp[i]=dp[i-2] else: if prev==1: dp[i]=dp[i-1]+dp[i-2] elif prev==2: if cur>6: dp[i]=dp[i-1] else: dp[i]=dp[i-1]+dp[i-2] return dp[len(s)] n=int(input()) dp=[0 for i in range(n+1)] dp[0]=1 dp[1]=1 print(decode(str(n))) #============================== def minCost(cost,m,n): dp=[[0 for i in range(3)]for i in range(3)] dp[0][0]=cost[0][0] for i in range(1,m+1): dp[i][0]=dp[i-1][0]+cost[i][0] for j in range(1,n+1): dp[0][j]=dp[0][j-1]+cost[0][j] for i in range(1,m+1): for j in range(1,n+1): dp[i][j]=cost[i][j]+min(dp[i-1][j],dp[i-1][j-1],dp[i][j-1]) return dp[m][n] cost = [[1, 2, 3], [4, 8, 2], [1, 5, 3]] print(minCost(cost, 2, 2)) #============================== def editDistance_recur(s1,s2,m,n): if m==0: return n if n==0: return m if s1[m-1]==s2[n-1]: return editDistance_recur(s1,s2,m-1,n-1) return 1+min(editDistance_recur(s1,s2,m,n-1),#insert editDistance_recur(s1,s2,m-1,n),#delete editDistance_recur(s1,s2,m-1,n-1))#replace print("edit distance using recursion : ", editDistance_recur("sunday","saturday",6,8)) #============================== def editDistance_dp(s1,s2,m,n): for i in range(m+1): for j in range(n+1): if i==0: dp[i][j]=j elif j==0: dp[i][j]=i elif s1[i-1]==s2[j-1]: dp[i][j]=dp[i-1][j-1] else: dp[i][j]=1+min(dp[i][j-1],#insert dp[i-1][j],#delete dp[i-1][j-1])#replace return dp[m][n] m=6 n=8 dp=[[0 for i in range(n+1)]for j in range(m+1)] print("edit distance using dp : ", editDistance_dp("sunday","saturday",m,n)) #============================== def lcsLength(x,y): m=len(x) n=len(y) dp = [[None]*(n+1) for i in range(m+1)] for i in range(m+1): for j in range(n+1): if i==0 or j==0: dp[i][j]=0 elif x[i-1]==y[j-1]: dp[i][j]=dp[i-1][j-1]+1 else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) return dp[m][n] print("length of LCS : ",lcsLength("AGGTAB","GXTXAYB")) #============================== def lcsPrint(x,y): m=len(x) n=len(y) dp = [[0 for i in range(n+1)] for j in range(m+1)] for i in range(m+1): for j in range(n+1): if i==0 or j==0: dp[i][j]=0 elif x[i-1]==y[j-1]: dp[i][j]=dp[i-1][j-1]+1 else: dp[i][j]=max(dp[i-1][j],dp[i][j-1]) index=dp[m][n] lcs=[""]*(index+1) lcs[index]="" i=m j=n while i>0 and j>0: if x[i-1]==y[j-1]: lcs[index-1]=x[i-1] i-=1 j-=1 index-=1 elif dp[i-1][j]>dp[i][j-1]: i-=1 else: j-=1 return lcs print("LCS : ",lcsPrint("AGGTAB","GXTXAYB")) #============================== R = 3 C = 5 def issafe(i, j): if (i >= 0 and i < R and j >= 0 and j < C): return True return False def rotOranges(v): changed = False no = 2 while (True): for i in range(R): for j in range(C): if (v[i][j] == no): if (issafe(i + 1, j) and v[i + 1][j] == 1): v[i + 1][j] = v[i][j] + 1 changed = True if (issafe(i, j + 1) and v[i][j + 1] == 1): v[i][j + 1] = v[i][j] + 1 changed = True if (issafe(i - 1, j) and v[i - 1][j] == 1): v[i - 1][j] = v[i][j] + 1 changed = True if (issafe(i, j - 1) and v[i][j - 1] == 1): v[i][j - 1] = v[i][j] + 1 changed = True if (not changed): break changed = False no += 1 for i in range(R): for j in range(C): if (v[i][j] == 1): return -1 return no - 2 if __name__ == "__main__": v = [[2, 1, 0, 2, 1], [1, 0, 1, 2, 1], [1, 0, 0, 2, 1]] print("Max time incurred: ",rotOranges(v)) #============================== # pattern searching def KMPSearch(pat, txt): M = len(pat) N = len(txt) lps = [0]*M j = 0 # index for pat[] computeLPSArray(pat, M, lps) i = 0 # index for txt[] while i < N: if pat[j] == txt[i]: i += 1 j += 1 if j == M: print ("Found pattern at index " + str(i-j)) j = lps[j-1] elif i < N and pat[j] != txt[i]: if j != 0: j = lps[j-1] else: i += 1 def computeLPSArray(pat, M, lps): len = 0 # length of the previous longest prefix suffix lps[0] # lps[0] is always 0 i = 1 while i < M: if pat[i]== pat[len]: len += 1 lps[i] = len i += 1 else: if len != 0: len = lps[len-1] else: lps[i] = 0 i += 1 txt = "ABABDABACDABABCABAB" pat = "ABABCABAB" KMPSearch(pat, txt) #==============================
def calc(n): if n < 12: return n if dp[n]: return dp[n] x = calc(n // 2) + calc(n // 3) + calc(n // 4) dp[n] = max(n, x) return dp[n] dp = [0 for i in range(1000000)] n = int(input()) print(calc(n)) def decode(s): for i in range(2, len(s) + 1): prev = int(s[i - 2]) cur = int(s[i - 1]) if prev >= 3 or prev == 0: dp[i] = dp[i - 1] elif cur == 0: dp[i] = dp[i - 2] elif prev == 1: dp[i] = dp[i - 1] + dp[i - 2] elif prev == 2: if cur > 6: dp[i] = dp[i - 1] else: dp[i] = dp[i - 1] + dp[i - 2] return dp[len(s)] n = int(input()) dp = [0 for i in range(n + 1)] dp[0] = 1 dp[1] = 1 print(decode(str(n))) def min_cost(cost, m, n): dp = [[0 for i in range(3)] for i in range(3)] dp[0][0] = cost[0][0] for i in range(1, m + 1): dp[i][0] = dp[i - 1][0] + cost[i][0] for j in range(1, n + 1): dp[0][j] = dp[0][j - 1] + cost[0][j] for i in range(1, m + 1): for j in range(1, n + 1): dp[i][j] = cost[i][j] + min(dp[i - 1][j], dp[i - 1][j - 1], dp[i][j - 1]) return dp[m][n] cost = [[1, 2, 3], [4, 8, 2], [1, 5, 3]] print(min_cost(cost, 2, 2)) def edit_distance_recur(s1, s2, m, n): if m == 0: return n if n == 0: return m if s1[m - 1] == s2[n - 1]: return edit_distance_recur(s1, s2, m - 1, n - 1) return 1 + min(edit_distance_recur(s1, s2, m, n - 1), edit_distance_recur(s1, s2, m - 1, n), edit_distance_recur(s1, s2, m - 1, n - 1)) print('edit distance using recursion : ', edit_distance_recur('sunday', 'saturday', 6, 8)) def edit_distance_dp(s1, s2, m, n): for i in range(m + 1): for j in range(n + 1): if i == 0: dp[i][j] = j elif j == 0: dp[i][j] = i elif s1[i - 1] == s2[j - 1]: dp[i][j] = dp[i - 1][j - 1] else: dp[i][j] = 1 + min(dp[i][j - 1], dp[i - 1][j], dp[i - 1][j - 1]) return dp[m][n] m = 6 n = 8 dp = [[0 for i in range(n + 1)] for j in range(m + 1)] print('edit distance using dp : ', edit_distance_dp('sunday', 'saturday', m, n)) def lcs_length(x, y): m = len(x) n = len(y) dp = [[None] * (n + 1) for i in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 or j == 0: dp[i][j] = 0 elif x[i - 1] == y[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) return dp[m][n] print('length of LCS : ', lcs_length('AGGTAB', 'GXTXAYB')) def lcs_print(x, y): m = len(x) n = len(y) dp = [[0 for i in range(n + 1)] for j in range(m + 1)] for i in range(m + 1): for j in range(n + 1): if i == 0 or j == 0: dp[i][j] = 0 elif x[i - 1] == y[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) index = dp[m][n] lcs = [''] * (index + 1) lcs[index] = '' i = m j = n while i > 0 and j > 0: if x[i - 1] == y[j - 1]: lcs[index - 1] = x[i - 1] i -= 1 j -= 1 index -= 1 elif dp[i - 1][j] > dp[i][j - 1]: i -= 1 else: j -= 1 return lcs print('LCS : ', lcs_print('AGGTAB', 'GXTXAYB')) r = 3 c = 5 def issafe(i, j): if i >= 0 and i < R and (j >= 0) and (j < C): return True return False def rot_oranges(v): changed = False no = 2 while True: for i in range(R): for j in range(C): if v[i][j] == no: if issafe(i + 1, j) and v[i + 1][j] == 1: v[i + 1][j] = v[i][j] + 1 changed = True if issafe(i, j + 1) and v[i][j + 1] == 1: v[i][j + 1] = v[i][j] + 1 changed = True if issafe(i - 1, j) and v[i - 1][j] == 1: v[i - 1][j] = v[i][j] + 1 changed = True if issafe(i, j - 1) and v[i][j - 1] == 1: v[i][j - 1] = v[i][j] + 1 changed = True if not changed: break changed = False no += 1 for i in range(R): for j in range(C): if v[i][j] == 1: return -1 return no - 2 if __name__ == '__main__': v = [[2, 1, 0, 2, 1], [1, 0, 1, 2, 1], [1, 0, 0, 2, 1]] print('Max time incurred: ', rot_oranges(v)) def kmp_search(pat, txt): m = len(pat) n = len(txt) lps = [0] * M j = 0 compute_lps_array(pat, M, lps) i = 0 while i < N: if pat[j] == txt[i]: i += 1 j += 1 if j == M: print('Found pattern at index ' + str(i - j)) j = lps[j - 1] elif i < N and pat[j] != txt[i]: if j != 0: j = lps[j - 1] else: i += 1 def compute_lps_array(pat, M, lps): len = 0 lps[0] i = 1 while i < M: if pat[i] == pat[len]: len += 1 lps[i] = len i += 1 elif len != 0: len = lps[len - 1] else: lps[i] = 0 i += 1 txt = 'ABABDABACDABABCABAB' pat = 'ABABCABAB' kmp_search(pat, txt)
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ y = int(x) r = 0 while x > 0: r *= 10 r += x % 10 x //= 10 print(r) if r == y: return True else: return False if __name__ == '__main__': x = 929 instance = Solution() solution = instance.isPalindrome(x) print(solution)
class Solution(object): def is_palindrome(self, x): """ :type x: int :rtype: bool """ y = int(x) r = 0 while x > 0: r *= 10 r += x % 10 x //= 10 print(r) if r == y: return True else: return False if __name__ == '__main__': x = 929 instance = solution() solution = instance.isPalindrome(x) print(solution)
'''For a range of numbers starting at 2, determine whether the number is 'perfect', 'abundant' or 'deficient', ''' topNum = input("What is the upper number for the range:") topNum = int(topNum) theNum=2 while theNum <= topNum: # sum up the divisors divisor = 1 sumOfDivisors = 0 while divisor < theNum: if theNum % divisor==0: sumOfDivisors = sumOfDivisors + divisor divisor = divisor + 1 # classify the number based on its divisor sum if theNum == sumOfDivisors: print(theNum,"is perfect") elif theNum < sumOfDivisors: print(theNum,"is abundant") else: print(theNum,"is deficient") theNum += 1
"""For a range of numbers starting at 2, determine whether the number is 'perfect', 'abundant' or 'deficient', """ top_num = input('What is the upper number for the range:') top_num = int(topNum) the_num = 2 while theNum <= topNum: divisor = 1 sum_of_divisors = 0 while divisor < theNum: if theNum % divisor == 0: sum_of_divisors = sumOfDivisors + divisor divisor = divisor + 1 if theNum == sumOfDivisors: print(theNum, 'is perfect') elif theNum < sumOfDivisors: print(theNum, 'is abundant') else: print(theNum, 'is deficient') the_num += 1
def div(n1,n2): d = n1 // n2 r = n1 - n2 * d print(r) while True: try: num1 = float(input("Please enter the first number:")) num2 = float(input("Please enter the second number:")) except ValueError: print("Please enter the number correctly.") else: div(num1,num2) break
def div(n1, n2): d = n1 // n2 r = n1 - n2 * d print(r) while True: try: num1 = float(input('Please enter the first number:')) num2 = float(input('Please enter the second number:')) except ValueError: print('Please enter the number correctly.') else: div(num1, num2) break
#!/usr/bin/env python # coding=utf-8 def concat(*args, sep = "/"): return sep.join(args) concat("earth","mars","venus") concat("earth","mars","venus", sep=".")
def concat(*args, sep='/'): return sep.join(args) concat('earth', 'mars', 'venus') concat('earth', 'mars', 'venus', sep='.')
class Television: def __init__(self): self.ligada = False self.canal = 4 def power(self): if self.ligada: self.ligada = False else: self.ligada = True def canal_up(self): if self.ligada: self.canal += 1 def canal_down(self): if self.ligada: self.canal -= 1 tv = Television() print(tv.ligada) tv.power() print(tv.ligada) tv.power() print(tv.ligada) tv.canal_up() tv.canal_up() print(tv.canal)
class Television: def __init__(self): self.ligada = False self.canal = 4 def power(self): if self.ligada: self.ligada = False else: self.ligada = True def canal_up(self): if self.ligada: self.canal += 1 def canal_down(self): if self.ligada: self.canal -= 1 tv = television() print(tv.ligada) tv.power() print(tv.ligada) tv.power() print(tv.ligada) tv.canal_up() tv.canal_up() print(tv.canal)
""" Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water. Note: You may not slant the container. """ class Solution: # @return an integer def maxArea(self, height): l = 0 r = len(height) - 1 max_water = 0 while l < r: max_water = max(max_water, (r-l) * min(height[l], height[r])) if height[l] <= height[r]: l += 1 else: r -= 1 return max_water # Two pointer problem
""" Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water. Note: You may not slant the container. """ class Solution: def max_area(self, height): l = 0 r = len(height) - 1 max_water = 0 while l < r: max_water = max(max_water, (r - l) * min(height[l], height[r])) if height[l] <= height[r]: l += 1 else: r -= 1 return max_water
input = """ % Input: specify parts of the rules ... rule(r1). head(bird,r1). rule(r2). head(swims,r1). rule(r3). head(neg_flies,r3). pbl(peng,r3). nbl(flies,r3). rule(r4). head(flies,r4). pbl(bird,r4). nbl(neg_flies,r4). rule(r5). head(peng,r5). pbl(bird,r5). pbl(swims,r5). nbl(neg_peng,r5). opp(flies,neg_flies). opp(peng,neg_peng). pr(r3,r4). """ output = """ % Input: specify parts of the rules ... rule(r1). head(bird,r1). rule(r2). head(swims,r1). rule(r3). head(neg_flies,r3). pbl(peng,r3). nbl(flies,r3). rule(r4). head(flies,r4). pbl(bird,r4). nbl(neg_flies,r4). rule(r5). head(peng,r5). pbl(bird,r5). pbl(swims,r5). nbl(neg_peng,r5). opp(flies,neg_flies). opp(peng,neg_peng). pr(r3,r4). """
input = '\n% Input: specify parts of the rules ...\n\n\n rule(r1). head(bird,r1).\n\n rule(r2). head(swims,r1). \n\n rule(r3). head(neg_flies,r3). pbl(peng,r3). nbl(flies,r3).\n\n rule(r4). head(flies,r4). pbl(bird,r4). nbl(neg_flies,r4).\n\n rule(r5). head(peng,r5). pbl(bird,r5). pbl(swims,r5). nbl(neg_peng,r5).\n\n opp(flies,neg_flies). \n opp(peng,neg_peng). \n\n pr(r3,r4).\n\n\n' output = '\n% Input: specify parts of the rules ...\n\n\n rule(r1). head(bird,r1).\n\n rule(r2). head(swims,r1). \n\n rule(r3). head(neg_flies,r3). pbl(peng,r3). nbl(flies,r3).\n\n rule(r4). head(flies,r4). pbl(bird,r4). nbl(neg_flies,r4).\n\n rule(r5). head(peng,r5). pbl(bird,r5). pbl(swims,r5). nbl(neg_peng,r5).\n\n opp(flies,neg_flies). \n opp(peng,neg_peng). \n\n pr(r3,r4).\n\n\n'
# Use words.txt as the file name fname = input("Enter file name: ") fh = open(fname) for inp in fname: print(inp.isUpper()) print('hello im the impostor, changes made by satyam raj') print('ima a hacker, coz im doing this bullshit for hacktoberfest')
fname = input('Enter file name: ') fh = open(fname) for inp in fname: print(inp.isUpper()) print('hello im the impostor, changes made by satyam raj') print('ima a hacker, coz im doing this bullshit for hacktoberfest')
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def dfs(self, node: TreeNode, sum: int) -> int: res = 1 if node.val == sum else 0 if node.left: res += self.dfs(node.left, sum - node.val) if node.right: res += self.dfs(node.right, sum - node.val) return res def pathSum(self, root: TreeNode, sum: int) -> int: if not root: return 0 result = 0 nodes = [] nodes.append(root) while nodes: node = nodes.pop() result += self.dfs(node, sum) if node.left: nodes.append(node.left) if node.right: nodes.append(node.right) return result
class Solution: def dfs(self, node: TreeNode, sum: int) -> int: res = 1 if node.val == sum else 0 if node.left: res += self.dfs(node.left, sum - node.val) if node.right: res += self.dfs(node.right, sum - node.val) return res def path_sum(self, root: TreeNode, sum: int) -> int: if not root: return 0 result = 0 nodes = [] nodes.append(root) while nodes: node = nodes.pop() result += self.dfs(node, sum) if node.left: nodes.append(node.left) if node.right: nodes.append(node.right) return result
def sssi(M, s): L = [] for i in M[::-1]: if s >= i: s -= i L.append(1) else: L.append(0) if s == 0: return L[::-1] print("!!!!!")
def sssi(M, s): l = [] for i in M[::-1]: if s >= i: s -= i L.append(1) else: L.append(0) if s == 0: return L[::-1] print('!!!!!')
"""Test Basic Addition""" def test_basic_addition(): assert 1 + 1 == 2 def test_basic_addition_inverse(): assert 1 + 1 != 3
"""Test Basic Addition""" def test_basic_addition(): assert 1 + 1 == 2 def test_basic_addition_inverse(): assert 1 + 1 != 3
class GrowingBlob: """ python is slow in accumulation of large data (str += segment). Growing blob is an optimization for that """ def __init__(self): self._blobs = [] self._length = 0 def append(self, blob): self._blobs.append(blob) self._length += len(blob) def length(self): return self._length def content(self): return "".join(self._blobs) def substr(self, start, ceil): if ceil > self._length: ceil = self._length offset = start length = ceil - offset result = "" for blob in self._blobs: if length == 0: break if offset > len(blob): offset -= len(blob) continue else: subblob = blob[offset: offset + length] result += subblob offset = 0 length -= len(subblob) return result
class Growingblob: """ python is slow in accumulation of large data (str += segment). Growing blob is an optimization for that """ def __init__(self): self._blobs = [] self._length = 0 def append(self, blob): self._blobs.append(blob) self._length += len(blob) def length(self): return self._length def content(self): return ''.join(self._blobs) def substr(self, start, ceil): if ceil > self._length: ceil = self._length offset = start length = ceil - offset result = '' for blob in self._blobs: if length == 0: break if offset > len(blob): offset -= len(blob) continue else: subblob = blob[offset:offset + length] result += subblob offset = 0 length -= len(subblob) return result
""" For more details regarding inputs and output in form of complex dictionaries see the original source docs at: %host%/docs/source/Core.html for example: `https://editor.webgme.org/docs/source/Core.html <https://editor.webgme.org/docs/source/Core.html>`_ """ class Core(object): """ Class for querying and manipulating the tree graph in a gme project. Practically, each method takes at least one node-dict as input. Use core.load_root(root_hash) to get an initial root-node of a the tree. """ def __init__(self, webgme): self._webgme = webgme self._CONSTANTS = None def _send(self, payload): payload['type'] = 'core' self._webgme.send_request(payload) return self._webgme.handle_response() @property def CONSTANTS(self): """ A dictionary with the `constants associated with the Core <https://github.com/webgme/webgme-engine/blob/master/src/common/core/constants.js>`_. """ if self._CONSTANTS is None: self._CONSTANTS = self._send({'name': 'CONSTANTS', 'args': []}) return self._CONSTANTS def add_library(self, node, name, library_root_hash, library_info=None): """ It adds a project as library to your project by copying it over. The library will be a node\ with the given name directly under your project's ROOT. It becomes a read-only portion of your project.\ You will only be able to manipulate it with library functions, but cannot edit the individual nodes inside.\ However you will be able to instantiate or copy the nodes into other places of your project. Every node\ that was part of the META in the originating project becomes part of your project's meta. :param node: any regular node in your project. :type node: dict :param name: the name of the library you wish to use as a namespace in your project. :type name: str :param library_root_hash: the hash of your library's root\ (must exist in the project's collection at the time of call). :type library_root_hash: str :param library_info: information about your project. :type library_info: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreIllegalOperationError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'addLibrary', 'args': [node, name, library_root_hash, library_info]}) def add_member(self, node, name, member): """ Adds a member to the given set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param member: the new member of the set. :type member: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'addMember', 'args': [node, name, member]}) def add_mixin(self, node, path): """ Adds a mixin to the mixin set of the node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'addMixin', 'args': [node, path]}) def apply_resolution(self, conflict): """ When our attempt to merge two patches ended in some conflict, then we can modify that result highlighting\ that in case of every conflict, which side we prefer (mine vs. theirs). If we give that object as an input\ to this function, it will finish the merge resolving the conflict according our settings and present a final\ patch. :param conflict: the object that represents our settings for every conflict and the so-far-merged\ patch. :type conflict: dict :returns: The function results in a tree structured patch object that contains the changesthat cover\ both parties modifications (and the conflicts are resolved according the input settings). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'applyResolution', 'args': [conflict]}) def apply_tree_diff(self, node, patch): """ Apply changes to the current project. :param node: the root of the containment hierarchy where we wish to apply the changes :type node: dict :param patch: the tree structured collection of changes represented with a special JSON object :type patch: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'applyTreeDiff', 'args': [node, patch]}) def can_set_as_mixin(self, node, path): """ Checks if the given path can be added as a mixin to the given node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Returns an object with isOk set to true if the given path can be added as a\ mixin to the given node. If it cannot, the reason will be reported under reason. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'canSetAsMixin', 'args': [node, path]}) def clear_meta_rules(self, node): """ Removes all META rules defined at the node. Note that it does not clear any rules from other meta-nodes\ where the node if referenced. :param node: the node in question. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'clearMetaRules', 'args': [node]}) def clear_mixins(self, node): """ Removes all mixins for a given node. :param node: the node in question. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'clearMixins', 'args': [node]}) def copy_node(self, node, parent): """ Copies the given node into parent. :param node: the node to be copied. :type node: dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns the copied node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'copyNode', 'args': [node, parent]}) def copy_nodes(self, nodes, parent): """ Copies the given nodes into parent. :param nodes: the nodes to be copied. :type nodes: list of dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns an array of the copied nodes. The order follows\ the order of originals. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'copyNodes', 'args': [nodes, parent]}) def create_child(self, node, base): """ Creates a child, with base as provided, inside the provided node. :param node: the parent of the node to be created. :type node: dict :param base: the base of the node to be created. :type base: dict :returns: The function returns the created child node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createChild', 'args': [node, base]}) def create_node(self, parameters=None): """ Creates a node according to the given parameters. :param parameters: the details of the creation. :type parameters: dict :returns: The function returns the created node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createNode', 'args': [parameters]}) def create_set(self, node, name): """ Creates a set for the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createSet', 'args': [node, name]}) def del_aspect_meta(self, node, name): """ Removes the given aspect rule of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAspectMeta', 'args': [node, name]}) def del_aspect_meta_target(self, node, name, path): """ Removes a valid type from the given aspect of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :param path: the absolute path of the valid type of the aspect. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAspectMetaTarget', 'args': [node, name, path]}) def del_attribute(self, node, name): """ Removes the given attributes from the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAttribute', 'args': [node, name]}) def del_attribute_meta(self, node, name): """ Removes an attribute definition from the META rules of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAttributeMeta', 'args': [node, name]}) def del_child_meta(self, node, path): """ Removes the given child rule from the node. :param node: the node in question. :type node: dict :param path: the absolute path of the child which rule is to be removed from the node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delChildMeta', 'args': [node, path]}) def del_constraint(self, node, name): """ Removes a constraint from the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delConstraint', 'args': [node, name]}) def del_member(self, node, name, path): """ Removes a member from the set. The functions doesn't remove the node itself. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member to be removed. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMember', 'args': [node, name, path]}) def del_member_attribute(self, node, set_name, member_path, attr_name): """ Removes an attribute which represented a property of the given set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param member_path: the absolute path of the member node. :type member_path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMemberAttribute', 'args': [node, set_name, member_path, attr_name]}) def del_member_registry(self, node, set_name, path, reg_name): """ Removes a registry entry which represented a property of the given set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMemberRegistry', 'args': [node, set_name, path, reg_name]}) def del_mixin(self, node, path): """ Removes a mixin from the mixin set of the node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMixin', 'args': [node, path]}) def del_pointer(self, node, name): """ Removes the pointer from the node. (Aliased deletePointer.) :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointer', 'args': [node, name]}) def del_pointer_meta(self, node, name): """ Removes the complete META rule regarding the given pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointerMeta', 'args': [node, name]}) def del_pointer_meta_target(self, node, name, path): """ Removes a possible target type from the pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set :type name: str :param path: the absolute path of the possible target type. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If node is read-only, or definition does not exist. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointerMetaTarget', 'args': [node, name, path]}) def del_registry(self, node, name): """ Removes the given registry entry from the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delRegistry', 'args': [node, name]}) def del_set(self, node, name): """ Removes a set from the node. (Aliased deleteSet.) :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSet', 'args': [node, name]}) def del_set_attribute(self, node, set_name, attr_name): """ Removes the attribute entry for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSetAttribute', 'args': [node, set_name, attr_name]}) def del_set_registry(self, node, set_name, reg_name): """ Removes the registry entry for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSetRegistry', 'args': [node, set_name, reg_name]}) def delete_node(self, node): """ Removes a node from the containment hierarchy. :param node: the node to be removed. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deleteNode', 'args': [node]}) def delete_pointer(self, node, name): """ Removes the pointer from the node. (Aliased delPointer.) :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deletePointer', 'args': [node, name]}) def delete_set(self, node, name): """ Removes a set from the node. (Aliased delSet.) :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deleteSet', 'args': [node, name]}) def generate_tree_diff(self, source_root, target_root): """ Generates a differential tree among the two states of the project that contains the necessary changes\ that can modify the source to be identical to the target. The result is in form of a json object. :param source_root: the root node of the source state. :type source_root: dict :param target_root: the root node of the target state. :type target_root: dict :returns: the difference between the two containment hierarchies in\ a special JSON object :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the exectuion. :raises CoreInternalError: the status of the exectuion. """ return self._send({'name': 'generateTreeDiff', 'args': [source_root, target_root]}) def get_all_meta_nodes(self, node): """ Returns all META nodes. :param node: any node of the containment hierarchy. :type node: dict :returns: The function returns a dictionary. The keys of the dictionary\ are the absolute paths of the META nodes of the project. Every value of the dictionary\ is a {@link module:Core~Node}. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAllMetaNodes', 'args': [node]}) def get_aspect_definition_info(self, node, name, member): """ Returns the meta nodes that introduce the given aspect relationship. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :param member: the child. :type member: dict :returns: The owner and the target of the aspect meta-rule that makes member a\ valid member of the named aspect of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectDefinitionInfo', 'args': [node, name, member]}) def get_aspect_definition_owner(self, node, name): """ Returns the meta node that introduces the given aspect. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :returns: The meta-node that defines the aspect and makes a valid aspect for the given node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectDefinitionOwner', 'args': [node, name]}) def get_aspect_meta(self, node, name): """ Returns the list of valid children types of the given aspect. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :returns: The function returns a list of absolute paths of nodes that are valid children of the node\ and fits to the META rules defined for the aspect. Any children, visible under the given aspect of the node\ must be an instance of at least one node represented by the absolute paths. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectMeta', 'args': [node, name]}) def get_attribute(self, node, name): """ Retrieves the value of the given attribute of the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: The function returns the value of the attribute of the node.\ If the value is undefined that means the node do not have\ such attribute defined. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttribute', 'args': [node, name]}) def get_attribute_definition_owner(self, node, name): """ Returns the meta node that introduces the given attribute. :param node: the node in question. :type node: dict :param name: the name of the attribute in question. :type name: str :returns: The meta-node that defines the attribute and makes it valid attribute for the\ given node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeDefinitionOwner', 'args': [node, name]}) def get_attribute_meta(self, node, name): """ Returns the definition object of an attribute from the META rules of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: The function returns the definition object, where type is always defined. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeMeta', 'args': [node, name]}) def get_attribute_names(self, node): """ Returns the names of the defined attributes of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the attributes of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeNames', 'args': [node]}) def get_base(self, node): """ Returns the base node. :param node: the node in question. :type node: dict :returns: Returns the base of the given node or null if there is no such node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBase', 'args': [node]}) def get_base_root(self, node): """ Returns the root of the inheritance chain of the given node. :param node: the node in question. :type node: dict :returns: Returns the root of the inheritance chain (usually the FCO). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseRoot', 'args': [node]}) def get_base_type(self, node): """ Returns the meta-node of the node in question, that is the first base node that is part of the meta.\ (Aliased getMetaType). :param node: the node in question :type node: dict :returns: Returns the first node (including itself) among the inheritance chain\ that is a META node. It returns null if it does not find such node (ideally the only node with this result\ is the ROOT). :rtype: dict or None :raises CoreIllegalArgumentError: If node is not a Node :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseType', 'args': [node]}) def get_base_types(self, node): """ Searches for the closest META node of the node in question and the direct mixins of that node. :param node: the node in question :type node: dict :returns: Returns the closest Meta node that is a base of the given node\ plus it returns all the mixin nodes associated with the base. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseTypes', 'args': [node]}) def get_child_definition_info(self, node, child): """ Returns the meta nodes that introduce the given containment relationship. :param node: the node in question. :type node: dict :param child: the child. :type child: dict :returns: The owner and the target of the containment meta-rule that makes child a\ valid child of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildDefinitionInfo', 'args': [node, child]}) def get_children_hashes(self, node): """ Collects the data hash values of the children of the node. :param node: the node in question. :type node: dict :returns: The function returns a dictionary of\ {@link module:Core~ObjectHash} that stored in pair with the relative id of the corresponding\ child of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenHashes', 'args': [node]}) def get_children_meta(self, node): """ Return a JSON representation of the META rules regarding the valid children of the given node. :param node: the node in question. :type node: dict :returns: The function returns a detailed JSON structure that represents the META\ rules regarding the possible children of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenMeta', 'args': [node]}) def get_children_paths(self, node): """ Collects the paths of all the children of the given node. :param node: the container node in question. :type node: dict :returns: The function returns an array of the absolute paths of the children. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenPaths', 'args': [node]}) def get_children_relids(self, node): """ Collects the relative ids of all the children of the given node. :param node: the container node in question. :type node: dict :returns: The function returns an array of the relative ids. :rtype: list of str """ return self._send({'name': 'getChildrenRelids', 'args': [node]}) def get_closure_information(self, nodes): """ Collects the necessary information to export the set of input nodes and use it in other\ - compatible - projects. :param nodes: the set of nodes that we want to export :type nodes: list of dict :returns: If the closure is available for export, the returned special JSON object\ will contain information about the necessary data that needs to be exported as well as relations\ that will need to be recreated in the destination project to preserve the structure of nodes. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getClosureInformation', 'args': [nodes]}) def get_collection_names(self, node): """ Retrieves a list of the defined pointer names that has the node as target. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the pointers pointing to the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCollectionNames', 'args': [node]}) def get_collection_paths(self, node, name): """ Retrieves a list of absolute paths of nodes that has a given pointer which points to the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer. :type name: str :returns: The function returns an array of absolute paths of nodes that\ has the pointer pointing to the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCollectionPaths', 'args': [node, name]}) def get_common_base(self, nodes): """ Returns the common base node of all supplied nodes. :param nodes: a variable number of nodes to compare :type nodes: list of dict :returns: The common base or null if e.g. the root node was passed. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCommonBase', 'args': [nodes]}) def get_common_parent(self, nodes): """ Returns the common parent node of all supplied nodes. :param nodes: a variable number of nodes to compare :type nodes: list of dict :returns: The common base or null if no nodes were passed. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCommonParent', 'args': [nodes]}) def get_constraint(self, node, name): """ Gets a constraint object of the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :returns: Returns the defined constraint or null if it was not\ defined for the node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getConstraint', 'args': [node, name]}) def get_constraint_names(self, node): """ Retrieves the list of constraint names defined for the node. :param node: the node in question. :type node: dict :returns: Returns the array of names of constraints available for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getConstraintNames', 'args': [node]}) def get_fco(self, node): """ Return the root of the inheritance chain of your Meta nodes. :param node: any node in your project. :type node: dict :returns: Returns the acting FCO of your project. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getFCO', 'args': [node]}) def get_fully_qualified_name(self, node): """ Returns the fully qualified name of the node, which is the list of its namespaces separated\ by dot and followed by the name of the node. :param node: the node in question. :type node: dict :returns: Returns the fully qualified name of the node,\ i.e. its namespaces and name join together by dots. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getFullyQualifiedName', 'args': [node]}) def get_guid(self, node): """ Get the GUID of a node. :param node: the node in question. :type node: dict :returns: Returns the globally unique identifier. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getGuid', 'args': [node]}) def get_hash(self, node): """ Returns the calculated hash and database id of the data for the node. :param node: the node in question. :type node: dict :returns: Returns the hash value of the data for the given node.\ An empty string is returned when the node was mutated and not persisted. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getHash', 'args': [node]}) def get_instance_paths(self, node): """ Collects the paths of all the instances of the given node. :param node: the node in question. :type node: dict :returns: The function returns an array of the absolute paths of the instances. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getInstancePaths', 'args': [node]}) def get_json_meta(self, node): """ Gives a JSON representation of the META rules of the node. :param node: the node in question. :type node: dict :returns: Returns an object that represents all the META rules of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getJsonMeta', 'args': [node]}) def get_library_guid(self, node, name=None): """ Returns the origin GUID of any library node. (If name is not provided the returned GUID will be the same\ across all projects where the library node is contained - regardless of library hierarchy.) :param node: the node in question. :type node: dict :param name: name of the library where we want to compute the GUID from.\ If not given, then the GUID is computed from the direct library root of the node. :type name: None or str :returns: Returns the origin GUID of the node. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryGuid', 'args': [node, name]}) def get_library_info(self, node, name): """ Returns the info associated with the library. :param node: any node in the project. :type node: dict :param name: the name of the library. :type name: str :returns: Returns the information object, stored alongside the library (that basically\ carries metaData about the library). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryInfo', 'args': [node, name]}) def get_library_meta_nodes(self, node, name, only_own=None): """ Returns all the Meta nodes within the given library.\ By default it will include nodes defined in any library within the given library. :param node: any node of your project. :type node: dict :param name: name of your library. :type name: str :param only_own: if true only returns with Meta nodes defined in the library itself. :type only_own: bool :returns: Returns an array of core nodes that are part of your meta from\ the given library. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryMetaNodes', 'args': [node, name, only_own]}) def get_library_names(self, node): """ Gives back the list of libraries in your project. :param node: any node in your project. :type node: dict :returns: Returns the fully qualified names of all the libraries in your project\ (even embedded ones). :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryNames', 'args': [node]}) def get_library_root(self, node, name): """ Returns the root node of the given library. :param node: any node in the project. :type node: dict :param name: the name of the library. :type name: str :returns: Returns the library root node or null, if the library is unknown. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryRoot', 'args': [node, name]}) def get_member_attribute(self, node, set_name, path, attr_name): """ Get the value of the attribute in relation with the set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Return the value of the attribute. If it is undefined,\ then there is no such attributed connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberAttribute', 'args': [node, set_name, path, attr_name]}) def get_member_attribute_names(self, node, name, path): """ Return the names of the attributes defined for the set membership to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of attributes that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberAttributeNames', 'args': [node, name, path]}) def get_member_own_attribute(self, node, set_name, path, attr_name): """ Get the value of the attribute for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Return the value of the attribute. If it is undefined,\ then there is no such attributed connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnAttribute', 'args': [node, set_name, path, attr_name]}) def get_member_own_attribute_names(self, node, name, path): """ Return the names of the attributes defined for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of attributes that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnAttributeNames', 'args': [node, name, path]}) def get_member_own_registry(self, node, set_name, path, reg_name): """ Get the value of the registry entry for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined,\ then there is no such registry connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnRegistry', 'args': [node, set_name, path, reg_name]}) def get_member_own_registry_names(self, node, name, path): """ Return the names of the registry entries defined for the set membership specifically defined to\ the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of registry entries that represents some property of the\ membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnRegistryNames', 'args': [node, name, path]}) def get_member_paths(self, node, name): """ Returns the list of absolute paths of the members of the given set of the given node. :param node: the set owner. :type node: dict :param name: the name of the set. :type name: str :returns: Returns an array of absolute path strings of the member nodes of the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberPaths', 'args': [node, name]}) def get_member_registry(self, node, set_name, path, reg_name): """ Get the value of the registry entry in relation with the set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined,\ then there is no such registry connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberRegistry', 'args': [node, set_name, path, reg_name]}) def get_member_registry_names(self, node, name, path): """ Return the names of the registry entries defined for the set membership to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of registry entries that represents some property of the\ membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberRegistryNames', 'args': [node, name, path]}) def get_meta_type(self, node): """ Returns the meta-node of the node in question, that is the first base node that is part of the meta.\ (Aliased getBaseType). :param node: the node in question :type node: dict :returns: Returns the first node (including itself) among the inheritance chain\ that is a META node. It returns null if it does not find such node (ideally the only node with this result\ is the ROOT). :rtype: dict or None :raises CoreIllegalArgumentError: If node is not a Node :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMetaType', 'args': [node]}) def get_mixin_errors(self, node): """ Checks if the mixins allocated with the node can be used.\ Every mixin node should be on the Meta.\ Every rule (attribute/pointer/set/aspect/containment/constraint) should be defined only in one mixin. :param node: the node to test. :type node: dict :returns: Returns the array of violations. If the array is empty,\ there is no violation. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinErrors', 'args': [node]}) def get_mixin_nodes(self, node): """ Gathers the mixin nodes defined directly at the node. :param node: the node in question. :type node: dict :returns: The dictionary of the mixin nodes keyed by their paths. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinNodes', 'args': [node]}) def get_mixin_paths(self, node): """ Gathers the paths of the mixin nodes defined directly at the node. :param node: the node in question. :type node: dict :returns: The paths of the mixins in an array ordered by their order of use (which is important\ in case of some collision among definitions would arise). :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinPaths', 'args': [node]}) def get_namespace(self, node): """ Returns the resolved namespace for the node. If node is not in a library it returns the\ empty string. If the node is in a library of a library -\ the full name space is the library names joined together by dots. :param node: the node in question. :type node: dict :returns: Returns the name space of the node. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getNamespace', 'args': [node]}) def get_own_attribute(self, node, name): """ Returns the value of the attribute defined for the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Returns the value of the attribute defined specifically for\ the node. If undefined then it means that there is no such attribute defined directly for the node, meaning\ that it either inherits some value or there is no such attribute at all. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnAttribute', 'args': [node, name]}) def get_own_attribute_names(self, node): """ Returns the names of the attributes of the node that have been first defined for the node and not for its\ bases. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the own attributes of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnAttributeNames', 'args': [node]}) def get_own_children_paths(self, parent): """ Collects the paths of all the children of the given node that has some data as well and not just inherited. :param parent: the container node in question. :type parent: dict :returns: The function returns an array of the absolute paths of the children. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnChildrenPaths', 'args': [parent]}) def get_own_children_relids(self, node): """ Collects the relative ids of all the children of the given node that has some data and not just inherited.\ N.B. Do not mutate the returned array! :param node: the container node in question. :type node: dict :returns: The function returns an array of the relative ids. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnChildrenRelids', 'args': [node]}) def get_own_constraint_names(self, node): """ Retrieves the list of constraint names defined specifically for the node. :param node: the node in question. :type node: dict :returns: Returns the array of names of constraints for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnConstraintNames', 'args': [node]}) def get_own_json_meta(self, node): """ Returns the META rules specifically defined for the given node. :param node: the node in question. :type node: dict :returns: The function returns an object that represent the META rules that were defined\ specifically for the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnJsonMeta', 'args': [node]}) def get_own_member_paths(self, node, name): """ Returns the list of absolute paths of the members of the given set of the given node that not simply\ inherited. :param node: the set owner. :type node: dict :param name: the name of the set. :type name: str :returns: Returns an array of absolute path strings of the member nodes of the set that has\ information on the node's inheritance level. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnMemberPaths', 'args': [node, name]}) def get_own_pointer_names(self, node): """ Returns the list of the names of the pointers that were defined specifically for the node. :param node: the node in question. :type node: dict :returns: Returns an array of names of pointers defined specifically for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnPointerNames', 'args': [node]}) def get_own_pointer_path(self, node, name): """ Returns the absolute path of the target of the pointer specifically defined for the node. :param node: the node in question :type node: dict :param name: the name of the pointer :type name: str :returns: Returns the absolute path. If the path is null, then it means that\ 'no-target' was defined specifically for this node for the pointer. If undefined it means that the node\ either inherits the target of the pointer or there is no pointer defined at all. :rtype: str or None or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnPointerPath', 'args': [node, name]}) def get_own_registry(self, node, name): """ Returns the value of the registry entry defined for the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: Returns the value of the registry entry defined specifically\ for the node. If undefined then it means that there is no such registry entry defined directly for the node,\ meaning that it either inherits some value or there is no such registry entry at all. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnRegistry', 'args': [node, name]}) def get_own_registry_names(self, node): """ Returns the names of the registry enrties of the node that have been first defined for the node\ and not for its bases. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the own registry entries of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnRegistryNames', 'args': [node]}) def get_own_set_attribute(self, node, set_name, attr_name): """ Get the value of the attribute entry specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Return the value of the attribute. If it is undefined,\ then there is no such attribute at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetAttribute', 'args': [node, set_name, attr_name]}) def get_own_set_attribute_names(self, node, name): """ Return the names of the attribute entries specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of attribute entries defined in the set at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetAttributeNames', 'args': [node, name]}) def get_own_set_names(self, node): """ Returns the names of the sets created specifically at the node.\ N.B. When adding a member to a set of a node, the set is automatically created at the node. :param node: the node in question. :type node: dict :returns: Returns an array of set names that were specifically created at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetNames', 'args': [node]}) def get_own_set_registry(self, node, set_name, reg_name): """ Get the value of the registry entry specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined,\ then there is no such registry at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetRegistry', 'args': [node, set_name, reg_name]}) def get_own_set_registry_names(self, node, name): """ Return the names of the registry entries specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of registry entries defined in the set at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetRegistryNames', 'args': [node, name]}) def get_own_valid_aspect_names(self, node): """ Returns the list of the META defined aspect names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns the aspect names that are specifically defined for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAspectNames', 'args': [node]}) def get_own_valid_aspect_target_paths(self, node, name): """ Returns the paths of the meta nodes that are valid target members of the given aspect\ specifically defined for the node. :param node: the node in question. :type node: dict :param name: the name of the aspec in question. :type name: str :returns: The paths of the meta nodes whose instances could be members of the aspect. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAspectTargetPaths', 'args': [node, name]}) def get_own_valid_attribute_names(self, node): """ Returns the list of the META defined attribute names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns the attribute names that are defined specifically for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAttributeNames', 'args': [node]}) def get_own_valid_pointer_names(self, node): """ Returns the list of the META defined pointer names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns all the pointer names that are defined among the META\ rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidPointerNames', 'args': [node]}) def get_own_valid_set_names(self, node): """ Returns the list of the META defined set names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns all the set names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidSetNames', 'args': [node]}) def get_own_valid_target_paths(self, node, name): """ Returns the paths of Meta nodes that are possible targets of the given pointer/set introduced by the node. :param node: the node in question. :type node: dict :param name: the name of pointer/set. :type name: str :returns: The function returns the paths of valid nodes. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidTargetPaths', 'args': [node, name]}) def get_parent(self, node): """ Returns the parent of the node. :param node: the node in question :type node: dict :returns: Returns the parent of the node or NULL if it has no parent. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getParent', 'args': [node]}) def get_path(self, node): """ Returns the complete path of the node in the containment hierarchy. :param node: the node in question. :type node: dict :returns: Returns a path string where each portion is a relative id and they are separated by '/'.\ The path can be empty as well if the node in question is the root itself, otherwise it should be a chain\ of relative ids from the root of the containment hierarchy. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPath', 'args': [node]}) def get_pointer_definition_info(self, node, name, target): """ Returns the meta nodes that introduce the given pointer relationship. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :param target: the target node. :type target: dict :returns: The owner and the target of the pointer meta-rule that makes target a\ valid target of the named pointer of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerDefinitionInfo', 'args': [node, name, target]}) def get_pointer_meta(self, node, name): """ Return a JSON representation of the META rules regarding the given pointer/set of the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :returns: The function returns a detailed JSON structure that\ represents the META rules regarding the given pointer/set of the node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerMeta', 'args': [node, name]}) def get_pointer_names(self, node): """ Retrieves a list of the defined pointer names of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the pointers of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerNames', 'args': [node]}) def get_pointer_path(self, node, name): """ Retrieves the path of the target of the given pointer of the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: The function returns the absolute path of the target node\ if there is a valid target. It returns null if though the pointer is defined it does not have any\ valid target. Finally, it return undefined if there is no pointer defined for the node under the given name. :rtype: str or None or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerPath', 'args': [node, name]}) def get_registry(self, node, name): """ Retrieves the value of the given registry entry of the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: The function returns the value of the registry entry\ of the node. The value can be an object or any primitive type. If the value is undefined that means\ the node do not have such attribute defined. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRegistry', 'args': [node, name]}) def get_registry_names(self, node): """ Returns the names of the defined registry entries of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the registry entries of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRegistryNames', 'args': [node]}) def get_relid(self, node): """ Returns the parent-relative identifier of the node. :param node: the node in question. :type node: dict :returns: Returns the last segment of the node path. :rtype: str or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRelid', 'args': [node]}) def get_root(self, node): """ Returns the root node of the containment tree that node is part of. :param node: the node in question. :type node: dict :returns: Returns the root of the containment hierarchy (it can be the node itself). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRoot', 'args': [node]}) def get_set_attribute(self, node, set_name, attr_name): """ Get the value of the attribute entry in the set. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Return the value of the attribute. If it is undefined,\ then there is no such attribute at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetAttribute', 'args': [node, set_name, attr_name]}) def get_set_attribute_names(self, node, name): """ Return the names of the attribute entries for the set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of attribute entries in the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetAttributeNames', 'args': [node, name]}) def get_set_definition_info(self, node, name, member): """ Returns the meta nodes that introduce the given set relationship. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :param member: the member. :type member: dict :returns: The owner and the target of the set meta-rule that makes member a\ valid member of the named set of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetDefinitionInfo', 'args': [node, name, member]}) def get_set_names(self, node): """ Returns the names of the sets of the node. :param node: the node in question. :type node: dict :returns: Returns an array of set names that the node has. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetNames', 'args': [node]}) def get_set_registry(self, node, set_name, reg_name): """ Get the value of the registry entry in the set. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined,\ then there is no such registry at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetRegistry', 'args': [node, set_name, reg_name]}) def get_set_registry_names(self, node, name): """ Return the names of the registry entries for the set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of registry entries in the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetRegistryNames', 'args': [node, name]}) def get_type_root(self, node): """ Returns the root of the inheritance chain (cannot be the node itself). :param node: the node in question. :type node: dict :returns: Returns the root of the inheritance chain of the node. If returns null,\ that means the node in question is the root of the chain. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getTypeRoot', 'args': [node]}) def get_valid_aspect_names(self, node): """ Returns the list of the META defined aspect names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the aspect names that are defined among the META rules of the\ node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAspectNames', 'args': [node]}) def get_valid_aspect_target_paths(self, node, name): """ Returns the paths of the meta nodes that are valid target members of the given aspect. :param node: the node in question. :type node: dict :param name: the name of the aspec in question. :type name: str :returns: The paths of the meta nodes whose instances could be members of the aspect. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAspectTargetPaths', 'args': [node, name]}) def get_valid_attribute_names(self, node): """ Returns the list of the META defined attribute names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the attribute names that are defined among the META rules of the\ node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAttributeNames', 'args': [node]}) def get_valid_children_meta_nodes(self, parameters): """ Retrieves the valid META nodes that can be base of a child of the node. :param parameters: the input parameters of the query. :type parameters: dict :returns: The function returns a list of valid nodes that can be instantiated as a\ child of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidChildrenMetaNodes', 'args': [parameters]}) def get_valid_children_paths(self, node): """ Returns the list of absolute path of the valid children types of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of absolute paths of the nodes that was defined as valid\ children for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidChildrenPaths', 'args': [node]}) def get_valid_pointer_names(self, node): """ Returns the list of the META defined pointer names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the pointer names that are defined among the META rules\ of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidPointerNames', 'args': [node]}) def get_valid_set_elements_meta_nodes(self, parameters): """ Retrieves the valid META nodes that can be base of a member of the set of the node. :param parameters: the input parameters of the query. :type parameters: dict :returns: The function returns a list of valid nodes that can be instantiated as a\ member of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidSetElementsMetaNodes', 'args': [parameters]}) def get_valid_set_names(self, node): """ Returns the list of the META defined set names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the set names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidSetNames', 'args': [node]}) def get_valid_target_paths(self, node, name): """ Returns the paths of Meta nodes that are possible targets of the given pointer/set. :param node: the node in question. :type node: dict :param name: the name of pointer/set. :type name: str :returns: The function returns the paths of valid nodes. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidTargetPaths', 'args': [node, name]}) def import_closure(self, node, closure_information): """ Imports the set of nodes in the closureInformation - that has the format created by\ [getClosureInformation]{@link Core#getClosureInformation} - as direct children of the parent node.\ All data necessary for importing the closure has to be imported beforehand! :param node: the parent node where the closure will be imported. :type node: dict :param closure_information: the information about the closure. :type closure_information: dict :returns: If the closure cannot be imported the resulting error highlights the causes,\ otherwise a specific object will be returned that holds information about the closure. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'importClosure', 'args': [node, closure_information]}) def is_abstract(self, node): """ Checks if the node is abstract. :param node: the node in question. :type node: dict :returns: The function returns true if the registry entry 'isAbstract' of the node if true hence\ the node is abstract. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isAbstract', 'args': [node]}) def is_connection(self, node): """ Check is the node is a connection-like node. :param node: the node in question. :type node: dict :returns: Returns true if both the 'src' and 'dst' pointer are defined as valid for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isConnection', 'args': [node]}) def is_empty(self, node): """ Checks if the node in question has some actual data. :param node: the node in question. :type node: dict :returns: Returns true if the node is 'empty' meaning that it is not reserved by real data.\ Returns false if the node is exists and have some meaningful value. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isEmpty', 'args': [node]}) def is_fully_overridden_member(self, node, name, path): """ Checks if the member is completely overridden in the set of the node. :param node: the node to test. :type node: dict :param name: the name of the set of the node. :type name: str :param path: the path of the member in question. :type path: str :returns: Returns true if the member exists in the base of the set, but was\ added to the given set as well, which means a complete override. If the set does not exist\ or the member do not have a 'base' member or just some property was overridden, the function returns\ false. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isFullyOverriddenMember', 'args': [node, name, path]}) def is_instance_of(self, node, base_node_or_path): """ Checks if the node is an instance of base. :param node: the node in question. :type node: dict :param base_node_or_path: a potential base node (or its path) of the node :type base_node_or_path: dict or str :returns: Returns true if the base is on the inheritance chain of node.\ A node is considered to be an instance of itself here. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isInstanceOf', 'args': [node, base_node_or_path]}) def is_library_element(self, node): """ Returns true if the node in question is a library element.. :param node: the node in question. :type node: dict :returns: Returns true if your node is a library element, false otherwise. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isLibraryElement', 'args': [node]}) def is_library_root(self, node): """ Returns true if the node in question is a library root.. :param node: the node in question. :type node: dict :returns: Returns true if your node is a library root (even if it is embedded in other library),\ false otherwise. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isLibraryRoot', 'args': [node]}) def is_member_of(self, node): """ Returns all membership information of the given node. :param node: the node in question :type node: dict :returns: Returns a dictionary where every the key of every entry is an absolute path of a set owner\ node. The value of each entry is an array with the set names in which the node can be found as a member. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isMemberOf', 'args': [node]}) def is_meta_node(self, node): """ Checks if the node is a META node. :param node: the node to test. :type node: dict :returns: Returns true if the node is a member of the METAAspectSet of the ROOT node hence can be\ seen as a META node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isMetaNode', 'args': [node]}) def is_type_of(self, node, type_node_or_path): """ Checks if the given node in any way inherits from the typeNode. In addition to checking if the node\ "isInstanceOf" of typeNode, this methods also takes mixins into account. :param node: the node in question. :type node: dict :param type_node_or_path: the type node we want to check or its path. :type type_node_or_path: dict or str :returns: The function returns true if the typeNodeOrPath represents a base node,\ or a mixin of any of the base nodes, of the node.\ Every node is considered to be a type of itself. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isTypeOf', 'args': [node, type_node_or_path]}) def is_valid_aspect_member_of(self, node, parent, name): """ Returns if a node could be contained in the given container's aspect. :param node: the node in question. :type node: dict :param parent: the container node in question. :type parent: dict :param name: the name of aspect. :type name: str :returns: The function returns true if the given container could contain the node in the asked aspect. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidAspectMemberOf', 'args': [node, parent, name]}) def is_valid_attribute_value_of(self, node, name, value): """ Checks if the given value is of the necessary type, according to the META rules. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param value: the value to test. :type value: str or int or float or bool or dict :returns: Returns true if the value matches the META definitions. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidAttributeValueOf', 'args': [node, name, value]}) def is_valid_child_of(self, node, parent): """ Checks if according to the META rules the given node can be a child of the parent. :param node: the node in question :type node: dict :param parent: the parent we like to test. :type parent: dict :returns: The function returns true if according to the META rules the node can be a child of the\ parent. The check does not cover multiplicity (so if the parent can only have twi children and it already\ has them, this function will still returns true). :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidChildOf', 'args': [node, parent]}) def is_valid_new_base(self, node, base): """ Checks if base can be the new base of node. :param node: the node in question. :type node: dict :param base: the new base. :type base: dict or None or None :returns: True if the supplied base is a valid base for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewBase', 'args': [node, base]}) def is_valid_new_child(self, parent_node, base_node): """ Checks if an instance of the given base can be created under the parent. It does not check for\ meta consistency. It only validates if the proposed creation would cause any loops in the\ combined containment inheritance trees. :param parent_node: the parent in question. :type parent_node: dict or None :param base_node: the intended type of the node. :type base_node: dict or None :returns: True if a child of the type can be created. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewChild', 'args': [parent_node, base_node]}) def is_valid_new_parent(self, node, parent): """ Checks if parent can be the new parent of node. :param node: the node in question. :type node: dict :param parent: the new parent. :type parent: dict :returns: True if the supplied parent is a valid parent for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewParent', 'args': [node, parent]}) def is_valid_target_of(self, node, source, name): """ Checks if the node can be a target of a pointer of the source node in accordance with the META rules. :param node: the node in question. :type node: dict :param source: the source to test. :type source: dict :param name: the name of the pointer. :type name: str :returns: The function returns true if according to the META rules, the given node is a valid\ target of the given pointer of the source. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidTargetOf', 'args': [node, source, name]}) def load_by_path(self, node, relative_path): """ From the given starting node, it loads the path given as a series of relative ids (separated by '/')\ and returns the node it finds at the ends of the path. If there is no node, the function will return null. :param node: the starting node of our search. :type node: dict :param relative_path: the relative path - built by relative ids - of the node in question. :type relative_path: str :returns: the resulting node :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadByPath', 'args': [node, relative_path]}) def load_child(self, parent, relative_id): """ Loads the child of the given parent pointed by the relative id. Behind the scenes, it means\ that it actually loads the data pointed by a hash stored inside the parent under the given id\ and wraps it in a node object which will be connected to the parent as a child in the containment\ hierarchy. If there is no such relative id reserved, the call will return with null. :param parent: the container node in question. :type parent: dict :param relative_id: the relative id of the child in question. :type relative_id: str :returns: the resulting child :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadChild', 'args': [parent, relative_id]}) def load_children(self, node): """ Loads all the children of the given parent. As it first checks the already reserved relative ids of\ the parent, it only loads the already existing children (so no on-demand empty node creation). :param node: the container node in question. :type node: dict :returns: the resulting children :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadChildren', 'args': [node]}) def load_collection(self, node, pointer_name): """ Loads all the source nodes that has such a pointer and its target is the given node. :param node: the target node in question. :type node: dict :param pointer_name: the name of the pointer of the sources. :type pointer_name: str :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadCollection', 'args': [node, pointer_name]}) def load_instances(self, node): """ Loads all the instances of the given node. :param node: the node in question. :type node: dict :returns: the found instances of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadInstances', 'args': [node]}) def load_members(self, node, set_name): """ Loads all the members of the given set of the node. :param node: the node in question. :type node: dict :param set_name: the name of the set in question. :type set_name: str :returns: the found members of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadMembers', 'args': [node, set_name]}) def load_own_children(self, node): """ Loads all the children of the given parent that has some data and not just inherited. As it first checks\ the already reserved relative ids of the parent, it only loads the already existing children\ (so no on-demand empty node creation). :param node: the container node in question. :type node: dict :returns: the resulting children :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadOwnChildren', 'args': [node]}) def load_own_members(self, node, set_name): """ Loads all the own members of the given set of the node. :param node: the node in question. :type node: dict :param set_name: the name of the set in question. :type set_name: str :returns: the found own members of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadOwnMembers', 'args': [node, set_name]}) def load_own_sub_tree(self, node): """ Loads a complete sub-tree of the containment hierarchy starting from the given node, but load only those\ children that has some additional data and not purely inherited. :param node: the container node in question. :type node: dict :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadOwnSubTree', 'args': [node]}) def load_pointer(self, node, pointer_name): """ Loads the target of the given pointer of the given node. In the callback the node can have three values:\ if the node is valid, then it is the defined target of a valid pointer,\ if the returned value is null, then it means that the pointer is defined, but has no real target,\ finally if the returned value is undefined than there is no such pointer defined for the given node. :param node: the source node in question. :type node: dict :param pointer_name: the name of the pointer. :type pointer_name: str :returns: the resulting target :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadPointer', 'args': [node, pointer_name]}) def load_root(self, hash): """ Loads the data object with the given hash and makes it a root of a containment hierarchy. :param hash: the hash of the data object we like to load as root. :type hash: str :returns: the resulting root node :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadRoot', 'args': [hash]}) def load_sub_tree(self, node): """ Loads a complete sub-tree of the containment hierarchy starting from the given node. :param node: the node that is the root of the sub-tree in question. :type node: dict :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadSubTree', 'args': [node]}) def move_aspect_meta_target(self, node, target, old_name, new_name): """ Moves the given target definition over to a new aspect. As actual values in case of\ relation definitions vary quite a bit from the meta-targets, this function does not deals with\ the actual pointer/set target/members. :param node: the node in question. :type node: dict :param target: the target that should be moved among definitions. :type target: dict :param old_name: the current name of the aspect that has the target. :type old_name: str :param new_name: the new aspect name where the target should be moved over. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveAspectMetaTarget', 'args': [node, target, old_name, new_name]}) def move_member(self, node, member_path, old_set_name, new_set_name): """ Moves an own member of the set over to another set of the node. :param node: the node in question. :type node: dict :param member_path: the path of the memberNode that should be moved. :type member_path: str :param old_set_name: the name of the set where the member is currently reside. :type old_set_name: str :param new_set_name: the name of the target set where the member should be moved to. :type new_set_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveMember', 'args': [node, member_path, old_set_name, new_set_name]}) def move_node(self, node, parent): """ Moves the given node under the given parent. :param node: the node to be moved. :type node: dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns the node after the move. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveNode', 'args': [node, parent]}) def move_pointer_meta_target(self, node, target, old_name, new_name): """ Moves the given target definition over to a new pointer or set.\ Note this does not alter the actual pointer target or set members. :param node: the node in question. :type node: dict :param target: the target that should be moved among definitions. :type target: dict :param old_name: the current name of the pointer/set definition in question. :type old_name: str :param new_name: the new name of the relation towards the target. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'movePointerMetaTarget', 'args': [node, target, old_name, new_name]}) def persist(self, node): """ Persists the changes made in memory and computed the data blobs that needs to be saved into the database\ to make the change and allow other users to see the new state of the project. :param node: some node element of the modified containment hierarchy (usually the root). :type node: dict :returns: The function returns an object which collects all the changes\ on data level and necessary to update the database on server side. Keys of the returned object are 'rootHash'\ and 'objects'. The values of these should be passed to project.makeCommit. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'persist', 'args': [node]}) def remove_library(self, node, name): """ Removes a library from your project. It will also remove any remaining instances of the specific library. :param node: any node in your project. :type node: dict :param name: the name of your library. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'removeLibrary', 'args': [node, name]}) def rename_attribute(self, node, old_name, new_name): """ Renames the given attribute of the node if its value is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the attribute in question. :type old_name: str :param new_name: the new name of the attribute. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameAttribute', 'args': [node, old_name, new_name]}) def rename_attribute_meta(self, node, old_name, new_name): """ Renames the given attribute definition of the node. It also renames the default value of the definition!\ As a result of this operation, all instances of node will have the new attribute, but if they have\ overriden the old attribute it will remain under that name (and become meta invalid). :param node: the node in question. :type node: dict :param old_name: the current name of the attribute definition in question. :type old_name: str :param new_name: the new name of the attribute. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameAttributeMeta', 'args': [node, old_name, new_name]}) def rename_library(self, node, old_name, new_name): """ Rename a library in your project. :param node: any node in your project. :type node: dict :param old_name: the current name of the library. :type old_name: str :param new_name: the new name of the project. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameLibrary', 'args': [node, old_name, new_name]}) def rename_pointer(self, node, old_name, new_name): """ Renames the given pointer of the node if its target is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the pointer in question. :type old_name: str :param new_name: the new name of the pointer. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renamePointer', 'args': [node, old_name, new_name]}) def rename_registry(self, node, old_name, new_name): """ Renames the given registry of the node if its value is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the registry in question. :type old_name: str :param new_name: the new name of the registry. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameRegistry', 'args': [node, old_name, new_name]}) def rename_set(self, node, old_name, new_name): """ Renames the given set of the node if its is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the set in question. :type old_name: str :param new_name: the new name of the set. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameSet', 'args': [node, old_name, new_name]}) def set_aspect_meta_target(self, node, name, target): """ Sets a valid type for the given aspect of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :param target: the valid type for the aspect. :type target: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAspectMetaTarget', 'args': [node, name, target]}) def set_attribute(self, node, name, value): """ Sets the value of the given attribute of the given node. It defines the attribute on demand, means that it\ will set the given attribute even if was ot defined for the node beforehand. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param value: the new of the attribute, undefined is not allowed. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAttribute', 'args': [node, name, value]}) def set_attribute_meta(self, node, name, rule): """ Sets the META rules of the attribute of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param rule: the rules that defines the attribute :type rule: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAttributeMeta', 'args': [node, name, rule]}) def set_base(self, node, base): """ Sets the base node of the given node. The function doesn't touches the properties or the children of the node\ so it can cause META rule violations that needs to be corrected manually. :param node: the node in question. :type node: dict :param base: the new base. :type base: dict or None :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setBase', 'args': [node, base]}) def set_child_meta(self, node, child, min=None, max=None): """ Sets the given child as a valid children type for the node. :param node: the node in question. :type node: dict :param child: the valid child node. :type child: dict :param min: the allowed minimum number of children from this given node type (if not given or\ -1 is set, then there will be no minimum rule according this child type) :type min: int :param max: the allowed maximum number of children from this given node type (if not given or\ -1 is set, then there will be no minimum rule according this child type) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setChildMeta', 'args': [node, child, min, max]}) def set_children_meta_limits(self, node, min=None, max=None): """ Sets the global containment limits for the node. :param node: the node in question. :type node: dict :param min: the allowed minimum number of children (if not given or\ -1 is set, then there will be no minimum rule according children) :type min: int :param max: the allowed maximum number of children (if not given or\ -1 is set, then there will be no maximum rule according children) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setChildrenMetaLimits', 'args': [node, min, max]}) def set_constraint(self, node, name, constraint): """ Sets a constraint object of the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :param constraint: the constraint to be set. :type constraint: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setConstraint', 'args': [node, name, constraint]}) def set_guid(self, node, guid): """ Set the GUID of a node. As the Core itself do not checks whether the GUID already exists. The use of\ this function is only advised during the creation of the node. :param node: the node in question. :type node: dict :param guid: the new globally unique identifier. :type guid: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreIllegalOperationError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'setGuid', 'args': [node, guid]}) def set_member_attribute(self, node, set_name, path, attr_name, value): """ Sets the attribute value which represents a property of the membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :param value: the new value of the attribute. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setMemberAttribute', 'args': [node, set_name, path, attr_name, value]}) def set_member_registry(self, node, set_name, path, reg_name, value): """ Sets the registry entry value which represents a property of the membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :param value: the new value of the registry. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setMemberRegistry', 'args': [node, set_name, path, reg_name, value]}) def set_pointer(self, node, name, target): """ Sets the target of the pointer of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :param target: the new target of the pointer. :type target: dict or None :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointer', 'args': [node, name, target]}) def set_pointer_meta_limits(self, node, name, min=None, max=None): """ Sets the global target limits for pointer/set of the node. On META level the only distinction between\ pointer and sets is the global multiplicity which has to maximize the number of possible targets to 1 in\ case of 'pure' pointer definitions. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :param min: the allowed minimum number of children (if not given or\ -1 is set, then there will be no minimum rule according targets) :type min: int :param max: the allowed maximum number of children (if not given or\ -1 is set, then there will be no maximum rule according targets) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointerMetaLimits', 'args': [node, name, min, max]}) def set_pointer_meta_target(self, node, name, target, min=None, max=None): """ Sets the given target as a valid target type for the pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :param target: the valid target/member node. :type target: dict :param min: the allowed minimum number of target/member from this given node type (if not\ given or -1 is set, then there will be no minimum rule according this target type) :type min: int :param max: the allowed maximum number of target/member from this given node type (if not\ given or -1 is set, then there will be no minimum rule according this target type) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointerMetaTarget', 'args': [node, name, target, min, max]}) def set_registry(self, node, name, value): """ Sets the value of the given registry entry of the given node. It defines the registry entry on demand,\ means that it will set the given registry entry even if was ot defined for the node beforehand. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :param value: the new of the registry entry. Can be any primitive\ type or object. Undefined is not allowed. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setRegistry', 'args': [node, name, value]}) def set_set_attribute(self, node, set_name, attr_name, value): """ Sets the attribute entry value for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :param value: the new value of the attribute. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setSetAttribute', 'args': [node, set_name, attr_name, value]}) def set_set_registry(self, node, set_name, reg_name, value): """ Sets the registry entry value for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :param value: the new value of the registry. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setSetRegistry', 'args': [node, set_name, reg_name, value]}) def try_to_concat_changes(self, mine, theirs): """ Tries to merge two patch object. The patches ideally represents changes made by two parties. They represents\ changes from the same source ending in different states. Our aim is to generate a single patch that could\ cover the changes of both party. :param mine: the tree structured JSON patch that represents my changes. :type mine: dict :param theirs: the tree structured JSON patch that represents the changes of the other party. :type theirs: dict :returns: The function returns with an object that contains the conflicts (if any) and the merged\ patch. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'tryToConcatChanges', 'args': [mine, theirs]}) def update_library(self, node, name, library_root_hash, library_info=None): """ It updates a library in your project based on the input information. It will 'reaplace' the old\ version, keeping as much information as possible regarding the instances. :param node: any regular node in your project. :type node: dict :param name: the name of the library you want to update. :type name: str :param library_root_hash: the hash of your library's new root\ (must exist in the project's collection at the time of call). :type library_root_hash: str :param library_info: information about your project. :type library_info: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreIllegalOperationError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'updateLibrary', 'args': [node, name, library_root_hash, library_info]})
""" For more details regarding inputs and output in form of complex dictionaries see the original source docs at: %host%/docs/source/Core.html for example: `https://editor.webgme.org/docs/source/Core.html <https://editor.webgme.org/docs/source/Core.html>`_ """ class Core(object): """ Class for querying and manipulating the tree graph in a gme project. Practically, each method takes at least one node-dict as input. Use core.load_root(root_hash) to get an initial root-node of a the tree. """ def __init__(self, webgme): self._webgme = webgme self._CONSTANTS = None def _send(self, payload): payload['type'] = 'core' self._webgme.send_request(payload) return self._webgme.handle_response() @property def constants(self): """ A dictionary with the `constants associated with the Core <https://github.com/webgme/webgme-engine/blob/master/src/common/core/constants.js>`_. """ if self._CONSTANTS is None: self._CONSTANTS = self._send({'name': 'CONSTANTS', 'args': []}) return self._CONSTANTS def add_library(self, node, name, library_root_hash, library_info=None): """ It adds a project as library to your project by copying it over. The library will be a node with the given name directly under your project's ROOT. It becomes a read-only portion of your project. You will only be able to manipulate it with library functions, but cannot edit the individual nodes inside. However you will be able to instantiate or copy the nodes into other places of your project. Every node that was part of the META in the originating project becomes part of your project's meta. :param node: any regular node in your project. :type node: dict :param name: the name of the library you wish to use as a namespace in your project. :type name: str :param library_root_hash: the hash of your library's root (must exist in the project's collection at the time of call). :type library_root_hash: str :param library_info: information about your project. :type library_info: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreIllegalOperationError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'addLibrary', 'args': [node, name, library_root_hash, library_info]}) def add_member(self, node, name, member): """ Adds a member to the given set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param member: the new member of the set. :type member: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'addMember', 'args': [node, name, member]}) def add_mixin(self, node, path): """ Adds a mixin to the mixin set of the node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'addMixin', 'args': [node, path]}) def apply_resolution(self, conflict): """ When our attempt to merge two patches ended in some conflict, then we can modify that result highlighting that in case of every conflict, which side we prefer (mine vs. theirs). If we give that object as an input to this function, it will finish the merge resolving the conflict according our settings and present a final patch. :param conflict: the object that represents our settings for every conflict and the so-far-merged patch. :type conflict: dict :returns: The function results in a tree structured patch object that contains the changesthat cover both parties modifications (and the conflicts are resolved according the input settings). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'applyResolution', 'args': [conflict]}) def apply_tree_diff(self, node, patch): """ Apply changes to the current project. :param node: the root of the containment hierarchy where we wish to apply the changes :type node: dict :param patch: the tree structured collection of changes represented with a special JSON object :type patch: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'applyTreeDiff', 'args': [node, patch]}) def can_set_as_mixin(self, node, path): """ Checks if the given path can be added as a mixin to the given node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Returns an object with isOk set to true if the given path can be added as a mixin to the given node. If it cannot, the reason will be reported under reason. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'canSetAsMixin', 'args': [node, path]}) def clear_meta_rules(self, node): """ Removes all META rules defined at the node. Note that it does not clear any rules from other meta-nodes where the node if referenced. :param node: the node in question. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'clearMetaRules', 'args': [node]}) def clear_mixins(self, node): """ Removes all mixins for a given node. :param node: the node in question. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'clearMixins', 'args': [node]}) def copy_node(self, node, parent): """ Copies the given node into parent. :param node: the node to be copied. :type node: dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns the copied node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'copyNode', 'args': [node, parent]}) def copy_nodes(self, nodes, parent): """ Copies the given nodes into parent. :param nodes: the nodes to be copied. :type nodes: list of dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns an array of the copied nodes. The order follows the order of originals. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'copyNodes', 'args': [nodes, parent]}) def create_child(self, node, base): """ Creates a child, with base as provided, inside the provided node. :param node: the parent of the node to be created. :type node: dict :param base: the base of the node to be created. :type base: dict :returns: The function returns the created child node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createChild', 'args': [node, base]}) def create_node(self, parameters=None): """ Creates a node according to the given parameters. :param parameters: the details of the creation. :type parameters: dict :returns: The function returns the created node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createNode', 'args': [parameters]}) def create_set(self, node, name): """ Creates a set for the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'createSet', 'args': [node, name]}) def del_aspect_meta(self, node, name): """ Removes the given aspect rule of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAspectMeta', 'args': [node, name]}) def del_aspect_meta_target(self, node, name, path): """ Removes a valid type from the given aspect of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :param path: the absolute path of the valid type of the aspect. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAspectMetaTarget', 'args': [node, name, path]}) def del_attribute(self, node, name): """ Removes the given attributes from the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAttribute', 'args': [node, name]}) def del_attribute_meta(self, node, name): """ Removes an attribute definition from the META rules of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delAttributeMeta', 'args': [node, name]}) def del_child_meta(self, node, path): """ Removes the given child rule from the node. :param node: the node in question. :type node: dict :param path: the absolute path of the child which rule is to be removed from the node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delChildMeta', 'args': [node, path]}) def del_constraint(self, node, name): """ Removes a constraint from the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delConstraint', 'args': [node, name]}) def del_member(self, node, name, path): """ Removes a member from the set. The functions doesn't remove the node itself. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member to be removed. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMember', 'args': [node, name, path]}) def del_member_attribute(self, node, set_name, member_path, attr_name): """ Removes an attribute which represented a property of the given set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param member_path: the absolute path of the member node. :type member_path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMemberAttribute', 'args': [node, set_name, member_path, attr_name]}) def del_member_registry(self, node, set_name, path, reg_name): """ Removes a registry entry which represented a property of the given set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMemberRegistry', 'args': [node, set_name, path, reg_name]}) def del_mixin(self, node, path): """ Removes a mixin from the mixin set of the node. :param node: the node in question. :type node: dict :param path: the path of the mixin node. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delMixin', 'args': [node, path]}) def del_pointer(self, node, name): """ Removes the pointer from the node. (Aliased deletePointer.) :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointer', 'args': [node, name]}) def del_pointer_meta(self, node, name): """ Removes the complete META rule regarding the given pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointerMeta', 'args': [node, name]}) def del_pointer_meta_target(self, node, name, path): """ Removes a possible target type from the pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set :type name: str :param path: the absolute path of the possible target type. :type path: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If node is read-only, or definition does not exist. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delPointerMetaTarget', 'args': [node, name, path]}) def del_registry(self, node, name): """ Removes the given registry entry from the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delRegistry', 'args': [node, name]}) def del_set(self, node, name): """ Removes a set from the node. (Aliased deleteSet.) :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSet', 'args': [node, name]}) def del_set_attribute(self, node, set_name, attr_name): """ Removes the attribute entry for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSetAttribute', 'args': [node, set_name, attr_name]}) def del_set_registry(self, node, set_name, reg_name): """ Removes the registry entry for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'delSetRegistry', 'args': [node, set_name, reg_name]}) def delete_node(self, node): """ Removes a node from the containment hierarchy. :param node: the node to be removed. :type node: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deleteNode', 'args': [node]}) def delete_pointer(self, node, name): """ Removes the pointer from the node. (Aliased delPointer.) :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deletePointer', 'args': [node, name]}) def delete_set(self, node, name): """ Removes a set from the node. (Aliased delSet.) :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'deleteSet', 'args': [node, name]}) def generate_tree_diff(self, source_root, target_root): """ Generates a differential tree among the two states of the project that contains the necessary changes that can modify the source to be identical to the target. The result is in form of a json object. :param source_root: the root node of the source state. :type source_root: dict :param target_root: the root node of the target state. :type target_root: dict :returns: the difference between the two containment hierarchies in a special JSON object :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the exectuion. :raises CoreInternalError: the status of the exectuion. """ return self._send({'name': 'generateTreeDiff', 'args': [source_root, target_root]}) def get_all_meta_nodes(self, node): """ Returns all META nodes. :param node: any node of the containment hierarchy. :type node: dict :returns: The function returns a dictionary. The keys of the dictionary are the absolute paths of the META nodes of the project. Every value of the dictionary is a {@link module:Core~Node}. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAllMetaNodes', 'args': [node]}) def get_aspect_definition_info(self, node, name, member): """ Returns the meta nodes that introduce the given aspect relationship. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :param member: the child. :type member: dict :returns: The owner and the target of the aspect meta-rule that makes member a valid member of the named aspect of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectDefinitionInfo', 'args': [node, name, member]}) def get_aspect_definition_owner(self, node, name): """ Returns the meta node that introduces the given aspect. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :returns: The meta-node that defines the aspect and makes a valid aspect for the given node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectDefinitionOwner', 'args': [node, name]}) def get_aspect_meta(self, node, name): """ Returns the list of valid children types of the given aspect. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :returns: The function returns a list of absolute paths of nodes that are valid children of the node and fits to the META rules defined for the aspect. Any children, visible under the given aspect of the node must be an instance of at least one node represented by the absolute paths. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAspectMeta', 'args': [node, name]}) def get_attribute(self, node, name): """ Retrieves the value of the given attribute of the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: The function returns the value of the attribute of the node. If the value is undefined that means the node do not have such attribute defined. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttribute', 'args': [node, name]}) def get_attribute_definition_owner(self, node, name): """ Returns the meta node that introduces the given attribute. :param node: the node in question. :type node: dict :param name: the name of the attribute in question. :type name: str :returns: The meta-node that defines the attribute and makes it valid attribute for the given node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeDefinitionOwner', 'args': [node, name]}) def get_attribute_meta(self, node, name): """ Returns the definition object of an attribute from the META rules of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: The function returns the definition object, where type is always defined. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeMeta', 'args': [node, name]}) def get_attribute_names(self, node): """ Returns the names of the defined attributes of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the attributes of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getAttributeNames', 'args': [node]}) def get_base(self, node): """ Returns the base node. :param node: the node in question. :type node: dict :returns: Returns the base of the given node or null if there is no such node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBase', 'args': [node]}) def get_base_root(self, node): """ Returns the root of the inheritance chain of the given node. :param node: the node in question. :type node: dict :returns: Returns the root of the inheritance chain (usually the FCO). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseRoot', 'args': [node]}) def get_base_type(self, node): """ Returns the meta-node of the node in question, that is the first base node that is part of the meta. (Aliased getMetaType). :param node: the node in question :type node: dict :returns: Returns the first node (including itself) among the inheritance chain that is a META node. It returns null if it does not find such node (ideally the only node with this result is the ROOT). :rtype: dict or None :raises CoreIllegalArgumentError: If node is not a Node :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseType', 'args': [node]}) def get_base_types(self, node): """ Searches for the closest META node of the node in question and the direct mixins of that node. :param node: the node in question :type node: dict :returns: Returns the closest Meta node that is a base of the given node plus it returns all the mixin nodes associated with the base. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getBaseTypes', 'args': [node]}) def get_child_definition_info(self, node, child): """ Returns the meta nodes that introduce the given containment relationship. :param node: the node in question. :type node: dict :param child: the child. :type child: dict :returns: The owner and the target of the containment meta-rule that makes child a valid child of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildDefinitionInfo', 'args': [node, child]}) def get_children_hashes(self, node): """ Collects the data hash values of the children of the node. :param node: the node in question. :type node: dict :returns: The function returns a dictionary of {@link module:Core~ObjectHash} that stored in pair with the relative id of the corresponding child of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenHashes', 'args': [node]}) def get_children_meta(self, node): """ Return a JSON representation of the META rules regarding the valid children of the given node. :param node: the node in question. :type node: dict :returns: The function returns a detailed JSON structure that represents the META rules regarding the possible children of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenMeta', 'args': [node]}) def get_children_paths(self, node): """ Collects the paths of all the children of the given node. :param node: the container node in question. :type node: dict :returns: The function returns an array of the absolute paths of the children. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getChildrenPaths', 'args': [node]}) def get_children_relids(self, node): """ Collects the relative ids of all the children of the given node. :param node: the container node in question. :type node: dict :returns: The function returns an array of the relative ids. :rtype: list of str """ return self._send({'name': 'getChildrenRelids', 'args': [node]}) def get_closure_information(self, nodes): """ Collects the necessary information to export the set of input nodes and use it in other - compatible - projects. :param nodes: the set of nodes that we want to export :type nodes: list of dict :returns: If the closure is available for export, the returned special JSON object will contain information about the necessary data that needs to be exported as well as relations that will need to be recreated in the destination project to preserve the structure of nodes. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getClosureInformation', 'args': [nodes]}) def get_collection_names(self, node): """ Retrieves a list of the defined pointer names that has the node as target. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the pointers pointing to the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCollectionNames', 'args': [node]}) def get_collection_paths(self, node, name): """ Retrieves a list of absolute paths of nodes that has a given pointer which points to the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer. :type name: str :returns: The function returns an array of absolute paths of nodes that has the pointer pointing to the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCollectionPaths', 'args': [node, name]}) def get_common_base(self, nodes): """ Returns the common base node of all supplied nodes. :param nodes: a variable number of nodes to compare :type nodes: list of dict :returns: The common base or null if e.g. the root node was passed. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCommonBase', 'args': [nodes]}) def get_common_parent(self, nodes): """ Returns the common parent node of all supplied nodes. :param nodes: a variable number of nodes to compare :type nodes: list of dict :returns: The common base or null if no nodes were passed. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getCommonParent', 'args': [nodes]}) def get_constraint(self, node, name): """ Gets a constraint object of the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :returns: Returns the defined constraint or null if it was not defined for the node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getConstraint', 'args': [node, name]}) def get_constraint_names(self, node): """ Retrieves the list of constraint names defined for the node. :param node: the node in question. :type node: dict :returns: Returns the array of names of constraints available for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getConstraintNames', 'args': [node]}) def get_fco(self, node): """ Return the root of the inheritance chain of your Meta nodes. :param node: any node in your project. :type node: dict :returns: Returns the acting FCO of your project. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getFCO', 'args': [node]}) def get_fully_qualified_name(self, node): """ Returns the fully qualified name of the node, which is the list of its namespaces separated by dot and followed by the name of the node. :param node: the node in question. :type node: dict :returns: Returns the fully qualified name of the node, i.e. its namespaces and name join together by dots. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getFullyQualifiedName', 'args': [node]}) def get_guid(self, node): """ Get the GUID of a node. :param node: the node in question. :type node: dict :returns: Returns the globally unique identifier. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getGuid', 'args': [node]}) def get_hash(self, node): """ Returns the calculated hash and database id of the data for the node. :param node: the node in question. :type node: dict :returns: Returns the hash value of the data for the given node. An empty string is returned when the node was mutated and not persisted. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getHash', 'args': [node]}) def get_instance_paths(self, node): """ Collects the paths of all the instances of the given node. :param node: the node in question. :type node: dict :returns: The function returns an array of the absolute paths of the instances. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getInstancePaths', 'args': [node]}) def get_json_meta(self, node): """ Gives a JSON representation of the META rules of the node. :param node: the node in question. :type node: dict :returns: Returns an object that represents all the META rules of the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getJsonMeta', 'args': [node]}) def get_library_guid(self, node, name=None): """ Returns the origin GUID of any library node. (If name is not provided the returned GUID will be the same across all projects where the library node is contained - regardless of library hierarchy.) :param node: the node in question. :type node: dict :param name: name of the library where we want to compute the GUID from. If not given, then the GUID is computed from the direct library root of the node. :type name: None or str :returns: Returns the origin GUID of the node. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryGuid', 'args': [node, name]}) def get_library_info(self, node, name): """ Returns the info associated with the library. :param node: any node in the project. :type node: dict :param name: the name of the library. :type name: str :returns: Returns the information object, stored alongside the library (that basically carries metaData about the library). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryInfo', 'args': [node, name]}) def get_library_meta_nodes(self, node, name, only_own=None): """ Returns all the Meta nodes within the given library. By default it will include nodes defined in any library within the given library. :param node: any node of your project. :type node: dict :param name: name of your library. :type name: str :param only_own: if true only returns with Meta nodes defined in the library itself. :type only_own: bool :returns: Returns an array of core nodes that are part of your meta from the given library. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryMetaNodes', 'args': [node, name, only_own]}) def get_library_names(self, node): """ Gives back the list of libraries in your project. :param node: any node in your project. :type node: dict :returns: Returns the fully qualified names of all the libraries in your project (even embedded ones). :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryNames', 'args': [node]}) def get_library_root(self, node, name): """ Returns the root node of the given library. :param node: any node in the project. :type node: dict :param name: the name of the library. :type name: str :returns: Returns the library root node or null, if the library is unknown. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getLibraryRoot', 'args': [node, name]}) def get_member_attribute(self, node, set_name, path, attr_name): """ Get the value of the attribute in relation with the set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Return the value of the attribute. If it is undefined, then there is no such attributed connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberAttribute', 'args': [node, set_name, path, attr_name]}) def get_member_attribute_names(self, node, name, path): """ Return the names of the attributes defined for the set membership to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of attributes that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberAttributeNames', 'args': [node, name, path]}) def get_member_own_attribute(self, node, set_name, path, attr_name): """ Get the value of the attribute for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :returns: Return the value of the attribute. If it is undefined, then there is no such attributed connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnAttribute', 'args': [node, set_name, path, attr_name]}) def get_member_own_attribute_names(self, node, name, path): """ Return the names of the attributes defined for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of attributes that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnAttributeNames', 'args': [node, name, path]}) def get_member_own_registry(self, node, set_name, path, reg_name): """ Get the value of the registry entry for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined, then there is no such registry connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnRegistry', 'args': [node, set_name, path, reg_name]}) def get_member_own_registry_names(self, node, name, path): """ Return the names of the registry entries defined for the set membership specifically defined to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of registry entries that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberOwnRegistryNames', 'args': [node, name, path]}) def get_member_paths(self, node, name): """ Returns the list of absolute paths of the members of the given set of the given node. :param node: the set owner. :type node: dict :param name: the name of the set. :type name: str :returns: Returns an array of absolute path strings of the member nodes of the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberPaths', 'args': [node, name]}) def get_member_registry(self, node, set_name, path, reg_name): """ Get the value of the registry entry in relation with the set membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined, then there is no such registry connected to the given set membership. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberRegistry', 'args': [node, set_name, path, reg_name]}) def get_member_registry_names(self, node, name, path): """ Return the names of the registry entries defined for the set membership to the member node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :param path: the absolute path of the member. :type path: str :returns: Returns the array of names of registry entries that represents some property of the membership. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMemberRegistryNames', 'args': [node, name, path]}) def get_meta_type(self, node): """ Returns the meta-node of the node in question, that is the first base node that is part of the meta. (Aliased getBaseType). :param node: the node in question :type node: dict :returns: Returns the first node (including itself) among the inheritance chain that is a META node. It returns null if it does not find such node (ideally the only node with this result is the ROOT). :rtype: dict or None :raises CoreIllegalArgumentError: If node is not a Node :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMetaType', 'args': [node]}) def get_mixin_errors(self, node): """ Checks if the mixins allocated with the node can be used. Every mixin node should be on the Meta. Every rule (attribute/pointer/set/aspect/containment/constraint) should be defined only in one mixin. :param node: the node to test. :type node: dict :returns: Returns the array of violations. If the array is empty, there is no violation. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinErrors', 'args': [node]}) def get_mixin_nodes(self, node): """ Gathers the mixin nodes defined directly at the node. :param node: the node in question. :type node: dict :returns: The dictionary of the mixin nodes keyed by their paths. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinNodes', 'args': [node]}) def get_mixin_paths(self, node): """ Gathers the paths of the mixin nodes defined directly at the node. :param node: the node in question. :type node: dict :returns: The paths of the mixins in an array ordered by their order of use (which is important in case of some collision among definitions would arise). :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getMixinPaths', 'args': [node]}) def get_namespace(self, node): """ Returns the resolved namespace for the node. If node is not in a library it returns the empty string. If the node is in a library of a library - the full name space is the library names joined together by dots. :param node: the node in question. :type node: dict :returns: Returns the name space of the node. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getNamespace', 'args': [node]}) def get_own_attribute(self, node, name): """ Returns the value of the attribute defined for the given node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: Returns the value of the attribute defined specifically for the node. If undefined then it means that there is no such attribute defined directly for the node, meaning that it either inherits some value or there is no such attribute at all. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnAttribute', 'args': [node, name]}) def get_own_attribute_names(self, node): """ Returns the names of the attributes of the node that have been first defined for the node and not for its bases. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the own attributes of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnAttributeNames', 'args': [node]}) def get_own_children_paths(self, parent): """ Collects the paths of all the children of the given node that has some data as well and not just inherited. :param parent: the container node in question. :type parent: dict :returns: The function returns an array of the absolute paths of the children. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnChildrenPaths', 'args': [parent]}) def get_own_children_relids(self, node): """ Collects the relative ids of all the children of the given node that has some data and not just inherited. N.B. Do not mutate the returned array! :param node: the container node in question. :type node: dict :returns: The function returns an array of the relative ids. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnChildrenRelids', 'args': [node]}) def get_own_constraint_names(self, node): """ Retrieves the list of constraint names defined specifically for the node. :param node: the node in question. :type node: dict :returns: Returns the array of names of constraints for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnConstraintNames', 'args': [node]}) def get_own_json_meta(self, node): """ Returns the META rules specifically defined for the given node. :param node: the node in question. :type node: dict :returns: The function returns an object that represent the META rules that were defined specifically for the node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnJsonMeta', 'args': [node]}) def get_own_member_paths(self, node, name): """ Returns the list of absolute paths of the members of the given set of the given node that not simply inherited. :param node: the set owner. :type node: dict :param name: the name of the set. :type name: str :returns: Returns an array of absolute path strings of the member nodes of the set that has information on the node's inheritance level. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnMemberPaths', 'args': [node, name]}) def get_own_pointer_names(self, node): """ Returns the list of the names of the pointers that were defined specifically for the node. :param node: the node in question. :type node: dict :returns: Returns an array of names of pointers defined specifically for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnPointerNames', 'args': [node]}) def get_own_pointer_path(self, node, name): """ Returns the absolute path of the target of the pointer specifically defined for the node. :param node: the node in question :type node: dict :param name: the name of the pointer :type name: str :returns: Returns the absolute path. If the path is null, then it means that 'no-target' was defined specifically for this node for the pointer. If undefined it means that the node either inherits the target of the pointer or there is no pointer defined at all. :rtype: str or None or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnPointerPath', 'args': [node, name]}) def get_own_registry(self, node, name): """ Returns the value of the registry entry defined for the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: Returns the value of the registry entry defined specifically for the node. If undefined then it means that there is no such registry entry defined directly for the node, meaning that it either inherits some value or there is no such registry entry at all. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnRegistry', 'args': [node, name]}) def get_own_registry_names(self, node): """ Returns the names of the registry enrties of the node that have been first defined for the node and not for its bases. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the own registry entries of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnRegistryNames', 'args': [node]}) def get_own_set_attribute(self, node, set_name, attr_name): """ Get the value of the attribute entry specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Return the value of the attribute. If it is undefined, then there is no such attribute at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetAttribute', 'args': [node, set_name, attr_name]}) def get_own_set_attribute_names(self, node, name): """ Return the names of the attribute entries specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of attribute entries defined in the set at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetAttributeNames', 'args': [node, name]}) def get_own_set_names(self, node): """ Returns the names of the sets created specifically at the node. N.B. When adding a member to a set of a node, the set is automatically created at the node. :param node: the node in question. :type node: dict :returns: Returns an array of set names that were specifically created at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetNames', 'args': [node]}) def get_own_set_registry(self, node, set_name, reg_name): """ Get the value of the registry entry specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined, then there is no such registry at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetRegistry', 'args': [node, set_name, reg_name]}) def get_own_set_registry_names(self, node, name): """ Return the names of the registry entries specifically set for the set at the node. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of registry entries defined in the set at the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnSetRegistryNames', 'args': [node, name]}) def get_own_valid_aspect_names(self, node): """ Returns the list of the META defined aspect names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns the aspect names that are specifically defined for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAspectNames', 'args': [node]}) def get_own_valid_aspect_target_paths(self, node, name): """ Returns the paths of the meta nodes that are valid target members of the given aspect specifically defined for the node. :param node: the node in question. :type node: dict :param name: the name of the aspec in question. :type name: str :returns: The paths of the meta nodes whose instances could be members of the aspect. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAspectTargetPaths', 'args': [node, name]}) def get_own_valid_attribute_names(self, node): """ Returns the list of the META defined attribute names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns the attribute names that are defined specifically for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidAttributeNames', 'args': [node]}) def get_own_valid_pointer_names(self, node): """ Returns the list of the META defined pointer names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns all the pointer names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidPointerNames', 'args': [node]}) def get_own_valid_set_names(self, node): """ Returns the list of the META defined set names of the node that were specifically defined for the node. :param node: the node in question. :type node: dict :returns: The function returns all the set names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidSetNames', 'args': [node]}) def get_own_valid_target_paths(self, node, name): """ Returns the paths of Meta nodes that are possible targets of the given pointer/set introduced by the node. :param node: the node in question. :type node: dict :param name: the name of pointer/set. :type name: str :returns: The function returns the paths of valid nodes. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getOwnValidTargetPaths', 'args': [node, name]}) def get_parent(self, node): """ Returns the parent of the node. :param node: the node in question :type node: dict :returns: Returns the parent of the node or NULL if it has no parent. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getParent', 'args': [node]}) def get_path(self, node): """ Returns the complete path of the node in the containment hierarchy. :param node: the node in question. :type node: dict :returns: Returns a path string where each portion is a relative id and they are separated by '/'. The path can be empty as well if the node in question is the root itself, otherwise it should be a chain of relative ids from the root of the containment hierarchy. :rtype: str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPath', 'args': [node]}) def get_pointer_definition_info(self, node, name, target): """ Returns the meta nodes that introduce the given pointer relationship. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :param target: the target node. :type target: dict :returns: The owner and the target of the pointer meta-rule that makes target a valid target of the named pointer of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerDefinitionInfo', 'args': [node, name, target]}) def get_pointer_meta(self, node, name): """ Return a JSON representation of the META rules regarding the given pointer/set of the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :returns: The function returns a detailed JSON structure that represents the META rules regarding the given pointer/set of the node. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerMeta', 'args': [node, name]}) def get_pointer_names(self, node): """ Retrieves a list of the defined pointer names of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the pointers of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerNames', 'args': [node]}) def get_pointer_path(self, node, name): """ Retrieves the path of the target of the given pointer of the given node. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :returns: The function returns the absolute path of the target node if there is a valid target. It returns null if though the pointer is defined it does not have any valid target. Finally, it return undefined if there is no pointer defined for the node under the given name. :rtype: str or None or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getPointerPath', 'args': [node, name]}) def get_registry(self, node, name): """ Retrieves the value of the given registry entry of the given node. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :returns: The function returns the value of the registry entry of the node. The value can be an object or any primitive type. If the value is undefined that means the node do not have such attribute defined. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRegistry', 'args': [node, name]}) def get_registry_names(self, node): """ Returns the names of the defined registry entries of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of the names of the registry entries of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRegistryNames', 'args': [node]}) def get_relid(self, node): """ Returns the parent-relative identifier of the node. :param node: the node in question. :type node: dict :returns: Returns the last segment of the node path. :rtype: str or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRelid', 'args': [node]}) def get_root(self, node): """ Returns the root node of the containment tree that node is part of. :param node: the node in question. :type node: dict :returns: Returns the root of the containment hierarchy (it can be the node itself). :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getRoot', 'args': [node]}) def get_set_attribute(self, node, set_name, attr_name): """ Get the value of the attribute entry in the set. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :returns: Return the value of the attribute. If it is undefined, then there is no such attribute at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetAttribute', 'args': [node, set_name, attr_name]}) def get_set_attribute_names(self, node, name): """ Return the names of the attribute entries for the set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of attribute entries in the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetAttributeNames', 'args': [node, name]}) def get_set_definition_info(self, node, name, member): """ Returns the meta nodes that introduce the given set relationship. :param node: the node in question. :type node: dict :param name: the name of the set in question. :type name: str :param member: the member. :type member: dict :returns: The owner and the target of the set meta-rule that makes member a valid member of the named set of node. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetDefinitionInfo', 'args': [node, name, member]}) def get_set_names(self, node): """ Returns the names of the sets of the node. :param node: the node in question. :type node: dict :returns: Returns an array of set names that the node has. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetNames', 'args': [node]}) def get_set_registry(self, node, set_name, reg_name): """ Get the value of the registry entry in the set. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :returns: Return the value of the registry. If it is undefined, then there is no such registry at the set. :rtype: str or int or float or bool or dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetRegistry', 'args': [node, set_name, reg_name]}) def get_set_registry_names(self, node, name): """ Return the names of the registry entries for the set. :param node: the owner of the set. :type node: dict :param name: the name of the set. :type name: str :returns: Returns the array of names of registry entries in the set. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getSetRegistryNames', 'args': [node, name]}) def get_type_root(self, node): """ Returns the root of the inheritance chain (cannot be the node itself). :param node: the node in question. :type node: dict :returns: Returns the root of the inheritance chain of the node. If returns null, that means the node in question is the root of the chain. :rtype: dict or None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getTypeRoot', 'args': [node]}) def get_valid_aspect_names(self, node): """ Returns the list of the META defined aspect names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the aspect names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAspectNames', 'args': [node]}) def get_valid_aspect_target_paths(self, node, name): """ Returns the paths of the meta nodes that are valid target members of the given aspect. :param node: the node in question. :type node: dict :param name: the name of the aspec in question. :type name: str :returns: The paths of the meta nodes whose instances could be members of the aspect. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAspectTargetPaths', 'args': [node, name]}) def get_valid_attribute_names(self, node): """ Returns the list of the META defined attribute names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the attribute names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidAttributeNames', 'args': [node]}) def get_valid_children_meta_nodes(self, parameters): """ Retrieves the valid META nodes that can be base of a child of the node. :param parameters: the input parameters of the query. :type parameters: dict :returns: The function returns a list of valid nodes that can be instantiated as a child of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidChildrenMetaNodes', 'args': [parameters]}) def get_valid_children_paths(self, node): """ Returns the list of absolute path of the valid children types of the node. :param node: the node in question. :type node: dict :returns: The function returns an array of absolute paths of the nodes that was defined as valid children for the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidChildrenPaths', 'args': [node]}) def get_valid_pointer_names(self, node): """ Returns the list of the META defined pointer names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the pointer names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidPointerNames', 'args': [node]}) def get_valid_set_elements_meta_nodes(self, parameters): """ Retrieves the valid META nodes that can be base of a member of the set of the node. :param parameters: the input parameters of the query. :type parameters: dict :returns: The function returns a list of valid nodes that can be instantiated as a member of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidSetElementsMetaNodes', 'args': [parameters]}) def get_valid_set_names(self, node): """ Returns the list of the META defined set names of the node. :param node: the node in question. :type node: dict :returns: The function returns all the set names that are defined among the META rules of the node. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidSetNames', 'args': [node]}) def get_valid_target_paths(self, node, name): """ Returns the paths of Meta nodes that are possible targets of the given pointer/set. :param node: the node in question. :type node: dict :param name: the name of pointer/set. :type name: str :returns: The function returns the paths of valid nodes. :rtype: list of str :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'getValidTargetPaths', 'args': [node, name]}) def import_closure(self, node, closure_information): """ Imports the set of nodes in the closureInformation - that has the format created by [getClosureInformation]{@link Core#getClosureInformation} - as direct children of the parent node. All data necessary for importing the closure has to be imported beforehand! :param node: the parent node where the closure will be imported. :type node: dict :param closure_information: the information about the closure. :type closure_information: dict :returns: If the closure cannot be imported the resulting error highlights the causes, otherwise a specific object will be returned that holds information about the closure. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'importClosure', 'args': [node, closure_information]}) def is_abstract(self, node): """ Checks if the node is abstract. :param node: the node in question. :type node: dict :returns: The function returns true if the registry entry 'isAbstract' of the node if true hence the node is abstract. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isAbstract', 'args': [node]}) def is_connection(self, node): """ Check is the node is a connection-like node. :param node: the node in question. :type node: dict :returns: Returns true if both the 'src' and 'dst' pointer are defined as valid for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isConnection', 'args': [node]}) def is_empty(self, node): """ Checks if the node in question has some actual data. :param node: the node in question. :type node: dict :returns: Returns true if the node is 'empty' meaning that it is not reserved by real data. Returns false if the node is exists and have some meaningful value. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isEmpty', 'args': [node]}) def is_fully_overridden_member(self, node, name, path): """ Checks if the member is completely overridden in the set of the node. :param node: the node to test. :type node: dict :param name: the name of the set of the node. :type name: str :param path: the path of the member in question. :type path: str :returns: Returns true if the member exists in the base of the set, but was added to the given set as well, which means a complete override. If the set does not exist or the member do not have a 'base' member or just some property was overridden, the function returns false. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isFullyOverriddenMember', 'args': [node, name, path]}) def is_instance_of(self, node, base_node_or_path): """ Checks if the node is an instance of base. :param node: the node in question. :type node: dict :param base_node_or_path: a potential base node (or its path) of the node :type base_node_or_path: dict or str :returns: Returns true if the base is on the inheritance chain of node. A node is considered to be an instance of itself here. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isInstanceOf', 'args': [node, base_node_or_path]}) def is_library_element(self, node): """ Returns true if the node in question is a library element.. :param node: the node in question. :type node: dict :returns: Returns true if your node is a library element, false otherwise. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isLibraryElement', 'args': [node]}) def is_library_root(self, node): """ Returns true if the node in question is a library root.. :param node: the node in question. :type node: dict :returns: Returns true if your node is a library root (even if it is embedded in other library), false otherwise. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isLibraryRoot', 'args': [node]}) def is_member_of(self, node): """ Returns all membership information of the given node. :param node: the node in question :type node: dict :returns: Returns a dictionary where every the key of every entry is an absolute path of a set owner node. The value of each entry is an array with the set names in which the node can be found as a member. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isMemberOf', 'args': [node]}) def is_meta_node(self, node): """ Checks if the node is a META node. :param node: the node to test. :type node: dict :returns: Returns true if the node is a member of the METAAspectSet of the ROOT node hence can be seen as a META node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isMetaNode', 'args': [node]}) def is_type_of(self, node, type_node_or_path): """ Checks if the given node in any way inherits from the typeNode. In addition to checking if the node "isInstanceOf" of typeNode, this methods also takes mixins into account. :param node: the node in question. :type node: dict :param type_node_or_path: the type node we want to check or its path. :type type_node_or_path: dict or str :returns: The function returns true if the typeNodeOrPath represents a base node, or a mixin of any of the base nodes, of the node. Every node is considered to be a type of itself. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isTypeOf', 'args': [node, type_node_or_path]}) def is_valid_aspect_member_of(self, node, parent, name): """ Returns if a node could be contained in the given container's aspect. :param node: the node in question. :type node: dict :param parent: the container node in question. :type parent: dict :param name: the name of aspect. :type name: str :returns: The function returns true if the given container could contain the node in the asked aspect. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidAspectMemberOf', 'args': [node, parent, name]}) def is_valid_attribute_value_of(self, node, name, value): """ Checks if the given value is of the necessary type, according to the META rules. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param value: the value to test. :type value: str or int or float or bool or dict :returns: Returns true if the value matches the META definitions. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidAttributeValueOf', 'args': [node, name, value]}) def is_valid_child_of(self, node, parent): """ Checks if according to the META rules the given node can be a child of the parent. :param node: the node in question :type node: dict :param parent: the parent we like to test. :type parent: dict :returns: The function returns true if according to the META rules the node can be a child of the parent. The check does not cover multiplicity (so if the parent can only have twi children and it already has them, this function will still returns true). :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidChildOf', 'args': [node, parent]}) def is_valid_new_base(self, node, base): """ Checks if base can be the new base of node. :param node: the node in question. :type node: dict :param base: the new base. :type base: dict or None or None :returns: True if the supplied base is a valid base for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewBase', 'args': [node, base]}) def is_valid_new_child(self, parent_node, base_node): """ Checks if an instance of the given base can be created under the parent. It does not check for meta consistency. It only validates if the proposed creation would cause any loops in the combined containment inheritance trees. :param parent_node: the parent in question. :type parent_node: dict or None :param base_node: the intended type of the node. :type base_node: dict or None :returns: True if a child of the type can be created. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewChild', 'args': [parent_node, base_node]}) def is_valid_new_parent(self, node, parent): """ Checks if parent can be the new parent of node. :param node: the node in question. :type node: dict :param parent: the new parent. :type parent: dict :returns: True if the supplied parent is a valid parent for the node. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidNewParent', 'args': [node, parent]}) def is_valid_target_of(self, node, source, name): """ Checks if the node can be a target of a pointer of the source node in accordance with the META rules. :param node: the node in question. :type node: dict :param source: the source to test. :type source: dict :param name: the name of the pointer. :type name: str :returns: The function returns true if according to the META rules, the given node is a valid target of the given pointer of the source. :rtype: bool :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'isValidTargetOf', 'args': [node, source, name]}) def load_by_path(self, node, relative_path): """ From the given starting node, it loads the path given as a series of relative ids (separated by '/') and returns the node it finds at the ends of the path. If there is no node, the function will return null. :param node: the starting node of our search. :type node: dict :param relative_path: the relative path - built by relative ids - of the node in question. :type relative_path: str :returns: the resulting node :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadByPath', 'args': [node, relative_path]}) def load_child(self, parent, relative_id): """ Loads the child of the given parent pointed by the relative id. Behind the scenes, it means that it actually loads the data pointed by a hash stored inside the parent under the given id and wraps it in a node object which will be connected to the parent as a child in the containment hierarchy. If there is no such relative id reserved, the call will return with null. :param parent: the container node in question. :type parent: dict :param relative_id: the relative id of the child in question. :type relative_id: str :returns: the resulting child :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadChild', 'args': [parent, relative_id]}) def load_children(self, node): """ Loads all the children of the given parent. As it first checks the already reserved relative ids of the parent, it only loads the already existing children (so no on-demand empty node creation). :param node: the container node in question. :type node: dict :returns: the resulting children :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadChildren', 'args': [node]}) def load_collection(self, node, pointer_name): """ Loads all the source nodes that has such a pointer and its target is the given node. :param node: the target node in question. :type node: dict :param pointer_name: the name of the pointer of the sources. :type pointer_name: str :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadCollection', 'args': [node, pointer_name]}) def load_instances(self, node): """ Loads all the instances of the given node. :param node: the node in question. :type node: dict :returns: the found instances of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadInstances', 'args': [node]}) def load_members(self, node, set_name): """ Loads all the members of the given set of the node. :param node: the node in question. :type node: dict :param set_name: the name of the set in question. :type set_name: str :returns: the found members of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadMembers', 'args': [node, set_name]}) def load_own_children(self, node): """ Loads all the children of the given parent that has some data and not just inherited. As it first checks the already reserved relative ids of the parent, it only loads the already existing children (so no on-demand empty node creation). :param node: the container node in question. :type node: dict :returns: the resulting children :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadOwnChildren', 'args': [node]}) def load_own_members(self, node, set_name): """ Loads all the own members of the given set of the node. :param node: the node in question. :type node: dict :param set_name: the name of the set in question. :type set_name: str :returns: the found own members of the set of the node. :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'loadOwnMembers', 'args': [node, set_name]}) def load_own_sub_tree(self, node): """ Loads a complete sub-tree of the containment hierarchy starting from the given node, but load only those children that has some additional data and not purely inherited. :param node: the container node in question. :type node: dict :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadOwnSubTree', 'args': [node]}) def load_pointer(self, node, pointer_name): """ Loads the target of the given pointer of the given node. In the callback the node can have three values: if the node is valid, then it is the defined target of a valid pointer, if the returned value is null, then it means that the pointer is defined, but has no real target, finally if the returned value is undefined than there is no such pointer defined for the given node. :param node: the source node in question. :type node: dict :param pointer_name: the name of the pointer. :type pointer_name: str :returns: the resulting target :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadPointer', 'args': [node, pointer_name]}) def load_root(self, hash): """ Loads the data object with the given hash and makes it a root of a containment hierarchy. :param hash: the hash of the data object we like to load as root. :type hash: str :returns: the resulting root node :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadRoot', 'args': [hash]}) def load_sub_tree(self, node): """ Loads a complete sub-tree of the containment hierarchy starting from the given node. :param node: the node that is the root of the sub-tree in question. :type node: dict :returns: the resulting sources :rtype: list of dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution :raises CoreInternalError: the result of the execution """ return self._send({'name': 'loadSubTree', 'args': [node]}) def move_aspect_meta_target(self, node, target, old_name, new_name): """ Moves the given target definition over to a new aspect. As actual values in case of relation definitions vary quite a bit from the meta-targets, this function does not deals with the actual pointer/set target/members. :param node: the node in question. :type node: dict :param target: the target that should be moved among definitions. :type target: dict :param old_name: the current name of the aspect that has the target. :type old_name: str :param new_name: the new aspect name where the target should be moved over. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveAspectMetaTarget', 'args': [node, target, old_name, new_name]}) def move_member(self, node, member_path, old_set_name, new_set_name): """ Moves an own member of the set over to another set of the node. :param node: the node in question. :type node: dict :param member_path: the path of the memberNode that should be moved. :type member_path: str :param old_set_name: the name of the set where the member is currently reside. :type old_set_name: str :param new_set_name: the name of the target set where the member should be moved to. :type new_set_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveMember', 'args': [node, member_path, old_set_name, new_set_name]}) def move_node(self, node, parent): """ Moves the given node under the given parent. :param node: the node to be moved. :type node: dict :param parent: the parent node of the copy. :type parent: dict :returns: The function returns the node after the move. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'moveNode', 'args': [node, parent]}) def move_pointer_meta_target(self, node, target, old_name, new_name): """ Moves the given target definition over to a new pointer or set. Note this does not alter the actual pointer target or set members. :param node: the node in question. :type node: dict :param target: the target that should be moved among definitions. :type target: dict :param old_name: the current name of the pointer/set definition in question. :type old_name: str :param new_name: the new name of the relation towards the target. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'movePointerMetaTarget', 'args': [node, target, old_name, new_name]}) def persist(self, node): """ Persists the changes made in memory and computed the data blobs that needs to be saved into the database to make the change and allow other users to see the new state of the project. :param node: some node element of the modified containment hierarchy (usually the root). :type node: dict :returns: The function returns an object which collects all the changes on data level and necessary to update the database on server side. Keys of the returned object are 'rootHash' and 'objects'. The values of these should be passed to project.makeCommit. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'persist', 'args': [node]}) def remove_library(self, node, name): """ Removes a library from your project. It will also remove any remaining instances of the specific library. :param node: any node in your project. :type node: dict :param name: the name of your library. :type name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'removeLibrary', 'args': [node, name]}) def rename_attribute(self, node, old_name, new_name): """ Renames the given attribute of the node if its value is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the attribute in question. :type old_name: str :param new_name: the new name of the attribute. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameAttribute', 'args': [node, old_name, new_name]}) def rename_attribute_meta(self, node, old_name, new_name): """ Renames the given attribute definition of the node. It also renames the default value of the definition! As a result of this operation, all instances of node will have the new attribute, but if they have overriden the old attribute it will remain under that name (and become meta invalid). :param node: the node in question. :type node: dict :param old_name: the current name of the attribute definition in question. :type old_name: str :param new_name: the new name of the attribute. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameAttributeMeta', 'args': [node, old_name, new_name]}) def rename_library(self, node, old_name, new_name): """ Rename a library in your project. :param node: any node in your project. :type node: dict :param old_name: the current name of the library. :type old_name: str :param new_name: the new name of the project. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameLibrary', 'args': [node, old_name, new_name]}) def rename_pointer(self, node, old_name, new_name): """ Renames the given pointer of the node if its target is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the pointer in question. :type old_name: str :param new_name: the new name of the pointer. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renamePointer', 'args': [node, old_name, new_name]}) def rename_registry(self, node, old_name, new_name): """ Renames the given registry of the node if its value is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the registry in question. :type old_name: str :param new_name: the new name of the registry. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameRegistry', 'args': [node, old_name, new_name]}) def rename_set(self, node, old_name, new_name): """ Renames the given set of the node if its is not inherited. :param node: the node in question. :type node: dict :param old_name: the current name of the set in question. :type old_name: str :param new_name: the new name of the set. :type new_name: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'renameSet', 'args': [node, old_name, new_name]}) def set_aspect_meta_target(self, node, name, target): """ Sets a valid type for the given aspect of the node. :param node: the node in question. :type node: dict :param name: the name of the aspect. :type name: str :param target: the valid type for the aspect. :type target: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAspectMetaTarget', 'args': [node, name, target]}) def set_attribute(self, node, name, value): """ Sets the value of the given attribute of the given node. It defines the attribute on demand, means that it will set the given attribute even if was ot defined for the node beforehand. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param value: the new of the attribute, undefined is not allowed. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAttribute', 'args': [node, name, value]}) def set_attribute_meta(self, node, name, rule): """ Sets the META rules of the attribute of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :param rule: the rules that defines the attribute :type rule: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setAttributeMeta', 'args': [node, name, rule]}) def set_base(self, node, base): """ Sets the base node of the given node. The function doesn't touches the properties or the children of the node so it can cause META rule violations that needs to be corrected manually. :param node: the node in question. :type node: dict :param base: the new base. :type base: dict or None :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setBase', 'args': [node, base]}) def set_child_meta(self, node, child, min=None, max=None): """ Sets the given child as a valid children type for the node. :param node: the node in question. :type node: dict :param child: the valid child node. :type child: dict :param min: the allowed minimum number of children from this given node type (if not given or -1 is set, then there will be no minimum rule according this child type) :type min: int :param max: the allowed maximum number of children from this given node type (if not given or -1 is set, then there will be no minimum rule according this child type) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setChildMeta', 'args': [node, child, min, max]}) def set_children_meta_limits(self, node, min=None, max=None): """ Sets the global containment limits for the node. :param node: the node in question. :type node: dict :param min: the allowed minimum number of children (if not given or -1 is set, then there will be no minimum rule according children) :type min: int :param max: the allowed maximum number of children (if not given or -1 is set, then there will be no maximum rule according children) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setChildrenMetaLimits', 'args': [node, min, max]}) def set_constraint(self, node, name, constraint): """ Sets a constraint object of the node. :param node: the node in question. :type node: dict :param name: the name of the constraint. :type name: str :param constraint: the constraint to be set. :type constraint: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setConstraint', 'args': [node, name, constraint]}) def set_guid(self, node, guid): """ Set the GUID of a node. As the Core itself do not checks whether the GUID already exists. The use of this function is only advised during the creation of the node. :param node: the node in question. :type node: dict :param guid: the new globally unique identifier. :type guid: str :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the result of the execution. :raises CoreIllegalOperationError: the result of the execution. :raises CoreInternalError: the result of the execution. """ return self._send({'name': 'setGuid', 'args': [node, guid]}) def set_member_attribute(self, node, set_name, path, attr_name, value): """ Sets the attribute value which represents a property of the membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param attr_name: the name of the attribute. :type attr_name: str :param value: the new value of the attribute. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setMemberAttribute', 'args': [node, set_name, path, attr_name, value]}) def set_member_registry(self, node, set_name, path, reg_name, value): """ Sets the registry entry value which represents a property of the membership. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param path: the absolute path of the member node. :type path: str :param reg_name: the name of the registry entry. :type reg_name: str :param value: the new value of the registry. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setMemberRegistry', 'args': [node, set_name, path, reg_name, value]}) def set_pointer(self, node, name, target): """ Sets the target of the pointer of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer in question. :type name: str :param target: the new target of the pointer. :type target: dict or None :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointer', 'args': [node, name, target]}) def set_pointer_meta_limits(self, node, name, min=None, max=None): """ Sets the global target limits for pointer/set of the node. On META level the only distinction between pointer and sets is the global multiplicity which has to maximize the number of possible targets to 1 in case of 'pure' pointer definitions. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :param min: the allowed minimum number of children (if not given or -1 is set, then there will be no minimum rule according targets) :type min: int :param max: the allowed maximum number of children (if not given or -1 is set, then there will be no maximum rule according targets) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointerMetaLimits', 'args': [node, name, min, max]}) def set_pointer_meta_target(self, node, name, target, min=None, max=None): """ Sets the given target as a valid target type for the pointer/set of the node. :param node: the node in question. :type node: dict :param name: the name of the pointer/set. :type name: str :param target: the valid target/member node. :type target: dict :param min: the allowed minimum number of target/member from this given node type (if not given or -1 is set, then there will be no minimum rule according this target type) :type min: int :param max: the allowed maximum number of target/member from this given node type (if not given or -1 is set, then there will be no minimum rule according this target type) :type max: int :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setPointerMetaTarget', 'args': [node, name, target, min, max]}) def set_registry(self, node, name, value): """ Sets the value of the given registry entry of the given node. It defines the registry entry on demand, means that it will set the given registry entry even if was ot defined for the node beforehand. :param node: the node in question. :type node: dict :param name: the name of the registry entry. :type name: str :param value: the new of the registry entry. Can be any primitive type or object. Undefined is not allowed. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setRegistry', 'args': [node, name, value]}) def set_set_attribute(self, node, set_name, attr_name, value): """ Sets the attribute entry value for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param attr_name: the name of the attribute entry. :type attr_name: str :param value: the new value of the attribute. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setSetAttribute', 'args': [node, set_name, attr_name, value]}) def set_set_registry(self, node, set_name, reg_name, value): """ Sets the registry entry value for the set at the node. :param node: the owner of the set. :type node: dict :param set_name: the name of the set. :type set_name: str :param reg_name: the name of the registry entry. :type reg_name: str :param value: the new value of the registry. :type value: str or int or float or bool or dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreIllegalOperationError: If the context of the operation is not allowed. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'setSetRegistry', 'args': [node, set_name, reg_name, value]}) def try_to_concat_changes(self, mine, theirs): """ Tries to merge two patch object. The patches ideally represents changes made by two parties. They represents changes from the same source ending in different states. Our aim is to generate a single patch that could cover the changes of both party. :param mine: the tree structured JSON patch that represents my changes. :type mine: dict :param theirs: the tree structured JSON patch that represents the changes of the other party. :type theirs: dict :returns: The function returns with an object that contains the conflicts (if any) and the merged patch. :rtype: dict :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises CoreInternalError: If some internal error took place inside the core layers. """ return self._send({'name': 'tryToConcatChanges', 'args': [mine, theirs]}) def update_library(self, node, name, library_root_hash, library_info=None): """ It updates a library in your project based on the input information. It will 'reaplace' the old version, keeping as much information as possible regarding the instances. :param node: any regular node in your project. :type node: dict :param name: the name of the library you want to update. :type name: str :param library_root_hash: the hash of your library's new root (must exist in the project's collection at the time of call). :type library_root_hash: str :param library_info: information about your project. :type library_info: dict :returns: Nothing is returned by the function. :rtype: None :raises CoreIllegalArgumentError: If some of the parameters don't match the input criteria. :raises JSError: the status of the execution. :raises CoreIllegalOperationError: the status of the execution. :raises CoreInternalError: the status of the execution. """ return self._send({'name': 'updateLibrary', 'args': [node, name, library_root_hash, library_info]})
__title__ = 'consign' __description__ = 'Python storage for humans.' __url__ = 'https://requests.readthedocs.io' __version__ = '0.2.2' __author__ = 'Daniel Jadraque' __author_email__ = 'jadraque@hey.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2021 Daniel Jadraque'
__title__ = 'consign' __description__ = 'Python storage for humans.' __url__ = 'https://requests.readthedocs.io' __version__ = '0.2.2' __author__ = 'Daniel Jadraque' __author_email__ = 'jadraque@hey.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2021 Daniel Jadraque'
nome = input("Digite seu nome: ") nome = nome.strip().title() print("No seu nome tem silva? {}".format("Silva" in nome)) print("O seu nome: {}".format(nome))
nome = input('Digite seu nome: ') nome = nome.strip().title() print('No seu nome tem silva? {}'.format('Silva' in nome)) print('O seu nome: {}'.format(nome))
class Employee: numEmployee = 0 def __init__(self, name, rate): self.owed = 0 self.name = name self.rate = rate Employee.numEmployee += 1 def __repr__(self): return "a custom object (%r)" % self.name def __del__(self): Employee.numEmployee -= 1 def hours(self, num_hours): self.owed += num_hours * self.rate return "%.2f hours worked" % num_hours def pay(self): self.owed = 0 return "payed %s" % self.name # inheritance class SpecialEmployee(Employee): def __init__(self, name, rate, bonus): Employee.__init__(self, name, rate) self.bonus = bonus def hours(self, num_hours): self.owed += num_hours * self.rate + self.bonus return "%.2f hours worked" % num_hours # class methods # class Aexp: # base = 2 # # @classmethod # def exp(cls, x): # return cls.base ** x # # # class Bexp(Aexp): # __base = 3 # # def __exp(self): # return x ** cls.base # emp1 = Employee("Anna", 8.50) # emp2 = Employee("Mark", 12.34) # # print(emp1.hours(20), emp1.owed, emp1.pay()) # print(emp2)
class Employee: num_employee = 0 def __init__(self, name, rate): self.owed = 0 self.name = name self.rate = rate Employee.numEmployee += 1 def __repr__(self): return 'a custom object (%r)' % self.name def __del__(self): Employee.numEmployee -= 1 def hours(self, num_hours): self.owed += num_hours * self.rate return '%.2f hours worked' % num_hours def pay(self): self.owed = 0 return 'payed %s' % self.name class Specialemployee(Employee): def __init__(self, name, rate, bonus): Employee.__init__(self, name, rate) self.bonus = bonus def hours(self, num_hours): self.owed += num_hours * self.rate + self.bonus return '%.2f hours worked' % num_hours
def get_unique_iterable_objects_in_order(iterable): unique_objects_in_order = [] for object_ in iterable: if object_ not in unique_objects_in_order: unique_objects_in_order.append(object_) return unique_objects_in_order
def get_unique_iterable_objects_in_order(iterable): unique_objects_in_order = [] for object_ in iterable: if object_ not in unique_objects_in_order: unique_objects_in_order.append(object_) return unique_objects_in_order
# -*- mode: python ; coding: utf-8 -*- block_cipher = None a = Analysis(['D:\\temp\\main.py'], pathex=['D:\\temp'], binaries=[], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='Stock_Market', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False ) #Notes for the new version :- #Version 5:- #Now, prices for the shares will be refreshed automatically. #Bug fixes.
block_cipher = None a = analysis(['D:\\temp\\main.py'], pathex=['D:\\temp'], binaries=[], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = pyz(a.pure, a.zipped_data, cipher=block_cipher) exe = exe(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='Stock_Market', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False)
test = { 'name': 'q1_1', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" >>> # Did you add Career Length column?; >>> nfl.num_columns == 6 True """, 'hidden': False, 'locked': False }, { 'code': r""" >>> # Checking that the first 10 rows are correct; >>> nfl.take(np.arange(10)) Player | Salary | Year Drafted | Pick Number | Position | Career Length Baker Mayfield | 570000 | 2018 | 1 | QB | 2 Cam Newton | 16200000 | 2011 | 1 | QB | 9 Eli Manning | 11500000 | 2004 | 1 | QB | 16 Eric Fisher | 10350000 | 2013 | 1 | OT | 7 Jadeveon Clowney | 15967200 | 2014 | 1 | DE | 6 Jameis Winston | 20922000 | 2015 | 1 | QB | 5 Jared Goff | 4259683 | 2016 | 1 | QB | 4 Kyler Murray | 495000 | 2019 | 1 | QB | 1 Matthew Stafford | 13500000 | 2009 | 1 | QB | 11 Myles Garrett | 3229750 | 2017 | 1 | DE | 3 """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest' } ] }
test = {'name': 'q1_1', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> # Did you add Career Length column?;\n >>> nfl.num_columns == 6\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> # Checking that the first 10 rows are correct;\n >>> nfl.take(np.arange(10))\n Player | Salary | Year Drafted | Pick Number | Position | Career Length\n Baker Mayfield | 570000 | 2018 | 1 | QB | 2\n Cam Newton | 16200000 | 2011 | 1 | QB | 9\n Eli Manning | 11500000 | 2004 | 1 | QB | 16\n Eric Fisher | 10350000 | 2013 | 1 | OT | 7\n Jadeveon Clowney | 15967200 | 2014 | 1 | DE | 6\n Jameis Winston | 20922000 | 2015 | 1 | QB | 5\n Jared Goff | 4259683 | 2016 | 1 | QB | 4\n Kyler Murray | 495000 | 2019 | 1 | QB | 1\n Matthew Stafford | 13500000 | 2009 | 1 | QB | 11\n Myles Garrett | 3229750 | 2017 | 1 | DE | 3\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
""" Typcasting w. Strings """ # Convert these variables into strings and then back to their original data types. Print out each result as well as its data type. What do you notice about the last one? five = 5 zero = 0 neg_8 = -8 T = True F = False
""" Typcasting w. Strings """ five = 5 zero = 0 neg_8 = -8 t = True f = False
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/ornithorhynchus_anatinus/SRP007412' OUT_DIR = '/staging/as/skchoudh/rna-seq-output/ornithorhynchus_anatinus/SRP007412' CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.fa.gz' CDNA_IDX = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.kallisto.index'
rawdata_dir = '/staging/as/skchoudh/rna-seq-datasets/single/ornithorhynchus_anatinus/SRP007412' out_dir = '/staging/as/skchoudh/rna-seq-output/ornithorhynchus_anatinus/SRP007412' cdna_fa_gz = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.fa.gz' cdna_idx = '/home/cmb-panasas2/skchoudh/genomes/ornithorhynchus_anatinus/cdna/Ornithorhynchus_anatinus.OANA5.cdna.all.kallisto.index'
''' Author : MiKueen Level : Medium Problem Statement : Find Minimum in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. You may assume no duplicate exists in the array. Example 1: Input: [3,4,5,1,2] Output: 1 Example 2: Input: [4,5,6,7,0,1,2] Output: 0 ''' class Solution(object): def findMin(self, nums): """ :type nums: List[int] :rtype: int """ if nums[0] < nums[-1] or len(nums) == 1: return nums[0] low , high = 0, len(nums)-1 while low < high: mid = (low + high) // 2 if nums[mid] > nums[mid+1]: return nums[mid+1] elif nums[mid-1] > nums[mid]: return nums[mid] elif nums[mid] > nums[0]: low = mid + 1 else: high = mid - 1
""" Author : MiKueen Level : Medium Problem Statement : Find Minimum in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. You may assume no duplicate exists in the array. Example 1: Input: [3,4,5,1,2] Output: 1 Example 2: Input: [4,5,6,7,0,1,2] Output: 0 """ class Solution(object): def find_min(self, nums): """ :type nums: List[int] :rtype: int """ if nums[0] < nums[-1] or len(nums) == 1: return nums[0] (low, high) = (0, len(nums) - 1) while low < high: mid = (low + high) // 2 if nums[mid] > nums[mid + 1]: return nums[mid + 1] elif nums[mid - 1] > nums[mid]: return nums[mid] elif nums[mid] > nums[0]: low = mid + 1 else: high = mid - 1
def say_hello(name): print("Hello,", name) user_name = input("What is your name? ") say_hello(user_name)
def say_hello(name): print('Hello,', name) user_name = input('What is your name? ') say_hello(user_name)
#xsv Libraries / dictionaries / variables or # WHATEVER YOU FUCKING CALL THEM! exampleVars = [ { 'Name': 'xH', 'Info': { 'Staff': ['Council'], 'Dev': ['Im Dynamic'], 'Office': ['Couch'], 'Role':[] } }, { 'Name': 'xsv', 'Info': { 'Staff': ['Im Dynamic'], 'Dev': ['@Blynd'], 'Office':[], 'Role':['Development Team'] } } ]
example_vars = [{'Name': 'xH', 'Info': {'Staff': ['Council'], 'Dev': ['Im Dynamic'], 'Office': ['Couch'], 'Role': []}}, {'Name': 'xsv', 'Info': {'Staff': ['Im Dynamic'], 'Dev': ['@Blynd'], 'Office': [], 'Role': ['Development Team']}}]
def is_opcode(line): return line.startswith('#define') and 'OPCODE' not in line def get_filename_for_op(op): return op.split("_")[0] def get_function_name_for_op(op): return "op_{}".format(op) outfiles = {} opfilenames = [] opmap = {} ops = [] f = open("opcodes.h") for line in f: if is_opcode(line): tokens = line.split()[1:] ops.append(tokens) headerfile = """ // AUTOGENERATED FILE // It's not meant to be pretty. #ifndef __6502_OPFUNCS__ #define __6502_OPFUNCS__ #include "opcodes.h" #include "opfuncs.c" typedef void (*instruction)(); $__OP_ARRAYS_DEFS__$ $__OP_NAMES__$ #endif """ opfuncheaderfile = open("ops.h", "w+") # Generated op array information op_array_defs = """ instruction opfuncs[256] = { """ for op in ops: opmap[str(int(op[1], 16))] = op[0] for i in range(256): if str(i) in opmap: o = opmap[str(i)] funcname = get_function_name_for_op(o) op_array_defs += "\t&{},\n".format(funcname) else: op_array_defs += "\t&op_NOP,\n" op_array_defs += "};" op_names_defs = """ const char *opnames[256] = { """ for op in ops: opmap[str(int(op[1], 16))] = op[0] for i in range(256): if str(i) in opmap: o = opmap[str(i)] op_names_defs += "\t\"{}\",\n".format(o) else: op_names_defs += "\t\"NOP\",\n" op_names_defs += "};" headerfile = headerfile.replace("$__OP_ARRAYS_DEFS__$", op_array_defs) headerfile = headerfile.replace("$__OP_NAMES__$", op_names_defs) opfuncheaderfile.write(headerfile)
def is_opcode(line): return line.startswith('#define') and 'OPCODE' not in line def get_filename_for_op(op): return op.split('_')[0] def get_function_name_for_op(op): return 'op_{}'.format(op) outfiles = {} opfilenames = [] opmap = {} ops = [] f = open('opcodes.h') for line in f: if is_opcode(line): tokens = line.split()[1:] ops.append(tokens) headerfile = '\n// AUTOGENERATED FILE\n// It\'s not meant to be pretty.\n\n#ifndef __6502_OPFUNCS__\n#define __6502_OPFUNCS__\n\n#include "opcodes.h"\n#include "opfuncs.c"\n\ntypedef void (*instruction)();\n\n\n$__OP_ARRAYS_DEFS__$\n\n$__OP_NAMES__$\n\n#endif\n' opfuncheaderfile = open('ops.h', 'w+') op_array_defs = '\ninstruction opfuncs[256] = {\n' for op in ops: opmap[str(int(op[1], 16))] = op[0] for i in range(256): if str(i) in opmap: o = opmap[str(i)] funcname = get_function_name_for_op(o) op_array_defs += '\t&{},\n'.format(funcname) else: op_array_defs += '\t&op_NOP,\n' op_array_defs += '};' op_names_defs = '\nconst char *opnames[256] = {\n' for op in ops: opmap[str(int(op[1], 16))] = op[0] for i in range(256): if str(i) in opmap: o = opmap[str(i)] op_names_defs += '\t"{}",\n'.format(o) else: op_names_defs += '\t"NOP",\n' op_names_defs += '};' headerfile = headerfile.replace('$__OP_ARRAYS_DEFS__$', op_array_defs) headerfile = headerfile.replace('$__OP_NAMES__$', op_names_defs) opfuncheaderfile.write(headerfile)
BATCH_SIZE = 128 EPOCHS = 120 LR = 0.001 NGRAM = 10 NUM_CLASS = 20 EMBEDDING_DIM = 100 CUDA = True DEVICE = 3 DEBUG = False # FILENAME = '../bsnn/data/tor_erase_tls2.traffic' FILENAME = '../bsnn/data/20_header_payload_all.traffic' # LABELS ={'facebook': 0, 'yahoomail': 1, 'Youtube': 2, 'itunes': 3, 'mysql': 4, 'filezilla': 5, 'amazon': 6, 'skype': 7, 'google': 8, 'gmail': 9, 'vimeo': 10, 'twitter': 11, 'spotify': 12, 'netflix': 13, 'aimchat': 14, 'voipbuster': 15, 'jd': 16, 'taobao': 17, 'pp': 18, 'weibo': 19, 'baidu': 20, 'thunder': 21, 'sohu': 22, 'youku': 23, 'tudou': 24, 'KG': 25, 'sinaUC': 26, 'cloudmusic': 27, 'qq': 28, 'ftps': 29, 'snmp': 30, 'ssh': 31, 'https': 32, 'smtp': 33, 'dns': 34, 'bittorrent': 35} # LABELS = {'vimeo': 0, 'spotify': 1, 'voipbuster': 2, 'sinauc': 3, 'cloudmusic': 4, 'weibo': 5, 'baidu': 6, 'tudou': 7, 'amazon': 8, 'thunder': 9, 'gmail': 10, 'pplive': 11, 'qq': 12, 'taobao': 13, 'yahoomail': 14, 'itunes': 15, 'twitter': 16, 'jd': 17, 'sohu': 18, 'youtube': 19, 'youku': 20, 'netflix': 21, 'aimchat': 22, 'kugou': 23, 'skype': 24, 'facebook': 25, 'google': 26, 'mssql': 27, 'ms-exchange': 28} # LABELS = {'audio': 0, 'browsing': 1, 'chat': 2, # 'file': 3, 'mail': 4, # 'p2p': 5, 'video': 6, 'voip': 7} LABELS = {'reddit': 0, 'facebook': 1, 'NeteaseMusic': 2, 'twitter': 3, 'qqmail': 4, 'instagram': 5, 'weibo': 6, 'iqiyi': 7, 'imdb': 8, 'TED': 9, 'douban': 10, 'amazon': 11, 'youtube': 12, 'JD': 13, 'youku': 14, 'baidu': 15, 'google': 16, 'tieba': 17, 'taobao': 18, 'bing': 19} test_percent = 0.2 # save model load_model_name = 'mymodel/ulti.model1' save_model_name = 'mymodel/ulti.model2'
batch_size = 128 epochs = 120 lr = 0.001 ngram = 10 num_class = 20 embedding_dim = 100 cuda = True device = 3 debug = False filename = '../bsnn/data/20_header_payload_all.traffic' labels = {'reddit': 0, 'facebook': 1, 'NeteaseMusic': 2, 'twitter': 3, 'qqmail': 4, 'instagram': 5, 'weibo': 6, 'iqiyi': 7, 'imdb': 8, 'TED': 9, 'douban': 10, 'amazon': 11, 'youtube': 12, 'JD': 13, 'youku': 14, 'baidu': 15, 'google': 16, 'tieba': 17, 'taobao': 18, 'bing': 19} test_percent = 0.2 load_model_name = 'mymodel/ulti.model1' save_model_name = 'mymodel/ulti.model2'
def inputGrades(nm): grades = [] for i in range(0,nm,1): grade = float(input('Enter your Grade: ')) grades.append(grade) return grades def printGrades(nm,x): for i in range(0,nm,1): print(x[i]) def avgGrades(nm,x): Sum = 0 for i in range(0,nm,1): Sum = Sum + x[i] average = Sum / nm return average def HighLowGrades(nm,x): highG = 0 lowG = 100 for i in range(0,nm,1): if(x[i] < lowG): lowG = x[i] if(x[i] > highG): highG = x[i] return highG, lowG def sortGrades(nm,x): for i in range(0,nm-1,1): for i in range(0,nm-1,1): if(x[i] > x[i+1]): temp = x[i] x[i] = x[i+1] x[i+1] = temp return x numGrades = int(input('Enter How Many Grades You Have: ')) myGrades = inputGrades(numGrades) printGrades(numGrades,myGrades) averageGrades = avgGrades(numGrades,myGrades) print('Your Average Grade is: ',round(averageGrades)) highG, lowG = HighLowGrades(numGrades,myGrades) print('Your Highest Grade is:',highG,'Your Lowest Grade is:',lowG) sortedGrades = sortGrades(numGrades,myGrades) print('Sorted List of Grades: ',sortedGrades)
def input_grades(nm): grades = [] for i in range(0, nm, 1): grade = float(input('Enter your Grade: ')) grades.append(grade) return grades def print_grades(nm, x): for i in range(0, nm, 1): print(x[i]) def avg_grades(nm, x): sum = 0 for i in range(0, nm, 1): sum = Sum + x[i] average = Sum / nm return average def high_low_grades(nm, x): high_g = 0 low_g = 100 for i in range(0, nm, 1): if x[i] < lowG: low_g = x[i] if x[i] > highG: high_g = x[i] return (highG, lowG) def sort_grades(nm, x): for i in range(0, nm - 1, 1): for i in range(0, nm - 1, 1): if x[i] > x[i + 1]: temp = x[i] x[i] = x[i + 1] x[i + 1] = temp return x num_grades = int(input('Enter How Many Grades You Have: ')) my_grades = input_grades(numGrades) print_grades(numGrades, myGrades) average_grades = avg_grades(numGrades, myGrades) print('Your Average Grade is: ', round(averageGrades)) (high_g, low_g) = high_low_grades(numGrades, myGrades) print('Your Highest Grade is:', highG, 'Your Lowest Grade is:', lowG) sorted_grades = sort_grades(numGrades, myGrades) print('Sorted List of Grades: ', sortedGrades)
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Created by Ross on 2019/8/21 class Solution: def lengthOfLIS(self, nums: List[int]) -> int: dp = [0] * len(nums) if len(nums) == 0: return 0 dp[0] = 1 for i in range(1, len(nums)): maxval = 0 for j in range(0, i): if nums[j] < nums[i]: maxval = max(maxval, dp[j]) dp[i] = maxval + 1 return max(dp) if __name__ == '__main__': s = Solution() print(s.lengthOfLIS(nums=[10, 9, 2, 5, 3, 7, 101, 18]))
class Solution: def length_of_lis(self, nums: List[int]) -> int: dp = [0] * len(nums) if len(nums) == 0: return 0 dp[0] = 1 for i in range(1, len(nums)): maxval = 0 for j in range(0, i): if nums[j] < nums[i]: maxval = max(maxval, dp[j]) dp[i] = maxval + 1 return max(dp) if __name__ == '__main__': s = solution() print(s.lengthOfLIS(nums=[10, 9, 2, 5, 3, 7, 101, 18]))
class TransformationTypeEnum(): __DOUBLE_SIGMOID = "double_sigmoid" __SIGMOID = "sigmoid" __REVERSE_SIGMOID = "reverse_sigmoid" __RIGHT_STEP = "right_step" __LEFT_STEP = "left_step" __STEP = "step" __CUSTOM_INTERPOLATION = "custom_interpolation" __NO_TRANSFORMATION = "no_transformation" @property def DOUBLE_SIGMOID(self): return self.__DOUBLE_SIGMOID @DOUBLE_SIGMOID.setter def DOUBLE_SIGMOID(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def SIGMOID(self): return self.__SIGMOID @SIGMOID.setter def SIGMOID(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def REVERSE_SIGMOID(self): return self.__REVERSE_SIGMOID @REVERSE_SIGMOID.setter def REVERSE_SIGMOID(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def RIGHT_STEP(self): return self.__RIGHT_STEP @RIGHT_STEP.setter def RIGHT_STEP(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def LEFT_STEP(self): return self.__LEFT_STEP @LEFT_STEP.setter def LEFT_STEP(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def STEP(self): return self.__STEP @STEP.setter def STEP(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def CUSTOM_INTERPOLATION(self): return self.__CUSTOM_INTERPOLATION @CUSTOM_INTERPOLATION.setter def CUSTOM_INTERPOLATION(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field") @property def NO_TRANSFORMATION(self): return self.__NO_TRANSFORMATION @NO_TRANSFORMATION.setter def NO_TRANSFORMATION(self, value): raise ValueError("Do not assign value to a TransformationTypeEnum field")
class Transformationtypeenum: __double_sigmoid = 'double_sigmoid' __sigmoid = 'sigmoid' __reverse_sigmoid = 'reverse_sigmoid' __right_step = 'right_step' __left_step = 'left_step' __step = 'step' __custom_interpolation = 'custom_interpolation' __no_transformation = 'no_transformation' @property def double_sigmoid(self): return self.__DOUBLE_SIGMOID @DOUBLE_SIGMOID.setter def double_sigmoid(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def sigmoid(self): return self.__SIGMOID @SIGMOID.setter def sigmoid(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def reverse_sigmoid(self): return self.__REVERSE_SIGMOID @REVERSE_SIGMOID.setter def reverse_sigmoid(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def right_step(self): return self.__RIGHT_STEP @RIGHT_STEP.setter def right_step(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def left_step(self): return self.__LEFT_STEP @LEFT_STEP.setter def left_step(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def step(self): return self.__STEP @STEP.setter def step(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def custom_interpolation(self): return self.__CUSTOM_INTERPOLATION @CUSTOM_INTERPOLATION.setter def custom_interpolation(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field') @property def no_transformation(self): return self.__NO_TRANSFORMATION @NO_TRANSFORMATION.setter def no_transformation(self, value): raise value_error('Do not assign value to a TransformationTypeEnum field')
__author__ = 'yinjun' """ @see http://blog.csdn.net/u011095253/article/details/9248073 @see http://www.jiuzhang.com/solutions/interleaving-string/ """ class Solution: """ @params s1, s2, s3: Three strings as description. @return: return True if s3 is formed by the interleaving of s1 and s2 or False if not. @hint: you can use [[True] * m for i in range (n)] to allocate a n*m matrix. """ def isInterleave(self, s1, s2, s3): # write your code here l1 = len(s1) l2 = len(s2) l3 = len(s3) if l3!=l1+l2: return False dp = [[False for j in range(l2+1)] for i in range(l1+1)] dp[0][0] = True for i in range(1, l1+1): if s3[i-1] == s1[i-1] and dp[i-1][0]: dp[i][0] = True for j in range(1, l2+1): if s3[j-1] == s2[j-1] and dp[0][j-1]: dp[0][j] = True for i in range(1, l1+1): for j in range(1, l2+1): if s3[i+j-1] == s1[i-1] and dp[i-1][j] \ or s3[i+j-1] == s2[j-1] and dp[i][j-1]: dp[i][j] = True return dp[l1][l2]
__author__ = 'yinjun' '\n@see http://blog.csdn.net/u011095253/article/details/9248073\n@see http://www.jiuzhang.com/solutions/interleaving-string/\n' class Solution: """ @params s1, s2, s3: Three strings as description. @return: return True if s3 is formed by the interleaving of s1 and s2 or False if not. @hint: you can use [[True] * m for i in range (n)] to allocate a n*m matrix. """ def is_interleave(self, s1, s2, s3): l1 = len(s1) l2 = len(s2) l3 = len(s3) if l3 != l1 + l2: return False dp = [[False for j in range(l2 + 1)] for i in range(l1 + 1)] dp[0][0] = True for i in range(1, l1 + 1): if s3[i - 1] == s1[i - 1] and dp[i - 1][0]: dp[i][0] = True for j in range(1, l2 + 1): if s3[j - 1] == s2[j - 1] and dp[0][j - 1]: dp[0][j] = True for i in range(1, l1 + 1): for j in range(1, l2 + 1): if s3[i + j - 1] == s1[i - 1] and dp[i - 1][j] or (s3[i + j - 1] == s2[j - 1] and dp[i][j - 1]): dp[i][j] = True return dp[l1][l2]
a = True # Creates a variable set to true while a: # While this variable is true, loop. Used to handle for 2+ word inputs inp = input('Enter ONE word: ') # Takes the users input test = inp.split() # Makes the users input a list of each word, to check how many words are there if len(test) == 1: # If this list has 1 value, then it is only one word, so: a = False # Set a to false so it ends the loop print(inp[::-1]) # Print the reverse of the string [{Beginning}:{End}:-1(Reverse)] else: # If the list does not have 1 value (0 or 2+) then the input is invalid, so: # Ask the user to make a new input, and loop through again. print('Your input was either 2 words, or nothing at all. Please try again :)')
a = True while a: inp = input('Enter ONE word: ') test = inp.split() if len(test) == 1: a = False print(inp[::-1]) else: print('Your input was either 2 words, or nothing at all. Please try again :)')
def main(request, response): type = request.GET.first("type", None) is_revalidation = request.headers.get("If-Modified-Since", None) content = "/* nothing to see here */" response.add_required_headers = False if is_revalidation is not None: response.writer.write_status(304) response.writer.write_header("x-content-type-options", "nosniff") response.writer.write_header("content-length", 0) if(type != None): response.writer.write_header("content-type", type) response.writer.end_headers() response.writer.write("") else: response.writer.write_status(200) response.writer.write_header("x-content-type-options", "nosniff") response.writer.write_header("content-length", len(content)) if(type != None): response.writer.write_header("content-type", type) response.writer.end_headers() response.writer.write(content)
def main(request, response): type = request.GET.first('type', None) is_revalidation = request.headers.get('If-Modified-Since', None) content = '/* nothing to see here */' response.add_required_headers = False if is_revalidation is not None: response.writer.write_status(304) response.writer.write_header('x-content-type-options', 'nosniff') response.writer.write_header('content-length', 0) if type != None: response.writer.write_header('content-type', type) response.writer.end_headers() response.writer.write('') else: response.writer.write_status(200) response.writer.write_header('x-content-type-options', 'nosniff') response.writer.write_header('content-length', len(content)) if type != None: response.writer.write_header('content-type', type) response.writer.end_headers() response.writer.write(content)
def calcula_soma(A: int, B: int): if (not isinstance(A, int) or not isinstance(B, int)): raise TypeError return f'SOMA = {A + B}'
def calcula_soma(A: int, B: int): if not isinstance(A, int) or not isinstance(B, int): raise TypeError return f'SOMA = {A + B}'
# Flask config reference: http://flask.pocoo.org/docs/1.0/config/ # Flask-Sqlalchemy config reference: http://flask-sqlalchemy.pocoo.org/2.3/config/ POSTGRES_ENV_VARS_DEV = { 'user': 'postgres', 'pwd': '1qaz2wsx', 'host': 'jblin', 'port': '5432', 'db': 'postgres', } POSTGRES_ENV_VARS_PRD = { # Set the new variables for production here } class BaseConfig(object): # Flask DEBUG = False TESTING = False SECRET_KEY = "12qwaszx" JSONIFY_MIMETYPE = "application/json" # Flask-Sqlalchemy SQLALCHEMY_DATABASE_URI = "postgresql://%(user)s:%(pwd)s@%(host)s:%(port)s/%(db)s" % POSTGRES_ENV_VARS_DEV SQLALCHEMY_TRACK_MODIFICATIONS = False class DevConfig(BaseConfig): DEBUG = True class TestConfig(BaseConfig): TESTING = True class PrdConfig(BaseConfig): # SQLALCHEMY_DATABASE_URI = "postgresql://%(user)s:%(password)s@%(host)s:%(port)s/%(db)s" % POSTGRES_ENV_VARS_PRD pass
postgres_env_vars_dev = {'user': 'postgres', 'pwd': '1qaz2wsx', 'host': 'jblin', 'port': '5432', 'db': 'postgres'} postgres_env_vars_prd = {} class Baseconfig(object): debug = False testing = False secret_key = '12qwaszx' jsonify_mimetype = 'application/json' sqlalchemy_database_uri = 'postgresql://%(user)s:%(pwd)s@%(host)s:%(port)s/%(db)s' % POSTGRES_ENV_VARS_DEV sqlalchemy_track_modifications = False class Devconfig(BaseConfig): debug = True class Testconfig(BaseConfig): testing = True class Prdconfig(BaseConfig): pass
def sort_address_results(addresses, postcode): ''' # Not to be used. Address Index API should sort for us. If required address object should include the following fields: paoStartNumber = address['nag']['pao']['paoStartNumber'] saoStartNumber = address['nag']['sao']['saoStartNumber'] street_number = paoStartNumber or saoStartNumber or 999999 addresses.append({ 'number': int(street_number), 'address': address['formattedAddress'], 'confidenceScore': address['confidenceScore'], 'underlyingScore': address['underlyingScore'] }) ''' number_of_results = len(addresses) if postcode or number_of_results < 40: sorted_addresses = sorted(addresses, key=lambda k: k['number']) else: sorted_addresses = sorted(addresses, key=lambda k: k['confidenceScore']) return sorted_addresses
def sort_address_results(addresses, postcode): """ # Not to be used. Address Index API should sort for us. If required address object should include the following fields: paoStartNumber = address['nag']['pao']['paoStartNumber'] saoStartNumber = address['nag']['sao']['saoStartNumber'] street_number = paoStartNumber or saoStartNumber or 999999 addresses.append({ 'number': int(street_number), 'address': address['formattedAddress'], 'confidenceScore': address['confidenceScore'], 'underlyingScore': address['underlyingScore'] }) """ number_of_results = len(addresses) if postcode or number_of_results < 40: sorted_addresses = sorted(addresses, key=lambda k: k['number']) else: sorted_addresses = sorted(addresses, key=lambda k: k['confidenceScore']) return sorted_addresses
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/851/A n,k,t = list(map(int,input().split())) print(min(t,n+k-t,k))
(n, k, t) = list(map(int, input().split())) print(min(t, n + k - t, k))
# Ch02-FlowControl-while_break_continue_statements.py # This is an example for while, break, continue statements. # # https://automatetheboringstuff.com/chapter2/ # Flow Control Statements: Lesson 6 - while Loops, break, and continue # # I changed the original code slightly. count = 0 while True: print('What is your name?') name = input() if name != 'Joe': if count > 2: print('Hint: The name should be Joe.') count = count + 1 continue print('Hi, Joe. What is the password?') password = input() if password == 'swordfish': break print('Access granted')
count = 0 while True: print('What is your name?') name = input() if name != 'Joe': if count > 2: print('Hint: The name should be Joe.') count = count + 1 continue print('Hi, Joe. What is the password?') password = input() if password == 'swordfish': break print('Access granted')
#!/bin/python3 # Complete the solve function below. def solve(s): words = s.split(' ') for i in range(len(words)): words[i] = words[i].capitalize() return ' '.join(words) if __name__ == '__main__': s = input() result = solve(s) print(result)
def solve(s): words = s.split(' ') for i in range(len(words)): words[i] = words[i].capitalize() return ' '.join(words) if __name__ == '__main__': s = input() result = solve(s) print(result)
# Assignment 6 # Author: Jignesh Chaudhary, Student Id: 197320 # a) Heapsort: Implement the heapsort algorithm from your textbook (Algorithm 7.5) but modify it so it ends after finding z largest keys # in non-increasing order. You can hardcode the keys to be integer type. Implement test program to provide unsorted integer list, z # value, and outputs the z sorted number of elements. Then analyze the algorithm and provide the analysis using big O notation. class heap: '''This class take array as a input and find z number of largest key in non-increasing order class has method call siftdown, makeheap, removekey and display''' def __init__(self, array, z): '''Constructur which create unsorted array from input and take int z to find z number of largest key in array ''' self.array = [] self.z = z for i in array: self.array.append(i) def siftdown(self, array, i, size): # this method used by makeheap method to arrange array data in proper manner array = self.array leftchild = 2*i+1 rightchild = 2*i+2 parent = i if leftchild <= size-1 and array[leftchild] > array[i]: parent = leftchild if rightchild <= size-1 and array[rightchild] > array[parent]: parent = rightchild if parent != i: largchild = array[i] array[i] = array[parent] array[parent] = largchild self.siftdown(array, parent, size) def makeheap(self): size = len(self.array) J = (size//2)-1 while J>=0: self.siftdown(self.array, J, size) J -= 1 def removekey(self): # this function will run heapsort algorithm for z number of large key end = len(self.array)-1 for i in range(self.z):# modify algorithm root = self.array[0] self.array[0] = self.array[end] self.array[end] = root self.siftdown(self.array, 0, end) end -= 1 def display(self): # to display array result=[] for i in range(1,len(self.array)-1): result.append(self.array[i]) print(self.array) if __name__ == '__main__': z = 4 list = [7,8,5,9,3,2,6,4,1,10] test = heap(list, z) test.display() test.makeheap() test.removekey() test.display()
class Heap: """This class take array as a input and find z number of largest key in non-increasing order class has method call siftdown, makeheap, removekey and display""" def __init__(self, array, z): """Constructur which create unsorted array from input and take int z to find z number of largest key in array """ self.array = [] self.z = z for i in array: self.array.append(i) def siftdown(self, array, i, size): array = self.array leftchild = 2 * i + 1 rightchild = 2 * i + 2 parent = i if leftchild <= size - 1 and array[leftchild] > array[i]: parent = leftchild if rightchild <= size - 1 and array[rightchild] > array[parent]: parent = rightchild if parent != i: largchild = array[i] array[i] = array[parent] array[parent] = largchild self.siftdown(array, parent, size) def makeheap(self): size = len(self.array) j = size // 2 - 1 while J >= 0: self.siftdown(self.array, J, size) j -= 1 def removekey(self): end = len(self.array) - 1 for i in range(self.z): root = self.array[0] self.array[0] = self.array[end] self.array[end] = root self.siftdown(self.array, 0, end) end -= 1 def display(self): result = [] for i in range(1, len(self.array) - 1): result.append(self.array[i]) print(self.array) if __name__ == '__main__': z = 4 list = [7, 8, 5, 9, 3, 2, 6, 4, 1, 10] test = heap(list, z) test.display() test.makeheap() test.removekey() test.display()
def main(str1, str2): m = len(str1) n = len(str2) j = 0 i = 0 while j < m and i < n: if str1[j] == str2[i]: j = j+1 i = i + 1 return j == m str2 = str(input()) N = int(input()) for i in range(N): str1 = str(input()) if main(str1, str2): print("POSITIVE") else: print( "NEGATIVE")
def main(str1, str2): m = len(str1) n = len(str2) j = 0 i = 0 while j < m and i < n: if str1[j] == str2[i]: j = j + 1 i = i + 1 return j == m str2 = str(input()) n = int(input()) for i in range(N): str1 = str(input()) if main(str1, str2): print('POSITIVE') else: print('NEGATIVE')