content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class DeviceTreePartitionSlice(object): """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type model description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not include size of the LVM meta data. lvm_data_offset (long|int): Each LVM partition starts with LVM meta data. After the meta data there can be data for one or more LVM volumes. This field indicates the offset in bytes (relative to partition) where data for various LVM volumes starts on the partition. NOTE: If this device tree represents first LVM volume on the partition, 'lvm_data_offset' is equal to 'offset'. offset (long|int): This is the offset (in bytes) where data for the LVM volume (for which this device tree is being build) starts relative to the start of the partition above. partition_number (int): The partition to use in the disk above. """ # Create a mapping from Model property names to API property names _names = { "disk_file_name":'diskFileName', "length":'length', "lvm_data_offset":'lvmDataOffset', "offset":'offset', "partition_number":'partitionNumber' } def __init__(self, disk_file_name=None, length=None, lvm_data_offset=None, offset=None, partition_number=None): """Constructor for the DeviceTreePartitionSlice class""" # Initialize members of the class self.disk_file_name = disk_file_name self.length = length self.lvm_data_offset = lvm_data_offset self.offset = offset self.partition_number = partition_number @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class. """ if dictionary is None: return None # Extract variables from the dictionary disk_file_name = dictionary.get('diskFileName') length = dictionary.get('length') lvm_data_offset = dictionary.get('lvmDataOffset') offset = dictionary.get('offset') partition_number = dictionary.get('partitionNumber') # Return an object of this model return cls(disk_file_name, length, lvm_data_offset, offset, partition_number)
class Devicetreepartitionslice(object): """Implementation of the 'DeviceTree_PartitionSlice' model. TODO: type model description here. Attributes: disk_file_name (string): The disk to use. length (long|int): The length of data for the LVM volume (for which this device tree is being built) in bytes. It does not include size of the LVM meta data. lvm_data_offset (long|int): Each LVM partition starts with LVM meta data. After the meta data there can be data for one or more LVM volumes. This field indicates the offset in bytes (relative to partition) where data for various LVM volumes starts on the partition. NOTE: If this device tree represents first LVM volume on the partition, 'lvm_data_offset' is equal to 'offset'. offset (long|int): This is the offset (in bytes) where data for the LVM volume (for which this device tree is being build) starts relative to the start of the partition above. partition_number (int): The partition to use in the disk above. """ _names = {'disk_file_name': 'diskFileName', 'length': 'length', 'lvm_data_offset': 'lvmDataOffset', 'offset': 'offset', 'partition_number': 'partitionNumber'} def __init__(self, disk_file_name=None, length=None, lvm_data_offset=None, offset=None, partition_number=None): """Constructor for the DeviceTreePartitionSlice class""" self.disk_file_name = disk_file_name self.length = length self.lvm_data_offset = lvm_data_offset self.offset = offset self.partition_number = partition_number @classmethod def from_dictionary(cls, dictionary): """Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class. """ if dictionary is None: return None disk_file_name = dictionary.get('diskFileName') length = dictionary.get('length') lvm_data_offset = dictionary.get('lvmDataOffset') offset = dictionary.get('offset') partition_number = dictionary.get('partitionNumber') return cls(disk_file_name, length, lvm_data_offset, offset, partition_number)
class Cell(): def __init__(self): self.touched = False self.has_mine = False self.marked = False self.value = 0 def _place_mine(self): self.has_mine = True def touch(self): if not self.marked: self.touched = True return self.has_mine def mark_as_safe(self): if not self.touched: self.marked = True def unmark(self): if self.marked: self.marked = False
class Cell: def __init__(self): self.touched = False self.has_mine = False self.marked = False self.value = 0 def _place_mine(self): self.has_mine = True def touch(self): if not self.marked: self.touched = True return self.has_mine def mark_as_safe(self): if not self.touched: self.marked = True def unmark(self): if self.marked: self.marked = False
# # PySNMP MIB module RUCKUS-VF2825-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RUCKUS-VF2825-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:50:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ruckusVF2825, = mibBuilder.importSymbols("RUCKUS-PRODUCTS-MIB", "ruckusVF2825") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") ModuleIdentity, Bits, Counter64, Unsigned32, Integer32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, iso, MibIdentifier, Gauge32, NotificationType, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Bits", "Counter64", "Unsigned32", "Integer32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "iso", "MibIdentifier", "Gauge32", "NotificationType", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ruckusVF2825MIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1)) if mibBuilder.loadTexts: ruckusVF2825MIB.setLastUpdated('201010150800Z') if mibBuilder.loadTexts: ruckusVF2825MIB.setOrganization('Ruckus Wireless, Inc.') ruckusVF2825Objects = MibIdentifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1)) ruckusVF2825Info = MibIdentifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1)) ruckusVF2825NetworkTable = MibTable((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1), ) if mibBuilder.loadTexts: ruckusVF2825NetworkTable.setStatus('current') ruckusVF2825NetworkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1), ).setIndexNames((0, "RUCKUS-VF2825-MIB", "ruckusVF2825NetworkName"), (0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: ruckusVF2825NetworkEntry.setStatus('current') ruckusVF2825NetworkName = MibTableColumn((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))) if mibBuilder.loadTexts: ruckusVF2825NetworkName.setStatus('current') ruckusVF2825NetworkIfName = MibTableColumn((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: ruckusVF2825NetworkIfName.setStatus('current') ruckusVF2825Events = MibIdentifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 2)) ruckusVF2825Conf = MibIdentifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 3)) ruckusVF2825Groups = MibIdentifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 3, 1)) mibBuilder.exportSymbols("RUCKUS-VF2825-MIB", ruckusVF2825Info=ruckusVF2825Info, ruckusVF2825NetworkIfName=ruckusVF2825NetworkIfName, PYSNMP_MODULE_ID=ruckusVF2825MIB, ruckusVF2825NetworkTable=ruckusVF2825NetworkTable, ruckusVF2825MIB=ruckusVF2825MIB, ruckusVF2825Events=ruckusVF2825Events, ruckusVF2825Conf=ruckusVF2825Conf, ruckusVF2825NetworkEntry=ruckusVF2825NetworkEntry, ruckusVF2825NetworkName=ruckusVF2825NetworkName, ruckusVF2825Groups=ruckusVF2825Groups, ruckusVF2825Objects=ruckusVF2825Objects)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (ruckus_vf2825,) = mibBuilder.importSymbols('RUCKUS-PRODUCTS-MIB', 'ruckusVF2825') (module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup') (module_identity, bits, counter64, unsigned32, integer32, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, ip_address, iso, mib_identifier, gauge32, notification_type, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'Bits', 'Counter64', 'Unsigned32', 'Integer32', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'IpAddress', 'iso', 'MibIdentifier', 'Gauge32', 'NotificationType', 'Counter32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') ruckus_vf2825_mib = module_identity((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1)) if mibBuilder.loadTexts: ruckusVF2825MIB.setLastUpdated('201010150800Z') if mibBuilder.loadTexts: ruckusVF2825MIB.setOrganization('Ruckus Wireless, Inc.') ruckus_vf2825_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1)) ruckus_vf2825_info = mib_identifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1)) ruckus_vf2825_network_table = mib_table((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1)) if mibBuilder.loadTexts: ruckusVF2825NetworkTable.setStatus('current') ruckus_vf2825_network_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1)).setIndexNames((0, 'RUCKUS-VF2825-MIB', 'ruckusVF2825NetworkName'), (0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: ruckusVF2825NetworkEntry.setStatus('current') ruckus_vf2825_network_name = mib_table_column((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 16))) if mibBuilder.loadTexts: ruckusVF2825NetworkName.setStatus('current') ruckus_vf2825_network_if_name = mib_table_column((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 16))).setMaxAccess('readonly') if mibBuilder.loadTexts: ruckusVF2825NetworkIfName.setStatus('current') ruckus_vf2825_events = mib_identifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 2)) ruckus_vf2825_conf = mib_identifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 3)) ruckus_vf2825_groups = mib_identifier((1, 3, 6, 1, 4, 1, 25053, 3, 1, 1, 1, 1, 3, 1)) mibBuilder.exportSymbols('RUCKUS-VF2825-MIB', ruckusVF2825Info=ruckusVF2825Info, ruckusVF2825NetworkIfName=ruckusVF2825NetworkIfName, PYSNMP_MODULE_ID=ruckusVF2825MIB, ruckusVF2825NetworkTable=ruckusVF2825NetworkTable, ruckusVF2825MIB=ruckusVF2825MIB, ruckusVF2825Events=ruckusVF2825Events, ruckusVF2825Conf=ruckusVF2825Conf, ruckusVF2825NetworkEntry=ruckusVF2825NetworkEntry, ruckusVF2825NetworkName=ruckusVF2825NetworkName, ruckusVF2825Groups=ruckusVF2825Groups, ruckusVF2825Objects=ruckusVF2825Objects)
# Created by MechAviv # ID :: [865090001] # Commerci Republic : Berry if sm.hasQuest(17613): # [Commerci Republic] The Minister's Son sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendNext("Hey! Keep your paws away from my pants!") sm.setSpeakerID(9390242) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("All your fish are belong to us!") sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("I am the great #e#bLeon Daniella#k#n! These fish are mine! See? I wrote my name on them.") sm.setSpeakerID(9390242) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("Your permanent marker won't dissuade us. WE WANT YOUR FISH!") sm.showNpcSpecialActionByTemplateId(9390241, "q17613", 0) sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("It's not fair if you attack me as a pack. Do it one by one, like a real man, er, cat. Hey! Are you listening? Ouch!") sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendSay("#b(Uh oh, that guy's in real trouble. I should help him.#k\r\nHey! Coastal Cats! Over here.") sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(False, True, False, False) i = 0 while i < 12: sm.spawnMob(9390847, 996, 132, False) i += 1
if sm.hasQuest(17613): sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendNext('Hey! Keep your paws away from my pants!') sm.setSpeakerID(9390242) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay('All your fish are belong to us!') sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay('I am the great #e#bLeon Daniella#k#n! These fish are mine! See? I wrote my name on them.') sm.setSpeakerID(9390242) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("Your permanent marker won't dissuade us. WE WANT YOUR FISH!") sm.showNpcSpecialActionByTemplateId(9390241, 'q17613', 0) sm.setSpeakerID(9390241) sm.removeEscapeButton() sm.flipDialogue() sm.setSpeakerType(3) sm.sendSay("It's not fair if you attack me as a pack. Do it one by one, like a real man, er, cat. Hey! Are you listening? Ouch!") sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendSay("#b(Uh oh, that guy's in real trouble. I should help him.#k\r\nHey! Coastal Cats! Over here.") sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(False, True, False, False) i = 0 while i < 12: sm.spawnMob(9390847, 996, 132, False) i += 1
class Solution: def totalMoney(self, n: int) -> int: s, m, p, t = 0, 0, 0, 0 while t < n: if t % 7 == 0: m += 1 s += m p = m else: p += 1 s += p t += 1 return s
class Solution: def total_money(self, n: int) -> int: (s, m, p, t) = (0, 0, 0, 0) while t < n: if t % 7 == 0: m += 1 s += m p = m else: p += 1 s += p t += 1 return s
SIG_START_DEFAULT = 0 SIG_UNDEF = 'undefined' class Signal(object): def __init__(self, name, start_state=None): self.name = name if start_state is not None: self.state = start_state else: self.state = SIG_START_DEFAULT self.previous = self.state self.conns = list() def __str__(self): msg = 'Sig<{}={}>' return msg.format( self.name, self.state) def set(self, time, state): self.previous = self.state self.state = state for conn in self.conns: # TODO: should really send only the state, not itself ?? # current form for access to .state and .previous (?.name? : not really) # NEEDED for trace, in current form. But device tracing is nicer ... conn(time, self) def add_connection(self, call, index=-1): self.conns[index:index] = [call] def remove_connection(self, call): while call in conns: self.conns.remove(call) def trace(self): self.add_connection(signal_trace, 0) def untrace(self): self.conns.remove(signal_trace) def signal_trace(time, sig): msg = '@{}: Sig<{}> {} ==> {}' msg = msg.format( time, sig.name, sig.previous, sig.state) print(msg) def trace(signal, on=True): if on: signal.add_connection(signal_trace) else: signal.conns.remove(signal_trace) def untrace(signal): trace(signal, False)
sig_start_default = 0 sig_undef = 'undefined' class Signal(object): def __init__(self, name, start_state=None): self.name = name if start_state is not None: self.state = start_state else: self.state = SIG_START_DEFAULT self.previous = self.state self.conns = list() def __str__(self): msg = 'Sig<{}={}>' return msg.format(self.name, self.state) def set(self, time, state): self.previous = self.state self.state = state for conn in self.conns: conn(time, self) def add_connection(self, call, index=-1): self.conns[index:index] = [call] def remove_connection(self, call): while call in conns: self.conns.remove(call) def trace(self): self.add_connection(signal_trace, 0) def untrace(self): self.conns.remove(signal_trace) def signal_trace(time, sig): msg = '@{}: Sig<{}> {} ==> {}' msg = msg.format(time, sig.name, sig.previous, sig.state) print(msg) def trace(signal, on=True): if on: signal.add_connection(signal_trace) else: signal.conns.remove(signal_trace) def untrace(signal): trace(signal, False)
class Solution: def replaceWords(self, dict, sentence): """ :type dict: List[str] :type sentence: str :rtype: str """ s = set(dict) sentence = sentence.split() for j, w in enumerate(sentence): for i in range(1, len(w)): if w[:i] in s: sentence[j] = w[:i] break return " ".join(sentence)
class Solution: def replace_words(self, dict, sentence): """ :type dict: List[str] :type sentence: str :rtype: str """ s = set(dict) sentence = sentence.split() for (j, w) in enumerate(sentence): for i in range(1, len(w)): if w[:i] in s: sentence[j] = w[:i] break return ' '.join(sentence)
# # PySNMP MIB module DE-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DE-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:21:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") IpAddress, enterprises, Bits, iso, TimeTicks, ModuleIdentity, Gauge32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, NotificationType, MibIdentifier, Counter32, Unsigned32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "enterprises", "Bits", "iso", "TimeTicks", "ModuleIdentity", "Gauge32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "NotificationType", "MibIdentifier", "Counter32", "Unsigned32", "Counter64") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") codex = MibIdentifier((1, 3, 6, 1, 4, 1, 449)) cdxProductSpecific = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2)) cdx6500 = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1)) cdx6500Configuration = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2)) cdx6500CfgGeneralGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2)) cdx6500Statistics = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3)) cdx6500StatOtherStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2)) cdx6500Controls = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4)) class DisplayString(OctetString): pass cdx6500StatEncryption = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12)) statEncryptionGeneral = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1)) deDataEncryptionHardwareStatus = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: deDataEncryptionHardwareStatus.setStatus('mandatory') deMaxChannelAvailable = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 500))).setMaxAccess("readonly") if mibBuilder.loadTexts: deMaxChannelAvailable.setStatus('mandatory') deMaxChannelConfigured = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 500))).setMaxAccess("readonly") if mibBuilder.loadTexts: deMaxChannelConfigured.setStatus('mandatory') deChannelsInUse = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 500))).setMaxAccess("readonly") if mibBuilder.loadTexts: deChannelsInUse.setStatus('mandatory') deMaxSimultaneousChannelsUsed = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 500))).setMaxAccess("readonly") if mibBuilder.loadTexts: deMaxSimultaneousChannelsUsed.setStatus('mandatory') deCurrentEncryptionQueueLength = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: deCurrentEncryptionQueueLength.setStatus('mandatory') deMaxEncryptionQueueDepth = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: deMaxEncryptionQueueDepth.setStatus('mandatory') deTimeLastStatisticsReset = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deTimeLastStatisticsReset.setStatus('mandatory') deAlgorithmSupportedByHardwareStatus = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("no-simm", 1), ("des-40", 2), ("des-64", 3), ("des-128", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: deAlgorithmSupportedByHardwareStatus.setStatus('mandatory') statEncryptionChannelTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2), ) if mibBuilder.loadTexts: statEncryptionChannelTable.setStatus('mandatory') statEncryptionChannelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1), ).setIndexNames((0, "DE-OPT-MIB", "deStatChannelNumber")) if mibBuilder.loadTexts: statEncryptionChannelEntry.setStatus('mandatory') deStatChannelNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: deStatChannelNumber.setStatus('mandatory') deLastStatisticsReset = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deLastStatisticsReset.setStatus('mandatory') deChannelState = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("nonData", 1), ("data", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: deChannelState.setStatus('mandatory') deSourceChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deSourceChannel.setStatus('mandatory') deDestinationChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deDestinationChannel.setStatus('mandatory') deCorruptedPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: deCorruptedPackets.setStatus('mandatory') cdx6500ControlsEncryption = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18)) ctrlEncryptionGeneral = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 1)) deCtrlEncryptionGeneral = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("resetStatistics", 1)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: deCtrlEncryptionGeneral.setStatus('mandatory') ctrlEncryptionChannelTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2), ) if mibBuilder.loadTexts: ctrlEncryptionChannelTable.setStatus('mandatory') ctrlEncryptionChannelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1), ).setIndexNames((0, "DE-OPT-MIB", "deCtrlChannelNumber")) if mibBuilder.loadTexts: ctrlEncryptionChannelEntry.setStatus('mandatory') deCtrlChannelNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1, 1), Integer32()) if mibBuilder.loadTexts: deCtrlChannelNumber.setStatus('mandatory') deCtrlEncryptionChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("resetStatistics", 1)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: deCtrlEncryptionChannel.setStatus('mandatory') mibBuilder.exportSymbols("DE-OPT-MIB", statEncryptionChannelEntry=statEncryptionChannelEntry, cdx6500StatOtherStatsGroup=cdx6500StatOtherStatsGroup, deChannelsInUse=deChannelsInUse, deCorruptedPackets=deCorruptedPackets, statEncryptionGeneral=statEncryptionGeneral, deStatChannelNumber=deStatChannelNumber, ctrlEncryptionChannelTable=ctrlEncryptionChannelTable, statEncryptionChannelTable=statEncryptionChannelTable, deDataEncryptionHardwareStatus=deDataEncryptionHardwareStatus, deCtrlChannelNumber=deCtrlChannelNumber, cdx6500Configuration=cdx6500Configuration, deDestinationChannel=deDestinationChannel, cdx6500StatEncryption=cdx6500StatEncryption, codex=codex, ctrlEncryptionGeneral=ctrlEncryptionGeneral, cdx6500Statistics=cdx6500Statistics, ctrlEncryptionChannelEntry=ctrlEncryptionChannelEntry, cdx6500CfgGeneralGroup=cdx6500CfgGeneralGroup, cdx6500Controls=cdx6500Controls, cdx6500=cdx6500, deMaxChannelAvailable=deMaxChannelAvailable, deMaxChannelConfigured=deMaxChannelConfigured, deSourceChannel=deSourceChannel, DisplayString=DisplayString, deMaxSimultaneousChannelsUsed=deMaxSimultaneousChannelsUsed, deCurrentEncryptionQueueLength=deCurrentEncryptionQueueLength, deLastStatisticsReset=deLastStatisticsReset, deMaxEncryptionQueueDepth=deMaxEncryptionQueueDepth, cdx6500ControlsEncryption=cdx6500ControlsEncryption, deCtrlEncryptionChannel=deCtrlEncryptionChannel, deAlgorithmSupportedByHardwareStatus=deAlgorithmSupportedByHardwareStatus, deCtrlEncryptionGeneral=deCtrlEncryptionGeneral, cdxProductSpecific=cdxProductSpecific, deTimeLastStatisticsReset=deTimeLastStatisticsReset, deChannelState=deChannelState)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (ip_address, enterprises, bits, iso, time_ticks, module_identity, gauge32, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, notification_type, mib_identifier, counter32, unsigned32, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'enterprises', 'Bits', 'iso', 'TimeTicks', 'ModuleIdentity', 'Gauge32', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'NotificationType', 'MibIdentifier', 'Counter32', 'Unsigned32', 'Counter64') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') codex = mib_identifier((1, 3, 6, 1, 4, 1, 449)) cdx_product_specific = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2)) cdx6500 = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1)) cdx6500_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2)) cdx6500_cfg_general_group = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2)) cdx6500_statistics = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3)) cdx6500_stat_other_stats_group = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2)) cdx6500_controls = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4)) class Displaystring(OctetString): pass cdx6500_stat_encryption = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12)) stat_encryption_general = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1)) de_data_encryption_hardware_status = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('up', 1), ('down', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: deDataEncryptionHardwareStatus.setStatus('mandatory') de_max_channel_available = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(10, 500))).setMaxAccess('readonly') if mibBuilder.loadTexts: deMaxChannelAvailable.setStatus('mandatory') de_max_channel_configured = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 500))).setMaxAccess('readonly') if mibBuilder.loadTexts: deMaxChannelConfigured.setStatus('mandatory') de_channels_in_use = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 500))).setMaxAccess('readonly') if mibBuilder.loadTexts: deChannelsInUse.setStatus('mandatory') de_max_simultaneous_channels_used = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 500))).setMaxAccess('readonly') if mibBuilder.loadTexts: deMaxSimultaneousChannelsUsed.setStatus('mandatory') de_current_encryption_queue_length = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: deCurrentEncryptionQueueLength.setStatus('mandatory') de_max_encryption_queue_depth = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: deMaxEncryptionQueueDepth.setStatus('mandatory') de_time_last_statistics_reset = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: deTimeLastStatisticsReset.setStatus('mandatory') de_algorithm_supported_by_hardware_status = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('no-simm', 1), ('des-40', 2), ('des-64', 3), ('des-128', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: deAlgorithmSupportedByHardwareStatus.setStatus('mandatory') stat_encryption_channel_table = mib_table((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2)) if mibBuilder.loadTexts: statEncryptionChannelTable.setStatus('mandatory') stat_encryption_channel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1)).setIndexNames((0, 'DE-OPT-MIB', 'deStatChannelNumber')) if mibBuilder.loadTexts: statEncryptionChannelEntry.setStatus('mandatory') de_stat_channel_number = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: deStatChannelNumber.setStatus('mandatory') de_last_statistics_reset = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: deLastStatisticsReset.setStatus('mandatory') de_channel_state = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('nonData', 1), ('data', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: deChannelState.setStatus('mandatory') de_source_channel = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 4), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: deSourceChannel.setStatus('mandatory') de_destination_channel = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 5), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: deDestinationChannel.setStatus('mandatory') de_corrupted_packets = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 3, 2, 12, 2, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: deCorruptedPackets.setStatus('mandatory') cdx6500_controls_encryption = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18)) ctrl_encryption_general = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 1)) de_ctrl_encryption_general = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('resetStatistics', 1)))).setMaxAccess('writeonly') if mibBuilder.loadTexts: deCtrlEncryptionGeneral.setStatus('mandatory') ctrl_encryption_channel_table = mib_table((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2)) if mibBuilder.loadTexts: ctrlEncryptionChannelTable.setStatus('mandatory') ctrl_encryption_channel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1)).setIndexNames((0, 'DE-OPT-MIB', 'deCtrlChannelNumber')) if mibBuilder.loadTexts: ctrlEncryptionChannelEntry.setStatus('mandatory') de_ctrl_channel_number = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1, 1), integer32()) if mibBuilder.loadTexts: deCtrlChannelNumber.setStatus('mandatory') de_ctrl_encryption_channel = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 4, 18, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('resetStatistics', 1)))).setMaxAccess('writeonly') if mibBuilder.loadTexts: deCtrlEncryptionChannel.setStatus('mandatory') mibBuilder.exportSymbols('DE-OPT-MIB', statEncryptionChannelEntry=statEncryptionChannelEntry, cdx6500StatOtherStatsGroup=cdx6500StatOtherStatsGroup, deChannelsInUse=deChannelsInUse, deCorruptedPackets=deCorruptedPackets, statEncryptionGeneral=statEncryptionGeneral, deStatChannelNumber=deStatChannelNumber, ctrlEncryptionChannelTable=ctrlEncryptionChannelTable, statEncryptionChannelTable=statEncryptionChannelTable, deDataEncryptionHardwareStatus=deDataEncryptionHardwareStatus, deCtrlChannelNumber=deCtrlChannelNumber, cdx6500Configuration=cdx6500Configuration, deDestinationChannel=deDestinationChannel, cdx6500StatEncryption=cdx6500StatEncryption, codex=codex, ctrlEncryptionGeneral=ctrlEncryptionGeneral, cdx6500Statistics=cdx6500Statistics, ctrlEncryptionChannelEntry=ctrlEncryptionChannelEntry, cdx6500CfgGeneralGroup=cdx6500CfgGeneralGroup, cdx6500Controls=cdx6500Controls, cdx6500=cdx6500, deMaxChannelAvailable=deMaxChannelAvailable, deMaxChannelConfigured=deMaxChannelConfigured, deSourceChannel=deSourceChannel, DisplayString=DisplayString, deMaxSimultaneousChannelsUsed=deMaxSimultaneousChannelsUsed, deCurrentEncryptionQueueLength=deCurrentEncryptionQueueLength, deLastStatisticsReset=deLastStatisticsReset, deMaxEncryptionQueueDepth=deMaxEncryptionQueueDepth, cdx6500ControlsEncryption=cdx6500ControlsEncryption, deCtrlEncryptionChannel=deCtrlEncryptionChannel, deAlgorithmSupportedByHardwareStatus=deAlgorithmSupportedByHardwareStatus, deCtrlEncryptionGeneral=deCtrlEncryptionGeneral, cdxProductSpecific=cdxProductSpecific, deTimeLastStatisticsReset=deTimeLastStatisticsReset, deChannelState=deChannelState)
# Ingredient Adjuster # Ask user how many cookies he or she wants cookie = int(input("Enter the amount of cookies you want: ")) sugar = 1.5 oil = 1 pounder = 2.75 print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep="")
cookie = int(input('Enter the amount of cookies you want: ')) sugar = 1.5 oil = 1 pounder = 2.75 print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep='')
""" EXAMPLE USAGE: opts = Opts(environ, opt('q', default=''), opt('pages', default=2), opt('split', default=0), opt('simple', default=0), opt('max_topics', default=40), opt('ncol', default=3), opt('save', default=False), opt('load', default=False), opt('smoothing', default='lidstone'), opt('single_query', default=0), opt('format', default='dev'), ) ... then opts is a hash. """ #### first, from anyall.org/util.py def safehtml(x): return cgi.escape(str(x),quote=True) def unicodify(s, encoding='utf8', *args): """ because {str,unicode}.{encode,decode} is anti-polymorphic, but sometimes you can't control which you have. """ if isinstance(s,unicode): return s if isinstance(s,str): return s.decode(encoding, *args) return unicode(s) class Struct(dict): def __getattr__(self, a): if a.startswith('__'): raise AttributeError return self[a] def __setattr__(self, a, v): self[a] = v #### main code type_builtin = type def opt(name, type=None, default=None): o = Struct(name=name, type=type, default=default) if type is None: if default is not None: o.type = type_builtin(default) else: o.type = str #raise Exception("need type for %s" % name) #if o.type==bool: o.type=int return o def type_clean(val,type): if type==bool: if val in (False,0,'0','f','false','False','no','n'): return False if val in (True,1,'1','t','true','True','yes','y'): return True raise Exception("bad bool value %s" % repr(val)) if type==str or type==unicode: # nope no strings, you're gonna get unicode instead! return unicodify(val) return type(val) class Opts(Struct): " modelled on trollop.rubyforge.org and gist.github.com/5682 " def __init__(self, environ, *optlist): vars = cgi.parse_qs(environ['QUERY_STRING']) for opt in optlist: val = vars.get(opt.name) val = val[0] if val else None if val is None and opt.default is not None: val = copy(opt.default) elif val is None: raise Exception("option not given: %s" % opt.name) val = type_clean(val, opt.type) self[opt.name] = val def input(self, name, **kwargs): val = self[name] h = '''<input id=%s name=%s value="%s"''' % (name, name, safehtml(val)) more = {} if type(val)==int: more['size'] = 2 elif type(val)==float: more['size'] = 4 more.update(kwargs) for k,v in more.iteritems(): h += ''' %s="%s"''' % (k,v) h += ">" return h
""" EXAMPLE USAGE: opts = Opts(environ, opt('q', default=''), opt('pages', default=2), opt('split', default=0), opt('simple', default=0), opt('max_topics', default=40), opt('ncol', default=3), opt('save', default=False), opt('load', default=False), opt('smoothing', default='lidstone'), opt('single_query', default=0), opt('format', default='dev'), ) ... then opts is a hash. """ def safehtml(x): return cgi.escape(str(x), quote=True) def unicodify(s, encoding='utf8', *args): """ because {str,unicode}.{encode,decode} is anti-polymorphic, but sometimes you can't control which you have. """ if isinstance(s, unicode): return s if isinstance(s, str): return s.decode(encoding, *args) return unicode(s) class Struct(dict): def __getattr__(self, a): if a.startswith('__'): raise AttributeError return self[a] def __setattr__(self, a, v): self[a] = v type_builtin = type def opt(name, type=None, default=None): o = struct(name=name, type=type, default=default) if type is None: if default is not None: o.type = type_builtin(default) else: o.type = str return o def type_clean(val, type): if type == bool: if val in (False, 0, '0', 'f', 'false', 'False', 'no', 'n'): return False if val in (True, 1, '1', 't', 'true', 'True', 'yes', 'y'): return True raise exception('bad bool value %s' % repr(val)) if type == str or type == unicode: return unicodify(val) return type(val) class Opts(Struct): """ modelled on trollop.rubyforge.org and gist.github.com/5682 """ def __init__(self, environ, *optlist): vars = cgi.parse_qs(environ['QUERY_STRING']) for opt in optlist: val = vars.get(opt.name) val = val[0] if val else None if val is None and opt.default is not None: val = copy(opt.default) elif val is None: raise exception('option not given: %s' % opt.name) val = type_clean(val, opt.type) self[opt.name] = val def input(self, name, **kwargs): val = self[name] h = '<input id=%s name=%s value="%s"' % (name, name, safehtml(val)) more = {} if type(val) == int: more['size'] = 2 elif type(val) == float: more['size'] = 4 more.update(kwargs) for (k, v) in more.iteritems(): h += ' %s="%s"' % (k, v) h += '>' return h
# Advent of Code 2021, Day 17 # # Simple projectile simulation, with search for # velocities that achieve highest position, and total # number of possible velocity values that reach target # area; just used a simple grid search. # # AK, 17/12/2021 # Target area (x range and y range) T = ((20,30), (-10, -5)) # Sample data T = ((192, 251), (-89, -59)) # Real data # Determine whether coordinates are within target area def withinTarget(x, y): return x >= T[0][0] and x <= T[0][1] and y >= T[1][0] and y <= T[1][1] # Returns the highest position achieved def simulate(xv, yv): # Start at 0,0 #print(f'Simulating {xv}, {yv}') x = y = 0 highest = -99999 # Highest y reached, for Part 1 hitTarget = False # Whether or not hit target area # Simulate steps iter = 0 while iter < 300: # Stop after lots of iterations # Position changes according to velocity iter += 1 x += xv y += yv # Record highest position if iter == 0 or y > highest: highest = y # Adjust velocity if xv > 0: xv -= 1 elif xv < 0: xv += 1 yv -= 1 #print(f' Position = {x},{y}, velocity = {xv},{yv}') # Stop if reached target area if withinTarget(x, y): #print(' Within target!') hitTarget = True break # If hit target, return highest position reached, otherwise # return None #print(' Highest y =', highest) return highest if hitTarget else None # Simple pseudo-optimization, just a grid search, finds # the highest position reached (for Part 1) and also counts # up the number of solutions that hit target (for Part 2) def optimize(): best = count = 0 for xv in range(0, 300): # Set bounds range of problem for yv in range(-100, 100): ypos = simulate(xv, yv) if ypos != None: # Only count if hit target if ypos > best: best = ypos count += 1 print('Best found =', best) print('Solutions found =', count) # Test examples #for xv, yv in [(7, 2), (6, 3), (9, 0), (17, -4), (6, 9)]: # print(xv, yv, simulate(xv, yv)) # Run the solution optimize()
t = ((20, 30), (-10, -5)) t = ((192, 251), (-89, -59)) def within_target(x, y): return x >= T[0][0] and x <= T[0][1] and (y >= T[1][0]) and (y <= T[1][1]) def simulate(xv, yv): x = y = 0 highest = -99999 hit_target = False iter = 0 while iter < 300: iter += 1 x += xv y += yv if iter == 0 or y > highest: highest = y if xv > 0: xv -= 1 elif xv < 0: xv += 1 yv -= 1 if within_target(x, y): hit_target = True break return highest if hitTarget else None def optimize(): best = count = 0 for xv in range(0, 300): for yv in range(-100, 100): ypos = simulate(xv, yv) if ypos != None: if ypos > best: best = ypos count += 1 print('Best found =', best) print('Solutions found =', count) optimize()
class Person(object): def __init__(self, name, age): self.name=name self.age=age def get_person(self,): return "Hi" print("hi")
class Person(object): def __init__(self, name, age): self.name = name self.age = age def get_person(self): return 'Hi' print('hi')
class Book: def __init__(self, title, price, author): self.title = title self.author = author self.price = price def __eq__(self, other): if not isinstance(other,Book): raise ValueError("Couldn't compare book to non-book") return (self.title == other.title and self.price == other.price and self.author == other.author) def __ge__(self, other): if not isinstance(other,Book): raise ValueError("Couldn't compare book to non-book") return self.price >= other.price def __lt__(self, other): if not isinstance(other,Book): raise ValueError("Couldn't compare book to non-book") return self.price < other.price obj1 = Book("Ramayan", 9999,"Valmiki") obj2 = Book("MahaBharat", 7777, "Vyasa") obj3 = Book("Ramayan", 9999,"Valmiki") obj4 = Book("Bhagavatam", 5789, "Vyasa") print(obj1==obj3) print(obj1 >= obj2) print(obj1 < obj2) books = [obj4,obj3,obj2,obj1] books.sort() print([book.title for book in books])
class Book: def __init__(self, title, price, author): self.title = title self.author = author self.price = price def __eq__(self, other): if not isinstance(other, Book): raise value_error("Couldn't compare book to non-book") return self.title == other.title and self.price == other.price and (self.author == other.author) def __ge__(self, other): if not isinstance(other, Book): raise value_error("Couldn't compare book to non-book") return self.price >= other.price def __lt__(self, other): if not isinstance(other, Book): raise value_error("Couldn't compare book to non-book") return self.price < other.price obj1 = book('Ramayan', 9999, 'Valmiki') obj2 = book('MahaBharat', 7777, 'Vyasa') obj3 = book('Ramayan', 9999, 'Valmiki') obj4 = book('Bhagavatam', 5789, 'Vyasa') print(obj1 == obj3) print(obj1 >= obj2) print(obj1 < obj2) books = [obj4, obj3, obj2, obj1] books.sort() print([book.title for book in books])
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012, Piston Cloud Computing, Inc. # 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 validate(filter, value): return FILTER_FUNCTIONS.get(filter, lambda v: True)(value) def validate_int_in_range(min=0, max=None): def _validator(v): try: if max is None: return min <= int(v) return min <= int(v) <= max except ValueError: return False return _validator def validate_boolean(v): return v.lower() in ('none', 'true', 'false', '1', '0') FILTER_FUNCTIONS = {'size_max': validate_int_in_range(), # build validator 'size_min': validate_int_in_range(), # build validator 'min_ram': validate_int_in_range(), # build validator 'protected': validate_boolean, 'is_public': validate_boolean, }
def validate(filter, value): return FILTER_FUNCTIONS.get(filter, lambda v: True)(value) def validate_int_in_range(min=0, max=None): def _validator(v): try: if max is None: return min <= int(v) return min <= int(v) <= max except ValueError: return False return _validator def validate_boolean(v): return v.lower() in ('none', 'true', 'false', '1', '0') filter_functions = {'size_max': validate_int_in_range(), 'size_min': validate_int_in_range(), 'min_ram': validate_int_in_range(), 'protected': validate_boolean, 'is_public': validate_boolean}
''' Example 1: Input: N = 5, arr = {1, 2, 3, 2, 1} Output: 3 Explaination: Only the number 3 is single. Example 2: Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6} Output: 4 Explaination: 4 is the only single. ''' class Solution: def findSingle(self, N, arr): # code here m = 0 for i in arr: m ^= i return m
""" Example 1: Input: N = 5, arr = {1, 2, 3, 2, 1} Output: 3 Explaination: Only the number 3 is single. Example 2: Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6} Output: 4 Explaination: 4 is the only single. """ class Solution: def find_single(self, N, arr): m = 0 for i in arr: m ^= i return m
class RecordNotFound(Exception): pass class InvalidLEI(Exception): pass class InvalidISIN(Exception): pass class NotFound(Exception): pass
class Recordnotfound(Exception): pass class Invalidlei(Exception): pass class Invalidisin(Exception): pass class Notfound(Exception): pass
N=int(input("Ingresa un numero base pls:")) M=int(input("Ingresa una potencia pls:")) print("LOS RESULTADOS SON:") for i in range(0,M+1): print(f"{N}^{i} = " + str(N**i))
n = int(input('Ingresa un numero base pls:')) m = int(input('Ingresa una potencia pls:')) print('LOS RESULTADOS SON:') for i in range(0, M + 1): print(f'{N}^{i} = ' + str(N ** i))
def main(): print("Please enter filename:") filename = input() f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt') f.write('{\n') f.write(' "parent": "forbidden:item/base_item",\n') f.write(' "textures": {\n') f.write(' "layer0": "forbidden:items/' + filename + '"\n') f.write(' }\n') f.write('}') f.close() main()
def main(): print('Please enter filename:') filename = input() f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt') f.write('{\n') f.write(' "parent": "forbidden:item/base_item",\n') f.write(' "textures": {\n') f.write(' "layer0": "forbidden:items/' + filename + '"\n') f.write(' }\n') f.write('}') f.close() main()
#show function logs all attempts on console and in out.txt file out = open("out.txt", 'w+') def show(line): li = "" for i in line: for j in i: li += str(j) + " " li += "\n" print(li) out.write(li) out.write("\n")
out = open('out.txt', 'w+') def show(line): li = '' for i in line: for j in i: li += str(j) + ' ' li += '\n' print(li) out.write(li) out.write('\n')
print() print("-- RELATIONS ------------------------------") print() print("GRAPH 1:\n0 0 0\n0 0 0\n0 0 0") g1 = Graph(3) print("REFLEXIVITA: " + str(is_reflexive(g1)) + " -> spravna odpoved: False") print("SYMETRIE: " + str(is_symmetric(g1)) + " -> spravna odpoved: True") print("ANTISYMETRIE: " + str(is_antisymmetric(g1)) + " -> spravna odpoved: True") print("TRANZITIVITA: " + str(is_transitive(g1)) + " -> spravna odpoved: True") print("-------------------------------------------") print("GRAPH 2:\n1 0 0\n0 1 0\n0 0 1") g2 = Graph(3) g2.matrix[0][0] = True g2.matrix[1][1] = True g2.matrix[2][2] = True print("REFLEXIVITA: " + str(is_reflexive(g2)) + " -> spravna odpoved: True") print("SYMETRIE: " + str(is_symmetric(g2)) + " -> spravna odpoved: True") print("ANTISYMETRIE: " + str(is_antisymmetric(g2)) + " -> spravna odpoved: False") print("TRANZITIVITA: " + str(is_transitive(g2)) + " -> spravna odpoved: True") print("- GOOD GRAPHS -----------------------------") print("GRAPH 3:\n0 0 0\n0 1 0\n0 1 1") g3 = Graph(3) g3.matrix[1][1] = True g3.matrix[2][1] = True g3.matrix[2][2] = True print("REFLEXIVITA: " + str(is_reflexive(g3)) + " -> spravna odpoved: False") print("SYMETRIE: " + str(is_symmetric(g3)) + " -> spravna odpoved: False") print("ANTISYMETRIE: " + str(is_antisymmetric(g3)) + " -> spravna odpoved: True") print("TRANZITIVITA: " + str(is_transitive(g3)) + " -> spravna odpoved: True") print("-------------------------------------------") print("GRAPH 4:\n0 1 1\n0 1 1\n0 0 1") g4 = Graph(3) g4.matrix[0][1] = True g4.matrix[0][2] = True g4.matrix[1][1] = True g4.matrix[1][2] = True g4.matrix[2][2] = True print("REFLEXIVITA: " + str(is_reflexive(g4)) + " -> spravna odpoved: False") print("SYMETRIE: " + str(is_symmetric(g4)) + " -> spravna odpoved: False") print("ANTISYMETRIE: " + str(is_antisymmetric(g4)) + " -> spravna odpoved: True") print("TRANZITIVITA: " + str(is_transitive(g4)) + " -> spravna odpoved: True") print("-------------------------------------------") print("GRAPH 5:\n1 0 0\n0 0 0\n1 0 0") g5 = Graph(3) g5.matrix[0][0] = True g5.matrix[2][0] = True print("REFLEXIVITA: " + str(is_reflexive(g5)) + " -> spravna odpoved: False") print("SYMETRIE: " + str(is_symmetric(g5)) + " -> spravna odpoved: False") print("ANTISYMETRIE: " + str(is_antisymmetric(g5)) + " -> spravna odpoved: True") print("TRANZITIVITA: " + str(is_transitive(g5)) + " -> spravna odpoved: True") print("-------------------------------------------") print("GRAPH 6:\n1 0 0\n1 1 0\n0 1 1") g6 = Graph(3) g6.matrix[0][0] = True g6.matrix[1][0] = True g6.matrix[1][1] = True g6.matrix[2][1] = True g6.matrix[2][2] = True print("REFLEXIVITA: " + str(is_reflexive(g6)) + " -> spravna odpoved: True") print("SYMETRIE: " + str(is_symmetric(g6)) + " -> spravna odpoved: False") print("ANTISYMETRIE: " + str(is_antisymmetric(g6)) + " -> spravna odpoved: True") print("TRANZITIVITA: " + str(is_transitive(g6)) + " -> spravna odpoved: False") print() print("- TRANSITIVE CLOSURE -------------------------") print() print("GRAPH 7:\n1 0 0\n1 1 0\n0 1 1") g7 = Graph(3) g7.matrix[0][0] = True g7.matrix[1][0] = True g7.matrix[1][1] = True g7.matrix[2][1] = True g7.matrix[2][2] = True print("TRANZITIVITA: " + str(is_transitive(g7)) + " -> spravna odpoved: False") transitive_closure(g7) print(str(g7.matrix)) print("TRANZITIVITA: " + str(is_transitive(g7)) + " -> spravna odpoved: True")
print() print('-- RELATIONS ------------------------------') print() print('GRAPH 1:\n0 0 0\n0 0 0\n0 0 0') g1 = graph(3) print('REFLEXIVITA: ' + str(is_reflexive(g1)) + ' -> spravna odpoved: False') print('SYMETRIE: ' + str(is_symmetric(g1)) + ' -> spravna odpoved: True') print('ANTISYMETRIE: ' + str(is_antisymmetric(g1)) + ' -> spravna odpoved: True') print('TRANZITIVITA: ' + str(is_transitive(g1)) + ' -> spravna odpoved: True') print('-------------------------------------------') print('GRAPH 2:\n1 0 0\n0 1 0\n0 0 1') g2 = graph(3) g2.matrix[0][0] = True g2.matrix[1][1] = True g2.matrix[2][2] = True print('REFLEXIVITA: ' + str(is_reflexive(g2)) + ' -> spravna odpoved: True') print('SYMETRIE: ' + str(is_symmetric(g2)) + ' -> spravna odpoved: True') print('ANTISYMETRIE: ' + str(is_antisymmetric(g2)) + ' -> spravna odpoved: False') print('TRANZITIVITA: ' + str(is_transitive(g2)) + ' -> spravna odpoved: True') print('- GOOD GRAPHS -----------------------------') print('GRAPH 3:\n0 0 0\n0 1 0\n0 1 1') g3 = graph(3) g3.matrix[1][1] = True g3.matrix[2][1] = True g3.matrix[2][2] = True print('REFLEXIVITA: ' + str(is_reflexive(g3)) + ' -> spravna odpoved: False') print('SYMETRIE: ' + str(is_symmetric(g3)) + ' -> spravna odpoved: False') print('ANTISYMETRIE: ' + str(is_antisymmetric(g3)) + ' -> spravna odpoved: True') print('TRANZITIVITA: ' + str(is_transitive(g3)) + ' -> spravna odpoved: True') print('-------------------------------------------') print('GRAPH 4:\n0 1 1\n0 1 1\n0 0 1') g4 = graph(3) g4.matrix[0][1] = True g4.matrix[0][2] = True g4.matrix[1][1] = True g4.matrix[1][2] = True g4.matrix[2][2] = True print('REFLEXIVITA: ' + str(is_reflexive(g4)) + ' -> spravna odpoved: False') print('SYMETRIE: ' + str(is_symmetric(g4)) + ' -> spravna odpoved: False') print('ANTISYMETRIE: ' + str(is_antisymmetric(g4)) + ' -> spravna odpoved: True') print('TRANZITIVITA: ' + str(is_transitive(g4)) + ' -> spravna odpoved: True') print('-------------------------------------------') print('GRAPH 5:\n1 0 0\n0 0 0\n1 0 0') g5 = graph(3) g5.matrix[0][0] = True g5.matrix[2][0] = True print('REFLEXIVITA: ' + str(is_reflexive(g5)) + ' -> spravna odpoved: False') print('SYMETRIE: ' + str(is_symmetric(g5)) + ' -> spravna odpoved: False') print('ANTISYMETRIE: ' + str(is_antisymmetric(g5)) + ' -> spravna odpoved: True') print('TRANZITIVITA: ' + str(is_transitive(g5)) + ' -> spravna odpoved: True') print('-------------------------------------------') print('GRAPH 6:\n1 0 0\n1 1 0\n0 1 1') g6 = graph(3) g6.matrix[0][0] = True g6.matrix[1][0] = True g6.matrix[1][1] = True g6.matrix[2][1] = True g6.matrix[2][2] = True print('REFLEXIVITA: ' + str(is_reflexive(g6)) + ' -> spravna odpoved: True') print('SYMETRIE: ' + str(is_symmetric(g6)) + ' -> spravna odpoved: False') print('ANTISYMETRIE: ' + str(is_antisymmetric(g6)) + ' -> spravna odpoved: True') print('TRANZITIVITA: ' + str(is_transitive(g6)) + ' -> spravna odpoved: False') print() print('- TRANSITIVE CLOSURE -------------------------') print() print('GRAPH 7:\n1 0 0\n1 1 0\n0 1 1') g7 = graph(3) g7.matrix[0][0] = True g7.matrix[1][0] = True g7.matrix[1][1] = True g7.matrix[2][1] = True g7.matrix[2][2] = True print('TRANZITIVITA: ' + str(is_transitive(g7)) + ' -> spravna odpoved: False') transitive_closure(g7) print(str(g7.matrix)) print('TRANZITIVITA: ' + str(is_transitive(g7)) + ' -> spravna odpoved: True')
# Some utility classes to represent a PDB structure class Atom: """ A simple class for an amino acid residue """ def __init__(self, type): self.type = type self.coords = (0.0, 0.0, 0.0) # Overload the __repr__ operator to make printing simpler. def __repr__(self): return self.type class Residue: """ A simple class for an amino acid residue """ def __init__(self, type, number): self.type = type self.number = number self.atoms = [] # Overload the __repr__ operator to make printing simpler. def __repr__(self): return "{0} {1}".format(self.type, self.number) @property def alpha_carbon(self): """ Lookup the atom representing the alpha carbon """ for atom in self.atoms: if atom.type in ('CA', 'CA A', 'C A'): return atom # Le sad: no alpha carbon found print(self.atoms) return None class ActiveSite: """ A simple class for an active site """ def __init__(self, name): self.name = name self.residues = [] # Overload the __repr__ operator to make printing simpler. def __repr__(self): return self.name
class Atom: """ A simple class for an amino acid residue """ def __init__(self, type): self.type = type self.coords = (0.0, 0.0, 0.0) def __repr__(self): return self.type class Residue: """ A simple class for an amino acid residue """ def __init__(self, type, number): self.type = type self.number = number self.atoms = [] def __repr__(self): return '{0} {1}'.format(self.type, self.number) @property def alpha_carbon(self): """ Lookup the atom representing the alpha carbon """ for atom in self.atoms: if atom.type in ('CA', 'CA A', 'C A'): return atom print(self.atoms) return None class Activesite: """ A simple class for an active site """ def __init__(self, name): self.name = name self.residues = [] def __repr__(self): return self.name
class _elastica_numpy: """The purpose is to throw deprecation error to people previously using _elastica_numpy module. Please remove this exception after v0.3.""" raise ImportError("The module _elastica_numpy is now deprecated.")
class _Elastica_Numpy: """The purpose is to throw deprecation error to people previously using _elastica_numpy module. Please remove this exception after v0.3.""" raise import_error('The module _elastica_numpy is now deprecated.')
# Task 03. Statistics def add_to_dict(product: str, quantity: int): if product not in stock: stock[product] = quantity else: stock[product] += quantity cmd = input() stock = {} while not cmd == "statistics": key = cmd.split(': ')[0] value = cmd.split(': ')[1] add_to_dict(key, int(value)) cmd = input() print("Products in stock:") for product in stock: print(f"- {product}: {stock[product]}") print(f"Total Products: {len(stock)}") print(f"Total Quantity: {sum(stock.values())}")
def add_to_dict(product: str, quantity: int): if product not in stock: stock[product] = quantity else: stock[product] += quantity cmd = input() stock = {} while not cmd == 'statistics': key = cmd.split(': ')[0] value = cmd.split(': ')[1] add_to_dict(key, int(value)) cmd = input() print('Products in stock:') for product in stock: print(f'- {product}: {stock[product]}') print(f'Total Products: {len(stock)}') print(f'Total Quantity: {sum(stock.values())}')
''' This problem was asked by Stripe. Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3. You can modify the input array in-place. ''' def findLowestPositiveInteger(array): array.sort() nextNumber = 1 for x in array: if x > nextNumber and x > 0: break elif x > 0: nextNumber += 1 print(nextNumber) findLowestPositiveInteger([3,4,-1,-1]) findLowestPositiveInteger([1, 2, 0])
""" This problem was asked by Stripe. Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3. You can modify the input array in-place. """ def find_lowest_positive_integer(array): array.sort() next_number = 1 for x in array: if x > nextNumber and x > 0: break elif x > 0: next_number += 1 print(nextNumber) find_lowest_positive_integer([3, 4, -1, -1]) find_lowest_positive_integer([1, 2, 0])
#Main class class Characters: def __init__(self, name, lastname, age, hp, title, language, race, weakness ): # instance variable unique to each instance self.__name = name self.__lastname = lastname self.__age = age self.__hp = hp self.__title = title self.__race = race self.__weakness = weakness self.__language = language def character_info(self): return f"ID:{self.__name} {self.__lastname}\n" \ f"age:{self.__age}\n" \ f"Hp:{self.__hp} \n" \ f"race:{self.__race}\n" \ f"title:{self.__title}\n" \ f"weakness:{self.__weakness}\n" \ f"language:{self.__language}\n" \ f"that's all buddy" def attributeone(self): return f"{self.__name}" def attributetwo(self): return F"{self.__hp}" #These classes are inheritors of the main class class WarriorPerson(Characters): def __init__(self, name="none", lastname="none", age="none", hp="150", title="none", language="none", race="human or unknown", weakness="none"): super().__init__(name, lastname, age, hp, title, language, race, weakness) class RegularHumanPerson(Characters): def __init__(self, name="none", lastname="", age="none", hp="50", title="The man who be normal", language="English", race="human or unknown", weakness="nearly everything"): super().__init__(name, lastname, age, hp, title, language, race, weakness) class WitchPerson(Characters): def __init__(self, name="none", lastname="none", age="none", hp="896", title="none", language="none", race="human or unknown", weakness="none"): super().__init__(name, lastname, age, hp, title, language, race, weakness) class VampirePerson(Characters): def __init__(self, name="none", lastname="", age="none", hp="500", title="none", language="none", race="human or unknown", weakness="none"): super().__init__(name, lastname, age, hp, title, language, race, weakness) regular_human = RegularHumanPerson( name="john", lastname="smith", age="45", hp="50", ) regular_humans_sidekick = RegularHumanPerson( name="robin", age="20", hp="32", ) old_warrior = WarriorPerson( name="Berserker", lastname="", age="345", hp="500", title="old warrior", language="English and old vikings language", race="Human", weakness="Science" ) old_which = WitchPerson( name="Sarah", lastname="", age="600", hp="659", title="Girl of beast", language="She knows little bit old english and witch language", race="Human", weakness="Science and light of angel" ) young_Vampire = VampirePerson( name="Deacon", lastname="", age="783", hp="800", language="She knows little bit old english and new english", race="vampire", weakness="stake" )
class Characters: def __init__(self, name, lastname, age, hp, title, language, race, weakness): self.__name = name self.__lastname = lastname self.__age = age self.__hp = hp self.__title = title self.__race = race self.__weakness = weakness self.__language = language def character_info(self): return f"ID:{self.__name} {self.__lastname}\nage:{self.__age}\nHp:{self.__hp} \nrace:{self.__race}\ntitle:{self.__title}\nweakness:{self.__weakness}\nlanguage:{self.__language}\nthat's all buddy" def attributeone(self): return f'{self.__name}' def attributetwo(self): return f'{self.__hp}' class Warriorperson(Characters): def __init__(self, name='none', lastname='none', age='none', hp='150', title='none', language='none', race='human or unknown', weakness='none'): super().__init__(name, lastname, age, hp, title, language, race, weakness) class Regularhumanperson(Characters): def __init__(self, name='none', lastname='', age='none', hp='50', title='The man who be normal', language='English', race='human or unknown', weakness='nearly everything'): super().__init__(name, lastname, age, hp, title, language, race, weakness) class Witchperson(Characters): def __init__(self, name='none', lastname='none', age='none', hp='896', title='none', language='none', race='human or unknown', weakness='none'): super().__init__(name, lastname, age, hp, title, language, race, weakness) class Vampireperson(Characters): def __init__(self, name='none', lastname='', age='none', hp='500', title='none', language='none', race='human or unknown', weakness='none'): super().__init__(name, lastname, age, hp, title, language, race, weakness) regular_human = regular_human_person(name='john', lastname='smith', age='45', hp='50') regular_humans_sidekick = regular_human_person(name='robin', age='20', hp='32') old_warrior = warrior_person(name='Berserker', lastname='', age='345', hp='500', title='old warrior', language='English and old vikings language', race='Human', weakness='Science') old_which = witch_person(name='Sarah', lastname='', age='600', hp='659', title='Girl of beast', language='She knows little bit old english and witch language', race='Human', weakness='Science and light of angel') young__vampire = vampire_person(name='Deacon', lastname='', age='783', hp='800', language='She knows little bit old english and new english', race='vampire', weakness='stake')
n = int(input()) b = list(map(int, input().split(' '))) x = [0] a = [] a.append(b[0]) x.append(a[0]) i = 1 while i < n: a.append(b[i]+x[i]) if a[i] > x[i]: x.append(a[i]) else: x.append(x[i]) i += 1 str_a = [str(ele) for ele in a] print(' '.join(str_a))
n = int(input()) b = list(map(int, input().split(' '))) x = [0] a = [] a.append(b[0]) x.append(a[0]) i = 1 while i < n: a.append(b[i] + x[i]) if a[i] > x[i]: x.append(a[i]) else: x.append(x[i]) i += 1 str_a = [str(ele) for ele in a] print(' '.join(str_a))
class Production(object): def analyze(self, world): """Implement your analyzer here.""" def interpret(self, world): """Implement your interpreter here.""" class FuncCall(Production): def __init__(self, token, params): self.name = token[1] self.params = params self.token = token def analyze(self, world): self.params.analyze(world) def interpret(self, world): funcdef = world.functions[self.name] funcdef.call(world, self.params) def __repr__(self): return f"FuncCall({self.name}: {self.params})" class Parameters(Production): def __init__(self, expressions): self.expressions = expressions def analyze(self, world): for expr in self.expressions: expr.analyze(world) def interpret(self, world): return [x.interpret(world) for x in self.expressions] def __repr__(self): return f"Parameters({self.expressions})" class Expr(Production): pass class NameExpr(Expr): def __init__(self, token): self.name = token[1] self.token = token def interpret(self, world): # This should point at an IntExpr for now ref = world.variables.get(self.name) return ref.interpret(world) def __repr__(self): return f"NameExpr({self.name})" class IntExpr(Expr): def __init__(self, token): self.integer = int(token[1]) self.token = token def __repr__(self): return f"IntExpr({self.integer})" def interpret(self, world): return self.integer class AddExpr(Expr): def __init__(self, left, right): self.left = left self.right = right def analyze(self, world): self.left.analyze(world) self.right.analyze(world) def interpret(self, world): return self.left.interpret(world) + self.right.interpret(world) def __repr__(self): return f"AddExpr({self.left}, {self.right})" class FuncDef(Production): def __init__(self, token, params, body): self.name = token[1] self.params = params self.body = body self.token = token def analyze(self, world): world.functions[self.name] = self def __repr__(self): return f"FuncDef({self.name}({self.params}): {self.body}" def call(self, world, params): params = params or Parameters() scope = world.clone() for i, p in enumerate(self.params.expressions): scope.variables[p.name] = params.expressions[i] for line in self.body: line.interpret(scope) class PrintFuncDef(Production): def call(self, world, params): print(*params.interpret(world))
class Production(object): def analyze(self, world): """Implement your analyzer here.""" def interpret(self, world): """Implement your interpreter here.""" class Funccall(Production): def __init__(self, token, params): self.name = token[1] self.params = params self.token = token def analyze(self, world): self.params.analyze(world) def interpret(self, world): funcdef = world.functions[self.name] funcdef.call(world, self.params) def __repr__(self): return f'FuncCall({self.name}: {self.params})' class Parameters(Production): def __init__(self, expressions): self.expressions = expressions def analyze(self, world): for expr in self.expressions: expr.analyze(world) def interpret(self, world): return [x.interpret(world) for x in self.expressions] def __repr__(self): return f'Parameters({self.expressions})' class Expr(Production): pass class Nameexpr(Expr): def __init__(self, token): self.name = token[1] self.token = token def interpret(self, world): ref = world.variables.get(self.name) return ref.interpret(world) def __repr__(self): return f'NameExpr({self.name})' class Intexpr(Expr): def __init__(self, token): self.integer = int(token[1]) self.token = token def __repr__(self): return f'IntExpr({self.integer})' def interpret(self, world): return self.integer class Addexpr(Expr): def __init__(self, left, right): self.left = left self.right = right def analyze(self, world): self.left.analyze(world) self.right.analyze(world) def interpret(self, world): return self.left.interpret(world) + self.right.interpret(world) def __repr__(self): return f'AddExpr({self.left}, {self.right})' class Funcdef(Production): def __init__(self, token, params, body): self.name = token[1] self.params = params self.body = body self.token = token def analyze(self, world): world.functions[self.name] = self def __repr__(self): return f'FuncDef({self.name}({self.params}): {self.body}' def call(self, world, params): params = params or parameters() scope = world.clone() for (i, p) in enumerate(self.params.expressions): scope.variables[p.name] = params.expressions[i] for line in self.body: line.interpret(scope) class Printfuncdef(Production): def call(self, world, params): print(*params.interpret(world))
""" A name to avoid typosquating pytest-foward-compatibility """ __version__ = "0.1.0"
""" A name to avoid typosquating pytest-foward-compatibility """ __version__ = '0.1.0'
class Config: DEBUG = False SQLURI = 'postgres://tarek:xxx@localhost/db' """ >>> from flask import Flask >>> app = Flask(__name__) >>> app.config.from_object('prod_settings.Config') >>> print(app.config) <Config {'ENV': 'production', 'DEBUG': False, 'TESTING': False, 'PROPAGATE_EXCEPTIONS': None, 'PRESERVE_CONTEXT_ON_EXCE PTION': None, 'SECRET_KEY': None, 'PERMANENT_SESSION_LIFETIME': datetime.timedelta(days=31), 'USE_X_SENDFILE': False, ' SERVER_NAME': None, 'APPLICATION_ROOT': '/', 'SESSION_COOKIE_NAME': 'session', 'SESSION_COOKIE_DOMAIN': None, 'SESSION_ COOKIE_PATH': None, 'SESSION_COOKIE_HTTPONLY': True, 'SESSION_COOKIE_SECURE': False, 'SESSION_COOKIE_SAMESITE': None, ' SESSION_REFRESH_EACH_REQUEST': True, 'MAX_CONTENT_LENGTH': None, 'SEND_FILE_MAX_AGE_DEFAULT': datetime.timedelta(second s=43200), 'TRAP_BAD_REQUEST_ERRORS': None, 'TRAP_HTTP_EXCEPTIONS': False, 'EXPLAIN_TEMPLATE_LOADING': False, 'PREFERRED _URL_SCHEME': 'http', 'JSON_AS_ASCII': True, 'JSON_SORT_KEYS': True, 'JSONIFY_PRETTYPRINT_REGULAR': False, 'JSONIFY_MIM ETYPE': 'application/json', 'TEMPLATES_AUTO_RELOAD': None, 'MAX_COOKIE_SIZE': 4093, 'SQLURI': 'postgres://tarek:xxx@loc alhost/db'}> """
class Config: debug = False sqluri = 'postgres://tarek:xxx@localhost/db' "\n>>> from flask import Flask \n>>> app = Flask(__name__) \n>>> app.config.from_object('prod_settings.Config') \n>>> print(app.config) \n<Config {'ENV': 'production', 'DEBUG': False, 'TESTING': False, 'PROPAGATE_EXCEPTIONS': None, 'PRESERVE_CONTEXT_ON_EXCE \nPTION': None, 'SECRET_KEY': None, 'PERMANENT_SESSION_LIFETIME': datetime.timedelta(days=31), 'USE_X_SENDFILE': False, ' \nSERVER_NAME': None, 'APPLICATION_ROOT': '/', 'SESSION_COOKIE_NAME': 'session', 'SESSION_COOKIE_DOMAIN': None, 'SESSION_ \nCOOKIE_PATH': None, 'SESSION_COOKIE_HTTPONLY': True, 'SESSION_COOKIE_SECURE': False, 'SESSION_COOKIE_SAMESITE': None, ' \nSESSION_REFRESH_EACH_REQUEST': True, 'MAX_CONTENT_LENGTH': None, 'SEND_FILE_MAX_AGE_DEFAULT': datetime.timedelta(second \ns=43200), 'TRAP_BAD_REQUEST_ERRORS': None, 'TRAP_HTTP_EXCEPTIONS': False, 'EXPLAIN_TEMPLATE_LOADING': False, 'PREFERRED \n_URL_SCHEME': 'http', 'JSON_AS_ASCII': True, 'JSON_SORT_KEYS': True, 'JSONIFY_PRETTYPRINT_REGULAR': False, 'JSONIFY_MIM \nETYPE': 'application/json', 'TEMPLATES_AUTO_RELOAD': None, 'MAX_COOKIE_SIZE': 4093, 'SQLURI': 'postgres://tarek:xxx@loc \nalhost/db'}> \n"
class Solution: """ @param s: A string @return: the length of last word """ def lengthOfLastWord(self, s): return len(s.strip().split(" ")[-1])
class Solution: """ @param s: A string @return: the length of last word """ def length_of_last_word(self, s): return len(s.strip().split(' ')[-1])
""" This shows that Lists and Dictionaries are different """ listfootball=['messi','inesta','pique','sanchez','suarez','neymar'] listbuzzfeed=['eugene','ashley','keith','ella','sara','chris'] """ This will return false """ print(listbuzzfeed==listfootball) dictfootball={'name':'lionel','age':'26','country':'argentina','club':'fc-barcelona'} dictfootball2={'country-name':'argentina','capital':'bueones-aires','sports':'football','icon':'maradona'} """ This will return true """ print(dictfootball2==dictfootball)
""" This shows that Lists and Dictionaries are different """ listfootball = ['messi', 'inesta', 'pique', 'sanchez', 'suarez', 'neymar'] listbuzzfeed = ['eugene', 'ashley', 'keith', 'ella', 'sara', 'chris'] '\nThis will return false\n' print(listbuzzfeed == listfootball) dictfootball = {'name': 'lionel', 'age': '26', 'country': 'argentina', 'club': 'fc-barcelona'} dictfootball2 = {'country-name': 'argentina', 'capital': 'bueones-aires', 'sports': 'football', 'icon': 'maradona'} '\nThis will return true\n' print(dictfootball2 == dictfootball)
""" ......................Static................................... class Bank(): @staticmethod def Banking(Attr): print("Welcome to Banking") print("It is Static Method") print("Pass Attribute :",Attr) BB=Bank() BB.Banking("Citi") BB.Banking("BOA") .........................GarbageCollection.................. """ class Dog(): def Sound(self): print("Bark") class Cat(): def Sound(self): print("Mew") def __del__(self): print("Destructor") d=Dog() d.Sound() c=Cat() c.Sound() del c
""" ......................Static................................... class Bank(): @staticmethod def Banking(Attr): print("Welcome to Banking") print("It is Static Method") print("Pass Attribute :",Attr) BB=Bank() BB.Banking("Citi") BB.Banking("BOA") .........................GarbageCollection.................. """ class Dog: def sound(self): print('Bark') class Cat: def sound(self): print('Mew') def __del__(self): print('Destructor') d = dog() d.Sound() c = cat() c.Sound() del c
""" # The data in these tables were mostly sourced from Free60 and various forums and tools. # In particular the tool Le Fluffie was helpful # Some data has been verified, some changed and some has yet to be used. """ class STFSHashInfo(object): """ Whether the block represented by the BlockHashRecord is used, free, old or current """ types = { 0x00: "Unused", 0x40: "Freed", 0x80: "Old", 0xC0: "Current" } types_list = ["Unused", "Allocated Free", "Allocated In Use Old", "Allocated In Use Current"] class GamerTagConstants(object): """ GamerZone and Region mappings """ GamerZone = { 0: "Xbox", 1: "Recreation", 2: "Pro", 3: "Family", 4: "Underground", 5: "Cheater" } Region = { 0: "None", 1: "United Arab Emirates", 2: "Albania", 3: "Armenia", 4: "Argentina", 5: "Austria", 6: "Australia", 7: "Azerbaijan", 8: "Belgium", 9: "Bahrain", 10: "Brunei Darussalam", 11: "Bolivia", 12: "Brazil", 13: "Belarus", 14: "Belize", 15: "Canada", 16: "Unknown1", 17: "Switzerland", 18: "Chile", 19: "China", 20: "Colombia", 21: "Costa Rica", 22: "Czech Republic", 23: "Germany", 24: "Denmark", 25: "Dominican Republic", 26: "Algeria", 27: "Ecuador", 28: "Estonia", 29: "Egypt", 30: "Spain", 31: "Finland", 32: "Faroe Islands", 33: "France", 34: "Great Britain", 35: "Georgia", 36: "Greece", 37: "Guatemala", 38: "Hong Kong", 39: "Honduras", 40: "Croatia", 41: "Hungary", 42: "Indonesia", 43: "Ireland", 44: "Israel", 45: "India", 46: "Iraq", 47: "Iran", 48: "Iceland", 49: "Italy", 50: "Jamaica", 51: "Jordan", 52: "Japan", 53: "Kenya", 54: "Kyrgyzstan", 55: "Korea", 56: "Kuwait", 57: "Kazakhstan", 58: "Lebanon", 59: "Liechtenstein", 60: "Luxembourg", 61: "Latvia", 62: "Libya", 63: "Morocco", 64: "Monaco", 65: "Macodonia", 66: "Mongolia", 67: "Macao", 68: "Maldives", 69: "Mexico", 70: "Malaysia", 71: "Nicaragua", 72: "Netherlands", 73: "Norway", 74: "New Zealand", 75: "Oman", 76: "Panama", 77: "Peru", 78: "Philippines", 79: "Pakistan", 80: "Poland", 81: "Puerto Rico", 82: "Portugal", 83: "Paraguay", 84: "Qatar", 85: "Romania", 86: "Russian Federation", 87: "Saudi Arabia", 88: "Sweden", 89: "Singapore", 90: "Slovenia", 91: "Slovak Republic", 92: "Unknown 2", 93: "El Salvador", 94: "Syria", 95: "Thailand", 96: "Tunisia", 97: "Turkey", 98: "Trinidad Tobago", 99: "Taiwan", 100: "Ukraine", 101: "United States", 102: "Urugay", 103: "Uzbekistan", 104: "Venezuela", 105: "Viet Nam", 106: "Yemen", 107: "SouthAfrica", 108: "Zimbabwe" } class GPDID(object): """GPID descriptions""" types = { 0x8000: "This Title", 0x10040000: "Permissions", 0x10040002: "Y Axis Inversion", 0x10040003: "Controller Vibration Settings", 0x63E80044: "Avatar Information", 0x63E83FFF: "Title Specific Setting 1", 0x63E83FFE: "Title Specific Setting 2", 0x63E83FFD: "Title Specific Setting 3", 0x10040004: "GamerZone", 0x10040005: "Region", 0x10040006: "Gamerscore", 0x10040007: "Presence State (Unknown)", 0x10040008: "Camera", 0x5004000B: "Reputation", 0x1004000C: "Mute Setting", 0x1004000D: "Voice Output Speakers", 0x1004000E: "Voice Volume Setting", 0x4064000F: "Gamer Picture Reference", 0x40640010: "Personal Picture Reference", 0x402C0011: "Motto", 0x10040012: "Titles Played", 0x10040013: "Achievements Unlocked", 0x10040015: "Difficulty Setting", 0x10040018: "Control Sensitivity", 0x1004001D: "Preferred Color 1", 0x1004001E: "Preferred Color 2", 0x10040022: "Auto Aim", 0x10040024: "Auto Center", 0x10040024: "Action Movement Control", 0x10040038: "Gamerscore Earned On Title", 0x10040039: "Achievements Unlocked on Title", 0x1004003A: "User Tier (Unknown)", 0x1004003B: "Has Messanger Account", 0x1004003C: "Messanger Auto Signin", 0x1004003D: "Save Live Password", 0x1004003E: "Public Friends List", 0x1004003F: "Service Type (Unknown)", 0x41040040: "Account Name", 0x40520041: "Account Location", 0x41900042: "Gamercard URL", 0x43E80043: "Account Bio", 0x10000000: "Sync ID Table", 0x20000000: "Sync Record", 0x10042004: "Xbox.com Favorite Game (1)", 0x10042005: "Xbox.com Favorite Game (2)", 0x10042006: "Xbox.com Favorite Game (3)", 0x10042007: "Xbox.com Favorite Game (4)", 0x10042008: "Xbox.com Favorite Game (5)", 0x10042009: "Xbox.com Favorite Game (6)", 0x1004200A: "Xbox.com Platforms Owned", 0x1004200B: "Xbox.com Connection Speed", 0x700803F4: "User Crux Last Change Time (Unknown)" } class ContentTypes: """ STFS Content Types mapping """ types = { 0xD0000: "Arcade Title", 0x9000: "Avatar Item", 0x40000: "Cache File", 0x2000000: "Community Game", 0x80000: "Game Demo", 0x20000: "Gamer Picture", 0xA0000: "Game Title", 0xC0000: "Game Trailer", 0x400000: "Game Video", 0x4000: "Installed Game", 0xB0000: "Installer", 0x2000: "IPTV Pause Buffer", 0xF0000: "License Store", 0x2: "Marketplace Content", 0x100000: "Movie", 0x300000: "Music Video", 0x500000: "Podcast Video", 0x10000: "Profile", 0x3: "Publisher", 0x1: "Saved Game", 0x50000: "Storage Download", 0x30000: "Theme", 0x200000: "TV", 0x90000: "Video", 0x600000: "Viral Video", 0x70000: "Xbox Download", 0x5000: "Xbox Original Game", 0x60000: "Xbox Saved Game", 0x1000: "Xbox 360 Title", 0x5000: "Xbox Title", 0xE0000: "XNA" }
""" # The data in these tables were mostly sourced from Free60 and various forums and tools. # In particular the tool Le Fluffie was helpful # Some data has been verified, some changed and some has yet to be used. """ class Stfshashinfo(object): """ Whether the block represented by the BlockHashRecord is used, free, old or current """ types = {0: 'Unused', 64: 'Freed', 128: 'Old', 192: 'Current'} types_list = ['Unused', 'Allocated Free', 'Allocated In Use Old', 'Allocated In Use Current'] class Gamertagconstants(object): """ GamerZone and Region mappings """ gamer_zone = {0: 'Xbox', 1: 'Recreation', 2: 'Pro', 3: 'Family', 4: 'Underground', 5: 'Cheater'} region = {0: 'None', 1: 'United Arab Emirates', 2: 'Albania', 3: 'Armenia', 4: 'Argentina', 5: 'Austria', 6: 'Australia', 7: 'Azerbaijan', 8: 'Belgium', 9: 'Bahrain', 10: 'Brunei Darussalam', 11: 'Bolivia', 12: 'Brazil', 13: 'Belarus', 14: 'Belize', 15: 'Canada', 16: 'Unknown1', 17: 'Switzerland', 18: 'Chile', 19: 'China', 20: 'Colombia', 21: 'Costa Rica', 22: 'Czech Republic', 23: 'Germany', 24: 'Denmark', 25: 'Dominican Republic', 26: 'Algeria', 27: 'Ecuador', 28: 'Estonia', 29: 'Egypt', 30: 'Spain', 31: 'Finland', 32: 'Faroe Islands', 33: 'France', 34: 'Great Britain', 35: 'Georgia', 36: 'Greece', 37: 'Guatemala', 38: 'Hong Kong', 39: 'Honduras', 40: 'Croatia', 41: 'Hungary', 42: 'Indonesia', 43: 'Ireland', 44: 'Israel', 45: 'India', 46: 'Iraq', 47: 'Iran', 48: 'Iceland', 49: 'Italy', 50: 'Jamaica', 51: 'Jordan', 52: 'Japan', 53: 'Kenya', 54: 'Kyrgyzstan', 55: 'Korea', 56: 'Kuwait', 57: 'Kazakhstan', 58: 'Lebanon', 59: 'Liechtenstein', 60: 'Luxembourg', 61: 'Latvia', 62: 'Libya', 63: 'Morocco', 64: 'Monaco', 65: 'Macodonia', 66: 'Mongolia', 67: 'Macao', 68: 'Maldives', 69: 'Mexico', 70: 'Malaysia', 71: 'Nicaragua', 72: 'Netherlands', 73: 'Norway', 74: 'New Zealand', 75: 'Oman', 76: 'Panama', 77: 'Peru', 78: 'Philippines', 79: 'Pakistan', 80: 'Poland', 81: 'Puerto Rico', 82: 'Portugal', 83: 'Paraguay', 84: 'Qatar', 85: 'Romania', 86: 'Russian Federation', 87: 'Saudi Arabia', 88: 'Sweden', 89: 'Singapore', 90: 'Slovenia', 91: 'Slovak Republic', 92: 'Unknown 2', 93: 'El Salvador', 94: 'Syria', 95: 'Thailand', 96: 'Tunisia', 97: 'Turkey', 98: 'Trinidad Tobago', 99: 'Taiwan', 100: 'Ukraine', 101: 'United States', 102: 'Urugay', 103: 'Uzbekistan', 104: 'Venezuela', 105: 'Viet Nam', 106: 'Yemen', 107: 'SouthAfrica', 108: 'Zimbabwe'} class Gpdid(object): """GPID descriptions""" types = {32768: 'This Title', 268697600: 'Permissions', 268697602: 'Y Axis Inversion', 268697603: 'Controller Vibration Settings', 1676148804: 'Avatar Information', 1676165119: 'Title Specific Setting 1', 1676165118: 'Title Specific Setting 2', 1676165117: 'Title Specific Setting 3', 268697604: 'GamerZone', 268697605: 'Region', 268697606: 'Gamerscore', 268697607: 'Presence State (Unknown)', 268697608: 'Camera', 1342439435: 'Reputation', 268697612: 'Mute Setting', 268697613: 'Voice Output Speakers', 268697614: 'Voice Volume Setting', 1080295439: 'Gamer Picture Reference', 1080295440: 'Personal Picture Reference', 1076625425: 'Motto', 268697618: 'Titles Played', 268697619: 'Achievements Unlocked', 268697621: 'Difficulty Setting', 268697624: 'Control Sensitivity', 268697629: 'Preferred Color 1', 268697630: 'Preferred Color 2', 268697634: 'Auto Aim', 268697636: 'Auto Center', 268697636: 'Action Movement Control', 268697656: 'Gamerscore Earned On Title', 268697657: 'Achievements Unlocked on Title', 268697658: 'User Tier (Unknown)', 268697659: 'Has Messanger Account', 268697660: 'Messanger Auto Signin', 268697661: 'Save Live Password', 268697662: 'Public Friends List', 268697663: 'Service Type (Unknown)', 1090781248: 'Account Name', 1079115841: 'Account Location', 1099956290: 'Gamercard URL', 1139277891: 'Account Bio', 268435456: 'Sync ID Table', 536870912: 'Sync Record', 268705796: 'Xbox.com Favorite Game (1)', 268705797: 'Xbox.com Favorite Game (2)', 268705798: 'Xbox.com Favorite Game (3)', 268705799: 'Xbox.com Favorite Game (4)', 268705800: 'Xbox.com Favorite Game (5)', 268705801: 'Xbox.com Favorite Game (6)', 268705802: 'Xbox.com Platforms Owned', 268705803: 'Xbox.com Connection Speed', 1879573492: 'User Crux Last Change Time (Unknown)'} class Contenttypes: """ STFS Content Types mapping """ types = {851968: 'Arcade Title', 36864: 'Avatar Item', 262144: 'Cache File', 33554432: 'Community Game', 524288: 'Game Demo', 131072: 'Gamer Picture', 655360: 'Game Title', 786432: 'Game Trailer', 4194304: 'Game Video', 16384: 'Installed Game', 720896: 'Installer', 8192: 'IPTV Pause Buffer', 983040: 'License Store', 2: 'Marketplace Content', 1048576: 'Movie', 3145728: 'Music Video', 5242880: 'Podcast Video', 65536: 'Profile', 3: 'Publisher', 1: 'Saved Game', 327680: 'Storage Download', 196608: 'Theme', 2097152: 'TV', 589824: 'Video', 6291456: 'Viral Video', 458752: 'Xbox Download', 20480: 'Xbox Original Game', 393216: 'Xbox Saved Game', 4096: 'Xbox 360 Title', 20480: 'Xbox Title', 917504: 'XNA'}
def valida(digitos): # digitos = [4,5,7,5,0,8,0,0,0] # digitos = [11] * 9 i = 1 soma = 0 for x in digitos: soma = soma +(i * x) i += 1 return bool( soma % 11 == 0) print(valida(1))
def valida(digitos): i = 1 soma = 0 for x in digitos: soma = soma + i * x i += 1 return bool(soma % 11 == 0) print(valida(1))
{ "targets": [{ "target_name": "OpenSSL_EVP_BytesToKey", "sources": [ "./test/main.cc", ], "cflags": [ "-Wall", "-Wno-maybe-uninitialized", "-Wno-uninitialized", "-Wno-unused-function", "-Wextra" ], "cflags_cc+": [ "-std=c++0x" ], "include_dirs": [ "/usr/local/include", "<!(node -e \"require('nan')\")" ], "conditions": [ [ "OS=='mac'", { "libraries": [ "-L/usr/local/lib" ], "xcode_settings": { "MACOSX_DEPLOYMENT_TARGET": "10.7", "OTHER_CPLUSPLUSFLAGS": [ "-stdlib=libc++" ] } } ] ] }] }
{'targets': [{'target_name': 'OpenSSL_EVP_BytesToKey', 'sources': ['./test/main.cc'], 'cflags': ['-Wall', '-Wno-maybe-uninitialized', '-Wno-uninitialized', '-Wno-unused-function', '-Wextra'], 'cflags_cc+': ['-std=c++0x'], 'include_dirs': ['/usr/local/include', '<!(node -e "require(\'nan\')")'], 'conditions': [["OS=='mac'", {'libraries': ['-L/usr/local/lib'], 'xcode_settings': {'MACOSX_DEPLOYMENT_TARGET': '10.7', 'OTHER_CPLUSPLUSFLAGS': ['-stdlib=libc++']}}]]}]}
class Car: """Unit under test.""" def __init__(self, speed): self.speed = speed def getSpeed(self): return self.speed def brake(self): self.speed = 0
class Car: """Unit under test.""" def __init__(self, speed): self.speed = speed def get_speed(self): return self.speed def brake(self): self.speed = 0
def catalan_number(n): nm = dm = 1 for k in range(2, n+1): nm, dm = ( nm*(n+k), dm*k ) return nm/dm print([catalan_number(n) for n in range(1, 16)]) [1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845]
def catalan_number(n): nm = dm = 1 for k in range(2, n + 1): (nm, dm) = (nm * (n + k), dm * k) return nm / dm print([catalan_number(n) for n in range(1, 16)]) [1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845]
"""Shows options""" def show_options(): options = ["\nYour options are below.", "\nEnter: '<rooms>' to show a list of rooms", "\nEnter: '<create> room_name' to create a room and assign it a name.", "\nEnter: '<join> room_name' to join an existing chat room.", "\nEnter: '<users>' to list the users' names in your current room.", "\nEnter: '<leave>' to leave your current room." ] return options
"""Shows options""" def show_options(): options = ['\nYour options are below.', "\nEnter: '<rooms>' to show a list of rooms", "\nEnter: '<create> room_name' to create a room and assign it a name.", "\nEnter: '<join> room_name' to join an existing chat room.", "\nEnter: '<users>' to list the users' names in your current room.", "\nEnter: '<leave>' to leave your current room."] return options
"""Constants for pyskyqremote- DE.""" SCHEDULE_URL = "https://www.sky.de/sgtvg/service/getBroadcasts" LIVE_IMAGE_URL = "https://www.sky.de{0}" PVR_IMAGE_URL = "https://www.sky.de{0}" CHANNEL_IMAGE_URL = "https://www.sky.de{0}" TIMEZONE = "Europe/Berlin" CHANNEL_URL = "https://raw.githubusercontent.com/RogerSelwyn/skyq_remote/master/pyskyqremote/country/channels-de.json" # pylint: disable=line-too-long
"""Constants for pyskyqremote- DE.""" schedule_url = 'https://www.sky.de/sgtvg/service/getBroadcasts' live_image_url = 'https://www.sky.de{0}' pvr_image_url = 'https://www.sky.de{0}' channel_image_url = 'https://www.sky.de{0}' timezone = 'Europe/Berlin' channel_url = 'https://raw.githubusercontent.com/RogerSelwyn/skyq_remote/master/pyskyqremote/country/channels-de.json'
# Copyright 2019 Google LLC # # 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 # # https://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. load("@com_google_api_codegen//rules_gapic:gapic.bzl", "gapic_srcjar", "unzipped_srcjar") def _cc_gapic_postprocessed_srcjar_impl(ctx): gapic_zip = ctx.file.gapic_zip output_main = ctx.outputs.main output_main_h = ctx.outputs.main_h output_dir_name = ctx.label.name output_dir_path = "%s/%s" % (output_main.dirname, output_dir_name) script = """ unzip -q {gapic_zip} -d {output_dir_path} # TODO: Call formatter here pushd {output_dir_path} zip -q -r {output_dir_name}-h.srcjar . -i ./*.gapic.h find . -name "*.gapic.h" -delete zip -q -r {output_dir_name}.srcjar . -i ./*.cc -i ./*.h popd mv {output_dir_path}/{output_dir_name}-h.srcjar {output_main_h} mv {output_dir_path}/{output_dir_name}.srcjar {output_main} rm -rf {output_dir_path} """.format( gapic_zip = gapic_zip.path, output_dir_name = output_dir_name, output_dir_path = output_dir_path, output_main = output_main.path, output_main_h = output_main_h.path, ) ctx.actions.run_shell( inputs = [gapic_zip], command = script, outputs = [output_main, output_main_h], ) _cc_gapic_postprocessed_srcjar = rule( _cc_gapic_postprocessed_srcjar_impl, attrs = { "gapic_zip": attr.label(mandatory = True, allow_single_file = True), }, outputs = { "main": "%{name}.srcjar", "main_h": "%{name}-h.srcjar", }, ) def cc_gapic_srcjar(name, src, package, **kwargs): raw_srcjar_name = "%s_raw" % name gapic_srcjar( name = raw_srcjar_name, src = src, package = package, output_suffix = ".zip", gapic_generator = Label("//generator:protoc-gen-cpp_gapic"), **kwargs ) _cc_gapic_postprocessed_srcjar( name = name, gapic_zip = ":%s" % raw_srcjar_name, **kwargs ) def cc_gapic_library(name, src, package, deps = [], **kwargs): srcjar_name = "%s_srcjar" % name cc_gapic_srcjar( name = srcjar_name, src = src, package = package, **kwargs ) actual_deps = deps + [ "@com_google_gapic_generator_cpp//gax:gax", ] main_file = ":%s.srcjar" % srcjar_name main_dir = "%s_main" % srcjar_name unzipped_srcjar( name = main_dir, srcjar = main_file, extension = "", **kwargs ) main_h_file = ":%s-h.srcjar" % srcjar_name main_h_dir = "%s_h_main" % srcjar_name unzipped_srcjar( name = main_h_dir, srcjar = main_h_file, extension = "", **kwargs ) native.cc_library( name = name, srcs = [":%s" % main_dir], deps = actual_deps, hdrs = [":%s" % main_h_dir], includes = [main_h_dir], # cc_library generates an empty .so file, making dynamic linking # impossible. This may be caused by us using a directory (instead of # exact files) as srcs input. linkstatic = True, **kwargs )
load('@com_google_api_codegen//rules_gapic:gapic.bzl', 'gapic_srcjar', 'unzipped_srcjar') def _cc_gapic_postprocessed_srcjar_impl(ctx): gapic_zip = ctx.file.gapic_zip output_main = ctx.outputs.main output_main_h = ctx.outputs.main_h output_dir_name = ctx.label.name output_dir_path = '%s/%s' % (output_main.dirname, output_dir_name) script = '\n unzip -q {gapic_zip} -d {output_dir_path}\n # TODO: Call formatter here\n pushd {output_dir_path}\n zip -q -r {output_dir_name}-h.srcjar . -i ./*.gapic.h\n find . -name "*.gapic.h" -delete\n zip -q -r {output_dir_name}.srcjar . -i ./*.cc -i ./*.h\n popd\n mv {output_dir_path}/{output_dir_name}-h.srcjar {output_main_h}\n mv {output_dir_path}/{output_dir_name}.srcjar {output_main}\n rm -rf {output_dir_path}\n '.format(gapic_zip=gapic_zip.path, output_dir_name=output_dir_name, output_dir_path=output_dir_path, output_main=output_main.path, output_main_h=output_main_h.path) ctx.actions.run_shell(inputs=[gapic_zip], command=script, outputs=[output_main, output_main_h]) _cc_gapic_postprocessed_srcjar = rule(_cc_gapic_postprocessed_srcjar_impl, attrs={'gapic_zip': attr.label(mandatory=True, allow_single_file=True)}, outputs={'main': '%{name}.srcjar', 'main_h': '%{name}-h.srcjar'}) def cc_gapic_srcjar(name, src, package, **kwargs): raw_srcjar_name = '%s_raw' % name gapic_srcjar(name=raw_srcjar_name, src=src, package=package, output_suffix='.zip', gapic_generator=label('//generator:protoc-gen-cpp_gapic'), **kwargs) _cc_gapic_postprocessed_srcjar(name=name, gapic_zip=':%s' % raw_srcjar_name, **kwargs) def cc_gapic_library(name, src, package, deps=[], **kwargs): srcjar_name = '%s_srcjar' % name cc_gapic_srcjar(name=srcjar_name, src=src, package=package, **kwargs) actual_deps = deps + ['@com_google_gapic_generator_cpp//gax:gax'] main_file = ':%s.srcjar' % srcjar_name main_dir = '%s_main' % srcjar_name unzipped_srcjar(name=main_dir, srcjar=main_file, extension='', **kwargs) main_h_file = ':%s-h.srcjar' % srcjar_name main_h_dir = '%s_h_main' % srcjar_name unzipped_srcjar(name=main_h_dir, srcjar=main_h_file, extension='', **kwargs) native.cc_library(name=name, srcs=[':%s' % main_dir], deps=actual_deps, hdrs=[':%s' % main_h_dir], includes=[main_h_dir], linkstatic=True, **kwargs)
NAME = 'weather.py' ORIGINAL_AUTHORS = [ 'Gabriele Ron' ] ABOUT = ''' A plugin to get the weather of a location ''' COMMANDS = ''' >>> .weather <city> <country code> returns the weather ''' WEBSITE = ''
name = 'weather.py' original_authors = ['Gabriele Ron'] about = '\nA plugin to get the weather of a location\n' commands = '\n>>> .weather <city> <country code>\nreturns the weather\n' website = ''
class Node: def __init__(self, value): self.value = value self.next = None class LinkList: def __init__(self, value): node = Node(value) self.head = node self.tail = node self.length = 1 def append(self, value): node = Node(value) if self.length == 0: self.head = node self.tail = node else: self.tail.next = node self.tail = node self.length += 1 return True def prepend(self, value): node = Node(value) if self.length == 0: self.head = node self.tail = node else: node.next = self.head self.head = node self.length += 1 return True def pop(self): if self.length == 0: return None if self.length == 1: temp = self.head self.head = None self.tail = None self.length -= 1 return temp temp = self.head while temp.next != self.tail: temp = temp.next pop = self.tail self.tail = temp self.tail.next = None self.length -= 1 return pop def pop_first(self): if self.length == 0: return None if self.length == 1: temp = self.head self.head = None self.tail = None self.length -= 1 return temp temp = self.head self.head = temp.next temp.next = None self.length -= 1 return temp def get(self, index): if index < 0 or index >= self.length: return None temp = self.head for _ in range(index): temp = temp.next return temp def set_value(self, value, index): temp = self.get(index) if temp: temp.value = value return True return False def insert(self, value, index): if index < 0 or index > self.length: return False if index == 0: return self.prepend(value) node = Node(value) temp = self.get(index - 1) node.next = temp.next temp.next = node self.length += 1 return True def remove(self, index): if index < 0 or index >= self.length: return None if index == 0: return self.pop_first() temp = self.get(index - 1) node = temp.next temp.next = node.next node.next = None self.length -= 1 return node def reverse(self): temp = self.head self.head = self.tail self.tail = temp before = None after = temp.next for _ in range(self.length): after = temp.next temp.next = before before = temp temp = after return True def __str__(self): answer = str() temp = self.head while temp: answer += str(temp.value) + " " temp = temp.next return answer
class Node: def __init__(self, value): self.value = value self.next = None class Linklist: def __init__(self, value): node = node(value) self.head = node self.tail = node self.length = 1 def append(self, value): node = node(value) if self.length == 0: self.head = node self.tail = node else: self.tail.next = node self.tail = node self.length += 1 return True def prepend(self, value): node = node(value) if self.length == 0: self.head = node self.tail = node else: node.next = self.head self.head = node self.length += 1 return True def pop(self): if self.length == 0: return None if self.length == 1: temp = self.head self.head = None self.tail = None self.length -= 1 return temp temp = self.head while temp.next != self.tail: temp = temp.next pop = self.tail self.tail = temp self.tail.next = None self.length -= 1 return pop def pop_first(self): if self.length == 0: return None if self.length == 1: temp = self.head self.head = None self.tail = None self.length -= 1 return temp temp = self.head self.head = temp.next temp.next = None self.length -= 1 return temp def get(self, index): if index < 0 or index >= self.length: return None temp = self.head for _ in range(index): temp = temp.next return temp def set_value(self, value, index): temp = self.get(index) if temp: temp.value = value return True return False def insert(self, value, index): if index < 0 or index > self.length: return False if index == 0: return self.prepend(value) node = node(value) temp = self.get(index - 1) node.next = temp.next temp.next = node self.length += 1 return True def remove(self, index): if index < 0 or index >= self.length: return None if index == 0: return self.pop_first() temp = self.get(index - 1) node = temp.next temp.next = node.next node.next = None self.length -= 1 return node def reverse(self): temp = self.head self.head = self.tail self.tail = temp before = None after = temp.next for _ in range(self.length): after = temp.next temp.next = before before = temp temp = after return True def __str__(self): answer = str() temp = self.head while temp: answer += str(temp.value) + ' ' temp = temp.next return answer
class node: def __init__(self,val): self.val = val self.next = None self.prev = None class mylinkedlist: def __init__(self): self.head = None self.tail = None self.size = 0 def get(self,index): if index < 0 or index >= self.size: return -1 cur = self.head while index != 0: cur = cur.next index = index -1 return cur.val def addathead(self,val): new_node = node(val) if self.head is None: self.head = new_node self.tail = new_node else: new_node.next = self.head self.head.prev = new_node self.head = new_node self.size = self.size + 1 def addatTail(self,val): new_node = node(val) if self.tail is None: self.head = new_node self.tail = new_node else: new_node.prev = self.tail self.tail.next = new_node self.tail = new_node self.size = self.size + 1 def addatIndex(self,index,val): if index < 0 or index >= self.size: return -1 elif index ==0: self.addathead(val) elif index == self.size: self.addatTail(val) else: cur = self.head while index-1 != 0: cur = cur.next index -= 1 new_node = node(val) new_node.next = cur.next cur.next.prev = new_node cur.next = new_node new_node.prev = cur self.size = self.size +1 def deleteatIndex(self,index,val): if index < 0 or index >= self.size: return -1 elif index == 0: cur = self.head.next if cur: cur.prev = None self.head = self.head.next self.size -= 1 if self.size == 0: self.tail = None elif index == self.size-1: cur = self.tail.prev if cur: cur.next = None self.tail = self.tail.prev size -= 1 if self.size == 0: self.head = None else: cur = self.head while index-1 != 0: cur = cur.next index -= 1 cur.next = cur.next.next cur.next.prev = cur self.size -=1
class Node: def __init__(self, val): self.val = val self.next = None self.prev = None class Mylinkedlist: def __init__(self): self.head = None self.tail = None self.size = 0 def get(self, index): if index < 0 or index >= self.size: return -1 cur = self.head while index != 0: cur = cur.next index = index - 1 return cur.val def addathead(self, val): new_node = node(val) if self.head is None: self.head = new_node self.tail = new_node else: new_node.next = self.head self.head.prev = new_node self.head = new_node self.size = self.size + 1 def addat_tail(self, val): new_node = node(val) if self.tail is None: self.head = new_node self.tail = new_node else: new_node.prev = self.tail self.tail.next = new_node self.tail = new_node self.size = self.size + 1 def addat_index(self, index, val): if index < 0 or index >= self.size: return -1 elif index == 0: self.addathead(val) elif index == self.size: self.addatTail(val) else: cur = self.head while index - 1 != 0: cur = cur.next index -= 1 new_node = node(val) new_node.next = cur.next cur.next.prev = new_node cur.next = new_node new_node.prev = cur self.size = self.size + 1 def deleteat_index(self, index, val): if index < 0 or index >= self.size: return -1 elif index == 0: cur = self.head.next if cur: cur.prev = None self.head = self.head.next self.size -= 1 if self.size == 0: self.tail = None elif index == self.size - 1: cur = self.tail.prev if cur: cur.next = None self.tail = self.tail.prev size -= 1 if self.size == 0: self.head = None else: cur = self.head while index - 1 != 0: cur = cur.next index -= 1 cur.next = cur.next.next cur.next.prev = cur self.size -= 1
#declaring variable as string phrase = str(input('Type a phrase: ')) #saving the phrase in lowercase phrase = phrase.lower() #presenting amount of lettters 'a' print('Amount of letters "a": ', phrase.count('a')) #presenting the position of firt 'a' print('Firt "A" in position: ', phrase.find('a')) #presenting the position of last 'a' whith 'right find' print('Last "A" in postion: ',phrase.rfind('a'))
phrase = str(input('Type a phrase: ')) phrase = phrase.lower() print('Amount of letters "a": ', phrase.count('a')) print('Firt "A" in position: ', phrase.find('a')) print('Last "A" in postion: ', phrase.rfind('a'))
{ "targets": [ { "target_name": "json", "product_name": "json", "variables": { "json_dir%": "../" }, 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], 'conditions': [ ['OS=="mac"', { 'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' } }] ], "type": "static_library", "include_dirs": [ "<(json_dir)/", "<(json_dir)/JSON", "<(json_dir)/JSON/src" ], "sources": [ "<(json_dir)/JSON/json.h", "<(json_dir)/JSON/src/autolink.h", "<(json_dir)/JSON/src/config.h", "<(json_dir)/JSON/src/features.h", "<(json_dir)/JSON/src/forwards.h", "<(json_dir)/JSON/src/json_batchallocator.h", "<(json_dir)/JSON/src/json_tool.h", "<(json_dir)/JSON/src/reader.h", "<(json_dir)/JSON/src/value.h", "<(json_dir)/JSON/src/writer.h", "<(json_dir)/JSON/src/json_internalarray.inl", "<(json_dir)/JSON/src/json_internalmap.inl", "<(json_dir)/JSON/src/json_valueiterator.inl", "<(json_dir)/JSON/src/json_reader.cpp", "<(json_dir)/JSON/src/json_value.cpp", "<(json_dir)/JSON/src/json_writer.cpp" ], "all_dependent_settings": { "include_dirs": [ "<(json_dir)/JSON" ] } } ], "variables": { "conditions": [ [ "OS == 'mac'", { "target_arch%": "x64" }, { "target_arch%": "ia32" } ] ] }, "target_defaults": { "default_configuration": "Release", "defines": [ ], "conditions": [ [ "OS == 'mac'", { "defines": [ "DARWIN" ] }, { "defines": [ "LINUX" ] } ], [ "OS == 'mac' and target_arch == 'x64'", { "xcode_settings": { "ARCHS": [ "x86_64" ] } } ] ], "configurations": { "Debug": { "cflags": [ "-g", "-O0" ], "xcode_settings": { "OTHER_CFLAGS": [ "-g", "-O0" ], "OTHER_CPLUSPLUSFLAGS": [ "-g", "-O0" ] } }, "Release": { "cflags": [ "-O3" ], "defines": [ "NDEBUG" ], "xcode_settings": { "OTHER_CFLAGS": [ "-O3" ], "OTHER_CPLUSPLUSFLAGS": [ "-O3", "-DNDEBUG" ] } } } } }
{'targets': [{'target_name': 'json', 'product_name': 'json', 'variables': {'json_dir%': '../'}, 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'conditions': [['OS=="mac"', {'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'}}]], 'type': 'static_library', 'include_dirs': ['<(json_dir)/', '<(json_dir)/JSON', '<(json_dir)/JSON/src'], 'sources': ['<(json_dir)/JSON/json.h', '<(json_dir)/JSON/src/autolink.h', '<(json_dir)/JSON/src/config.h', '<(json_dir)/JSON/src/features.h', '<(json_dir)/JSON/src/forwards.h', '<(json_dir)/JSON/src/json_batchallocator.h', '<(json_dir)/JSON/src/json_tool.h', '<(json_dir)/JSON/src/reader.h', '<(json_dir)/JSON/src/value.h', '<(json_dir)/JSON/src/writer.h', '<(json_dir)/JSON/src/json_internalarray.inl', '<(json_dir)/JSON/src/json_internalmap.inl', '<(json_dir)/JSON/src/json_valueiterator.inl', '<(json_dir)/JSON/src/json_reader.cpp', '<(json_dir)/JSON/src/json_value.cpp', '<(json_dir)/JSON/src/json_writer.cpp'], 'all_dependent_settings': {'include_dirs': ['<(json_dir)/JSON']}}], 'variables': {'conditions': [["OS == 'mac'", {'target_arch%': 'x64'}, {'target_arch%': 'ia32'}]]}, 'target_defaults': {'default_configuration': 'Release', 'defines': [], 'conditions': [["OS == 'mac'", {'defines': ['DARWIN']}, {'defines': ['LINUX']}], ["OS == 'mac' and target_arch == 'x64'", {'xcode_settings': {'ARCHS': ['x86_64']}}]], 'configurations': {'Debug': {'cflags': ['-g', '-O0'], 'xcode_settings': {'OTHER_CFLAGS': ['-g', '-O0'], 'OTHER_CPLUSPLUSFLAGS': ['-g', '-O0']}}, 'Release': {'cflags': ['-O3'], 'defines': ['NDEBUG'], 'xcode_settings': {'OTHER_CFLAGS': ['-O3'], 'OTHER_CPLUSPLUSFLAGS': ['-O3', '-DNDEBUG']}}}}}
todos = [] impar = [] par = [] while True: todos.append(int(input('Digite um valor: '))) soun = str(input('Quer adicionar mais ? [S/N] ')).strip()[0] if soun in 'Nn': break for n in todos: if n % 2 == 0: par.append(n) for v in todos: if v % 2 != 0: impar.append(v) print('=' * 40) print(f'Os numeros digitados sao estes {todos}') print(f'Os pares sao {par}.\nE os impares sao {impar}.')
todos = [] impar = [] par = [] while True: todos.append(int(input('Digite um valor: '))) soun = str(input('Quer adicionar mais ? [S/N] ')).strip()[0] if soun in 'Nn': break for n in todos: if n % 2 == 0: par.append(n) for v in todos: if v % 2 != 0: impar.append(v) print('=' * 40) print(f'Os numeros digitados sao estes {todos}') print(f'Os pares sao {par}.\nE os impares sao {impar}.')
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ num = "1" for _ in range(1, n): digit = num[0] count = 1 newNum = "" for j in range(1, len(num)): if num[j] == digit: count += 1 else: newNum += str(count) + digit digit = num[j] count = 1 newNum += str(count) + digit num = newNum return num
class Solution(object): def count_and_say(self, n): """ :type n: int :rtype: str """ num = '1' for _ in range(1, n): digit = num[0] count = 1 new_num = '' for j in range(1, len(num)): if num[j] == digit: count += 1 else: new_num += str(count) + digit digit = num[j] count = 1 new_num += str(count) + digit num = newNum return num
def print_formatted(N): width = len(bin(N)[2:]) for i in range(1, N + 1): print(' '.join(map(lambda x: x.rjust(width), [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]]))) if __name__ == '__main__': n = int(input()) print_formatted(n)
def print_formatted(N): width = len(bin(N)[2:]) for i in range(1, N + 1): print(' '.join(map(lambda x: x.rjust(width), [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]]))) if __name__ == '__main__': n = int(input()) print_formatted(n)
class File: def __init__(self, hash, realName, extension, url): self.hash = hash self.realName = realName self.extension = extension self.url = url @staticmethod def from_DB(record): return File(record[0], record[1], record[2], record[3])
class File: def __init__(self, hash, realName, extension, url): self.hash = hash self.realName = realName self.extension = extension self.url = url @staticmethod def from_db(record): return file(record[0], record[1], record[2], record[3])
""" This module contains the utility functions for the main module. """ def request_type(request): """ If the request is for multiple addresses, build a str with separator """ if isinstance(request, list): # If the list is ints convert to string. to_string = ''.join(str(e) for e in request) # Finally build one string of the list. request = ",".join(to_string) return request # def have_confs(confirmations): # """ If the request has URI params we add them to the request string """ # confs = {'confirmations': confirmations} # if confs['confirmations'] > 0: # return True # else: # return False
""" This module contains the utility functions for the main module. """ def request_type(request): """ If the request is for multiple addresses, build a str with separator """ if isinstance(request, list): to_string = ''.join((str(e) for e in request)) request = ','.join(to_string) return request
class TicTacToe: def __init__(self) -> None: """ Create TicTacToe Game logic """ self.tic_board = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]] self.turn = True def play(self, x: int, y: int) -> bool: """ Playes one move for each player Args: x (int): x coords for place to play y (int): y coords for place to play Returns: bool: True if you can play the move else False """ if self.tic_board[x][y] != " ": return False if self.turn: self.tic_board[x][y] = "X" else: self.tic_board[x][y] = "O" self.turn = not self.turn return True def isMovesLeft(self) -> bool: """ Checks if any moves is left Returns: bool: True if there are any left moves """ for i in range(len(self.tic_board)): for j in range(len(self.tic_board[0])): if (self.tic_board[i][j] == " "): return True return False def movesLeft(self) -> int: """ Gets the number of moves left Returns: int: The number of empty cells """ sum = 0 for i in range(len(self.tic_board)): for j in range(len(self.tic_board[0])): if (self.tic_board[i][j] == " "): sum += 1 return sum def win(self) -> str: """ Function for when the player wins Returns: str: player X wins or player O wins """ check_x = ["X", "X", "X"] check_o = ["O", "O", "O"] win_x = "X wins" win_o = "O wins" for i in range(3): # check for horizontal wins if self.tic_board[i] == check_x: return win_x if self.tic_board[i] == check_o: return win_o # check for vertical wins if [row[i] for row in self.tic_board] == check_x: return win_x if [row[i] for row in self.tic_board] == check_o: return win_o # check for diagonals if [self.tic_board[i1][i1] for i1 in range(len(self.tic_board))] == check_x: return win_x if [self.tic_board[i1][i1] for i1 in range(len(self.tic_board))] == check_o: return win_o if [self.tic_board[i][len(self.tic_board[0])-i-1] for i in range(len(self.tic_board))] == check_x: return win_x if [self.tic_board[i][len(self.tic_board[0])-i-1] for i in range(len(self.tic_board))] == check_o: return win_o if not self.isMovesLeft(): return "Draw" return "" def __str__(self) -> str: """ToString method to print the class Returns: str: board in format ['', '', ''] ['', '', ''] ['', '', ''] """ return f"{self.tic_board[0]}\n{self.tic_board[1]}\n{self.tic_board[2]}" # Testing the TicTacToe class for bugs if __name__ == "__main__": game = TicTacToe() game.tic_board = [ ['X', 'O', 'O'], ['X', 'O', 'O'], ['X', 'X', 'X']] print(game) print(game.win())
class Tictactoe: def __init__(self) -> None: """ Create TicTacToe Game logic """ self.tic_board = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']] self.turn = True def play(self, x: int, y: int) -> bool: """ Playes one move for each player Args: x (int): x coords for place to play y (int): y coords for place to play Returns: bool: True if you can play the move else False """ if self.tic_board[x][y] != ' ': return False if self.turn: self.tic_board[x][y] = 'X' else: self.tic_board[x][y] = 'O' self.turn = not self.turn return True def is_moves_left(self) -> bool: """ Checks if any moves is left Returns: bool: True if there are any left moves """ for i in range(len(self.tic_board)): for j in range(len(self.tic_board[0])): if self.tic_board[i][j] == ' ': return True return False def moves_left(self) -> int: """ Gets the number of moves left Returns: int: The number of empty cells """ sum = 0 for i in range(len(self.tic_board)): for j in range(len(self.tic_board[0])): if self.tic_board[i][j] == ' ': sum += 1 return sum def win(self) -> str: """ Function for when the player wins Returns: str: player X wins or player O wins """ check_x = ['X', 'X', 'X'] check_o = ['O', 'O', 'O'] win_x = 'X wins' win_o = 'O wins' for i in range(3): if self.tic_board[i] == check_x: return win_x if self.tic_board[i] == check_o: return win_o if [row[i] for row in self.tic_board] == check_x: return win_x if [row[i] for row in self.tic_board] == check_o: return win_o if [self.tic_board[i1][i1] for i1 in range(len(self.tic_board))] == check_x: return win_x if [self.tic_board[i1][i1] for i1 in range(len(self.tic_board))] == check_o: return win_o if [self.tic_board[i][len(self.tic_board[0]) - i - 1] for i in range(len(self.tic_board))] == check_x: return win_x if [self.tic_board[i][len(self.tic_board[0]) - i - 1] for i in range(len(self.tic_board))] == check_o: return win_o if not self.isMovesLeft(): return 'Draw' return '' def __str__(self) -> str: """ToString method to print the class Returns: str: board in format ['', '', ''] ['', '', ''] ['', '', ''] """ return f'{self.tic_board[0]}\n{self.tic_board[1]}\n{self.tic_board[2]}' if __name__ == '__main__': game = tic_tac_toe() game.tic_board = [['X', 'O', 'O'], ['X', 'O', 'O'], ['X', 'X', 'X']] print(game) print(game.win())
class Node(object): def __init__(self, value, parent=None): self.value = value self.parent = parent def __eq__(self, other): if isinstance(other, Node): return self.value == other.value return NotImplemented def __ne__(self, other): return not self.__eq__(other) def __hash__(self): return hash(self.value) def __str__(self): return str(self.value) def lca(node1, node2): """ Return a least common ancestor. Memory and time complexity: O(s), where s is the distance between the two nodes. """ if not isinstance(node1, Node) or not isinstance(node2, Node): raise TypeError("Inputs should be a Node.") ancestors = set() while node1 or node2: if node1: if node1 in ancestors: return node1 else: ancestors.add(node1) node1 = node1.parent if node2: if node2 in ancestors: return node2 else: ancestors.add(node2) node2 = node2.parent raise Exception("Least common ancestor not found.") def main(): node1 = Node(1, None) node2 = Node(2, node1) node3 = Node(3, node1) node4 = Node(4, node2) node5 = Node(5, node2) node6 = Node(6, node3) node7 = Node(7, node3) node8 = Node(8, node4) node9 = Node(9, node4) print(lca(node1, node1)) # 1 print(lca(node7, node7)) # 7 print(lca(node1, node2)) # 1 print(lca(node8, node9)) # 4 print(lca(node8, node6)) # 1 print(lca(node5, node9)) # 2 if __name__ == '__main__': main()
class Node(object): def __init__(self, value, parent=None): self.value = value self.parent = parent def __eq__(self, other): if isinstance(other, Node): return self.value == other.value return NotImplemented def __ne__(self, other): return not self.__eq__(other) def __hash__(self): return hash(self.value) def __str__(self): return str(self.value) def lca(node1, node2): """ Return a least common ancestor. Memory and time complexity: O(s), where s is the distance between the two nodes. """ if not isinstance(node1, Node) or not isinstance(node2, Node): raise type_error('Inputs should be a Node.') ancestors = set() while node1 or node2: if node1: if node1 in ancestors: return node1 else: ancestors.add(node1) node1 = node1.parent if node2: if node2 in ancestors: return node2 else: ancestors.add(node2) node2 = node2.parent raise exception('Least common ancestor not found.') def main(): node1 = node(1, None) node2 = node(2, node1) node3 = node(3, node1) node4 = node(4, node2) node5 = node(5, node2) node6 = node(6, node3) node7 = node(7, node3) node8 = node(8, node4) node9 = node(9, node4) print(lca(node1, node1)) print(lca(node7, node7)) print(lca(node1, node2)) print(lca(node8, node9)) print(lca(node8, node6)) print(lca(node5, node9)) if __name__ == '__main__': main()
class Vertex: def __init__(self, id): self.id = id self.edges = set() def outgoing_edges(self): for edge in self.edges: successor = edge.get_successor(self) if successor is not None: yield edge
class Vertex: def __init__(self, id): self.id = id self.edges = set() def outgoing_edges(self): for edge in self.edges: successor = edge.get_successor(self) if successor is not None: yield edge
""" Test cases for micro-grid systems The following systems are considered 1. AC micro-grid 2. DC micro-grid 3. Hybrid AC/DC micro-grid """
""" Test cases for micro-grid systems The following systems are considered 1. AC micro-grid 2. DC micro-grid 3. Hybrid AC/DC micro-grid """
# -*- coding: UTF-8 -*- light = input('input a light') if light == 'red': print('GoGoGO') elif light == 'green': print('stop')
light = input('input a light') if light == 'red': print('GoGoGO') elif light == 'green': print('stop')
''' Resources/other/contact _______________________ Contact information for XL Discoverer. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' __all__ = [ 'AUTHOR', 'AUTHOR_EMAIL', 'MAINTAINER', 'MAINTAINER_EMAIL' ] # EMAIL # ----- AUTHOR_EMAIL = 'ahuszagh@gmail.com' MAINTAINER_EMAIL = 'crosslinkdiscoverer@gmail.com' # PEOPLE # ------ AUTHOR = 'Alex Huszagh' MAINTAINER = 'Alex Huszagh'
""" Resources/other/contact _______________________ Contact information for XL Discoverer. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. """ __all__ = ['AUTHOR', 'AUTHOR_EMAIL', 'MAINTAINER', 'MAINTAINER_EMAIL'] author_email = 'ahuszagh@gmail.com' maintainer_email = 'crosslinkdiscoverer@gmail.com' author = 'Alex Huszagh' maintainer = 'Alex Huszagh'
# -* coding: utf-8 -*- """Numerical polynomial and multivariate polynomial library.""" __version__ = '0.0.1.dev0'
"""Numerical polynomial and multivariate polynomial library.""" __version__ = '0.0.1.dev0'
# Binary Tree Level Order Traversal - Breadth First Search 1 # Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def levelTraverse(self, node, level): if (level == len(self.levels)): self.levels.append([]) self.levels[level].append(node.val) if (node.left): self.levelTraverse(node.left, level + 1) if (node.right): self.levelTraverse(node.right, level + 1) def levelOrder(self, root): if not root: return [] self.levels = [] self.levelTraverse(root, 0) return self.levels # Time Complexity: O(N) # Space Complexity: O(N)
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def level_traverse(self, node, level): if level == len(self.levels): self.levels.append([]) self.levels[level].append(node.val) if node.left: self.levelTraverse(node.left, level + 1) if node.right: self.levelTraverse(node.right, level + 1) def level_order(self, root): if not root: return [] self.levels = [] self.levelTraverse(root, 0) return self.levels
# Seasons.py -- Hass helper python_script to turn a Climate entity into a smart # thermostat, with support for multiple thermostats each having their own # schedule. # # INPUTS: # * climate_unit (required): The Climate entity to be controlled # * global_mode (required): an entity whose state is the desired global climate # mode (usually an input_select) # * state_entity (required): an input_text entity, unique to this climate_unit, # where the script can store some information between runs. # * at_home_sensor (optional): an entity that represents whether anyone is home # (usually a binary_sensor) # * from_timer (optional): whether the script was triggered by timer. If true, # only changes that modify the last-set operation mode or setpoint take # effect. This is done so that manual changes are left alone until the next # schedule switch. # # The last input is the 'seasons' dictionary as defined below, which defines the # scheduled behavior for each global mode / climate unit combination. It's a # dictionary keyed by a tuple of global mode and climate unit. Each entry is a # list of schedules, where each schedule has the following fields: # * title: Used only for logging and to help you find the right entry for edits # * time_on / time_off (optional): Start and stop of this schedule, 24-hour # hours:minutes. If not given, this schedule is always active (though see # window and if_away/if_home below) # * days: (optional): String defining days of week this schedule is active, matched # on the schedule's start time. Seven characters, dash or dot if not active, any # other character if active. You can use 0123456 or MTWTFSS or whatever you like. # Monday is first, following Python datetime convention. # * operation (required): The operating mode for this schedule, one of the modes # supported by your climate entity. # * setpoint (optional): The desired temperature for this schedule. Some modes # (e.g. 'dry' dehumidifaction) don't require a setpoint so it's optional # * window (optional): If given, if this entity's state is 'on' (i.e. the given # window is open), the schedule will act as if its operation mode is 'off'. # This is so you don't attempt to heat/cool the great outdoors if you left the # window open for some fresh air. # * if_away / if_home (optional): If present, this schedule will only apply if # the at_home_sensor state matches (true meaning someone is home). If no # at_home_sensor is given, these are both always false. # * humidity_sensor (optional): See if_humid. Note: could also be some other # type of sensor, like dewpoint. # * if_humid (optional): Percentage. If present, this schedule will only apply # if the humidity reported by the humidity_sensor is above this value at the # beginning of the period. # # Put this script in <config>/python_scripts (create the directory if needed) # and activate it as described at # https://www.home-assistant.io/components/python_script/ . # You should set up automations to call service python_script.seasons for each # relevant climate unit for the each of the following events: # * your global_mode entity changes (all climate units) # * your at_home_sensor changes (all climate units) # * your window sensor(s) change(s) (relevant climate units) # * on a time_interval, suggested every 15 minutes. (all climate units). This # interval is the resolution of your scheduled changes, so make it more or # less frequent as required. SEASONS = { ('Cold Winter', 'climate.first_floor_heat'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Cold Winter', 'climate.second_floor'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Cold Winter', 'climate.loft_heat'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Winter', 'climate.first_floor_heat'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Winter', 'climate.second_floor'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Winter', 'climate.master_br'): [ { 'title': 'Winter Sleeping', 'time_on': '21:29', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 64 } ], ('Winter', 'climate.loft_heat'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Cold Shoulder', 'climate.first_floor_heat'): [ { 'title': 'Ecobee schedule', 'operation': 'heat' } ], ('Cold Shoulder', 'climate.master_br'): [ { 'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 67 }, { 'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68 }, { 'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 64 }, { 'title': 'Day (Away)', 'time_on': '07:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 62 }, { 'title': 'Day (Home)', 'time_on': '07:59', 'time_off': '17:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68 }, { 'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'if_away': True, 'setpoint': 62 }, { 'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68 } ], ('Cold Shoulder', 'climate.loft_heat'): [ { 'title': 'Morning Boost', 'operation': 'heat', 'time_on': '06:59', 'time_off': '07:44', 'window': 'binary_sensor.skylight', 'setpoint': 68 } ], ('Cold Shoulder', 'climate.loft'): [ { 'title': 'Night', 'operation': 'heat', 'time_on': '00:04', 'time_off': '07:14', 'window': 'binary_sensor.skylight', 'setpoint': 61 }, { 'title': 'Day (Weekday)', 'days': 'MTWTF..', 'operation': 'heat', 'time_on': '07:14', 'time_off': '16:59', 'window': 'binary_sensor.skylight', 'setpoint': 68 }, { 'title': 'Day (Weekend)', 'days': '.....SS', 'operation': 'heat', 'time_on': '08:59', 'time_off': '16:59', 'window': 'binary_sensor.skylight', 'setpoint': 62 }, { 'title': 'Evening', 'operation': 'heat', 'time_on': '16:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 63 } ], ('Warm Shoulder', 'climate.first_floor'): [ { 'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 68 }, { 'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 68 }, { 'title': 'Pre-Sleeping', 'time_on': '21:44', 'time_off': '21:59', 'operation': 'heat', 'setpoint': 62 }, { 'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 62 }, { 'title': 'Day (Away)', 'time_on': '08:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'setpoint': 62 }, { 'title': 'Day (Home)', 'time_on': '08:59', 'time_off': '17:59', 'operation': 'heat', 'setpoint': 68 }, { 'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'if_away': True, 'setpoint': 62 }, { 'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'setpoint': 69 } ], ('Warm Shoulder', 'climate.master_br'): [ { 'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 67 }, { 'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 68 }, { 'title': 'Pre-Sleeping', 'time_on': '21:44', 'time_off': '21:59', 'operation': 'heat', 'setpoint': 64 }, { 'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 64 }, { 'title': 'Day (Away)', 'time_on': '08:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'setpoint': 62 }, { 'title': 'Day (Home)', 'time_on': '08:59', 'time_off': '17:59', 'operation': 'heat', 'setpoint': 68 }, { 'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'if_away': True, 'setpoint': 62 }, { 'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'setpoint': 68 } ], ('Warm Shoulder', 'climate.loft'): [ { 'title': 'Night', 'operation': 'heat', 'time_on': '00:04', 'time_off': '07:29', 'window': 'binary_sensor.skylight', 'setpoint': 61 }, { 'title': 'Day (Weekday)', 'days': 'MTWTF..', 'operation': 'heat', 'time_on': '07:29', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 68 }, { 'title': 'Day (Weekend)', 'days': '.....SS', 'operation': 'heat', 'time_on': '08:59', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 62 }, { 'title': 'Evening', 'operation': 'heat', 'time_on': '17:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 63 } ], ('Normal Summer', 'climate.master_br'): [ { 'title': 'Dehumidify', 'time_on': '19:59', 'time_off': '20:59', 'operation': 'dry', 'humidity_sensor': 'sensor.dewpoint_mbr', 'if_humid': 63, 'window': 'binary_sensor.bedroom_window', }, { 'title': 'Sleeping-early', 'time_on': '20:59', 'time_off': '02:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 73 }, { 'title': 'Sleeping-late', 'time_on': '02:59', 'time_off': '07:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 74 }, ], ('Hot Summer', 'climate.master_br'): [ { 'title': 'Dehumidify', 'time_on': '19:59', 'time_off': '20:59', 'operation': 'dry', 'humidity_sensor': 'sensor.dewpoint_mbr', 'if_humid': 63, 'window': 'binary_sensor.bedroom_window', }, { 'title': 'Sleeping-early', 'time_on': '20:59', 'time_off': '02:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 73 }, { 'title': 'Sleeping-late', 'time_on': '02:59', 'time_off': '07:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 74 }, { 'title': 'Day (Away)', 'time_on': '08:29', 'time_off': '19:44', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'if_away': True, 'setpoint': 78 }, { 'title': 'Day (Home)', 'time_on': '08:29', 'time_off': '19:44', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 76 }, ], ('Hot Summer', 'climate.loft'): [ { 'title': 'Night', 'operation': 'cool', 'time_on': '00:04', 'time_off': '08:59', 'window': 'binary_sensor.skylight', 'setpoint': 83 }, { 'title': 'Day (away)', 'operation': 'cool', 'time_on': '08:59', 'time_off': '17:59', 'if_away': True, 'window': 'binary_sensor.skylight', 'setpoint': 85 }, { 'title': 'Day', 'operation': 'cool', 'time_on': '08:59', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 80 }, { 'title': 'Evening', 'operation': 'cool', 'time_on': '17:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 81 } ], ('Hot Summer', 'climate.first_floor'): [ { 'title': 'Sleeping', 'time_on': '21:59', 'time_off': '05:59', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 78 }, { 'title': 'Day (Away)', 'time_on': '07:59', 'time_off': '15:59', 'operation': 'cool', 'window': 'binary_sensor.first_floor_windows', 'if_away': True, 'setpoint': 78 }, { 'title': 'Day (Home)', 'time_on': '05:59', 'time_off': '15:59', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 75 }, { 'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'cool', 'window': 'binary_sensor.first_floor_windows', 'if_away': True, 'setpoint': 78 }, { 'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 75 } ] } def is_time_between(begin_time, end_time, check_time): if begin_time < end_time: return begin_time <= check_time <= end_time # crosses midnight return check_time >= begin_time or check_time <= end_time def time_offset(orig_time, offset): hour = orig_time.hour minute = orig_time.minute minute = minute + offset if minute < 0: hour = hour - 1 minute = minute + 60 if minute > 60: hour = hour + 1 minute = minute - 60 if hour < 0: hour = hour + 24 if hour > 24: hour = hour - 24 return datetime.time(hour=hour, minute=minute) def day_of_start(start_time, end_time, check_time): today = datetime.datetime.now().weekday() # today if doesn't cross midnight or no actual times given if (not start_time) or (not end_time) or start_time <= end_time: return today # today if we're between start and midnight if start_time <= check_time: return today # Otherwise, yesterday return 6 if today == 0 else today - 1 saved_state = hass.states.get(data.get('state_entity')).state climate_unit = data.get('climate_unit', 'climate.master_br') current_mode = hass.states.get(data.get('global_mode')).state from_timer = data.get('from_timer', False) at_home_sensor = data.get('at_home_sensor') is_home = False is_away = False if at_home_sensor: is_home = hass.states.get(at_home_sensor).state == 'on' is_away = not is_home now = datetime.datetime.now().time() key = (current_mode, climate_unit) schedules = SEASONS.get(key) matched = False setpoint = None turn_on = False turn_off = False desired_operation = None title = None next_state = None if not schedules: logger.info("No schedules for {}".format(key)) else: for schedule in schedules: time_on_str = schedule.get('time_on') time_off_str = schedule.get('time_off') time_on = None time_off = None if time_on_str: time_on = datetime.datetime.strptime(time_on_str, '%H:%M').time() if time_off_str: time_off = datetime.datetime.strptime(time_off_str, '%H:%M').time() start_day = day_of_start(time_on, time_off, now) day_match = True days = schedule.get('days') if days and len(days) == 7: day_match = days[start_day] != '-' and days[start_day] != '.' in_interval = day_match and (((not time_on) or (not time_off) or is_time_between(time_on, time_off, now))) home_away_match = True if schedule.get('if_home'): home_away_match = is_home if schedule.get('if_away'): home_away_match = not is_home dry_exclude = False hs = schedule.get('humidity_sensor') if hs and schedule.get('if_humid'): dry_exclude = float(hass.states.get(hs).state) < float(schedule['if_humid']) if in_interval and home_away_match and not dry_exclude: # When we get here, we have schedules for this unit and # global mode and we're in this schedule's interval. # We will obey this schedule and ignore subsequent matches if not time_on: time_on = datetime.datetime.strptime('00:00', '%H:%M').time() window_open = False if schedule.get('window'): window_open = hass.states.get(schedule['window']).state == 'on' else: window_open = False decided = False matched = True next_state = "%s-%s" % (str(schedule.get('operation')), str(schedule.get('setpoint'))) same_next_state = (next_state == saved_state) if window_open: # Off if window is open turn_off = True title = schedule.get('title') + ' (Window open)' decided = True if (not decided) and from_timer and (not same_next_state): desired_operation = schedule.get('operation') if desired_operation == 'off': turn_off = True else: turn_on = True setpoint = schedule.get('setpoint') title = schedule.get('title') decided = True if not decided and (not from_timer): desired_operation = schedule.get('operation') if desired_operation == 'off': turn_off = True else: turn_on = True setpoint = schedule.get('setpoint') title = schedule.get('title') decided = True break if not matched and current_mode != "Manual": # If no schedules matched, turn off except in Manual next_state = "off-None" same_next_state = (next_state == saved_state) if (not from_timer) or (not same_next_state): turn_off = True title = 'Default (Off)' if turn_off: desired_operation = 'off' if desired_operation: logger.info("Setting {} to mode {} target {} from schedule {}".format( climate_unit, desired_operation, setpoint, title)) service_data = { "entity_id": climate_unit, "hvac_mode": desired_operation } hass.services.call('climate', 'set_hvac_mode', service_data, False) if setpoint: time.sleep(2.0) if '.' in str(setpoint): setpoint_num = float(setpoint) else: setpoint_num = int(setpoint) service_data = { "entity_id": climate_unit, "temperature": setpoint_num, "hvac_mode": desired_operation } hass.services.call('climate', 'set_temperature', service_data, False) if next_state: hass.states.set(data.get('state_entity'), next_state)
seasons = {('Cold Winter', 'climate.first_floor_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Winter', 'climate.second_floor'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Winter', 'climate.loft_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Winter', 'climate.first_floor_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Winter', 'climate.second_floor'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Winter', 'climate.master_br'): [{'title': 'Winter Sleeping', 'time_on': '21:29', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 64}], ('Winter', 'climate.loft_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Shoulder', 'climate.first_floor_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Shoulder', 'climate.master_br'): [{'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 67}, {'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68}, {'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 64}, {'title': 'Day (Away)', 'time_on': '07:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 62}, {'title': 'Day (Home)', 'time_on': '07:59', 'time_off': '17:59', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68}, {'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'if_away': True, 'setpoint': 62}, {'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'window': 'binary_sensor.bedroom_window', 'setpoint': 68}], ('Cold Shoulder', 'climate.loft_heat'): [{'title': 'Morning Boost', 'operation': 'heat', 'time_on': '06:59', 'time_off': '07:44', 'window': 'binary_sensor.skylight', 'setpoint': 68}], ('Cold Shoulder', 'climate.loft'): [{'title': 'Night', 'operation': 'heat', 'time_on': '00:04', 'time_off': '07:14', 'window': 'binary_sensor.skylight', 'setpoint': 61}, {'title': 'Day (Weekday)', 'days': 'MTWTF..', 'operation': 'heat', 'time_on': '07:14', 'time_off': '16:59', 'window': 'binary_sensor.skylight', 'setpoint': 68}, {'title': 'Day (Weekend)', 'days': '.....SS', 'operation': 'heat', 'time_on': '08:59', 'time_off': '16:59', 'window': 'binary_sensor.skylight', 'setpoint': 62}, {'title': 'Evening', 'operation': 'heat', 'time_on': '16:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 63}], ('Warm Shoulder', 'climate.first_floor'): [{'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 68}, {'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 68}, {'title': 'Pre-Sleeping', 'time_on': '21:44', 'time_off': '21:59', 'operation': 'heat', 'setpoint': 62}, {'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 62}, {'title': 'Day (Away)', 'time_on': '08:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'setpoint': 62}, {'title': 'Day (Home)', 'time_on': '08:59', 'time_off': '17:59', 'operation': 'heat', 'setpoint': 68}, {'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'if_away': True, 'setpoint': 62}, {'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'setpoint': 69}], ('Warm Shoulder', 'climate.master_br'): [{'title': 'Morning (weekday)', 'days': 'MTWTF..', 'time_on': '05:44', 'time_off': '07:59', 'operation': 'heat', 'setpoint': 67}, {'title': 'Morning (weekend)', 'days': '.....SS', 'time_on': '07:29', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 68}, {'title': 'Pre-Sleeping', 'time_on': '21:44', 'time_off': '21:59', 'operation': 'heat', 'setpoint': 64}, {'title': 'Sleeping', 'time_on': '21:59', 'time_off': '08:59', 'operation': 'heat', 'setpoint': 64}, {'title': 'Day (Away)', 'time_on': '08:59', 'time_off': '16:29', 'if_away': True, 'operation': 'heat', 'setpoint': 62}, {'title': 'Day (Home)', 'time_on': '08:59', 'time_off': '17:59', 'operation': 'heat', 'setpoint': 68}, {'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'heat', 'if_away': True, 'setpoint': 62}, {'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'operation': 'heat', 'setpoint': 68}], ('Warm Shoulder', 'climate.loft'): [{'title': 'Night', 'operation': 'heat', 'time_on': '00:04', 'time_off': '07:29', 'window': 'binary_sensor.skylight', 'setpoint': 61}, {'title': 'Day (Weekday)', 'days': 'MTWTF..', 'operation': 'heat', 'time_on': '07:29', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 68}, {'title': 'Day (Weekend)', 'days': '.....SS', 'operation': 'heat', 'time_on': '08:59', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 62}, {'title': 'Evening', 'operation': 'heat', 'time_on': '17:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 63}], ('Normal Summer', 'climate.master_br'): [{'title': 'Dehumidify', 'time_on': '19:59', 'time_off': '20:59', 'operation': 'dry', 'humidity_sensor': 'sensor.dewpoint_mbr', 'if_humid': 63, 'window': 'binary_sensor.bedroom_window'}, {'title': 'Sleeping-early', 'time_on': '20:59', 'time_off': '02:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 73}, {'title': 'Sleeping-late', 'time_on': '02:59', 'time_off': '07:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 74}], ('Hot Summer', 'climate.master_br'): [{'title': 'Dehumidify', 'time_on': '19:59', 'time_off': '20:59', 'operation': 'dry', 'humidity_sensor': 'sensor.dewpoint_mbr', 'if_humid': 63, 'window': 'binary_sensor.bedroom_window'}, {'title': 'Sleeping-early', 'time_on': '20:59', 'time_off': '02:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 73}, {'title': 'Sleeping-late', 'time_on': '02:59', 'time_off': '07:59', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 74}, {'title': 'Day (Away)', 'time_on': '08:29', 'time_off': '19:44', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'if_away': True, 'setpoint': 78}, {'title': 'Day (Home)', 'time_on': '08:29', 'time_off': '19:44', 'operation': 'cool', 'window': 'binary_sensor.bedroom_window', 'setpoint': 76}], ('Hot Summer', 'climate.loft'): [{'title': 'Night', 'operation': 'cool', 'time_on': '00:04', 'time_off': '08:59', 'window': 'binary_sensor.skylight', 'setpoint': 83}, {'title': 'Day (away)', 'operation': 'cool', 'time_on': '08:59', 'time_off': '17:59', 'if_away': True, 'window': 'binary_sensor.skylight', 'setpoint': 85}, {'title': 'Day', 'operation': 'cool', 'time_on': '08:59', 'time_off': '17:59', 'window': 'binary_sensor.skylight', 'setpoint': 80}, {'title': 'Evening', 'operation': 'cool', 'time_on': '17:59', 'time_off': '00:04', 'window': 'binary_sensor.skylight', 'setpoint': 81}], ('Hot Summer', 'climate.first_floor'): [{'title': 'Sleeping', 'time_on': '21:59', 'time_off': '05:59', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 78}, {'title': 'Day (Away)', 'time_on': '07:59', 'time_off': '15:59', 'operation': 'cool', 'window': 'binary_sensor.first_floor_windows', 'if_away': True, 'setpoint': 78}, {'title': 'Day (Home)', 'time_on': '05:59', 'time_off': '15:59', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 75}, {'title': 'Evening (Away)', 'time_on': '17:59', 'time_off': '21:44', 'operation': 'cool', 'window': 'binary_sensor.first_floor_windows', 'if_away': True, 'setpoint': 78}, {'title': 'Evening (Home)', 'time_on': '15:59', 'time_off': '21:44', 'window': 'binary_sensor.first_floor_windows', 'operation': 'cool', 'setpoint': 75}]} def is_time_between(begin_time, end_time, check_time): if begin_time < end_time: return begin_time <= check_time <= end_time return check_time >= begin_time or check_time <= end_time def time_offset(orig_time, offset): hour = orig_time.hour minute = orig_time.minute minute = minute + offset if minute < 0: hour = hour - 1 minute = minute + 60 if minute > 60: hour = hour + 1 minute = minute - 60 if hour < 0: hour = hour + 24 if hour > 24: hour = hour - 24 return datetime.time(hour=hour, minute=minute) def day_of_start(start_time, end_time, check_time): today = datetime.datetime.now().weekday() if not start_time or not end_time or start_time <= end_time: return today if start_time <= check_time: return today return 6 if today == 0 else today - 1 saved_state = hass.states.get(data.get('state_entity')).state climate_unit = data.get('climate_unit', 'climate.master_br') current_mode = hass.states.get(data.get('global_mode')).state from_timer = data.get('from_timer', False) at_home_sensor = data.get('at_home_sensor') is_home = False is_away = False if at_home_sensor: is_home = hass.states.get(at_home_sensor).state == 'on' is_away = not is_home now = datetime.datetime.now().time() key = (current_mode, climate_unit) schedules = SEASONS.get(key) matched = False setpoint = None turn_on = False turn_off = False desired_operation = None title = None next_state = None if not schedules: logger.info('No schedules for {}'.format(key)) else: for schedule in schedules: time_on_str = schedule.get('time_on') time_off_str = schedule.get('time_off') time_on = None time_off = None if time_on_str: time_on = datetime.datetime.strptime(time_on_str, '%H:%M').time() if time_off_str: time_off = datetime.datetime.strptime(time_off_str, '%H:%M').time() start_day = day_of_start(time_on, time_off, now) day_match = True days = schedule.get('days') if days and len(days) == 7: day_match = days[start_day] != '-' and days[start_day] != '.' in_interval = day_match and (not time_on or not time_off or is_time_between(time_on, time_off, now)) home_away_match = True if schedule.get('if_home'): home_away_match = is_home if schedule.get('if_away'): home_away_match = not is_home dry_exclude = False hs = schedule.get('humidity_sensor') if hs and schedule.get('if_humid'): dry_exclude = float(hass.states.get(hs).state) < float(schedule['if_humid']) if in_interval and home_away_match and (not dry_exclude): if not time_on: time_on = datetime.datetime.strptime('00:00', '%H:%M').time() window_open = False if schedule.get('window'): window_open = hass.states.get(schedule['window']).state == 'on' else: window_open = False decided = False matched = True next_state = '%s-%s' % (str(schedule.get('operation')), str(schedule.get('setpoint'))) same_next_state = next_state == saved_state if window_open: turn_off = True title = schedule.get('title') + ' (Window open)' decided = True if not decided and from_timer and (not same_next_state): desired_operation = schedule.get('operation') if desired_operation == 'off': turn_off = True else: turn_on = True setpoint = schedule.get('setpoint') title = schedule.get('title') decided = True if not decided and (not from_timer): desired_operation = schedule.get('operation') if desired_operation == 'off': turn_off = True else: turn_on = True setpoint = schedule.get('setpoint') title = schedule.get('title') decided = True break if not matched and current_mode != 'Manual': next_state = 'off-None' same_next_state = next_state == saved_state if not from_timer or not same_next_state: turn_off = True title = 'Default (Off)' if turn_off: desired_operation = 'off' if desired_operation: logger.info('Setting {} to mode {} target {} from schedule {}'.format(climate_unit, desired_operation, setpoint, title)) service_data = {'entity_id': climate_unit, 'hvac_mode': desired_operation} hass.services.call('climate', 'set_hvac_mode', service_data, False) if setpoint: time.sleep(2.0) if '.' in str(setpoint): setpoint_num = float(setpoint) else: setpoint_num = int(setpoint) service_data = {'entity_id': climate_unit, 'temperature': setpoint_num, 'hvac_mode': desired_operation} hass.services.call('climate', 'set_temperature', service_data, False) if next_state: hass.states.set(data.get('state_entity'), next_state)
# -------------- # Code starts here class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class= class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) # Code ends here # -------------- # Code starts here courses= {'Math':65,'English':70,'History':80,'French':70,'Science':60} total= 65+70+80+70+60 print(total) percentage= ((total)/500)*100 print(percentage) # Code ends here # -------------- # Code starts here mathematics={'Geoffrey Hinton':78,'Andrew Ng':95,'Sebastian Raschka':65,'Yoshua Benjio':50, 'Hilary Mason':70,'Corinna Cortes':66,'Peter Warden':75} topper= max(mathematics,key=mathematics.get) print(topper) # Code ends here # -------------- # Given string topper = 'andrew ng' # Code starts here first_name=(topper.split( )[0]) print(first_name) last_name=(topper.split( )[1]) print(last_name) #first_name=print(topper[0:6]) #last_name=print(topper[7:9]) full_name ='ng' +' '+ 'andrew' certificate_name=full_name.upper() print(certificate_name) #print(full_name) # Code ends here
class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) courses = {'Math': 65, 'English': 70, 'History': 80, 'French': 70, 'Science': 60} total = 65 + 70 + 80 + 70 + 60 print(total) percentage = total / 500 * 100 print(percentage) mathematics = {'Geoffrey Hinton': 78, 'Andrew Ng': 95, 'Sebastian Raschka': 65, 'Yoshua Benjio': 50, 'Hilary Mason': 70, 'Corinna Cortes': 66, 'Peter Warden': 75} topper = max(mathematics, key=mathematics.get) print(topper) topper = 'andrew ng' first_name = topper.split()[0] print(first_name) last_name = topper.split()[1] print(last_name) full_name = 'ng' + ' ' + 'andrew' certificate_name = full_name.upper() print(certificate_name)
# Init conventions for input generation ROT_DIR_REF = -1 CURRENT_DIR_REF = -1 PHASE_DIR_REF = -1 class InputError(Exception): """Raised when the input data are incomplete or incorrect""" pass
rot_dir_ref = -1 current_dir_ref = -1 phase_dir_ref = -1 class Inputerror(Exception): """Raised when the input data are incomplete or incorrect""" pass
def join_bash_scripts(scripts): """ have the option of creating a wrapper script for every group of bash files to be run, or just join them on the fly. """ if len(scripts) < 2: raise NotImplementedError output_script = scripts[0] for script in scripts[1:]: output_script = output_script + ''.join(script.splitlines(True)[1:]) return output_script def open_files(filenames): """open files and return contents.""" return list(map(lambda file: open(file, 'r').read(), filenames))
def join_bash_scripts(scripts): """ have the option of creating a wrapper script for every group of bash files to be run, or just join them on the fly. """ if len(scripts) < 2: raise NotImplementedError output_script = scripts[0] for script in scripts[1:]: output_script = output_script + ''.join(script.splitlines(True)[1:]) return output_script def open_files(filenames): """open files and return contents.""" return list(map(lambda file: open(file, 'r').read(), filenames))
def cria(linhas, colunas): return {'linhas': linhas, 'colunas': colunas, 'dados': {}} #[[0,3],[1,2]] def criaLst(matriz_lst): linhas = len(matriz_lst) #2 colunas = len(matriz_lst[0]) #2 dados = {} #{(0,1): 3, (1,0):1, (1,1):2} for i in range(linhas): for j in range(colunas): if matriz_lst[i][j] != 0: #Cast to int before dados[i,j] = matriz_lst[i][j] return {'linhas': linhas, 'colunas': colunas, 'dados': dados} def carrega(nome_arquivo): matriz_file = open(nome_arquivo, 'rt', encoding='utf8') linha_matriz = matriz_file.readline() matriz_lst = [] while linha_matriz != "": temp = '' linha_mat = [] for i in range(len(linha_matriz)): if linha_matriz[i] != ' ': temp += linha_matriz[i] elif len(temp) > 0: striped_temp = temp.strip() striped_temp = float(striped_temp) linha_mat.append(striped_temp) temp = '' if len(temp) > 0: striped_temp = temp.strip() striped_temp = float(striped_temp) linha_mat.append(striped_temp) matriz_lst.append(linha_mat) linha_matriz = matriz_file.readline() matriz_file.close() return criaLst(matriz_lst) def salva(tadMat, nome_arquivo): matriz_file = open(nome_arquivo, 'wt', encoding='utf8') linhas = tadMat['linhas'] colunas = tadMat['colunas'] linha_lst = [] for l in range(linhas): for c in range(colunas): linha_lst.append("{:.1f}".format(getElem(tadMat,l,c))) matriz_file.write(" ".join(linha_lst)+"\n") linha_lst.clear() matriz_file.close() return tadMat def destroi(): return None def getElem(tadMat, linha, coluna): chave = (linha,coluna) if linha < tadMat['linhas'] and coluna < tadMat['colunas']: if chave in tadMat['dados'].keys(): return tadMat['dados'][chave] else: return 0 else: return None def setElem(tadMat, linha, coluna, valor): chave = (linha,coluna) if linha < tadMat['linhas'] and coluna < tadMat['colunas']: if chave in tadMat['dados'].keys(): existente = tadMat['dados'][chave] else: existente = 0 if valor == 0 and existente == 0: return elif valor == 0 and existente != 0: del tadMat['dados'][linha, coluna] elif valor != 0 and existente == 0: tadMat['dados'][linha, coluna] = valor elif valor != 0 and existente != 0: tadMat['dados'][linha, coluna] = valor else: return None def subtracao(tadMatA, tadMatB): #User o getElem e o setElem vai facilitar linhasA = tadMatA['linhas'] colunasA = tadMatA['colunas'] if (linhasA == tadMatB['linhas']) and (colunasA == tadMatB['colunas']): tadMatC = cria(linhasA, colunasA) for l in range(linhasA): for c in range(colunasA): setElem(tadMatC,l,c,getElem(tadMatA,l,c) - getElem(tadMatB,l,c)) return tadMatC else: return None def soma(tadMatA, tadMatB): #User o getElem e o setElem vai facilitar linhasA = tadMatA['linhas'] colunasA = tadMatA['colunas'] if (linhasA == tadMatB['linhas']) and (colunasA == tadMatB['colunas']): tadMatC = cria(linhasA, colunasA) for l in range(linhasA): for c in range(colunasA): setElem(tadMatC,l,c,getElem(tadMatA,l,c) + getElem(tadMatB,l,c)) return tadMatC else: return None def vezesK(tadMat, k): linhas = tadMat['linhas'] colunas = tadMat['colunas'] for l in range(linhas): for c in range(colunas): setElem(tadMat,l,c,getElem(tadMat,l,c) * k) return tadMat def multi(tadMatA, tadMatB): colunasA = tadMatA['colunas'] linhasB = tadMatB['linhas'] if colunasA == linhasB: linhasA = tadMatA['linhas'] colunasB = tadMatB['colunas'] tadMatC_lst = [] for l in range(linhasA): tadMatC_lst.append([]) for c in range(colunasB): tadMatC_lst[l].append(0) for k in range(colunasA): tadMatC_lst[l][c] += getElem(tadMatA, l, k) * getElem(tadMatB, k, c) return criaLst(tadMatC_lst) else: return None def clona(tadMat): linhas = tadMat['linhas'] colunas = tadMat['colunas'] dados = tadMat['dados'] return {'linhas': linhas, 'colunas': colunas, 'dados': dados } def quantLinhas(tadMat): return tadMat['linhas'] def quantColunas(tadMat): return tadMat['colunas'] def diagP(tadMat): diagP_lst = [] linhas = tadMat['linhas'] colunas = tadMat['colunas'] if linhas == colunas: for l in range(linhas): for c in range(colunas): if l == c: diagP_lst.append(getElem(tadMat,l,c)) return diagP_lst else: return None def diagS(tadMat): diagS_lst = [] linhas = tadMat['linhas'] colunas = tadMat['colunas'] if linhas == colunas: for l in range(linhas): for c in range(colunas): if (colunas - 1) == (l + c): diagS_lst.append(getElem(tadMat,l,c)) return diagS_lst else: return None def transposta(tadMat): linhas = tadMat['linhas'] colunas = tadMat['colunas'] dados = tadMat['dados'] dados_t = {} for key in dados: dados_t[key[1],key[0]] = dados[key] tadMat['linhas'] = colunas tadMat['colunas'] = linhas tadMat['dados'] = dados_t
def cria(linhas, colunas): return {'linhas': linhas, 'colunas': colunas, 'dados': {}} def cria_lst(matriz_lst): linhas = len(matriz_lst) colunas = len(matriz_lst[0]) dados = {} for i in range(linhas): for j in range(colunas): if matriz_lst[i][j] != 0: dados[i, j] = matriz_lst[i][j] return {'linhas': linhas, 'colunas': colunas, 'dados': dados} def carrega(nome_arquivo): matriz_file = open(nome_arquivo, 'rt', encoding='utf8') linha_matriz = matriz_file.readline() matriz_lst = [] while linha_matriz != '': temp = '' linha_mat = [] for i in range(len(linha_matriz)): if linha_matriz[i] != ' ': temp += linha_matriz[i] elif len(temp) > 0: striped_temp = temp.strip() striped_temp = float(striped_temp) linha_mat.append(striped_temp) temp = '' if len(temp) > 0: striped_temp = temp.strip() striped_temp = float(striped_temp) linha_mat.append(striped_temp) matriz_lst.append(linha_mat) linha_matriz = matriz_file.readline() matriz_file.close() return cria_lst(matriz_lst) def salva(tadMat, nome_arquivo): matriz_file = open(nome_arquivo, 'wt', encoding='utf8') linhas = tadMat['linhas'] colunas = tadMat['colunas'] linha_lst = [] for l in range(linhas): for c in range(colunas): linha_lst.append('{:.1f}'.format(get_elem(tadMat, l, c))) matriz_file.write(' '.join(linha_lst) + '\n') linha_lst.clear() matriz_file.close() return tadMat def destroi(): return None def get_elem(tadMat, linha, coluna): chave = (linha, coluna) if linha < tadMat['linhas'] and coluna < tadMat['colunas']: if chave in tadMat['dados'].keys(): return tadMat['dados'][chave] else: return 0 else: return None def set_elem(tadMat, linha, coluna, valor): chave = (linha, coluna) if linha < tadMat['linhas'] and coluna < tadMat['colunas']: if chave in tadMat['dados'].keys(): existente = tadMat['dados'][chave] else: existente = 0 if valor == 0 and existente == 0: return elif valor == 0 and existente != 0: del tadMat['dados'][linha, coluna] elif valor != 0 and existente == 0: tadMat['dados'][linha, coluna] = valor elif valor != 0 and existente != 0: tadMat['dados'][linha, coluna] = valor else: return None def subtracao(tadMatA, tadMatB): linhas_a = tadMatA['linhas'] colunas_a = tadMatA['colunas'] if linhasA == tadMatB['linhas'] and colunasA == tadMatB['colunas']: tad_mat_c = cria(linhasA, colunasA) for l in range(linhasA): for c in range(colunasA): set_elem(tadMatC, l, c, get_elem(tadMatA, l, c) - get_elem(tadMatB, l, c)) return tadMatC else: return None def soma(tadMatA, tadMatB): linhas_a = tadMatA['linhas'] colunas_a = tadMatA['colunas'] if linhasA == tadMatB['linhas'] and colunasA == tadMatB['colunas']: tad_mat_c = cria(linhasA, colunasA) for l in range(linhasA): for c in range(colunasA): set_elem(tadMatC, l, c, get_elem(tadMatA, l, c) + get_elem(tadMatB, l, c)) return tadMatC else: return None def vezes_k(tadMat, k): linhas = tadMat['linhas'] colunas = tadMat['colunas'] for l in range(linhas): for c in range(colunas): set_elem(tadMat, l, c, get_elem(tadMat, l, c) * k) return tadMat def multi(tadMatA, tadMatB): colunas_a = tadMatA['colunas'] linhas_b = tadMatB['linhas'] if colunasA == linhasB: linhas_a = tadMatA['linhas'] colunas_b = tadMatB['colunas'] tad_mat_c_lst = [] for l in range(linhasA): tadMatC_lst.append([]) for c in range(colunasB): tadMatC_lst[l].append(0) for k in range(colunasA): tadMatC_lst[l][c] += get_elem(tadMatA, l, k) * get_elem(tadMatB, k, c) return cria_lst(tadMatC_lst) else: return None def clona(tadMat): linhas = tadMat['linhas'] colunas = tadMat['colunas'] dados = tadMat['dados'] return {'linhas': linhas, 'colunas': colunas, 'dados': dados} def quant_linhas(tadMat): return tadMat['linhas'] def quant_colunas(tadMat): return tadMat['colunas'] def diag_p(tadMat): diag_p_lst = [] linhas = tadMat['linhas'] colunas = tadMat['colunas'] if linhas == colunas: for l in range(linhas): for c in range(colunas): if l == c: diagP_lst.append(get_elem(tadMat, l, c)) return diagP_lst else: return None def diag_s(tadMat): diag_s_lst = [] linhas = tadMat['linhas'] colunas = tadMat['colunas'] if linhas == colunas: for l in range(linhas): for c in range(colunas): if colunas - 1 == l + c: diagS_lst.append(get_elem(tadMat, l, c)) return diagS_lst else: return None def transposta(tadMat): linhas = tadMat['linhas'] colunas = tadMat['colunas'] dados = tadMat['dados'] dados_t = {} for key in dados: dados_t[key[1], key[0]] = dados[key] tadMat['linhas'] = colunas tadMat['colunas'] = linhas tadMat['dados'] = dados_t
# -*- coding: utf-8 -*- def main(): n, l = list(map(int, input().split())) s = input() tab_count = 1 crash_count = 0 for si in s: if si == '+': tab_count += 1 else: tab_count -= 1 if tab_count > l: crash_count += 1 tab_count = 1 print(crash_count) if __name__ == '__main__': main()
def main(): (n, l) = list(map(int, input().split())) s = input() tab_count = 1 crash_count = 0 for si in s: if si == '+': tab_count += 1 else: tab_count -= 1 if tab_count > l: crash_count += 1 tab_count = 1 print(crash_count) if __name__ == '__main__': main()
#Autor Manuela Garcia Monsalve # 28 septiembre 2018 #Esta es la super clase Vehiculo donde se encuentran los atributos de marca, modelo y color que seran #heredados para las subclases class Vehiculo(): def __init__(self,marca,color, modelo): #Se generan los atributos para poder ser heredados self.marca = marca self.color = color self.modelo = modelo def Prender(self): #Metodo prender vehiculo pass def Arrancar(self):#Metodo arrancar vehiculo pass def Apagar(self):#Metodo apagar vehiculo pass
class Vehiculo: def __init__(self, marca, color, modelo): self.marca = marca self.color = color self.modelo = modelo def prender(self): pass def arrancar(self): pass def apagar(self): pass
widget_types = [ "textinput", # Editable text input box "textupdate", # Read only text update "led", # On/Off LED indicator "combo", # Select from a number of choice values "icon", # This field gives the URL for an icon for the whole Block "group", # Group node in a TreeView that other fields can attach to "table", # Table of rows. A list is a single column table "checkbox", # A box that can be checked or not "flowgraph", # Boxes with lines representing child blocks and connections ] def widget(widget_type): """Associates a widget with this field""" assert widget_type in widget_types, \ "Got %r, expected one of %s" % (widget_type, widget_types) tag = "widget:%s" % widget_type return tag port_types = [ "bool", # Boolean "int32", # 32-bit signed integer "NDArray", # areaDetector NDArray port "CS", # Motor co-ordinate system ] def inport(port_type, disconnected_value): """Marks this field as an inport""" assert port_type in port_types, \ "Got %r, expected one of %s" % (port_type, port_types) tag = "inport:%s:%s" % (port_type, disconnected_value) return tag def outport(port_type, connected_value): """Marks this field as an outport""" assert port_type in port_types, \ "Got %r, expected one of %s" % (port_type, port_types) tag = "outport:%s:%s" % (port_type, connected_value) return tag def group(group_name): """Marks this field as belonging to a group""" tag = "group:%s" % group_name return tag def config(): """Marks this field as a value that should be saved and loaded at config""" tag = "config" return tag
widget_types = ['textinput', 'textupdate', 'led', 'combo', 'icon', 'group', 'table', 'checkbox', 'flowgraph'] def widget(widget_type): """Associates a widget with this field""" assert widget_type in widget_types, 'Got %r, expected one of %s' % (widget_type, widget_types) tag = 'widget:%s' % widget_type return tag port_types = ['bool', 'int32', 'NDArray', 'CS'] def inport(port_type, disconnected_value): """Marks this field as an inport""" assert port_type in port_types, 'Got %r, expected one of %s' % (port_type, port_types) tag = 'inport:%s:%s' % (port_type, disconnected_value) return tag def outport(port_type, connected_value): """Marks this field as an outport""" assert port_type in port_types, 'Got %r, expected one of %s' % (port_type, port_types) tag = 'outport:%s:%s' % (port_type, connected_value) return tag def group(group_name): """Marks this field as belonging to a group""" tag = 'group:%s' % group_name return tag def config(): """Marks this field as a value that should be saved and loaded at config""" tag = 'config' return tag
""" 17 Cupboards - https://codeforces.com/problemset/problem/248/A """ n = int(input()) nL, nR = 0, 0 for _ in range(n): x, y = map(int, input().split()) nL += x nR += y print(min(nL, n - nL) + min(nR, n - nR))
""" 17 Cupboards - https://codeforces.com/problemset/problem/248/A """ n = int(input()) (n_l, n_r) = (0, 0) for _ in range(n): (x, y) = map(int, input().split()) n_l += x n_r += y print(min(nL, n - nL) + min(nR, n - nR))
def cookie(x): if isinstance(x, str): cookie_eater = "Zach" elif isinstance(x, int) or isinstance(x, float): cookie_eater = "Monica" else: cookie_eater = "the dog" if x == True or x == False: cookie_eater = "the dog" return "Who ate the last cookie? It was %s!" % cookie_eater print(cookie("Ryan")) print(cookie(2.3)) print(cookie(True)) print(isinstance(True, float)) ## More common use: x = 200 print(type(x) == int)
def cookie(x): if isinstance(x, str): cookie_eater = 'Zach' elif isinstance(x, int) or isinstance(x, float): cookie_eater = 'Monica' else: cookie_eater = 'the dog' if x == True or x == False: cookie_eater = 'the dog' return 'Who ate the last cookie? It was %s!' % cookie_eater print(cookie('Ryan')) print(cookie(2.3)) print(cookie(True)) print(isinstance(True, float)) x = 200 print(type(x) == int)
result = '' for line in DATA: result += line + '\n'
result = '' for line in DATA: result += line + '\n'
# -*- coding: utf-8 -*- """ Model object specification and validation. """
""" Model object specification and validation. """
class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: dp = [[0] * len(matrix[0]) for i in range(len(matrix))] for row_i, row in enumerate(matrix): for col_i, col in enumerate(row): if col == "0": dp[row_i][col_i] = 0 else: dp[row_i][col_i] = self.find(col_i, row) mx = 0 print(dp) for i in range(len(dp)): for j in range(len(dp[i])): mx = max(mx, self.search(dp, i, j)) return mx def search(self, dp, start_row, start_col): start, up, down = dp[start_row][start_col], 0, 0 if start_row > 0: for i in range(start_row - 1, -1, -1): if start <= dp[i][start_col]: up += 1 else: break if start_row < len(dp) - 1: for i in range(start_row + 1, len(dp)): if start <= dp[i][start_col]: down += 1 else: break return start * (up + down + 1) def find(self, index, row): count = 0 for i in range(index, len(row)): if row[i] == "0": break count += 1 return count
class Solution: def maximal_rectangle(self, matrix: List[List[str]]) -> int: dp = [[0] * len(matrix[0]) for i in range(len(matrix))] for (row_i, row) in enumerate(matrix): for (col_i, col) in enumerate(row): if col == '0': dp[row_i][col_i] = 0 else: dp[row_i][col_i] = self.find(col_i, row) mx = 0 print(dp) for i in range(len(dp)): for j in range(len(dp[i])): mx = max(mx, self.search(dp, i, j)) return mx def search(self, dp, start_row, start_col): (start, up, down) = (dp[start_row][start_col], 0, 0) if start_row > 0: for i in range(start_row - 1, -1, -1): if start <= dp[i][start_col]: up += 1 else: break if start_row < len(dp) - 1: for i in range(start_row + 1, len(dp)): if start <= dp[i][start_col]: down += 1 else: break return start * (up + down + 1) def find(self, index, row): count = 0 for i in range(index, len(row)): if row[i] == '0': break count += 1 return count
# variables 4 a = "abc" b = 1 c = 1.5 d = True e = 3 + 5j print("a:", type(a), "b", type(b), "c:", type(c), "d:", type(d), "e:", type(e))
a = 'abc' b = 1 c = 1.5 d = True e = 3 + 5j print('a:', type(a), 'b', type(b), 'c:', type(c), 'd:', type(d), 'e:', type(e))
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold(x1, y1, x2, y2, r1, r2): distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) radSumSq = (r1 + r2) * (r1 + r2) if (distSq == radSumSq): return 1 elif (distSq > radSumSq): return - 1 else: return 0 #TOFILL if __name__ == '__main__': param = [ (11, 36, 62, 64, 50, 4,), (87, 1, 62, 64, 54, 41,), (51, 1, 47, 90, 14, 71,), (89, 67, 9, 52, 94, 21,), (64, 10, 79, 45, 67, 78,), (57, 86, 99, 43, 83, 63,), (65, 90, 42, 82, 77, 32,), (32, 23, 28, 26, 60, 45,), (73, 61, 63, 77, 92, 76,), (3, 99, 6, 19, 21, 28,) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success += 1 print("#Results: %i, %i" % (n_success, len(param)))
def f_gold(x1, y1, x2, y2, r1, r2): dist_sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) rad_sum_sq = (r1 + r2) * (r1 + r2) if distSq == radSumSq: return 1 elif distSq > radSumSq: return -1 else: return 0 if __name__ == '__main__': param = [(11, 36, 62, 64, 50, 4), (87, 1, 62, 64, 54, 41), (51, 1, 47, 90, 14, 71), (89, 67, 9, 52, 94, 21), (64, 10, 79, 45, 67, 78), (57, 86, 99, 43, 83, 63), (65, 90, 42, 82, 77, 32), (32, 23, 28, 26, 60, 45), (73, 61, 63, 77, 92, 76), (3, 99, 6, 19, 21, 28)] n_success = 0 for (i, parameters_set) in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success += 1 print('#Results: %i, %i' % (n_success, len(param)))
#!/usr/bin/env python # Task 1 instructions = list() with open("./dec_2/dec2_input.txt") as f: instructions = [x for x in f.read().split('\n')] start_position = [0, 0] for direction in instructions: info = direction.split(' ') vector, length = info[0], int(info[1]) if vector == "forward": start_position[0] += length elif vector == "up": start_position[1] -= length elif vector == "down": start_position[1] += length print(start_position[0] * start_position[1]) # Task 2 start_position = [0, 0, 0] for direction in instructions: info = direction.split(' ') vector, length = info[0], int(info[1]) if vector == "forward": start_position[0] += length start_position[1] += length * start_position[2] elif vector == "up": start_position[2] -= length elif vector == "down": start_position[2] += length print(info, start_position) print(start_position[0] * start_position[1])
instructions = list() with open('./dec_2/dec2_input.txt') as f: instructions = [x for x in f.read().split('\n')] start_position = [0, 0] for direction in instructions: info = direction.split(' ') (vector, length) = (info[0], int(info[1])) if vector == 'forward': start_position[0] += length elif vector == 'up': start_position[1] -= length elif vector == 'down': start_position[1] += length print(start_position[0] * start_position[1]) start_position = [0, 0, 0] for direction in instructions: info = direction.split(' ') (vector, length) = (info[0], int(info[1])) if vector == 'forward': start_position[0] += length start_position[1] += length * start_position[2] elif vector == 'up': start_position[2] -= length elif vector == 'down': start_position[2] += length print(info, start_position) print(start_position[0] * start_position[1])
a = input() s = [int(x) for x in input().split()] buff = 0 load = False for num in s: if num - buff < 0: load = True if num - buff >= 30: print(buff+30) break else: if load: buff += 5 load = False else: buff = num + 5 else: print(buff+30)
a = input() s = [int(x) for x in input().split()] buff = 0 load = False for num in s: if num - buff < 0: load = True if num - buff >= 30: print(buff + 30) break elif load: buff += 5 load = False else: buff = num + 5 else: print(buff + 30)
"""File IO.""" def re_readable_read(file): """Read file and reset cursor/pointer to allow fast, simple re-read. Side Effects: Mutates file stream object passed as argument by moving cursor/pointer from from position at start of function call and setting it to position '0'. If file stream has not been read before calling this function, there will be no effective change. Returns: str: Contents of read file. """ file_contents = file.read() file.seek(0) return file_contents def open_and_read(file): """Alias: read_contents""" read_contents(file) def read_contents(file): """Open file and read it. Returns: str: File contents. """ # with open(file, 'r') as stream: # return re_readable_read(stream) # return re_readable_read(open(file, 'r')) return open(file, 'r').read()
"""File IO.""" def re_readable_read(file): """Read file and reset cursor/pointer to allow fast, simple re-read. Side Effects: Mutates file stream object passed as argument by moving cursor/pointer from from position at start of function call and setting it to position '0'. If file stream has not been read before calling this function, there will be no effective change. Returns: str: Contents of read file. """ file_contents = file.read() file.seek(0) return file_contents def open_and_read(file): """Alias: read_contents""" read_contents(file) def read_contents(file): """Open file and read it. Returns: str: File contents. """ return open(file, 'r').read()
class OmnipyConfiguration(object): def __init__(self): self.mqtt_host = "" self.mqtt_port = 1883 self.mqtt_clientid = "" self.mqtt_command_topic = "" self.mqtt_response_topic = "" self.mqtt_rate_topic = ""
class Omnipyconfiguration(object): def __init__(self): self.mqtt_host = '' self.mqtt_port = 1883 self.mqtt_clientid = '' self.mqtt_command_topic = '' self.mqtt_response_topic = '' self.mqtt_rate_topic = ''
def solution(N): num = bin(N)[2:].split('1') if len(num[1:-1]) == 0: return 0 return len(max(num[1:-1], key=lambda x: len(x)))
def solution(N): num = bin(N)[2:].split('1') if len(num[1:-1]) == 0: return 0 return len(max(num[1:-1], key=lambda x: len(x)))
a = int(input()) b = int ( input ( ) ) a = int(input())
a = int(input()) b = int(input()) a = int(input())
class Solution(object): def shuffle(self, nums, n): """ :type nums: List[int] :type n: int :rtype: List[int] """ shuffled_array = [] for i in range(0, n): shuffled_array.append(nums[i]) shuffled_array.append(nums[i+n]) return shuffled_array s = Solution() print("Solution 1 :", s.shuffle([2, 5, 1, 3, 4, 7], 3)) print("Solution 2 :", s.shuffle([1, 2, 3, 4, 4, 3, 2, 1], 4)) print("Solution 1 :", s.shuffle([1, 1, 2, 2], 2))
class Solution(object): def shuffle(self, nums, n): """ :type nums: List[int] :type n: int :rtype: List[int] """ shuffled_array = [] for i in range(0, n): shuffled_array.append(nums[i]) shuffled_array.append(nums[i + n]) return shuffled_array s = solution() print('Solution 1 :', s.shuffle([2, 5, 1, 3, 4, 7], 3)) print('Solution 2 :', s.shuffle([1, 2, 3, 4, 4, 3, 2, 1], 4)) print('Solution 1 :', s.shuffle([1, 1, 2, 2], 2))
word = 'Python' word[0] = 'M'
word = 'Python' word[0] = 'M'
#Operator Name Example # > Greater than x > y x = 5 y = 3 print(x > y) # true
x = 5 y = 3 print(x > y)
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( x , y , z ) : c = 0 while ( x and y and z ) : x = x - 1 y = y - 1 z = z - 1 c = c + 1 return c #TOFILL if __name__ == '__main__': param = [ (23,98,25,), (87,55,94,), (35,90,29,), (25,9,41,), (93,22,39,), (52,42,96,), (95,88,26,), (91,64,51,), (75,1,6,), (96,44,76,) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success+=1 print("#Results: %i, %i" % (n_success, len(param)))
def f_gold(x, y, z): c = 0 while x and y and z: x = x - 1 y = y - 1 z = z - 1 c = c + 1 return c if __name__ == '__main__': param = [(23, 98, 25), (87, 55, 94), (35, 90, 29), (25, 9, 41), (93, 22, 39), (52, 42, 96), (95, 88, 26), (91, 64, 51), (75, 1, 6), (96, 44, 76)] n_success = 0 for (i, parameters_set) in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success += 1 print('#Results: %i, %i' % (n_success, len(param)))
# Voting with delegation. # Information about voters voters: public({ # weight is accumulated by delegation weight: num, # if true, that person already voted voted: bool, # person delegated to delegate: address, # index of the voted proposal vote: num }[address]) # This is a type for a list of proposals. proposals: public({ # short name (up to 32 bytes) name: bytes32, # number of accumulated votes vote_count: num }[num]) voter_count: public(num) chairperson: public(address) # Setup global variables def __init__(_proposalNames: bytes32[5]): self.chairperson = msg.sender self.voter_count = 0 for i in range(5): self.proposals[i] = { name: _proposalNames[i], vote_count: 0 } # Give `voter` the right to vote on this ballot. # May only be called by `chairperson`. def give_right_to_vote(voter: address): # Throws if sender is not chairpers assert msg.sender == self.chairperson # Throws if voter has already voted assert not self.voters[voter].voted # Throws if voters voting weight isn't 0 assert self.voters[voter].weight == 0 self.voters[voter].weight = 1 self.voter_count += 1 # Delegate your vote to the voter `to`. def delegate(_to: address): to = _to # Throws if sender has already voted assert not self.voters[msg.sender].voted # Throws if sender tries to delegate their vote to themselves assert not msg.sender == to # loop can delegate votes up to the current voter count for i in range(self.voter_count, self.voter_count+1): if self.voters[to].delegate: # Because there are not while loops, use recursion to forward the delegation # self.delegate(self.voters[to].delegate) assert self.voters[to].delegate != msg.sender to = self.voters[to].delegate self.voters[msg.sender].voted = True self.voters[msg.sender].delegate = to if self.voters[to].voted: # If the delegate already voted, # directly add to the number of votes self.proposals[self.voters[to].vote].vote_count += self.voters[msg.sender].weight else: # If the delegate did not vote yet, # add to her weight. self.voters[to].weight += self.voters[msg.sender].weight # Give your vote (including votes delegated to you) # to proposal `proposals[proposal].name`. def vote(proposal: num): assert not self.voters[msg.sender].voted self.voters[msg.sender].voted = True self.voters[msg.sender].vote = proposal # If `proposal` is out of the range of the array, # this will throw automatically and revert all # changes. self.proposals[proposal].vote_count += self.voters[msg.sender].weight # Computes the winning proposal taking all # previous votes into account. @constant def winning_proposal() -> num: winning_vote_count = 0 for i in range(5): if self.proposals[i].vote_count > winning_vote_count: winning_vote_count = self.proposals[i].vote_count winning_proposal = i return winning_proposal # Calls winning_proposal() function to get the index # of the winner contained in the proposals array and then # returns the name of the winner @constant def winner_name() -> bytes32: return self.proposals[self.winning_proposal()].name
voters: public({weight: num, voted: bool, delegate: address, vote: num}[address]) proposals: public({name: bytes32, vote_count: num}[num]) voter_count: public(num) chairperson: public(address) def __init__(_proposalNames: bytes32[5]): self.chairperson = msg.sender self.voter_count = 0 for i in range(5): self.proposals[i] = {name: _proposalNames[i], vote_count: 0} def give_right_to_vote(voter: address): assert msg.sender == self.chairperson assert not self.voters[voter].voted assert self.voters[voter].weight == 0 self.voters[voter].weight = 1 self.voter_count += 1 def delegate(_to: address): to = _to assert not self.voters[msg.sender].voted assert not msg.sender == to for i in range(self.voter_count, self.voter_count + 1): if self.voters[to].delegate: assert self.voters[to].delegate != msg.sender to = self.voters[to].delegate self.voters[msg.sender].voted = True self.voters[msg.sender].delegate = to if self.voters[to].voted: self.proposals[self.voters[to].vote].vote_count += self.voters[msg.sender].weight else: self.voters[to].weight += self.voters[msg.sender].weight def vote(proposal: num): assert not self.voters[msg.sender].voted self.voters[msg.sender].voted = True self.voters[msg.sender].vote = proposal self.proposals[proposal].vote_count += self.voters[msg.sender].weight @constant def winning_proposal() -> num: winning_vote_count = 0 for i in range(5): if self.proposals[i].vote_count > winning_vote_count: winning_vote_count = self.proposals[i].vote_count winning_proposal = i return winning_proposal @constant def winner_name() -> bytes32: return self.proposals[self.winning_proposal()].name
load( "@com_googlesource_gerrit_bazlets//tools:junit.bzl", "junit_tests", ) def tests(tests): for src in tests: name = src[len("tst/"):len(src) - len(".java")].replace("/", "_") labels = [] timeout = "moderate" if name.startswith("org_eclipse_jgit_"): package = name[len("org.eclipse.jgit_"):] if package.startswith("internal_storage_"): package = package[len("internal.storage_"):] index = package.find("_") if index > 0: labels.append(package[:index]) else: labels.append(index) if "lib" not in labels: labels.append("lib") # TODO(http://eclip.se/534285): Make this test pass reliably # and remove the flaky attribute. flaky = src.endswith("CrissCrossMergeTest.java") additional_deps = [] if src.endswith("RootLocaleTest.java"): additional_deps = [ "//org.eclipse.jgit.pgm:pgm", "//org.eclipse.jgit.ui:ui", ] if src.endswith("WalkEncryptionTest.java"): additional_deps = [ "//org.eclipse.jgit:insecure_cipher_factory", ] if src.endswith("OpenSshConfigTest.java"): additional_deps = [ "//lib:jsch", ] if src.endswith("JschConfigSessionFactoryTest.java"): additional_deps = [ "//lib:jsch", ] if src.endswith("ArchiveCommandTest.java"): additional_deps = [ "//lib:commons-compress", "//lib:xz", "//org.eclipse.jgit.archive:jgit-archive", ] heap_size = "-Xmx256m" if src.endswith("HugeCommitMessageTest.java"): heap_size = "-Xmx512m" if src.endswith("EolRepositoryTest.java") or src.endswith("GcCommitSelectionTest.java"): timeout = "long" junit_tests( name = name, tags = labels, srcs = [src], deps = additional_deps + [ ":helpers", ":tst_rsrc", "//lib:javaewah", "//lib:junit", "//lib:slf4j-api", "//org.eclipse.jgit:jgit", "//org.eclipse.jgit.junit:junit", "//org.eclipse.jgit.lfs:jgit-lfs", ], flaky = flaky, jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"], timeout = timeout, )
load('@com_googlesource_gerrit_bazlets//tools:junit.bzl', 'junit_tests') def tests(tests): for src in tests: name = src[len('tst/'):len(src) - len('.java')].replace('/', '_') labels = [] timeout = 'moderate' if name.startswith('org_eclipse_jgit_'): package = name[len('org.eclipse.jgit_'):] if package.startswith('internal_storage_'): package = package[len('internal.storage_'):] index = package.find('_') if index > 0: labels.append(package[:index]) else: labels.append(index) if 'lib' not in labels: labels.append('lib') flaky = src.endswith('CrissCrossMergeTest.java') additional_deps = [] if src.endswith('RootLocaleTest.java'): additional_deps = ['//org.eclipse.jgit.pgm:pgm', '//org.eclipse.jgit.ui:ui'] if src.endswith('WalkEncryptionTest.java'): additional_deps = ['//org.eclipse.jgit:insecure_cipher_factory'] if src.endswith('OpenSshConfigTest.java'): additional_deps = ['//lib:jsch'] if src.endswith('JschConfigSessionFactoryTest.java'): additional_deps = ['//lib:jsch'] if src.endswith('ArchiveCommandTest.java'): additional_deps = ['//lib:commons-compress', '//lib:xz', '//org.eclipse.jgit.archive:jgit-archive'] heap_size = '-Xmx256m' if src.endswith('HugeCommitMessageTest.java'): heap_size = '-Xmx512m' if src.endswith('EolRepositoryTest.java') or src.endswith('GcCommitSelectionTest.java'): timeout = 'long' junit_tests(name=name, tags=labels, srcs=[src], deps=additional_deps + [':helpers', ':tst_rsrc', '//lib:javaewah', '//lib:junit', '//lib:slf4j-api', '//org.eclipse.jgit:jgit', '//org.eclipse.jgit.junit:junit', '//org.eclipse.jgit.lfs:jgit-lfs'], flaky=flaky, jvm_flags=[heap_size, '-Dfile.encoding=UTF-8'], timeout=timeout)
#Exam def solution(N): if (N > 0) and (N < 1000): #Assume that N is an integer within 1 to 1000 list_of_coded_numbers = [] #List will contain the coded numbers in descending order while N > 0: if (N % 2 == 0) and (N % 3 == 0) and (N % 5 == 0): list_of_coded_numbers.append("CodilityTestCoders") elif (N % 3 == 0) and (N % 5 == 0): list_of_coded_numbers.append("TestCoders") elif (N % 2 == 0) and (N % 5 == 0): list_of_coded_numbers.append("CodilityCoders") elif (N % 2 == 0) and (N % 3 == 0): list_of_coded_numbers.append("CodilityTest") elif (N % 5 == 0): list_of_coded_numbers.append("Coders") elif (N % 3 == 0): list_of_coded_numbers.append("Test") elif (N % 2 == 0): list_of_coded_numbers.append("Codility") else: list_of_coded_numbers.append(N) N -= 1 list_of_coded_numbers.reverse() #Arrange the coded numbers in ascending order for coded_number in list_of_coded_numbers:# Print the coded numbers in each line print(coded_number) if __name__ == '__main__': solution(110)
def solution(N): if N > 0 and N < 1000: list_of_coded_numbers = [] while N > 0: if N % 2 == 0 and N % 3 == 0 and (N % 5 == 0): list_of_coded_numbers.append('CodilityTestCoders') elif N % 3 == 0 and N % 5 == 0: list_of_coded_numbers.append('TestCoders') elif N % 2 == 0 and N % 5 == 0: list_of_coded_numbers.append('CodilityCoders') elif N % 2 == 0 and N % 3 == 0: list_of_coded_numbers.append('CodilityTest') elif N % 5 == 0: list_of_coded_numbers.append('Coders') elif N % 3 == 0: list_of_coded_numbers.append('Test') elif N % 2 == 0: list_of_coded_numbers.append('Codility') else: list_of_coded_numbers.append(N) n -= 1 list_of_coded_numbers.reverse() for coded_number in list_of_coded_numbers: print(coded_number) if __name__ == '__main__': solution(110)
# # This file is part of stac2odc # Copyright (C) 2020 INPE. # # stac2odc is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # __version__ = '0.0.1'
__version__ = '0.0.1'
""" LINK: https://leetcode.com/problems/power-of-three/ Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Input: n = 27 Output: true Example 2: Input: n = 0 Output: false Example 3: Input: n = 9 Output: true Example 4: Input: n = 45 Output: false Constraints: -231 <= n <= 231 - 1 Follow up: Could you do it without using any loop / recursion? """ def isPowerOfThree(n): if not n: return False while not n%3: n /= 3 return n==1 def isPowerOfThree_recursive(n): if not n: return False elif n==1: return True elif not n%3: return isPowerOfThree_recursive(n/3) return False
""" LINK: https://leetcode.com/problems/power-of-three/ Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Input: n = 27 Output: true Example 2: Input: n = 0 Output: false Example 3: Input: n = 9 Output: true Example 4: Input: n = 45 Output: false Constraints: -231 <= n <= 231 - 1 Follow up: Could you do it without using any loop / recursion? """ def is_power_of_three(n): if not n: return False while not n % 3: n /= 3 return n == 1 def is_power_of_three_recursive(n): if not n: return False elif n == 1: return True elif not n % 3: return is_power_of_three_recursive(n / 3) return False
str = 'X-DSPAM-Confidence:0.8475' print(str) colon = str.find(":") fnum = float(str[colon+1:]) print("Number from string equals:", fnum)
str = 'X-DSPAM-Confidence:0.8475' print(str) colon = str.find(':') fnum = float(str[colon + 1:]) print('Number from string equals:', fnum)
# Python > Strings > String Validators # Identify the presence of alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters in a string. # # https://www.hackerrank.com/challenges/string-validators/problem # if __name__ == '__main__': s = input() # any alphanumeric characters print(any(c.isalnum() for c in s)) # any alphabetical characters print(any(c.isalpha() for c in s)) # any digits print(any(c.isdigit() for c in s)) # any lowercase characters print(any(c.islower() for c in s)) # any uppercase characters print(any(c.isupper() for c in s))
if __name__ == '__main__': s = input() print(any((c.isalnum() for c in s))) print(any((c.isalpha() for c in s))) print(any((c.isdigit() for c in s))) print(any((c.islower() for c in s))) print(any((c.isupper() for c in s)))
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ a=input() print(a[0].upper()+a[1:])
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ a = input() print(a[0].upper() + a[1:])
DOMAIN = "airthings" KEY_API = "api" PLATFORMS = ("sensor",) ERROR_LOGIN_FAILED = "login_failed"
domain = 'airthings' key_api = 'api' platforms = ('sensor',) error_login_failed = 'login_failed'
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' def associate_customer_gateway(CustomerGatewayArn=None, GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Associates a customer gateway with a device and optionally, with a link. If you specify a link, it must be associated with the specified device. You can only associate customer gateways that are connected to a VPN attachment on a transit gateway. The transit gateway must be registered in your global network. When you register a transit gateway, customer gateways that are connected to the transit gateway are automatically included in the global network. To list customer gateways that are connected to a transit gateway, use the DescribeVpnConnections EC2 API and filter by transit-gateway-id . You cannot associate a customer gateway with more than one device and link. See also: AWS API Documentation Exceptions :example: response = client.associate_customer_gateway( CustomerGatewayArn='string', GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type CustomerGatewayArn: string :param CustomerGatewayArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the customer gateway. For more information, see Resources Defined by Amazon EC2 .\n :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: [REQUIRED]\nThe ID of the device.\n :type LinkId: string :param LinkId: The ID of the link. :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- CustomerGatewayAssociation (dict) -- The customer gateway association. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def associate_link(GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Associates a link to a device. A device can be associated to multiple links and a link can be associated to multiple devices. The device and link must be in the same global network and the same site. See also: AWS API Documentation Exceptions :example: response = client.associate_link( GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: [REQUIRED]\nThe ID of the device.\n :type LinkId: string :param LinkId: [REQUIRED]\nThe ID of the link.\n :rtype: dict ReturnsResponse Syntax { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- LinkAssociation (dict) -- The link association. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). """ pass def create_device(GlobalNetworkId=None, Description=None, Type=None, Vendor=None, Model=None, SerialNumber=None, Location=None, SiteId=None, Tags=None): """ Creates a new device in a global network. If you specify both a site ID and a location, the location of the site is used for visualization in the Network Manager console. See also: AWS API Documentation Exceptions :example: response = client.create_device( GlobalNetworkId='string', Description='string', Type='string', Vendor='string', Model='string', SerialNumber='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, SiteId='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type Description: string :param Description: A description of the device.\nLength Constraints: Maximum length of 256 characters.\n :type Type: string :param Type: The type of the device. :type Vendor: string :param Vendor: The vendor of the device.\nLength Constraints: Maximum length of 128 characters.\n :type Model: string :param Model: The model of the device.\nLength Constraints: Maximum length of 128 characters.\n :type SerialNumber: string :param SerialNumber: The serial number of the device.\nLength Constraints: Maximum length of 128 characters.\n :type Location: dict :param Location: The location of the device.\n\nAddress (string) --The physical address.\n\nLatitude (string) --The latitude.\n\nLongitude (string) --The longitude.\n\n\n :type SiteId: string :param SiteId: The ID of the site. :type Tags: list :param Tags: The tags to apply to the resource during creation.\n\n(dict) --Describes a tag.\n\nKey (string) --The tag key.\nLength Constraints: Maximum length of 128 characters.\n\nValue (string) --The tag value.\nLength Constraints: Maximum length of 256 characters.\n\n\n\n\n :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_global_network(Description=None, Tags=None): """ Creates a new, empty global network. See also: AWS API Documentation Exceptions :example: response = client.create_global_network( Description='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type Description: string :param Description: A description of the global network.\nLength Constraints: Maximum length of 256 characters.\n :type Tags: list :param Tags: The tags to apply to the resource during creation.\n\n(dict) --Describes a tag.\n\nKey (string) --The tag key.\nLength Constraints: Maximum length of 128 characters.\n\nValue (string) --The tag value.\nLength Constraints: Maximum length of 256 characters.\n\n\n\n\n :rtype: dict ReturnsResponse Syntax { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) -- Information about the global network object. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_link(GlobalNetworkId=None, Description=None, Type=None, Bandwidth=None, Provider=None, SiteId=None, Tags=None): """ Creates a new link for a specified site. See also: AWS API Documentation Exceptions :example: response = client.create_link( GlobalNetworkId='string', Description='string', Type='string', Bandwidth={ 'UploadSpeed': 123, 'DownloadSpeed': 123 }, Provider='string', SiteId='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type Description: string :param Description: A description of the link.\nLength Constraints: Maximum length of 256 characters.\n :type Type: string :param Type: The type of the link.\nConstraints: Cannot include the following characters: | ^\nLength Constraints: Maximum length of 128 characters.\n :type Bandwidth: dict :param Bandwidth: [REQUIRED]\nThe upload speed and download speed in Mbps.\n\nUploadSpeed (integer) --Upload speed in Mbps.\n\nDownloadSpeed (integer) --Download speed in Mbps.\n\n\n :type Provider: string :param Provider: The provider of the link.\nConstraints: Cannot include the following characters: | ^\nLength Constraints: Maximum length of 128 characters.\n :type SiteId: string :param SiteId: [REQUIRED]\nThe ID of the site.\n :type Tags: list :param Tags: The tags to apply to the resource during creation.\n\n(dict) --Describes a tag.\n\nKey (string) --The tag key.\nLength Constraints: Maximum length of 128 characters.\n\nValue (string) --The tag value.\nLength Constraints: Maximum length of 256 characters.\n\n\n\n\n :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_site(GlobalNetworkId=None, Description=None, Location=None, Tags=None): """ Creates a new site in a global network. See also: AWS API Documentation Exceptions :example: response = client.create_site( GlobalNetworkId='string', Description='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type Description: string :param Description: A description of your site.\nLength Constraints: Maximum length of 256 characters.\n :type Location: dict :param Location: The site location. This information is used for visualization in the Network Manager console. If you specify the address, the latitude and longitude are automatically calculated.\n\nAddress : The physical address of the site.\nLatitude : The latitude of the site.\nLongitude : The longitude of the site.\n\n\nAddress (string) --The physical address.\n\nLatitude (string) --The latitude.\n\nLongitude (string) --The longitude.\n\n\n :type Tags: list :param Tags: The tags to apply to the resource during creation.\n\n(dict) --Describes a tag.\n\nKey (string) --The tag key.\nLength Constraints: Maximum length of 128 characters.\n\nValue (string) --The tag value.\nLength Constraints: Maximum length of 256 characters.\n\n\n\n\n :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_device(GlobalNetworkId=None, DeviceId=None): """ Deletes an existing device. You must first disassociate the device from any links and customer gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_device( GlobalNetworkId='string', DeviceId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: [REQUIRED]\nThe ID of the device.\n :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_global_network(GlobalNetworkId=None): """ Deletes an existing global network. You must first delete all global network objects (devices, links, and sites) and deregister all transit gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_global_network( GlobalNetworkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :rtype: dict ReturnsResponse Syntax{ 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) --Information about the global network. GlobalNetworkId (string) --The ID of the global network. GlobalNetworkArn (string) --The Amazon Resource Name (ARN) of the global network. Description (string) --The description of the global network. CreatedAt (datetime) --The date and time that the global network was created. State (string) --The state of the global network. Tags (list) --The tags for the global network. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } """ pass def delete_link(GlobalNetworkId=None, LinkId=None): """ Deletes an existing link. You must first disassociate the link from any devices and customer gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_link( GlobalNetworkId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type LinkId: string :param LinkId: [REQUIRED]\nThe ID of the link.\n :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_site(GlobalNetworkId=None, SiteId=None): """ Deletes an existing site. The site cannot be associated with any device or link. See also: AWS API Documentation Exceptions :example: response = client.delete_site( GlobalNetworkId='string', SiteId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type SiteId: string :param SiteId: [REQUIRED]\nThe ID of the site.\n :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def deregister_transit_gateway(GlobalNetworkId=None, TransitGatewayArn=None): """ Deregisters a transit gateway from your global network. This action does not delete your transit gateway, or modify any of its attachments. This action removes any customer gateway associations. See also: AWS API Documentation Exceptions :example: response = client.deregister_transit_gateway( GlobalNetworkId='string', TransitGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type TransitGatewayArn: string :param TransitGatewayArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the transit gateway.\n :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } Response Structure (dict) -- TransitGatewayRegistration (dict) -- The transit gateway registration information. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def describe_global_networks(GlobalNetworkIds=None, MaxResults=None, NextToken=None): """ Describes one or more global networks. By default, all global networks are described. To describe the objects in your global network, you must use the appropriate Get* action. For example, to list the transit gateways in your global network, use GetTransitGatewayRegistrations . See also: AWS API Documentation Exceptions :example: response = client.describe_global_networks( GlobalNetworkIds=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkIds: list :param GlobalNetworkIds: The IDs of one or more global networks. The maximum is 10.\n\n(string) --\n\n :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'GlobalNetworks': [ { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- GlobalNetworks (list) -- Information about the global networks. (dict) -- Describes a global network. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetworks': [ { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def disassociate_customer_gateway(GlobalNetworkId=None, CustomerGatewayArn=None): """ Disassociates a customer gateway from a device and a link. See also: AWS API Documentation Exceptions :example: response = client.disassociate_customer_gateway( GlobalNetworkId='string', CustomerGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type CustomerGatewayArn: string :param CustomerGatewayArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the customer gateway. For more information, see Resources Defined by Amazon EC2 .\n :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- CustomerGatewayAssociation (dict) -- Information about the customer gateway association. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def disassociate_link(GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Disassociates an existing device from a link. You must first disassociate any customer gateways that are associated with the link. See also: AWS API Documentation Exceptions :example: response = client.disassociate_link( GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: [REQUIRED]\nThe ID of the device.\n :type LinkId: string :param LinkId: [REQUIRED]\nThe ID of the link.\n :rtype: dict ReturnsResponse Syntax { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- LinkAssociation (dict) -- Information about the link association. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to\nClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model. """ pass def get_customer_gateway_associations(GlobalNetworkId=None, CustomerGatewayArns=None, MaxResults=None, NextToken=None): """ Gets the association information for customer gateways that are associated with devices and links in your global network. See also: AWS API Documentation Exceptions :example: response = client.get_customer_gateway_associations( GlobalNetworkId='string', CustomerGatewayArns=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type CustomerGatewayArns: list :param CustomerGatewayArns: One or more customer gateway Amazon Resource Names (ARNs). For more information, see Resources Defined by Amazon EC2 . The maximum is 10.\n\n(string) --\n\n :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociations': [ { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } Response Structure (dict) -- CustomerGatewayAssociations (list) -- The customer gateway associations. (dict) -- Describes the association between a customer gateway, a device, and a link. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociations': [ { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_devices(GlobalNetworkId=None, DeviceIds=None, SiteId=None, MaxResults=None, NextToken=None): """ Gets information about one or more of your devices in a global network. See also: AWS API Documentation Exceptions :example: response = client.get_devices( GlobalNetworkId='string', DeviceIds=[ 'string', ], SiteId='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceIds: list :param DeviceIds: One or more device IDs. The maximum is 10.\n\n(string) --\n\n :type SiteId: string :param SiteId: The ID of the site. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Devices': [ { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Devices (list) -- The devices. (dict) -- Describes a device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Devices': [ { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_link_associations(GlobalNetworkId=None, DeviceId=None, LinkId=None, MaxResults=None, NextToken=None): """ Gets the link associations for a device or a link. Either the device ID or the link ID must be specified. See also: AWS API Documentation Exceptions :example: response = client.get_link_associations( GlobalNetworkId='string', DeviceId='string', LinkId='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: The ID of the device. :type LinkId: string :param LinkId: The ID of the link. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'LinkAssociations': [ { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } Response Structure (dict) -- LinkAssociations (list) -- The link associations. (dict) -- Describes the association between a device and a link. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociations': [ { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_links(GlobalNetworkId=None, LinkIds=None, SiteId=None, Type=None, Provider=None, MaxResults=None, NextToken=None): """ Gets information about one or more links in a specified global network. If you specify the site ID, you cannot specify the type or provider in the same request. You can specify the type and provider in the same request. See also: AWS API Documentation Exceptions :example: response = client.get_links( GlobalNetworkId='string', LinkIds=[ 'string', ], SiteId='string', Type='string', Provider='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type LinkIds: list :param LinkIds: One or more link IDs. The maximum is 10.\n\n(string) --\n\n :type SiteId: string :param SiteId: The ID of the site. :type Type: string :param Type: The link type. :type Provider: string :param Provider: The link provider. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Links': [ { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Links (list) -- The links. (dict) -- Describes a link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Links': [ { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} ReturnsA paginator object. """ pass def get_sites(GlobalNetworkId=None, SiteIds=None, MaxResults=None, NextToken=None): """ Gets information about one or more of your sites in a global network. See also: AWS API Documentation Exceptions :example: response = client.get_sites( GlobalNetworkId='string', SiteIds=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type SiteIds: list :param SiteIds: One or more site IDs. The maximum is 10.\n\n(string) --\n\n :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Sites': [ { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Sites (list) -- The sites. (dict) -- Describes a site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Sites': [ { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_transit_gateway_registrations(GlobalNetworkId=None, TransitGatewayArns=None, MaxResults=None, NextToken=None): """ Gets information about the transit gateway registrations in a specified global network. See also: AWS API Documentation Exceptions :example: response = client.get_transit_gateway_registrations( GlobalNetworkId='string', TransitGatewayArns=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type TransitGatewayArns: list :param TransitGatewayArns: The Amazon Resource Names (ARNs) of one or more transit gateways. The maximum is 10.\n\n(string) --\n\n :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistrations': [ { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } }, ], 'NextToken': 'string' } Response Structure (dict) -- TransitGatewayRegistrations (list) -- The transit gateway registrations. (dict) -- Describes the registration of a transit gateway to a global network. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistrations': [ { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_waiter(waiter_name=None): """ Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters. :rtype: botocore.waiter.Waiter """ pass def list_tags_for_resource(ResourceArn=None): """ Lists the tags for a specified resource. See also: AWS API Documentation Exceptions :example: response = client.list_tags_for_resource( ResourceArn='string' ) :type ResourceArn: string :param ResourceArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the resource.\n :rtype: dict ReturnsResponse Syntax{ 'TagList': [ { 'Key': 'string', 'Value': 'string' }, ] } Response Structure (dict) -- TagList (list) --The list of tags. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TagList': [ { 'Key': 'string', 'Value': 'string' }, ] } """ pass def register_transit_gateway(GlobalNetworkId=None, TransitGatewayArn=None): """ Registers a transit gateway in your global network. The transit gateway can be in any AWS Region, but it must be owned by the same AWS account that owns the global network. You cannot register a transit gateway in more than one global network. See also: AWS API Documentation Exceptions :example: response = client.register_transit_gateway( GlobalNetworkId='string', TransitGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type TransitGatewayArn: string :param TransitGatewayArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the transit gateway. For more information, see Resources Defined by Amazon EC2 .\n :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } Response Structure (dict) -- TransitGatewayRegistration (dict) -- Information about the transit gateway registration. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def tag_resource(ResourceArn=None, Tags=None): """ Tags a specified resource. See also: AWS API Documentation Exceptions :example: response = client.tag_resource( ResourceArn='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type ResourceArn: string :param ResourceArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the resource.\n :type Tags: list :param Tags: [REQUIRED]\nThe tags to apply to the specified resource.\n\n(dict) --Describes a tag.\n\nKey (string) --The tag key.\nLength Constraints: Maximum length of 128 characters.\n\nValue (string) --The tag value.\nLength Constraints: Maximum length of 256 characters.\n\n\n\n\n :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: {} :returns: (dict) -- """ pass def untag_resource(ResourceArn=None, TagKeys=None): """ Removes tags from a specified resource. See also: AWS API Documentation Exceptions :example: response = client.untag_resource( ResourceArn='string', TagKeys=[ 'string', ] ) :type ResourceArn: string :param ResourceArn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the resource.\n :type TagKeys: list :param TagKeys: [REQUIRED]\nThe tag keys to remove from the specified resource.\n\n(string) --\n\n :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: {} :returns: (dict) -- """ pass def update_device(GlobalNetworkId=None, DeviceId=None, Description=None, Type=None, Vendor=None, Model=None, SerialNumber=None, Location=None, SiteId=None): """ Updates the details for an existing device. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_device( GlobalNetworkId='string', DeviceId='string', Description='string', Type='string', Vendor='string', Model='string', SerialNumber='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, SiteId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type DeviceId: string :param DeviceId: [REQUIRED]\nThe ID of the device.\n :type Description: string :param Description: A description of the device.\nLength Constraints: Maximum length of 256 characters.\n :type Type: string :param Type: The type of the device. :type Vendor: string :param Vendor: The vendor of the device.\nLength Constraints: Maximum length of 128 characters.\n :type Model: string :param Model: The model of the device.\nLength Constraints: Maximum length of 128 characters.\n :type SerialNumber: string :param SerialNumber: The serial number of the device.\nLength Constraints: Maximum length of 128 characters.\n :type Location: dict :param Location: Describes a location.\n\nAddress (string) --The physical address.\n\nLatitude (string) --The latitude.\n\nLongitude (string) --The longitude.\n\n\n :type SiteId: string :param SiteId: The ID of the site. :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_global_network(GlobalNetworkId=None, Description=None): """ Updates an existing global network. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_global_network( GlobalNetworkId='string', Description='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of your global network.\n :type Description: string :param Description: A description of the global network.\nLength Constraints: Maximum length of 256 characters.\n :rtype: dict ReturnsResponse Syntax { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) -- Information about the global network object. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_link(GlobalNetworkId=None, LinkId=None, Description=None, Type=None, Bandwidth=None, Provider=None): """ Updates the details for an existing link. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_link( GlobalNetworkId='string', LinkId='string', Description='string', Type='string', Bandwidth={ 'UploadSpeed': 123, 'DownloadSpeed': 123 }, Provider='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type LinkId: string :param LinkId: [REQUIRED]\nThe ID of the link.\n :type Description: string :param Description: A description of the link.\nLength Constraints: Maximum length of 256 characters.\n :type Type: string :param Type: The type of the link.\nLength Constraints: Maximum length of 128 characters.\n :type Bandwidth: dict :param Bandwidth: The upload and download speed in Mbps.\n\nUploadSpeed (integer) --Upload speed in Mbps.\n\nDownloadSpeed (integer) --Download speed in Mbps.\n\n\n :type Provider: string :param Provider: The provider of the link.\nLength Constraints: Maximum length of 128 characters.\n :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_site(GlobalNetworkId=None, SiteId=None, Description=None, Location=None): """ Updates the information for an existing site. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_site( GlobalNetworkId='string', SiteId='string', Description='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' } ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED]\nThe ID of the global network.\n :type SiteId: string :param SiteId: [REQUIRED]\nThe ID of your site.\n :type Description: string :param Description: A description of your site.\nLength Constraints: Maximum length of 256 characters.\n :type Location: dict :param Location: The site location:\n\nAddress : The physical address of the site.\nLatitude : The latitude of the site.\nLongitude : The longitude of the site.\n\n\nAddress (string) --The physical address.\n\nLatitude (string) --The latitude.\n\nLongitude (string) --The longitude.\n\n\n :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ def associate_customer_gateway(CustomerGatewayArn=None, GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Associates a customer gateway with a device and optionally, with a link. If you specify a link, it must be associated with the specified device. You can only associate customer gateways that are connected to a VPN attachment on a transit gateway. The transit gateway must be registered in your global network. When you register a transit gateway, customer gateways that are connected to the transit gateway are automatically included in the global network. To list customer gateways that are connected to a transit gateway, use the DescribeVpnConnections EC2 API and filter by transit-gateway-id . You cannot associate a customer gateway with more than one device and link. See also: AWS API Documentation Exceptions :example: response = client.associate_customer_gateway( CustomerGatewayArn='string', GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type CustomerGatewayArn: string :param CustomerGatewayArn: [REQUIRED] The Amazon Resource Name (ARN) of the customer gateway. For more information, see Resources Defined by Amazon EC2 . :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: [REQUIRED] The ID of the device. :type LinkId: string :param LinkId: The ID of the link. :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- CustomerGatewayAssociation (dict) -- The customer gateway association. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def associate_link(GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Associates a link to a device. A device can be associated to multiple links and a link can be associated to multiple devices. The device and link must be in the same global network and the same site. See also: AWS API Documentation Exceptions :example: response = client.associate_link( GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: [REQUIRED] The ID of the device. :type LinkId: string :param LinkId: [REQUIRED] The ID of the link. :rtype: dict ReturnsResponse Syntax { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- LinkAssociation (dict) -- The link association. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def create_device(GlobalNetworkId=None, Description=None, Type=None, Vendor=None, Model=None, SerialNumber=None, Location=None, SiteId=None, Tags=None): """ Creates a new device in a global network. If you specify both a site ID and a location, the location of the site is used for visualization in the Network Manager console. See also: AWS API Documentation Exceptions :example: response = client.create_device( GlobalNetworkId='string', Description='string', Type='string', Vendor='string', Model='string', SerialNumber='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, SiteId='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type Description: string :param Description: A description of the device. Length Constraints: Maximum length of 256 characters. :type Type: string :param Type: The type of the device. :type Vendor: string :param Vendor: The vendor of the device. Length Constraints: Maximum length of 128 characters. :type Model: string :param Model: The model of the device. Length Constraints: Maximum length of 128 characters. :type SerialNumber: string :param SerialNumber: The serial number of the device. Length Constraints: Maximum length of 128 characters. :type Location: dict :param Location: The location of the device. Address (string) --The physical address. Latitude (string) --The latitude. Longitude (string) --The longitude. :type SiteId: string :param SiteId: The ID of the site. :type Tags: list :param Tags: The tags to apply to the resource during creation. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_global_network(Description=None, Tags=None): """ Creates a new, empty global network. See also: AWS API Documentation Exceptions :example: response = client.create_global_network( Description='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type Description: string :param Description: A description of the global network. Length Constraints: Maximum length of 256 characters. :type Tags: list :param Tags: The tags to apply to the resource during creation. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) -- Information about the global network object. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_link(GlobalNetworkId=None, Description=None, Type=None, Bandwidth=None, Provider=None, SiteId=None, Tags=None): """ Creates a new link for a specified site. See also: AWS API Documentation Exceptions :example: response = client.create_link( GlobalNetworkId='string', Description='string', Type='string', Bandwidth={ 'UploadSpeed': 123, 'DownloadSpeed': 123 }, Provider='string', SiteId='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type Description: string :param Description: A description of the link. Length Constraints: Maximum length of 256 characters. :type Type: string :param Type: The type of the link. Constraints: Cannot include the following characters: | ^ Length Constraints: Maximum length of 128 characters. :type Bandwidth: dict :param Bandwidth: [REQUIRED] The upload speed and download speed in Mbps. UploadSpeed (integer) --Upload speed in Mbps. DownloadSpeed (integer) --Download speed in Mbps. :type Provider: string :param Provider: The provider of the link. Constraints: Cannot include the following characters: | ^ Length Constraints: Maximum length of 128 characters. :type SiteId: string :param SiteId: [REQUIRED] The ID of the site. :type Tags: list :param Tags: The tags to apply to the resource during creation. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def create_site(GlobalNetworkId=None, Description=None, Location=None, Tags=None): """ Creates a new site in a global network. See also: AWS API Documentation Exceptions :example: response = client.create_site( GlobalNetworkId='string', Description='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type Description: string :param Description: A description of your site. Length Constraints: Maximum length of 256 characters. :type Location: dict :param Location: The site location. This information is used for visualization in the Network Manager console. If you specify the address, the latitude and longitude are automatically calculated. Address : The physical address of the site. Latitude : The latitude of the site. Longitude : The longitude of the site. Address (string) --The physical address. Latitude (string) --The latitude. Longitude (string) --The longitude. :type Tags: list :param Tags: The tags to apply to the resource during creation. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_device(GlobalNetworkId=None, DeviceId=None): """ Deletes an existing device. You must first disassociate the device from any links and customer gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_device( GlobalNetworkId='string', DeviceId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: [REQUIRED] The ID of the device. :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_global_network(GlobalNetworkId=None): """ Deletes an existing global network. You must first delete all global network objects (devices, links, and sites) and deregister all transit gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_global_network( GlobalNetworkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :rtype: dict ReturnsResponse Syntax{ 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) --Information about the global network. GlobalNetworkId (string) --The ID of the global network. GlobalNetworkArn (string) --The Amazon Resource Name (ARN) of the global network. Description (string) --The description of the global network. CreatedAt (datetime) --The date and time that the global network was created. State (string) --The state of the global network. Tags (list) --The tags for the global network. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } """ pass def delete_link(GlobalNetworkId=None, LinkId=None): """ Deletes an existing link. You must first disassociate the link from any devices and customer gateways. See also: AWS API Documentation Exceptions :example: response = client.delete_link( GlobalNetworkId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type LinkId: string :param LinkId: [REQUIRED] The ID of the link. :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def delete_site(GlobalNetworkId=None, SiteId=None): """ Deletes an existing site. The site cannot be associated with any device or link. See also: AWS API Documentation Exceptions :example: response = client.delete_site( GlobalNetworkId='string', SiteId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type SiteId: string :param SiteId: [REQUIRED] The ID of the site. :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def deregister_transit_gateway(GlobalNetworkId=None, TransitGatewayArn=None): """ Deregisters a transit gateway from your global network. This action does not delete your transit gateway, or modify any of its attachments. This action removes any customer gateway associations. See also: AWS API Documentation Exceptions :example: response = client.deregister_transit_gateway( GlobalNetworkId='string', TransitGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type TransitGatewayArn: string :param TransitGatewayArn: [REQUIRED] The Amazon Resource Name (ARN) of the transit gateway. :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } Response Structure (dict) -- TransitGatewayRegistration (dict) -- The transit gateway registration information. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def describe_global_networks(GlobalNetworkIds=None, MaxResults=None, NextToken=None): """ Describes one or more global networks. By default, all global networks are described. To describe the objects in your global network, you must use the appropriate Get* action. For example, to list the transit gateways in your global network, use GetTransitGatewayRegistrations . See also: AWS API Documentation Exceptions :example: response = client.describe_global_networks( GlobalNetworkIds=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkIds: list :param GlobalNetworkIds: The IDs of one or more global networks. The maximum is 10. (string) -- :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'GlobalNetworks': [ { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- GlobalNetworks (list) -- Information about the global networks. (dict) -- Describes a global network. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetworks': [ { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def disassociate_customer_gateway(GlobalNetworkId=None, CustomerGatewayArn=None): """ Disassociates a customer gateway from a device and a link. See also: AWS API Documentation Exceptions :example: response = client.disassociate_customer_gateway( GlobalNetworkId='string', CustomerGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type CustomerGatewayArn: string :param CustomerGatewayArn: [REQUIRED] The Amazon Resource Name (ARN) of the customer gateway. For more information, see Resources Defined by Amazon EC2 . :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- CustomerGatewayAssociation (dict) -- Information about the customer gateway association. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociation': { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def disassociate_link(GlobalNetworkId=None, DeviceId=None, LinkId=None): """ Disassociates an existing device from a link. You must first disassociate any customer gateways that are associated with the link. See also: AWS API Documentation Exceptions :example: response = client.disassociate_link( GlobalNetworkId='string', DeviceId='string', LinkId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: [REQUIRED] The ID of the device. :type LinkId: string :param LinkId: [REQUIRED] The ID of the link. :rtype: dict ReturnsResponse Syntax { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } Response Structure (dict) -- LinkAssociation (dict) -- Information about the link association. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociation': { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_customer_gateway_associations(GlobalNetworkId=None, CustomerGatewayArns=None, MaxResults=None, NextToken=None): """ Gets the association information for customer gateways that are associated with devices and links in your global network. See also: AWS API Documentation Exceptions :example: response = client.get_customer_gateway_associations( GlobalNetworkId='string', CustomerGatewayArns=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type CustomerGatewayArns: list :param CustomerGatewayArns: One or more customer gateway Amazon Resource Names (ARNs). For more information, see Resources Defined by Amazon EC2 . The maximum is 10. (string) -- :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'CustomerGatewayAssociations': [ { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } Response Structure (dict) -- CustomerGatewayAssociations (list) -- The customer gateway associations. (dict) -- Describes the association between a customer gateway, a device, and a link. CustomerGatewayArn (string) -- The Amazon Resource Name (ARN) of the customer gateway. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The ID of the device. LinkId (string) -- The ID of the link. State (string) -- The association state. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'CustomerGatewayAssociations': [ { 'CustomerGatewayArn': 'string', 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_devices(GlobalNetworkId=None, DeviceIds=None, SiteId=None, MaxResults=None, NextToken=None): """ Gets information about one or more of your devices in a global network. See also: AWS API Documentation Exceptions :example: response = client.get_devices( GlobalNetworkId='string', DeviceIds=[ 'string', ], SiteId='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceIds: list :param DeviceIds: One or more device IDs. The maximum is 10. (string) -- :type SiteId: string :param SiteId: The ID of the site. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Devices': [ { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Devices (list) -- The devices. (dict) -- Describes a device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Devices': [ { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_link_associations(GlobalNetworkId=None, DeviceId=None, LinkId=None, MaxResults=None, NextToken=None): """ Gets the link associations for a device or a link. Either the device ID or the link ID must be specified. See also: AWS API Documentation Exceptions :example: response = client.get_link_associations( GlobalNetworkId='string', DeviceId='string', LinkId='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: The ID of the device. :type LinkId: string :param LinkId: The ID of the link. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'LinkAssociations': [ { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } Response Structure (dict) -- LinkAssociations (list) -- The link associations. (dict) -- Describes the association between a device and a link. GlobalNetworkId (string) -- The ID of the global network. DeviceId (string) -- The device ID for the link association. LinkId (string) -- The ID of the link. LinkAssociationState (string) -- The state of the association. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'LinkAssociations': [ { 'GlobalNetworkId': 'string', 'DeviceId': 'string', 'LinkId': 'string', 'LinkAssociationState': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED' }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_links(GlobalNetworkId=None, LinkIds=None, SiteId=None, Type=None, Provider=None, MaxResults=None, NextToken=None): """ Gets information about one or more links in a specified global network. If you specify the site ID, you cannot specify the type or provider in the same request. You can specify the type and provider in the same request. See also: AWS API Documentation Exceptions :example: response = client.get_links( GlobalNetworkId='string', LinkIds=[ 'string', ], SiteId='string', Type='string', Provider='string', MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type LinkIds: list :param LinkIds: One or more link IDs. The maximum is 10. (string) -- :type SiteId: string :param SiteId: The ID of the site. :type Type: string :param Type: The link type. :type Provider: string :param Provider: The link provider. :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Links': [ { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Links (list) -- The links. (dict) -- Describes a link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Links': [ { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} ReturnsA paginator object. """ pass def get_sites(GlobalNetworkId=None, SiteIds=None, MaxResults=None, NextToken=None): """ Gets information about one or more of your sites in a global network. See also: AWS API Documentation Exceptions :example: response = client.get_sites( GlobalNetworkId='string', SiteIds=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type SiteIds: list :param SiteIds: One or more site IDs. The maximum is 10. (string) -- :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'Sites': [ { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } Response Structure (dict) -- Sites (list) -- The sites. (dict) -- Describes a site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Sites': [ { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_transit_gateway_registrations(GlobalNetworkId=None, TransitGatewayArns=None, MaxResults=None, NextToken=None): """ Gets information about the transit gateway registrations in a specified global network. See also: AWS API Documentation Exceptions :example: response = client.get_transit_gateway_registrations( GlobalNetworkId='string', TransitGatewayArns=[ 'string', ], MaxResults=123, NextToken='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type TransitGatewayArns: list :param TransitGatewayArns: The Amazon Resource Names (ARNs) of one or more transit gateways. The maximum is 10. (string) -- :type MaxResults: integer :param MaxResults: The maximum number of results to return. :type NextToken: string :param NextToken: The token for the next page of results. :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistrations': [ { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } }, ], 'NextToken': 'string' } Response Structure (dict) -- TransitGatewayRegistrations (list) -- The transit gateway registrations. (dict) -- Describes the registration of a transit gateway to a global network. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. NextToken (string) -- The token for the next page of results. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistrations': [ { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } }, ], 'NextToken': 'string' } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def get_waiter(waiter_name=None): """ Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :rtype: botocore.waiter.Waiter """ pass def list_tags_for_resource(ResourceArn=None): """ Lists the tags for a specified resource. See also: AWS API Documentation Exceptions :example: response = client.list_tags_for_resource( ResourceArn='string' ) :type ResourceArn: string :param ResourceArn: [REQUIRED] The Amazon Resource Name (ARN) of the resource. :rtype: dict ReturnsResponse Syntax{ 'TagList': [ { 'Key': 'string', 'Value': 'string' }, ] } Response Structure (dict) -- TagList (list) --The list of tags. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TagList': [ { 'Key': 'string', 'Value': 'string' }, ] } """ pass def register_transit_gateway(GlobalNetworkId=None, TransitGatewayArn=None): """ Registers a transit gateway in your global network. The transit gateway can be in any AWS Region, but it must be owned by the same AWS account that owns the global network. You cannot register a transit gateway in more than one global network. See also: AWS API Documentation Exceptions :example: response = client.register_transit_gateway( GlobalNetworkId='string', TransitGatewayArn='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type TransitGatewayArn: string :param TransitGatewayArn: [REQUIRED] The Amazon Resource Name (ARN) of the transit gateway. For more information, see Resources Defined by Amazon EC2 . :rtype: dict ReturnsResponse Syntax { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } Response Structure (dict) -- TransitGatewayRegistration (dict) -- Information about the transit gateway registration. GlobalNetworkId (string) -- The ID of the global network. TransitGatewayArn (string) -- The Amazon Resource Name (ARN) of the transit gateway. State (dict) -- The state of the transit gateway registration. Code (string) -- The code for the state reason. Message (string) -- The message for the state reason. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'TransitGatewayRegistration': { 'GlobalNetworkId': 'string', 'TransitGatewayArn': 'string', 'State': { 'Code': 'PENDING'|'AVAILABLE'|'DELETING'|'DELETED'|'FAILED', 'Message': 'string' } } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def tag_resource(ResourceArn=None, Tags=None): """ Tags a specified resource. See also: AWS API Documentation Exceptions :example: response = client.tag_resource( ResourceArn='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) :type ResourceArn: string :param ResourceArn: [REQUIRED] The Amazon Resource Name (ARN) of the resource. :type Tags: list :param Tags: [REQUIRED] The tags to apply to the specified resource. (dict) --Describes a tag. Key (string) --The tag key. Length Constraints: Maximum length of 128 characters. Value (string) --The tag value. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: {} :returns: (dict) -- """ pass def untag_resource(ResourceArn=None, TagKeys=None): """ Removes tags from a specified resource. See also: AWS API Documentation Exceptions :example: response = client.untag_resource( ResourceArn='string', TagKeys=[ 'string', ] ) :type ResourceArn: string :param ResourceArn: [REQUIRED] The Amazon Resource Name (ARN) of the resource. :type TagKeys: list :param TagKeys: [REQUIRED] The tag keys to remove from the specified resource. (string) -- :rtype: dict ReturnsResponse Syntax {} Response Structure (dict) -- Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: {} :returns: (dict) -- """ pass def update_device(GlobalNetworkId=None, DeviceId=None, Description=None, Type=None, Vendor=None, Model=None, SerialNumber=None, Location=None, SiteId=None): """ Updates the details for an existing device. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_device( GlobalNetworkId='string', DeviceId='string', Description='string', Type='string', Vendor='string', Model='string', SerialNumber='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, SiteId='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type DeviceId: string :param DeviceId: [REQUIRED] The ID of the device. :type Description: string :param Description: A description of the device. Length Constraints: Maximum length of 256 characters. :type Type: string :param Type: The type of the device. :type Vendor: string :param Vendor: The vendor of the device. Length Constraints: Maximum length of 128 characters. :type Model: string :param Model: The model of the device. Length Constraints: Maximum length of 128 characters. :type SerialNumber: string :param SerialNumber: The serial number of the device. Length Constraints: Maximum length of 128 characters. :type Location: dict :param Location: Describes a location. Address (string) --The physical address. Latitude (string) --The latitude. Longitude (string) --The longitude. :type SiteId: string :param SiteId: The ID of the site. :rtype: dict ReturnsResponse Syntax { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Device (dict) -- Information about the device. DeviceId (string) -- The ID of the device. DeviceArn (string) -- The Amazon Resource Name (ARN) of the device. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the device. Type (string) -- The device type. Vendor (string) -- The device vendor. Model (string) -- The device model. SerialNumber (string) -- The device serial number. Location (dict) -- The site location. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. SiteId (string) -- The site ID. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The device state. Tags (list) -- The tags for the device. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Device': { 'DeviceId': 'string', 'DeviceArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Type': 'string', 'Vendor': 'string', 'Model': 'string', 'SerialNumber': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'SiteId': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_global_network(GlobalNetworkId=None, Description=None): """ Updates an existing global network. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_global_network( GlobalNetworkId='string', Description='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of your global network. :type Description: string :param Description: A description of the global network. Length Constraints: Maximum length of 256 characters. :rtype: dict ReturnsResponse Syntax { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- GlobalNetwork (dict) -- Information about the global network object. GlobalNetworkId (string) -- The ID of the global network. GlobalNetworkArn (string) -- The Amazon Resource Name (ARN) of the global network. Description (string) -- The description of the global network. CreatedAt (datetime) -- The date and time that the global network was created. State (string) -- The state of the global network. Tags (list) -- The tags for the global network. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'GlobalNetwork': { 'GlobalNetworkId': 'string', 'GlobalNetworkArn': 'string', 'Description': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_link(GlobalNetworkId=None, LinkId=None, Description=None, Type=None, Bandwidth=None, Provider=None): """ Updates the details for an existing link. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_link( GlobalNetworkId='string', LinkId='string', Description='string', Type='string', Bandwidth={ 'UploadSpeed': 123, 'DownloadSpeed': 123 }, Provider='string' ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type LinkId: string :param LinkId: [REQUIRED] The ID of the link. :type Description: string :param Description: A description of the link. Length Constraints: Maximum length of 256 characters. :type Type: string :param Type: The type of the link. Length Constraints: Maximum length of 128 characters. :type Bandwidth: dict :param Bandwidth: The upload and download speed in Mbps. UploadSpeed (integer) --Upload speed in Mbps. DownloadSpeed (integer) --Download speed in Mbps. :type Provider: string :param Provider: The provider of the link. Length Constraints: Maximum length of 128 characters. :rtype: dict ReturnsResponse Syntax { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Link (dict) -- Information about the link. LinkId (string) -- The ID of the link. LinkArn (string) -- The Amazon Resource Name (ARN) of the link. GlobalNetworkId (string) -- The ID of the global network. SiteId (string) -- The ID of the site. Description (string) -- The description of the link. Type (string) -- The type of the link. Bandwidth (dict) -- The bandwidth for the link. UploadSpeed (integer) -- Upload speed in Mbps. DownloadSpeed (integer) -- Download speed in Mbps. Provider (string) -- The provider of the link. CreatedAt (datetime) -- The date and time that the link was created. State (string) -- The state of the link. Tags (list) -- The tags for the link. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Link': { 'LinkId': 'string', 'LinkArn': 'string', 'GlobalNetworkId': 'string', 'SiteId': 'string', 'Description': 'string', 'Type': 'string', 'Bandwidth': { 'UploadSpeed': 123, 'DownloadSpeed': 123 }, 'Provider': 'string', 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.ServiceQuotaExceededException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass def update_site(GlobalNetworkId=None, SiteId=None, Description=None, Location=None): """ Updates the information for an existing site. To remove information for any of the parameters, specify an empty string. See also: AWS API Documentation Exceptions :example: response = client.update_site( GlobalNetworkId='string', SiteId='string', Description='string', Location={ 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' } ) :type GlobalNetworkId: string :param GlobalNetworkId: [REQUIRED] The ID of the global network. :type SiteId: string :param SiteId: [REQUIRED] The ID of your site. :type Description: string :param Description: A description of your site. Length Constraints: Maximum length of 256 characters. :type Location: dict :param Location: The site location: Address : The physical address of the site. Latitude : The latitude of the site. Longitude : The longitude of the site. Address (string) --The physical address. Latitude (string) --The latitude. Longitude (string) --The longitude. :rtype: dict ReturnsResponse Syntax { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } Response Structure (dict) -- Site (dict) -- Information about the site. SiteId (string) -- The ID of the site. SiteArn (string) -- The Amazon Resource Name (ARN) of the site. GlobalNetworkId (string) -- The ID of the global network. Description (string) -- The description of the site. Location (dict) -- The location of the site. Address (string) -- The physical address. Latitude (string) -- The latitude. Longitude (string) -- The longitude. CreatedAt (datetime) -- The date and time that the site was created. State (string) -- The state of the site. Tags (list) -- The tags for the site. (dict) -- Describes a tag. Key (string) -- The tag key. Length Constraints: Maximum length of 128 characters. Value (string) -- The tag value. Length Constraints: Maximum length of 256 characters. Exceptions NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException :return: { 'Site': { 'SiteId': 'string', 'SiteArn': 'string', 'GlobalNetworkId': 'string', 'Description': 'string', 'Location': { 'Address': 'string', 'Latitude': 'string', 'Longitude': 'string' }, 'CreatedAt': datetime(2015, 1, 1), 'State': 'PENDING'|'AVAILABLE'|'DELETING'|'UPDATING', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } } :returns: NetworkManager.Client.exceptions.ValidationException NetworkManager.Client.exceptions.AccessDeniedException NetworkManager.Client.exceptions.ResourceNotFoundException NetworkManager.Client.exceptions.ConflictException NetworkManager.Client.exceptions.ThrottlingException NetworkManager.Client.exceptions.InternalServerException """ pass
def updatePars(): if not parent().par.Lockbuffermenu: return op('output_table_path').cook(force=True) dat = op('output_table') if dat.numRows < 2: return p = parent().par.Outputbuffer p.menuNames = dat.col('name')[1:] p.menuLabels = dat.col('label')[1:] def onTableChange(dat): updatePars() def onValueChange(*_): updatePars()
def update_pars(): if not parent().par.Lockbuffermenu: return op('output_table_path').cook(force=True) dat = op('output_table') if dat.numRows < 2: return p = parent().par.Outputbuffer p.menuNames = dat.col('name')[1:] p.menuLabels = dat.col('label')[1:] def on_table_change(dat): update_pars() def on_value_change(*_): update_pars()
def error_Check(inputX, inputY, nSamples, initVector, minCost, alpha, training_epochs, silent, overlap, objFunc, keepPercent, batchSize, batching): acceptedObjFuncs = ["", "QUAD"] if inputX.shape[0] != inputY.shape[0]: print("Must have the same number of labels and training samples") return -1 if type(nSamples) != int: print("nSamples must be an integer") return -1 if len(initVector) <= 1: print("init vector is too short, must be at least 2 layers") return -1 if type(minCost) not in [int, float]: print("minCost must be float or integer") return -1 if type(alpha) not in [int, float]: print("alpha must be float or integer") return -1 if type(training_epochs) != int: print("training_epochs must be an integer") return -1 if type(silent) != bool: print("silent must be either True or False") return -1 if type(overlap) != bool: print("silent must be either True or False") return -1 if type(keepPercent) not in [float, int]: print("keepPercent must be an int or float") return -1 if keepPercent > 1 or keepPercent < 0: print("keepPercent must be between 0 and 1") return -1 if objFunc not in acceptedObjFuncs: print("objFunc can only take on values: ", end='') for func in acceptedObjFuncs[:-1]: if func == '': print("Empty string", end=', ') else: print(func, end=", ") print(acceptedObjFuncs[-1] + '.') return -1 if type(batchSize) != int: print("batchSize must be int") return -1 if batching not in [True, False]: print("batching must be boolean") return -1 #passed all tests return 0
def error__check(inputX, inputY, nSamples, initVector, minCost, alpha, training_epochs, silent, overlap, objFunc, keepPercent, batchSize, batching): accepted_obj_funcs = ['', 'QUAD'] if inputX.shape[0] != inputY.shape[0]: print('Must have the same number of labels and training samples') return -1 if type(nSamples) != int: print('nSamples must be an integer') return -1 if len(initVector) <= 1: print('init vector is too short, must be at least 2 layers') return -1 if type(minCost) not in [int, float]: print('minCost must be float or integer') return -1 if type(alpha) not in [int, float]: print('alpha must be float or integer') return -1 if type(training_epochs) != int: print('training_epochs must be an integer') return -1 if type(silent) != bool: print('silent must be either True or False') return -1 if type(overlap) != bool: print('silent must be either True or False') return -1 if type(keepPercent) not in [float, int]: print('keepPercent must be an int or float') return -1 if keepPercent > 1 or keepPercent < 0: print('keepPercent must be between 0 and 1') return -1 if objFunc not in acceptedObjFuncs: print('objFunc can only take on values: ', end='') for func in acceptedObjFuncs[:-1]: if func == '': print('Empty string', end=', ') else: print(func, end=', ') print(acceptedObjFuncs[-1] + '.') return -1 if type(batchSize) != int: print('batchSize must be int') return -1 if batching not in [True, False]: print('batching must be boolean') return -1 return 0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 25 14:06:56 2020 Class to handle coordinates in Hive according to how they are used in the entomology Hive position editor. cf. https://entomology.appspot.com/hive.html?bg=0&board=:w***@bA**@bB***@bG*@bL*@bM*@bP*@bQ**@bS***@wA**@wB***@wG*@wL*@wM*@wP*@wQ**@wS&grid=1 @author: epenjos """ class Position: def __init__(self, aA, aB): self.a = aA self.b = aB def importBSCoords(self, coordinates): #handle the conversion to numerical coordinates from the format #used at BoardSpace # a,b are non-orhogonal coordinates of the hex-grid # N 13 = ( 0, 0) # N 12 = ( 0, 1) # O 13 = ( 1, 0) # M 11 = (-1, 2) # O 14 = ( 1,-1) # M 12 = (-1, 1) coords = coordinates.split() self.a = ord(coords[0]) - 78 #coords[1] the letter coordinate self.b = 13 - int(coords[1]) #coords[2] is the numerical coordinate return self #Overloading the '+' operator def __add__(self, other): newA = self.a + other.a newB = self.b + other.b return Position(newA,newB) def __sub__(self, other): newA = self.a - other.a newB = self.b - other.b return Position(newA,newB) #The scalar product for vectors implemented def __mul__(self, other): return self.a * other.a + self.b * other.b def __neg__(self): return Position(-self.a, -self.b) def __eq__(self, other): return (self.a == other.a) & (self.b == other.b) def __ne__(self, other): return not self.__eq__(other) #60 degrees rotation counter-clockwise transformation # e1 -> e1 - e2 # e2 -> e1 # [ 1 1 ] [a] # [-1 0 ] [b] def rot60CCW(self): newA = Position( 1, 1)*self newB = Position(-1, 0)*self return Position(newA, newB) def rot120CCW(self): newA = Position( 0, 1)*self newB = Position(-1,-1)*self return Position(newA, newB) def rot180CCW(self): newA = Position(-1, 0)*self newB = Position( 0,-1)*self return Position(newA, newB) def rot60CW(self): newA = Position( 0,-1)*self newB = Position( 1, 1)*self return Position(newA, newB) def rot120CW(self): newA = Position(-1,-1)*self newB = Position( 1, 0)*self return Position(newA, newB) def reflXaxis(self): newA = Position( 1, 1)*self newB = Position( 0,-1)*self return Position(newA, newB) def __repr__(self): return "(%s,%s)" % (self.a, self.b) def testPositionClass(): inpStr = ["N 13", "N 12", "O 13", "M 11", "O 14", "M 12"] expRes = ["(0,0)", "(0,1)", "(1,0)", "(-1,2)", "(1,-1)", "(-1,1)"] for i, val in enumerate(inpStr): if str(Position(0,0).importBSCoords(val)) != expRes[i]: print("Position conversion error:" + val + "=>" + str(Position(0,0).importBSCoords(val))) assert Position(2,1).reflXaxis() == Position(3,-1) assert Position(-4,2).reflXaxis() == Position(-2,-2) assert Position(2,1).rot60CCW() == Position(3,-2) assert Position(4,-1).rot60CCW() == Position(3,-4) assert Position(2,1).rot60CW() == Position(-1,3) assert Position(7,-4).rot60CW() == Position(4,3) assert Position(2,1).rot120CW() == Position(-3,2) assert Position(-2,-2).rot120CW() == Position(4,-2)
""" Created on Thu Jun 25 14:06:56 2020 Class to handle coordinates in Hive according to how they are used in the entomology Hive position editor. cf. https://entomology.appspot.com/hive.html?bg=0&board=:w***@bA**@bB***@bG*@bL*@bM*@bP*@bQ**@bS***@wA**@wB***@wG*@wL*@wM*@wP*@wQ**@wS&grid=1 @author: epenjos """ class Position: def __init__(self, aA, aB): self.a = aA self.b = aB def import_bs_coords(self, coordinates): coords = coordinates.split() self.a = ord(coords[0]) - 78 self.b = 13 - int(coords[1]) return self def __add__(self, other): new_a = self.a + other.a new_b = self.b + other.b return position(newA, newB) def __sub__(self, other): new_a = self.a - other.a new_b = self.b - other.b return position(newA, newB) def __mul__(self, other): return self.a * other.a + self.b * other.b def __neg__(self): return position(-self.a, -self.b) def __eq__(self, other): return (self.a == other.a) & (self.b == other.b) def __ne__(self, other): return not self.__eq__(other) def rot60_ccw(self): new_a = position(1, 1) * self new_b = position(-1, 0) * self return position(newA, newB) def rot120_ccw(self): new_a = position(0, 1) * self new_b = position(-1, -1) * self return position(newA, newB) def rot180_ccw(self): new_a = position(-1, 0) * self new_b = position(0, -1) * self return position(newA, newB) def rot60_cw(self): new_a = position(0, -1) * self new_b = position(1, 1) * self return position(newA, newB) def rot120_cw(self): new_a = position(-1, -1) * self new_b = position(1, 0) * self return position(newA, newB) def refl_xaxis(self): new_a = position(1, 1) * self new_b = position(0, -1) * self return position(newA, newB) def __repr__(self): return '(%s,%s)' % (self.a, self.b) def test_position_class(): inp_str = ['N 13', 'N 12', 'O 13', 'M 11', 'O 14', 'M 12'] exp_res = ['(0,0)', '(0,1)', '(1,0)', '(-1,2)', '(1,-1)', '(-1,1)'] for (i, val) in enumerate(inpStr): if str(position(0, 0).importBSCoords(val)) != expRes[i]: print('Position conversion error:' + val + '=>' + str(position(0, 0).importBSCoords(val))) assert position(2, 1).reflXaxis() == position(3, -1) assert position(-4, 2).reflXaxis() == position(-2, -2) assert position(2, 1).rot60CCW() == position(3, -2) assert position(4, -1).rot60CCW() == position(3, -4) assert position(2, 1).rot60CW() == position(-1, 3) assert position(7, -4).rot60CW() == position(4, 3) assert position(2, 1).rot120CW() == position(-3, 2) assert position(-2, -2).rot120CW() == position(4, -2)
''' Kattis - oddgnome theres probably a smarter way, but i really can't be bothered Time: O(n^2 log n), Space: O(n) ''' num_tc = int(input()) for _ in range(num_tc): arr = list(map(int, input().split())) n = arr.pop(0) for i in range(1, n): new_arr = arr[:i] + arr[i+1:] if new_arr == sorted(new_arr): print(i+1) break
""" Kattis - oddgnome theres probably a smarter way, but i really can't be bothered Time: O(n^2 log n), Space: O(n) """ num_tc = int(input()) for _ in range(num_tc): arr = list(map(int, input().split())) n = arr.pop(0) for i in range(1, n): new_arr = arr[:i] + arr[i + 1:] if new_arr == sorted(new_arr): print(i + 1) break
def force_bytes(value): if isinstance(value, bytes): return value return str(value).encode('utf-8')
def force_bytes(value): if isinstance(value, bytes): return value return str(value).encode('utf-8')
""" ## Questions : EASY ### 1844. [Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters/) You are given a 0-indexed string s that has lowercase English letters in its even indices and digits in its odd indices. There is a function shift(c, x), where c is a character and x is a digit, that returns the xth character after c. For example, shift('a', 5) = 'f' and shift('x', 0) = 'x'. For every odd index i, you want to replace the digit s[i] with shift(s[i-1], s[i]). Return s after replacing all digits. It is guaranteed that shift(s[i-1], s[i]) will never exceed 'z'. Example 1: Input: s = "a1c1e1" Output: "abcdef" Explanation: The digits are replaced as follows: - s[1] -> shift('a',1) = 'b' - s[3] -> shift('c',1) = 'd' - s[5] -> shift('e',1) = 'f' Example 2: Input: s = "a1b2c3d4e" Output: "abbdcfdhe" Explanation: The digits are replaced as follows: - s[1] -> shift('a',1) = 'b' - s[3] -> shift('b',2) = 'd' - s[5] -> shift('c',3) = 'f' - s[7] -> shift('d',4) = 'h' Constraints: 1 <= s.length <= 100 s consists only of lowercase English letters and digits. shift(s[i-1], s[i]) <= 'z' for all odd indices i. """ # Solutions class Solution: def replaceDigits(self, s: str) -> str: chars = 'abcdefghijklmnopqrstuvwxyz' res = '' n = len(s) i = 0 while i < n: if i & 1: new_char = chars[(int(s[i]) + chars.index(s[i - 1])) % 26] res += new_char else: res += s[i] i += 1 return res # Runtime : 28 ms, faster than 91.58% of Python3 online submissions # Memory Usage : 14.2 MB, less than 44.97% of Python3 online submissions
""" ## Questions : EASY ### 1844. [Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters/) You are given a 0-indexed string s that has lowercase English letters in its even indices and digits in its odd indices. There is a function shift(c, x), where c is a character and x is a digit, that returns the xth character after c. For example, shift('a', 5) = 'f' and shift('x', 0) = 'x'. For every odd index i, you want to replace the digit s[i] with shift(s[i-1], s[i]). Return s after replacing all digits. It is guaranteed that shift(s[i-1], s[i]) will never exceed 'z'. Example 1: Input: s = "a1c1e1" Output: "abcdef" Explanation: The digits are replaced as follows: - s[1] -> shift('a',1) = 'b' - s[3] -> shift('c',1) = 'd' - s[5] -> shift('e',1) = 'f' Example 2: Input: s = "a1b2c3d4e" Output: "abbdcfdhe" Explanation: The digits are replaced as follows: - s[1] -> shift('a',1) = 'b' - s[3] -> shift('b',2) = 'd' - s[5] -> shift('c',3) = 'f' - s[7] -> shift('d',4) = 'h' Constraints: 1 <= s.length <= 100 s consists only of lowercase English letters and digits. shift(s[i-1], s[i]) <= 'z' for all odd indices i. """ class Solution: def replace_digits(self, s: str) -> str: chars = 'abcdefghijklmnopqrstuvwxyz' res = '' n = len(s) i = 0 while i < n: if i & 1: new_char = chars[(int(s[i]) + chars.index(s[i - 1])) % 26] res += new_char else: res += s[i] i += 1 return res
""" Event dispatcher for non-browser Events which occur on Widget state changes. """ class EventDispatcher(object): """ Base class for event notifier. """ def __init__(self, name): super(EventDispatcher, self).__init__() self.queue = [] self.name = name def _genTargetFuncName(self): """ Returns the name of the function called on the receiving object """ return "on%s" % (self.name[0].upper() + self.name[1:]) def register(self, cb, reset=False): """ Append "cb" to the list of objects to inform of the given Event. Does nothing if cb has already subscribed. :param cb: the object to register :type cb: object """ assert self._genTargetFuncName() in dir(cb), "cb must provide a %s method" % self._genTargetFuncName() if reset: self.queue = [] if cb not in self.queue: self.queue.append(cb) def unregister(self, cb): """ Remove "cb" from the list of objects to inform of the given Event. Does nothing if cb is not in that list. :param cb: the object to remove :type cb: object """ if cb in self.queue: self.queue.remove(cb) def fire(self, *args, **kwargs): """ Fires the event. Informs all subscribed listeners. All parameters passed to the receiving function. """ for cb in self.queue: getattr(cb, self._genTargetFuncName())(*args, **kwargs)
""" Event dispatcher for non-browser Events which occur on Widget state changes. """ class Eventdispatcher(object): """ Base class for event notifier. """ def __init__(self, name): super(EventDispatcher, self).__init__() self.queue = [] self.name = name def _gen_target_func_name(self): """ Returns the name of the function called on the receiving object """ return 'on%s' % (self.name[0].upper() + self.name[1:]) def register(self, cb, reset=False): """ Append "cb" to the list of objects to inform of the given Event. Does nothing if cb has already subscribed. :param cb: the object to register :type cb: object """ assert self._genTargetFuncName() in dir(cb), 'cb must provide a %s method' % self._genTargetFuncName() if reset: self.queue = [] if cb not in self.queue: self.queue.append(cb) def unregister(self, cb): """ Remove "cb" from the list of objects to inform of the given Event. Does nothing if cb is not in that list. :param cb: the object to remove :type cb: object """ if cb in self.queue: self.queue.remove(cb) def fire(self, *args, **kwargs): """ Fires the event. Informs all subscribed listeners. All parameters passed to the receiving function. """ for cb in self.queue: getattr(cb, self._genTargetFuncName())(*args, **kwargs)