content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module EXTREME-OSPF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 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, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection") extremeAgent, = mibBuilder.importSymbols("EXTREME-BASE-MIB", "extremeAgent") extremeVlanIfIndex, = mibBuilder.importSymbols("EXTREME-VLAN-MIB", "extremeVlanIfIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Unsigned32, iso, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, ObjectIdentity, Bits, MibIdentifier, ModuleIdentity, Counter64, Counter32, NotificationType, Integer32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "iso", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "ObjectIdentity", "Bits", "MibIdentifier", "ModuleIdentity", "Counter64", "Counter32", "NotificationType", "Integer32", "IpAddress") RowStatus, TruthValue, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "TextualConvention", "DisplayString") extremeOspf = ModuleIdentity((1, 3, 6, 1, 4, 1, 1916, 1, 15)) if mibBuilder.loadTexts: extremeOspf.setLastUpdated('0006280000Z') if mibBuilder.loadTexts: extremeOspf.setOrganization('Extreme Networks, Inc.') extremeOspfInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1), ) if mibBuilder.loadTexts: extremeOspfInterfaceTable.setStatus('current') extremeOspfInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1), ).setIndexNames((0, "EXTREME-VLAN-MIB", "extremeVlanIfIndex")) if mibBuilder.loadTexts: extremeOspfInterfaceEntry.setStatus('current') extremeOspfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 1), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: extremeOspfAreaId.setStatus('current') extremeOspfInterfacePassive = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 2), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: extremeOspfInterfacePassive.setStatus('current') extremeOspfInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: extremeOspfInterfaceStatus.setStatus('current') mibBuilder.exportSymbols("EXTREME-OSPF-MIB", extremeOspfInterfacePassive=extremeOspfInterfacePassive, PYSNMP_MODULE_ID=extremeOspf, extremeOspf=extremeOspf, extremeOspfAreaId=extremeOspfAreaId, extremeOspfInterfaceEntry=extremeOspfInterfaceEntry, extremeOspfInterfaceStatus=extremeOspfInterfaceStatus, extremeOspfInterfaceTable=extremeOspfInterfaceTable)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection') (extreme_agent,) = mibBuilder.importSymbols('EXTREME-BASE-MIB', 'extremeAgent') (extreme_vlan_if_index,) = mibBuilder.importSymbols('EXTREME-VLAN-MIB', 'extremeVlanIfIndex') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (unsigned32, iso, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, object_identity, bits, mib_identifier, module_identity, counter64, counter32, notification_type, integer32, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'iso', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'ObjectIdentity', 'Bits', 'MibIdentifier', 'ModuleIdentity', 'Counter64', 'Counter32', 'NotificationType', 'Integer32', 'IpAddress') (row_status, truth_value, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TruthValue', 'TextualConvention', 'DisplayString') extreme_ospf = module_identity((1, 3, 6, 1, 4, 1, 1916, 1, 15)) if mibBuilder.loadTexts: extremeOspf.setLastUpdated('0006280000Z') if mibBuilder.loadTexts: extremeOspf.setOrganization('Extreme Networks, Inc.') extreme_ospf_interface_table = mib_table((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1)) if mibBuilder.loadTexts: extremeOspfInterfaceTable.setStatus('current') extreme_ospf_interface_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1)).setIndexNames((0, 'EXTREME-VLAN-MIB', 'extremeVlanIfIndex')) if mibBuilder.loadTexts: extremeOspfInterfaceEntry.setStatus('current') extreme_ospf_area_id = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 1), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: extremeOspfAreaId.setStatus('current') extreme_ospf_interface_passive = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 2), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: extremeOspfInterfacePassive.setStatus('current') extreme_ospf_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 3), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: extremeOspfInterfaceStatus.setStatus('current') mibBuilder.exportSymbols('EXTREME-OSPF-MIB', extremeOspfInterfacePassive=extremeOspfInterfacePassive, PYSNMP_MODULE_ID=extremeOspf, extremeOspf=extremeOspf, extremeOspfAreaId=extremeOspfAreaId, extremeOspfInterfaceEntry=extremeOspfInterfaceEntry, extremeOspfInterfaceStatus=extremeOspfInterfaceStatus, extremeOspfInterfaceTable=extremeOspfInterfaceTable)
# -*- coding: utf-8 -*- """ Created on Mon May 29 17:31:17 2017 @author: Prosimio """
""" Created on Mon May 29 17:31:17 2017 @author: Prosimio """
class IndigoDevice: def __init__(self, id, name): self.id = id self.name = name self.states = {} self.states_meta = {} self.pluginProps = {} self.image = None self.brightness = 0 def updateStateOnServer(self, key, value, uiValue=None, decimalPlaces=0): self.states[key] = value self.states_meta[key] = {'value': value, 'uiValue': uiValue, 'decimalPlaces': decimalPlaces} # update the brightness "helper" if key == "brightnessLevel": self.brightness = value def replacePluginPropsOnServer(self, pluginProps): self.pluginProps = pluginProps def updateStateImageOnServer(self, image): self.image = image def refreshFromServer(self): pass
class Indigodevice: def __init__(self, id, name): self.id = id self.name = name self.states = {} self.states_meta = {} self.pluginProps = {} self.image = None self.brightness = 0 def update_state_on_server(self, key, value, uiValue=None, decimalPlaces=0): self.states[key] = value self.states_meta[key] = {'value': value, 'uiValue': uiValue, 'decimalPlaces': decimalPlaces} if key == 'brightnessLevel': self.brightness = value def replace_plugin_props_on_server(self, pluginProps): self.pluginProps = pluginProps def update_state_image_on_server(self, image): self.image = image def refresh_from_server(self): pass
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reorderList(self, head): """ :type head: ListNode :rtype: void Do not return anything, modify head in-place instead. """ ## quick solution # find l1, l2 f=s=dummy=ListNode(0) dummy.next=head while f and f.next: f=f.next.next s=s.next l2=s.next s.next=None l1=dummy.next # reverse l2 dummy.next=None x=l2 while x: x.next,dummy.next, x = dummy.next, x, x.next l2=dummy.next # combine l1, l2 cur=dummy while l1 or l2: if l1: cur.next, l1.next, l1 = l1, None, l1.next cur=cur.next if l2: cur.next, l2.next, l2 = l2, None, l2.next cur=cur.next return ## normal solution (TLE) cur=head while cur and cur.next: l1=cur.next l2=cur while l1.next: l1=l1.next l2=l2.next l2.next=None l1.next=cur.next cur.next=l1 cur=cur.next.next
class Solution(object): def reorder_list(self, head): """ :type head: ListNode :rtype: void Do not return anything, modify head in-place instead. """ f = s = dummy = list_node(0) dummy.next = head while f and f.next: f = f.next.next s = s.next l2 = s.next s.next = None l1 = dummy.next dummy.next = None x = l2 while x: (x.next, dummy.next, x) = (dummy.next, x, x.next) l2 = dummy.next cur = dummy while l1 or l2: if l1: (cur.next, l1.next, l1) = (l1, None, l1.next) cur = cur.next if l2: (cur.next, l2.next, l2) = (l2, None, l2.next) cur = cur.next return cur = head while cur and cur.next: l1 = cur.next l2 = cur while l1.next: l1 = l1.next l2 = l2.next l2.next = None l1.next = cur.next cur.next = l1 cur = cur.next.next
# callbacks.py # Authors: Jacob Schreiber <jmschreiber91@gmail.com> class Callback(object): """An object that adds functionality during training. A callback is a function or group of functions that can be executed during the training process for any of pomegranate's models that have iterative training procedures. A callback can be called at three stages-- the beginning of training, at the end of each epoch (or iteration), and at the end of training. Users can define any functions that they wish in the corresponding functions. """ def __init__(self): self.model = None self.params = None def on_training_begin(self): """Functionality to add to the beginning of training. This method will be called at the beginning of each model's training procedure. """ pass def on_training_end(self, logs): """Functionality to add to the end of training. This method will be called at the end of each model's training procedure. """ pass def on_epoch_end(self, logs): """Functionality to add to the end of each epoch. This method will be called at the end of each epoch during the model's iterative training procedure. """ pass class ModelCheckpoint(Callback): """This will save the model to disk after each epoch.""" def __init__(self, name=None, verbose=True): self.model = None self.params = None self.name = None self.verbose = verbose def on_epoch_end(self, logs): """Save the model to disk at the end of each epoch.""" model = self.model.to_json() epoch = logs['epoch'] name = self.name if self.name is not None else self.model.name if self.verbose: print("[{}] Saving checkpoint to {}.{}.json".format(epoch, name, epoch)) with open('{}.{}.json'.format(name, epoch), 'w') as outfile: outfile.write(model) class History(Callback): """Keeps a history of the loss during training.""" def on_training_begin(self): self.total_improvement = [] self.improvements = [] self.log_probabilities = [] self.epoch_start_times = [] self.epoch_end_times = [] self.epoch_durations = [] self.epochs = [] self.learning_rates = [] self.n_seen_batches = [] self.initial_log_probablity = None self.test_log_probability = [] def on_epoch_end(self, logs): """Save the files to the appropriate lists.""" self.total_improvement.append(logs['total_improvement']) self.improvements.append(logs['improvement']) self.log_probabilities.append(logs['log_probability']) self.epoch_start_times.append(logs['epoch_start_time']) self.epoch_end_times.append(logs['epoch_end_time']) self.epoch_durations.append(logs['duration']) self.epochs.append(logs['epoch']) self.learning_rates.append(logs['learning_rate']) self.n_seen_batches.append(logs['n_seen_batches']) self.initial_log_probability = logs['initial_log_probability'] self.test_log_probability.append(logs['test_log_probability']) class CSVLogger(Callback): """Logs results of training to a CSV file during training.""" def __init__(self, filename, separator=',', append=False): self.filename = filename self.separator = separator self.append = append self.file = None self.columns = ['epoch', 'duration', 'total_improvement', 'improvement', 'log_probability', 'last_log_probability', 'test_log_probability', 'epoch_start_time', 'epoch_end_time', 'n_seen_batches', 'learning_rate'] def on_training_begin(self): if self.append == False: self.file = open(self.filename, 'w') self.file.write(self.separator.join(self.columns) + "\n") else: self.file = open(self.filename, 'a') def on_training_end(self, logs): self.file.close() def on_epoch_end(self, logs): self.file.write(self.separator.join(str(logs[col]) for col in self.columns) + "\n") class LambdaCallback(Callback): """A callback that takes in anonymous functions for any of the methods, for convenience.""" def __init__(self, on_training_begin=None, on_training_end=None, on_epoch_end=None): self.on_training_begin_ = on_training_begin self.on_training_end_ = on_training_end self.on_epoch_end_ = on_epoch_end def on_training_begin(self): if self.on_training_begin_ is not None: self.on_training_begin_() def on_training_end(self, logs): if self.on_training_end_ is not None: self.on_training_end_(logs) def on_epoch_end(self, logs): if self.on_epoch_end_ is not None: self.on_epoch_end_(logs)
class Callback(object): """An object that adds functionality during training. A callback is a function or group of functions that can be executed during the training process for any of pomegranate's models that have iterative training procedures. A callback can be called at three stages-- the beginning of training, at the end of each epoch (or iteration), and at the end of training. Users can define any functions that they wish in the corresponding functions. """ def __init__(self): self.model = None self.params = None def on_training_begin(self): """Functionality to add to the beginning of training. This method will be called at the beginning of each model's training procedure. """ pass def on_training_end(self, logs): """Functionality to add to the end of training. This method will be called at the end of each model's training procedure. """ pass def on_epoch_end(self, logs): """Functionality to add to the end of each epoch. This method will be called at the end of each epoch during the model's iterative training procedure. """ pass class Modelcheckpoint(Callback): """This will save the model to disk after each epoch.""" def __init__(self, name=None, verbose=True): self.model = None self.params = None self.name = None self.verbose = verbose def on_epoch_end(self, logs): """Save the model to disk at the end of each epoch.""" model = self.model.to_json() epoch = logs['epoch'] name = self.name if self.name is not None else self.model.name if self.verbose: print('[{}] Saving checkpoint to {}.{}.json'.format(epoch, name, epoch)) with open('{}.{}.json'.format(name, epoch), 'w') as outfile: outfile.write(model) class History(Callback): """Keeps a history of the loss during training.""" def on_training_begin(self): self.total_improvement = [] self.improvements = [] self.log_probabilities = [] self.epoch_start_times = [] self.epoch_end_times = [] self.epoch_durations = [] self.epochs = [] self.learning_rates = [] self.n_seen_batches = [] self.initial_log_probablity = None self.test_log_probability = [] def on_epoch_end(self, logs): """Save the files to the appropriate lists.""" self.total_improvement.append(logs['total_improvement']) self.improvements.append(logs['improvement']) self.log_probabilities.append(logs['log_probability']) self.epoch_start_times.append(logs['epoch_start_time']) self.epoch_end_times.append(logs['epoch_end_time']) self.epoch_durations.append(logs['duration']) self.epochs.append(logs['epoch']) self.learning_rates.append(logs['learning_rate']) self.n_seen_batches.append(logs['n_seen_batches']) self.initial_log_probability = logs['initial_log_probability'] self.test_log_probability.append(logs['test_log_probability']) class Csvlogger(Callback): """Logs results of training to a CSV file during training.""" def __init__(self, filename, separator=',', append=False): self.filename = filename self.separator = separator self.append = append self.file = None self.columns = ['epoch', 'duration', 'total_improvement', 'improvement', 'log_probability', 'last_log_probability', 'test_log_probability', 'epoch_start_time', 'epoch_end_time', 'n_seen_batches', 'learning_rate'] def on_training_begin(self): if self.append == False: self.file = open(self.filename, 'w') self.file.write(self.separator.join(self.columns) + '\n') else: self.file = open(self.filename, 'a') def on_training_end(self, logs): self.file.close() def on_epoch_end(self, logs): self.file.write(self.separator.join((str(logs[col]) for col in self.columns)) + '\n') class Lambdacallback(Callback): """A callback that takes in anonymous functions for any of the methods, for convenience.""" def __init__(self, on_training_begin=None, on_training_end=None, on_epoch_end=None): self.on_training_begin_ = on_training_begin self.on_training_end_ = on_training_end self.on_epoch_end_ = on_epoch_end def on_training_begin(self): if self.on_training_begin_ is not None: self.on_training_begin_() def on_training_end(self, logs): if self.on_training_end_ is not None: self.on_training_end_(logs) def on_epoch_end(self, logs): if self.on_epoch_end_ is not None: self.on_epoch_end_(logs)
# Nama : Eraraya Morenzo Muten # NIM : 16520002 # Tanggal : 26 Maret 2021 # Program EmpatInteger # Input: 4 integer: A, B, C, D # Output: Sifat integer dari A, B, C, D (positif/negatif/nol) # Jika semua integer positif, tampilkan: # nilai maksimum, minimum, dan mean olympic # KAMUS # variabel # A, B, C, D : int # mo : real # PROCEDURE DAN FUNCTION def CekInteger (x): # I.S.: x terdefinisi, bertype int # F.S.: Jika x positif, maka tertulis di layar: POSITIF # Jika x negatif, maka tertulis di layar: NEGATIF # Jika x nol, maka tertulis di layar: NOL if x>0: print("POSITIF") elif x<0: print("NEGATIF") elif x==0: print("NOL") def Max (a, b, c, d): # menghasilkan nilai terbesar di antara a, b, c, d (integer) return max(a,b,c,d) def Min (a, b, c, d): # menghasilkan nilai terkecil di antara a, b, c, d (integer) return min(a,b,c,d) def IsAllPositif (a, b, c, d): # menghasilkan True jika a, b, c, d seluruhnya positif # False jika tidak return (a>0) and (b>0) and (c>0) and (d>0) # PROGRAM UTAMA A = int(input()) B = int(input()) C = int(input()) D = int(input()) # Menuliskan sifat integer CekInteger(A) CekInteger(B) CekInteger(C) CekInteger(D) # Penulisan maksimum, minimum, dan mean olympic if (IsAllPositif(A,B,C,D)): print(Max(A,B,C,D)) print(Min(A,B,C,D)) mo = (A + B + C + D - Max(A,B,C,D) - Min(A,B,C,D)) / 2 print("%.2f" % mo) # 2 desimal
def cek_integer(x): if x > 0: print('POSITIF') elif x < 0: print('NEGATIF') elif x == 0: print('NOL') def max(a, b, c, d): return max(a, b, c, d) def min(a, b, c, d): return min(a, b, c, d) def is_all_positif(a, b, c, d): return a > 0 and b > 0 and (c > 0) and (d > 0) a = int(input()) b = int(input()) c = int(input()) d = int(input()) cek_integer(A) cek_integer(B) cek_integer(C) cek_integer(D) if is_all_positif(A, B, C, D): print(max(A, B, C, D)) print(min(A, B, C, D)) mo = (A + B + C + D - max(A, B, C, D) - min(A, B, C, D)) / 2 print('%.2f' % mo)
username = 'ENTER YOUR E-MAIL ID HERE' password = 'ENTER YOUR PASSWORD HERE' entry_nodeIp = 'http://py4e-data.dr-chuck.net/json?' gmaps_api_key = 42 user_agents_list = ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36", "Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", ]
username = 'ENTER YOUR E-MAIL ID HERE' password = 'ENTER YOUR PASSWORD HERE' entry_node_ip = 'http://py4e-data.dr-chuck.net/json?' gmaps_api_key = 42 user_agents_list = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', 'Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36']
# uninhm # https://atcoder.jp/contests/abc183/tasks/abc183_a # implementation print(max(0, int(input())))
print(max(0, int(input())))
d1 = {42: 100} d2 = {'abc': 'fob'} d3 = {1e1000: d1} s = set([frozenset([2,3,4])]) class C(object): abc = 42 def f(self): pass cinst = C() class C2(object): abc = 42 def __init__(self): self.oar = 100 self.self = self def __repr__(self): return 'myrepr' def __hex__(self): return 'myhex' def f(self): pass c2inst = C2() class C3(object): def __init__(self): self.abc = 42 self._contents = [1,2] def __iter__(self): return iter(self._contents) def __len__(self): return len(self._contents) def __getitem__(self, index): return self._contents[index] c3inst = C3() l = [1, 2, ] i = 3 pass
d1 = {42: 100} d2 = {'abc': 'fob'} d3 = {1e309: d1} s = set([frozenset([2, 3, 4])]) class C(object): abc = 42 def f(self): pass cinst = c() class C2(object): abc = 42 def __init__(self): self.oar = 100 self.self = self def __repr__(self): return 'myrepr' def __hex__(self): return 'myhex' def f(self): pass c2inst = c2() class C3(object): def __init__(self): self.abc = 42 self._contents = [1, 2] def __iter__(self): return iter(self._contents) def __len__(self): return len(self._contents) def __getitem__(self, index): return self._contents[index] c3inst = c3() l = [1, 2] i = 3 pass
url = "https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json" def turn_right(): turn_left() turn_left() turn_left() def hurdle(): move() turn_left() move() turn_right() move() turn_right() move() turn_left() for i in range(1, 7): hurdle()
url = 'https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json' def turn_right(): turn_left() turn_left() turn_left() def hurdle(): move() turn_left() move() turn_right() move() turn_right() move() turn_left() for i in range(1, 7): hurdle()
class Test: def __init__(self, text): self.text = text def text(self): return self.text
class Test: def __init__(self, text): self.text = text def text(self): return self.text
# Instruments SST_INSTRUMENT = 'SST' POEMAS_INSTRUMENT = 'POEMAS' # File types TRK_TYPE = 'TRK' RBD_TYPE = 'RBD' # Instrument Types AVAILABLE_SST_TYPES = { RBD_TYPE: ["bi", "rs", "rf"] } AVAILABLE_POEMAS_TYPES = { TRK_TYPE: ["TRK"] } INSTRUMENT_TO_TYPE_MAP = { SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES } # Errors OBJECTS_NOT_FROM_SAME_INSTRUMENT = "Objects are not from the same instrument: {}" CONCATENATE_NOT_AVAILABLE_ERROR = "Concatenate operation not available for file with type {} from instrument {}" FILE_NOT_FOUND_ERROR = "File not found: {}" INVALID_PATH_TO_XML_ERROR = "Invalid path to XML: {}" INVALID_INSTRUMENT_ERROR = "Invalid instrument: {}" INVALID_FILE_TYPE_ERROR = "Invalid file type {} for instrument {}." INVALID_FILE_NAME = "Invalid filename {}" INVALID_XML_FILE = "Invalid xml type: {}" FILE_ALREADY_EXISTS = "File {} already exists." INVALID_LEVEL_TYPE = "This level type is not valid: {}. It must be a integer" FITS_LEVEL_NOT_AVAILABLE = "Fits level {} is not available for conversion" CANT_CONVERT_FITS_LEVEL = "Can't get fits level {} for object with level {}, please try a level higher than {}" COULDNT_MATCH_CONVERTED_DATA_TO_INSTRUMENT = "Couldn't match converted data fom file type {} to instrument {}" # Others XML_TABLE_PATH = "xml-tables/{}/{}" CONCATENATED_DATA = "Concatenated Data"
sst_instrument = 'SST' poemas_instrument = 'POEMAS' trk_type = 'TRK' rbd_type = 'RBD' available_sst_types = {RBD_TYPE: ['bi', 'rs', 'rf']} available_poemas_types = {TRK_TYPE: ['TRK']} instrument_to_type_map = {SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES} objects_not_from_same_instrument = 'Objects are not from the same instrument: {}' concatenate_not_available_error = 'Concatenate operation not available for file with type {} from instrument {}' file_not_found_error = 'File not found: {}' invalid_path_to_xml_error = 'Invalid path to XML: {}' invalid_instrument_error = 'Invalid instrument: {}' invalid_file_type_error = 'Invalid file type {} for instrument {}.' invalid_file_name = 'Invalid filename {}' invalid_xml_file = 'Invalid xml type: {}' file_already_exists = 'File {} already exists.' invalid_level_type = 'This level type is not valid: {}. It must be a integer' fits_level_not_available = 'Fits level {} is not available for conversion' cant_convert_fits_level = "Can't get fits level {} for object with level {}, please try a level higher than {}" couldnt_match_converted_data_to_instrument = "Couldn't match converted data fom file type {} to instrument {}" xml_table_path = 'xml-tables/{}/{}' concatenated_data = 'Concatenated Data'
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 23:51:39 2020 @author: abcdk """ word = "Guten Morgen" extract = word[2:5:1] print(extract.upper()) word2 = "Racetrack" extract2 = word2[1:4:1] print(extract2.capitalize())
""" Created on Sun Apr 19 23:51:39 2020 @author: abcdk """ word = 'Guten Morgen' extract = word[2:5:1] print(extract.upper()) word2 = 'Racetrack' extract2 = word2[1:4:1] print(extract2.capitalize())
def get_sunday(): return 'Sunday' def get_monday(): return 'Monday' def get_tuesday(): return 'Tuesday' def get_default(): return 'Unknown' day = 4 switcher = { 0 : get_sunday, 1 : get_monday, 2 : get_tuesday } day_name = switcher.get(day,get_default)() print(day_name)
def get_sunday(): return 'Sunday' def get_monday(): return 'Monday' def get_tuesday(): return 'Tuesday' def get_default(): return 'Unknown' day = 4 switcher = {0: get_sunday, 1: get_monday, 2: get_tuesday} day_name = switcher.get(day, get_default)() print(day_name)
CONFIG_FILENAMES = [ '.vintrc.yaml', '.vintrc.yml', '.vintrc', ]
config_filenames = ['.vintrc.yaml', '.vintrc.yml', '.vintrc']
# -------------- This file adds actual expected results to submission file -----------------# f=open('submission.csv','r') g=open('testHistory.csv','r') # ts.csv generated before h=open('res.csv','w+') lines=f.readlines() i=0 for line in g.readlines(): k=line.split(',') toWrite=k[5] h.write(lines[i][0:-1]+','+toWrite+'\n') i+=1 h.close() f.close() g.close() #----------------- Note ---------------------# # After this file executed: # rename res.csv to submission.csv #--------------------------------------------#
f = open('submission.csv', 'r') g = open('testHistory.csv', 'r') h = open('res.csv', 'w+') lines = f.readlines() i = 0 for line in g.readlines(): k = line.split(',') to_write = k[5] h.write(lines[i][0:-1] + ',' + toWrite + '\n') i += 1 h.close() f.close() g.close()
""" Version. Doing it this way provides for access in setup.py and via __version__ """ __version__ = "0.1.4"
""" Version. Doing it this way provides for access in setup.py and via __version__ """ __version__ = '0.1.4'
IRIS_BYPASS=False AWS_REGION = "us-west-1" IRIS_SNS_TOPIC = "iris-topic" IRIS_SQS_APP_QUEUE = "iris-test-queue" IRIS_POLL_INTERVAL = 20
iris_bypass = False aws_region = 'us-west-1' iris_sns_topic = 'iris-topic' iris_sqs_app_queue = 'iris-test-queue' iris_poll_interval = 20
# This dictionary is to define metrics that we should extract data from and then # their exposed name as predicted metric metrics = { 'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict' } # prom_url = 'http://localhost/' expose_port = 8000 # interval in days interval = 30 # chunk size in hour chunk_size = 24
metrics = {'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict'} prom_url = 'http://localhost/' expose_port = 8000 interval = 30 chunk_size = 24
""" Data types used on Android and whatsapp """ class TextPlain: def __str__(self): return "text/plain" class AnyImage: def __str__(self): return "image/*" class AndroidVndContact: def __str__(self): return "vnd.android.cursor.dir/contact"
""" Data types used on Android and whatsapp """ class Textplain: def __str__(self): return 'text/plain' class Anyimage: def __str__(self): return 'image/*' class Androidvndcontact: def __str__(self): return 'vnd.android.cursor.dir/contact'
def print_hello(): print("hello!") def print_goodbye(): print("goodbye!")
def print_hello(): print('hello!') def print_goodbye(): print('goodbye!')
n = int(input()) primary = [] secondary = [] matrix = [] for _ in range(n): matrix.append([int(x) for x in input().split()]) for r in range(n): primary.append(matrix[r][r]) secondary.append(matrix[r][n - 1 -r]) sum_p = (sum([x for x in primary])) sum_s = (sum([x for x in secondary])) print(abs(sum_p-sum_s))
n = int(input()) primary = [] secondary = [] matrix = [] for _ in range(n): matrix.append([int(x) for x in input().split()]) for r in range(n): primary.append(matrix[r][r]) secondary.append(matrix[r][n - 1 - r]) sum_p = sum([x for x in primary]) sum_s = sum([x for x in secondary]) print(abs(sum_p - sum_s))
# replace with the label of class for which you are interested in building the lexicon; # this should be the same as the label in your input files positive_class_label = "on-topic" # replace the label for the examples that do not belong to the topic of interest # this should be the same as the label in your input files negative_class_label ="off-topic" # lexicon size lexicon_size = 400
positive_class_label = 'on-topic' negative_class_label = 'off-topic' lexicon_size = 400
"""JPL Planetary and Lunar Ephemeris DE422 for the jplephem package. This is the most recent long-period ephemeris published by the Jet Propulsion Laboratory. While requiring more than half a gigabyte of space, it achieves quite high accuracy. :Name: DE422 (September 2009) :Years: -3000 through 3000 :Planets: Yes :Sun/Moon: Yes :Nutations: Yes :Librations: Yes :Report: `Jones, Fomalont, Dhawan, Romney, Folkner, Lanyi, Border, Jacobson (2010) [PDF] <http://arxiv.org/pdf/1012.0264>`_ :Size: 531 MB This ephemeris incorporates ranging data from recent spacecraft missions, including the Cassini mission to Saturn, which results in an accuracy for Saturn of a few milliarcseconds for positions over the past decade. If this ephemeris is too large for your application, take a look at `DE421 <http://pypi.python.org/pypi/de421>`_ and `DE423 <http://pypi.python.org/pypi/de423>`_ as alternatives. To compute using this ephemeris in Python, see the `jplephem <http://pypi.python.org/pypi/jplephem>`_ package. """
"""JPL Planetary and Lunar Ephemeris DE422 for the jplephem package. This is the most recent long-period ephemeris published by the Jet Propulsion Laboratory. While requiring more than half a gigabyte of space, it achieves quite high accuracy. :Name: DE422 (September 2009) :Years: -3000 through 3000 :Planets: Yes :Sun/Moon: Yes :Nutations: Yes :Librations: Yes :Report: `Jones, Fomalont, Dhawan, Romney, Folkner, Lanyi, Border, Jacobson (2010) [PDF] <http://arxiv.org/pdf/1012.0264>`_ :Size: 531 MB This ephemeris incorporates ranging data from recent spacecraft missions, including the Cassini mission to Saturn, which results in an accuracy for Saturn of a few milliarcseconds for positions over the past decade. If this ephemeris is too large for your application, take a look at `DE421 <http://pypi.python.org/pypi/de421>`_ and `DE423 <http://pypi.python.org/pypi/de423>`_ as alternatives. To compute using this ephemeris in Python, see the `jplephem <http://pypi.python.org/pypi/jplephem>`_ package. """
def loadfile(name): values = [] f = open(name, "r") for x in f: values.append(x) return values def day2(): depth = 0 position = 0 depth2 = 0 for i in range(0, len(values)): value = values[i].split() if value[0] == "forward": position += int(value[1]) depth2 += int(value[1]) * depth elif value[0] == "down": depth += int(value[1]) elif value[0] == "up": depth -= int(value[1]) return [position,depth, depth2] values = loadfile("data.txt") print(values) solution = day2() print("full solution: " + str(solution)) print("solution day2a: " + str(solution[0]*solution[1])) print("solution day2b: " + str(solution[0]*solution[2]))
def loadfile(name): values = [] f = open(name, 'r') for x in f: values.append(x) return values def day2(): depth = 0 position = 0 depth2 = 0 for i in range(0, len(values)): value = values[i].split() if value[0] == 'forward': position += int(value[1]) depth2 += int(value[1]) * depth elif value[0] == 'down': depth += int(value[1]) elif value[0] == 'up': depth -= int(value[1]) return [position, depth, depth2] values = loadfile('data.txt') print(values) solution = day2() print('full solution: ' + str(solution)) print('solution day2a: ' + str(solution[0] * solution[1])) print('solution day2b: ' + str(solution[0] * solution[2]))
"""Kata: Move Zeroes - Move all zeroes in list to end. #1 Best Practices Solution by riyakayal def move_zeros(arr): l = [i for i in arr if isinstance(i, bool) or i!=0] return l+[0]*(len(arr)-len(l)) """ def move_zeroes(array): all_zeroes = list(filter((lambda x: x == 0 and type(x) is not bool), array)) non_zeroes = list(filter((lambda x: x != 0 or type(x) is bool), array)) return non_zeroes + all_zeroes
"""Kata: Move Zeroes - Move all zeroes in list to end. #1 Best Practices Solution by riyakayal def move_zeros(arr): l = [i for i in arr if isinstance(i, bool) or i!=0] return l+[0]*(len(arr)-len(l)) """ def move_zeroes(array): all_zeroes = list(filter(lambda x: x == 0 and type(x) is not bool, array)) non_zeroes = list(filter(lambda x: x != 0 or type(x) is bool, array)) return non_zeroes + all_zeroes
class PrefixStorage(object): """Storage for store information about prefixes. >>> s = PrefixStorage() First we save information for some prefixes: >>> s["123"] = "123 domain" >>> s["12"] = "12 domain" Then we can retrieve prefix information by full key (longest prefix always win): >>> s.getByPrefix("123456") '123 domain' >>> s.getByPrefix("12456") '12 domain' If no prefix has been found then getByPrefix() returns default value: >>> s.getByPrefix("13456", "None") 'None' """ def __init__(self): self._mapping = {} self._sizes = [] def __setitem__(self, key, value): ln = len(key) if ln not in self._sizes: self._sizes.append(ln) self._sizes.sort() self._sizes.reverse() self._mapping[key] = value def getByPrefix(self, key, default=None): for ln in self._sizes: k = key[:ln] if k in self._mapping: return self._mapping[k] return default
class Prefixstorage(object): """Storage for store information about prefixes. >>> s = PrefixStorage() First we save information for some prefixes: >>> s["123"] = "123 domain" >>> s["12"] = "12 domain" Then we can retrieve prefix information by full key (longest prefix always win): >>> s.getByPrefix("123456") '123 domain' >>> s.getByPrefix("12456") '12 domain' If no prefix has been found then getByPrefix() returns default value: >>> s.getByPrefix("13456", "None") 'None' """ def __init__(self): self._mapping = {} self._sizes = [] def __setitem__(self, key, value): ln = len(key) if ln not in self._sizes: self._sizes.append(ln) self._sizes.sort() self._sizes.reverse() self._mapping[key] = value def get_by_prefix(self, key, default=None): for ln in self._sizes: k = key[:ln] if k in self._mapping: return self._mapping[k] return default
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY short_version = '1.10.4' version = '1.10.4' full_version = '1.10.4' git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60' release = True if not release: version = full_version
short_version = '1.10.4' version = '1.10.4' full_version = '1.10.4' git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60' release = True if not release: version = full_version
class Solution: def twoSum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum < target: l += 1 elif sum > target: r -= 1 else: return [l + 1, r + 1]
class Solution: def two_sum(self, numbers, target): """ :type numbers: List[int] :type target: int :rtype: List[int] """ l = 0 r = len(numbers) - 1 while l < r: sum = numbers[l] + numbers[r] if sum < target: l += 1 elif sum > target: r -= 1 else: return [l + 1, r + 1]
# Define a Subtraction Function def sub(num1, num2): return num1 - num2
def sub(num1, num2): return num1 - num2
baseurl='\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>' for i in range(1, 18): url = baseurl % (i,i,i,i) print(url+"\n")
baseurl = '\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>' for i in range(1, 18): url = baseurl % (i, i, i, i) print(url + '\n')
class Duck: def swim(self): print("Duck is swimming!") def layEggs(self): print("Duck is laying eggs!") class Fish: def swim(self): print("Fish is swimming!") def layEggs(self): print("Fish is laying eggs!") class Diver: def swim(self): print("A human is waddling around in water!") def saySomethingFunny(self): print("MATLAB is a real programming language!") def swim(entity): entity.swim() def layEggs(entity): entity.layEggs() duck = Duck() fish = Fish() diver = Diver() duck.swim() duck.layEggs() fish.swim() fish.layEggs() diver.swim() diver.layEggs()
class Duck: def swim(self): print('Duck is swimming!') def lay_eggs(self): print('Duck is laying eggs!') class Fish: def swim(self): print('Fish is swimming!') def lay_eggs(self): print('Fish is laying eggs!') class Diver: def swim(self): print('A human is waddling around in water!') def say_something_funny(self): print('MATLAB is a real programming language!') def swim(entity): entity.swim() def lay_eggs(entity): entity.layEggs() duck = duck() fish = fish() diver = diver() duck.swim() duck.layEggs() fish.swim() fish.layEggs() diver.swim() diver.layEggs()
def findTagInChildren(children, key, value=None): """ Find in children a tag element with specified attribute key. If value is set to None, the value is returned. If value is specified, name et attrs of child are returned. In case no element or value is found, None is returned - children: list of tuples (name of element, element attributes) - return: value, (name, attibutes) or None """ #try to get tag with k = place for name, attrs in children: #Skip if this is not a tag if name != "tag": continue #It's a tag try: k = attrs['k'] except KeyError: continue else: if k != key: continue else: try: v = attrs['v'] except KeyError: continue else: if value is None: return v elif v == value: return name, attrs return """ Compare two strings and return True if strings match. Each string is converted into lower case characters before comparison. - characters are replaces with space characters. """ def compareStrings(string1, string2): s1 = string1.lower().replace('-', ' ') s2 = string2.lower().replace('-', ' ') match = False if s1 == s2: match = True return match
def find_tag_in_children(children, key, value=None): """ Find in children a tag element with specified attribute key. If value is set to None, the value is returned. If value is specified, name et attrs of child are returned. In case no element or value is found, None is returned - children: list of tuples (name of element, element attributes) - return: value, (name, attibutes) or None """ for (name, attrs) in children: if name != 'tag': continue try: k = attrs['k'] except KeyError: continue else: if k != key: continue else: try: v = attrs['v'] except KeyError: continue else: if value is None: return v elif v == value: return (name, attrs) return '\nCompare two strings and return True if strings match.\n\nEach string is converted into lower case characters before comparison.\n- characters are replaces with space characters.\n' def compare_strings(string1, string2): s1 = string1.lower().replace('-', ' ') s2 = string2.lower().replace('-', ' ') match = False if s1 == s2: match = True return match
class main: a = '' def func(self): s = '' b = '\n\n\ntareq\n\n\n' for i in b: if i != '\n': s += i print(s) ii = main() ii.func()
class Main: a = '' def func(self): s = '' b = '\n\n\ntareq\n\n\n' for i in b: if i != '\n': s += i print(s) ii = main() ii.func()
def lambda_handler(event, context): message = event['Records'][0]['Sns']['Message'] print("handle message: " + message) webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV' http = urllib3.PoolManager() r = http.request( 'POST', webhook_url, body=message.encode('utf-8'), headers={'Content-Type': 'application/json'} ) print("webhook post response: " + r.data.decode('utf-8') ) return message
def lambda_handler(event, context): message = event['Records'][0]['Sns']['Message'] print('handle message: ' + message) webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV' http = urllib3.PoolManager() r = http.request('POST', webhook_url, body=message.encode('utf-8'), headers={'Content-Type': 'application/json'}) print('webhook post response: ' + r.data.decode('utf-8')) return message
#!/usr/bin/env python """ CREATED AT: 2021/11/5 Des: https://leetcode.com/problems/arranging-coins/ GITHUB: https://github.com/Jiezhi/myleetcode Difficulty: Easy Tag: See: """ class Solution: def arrangeCoins(self, n: int) -> int: """ Runtime: 924 ms, faster than 35.91% Memory Usage: 14.3 MB, less than 39.42% 1 <= n <= 2^31 - 1 :param n: :return: """ i = 1 while n >= i: n, i = n - i, i + 1 return i - 1 def test(): assert Solution().arrangeCoins(n=1) == 1 assert Solution().arrangeCoins(n=2) == 1 assert Solution().arrangeCoins(n=3) == 2 assert Solution().arrangeCoins(n=4) == 2 assert Solution().arrangeCoins(n=5) == 2 assert Solution().arrangeCoins(n=6) == 3 assert Solution().arrangeCoins(n=7) == 3 assert Solution().arrangeCoins(n=8) == 3 assert Solution().arrangeCoins(n=9) == 3 assert Solution().arrangeCoins(n=10) == 4 if __name__ == '__main__': test()
""" CREATED AT: 2021/11/5 Des: https://leetcode.com/problems/arranging-coins/ GITHUB: https://github.com/Jiezhi/myleetcode Difficulty: Easy Tag: See: """ class Solution: def arrange_coins(self, n: int) -> int: """ Runtime: 924 ms, faster than 35.91% Memory Usage: 14.3 MB, less than 39.42% 1 <= n <= 2^31 - 1 :param n: :return: """ i = 1 while n >= i: (n, i) = (n - i, i + 1) return i - 1 def test(): assert solution().arrangeCoins(n=1) == 1 assert solution().arrangeCoins(n=2) == 1 assert solution().arrangeCoins(n=3) == 2 assert solution().arrangeCoins(n=4) == 2 assert solution().arrangeCoins(n=5) == 2 assert solution().arrangeCoins(n=6) == 3 assert solution().arrangeCoins(n=7) == 3 assert solution().arrangeCoins(n=8) == 3 assert solution().arrangeCoins(n=9) == 3 assert solution().arrangeCoins(n=10) == 4 if __name__ == '__main__': test()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 11 16:00:00 2020 @author: natnem """ def CountingSort(A): k = max(A) + 1 C = [0]*(k) #Auxillary array to keep track of the key appearances B = [0]*(len(A)) #To hold the output for i in A: C[i] = C[i] + 1 #0 i if key(Index) is in A else, increment for each apperance of keys for x in range(1,k): C[x] = C[x] + C[x-1] #to keep track of how many keys are before the key in C for j in range(len(A)-1,-1,-1): B[C[A[j]]-1] = A[j] #place the key in sorted place C[A[j]] = C[A[j]] - 1 #decrement key appearance from auxillary array return B A = [2,5,3,0,1,1] print(CountingSort(A))
""" Created on Tue Feb 11 16:00:00 2020 @author: natnem """ def counting_sort(A): k = max(A) + 1 c = [0] * k b = [0] * len(A) for i in A: C[i] = C[i] + 1 for x in range(1, k): C[x] = C[x] + C[x - 1] for j in range(len(A) - 1, -1, -1): B[C[A[j]] - 1] = A[j] C[A[j]] = C[A[j]] - 1 return B a = [2, 5, 3, 0, 1, 1] print(counting_sort(A))
class Descritor: def __init__(self, obj, set=None, get=None, delete=None): self.obj = obj self.set = set self.get = get self.delete = delete def __set__(self, obj, val): print('Estou setando algo') self.obj = val def __get__(self, obj, tipo=None): print('Estou pegango algo') return self.obj def __delete__(self, obj): print('Estou deletando algo') del self.obj def __repr__(self): return self.obj class NumeroPositivo: _n = None def get_n(self): print('get') return self._n def set_n(self, val): print('set') if val < 1: ... else: self._n = val def del_n(self): print('del') del self._n n = Descritor(_n)
class Descritor: def __init__(self, obj, set=None, get=None, delete=None): self.obj = obj self.set = set self.get = get self.delete = delete def __set__(self, obj, val): print('Estou setando algo') self.obj = val def __get__(self, obj, tipo=None): print('Estou pegango algo') return self.obj def __delete__(self, obj): print('Estou deletando algo') del self.obj def __repr__(self): return self.obj class Numeropositivo: _n = None def get_n(self): print('get') return self._n def set_n(self, val): print('set') if val < 1: ... else: self._n = val def del_n(self): print('del') del self._n n = descritor(_n)
# -*- coding: utf-8 -*- A = int(input()) B = int(input()) PROD = (A*B) print("PROD =", PROD)
a = int(input()) b = int(input()) prod = A * B print('PROD =', PROD)
class Persona: cedula = 0 nombre = '' telefono = 0 voto = 0 def __init__(self, cd, nm, tl, vt): self.cedula = cd self.nombre = nm self.telefono = tl self.voto = vt def getCedula(self): return self.cedula def getNombre(self): return self.nombre def getTelefono(self): return self.telefono def getVoto(self): return self.voto def getTodo(self): return self.cedula, self.nombre, self.telefono, self.voto class Estudiante(Persona): carnet = '' carrera = '' def __init__(self, cd, nm, tl, vt): self.carnet = '' self.carrera = '' Persona.__init__(self, cd, nm, tl, vt) def setCarnet(self, cn): self.carnet = cn def setCarrera(self, cr): self.carrera = cr def getCarnet(self): return self.carnet def getCarrera(self): return self.carrera def getTodo(self): datos = [] datos.append(Estudiante.getCarnet(self)) datos.append(Estudiante.getCarrera(self)) persona = Persona.getTodo(self) for p in persona: datos.append(p) return datos
class Persona: cedula = 0 nombre = '' telefono = 0 voto = 0 def __init__(self, cd, nm, tl, vt): self.cedula = cd self.nombre = nm self.telefono = tl self.voto = vt def get_cedula(self): return self.cedula def get_nombre(self): return self.nombre def get_telefono(self): return self.telefono def get_voto(self): return self.voto def get_todo(self): return (self.cedula, self.nombre, self.telefono, self.voto) class Estudiante(Persona): carnet = '' carrera = '' def __init__(self, cd, nm, tl, vt): self.carnet = '' self.carrera = '' Persona.__init__(self, cd, nm, tl, vt) def set_carnet(self, cn): self.carnet = cn def set_carrera(self, cr): self.carrera = cr def get_carnet(self): return self.carnet def get_carrera(self): return self.carrera def get_todo(self): datos = [] datos.append(Estudiante.getCarnet(self)) datos.append(Estudiante.getCarrera(self)) persona = Persona.getTodo(self) for p in persona: datos.append(p) return datos
def stingy(total_lambs): stingyList = [1, 1] x, total = 2, 2 while x <= total_lambs: value = stingyList[x-1] + stingyList[x-2] stingyList.append(value) total += int(stingyList[x]) if total > total_lambs: break x+= 1 return len(stingyList) def generous(total_lambs): generousList = [] x, total = 0, 0 while x <= total_lambs: current = 2**x generousList.append(current) total += current if total > total_lambs: break x += 1 return len(generousList) def solution(total_lambs): return stingy(total_lambs) - generous(total_lambs) if __name__ == "__main__": i1 = 143 print(solution(i1)) i2 = 10 print(solution(i2))
def stingy(total_lambs): stingy_list = [1, 1] (x, total) = (2, 2) while x <= total_lambs: value = stingyList[x - 1] + stingyList[x - 2] stingyList.append(value) total += int(stingyList[x]) if total > total_lambs: break x += 1 return len(stingyList) def generous(total_lambs): generous_list = [] (x, total) = (0, 0) while x <= total_lambs: current = 2 ** x generousList.append(current) total += current if total > total_lambs: break x += 1 return len(generousList) def solution(total_lambs): return stingy(total_lambs) - generous(total_lambs) if __name__ == '__main__': i1 = 143 print(solution(i1)) i2 = 10 print(solution(i2))
""" Desenvolva um programa que leia seis numeros inteiros e mostre a soma apenas daques que forem pares. Se o valor digitado for impar, desconsidere-o. """ soma = 0 for n in range (0, 6): numero = int(input('Digite um numero: ')) if numero %2 == 0: soma = soma + numero print(soma) print('FIM')
""" Desenvolva um programa que leia seis numeros inteiros e mostre a soma apenas daques que forem pares. Se o valor digitado for impar, desconsidere-o. """ soma = 0 for n in range(0, 6): numero = int(input('Digite um numero: ')) if numero % 2 == 0: soma = soma + numero print(soma) print('FIM')
class Account: def __init__(self): self.__blocked: bool = False self.__bound: int = 1000000 self.__balance: int = 0 self.__max_credit: int = -1000 def deposit(self, _sum: int) -> bool: if self.__blocked : return False if _sum < 0 or _sum > self.__bound: return False self.__balance += _sum return True def withdraw(self, _sum: int) -> bool: if self.__blocked : return False if _sum < 0 or _sum > self.__bound : return False if self.__balance <= self.__max_credit + _sum: return False self.__balance -= _sum return True def get_balance(self) -> int: return self.__balance def get_max_credit(self) -> int: return -self.__max_credit def is_blocked(self) -> bool: return self.__blocked def block(self) -> None: self.__blocked = True def unblock(self) -> bool: if self.__balance < self.__max_credit: return False self.__blocked = False return True def set_max_credit(self, mc: int) -> bool: if abs(mc) > self.__bound: return False self.__max_credit = -mc return True
class Account: def __init__(self): self.__blocked: bool = False self.__bound: int = 1000000 self.__balance: int = 0 self.__max_credit: int = -1000 def deposit(self, _sum: int) -> bool: if self.__blocked: return False if _sum < 0 or _sum > self.__bound: return False self.__balance += _sum return True def withdraw(self, _sum: int) -> bool: if self.__blocked: return False if _sum < 0 or _sum > self.__bound: return False if self.__balance <= self.__max_credit + _sum: return False self.__balance -= _sum return True def get_balance(self) -> int: return self.__balance def get_max_credit(self) -> int: return -self.__max_credit def is_blocked(self) -> bool: return self.__blocked def block(self) -> None: self.__blocked = True def unblock(self) -> bool: if self.__balance < self.__max_credit: return False self.__blocked = False return True def set_max_credit(self, mc: int) -> bool: if abs(mc) > self.__bound: return False self.__max_credit = -mc return True
def process_sql_file(file_name): file, string = open(file_name, "r"), '' # for line in file, remove comments, space out '(' and ')', add line to output string: for line in file: line = line.rstrip() line = line.split('//')[0] line = line.split('--')[0] line = line.replace('(', ' ( ') line = line.replace(')', ' ) ') string += ' ' + line file.close() # remove multi-line comments: while string.find('/*') > -1 and string.find('*/') > -1: l_multi_line = string.find('/*') r_multi_line = string.find('*/') string = string[:l_multi_line] + string[r_multi_line + 2:] string = string.lower() # remove extra whitespaces and make list words = string.split() return words def find_table_names(words, rm_cte=False): table_names = set() previous_word = '' ctes = set() for word in words: if rm_cte and word == 'as': ctes.add(previous_word) if previous_word == 'from' or previous_word == 'join': if word != '(': if rm_cte and word not in ctes: table_names.add(word) if not rm_cte: table_names.add(word) previous_word = word return sorted(list(table_names)) # this function assumes that the .sql file does not have any syntax errors: def find_table_names_from_sql_file(file_name, rm_cte=False): words = process_sql_file(file_name) return find_table_names(words, rm_cte=rm_cte)
def process_sql_file(file_name): (file, string) = (open(file_name, 'r'), '') for line in file: line = line.rstrip() line = line.split('//')[0] line = line.split('--')[0] line = line.replace('(', ' ( ') line = line.replace(')', ' ) ') string += ' ' + line file.close() while string.find('/*') > -1 and string.find('*/') > -1: l_multi_line = string.find('/*') r_multi_line = string.find('*/') string = string[:l_multi_line] + string[r_multi_line + 2:] string = string.lower() words = string.split() return words def find_table_names(words, rm_cte=False): table_names = set() previous_word = '' ctes = set() for word in words: if rm_cte and word == 'as': ctes.add(previous_word) if previous_word == 'from' or previous_word == 'join': if word != '(': if rm_cte and word not in ctes: table_names.add(word) if not rm_cte: table_names.add(word) previous_word = word return sorted(list(table_names)) def find_table_names_from_sql_file(file_name, rm_cte=False): words = process_sql_file(file_name) return find_table_names(words, rm_cte=rm_cte)
# Membership, identity, and logical operations x=[1,2,3] y=[1,2,3] print(x==y) #test equivalance print(x is y) #test object identity x=y # assignment print(x is y)
x = [1, 2, 3] y = [1, 2, 3] print(x == y) print(x is y) x = y print(x is y)
''' Created on Nov 20, 2014 This is a dummy to solve dependencies from error.py @author: Tim Gerhard ''' # The webfrontend does not dump errors. If this function is called anywhere, this simply doesn't matter. def dumpError(error): return
""" Created on Nov 20, 2014 This is a dummy to solve dependencies from error.py @author: Tim Gerhard """ def dump_error(error): return
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
# Write a program that reads a temperature value and the letter C for Celsius or F for # Fahrenheit. Print whether water is liquid, solid, or gaseous at the given temperature # at sea level. type = str(input("Enter the temperature type, C for celsius or F for fahrenheit: ")) temperature = float(input("Enter the temperature: ")) if type == "C": if temperature >= 0 and temperature < 100: print("Water is liquid.") elif temperature >= 100: print("Water is gaseous.") else: print("Water is solid.") elif type == "F": if temperature >= 32 and temperature < 132: print("Water is liquid.") elif temperature >= 132: print("Water is gaseous.") else: print("Water is solid.")
type = str(input('Enter the temperature type, C for celsius or F for fahrenheit: ')) temperature = float(input('Enter the temperature: ')) if type == 'C': if temperature >= 0 and temperature < 100: print('Water is liquid.') elif temperature >= 100: print('Water is gaseous.') else: print('Water is solid.') elif type == 'F': if temperature >= 32 and temperature < 132: print('Water is liquid.') elif temperature >= 132: print('Water is gaseous.') else: print('Water is solid.')
def mike(): print("hola") mike() mike() mike() mike() mike()
def mike(): print('hola') mike() mike() mike() mike() mike()
# Python3 program to count triplets with # sum smaller than a given value # Function to count triplets with sum smaller # than a given value def countTriplets(arr, n, sum): # Sort input array arr.sort() # Initialize result ans = 0 # Every iteration of loop counts triplet with # first element as arr[i]. for i in range(0, n - 2): # Initialize other two elements as corner elements # of subarray arr[j+1..k] j = i + 1 k = n - 1 # Use Meet in the Middle concept while (j < k): # If sum of current triplet is more or equal, # move right corner to look for smaller values if (arr[i] + arr[j] + arr[k] >= sum): k = k - 1 # Else move left corner else: # This is important. For current i and j, there # can be total k-j third elements. ans += (k - j) j = j + 1 return ans # Driver program if __name__ == '__main__': arr = [5, 3, 4, 7,1] n = len(arr) sum = 12 print(countTriplets(arr, n, sum))
def count_triplets(arr, n, sum): arr.sort() ans = 0 for i in range(0, n - 2): j = i + 1 k = n - 1 while j < k: if arr[i] + arr[j] + arr[k] >= sum: k = k - 1 else: ans += k - j j = j + 1 return ans if __name__ == '__main__': arr = [5, 3, 4, 7, 1] n = len(arr) sum = 12 print(count_triplets(arr, n, sum))
class UnknownResponseType(Exception): pass class UnknownDatetime(Exception): pass
class Unknownresponsetype(Exception): pass class Unknowndatetime(Exception): pass
t=int(input()) for i in range(t): s=int(input()) m=s%12 if m==1: print(s+11,'WS') elif m==2: print(s+9,'MS') elif m==3: print(s+7,'AS') elif m==4: print(s+5,'AS') elif m==5: print(s+3,'MS') elif m==6: print(s+1,'WS') elif m==7: print(s-1,'WS') elif m==8: print(s-3,'MS') elif m==9: print(s-5,'AS') elif m==10: print(s-7,'AS') elif m==11: print(s-9,'MS') elif m==0: print(s-11,'WS') # t=int(input()) # for i in range(t): # s=int(input()) # m=s%12 # l=11 # if m==0: # print(s-11,'WS') # for i in range(1,12): # if m==i: # print(s+l) # else: # l=l-2
t = int(input()) for i in range(t): s = int(input()) m = s % 12 if m == 1: print(s + 11, 'WS') elif m == 2: print(s + 9, 'MS') elif m == 3: print(s + 7, 'AS') elif m == 4: print(s + 5, 'AS') elif m == 5: print(s + 3, 'MS') elif m == 6: print(s + 1, 'WS') elif m == 7: print(s - 1, 'WS') elif m == 8: print(s - 3, 'MS') elif m == 9: print(s - 5, 'AS') elif m == 10: print(s - 7, 'AS') elif m == 11: print(s - 9, 'MS') elif m == 0: print(s - 11, 'WS')
__author__ = 'Mikhail' def add_line(line_one, line_two): """ >>> line_one = [1, 2, 3] >>> line_two = [1, 2, 3] >>> add_line(line_one, line_two) >>> line_one [2, 4, 6] >>> line_two [1, 2, 3] >>> add_line(line_two, line_one) >>> line_one [2, 4, 6] >>> line_two [3, 6, 9] """ for i in range(len(line_one)): line_one[i] += line_two[i] def multiply_by_value(line, value): """ >>> line_one = [1, 2, 3] >>> value = 5 >>> multiply_by_value(line_one, value) >>> line_one [5, 10, 15] """ for i in range(len(line)): line[i] *= value def gauss_method(matrix, result_vector): """ >>> matrix = [[1, 2, 3, 4], [1, 1, 1, 1], [1, 1, 2, 3], [1, 1, 2, 2]] >>> vector = [1, 0, 0, 0] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0, -0.0], [-0.0, 1.0, -0.0, -0.0], [-0.0, -0.0, 1.0, -0.0], [0.0, 0.0, 0.0, 1.0]] >>> vector [-1.0, 1.0, -0.0, 0.0] >>> matrix = [[4, 2, 1], [7, 8, 9], [9, 1, 3]] >>> vector = [1, 1, 2] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0], [-0.0, 1.0, -0.0], [-0.0, 6.082091352294336e-17, 1.0]] >>> vector [0.2608695652173913, 0.043478260869565265, -0.1304347826086957] >>> matrix = [[1, 3, 4], [2, 1, 4]] >>> vector = [4, 5] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, 1.5999999999999996], [0.0, 1.0, 0.8]] >>> vector [2.1999999999999993, 0.6000000000000001] >>> matrix = [[1, 3, 2], [2, 6, 4], [1, 4, 3]] >>> vector = [7, 8, 1] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -1.0], [-0.0, 1.0, 1.0], [0.0, 0.0, 0.0]] >>> vector [24.999999999999996, -6.0, 3.0] >>> matrix = [[1, 1, -3], [2, 1, -2], [1, 1, 1], [1, 2, -3]] >>> vector = [-1, 1, 3, 1] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0], [0.0, 1.0, 0.0], [-0.0, -0.0, 1.0], [0.0, 0.0, 0.0]] >>> vector [1.0, 1.0, 1.0, -0.25] >>> matrix = [[3, 3, -1], [1, -2, -3], [2, 1, -2]] >>> vector = [1, -11, -4] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, 0.0], [0.0, 1.0, -0.0], [-0.0, -0.0, 1.0]] >>> vector [-1.0, 2.0, 2.0] """ the_smallest_matrix_size = min(len(matrix), len(matrix[0])) the_matrix_size = len(matrix) # forward for forward_row_id in range(the_smallest_matrix_size): column_id = forward_row_id if matrix[forward_row_id][column_id] == 0: # attempt to identify required row rows_were_switched = False for another_modified_row_id in range(forward_row_id + 1, the_matrix_size): if matrix[another_modified_row_id][column_id] != 0: # switch rows in the matrix for matrix_column_id in range(column_id, len(matrix[0]), 1): matrix[forward_row_id][matrix_column_id], matrix[another_modified_row_id][matrix_column_id] = \ matrix[another_modified_row_id][matrix_column_id], matrix[forward_row_id][matrix_column_id] # switch elements in result vector result_vector[forward_row_id], result_vector[another_modified_row_id] = \ result_vector[another_modified_row_id], result_vector[forward_row_id] rows_were_switched = True break if not rows_were_switched: continue normalization_value = matrix[forward_row_id][column_id] # change value on the element on diagonal multiply_by_value(matrix[forward_row_id], 1.0/normalization_value) result_vector[forward_row_id] *= 1.0/normalization_value # modification for modified_row_id in range(forward_row_id + 1, the_matrix_size): if matrix[modified_row_id][column_id] != 0: direct_or_reverse_gauss_step(column_id, forward_row_id, matrix, modified_row_id, result_vector) # reverse for reverse_row_id in range(the_smallest_matrix_size - 1, -1, -1): column_id = reverse_row_id if matrix[reverse_row_id][column_id] != 0: normalization_value = matrix[reverse_row_id][column_id] # change value on the element on diagonal multiply_by_value(matrix[reverse_row_id], 1.0/normalization_value) result_vector[reverse_row_id] *= 1.0/normalization_value # modification for modified_row_id in range(reverse_row_id - 1, -1, -1): if matrix[modified_row_id][column_id] != 0: direct_or_reverse_gauss_step(column_id, reverse_row_id, matrix, modified_row_id, result_vector) def direct_or_reverse_gauss_step(column_id, forward_row_id, matrix, modified_row_id, result_vector): """ """ modification = -(matrix[forward_row_id][column_id]) / (matrix[modified_row_id][column_id]) # normalise matrix row multiply_by_value(matrix[modified_row_id], modification) # normalise result vector result_vector[modified_row_id] *= modification # change required row add_line(matrix[modified_row_id], matrix[forward_row_id]) # change result vector result_vector[modified_row_id] += result_vector[forward_row_id] def analyse_gauss_method_results(matrix, result_vector): """ >>> matrix = [[1.0, -0.0, -0.0], [-0.0, 1.0, -0.0], [-0.0, 6.082091352294336e-17, 1.0]] >>> result_vector = [0.2608695652173913, 0.043478260869565265, -0.1304347826086957] >>> analyse_gauss_method_results(matrix, result_vector) YES 0.260869565217 0.0434782608696 -0.130434782609 >>> processed_matrix = [[1.0, -0.0, -1.0], [-0.0, 1.0, 1.0], [0.0, 0.0, 0.0]] >>> result_vector = [24.999999999999996, -6.0, 3.0] >>> analyse_gauss_method_results(processed_matrix, result_vector) NO >>> processed_matrix = [[1.0, -0.0, 1.5999999999999996], [0.0, 1.0, 0.8]] >>> result_vector = [2.1999999999999993, 0.6000000000000001] >>> analyse_gauss_method_results(processed_matrix, result_vector) INF >>> processed_matrix = [[1.0, -0.0, -0.0], [0.0, 1.0, 0.0], [-0.0, -0.0, 1.0], [0.0, 0.0, 0.0]] >>> result_vector = [1.0, 1.0, 1.0, -0.25] >>> analyse_gauss_method_results(processed_matrix, result_vector) NO """ # check on situation when the system has no answer for row_id, row in enumerate(matrix): if all([abs(row_element) < 1.0e-8 for row_element in matrix[row_id]]) and abs(result_vector[row_id]) > 1.0e-8: print("NO") return # system has infinite number of answers if len(matrix) < len(matrix[0]): print("INF") return # system has only one answer print("YES") print(" ".join([str(res) for res in result_vector])) if __name__ == "__main__": # data initialization data = list(map(lambda x: int(x), input().split())) amount_of_equations = data[0] amount_of_variables = data[1] initial_matrix = list() initial_vector = list() for equation_id in range(amount_of_equations): equation = list(map(lambda x: float(x), input().split())) initial_matrix.append(equation[:-1]) initial_vector.append(equation[-1]) gauss_method(initial_matrix, initial_vector) analyse_gauss_method_results(initial_matrix, initial_vector)
__author__ = 'Mikhail' def add_line(line_one, line_two): """ >>> line_one = [1, 2, 3] >>> line_two = [1, 2, 3] >>> add_line(line_one, line_two) >>> line_one [2, 4, 6] >>> line_two [1, 2, 3] >>> add_line(line_two, line_one) >>> line_one [2, 4, 6] >>> line_two [3, 6, 9] """ for i in range(len(line_one)): line_one[i] += line_two[i] def multiply_by_value(line, value): """ >>> line_one = [1, 2, 3] >>> value = 5 >>> multiply_by_value(line_one, value) >>> line_one [5, 10, 15] """ for i in range(len(line)): line[i] *= value def gauss_method(matrix, result_vector): """ >>> matrix = [[1, 2, 3, 4], [1, 1, 1, 1], [1, 1, 2, 3], [1, 1, 2, 2]] >>> vector = [1, 0, 0, 0] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0, -0.0], [-0.0, 1.0, -0.0, -0.0], [-0.0, -0.0, 1.0, -0.0], [0.0, 0.0, 0.0, 1.0]] >>> vector [-1.0, 1.0, -0.0, 0.0] >>> matrix = [[4, 2, 1], [7, 8, 9], [9, 1, 3]] >>> vector = [1, 1, 2] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0], [-0.0, 1.0, -0.0], [-0.0, 6.082091352294336e-17, 1.0]] >>> vector [0.2608695652173913, 0.043478260869565265, -0.1304347826086957] >>> matrix = [[1, 3, 4], [2, 1, 4]] >>> vector = [4, 5] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, 1.5999999999999996], [0.0, 1.0, 0.8]] >>> vector [2.1999999999999993, 0.6000000000000001] >>> matrix = [[1, 3, 2], [2, 6, 4], [1, 4, 3]] >>> vector = [7, 8, 1] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -1.0], [-0.0, 1.0, 1.0], [0.0, 0.0, 0.0]] >>> vector [24.999999999999996, -6.0, 3.0] >>> matrix = [[1, 1, -3], [2, 1, -2], [1, 1, 1], [1, 2, -3]] >>> vector = [-1, 1, 3, 1] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, -0.0], [0.0, 1.0, 0.0], [-0.0, -0.0, 1.0], [0.0, 0.0, 0.0]] >>> vector [1.0, 1.0, 1.0, -0.25] >>> matrix = [[3, 3, -1], [1, -2, -3], [2, 1, -2]] >>> vector = [1, -11, -4] >>> gauss_method(matrix, vector) >>> matrix [[1.0, -0.0, 0.0], [0.0, 1.0, -0.0], [-0.0, -0.0, 1.0]] >>> vector [-1.0, 2.0, 2.0] """ the_smallest_matrix_size = min(len(matrix), len(matrix[0])) the_matrix_size = len(matrix) for forward_row_id in range(the_smallest_matrix_size): column_id = forward_row_id if matrix[forward_row_id][column_id] == 0: rows_were_switched = False for another_modified_row_id in range(forward_row_id + 1, the_matrix_size): if matrix[another_modified_row_id][column_id] != 0: for matrix_column_id in range(column_id, len(matrix[0]), 1): (matrix[forward_row_id][matrix_column_id], matrix[another_modified_row_id][matrix_column_id]) = (matrix[another_modified_row_id][matrix_column_id], matrix[forward_row_id][matrix_column_id]) (result_vector[forward_row_id], result_vector[another_modified_row_id]) = (result_vector[another_modified_row_id], result_vector[forward_row_id]) rows_were_switched = True break if not rows_were_switched: continue normalization_value = matrix[forward_row_id][column_id] multiply_by_value(matrix[forward_row_id], 1.0 / normalization_value) result_vector[forward_row_id] *= 1.0 / normalization_value for modified_row_id in range(forward_row_id + 1, the_matrix_size): if matrix[modified_row_id][column_id] != 0: direct_or_reverse_gauss_step(column_id, forward_row_id, matrix, modified_row_id, result_vector) for reverse_row_id in range(the_smallest_matrix_size - 1, -1, -1): column_id = reverse_row_id if matrix[reverse_row_id][column_id] != 0: normalization_value = matrix[reverse_row_id][column_id] multiply_by_value(matrix[reverse_row_id], 1.0 / normalization_value) result_vector[reverse_row_id] *= 1.0 / normalization_value for modified_row_id in range(reverse_row_id - 1, -1, -1): if matrix[modified_row_id][column_id] != 0: direct_or_reverse_gauss_step(column_id, reverse_row_id, matrix, modified_row_id, result_vector) def direct_or_reverse_gauss_step(column_id, forward_row_id, matrix, modified_row_id, result_vector): """ """ modification = -matrix[forward_row_id][column_id] / matrix[modified_row_id][column_id] multiply_by_value(matrix[modified_row_id], modification) result_vector[modified_row_id] *= modification add_line(matrix[modified_row_id], matrix[forward_row_id]) result_vector[modified_row_id] += result_vector[forward_row_id] def analyse_gauss_method_results(matrix, result_vector): """ >>> matrix = [[1.0, -0.0, -0.0], [-0.0, 1.0, -0.0], [-0.0, 6.082091352294336e-17, 1.0]] >>> result_vector = [0.2608695652173913, 0.043478260869565265, -0.1304347826086957] >>> analyse_gauss_method_results(matrix, result_vector) YES 0.260869565217 0.0434782608696 -0.130434782609 >>> processed_matrix = [[1.0, -0.0, -1.0], [-0.0, 1.0, 1.0], [0.0, 0.0, 0.0]] >>> result_vector = [24.999999999999996, -6.0, 3.0] >>> analyse_gauss_method_results(processed_matrix, result_vector) NO >>> processed_matrix = [[1.0, -0.0, 1.5999999999999996], [0.0, 1.0, 0.8]] >>> result_vector = [2.1999999999999993, 0.6000000000000001] >>> analyse_gauss_method_results(processed_matrix, result_vector) INF >>> processed_matrix = [[1.0, -0.0, -0.0], [0.0, 1.0, 0.0], [-0.0, -0.0, 1.0], [0.0, 0.0, 0.0]] >>> result_vector = [1.0, 1.0, 1.0, -0.25] >>> analyse_gauss_method_results(processed_matrix, result_vector) NO """ for (row_id, row) in enumerate(matrix): if all([abs(row_element) < 1e-08 for row_element in matrix[row_id]]) and abs(result_vector[row_id]) > 1e-08: print('NO') return if len(matrix) < len(matrix[0]): print('INF') return print('YES') print(' '.join([str(res) for res in result_vector])) if __name__ == '__main__': data = list(map(lambda x: int(x), input().split())) amount_of_equations = data[0] amount_of_variables = data[1] initial_matrix = list() initial_vector = list() for equation_id in range(amount_of_equations): equation = list(map(lambda x: float(x), input().split())) initial_matrix.append(equation[:-1]) initial_vector.append(equation[-1]) gauss_method(initial_matrix, initial_vector) analyse_gauss_method_results(initial_matrix, initial_vector)
def mergeSortedArrays(L, R): sorted_array = [] i = j = 0 while i < len(L) and j < len(R): if L[i] < R[j]: sorted_array.append(L[i]) i += 1 else: sorted_array.append(R[j]) j += 1 # When we run out of elements in either L or M, # pick up the remaining elements and put in A[p..r] while i < len(L): sorted_array.append(L[i]) i += 1 while j < len(R): sorted_array.append(R[j]) j += 1 return sorted_array def mergeSort(nums): # exit condition!!! Important for a recursion! if (len(nums) <= 1): return nums # split the array to two smaller arrays middle = len(nums) // 2 L = nums[:middle] R = nums[middle:] # sort the smalle5r arrays L = mergeSort(L) R = mergeSort(R) nums = mergeSortedArrays(L, R) return nums array = [6, 5, 12, 10, 9, 1] mergeSort(array) print(array)
def merge_sorted_arrays(L, R): sorted_array = [] i = j = 0 while i < len(L) and j < len(R): if L[i] < R[j]: sorted_array.append(L[i]) i += 1 else: sorted_array.append(R[j]) j += 1 while i < len(L): sorted_array.append(L[i]) i += 1 while j < len(R): sorted_array.append(R[j]) j += 1 return sorted_array def merge_sort(nums): if len(nums) <= 1: return nums middle = len(nums) // 2 l = nums[:middle] r = nums[middle:] l = merge_sort(L) r = merge_sort(R) nums = merge_sorted_arrays(L, R) return nums array = [6, 5, 12, 10, 9, 1] merge_sort(array) print(array)
"abcd".startswith("ab") #returns True "abcd".endswith("zn") #returns False "bb" in "abab" #returns False "ab" in "abab" #returns True loc = "abab".find("bb") #returns -1 loc = "abab".find("ab") #returns 0 loc = "abab".find("ab",loc+1) #returns 2
'abcd'.startswith('ab') 'abcd'.endswith('zn') 'bb' in 'abab' 'ab' in 'abab' loc = 'abab'.find('bb') loc = 'abab'.find('ab') loc = 'abab'.find('ab', loc + 1)
# -*- encoding: utf-8 -*- """ Copyright (c) Minu Kim - minu.kim@kaist.ac.kr Templates from AppSeed.us This file is hidden for privacy issues. """
""" Copyright (c) Minu Kim - minu.kim@kaist.ac.kr Templates from AppSeed.us This file is hidden for privacy issues. """
SOLVERS = ( { 'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d', }, { 'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s', }, { 'type': 'local', 'name': 'picosat', 'command': './solvers/picosat-tptp.sh -L %d %s', }, { 'type': 'local', 'name': 'satisfiable-dummy', 'command': './solvers/satisfiable-dummy.sh %s -t %d', }, { 'type': 'local', 'name': 'unsatisfiable-dummy', 'command': './solvers/unsatisfiable-dummy.sh %s -t %d', }, { 'type': 'local', 'name': 'gaveup-dummy', 'command': './solvers/gaveup-dummy.sh %s -t %d', }, )
solvers = ({'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d'}, {'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s'}, {'type': 'local', 'name': 'picosat', 'command': './solvers/picosat-tptp.sh -L %d %s'}, {'type': 'local', 'name': 'satisfiable-dummy', 'command': './solvers/satisfiable-dummy.sh %s -t %d'}, {'type': 'local', 'name': 'unsatisfiable-dummy', 'command': './solvers/unsatisfiable-dummy.sh %s -t %d'}, {'type': 'local', 'name': 'gaveup-dummy', 'command': './solvers/gaveup-dummy.sh %s -t %d'})
"""Choices for Rider APP""" status_choices = ( ('in_shop', 'In Shop'), ('enroute_destination', 'Enroute destination'), ('delivered', 'Delivered') ) IN_SHOP = 'in_shop'
"""Choices for Rider APP""" status_choices = (('in_shop', 'In Shop'), ('enroute_destination', 'Enroute destination'), ('delivered', 'Delivered')) in_shop = 'in_shop'
""" For ease of use, please lay out your grid in Euclidean-plane format and NOT in numpy-type format. For example, if an object needs to be placed in the 3rd row and 7th column of the gridworld numpy matrix, enter its location in your layout dict as [7,3]. The codebase will take care of the matrix-indexing for you. For example, the above object will be queried as grid[3, 7] when placed into the grid. NOTE: the origin (0,0) is the top-left corner of the grid. The positive direction along the x-axis counts to the right and the positive direction along the y-axis """ LINEAR = { 'FOUR_PLAYERS': { 'WALLS': [ # First wall [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [8, 11], # Second wall [0, 7], [1, 7], [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], # Third wall [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [8, 3] ], # Doors are double doors of coord [[x1,x2], [y1,y2]] 'DOORS': [ [[6, 7], [11, 11]], [[2, 3], [7, 7]], [[6, 7], [3, 3]] ], 'PLATES': [ [7, 13], [2, 9], [7, 5] ], 'AGENTS': [ [5, 13], [5, 12], [4, 13], [4, 12] ], 'GOAL': [ [3, 1] ] }, 'FIVE_PLAYERS': { 'WALLS': [ # First wall [0, 15], [1, 15], # [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], # Second wall [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], # [5, 11], [8, 11], # Third wall [0, 7], [1, 7], # [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], # Fourth wall [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], # [5, 3], [8, 3], ], # Doors are double doors of coord [[x1,x2], [y1,y2]] 'DOORS': [ [[2, 3, 4], [15, 15, 15]], [[5, 6, 7], [11, 11, 11]], [[2, 3, 4], [7, 7, 7]], [[5, 6, 7], [3, 3, 3]] ], 'PLATES': [ [2, 17], [7, 13], [2, 9], [7, 5] ], 'AGENTS': [ [6, 16], [5, 17], [5, 16], [4, 17], [4, 16] ], 'GOAL': [ [3, 1] ] }, 'SIX_PLAYERS': { 'WALLS': [ # First wall [0, 19], [1, 19], [2, 19], [3, 19], [4, 19], # [5, 19], [8, 19], # Second wall [0, 15], [1, 15], # [4, 15], [5, 15], [6, 15], [7, 15], [8, 15], # Third wall [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], # [5, 11], [8, 11], # Fourth wall [0, 7], [1, 7], # [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], # Fifth wall [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], # [5, 3], [8, 3], ], # Doors are double doors of coord [[x1,x2], [y1,y2]] 'DOORS': [ [[5, 6, 7], [19, 19, 19]], [[2, 3, 4], [15, 15, 15]], [[5, 6, 7], [11, 11, 11]], [[2, 3, 4], [7, 7, 7]], [[5, 6, 7], [3, 3, 3]] ], 'PLATES': [ [7, 21], [2, 17], [7, 13], [2, 9], [7, 5] ], 'AGENTS': [ [6, 21], [6, 20], [5, 21], [5, 20], [4, 21], [4, 20] ], 'GOAL': [ [3, 1] ] } }
""" For ease of use, please lay out your grid in Euclidean-plane format and NOT in numpy-type format. For example, if an object needs to be placed in the 3rd row and 7th column of the gridworld numpy matrix, enter its location in your layout dict as [7,3]. The codebase will take care of the matrix-indexing for you. For example, the above object will be queried as grid[3, 7] when placed into the grid. NOTE: the origin (0,0) is the top-left corner of the grid. The positive direction along the x-axis counts to the right and the positive direction along the y-axis """ linear = {'FOUR_PLAYERS': {'WALLS': [[0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [5, 11], [8, 11], [0, 7], [1, 7], [4, 7], [5, 7], [6, 7], [7, 7], [8, 7], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [5, 3], [8, 3]], 'DOORS': [[[6, 7], [11, 11]], [[2, 3], [7, 7]], [[6, 7], [3, 3]]], 'PLATES': [[7, 13], [2, 9], [7, 5]], 'AGENTS': [[5, 13], [5, 12], [4, 13], [4, 12]], 'GOAL': [[3, 1]]}, 'FIVE_PLAYERS': {'WALLS': [[0, 15], [1, 15], [5, 15], [6, 15], [7, 15], [8, 15], [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [8, 11], [0, 7], [1, 7], [5, 7], [6, 7], [7, 7], [8, 7], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [8, 3]], 'DOORS': [[[2, 3, 4], [15, 15, 15]], [[5, 6, 7], [11, 11, 11]], [[2, 3, 4], [7, 7, 7]], [[5, 6, 7], [3, 3, 3]]], 'PLATES': [[2, 17], [7, 13], [2, 9], [7, 5]], 'AGENTS': [[6, 16], [5, 17], [5, 16], [4, 17], [4, 16]], 'GOAL': [[3, 1]]}, 'SIX_PLAYERS': {'WALLS': [[0, 19], [1, 19], [2, 19], [3, 19], [4, 19], [8, 19], [0, 15], [1, 15], [5, 15], [6, 15], [7, 15], [8, 15], [0, 11], [1, 11], [2, 11], [3, 11], [4, 11], [8, 11], [0, 7], [1, 7], [5, 7], [6, 7], [7, 7], [8, 7], [0, 3], [1, 3], [2, 3], [3, 3], [4, 3], [8, 3]], 'DOORS': [[[5, 6, 7], [19, 19, 19]], [[2, 3, 4], [15, 15, 15]], [[5, 6, 7], [11, 11, 11]], [[2, 3, 4], [7, 7, 7]], [[5, 6, 7], [3, 3, 3]]], 'PLATES': [[7, 21], [2, 17], [7, 13], [2, 9], [7, 5]], 'AGENTS': [[6, 21], [6, 20], [5, 21], [5, 20], [4, 21], [4, 20]], 'GOAL': [[3, 1]]}}
SEED_URLS = [ "https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/pathfinder-kingmaker-definitive-edition/bphqqn22gb7l?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/call-of-duty-modern-warfare---digital-standard-edition/9NVQBQ3F6W9W?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/ori-and-the-will-of-the-wisps/9N8CD0XZKLP4?activetab=pivot:overviewtab", "https://www.microsoft.com/EN-CA/p/red-dead-redemption-2/9N2ZDN7NWQKV?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/tom-clancys-rainbow-six-siege-deluxe-edition/9p30k2nxwh82?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/pillars-of-eternity-complete-edition/bs34vnw7h61f?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/pillars-of-eternity-ii-deadfire-ultimate-edition/9pjd2kmx7tz6?activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/astroneer/9nblggh43kzb?cid=msft_web_chart&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/farm-together/9mxsdjxfzq25?cid=msft_web_chart&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/Mafia-III-Definitive-Edition/BVZLS7XZ68KF?rtc=1&activetab=pivot:overviewtab", "https://www.microsoft.com/EN-CA/p/little-nightmares/BWD88K55MK5W?id=Pubsalegame_Week13&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/Nexomon-Extinction/9NCJR504WXT0?rtc=1&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/GreedFall/BWMH4RQ4Q06F?rtc=1&activetab=pivot:overviewtab", "https://www.microsoft.com/en-ca/p/outriders-standard-edition/9p12rcxbf02p?activetab=pivot:overviewtab", ]
seed_urls = ['https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pathfinder-kingmaker-definitive-edition/bphqqn22gb7l?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/call-of-duty-modern-warfare---digital-standard-edition/9NVQBQ3F6W9W?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/ori-and-the-will-of-the-wisps/9N8CD0XZKLP4?activetab=pivot:overviewtab', 'https://www.microsoft.com/EN-CA/p/red-dead-redemption-2/9N2ZDN7NWQKV?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/tom-clancys-rainbow-six-siege-deluxe-edition/9p30k2nxwh82?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pillars-of-eternity-complete-edition/bs34vnw7h61f?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pillars-of-eternity-ii-deadfire-ultimate-edition/9pjd2kmx7tz6?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/astroneer/9nblggh43kzb?cid=msft_web_chart&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/farm-together/9mxsdjxfzq25?cid=msft_web_chart&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/Mafia-III-Definitive-Edition/BVZLS7XZ68KF?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/EN-CA/p/little-nightmares/BWD88K55MK5W?id=Pubsalegame_Week13&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/Nexomon-Extinction/9NCJR504WXT0?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/GreedFall/BWMH4RQ4Q06F?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/outriders-standard-edition/9p12rcxbf02p?activetab=pivot:overviewtab']
# salva no copiateste.txt o mesmo conteudo do teste.txt with open('teste.txt', 'r') as arquivolido: with open('copiateste.txt', 'w') as arquivocriado: for linha in arquivolido: arquivocriado.write(linha)
with open('teste.txt', 'r') as arquivolido: with open('copiateste.txt', 'w') as arquivocriado: for linha in arquivolido: arquivocriado.write(linha)
class Event: def __init__(self, event_type, time, direction, intersection): self.event_type = event_type self.time = time self.direction = direction self.intersection = intersection
class Event: def __init__(self, event_type, time, direction, intersection): self.event_type = event_type self.time = time self.direction = direction self.intersection = intersection
""" Please write a program to compress and decompress the string "hello world!hello world!hello world!hello world!". import zlib s = 'hello world!hello world!hello world!hello world!' # In Python 3 zlib.compress() accepts only DataType <bytes> y = bytes(s, 'utf-8') x = zlib.compress(y) print(x) print(zlib.decompress(x)) """ """ Please write a program to print the running time of execution of "1+1" for 100 times. import datetime before = datetime.datetime.now() for i in range(100): x = 1 + 1 after = datetime.datetime.now() execution_time = after - before print(execution_time.microseconds) """ """ Please write a program to shuffle and print the list [3,6,7,8]. import random lst = [3,6,7,8] random.shuffle(lst) print(lst) """ """ Please write a program to generate all sentences where subject is in ["I", "You"] and verb is in ["Play", "Love"] and the object is in ["Hockey","Football"]. if __name__ == '__main__': sub=['I','You'] verb=['Play','Love'] obj=['Hockey','Football'] for i in sub: for j in verb: for k in obj: print(f'{i} {j} {k}') """
""" Please write a program to compress and decompress the string "hello world!hello world!hello world!hello world!". import zlib s = 'hello world!hello world!hello world!hello world!' # In Python 3 zlib.compress() accepts only DataType <bytes> y = bytes(s, 'utf-8') x = zlib.compress(y) print(x) print(zlib.decompress(x)) """ '\n\nPlease write a program to print the running time of execution of "1+1" for 100 times.\n\nimport datetime\n\nbefore = datetime.datetime.now()\nfor i in range(100):\n x = 1 + 1\nafter = datetime.datetime.now()\nexecution_time = after - before\nprint(execution_time.microseconds)\n\n' '\n\nPlease write a program to shuffle and print the list [3,6,7,8].\n\nimport random\n\nlst = [3,6,7,8]\nrandom.shuffle(lst)\nprint(lst)\n\n' '\n\nPlease write a program to generate all sentences where\nsubject is in ["I", "You"] and verb is in ["Play", "Love"] and the object is in ["Hockey","Football"].\n\nif __name__ == \'__main__\':\n sub=[\'I\',\'You\']\n verb=[\'Play\',\'Love\']\n obj=[\'Hockey\',\'Football\']\n for i in sub:\n for j in verb:\n for k in obj:\n print(f\'{i} {j} {k}\')\n\n'
#write import statement for reverse string function ''' 10 points Write a main function to .... Loop as long as user types y. Prompt user for a string (assume user will always give you good data). Pass the string to the reverse string function and display the reversed string '''
""" 10 points Write a main function to .... Loop as long as user types y. Prompt user for a string (assume user will always give you good data). Pass the string to the reverse string function and display the reversed string """
day = str(input()) if (day == "Monday") or (day == "Tuesday") or (day == "Friday"): print("12") elif (day == "Wednesday") or (day == "Thursday"): print("14") else: print("16")
day = str(input()) if day == 'Monday' or day == 'Tuesday' or day == 'Friday': print('12') elif day == 'Wednesday' or day == 'Thursday': print('14') else: print('16')
def two_fer(name=""): if not name.strip(): return "One for you, one for me." else: return "One for {}, one for me.".format(name)
def two_fer(name=''): if not name.strip(): return 'One for you, one for me.' else: return 'One for {}, one for me.'.format(name)
""" The probe's x,y position starts at 0,0. Then, it will follow some trajectory by moving in steps. On each step, these changes occur in the following order: The probe's x position increases by its x velocity. The probe's y position increases by its y velocity. Due to drag, the probe's x velocity changes by 1 toward the value 0; that is, it decreases by 1 if it is greater than 0, increases by 1 if it is less than 0, or does not change if it is already 0. Due to gravity, the probe's y velocity decreases by 1. """ def get_max(x_pos, y_pos, x_velocity, y_velocity, target_x1, target_x2, target_y1, target_y2): max_y = -100 while x_pos <= target_x2 and y_pos >= target_y2: if y_pos > max_y: max_y = y_pos x_pos, y_pos, x_velocity, y_velocity = calc_pos_and_velocity(x_pos, y_pos, x_velocity, y_velocity) if x_pos >= target_x1 and x_pos <= target_x2 and y_pos <= target_y1 and y_pos >= target_y2: return max_y return -100 def calc_pos_and_velocity(x, y, x_velocity, y_velocity): x_pos = x + x_velocity y_pos = y + y_velocity if x_velocity == 0: x_velocity = 0 elif x_velocity > 0: x_velocity -= 1 else: x_velocity += 1 y_velocity -= 1 return x_pos, y_pos, x_velocity, y_velocity def main(): # Example data # target area: x=20..30, y=-10..-5 target_x1 = 20 target_x2 = 30 target_y1 = -5 target_y2 = -10 x_pos = 0 y_pos = 0 x_vel = 6 y_vel = 3 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == 6, f'Expected 6, got {max_y}' x_vel = 6 y_vel = 9 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == 45, f'Expected 45, got {max_y}' # 17,-4 # Never reach target zone x_vel = 17 y_vel = -4 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == -100, f'Expected -100, got {max_y}' max_ys = [] max_set = set() for x in range(0, 1000): for y in range(-100, 100): x_vel = x y_vel = y max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) if max_y != -100: max_ys.append(max_y) max_set.add((x_vel, y_vel)) # print(max_ys) print(max(max_ys)) assert max(max_ys) == 45, f'Expected 45, got {max(max_ys)}' # print(max_set) print(len(max_set)) assert len(max_set) == 112, f'Expected 112, got {len(max_set)}' # target area: x=155..215, y=-132..-72 print('INPUT DATA: target area: x=155..215, y=-132..-72') target_x1 = 155 target_x2 = 215 target_y1 = -72 target_y2 = -132 x_pos = 0 y_pos = 0 max_ys = [] max_set = set() for x in range(0, 1000): for y in range(-500, 500): x_vel = x y_vel = y max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) if max_y != -100: max_ys.append(max_y) max_set.add((x_vel, y_vel)) # print(max_ys) print(max(max_ys)) assert max(max_ys) == 8646, f'Expected 8646, got {max(max_ys)}' print(len(max_set)) assert len(max_set) == 5945, f'Expected 5945, got {len(max_set)}' if __name__ == '__main__': main()
""" The probe's x,y position starts at 0,0. Then, it will follow some trajectory by moving in steps. On each step, these changes occur in the following order: The probe's x position increases by its x velocity. The probe's y position increases by its y velocity. Due to drag, the probe's x velocity changes by 1 toward the value 0; that is, it decreases by 1 if it is greater than 0, increases by 1 if it is less than 0, or does not change if it is already 0. Due to gravity, the probe's y velocity decreases by 1. """ def get_max(x_pos, y_pos, x_velocity, y_velocity, target_x1, target_x2, target_y1, target_y2): max_y = -100 while x_pos <= target_x2 and y_pos >= target_y2: if y_pos > max_y: max_y = y_pos (x_pos, y_pos, x_velocity, y_velocity) = calc_pos_and_velocity(x_pos, y_pos, x_velocity, y_velocity) if x_pos >= target_x1 and x_pos <= target_x2 and (y_pos <= target_y1) and (y_pos >= target_y2): return max_y return -100 def calc_pos_and_velocity(x, y, x_velocity, y_velocity): x_pos = x + x_velocity y_pos = y + y_velocity if x_velocity == 0: x_velocity = 0 elif x_velocity > 0: x_velocity -= 1 else: x_velocity += 1 y_velocity -= 1 return (x_pos, y_pos, x_velocity, y_velocity) def main(): target_x1 = 20 target_x2 = 30 target_y1 = -5 target_y2 = -10 x_pos = 0 y_pos = 0 x_vel = 6 y_vel = 3 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == 6, f'Expected 6, got {max_y}' x_vel = 6 y_vel = 9 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == 45, f'Expected 45, got {max_y}' x_vel = 17 y_vel = -4 max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) assert max_y == -100, f'Expected -100, got {max_y}' max_ys = [] max_set = set() for x in range(0, 1000): for y in range(-100, 100): x_vel = x y_vel = y max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) if max_y != -100: max_ys.append(max_y) max_set.add((x_vel, y_vel)) print(max(max_ys)) assert max(max_ys) == 45, f'Expected 45, got {max(max_ys)}' print(len(max_set)) assert len(max_set) == 112, f'Expected 112, got {len(max_set)}' print('INPUT DATA: target area: x=155..215, y=-132..-72') target_x1 = 155 target_x2 = 215 target_y1 = -72 target_y2 = -132 x_pos = 0 y_pos = 0 max_ys = [] max_set = set() for x in range(0, 1000): for y in range(-500, 500): x_vel = x y_vel = y max_y = get_max(x_pos, y_pos, x_vel, y_vel, target_x1, target_x2, target_y1, target_y2) if max_y != -100: max_ys.append(max_y) max_set.add((x_vel, y_vel)) print(max(max_ys)) assert max(max_ys) == 8646, f'Expected 8646, got {max(max_ys)}' print(len(max_set)) assert len(max_set) == 5945, f'Expected 5945, got {len(max_set)}' if __name__ == '__main__': main()
""" Write a Python program to check if two given strings are isomorphic to each other or not. """ def isIsomorphic(str1, str2): dict_str1 = {} dict_str2 = {} for i, value in enumerate(str1): dict_str1[value] = dict_str1.get(value, []) + [i] for j, value in enumerate(str2): dict_str2[value] = dict_str2.get(value, []) + [j] if sorted(dict_str1.values()) == sorted(dict_str2.values()): return True else: return False print(isIsomorphic("foo", "bar"))
""" Write a Python program to check if two given strings are isomorphic to each other or not. """ def is_isomorphic(str1, str2): dict_str1 = {} dict_str2 = {} for (i, value) in enumerate(str1): dict_str1[value] = dict_str1.get(value, []) + [i] for (j, value) in enumerate(str2): dict_str2[value] = dict_str2.get(value, []) + [j] if sorted(dict_str1.values()) == sorted(dict_str2.values()): return True else: return False print(is_isomorphic('foo', 'bar'))
class Args: def __init__(self, config, checkpoint): self.cfg = config self.checkpoint = checkpoint self.sp = True self.detector = "yolo" self.inputpath = "./" self.inputlist = "" self.inputimg = "" self.outputpath = "examples/res/" self.save_img = False self.vis = False self.profile = False self.format = "open" self.min_box_area = 0 self.detbatch = 5 self.posebatch = 80 self.eval = False self.gpus = "0" self.qsize = 1024 self.flip = False self.debug = False self.video = "" self.webcam = 1 self.save_video = False self.vis_fast = False self.pose_track = False
class Args: def __init__(self, config, checkpoint): self.cfg = config self.checkpoint = checkpoint self.sp = True self.detector = 'yolo' self.inputpath = './' self.inputlist = '' self.inputimg = '' self.outputpath = 'examples/res/' self.save_img = False self.vis = False self.profile = False self.format = 'open' self.min_box_area = 0 self.detbatch = 5 self.posebatch = 80 self.eval = False self.gpus = '0' self.qsize = 1024 self.flip = False self.debug = False self.video = '' self.webcam = 1 self.save_video = False self.vis_fast = False self.pose_track = False
PANDA_MODELS = dict( gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472', ) KUKA_MODELS = dict( gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681', ) BAXTER_MODELS = dict( gt_joints='dream-baxter-gt_joints--510055', predict_joints='dream-baxter-predict_joints--519984', ) OWI_MODELS = dict( predict_joints='craves-owi535-predict_joints--295440', ) PANDA_ABLATION_REFERENCE_POINT_MODELS = dict( link0='dream-panda-gt_joints-reference_point=link0--864695', link1='dream-panda-gt_joints-reference_point=link1--499756', link2='dream-panda-gt_joints-reference_point=link2--905185', link4='dream-panda-gt_joints-reference_point=link4--913645', link5='dream-panda-gt_joints-reference_point=link5--669469', link9='dream-panda-gt_joints-reference_point=hand--588677', ) PANDA_ABLATION_ANCHOR_MODELS = dict( link0='dream-panda-predict_joints-anchor=link0--90648', link1='dream-panda-predict_joints-anchor=link1--375503', link2='dream-panda-predict_joints-anchor=link2--463951', link4='dream-panda-predict_joints-anchor=link4--388856', link5='dream-panda-predict_joints-anchor=link5--249745', link9='dream-panda-predict_joints-anchor=link9--106543', random_all='dream-panda-predict_joints-anchor=random_all--116995', random_top3='dream-panda-predict_joints-anchor=random_top_3_largest--65378', random_top5=PANDA_MODELS['predict_joints'], ) PANDA_ABLATION_ITERATION_MODELS = { 'n_train_iter=1': 'dream-panda-predict_joints-n_train_iter=1--752826', 'n_train_iter=2': 'dream-panda-predict_joints-n_train_iter=2--949003', 'n_train_iter=5': 'dream-panda-predict_joints-n_train_iter=5--315150', } RESULT_ID = 1804 DREAM_PAPER_RESULT_IDS = [ f'dream-{robot}-dream-all-models--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter') ] DREAM_KNOWN_ANGLES_RESULT_IDS = [ f'dream-{robot}-knownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter') ] DREAM_UNKNOWN_ANGLES_RESULT_IDS = [ f'dream-{robot}-unknownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter') ] PANDA_KNOWN_ANGLES_ITERATIVE_RESULT_IDS = [ f'dream-panda-orb-knownq--{RESULT_ID}', f'dream-panda-orb-knownq-online--{RESULT_ID}' ] CRAVES_LAB_RESULT_IDS = [ f'craves-lab-unknownq--{RESULT_ID}' ] CRAVES_YOUTUBE_RESULT_IDS = [ f'craves-youtube-unknownq-focal={focal}--{RESULT_ID}' for focal in (500, 750, 1000, 1250, 1500, 1750, 2000) ] PANDA_KNOWN_ANGLES_ABLATION_RESULT_IDS = [ f'dream-panda-orb-knownq-link{link_id}--{RESULT_ID}' for link_id in (0, 1, 2, 4, 5, 9) ] PANDA_UNKNOWN_ANGLES_ABLATION_RESULT_IDS = [ f'dream-panda-orb-unknownq-{anchor}--{RESULT_ID}' for anchor in ('link5', 'link2', 'link1', 'link0', 'link4', 'link9', 'random_all', 'random_top5', 'random_top3') ] PANDA_ITERATIONS_ABLATION_RESULT_IDS = [ f'dream-panda-orb-train_K={train_K}--{RESULT_ID}' for train_K in (1, 2, 3, 5) ]
panda_models = dict(gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472') kuka_models = dict(gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681') baxter_models = dict(gt_joints='dream-baxter-gt_joints--510055', predict_joints='dream-baxter-predict_joints--519984') owi_models = dict(predict_joints='craves-owi535-predict_joints--295440') panda_ablation_reference_point_models = dict(link0='dream-panda-gt_joints-reference_point=link0--864695', link1='dream-panda-gt_joints-reference_point=link1--499756', link2='dream-panda-gt_joints-reference_point=link2--905185', link4='dream-panda-gt_joints-reference_point=link4--913645', link5='dream-panda-gt_joints-reference_point=link5--669469', link9='dream-panda-gt_joints-reference_point=hand--588677') panda_ablation_anchor_models = dict(link0='dream-panda-predict_joints-anchor=link0--90648', link1='dream-panda-predict_joints-anchor=link1--375503', link2='dream-panda-predict_joints-anchor=link2--463951', link4='dream-panda-predict_joints-anchor=link4--388856', link5='dream-panda-predict_joints-anchor=link5--249745', link9='dream-panda-predict_joints-anchor=link9--106543', random_all='dream-panda-predict_joints-anchor=random_all--116995', random_top3='dream-panda-predict_joints-anchor=random_top_3_largest--65378', random_top5=PANDA_MODELS['predict_joints']) panda_ablation_iteration_models = {'n_train_iter=1': 'dream-panda-predict_joints-n_train_iter=1--752826', 'n_train_iter=2': 'dream-panda-predict_joints-n_train_iter=2--949003', 'n_train_iter=5': 'dream-panda-predict_joints-n_train_iter=5--315150'} result_id = 1804 dream_paper_result_ids = [f'dream-{robot}-dream-all-models--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')] dream_known_angles_result_ids = [f'dream-{robot}-knownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')] dream_unknown_angles_result_ids = [f'dream-{robot}-unknownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')] panda_known_angles_iterative_result_ids = [f'dream-panda-orb-knownq--{RESULT_ID}', f'dream-panda-orb-knownq-online--{RESULT_ID}'] craves_lab_result_ids = [f'craves-lab-unknownq--{RESULT_ID}'] craves_youtube_result_ids = [f'craves-youtube-unknownq-focal={focal}--{RESULT_ID}' for focal in (500, 750, 1000, 1250, 1500, 1750, 2000)] panda_known_angles_ablation_result_ids = [f'dream-panda-orb-knownq-link{link_id}--{RESULT_ID}' for link_id in (0, 1, 2, 4, 5, 9)] panda_unknown_angles_ablation_result_ids = [f'dream-panda-orb-unknownq-{anchor}--{RESULT_ID}' for anchor in ('link5', 'link2', 'link1', 'link0', 'link4', 'link9', 'random_all', 'random_top5', 'random_top3')] panda_iterations_ablation_result_ids = [f'dream-panda-orb-train_K={train_K}--{RESULT_ID}' for train_k in (1, 2, 3, 5)]
n = int(input()) narr = list(map(int,input().split())) ev,od = 0,0 for i in range(n): if narr[i]%2==0: ev+=narr[i] else: od+=narr[i] print(od-ev)
n = int(input()) narr = list(map(int, input().split())) (ev, od) = (0, 0) for i in range(n): if narr[i] % 2 == 0: ev += narr[i] else: od += narr[i] print(od - ev)
def linear_search(array, n): """ - Definition - In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list. Comlexity: Time Complexity: O(n) - since in worst case we're checking each element exactly once. """ is_found = False for i in array: if i == n: is_found = True else: continue return is_found
def linear_search(array, n): """ - Definition - In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list. Comlexity: Time Complexity: O(n) - since in worst case we're checking each element exactly once. """ is_found = False for i in array: if i == n: is_found = True else: continue return is_found
def _resource_from_cache_prefix(resource, cache): """ Combine the resource name with the cache prefix (if any) """ if getattr(cache, 'key_prefix', None): name = '{} {}'.format(resource, cache.key_prefix) else: name = resource # enforce lowercase to make the output nicer to read return name.lower() def quantize_key_values(key): """ Used in the Django trace operation method, it ensures that if a dict with values is used, we removes the values from the span meta attributes. For example:: >>> quantize_key_values({'key', 'value'}) # returns ['key'] """ if isinstance(key, dict): return key.keys() return key
def _resource_from_cache_prefix(resource, cache): """ Combine the resource name with the cache prefix (if any) """ if getattr(cache, 'key_prefix', None): name = '{} {}'.format(resource, cache.key_prefix) else: name = resource return name.lower() def quantize_key_values(key): """ Used in the Django trace operation method, it ensures that if a dict with values is used, we removes the values from the span meta attributes. For example:: >>> quantize_key_values({'key', 'value'}) # returns ['key'] """ if isinstance(key, dict): return key.keys() return key
#!usr/bin/env python3 # -*- coding:utf-8 -*- ''' Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5, 7, 7, 8, 8, 10] and target value 8, return [3, 4]. ''' class Solution(object): def searchRange(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums)): if nums[i] == target: left = i break else: return [-1, 1] # find the index of the rightmost appearance of `target` (by reverse # iteration). it is guaranteed to appear. for j in range(len(nums) - 1, -1, -1): if nums[j] == target: right = j break return [left, right] if __name__ == "__main__": assert Solution().searchRange([5, 7, 7, 8, 8, 10], 8) == [3, 4] assert Solution().searchRange([5, 7, 7, 8, 8, 10], 5) == [0, 0] assert Solution().searchRange([5, 7, 7, 8, 8, 10], 7) == [1, 2] assert Solution().searchRange([5, 7, 7, 8, 8, 10], 10) == [5, 5]
""" Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5, 7, 7, 8, 8, 10] and target value 8, return [3, 4]. """ class Solution(object): def search_range(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums)): if nums[i] == target: left = i break else: return [-1, 1] for j in range(len(nums) - 1, -1, -1): if nums[j] == target: right = j break return [left, right] if __name__ == '__main__': assert solution().searchRange([5, 7, 7, 8, 8, 10], 8) == [3, 4] assert solution().searchRange([5, 7, 7, 8, 8, 10], 5) == [0, 0] assert solution().searchRange([5, 7, 7, 8, 8, 10], 7) == [1, 2] assert solution().searchRange([5, 7, 7, 8, 8, 10], 10) == [5, 5]
# Here we assume that cs_array has the dimensions (n_bins, n_chans, n_seg) # Where n_chans is the number of channels of interest ## cs_array has been filtered before this step cs_avg = np.mean(cs_array, axis=-1) ## Take the IFFT of the cross spectrum to get the CCF ccf_avg = fftpack.ifft(cs_avg, axis=0).real ccf_array = fftpack.ifft(cs_array, axis=0).real ## Apply normalization ccv_avg *= (2.0 / np.float(n_bins) / ref_rms) ccf_array *= (2.0 / np.float(n_bins) / ref_rms) ## Compute the standard error on each ccf bin from the segment-to-segment ## variations. ccf_resid = (ccf_array.T - ccf_avg.T).T ## Eqn 2.3 from S. Vaughan 2013, "Scientific Inference" sample_var = np.sum(ccf_resid**2, axis=2) / (meta_dict['n_seg'] - 1) ## Eqn 2.4 from S. Vaughan 2013, "Scientific Inference" standard_error = np.sqrt(sample_var / meta_dict['n_seg']) return ccf_avg, standard_error
cs_avg = np.mean(cs_array, axis=-1) ccf_avg = fftpack.ifft(cs_avg, axis=0).real ccf_array = fftpack.ifft(cs_array, axis=0).real ccv_avg *= 2.0 / np.float(n_bins) / ref_rms ccf_array *= 2.0 / np.float(n_bins) / ref_rms ccf_resid = (ccf_array.T - ccf_avg.T).T sample_var = np.sum(ccf_resid ** 2, axis=2) / (meta_dict['n_seg'] - 1) standard_error = np.sqrt(sample_var / meta_dict['n_seg']) return (ccf_avg, standard_error)
# Copyright (c) 2017 Dustin Toff # Licensed under Apache License v2.0 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository") def new_github_repository(name = None, user = None, project = None, commit = None, tag = None, sha256 = None, build_file = None, build_file_content = None): """ Equivalent to new_git_repository but for github repos If sha256 is set, the repository will be downloaded in its .tar.gz form, ensuring the bytes do not change over time, even when using a tag which may be changed in the origin. """ if sha256 != None: # Ordered by specificity id = commit or tag # GitHub strips the "v" from tags like "v1.0" and uses "1.0" instead github_id = id for num in range(10): if id.startswith("v{n}".format(n = num)): github_id = id[1:] break return http_archive(**{ "name": name, "sha256": sha256, "strip_prefix": "{project}-{id}".format(project = project, id = github_id), "urls": [ "https://github.com/{user}/{project}/archive/{id}.tar.gz".format(user = user, project = project, id = id), ], "build_file": build_file, "build_file_content": build_file_content, }) else: if build_file != None or build_file_content != None: method = new_git_repository else: method = git_repository return method(**{ "name": name, "remote": "https://github.com/{user}/{project}.git".format(user = user, project = project), "commit": commit, "tag": tag, "build_file": build_file, "build_file_content": build_file_content, }) def github_repository(name = None, user = None, project = None, commit = None, tag = None, sha256 = None): """ Equivalent to new_git_repository but for github repos """ return new_github_repository(name = name, user = user, project = project, commit = commit, tag = tag, sha256 = sha256)
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository', 'new_git_repository') def new_github_repository(name=None, user=None, project=None, commit=None, tag=None, sha256=None, build_file=None, build_file_content=None): """ Equivalent to new_git_repository but for github repos If sha256 is set, the repository will be downloaded in its .tar.gz form, ensuring the bytes do not change over time, even when using a tag which may be changed in the origin. """ if sha256 != None: id = commit or tag github_id = id for num in range(10): if id.startswith('v{n}'.format(n=num)): github_id = id[1:] break return http_archive(**{'name': name, 'sha256': sha256, 'strip_prefix': '{project}-{id}'.format(project=project, id=github_id), 'urls': ['https://github.com/{user}/{project}/archive/{id}.tar.gz'.format(user=user, project=project, id=id)], 'build_file': build_file, 'build_file_content': build_file_content}) else: if build_file != None or build_file_content != None: method = new_git_repository else: method = git_repository return method(**{'name': name, 'remote': 'https://github.com/{user}/{project}.git'.format(user=user, project=project), 'commit': commit, 'tag': tag, 'build_file': build_file, 'build_file_content': build_file_content}) def github_repository(name=None, user=None, project=None, commit=None, tag=None, sha256=None): """ Equivalent to new_git_repository but for github repos """ return new_github_repository(name=name, user=user, project=project, commit=commit, tag=tag, sha256=sha256)
""" sqmpy ~~~~~ A job management web application that makes it easier for scientists to submit and monitor jobs to remote to remote resources. `sqm' stands for Simple Queue Manager. """ __author__ = 'Mehdi Sadeghi' __version__ = '0.4'
""" sqmpy ~~~~~ A job management web application that makes it easier for scientists to submit and monitor jobs to remote to remote resources. `sqm' stands for Simple Queue Manager. """ __author__ = 'Mehdi Sadeghi' __version__ = '0.4'
int_list = list(map(int, input().split())) movement = int(input()) for i in range(movement): int_list.append(int_list[0]) int_list.remove(int_list[0]) print(int_list)
int_list = list(map(int, input().split())) movement = int(input()) for i in range(movement): int_list.append(int_list[0]) int_list.remove(int_list[0]) print(int_list)
total = 0 count = 0 average = 0 smallest = None largest = None print('before largest:', largest) while True: inp = input('>') if inp == "done": break try: if float(inp): total += float(inp) count += 1 new_value = float(inp) if largest is None or new_value > largest: largest = new_value print('new_largest is', largest) if smallest is None or new_value < smallest: smallest = new_value print('new_smallest is', smallest) except ValueError: print('invalid input') if count != 0: print('done') print('largest is', largest) print('smallest is', smallest) print('count is', count) print(total) print('average=', total / count) else: print('enter a number please')
total = 0 count = 0 average = 0 smallest = None largest = None print('before largest:', largest) while True: inp = input('>') if inp == 'done': break try: if float(inp): total += float(inp) count += 1 new_value = float(inp) if largest is None or new_value > largest: largest = new_value print('new_largest is', largest) if smallest is None or new_value < smallest: smallest = new_value print('new_smallest is', smallest) except ValueError: print('invalid input') if count != 0: print('done') print('largest is', largest) print('smallest is', smallest) print('count is', count) print(total) print('average=', total / count) else: print('enter a number please')
# # PySNMP MIB module Nortel-MsCarrier-MscPassport-AlarmMIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AlarmMIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:19:28 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") ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint") DateAndTime, DisplayString, Unsigned32, RowPointer = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB", "DateAndTime", "DisplayString", "Unsigned32", "RowPointer") HexString, Hex, DigitString, AsciiString = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-TextualConventionsMIB", "HexString", "Hex", "DigitString", "AsciiString") mscPassportMIBs, mscPassportTraps = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB", "mscPassportMIBs", "mscPassportTraps") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, TimeTicks, MibIdentifier, Counter32, NotificationType, Unsigned32, Gauge32, Counter64, iso, Integer32, ModuleIdentity, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "TimeTicks", "MibIdentifier", "Counter32", "NotificationType", "Unsigned32", "Gauge32", "Counter64", "iso", "Integer32", "ModuleIdentity", "Bits", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") alarmMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4)) mscAlarmTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2)) mscMandatoryAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7)) mscComponentRowPointer = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 1), RowPointer()) if mibBuilder.loadTexts: mscComponentRowPointer.setStatus('mandatory') mscComponentName = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 2), DisplayString()) if mibBuilder.loadTexts: mscComponentName.setStatus('mandatory') mscEventTime = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 3), DateAndTime()) if mibBuilder.loadTexts: mscEventTime.setStatus('mandatory') mscActiveListStatus = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("message", 0), ("set", 1), ("clear", 2)))) if mibBuilder.loadTexts: mscActiveListStatus.setStatus('mandatory') mscSeverity = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("indeterminate", 0), ("critical", 1), ("major", 2), ("minor", 3), ("warning", 4), ("cleared", 5)))) if mibBuilder.loadTexts: mscSeverity.setStatus('mandatory') mscAlarmType = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("communications", 0), ("qualityOfService", 1), ("processing", 2), ("equipment", 3), ("environmental", 4), ("security", 5), ("operator", 6), ("debug", 7), ("unknown", 8)))) if mibBuilder.loadTexts: mscAlarmType.setStatus('mandatory') mscProbableCause = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25, 26, 27, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 90, 91, 92, 93, 100, 101, 102, 110, 111, 112, 113, 114, 120, 121, 122, 200, 201, 202, 203, 204))).clone(namedValues=NamedValues(("lossOfSignal", 0), ("lossOfFrame", 1), ("framingError", 2), ("localTransmissionError", 3), ("remoteTransmissionError", 4), ("callEstablishmentError", 5), ("degradedSignal", 6), ("commSubsystemFailure", 7), ("commProtocolError", 8), ("lanError", 9), ("dteDceInterfaceError", 10), ("responseTimeExcessive", 20), ("queueSizeExceeded", 21), ("bandwidthReduced", 22), ("retransmissionRateReduced", 23), ("thresholdCrossed", 24), ("performanceDegraded", 25), ("congestion", 26), ("atOrNearCapacity", 27), ("storageCapacityProblem", 40), ("versionMismatch", 41), ("corruptData", 42), ("cpuCyclesLimitExceeded", 43), ("softwareError", 44), ("softwareProgramError", 45), ("softwareProgramTermination", 46), ("fileError", 47), ("outOfMemory", 48), ("underlyingResourceUnavail", 49), ("applicationSubsystemFailure", 50), ("configurationError", 51), ("powerProblem", 60), ("timingProblem", 61), ("processorProblem", 62), ("datasetModemError", 63), ("multiplexorProblem", 64), ("receiverFailure", 65), ("transmitterFailure", 66), ("outputDeviceError", 67), ("inputDeviceError", 68), ("ioDeviceError", 69), ("equipmentFailure", 70), ("adapterError", 71), ("duplicateInfo", 80), ("infoMissing", 81), ("infoModification", 82), ("infoOutOfSequence", 83), ("unexpectedInfo", 84), ("denialOfService", 90), ("outOfService", 91), ("proceduralError", 92), ("otherOperational", 93), ("cableTamper", 100), ("intrusionDetection", 101), ("otherPhysical", 102), ("authenticationFailure", 110), ("breachOfConfidence", 111), ("nonRepudiationFailure", 112), ("unauthorizedAccess", 113), ("otherSecurityService", 114), ("delayedInfo", 120), ("keyExpired", 121), ("outOfHoursActivity", 122), ("operationalCondition", 200), ("debugging", 201), ("unknown", 202), ("inactiveVirtualCircuit", 203), ("networkServerIntervention", 204)))) if mibBuilder.loadTexts: mscProbableCause.setStatus('mandatory') mscNtpIndex = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 8), DigitString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)) if mibBuilder.loadTexts: mscNtpIndex.setStatus('mandatory') mscCommentData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 9), AsciiString().subtype(subtypeSpec=ValueSizeConstraint(0, 750))) if mibBuilder.loadTexts: mscCommentData.setStatus('mandatory') mscOptionalAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8)) mscNotificationID = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 1), Hex()) if mibBuilder.loadTexts: mscNotificationID.setStatus('mandatory') mscLpForHierClear = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 2), RowPointer()) if mibBuilder.loadTexts: mscLpForHierClear.setStatus('mandatory') mscOperatorData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 3), HexString().subtype(subtypeSpec=ValueSizeConstraint(0, 750))) if mibBuilder.loadTexts: mscOperatorData.setStatus('mandatory') mscPid = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 25))) if mibBuilder.loadTexts: mscPid.setStatus('mandatory') mscFileName = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 5), DisplayString()) if mibBuilder.loadTexts: mscFileName.setStatus('mandatory') mscFileLineNumber = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 6), Unsigned32()) if mibBuilder.loadTexts: mscFileLineNumber.setStatus('mandatory') mscFileVersion = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 7), DisplayString()) if mibBuilder.loadTexts: mscFileVersion.setStatus('mandatory') mscInternalData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 8), HexString().subtype(subtypeSpec=ValueSizeConstraint(0, 750))) if mibBuilder.loadTexts: mscInternalData.setStatus('mandatory') mscProvisionalAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9)) mscCid = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9, 1), Unsigned32()) if mibBuilder.loadTexts: mscCid.setStatus('mandatory') mscCriticalAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,1)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) mscMajorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,2)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) mscMinorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,3)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) mscWarningAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,4)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) mscClearedAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,5)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) mscIndeterminateAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,6)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData")) alarmGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1)) alarmGroupCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1)) alarmGroupCA01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2)) alarmGroupCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2, 2)) alarmNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2)) alarmNotificationsGroupCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2, 1)) alarmCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3)) alarmCapabilitiesCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1)) alarmCapabilitiesCA01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2)) alarmCapabilitiesCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2, 2)) mibBuilder.exportSymbols("Nortel-MsCarrier-MscPassport-AlarmMIB", mscCommentData=mscCommentData, alarmCapabilitiesCA01=alarmCapabilitiesCA01, alarmCapabilitiesCA01A=alarmCapabilitiesCA01A, alarmCapabilities=alarmCapabilities, mscOptionalAlarmInfo=mscOptionalAlarmInfo, alarmNotificationsGroupCA01A=alarmNotificationsGroupCA01A, mscProvisionalAlarmInfo=mscProvisionalAlarmInfo, mscWarningAlarm=mscWarningAlarm, mscAlarmTrap=mscAlarmTrap, alarmCapabilitiesCA=alarmCapabilitiesCA, mscMandatoryAlarmInfo=mscMandatoryAlarmInfo, mscComponentRowPointer=mscComponentRowPointer, mscNtpIndex=mscNtpIndex, alarmGroup=alarmGroup, alarmNotifications=alarmNotifications, mscProbableCause=mscProbableCause, mscMinorAlarm=mscMinorAlarm, mscActiveListStatus=mscActiveListStatus, mscLpForHierClear=mscLpForHierClear, alarmGroupCA01A=alarmGroupCA01A, mscAlarmType=mscAlarmType, mscNotificationID=mscNotificationID, mscFileLineNumber=mscFileLineNumber, mscClearedAlarm=mscClearedAlarm, alarmGroupCA01=alarmGroupCA01, mscFileVersion=mscFileVersion, mscOperatorData=mscOperatorData, mscMajorAlarm=mscMajorAlarm, alarmGroupCA=alarmGroupCA, mscSeverity=mscSeverity, mscComponentName=mscComponentName, mscIndeterminateAlarm=mscIndeterminateAlarm, mscFileName=mscFileName, mscInternalData=mscInternalData, alarmMIB=alarmMIB, mscPid=mscPid, mscCriticalAlarm=mscCriticalAlarm, mscCid=mscCid, mscEventTime=mscEventTime)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint') (date_and_time, display_string, unsigned32, row_pointer) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB', 'DateAndTime', 'DisplayString', 'Unsigned32', 'RowPointer') (hex_string, hex, digit_string, ascii_string) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-TextualConventionsMIB', 'HexString', 'Hex', 'DigitString', 'AsciiString') (msc_passport_mi_bs, msc_passport_traps) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB', 'mscPassportMIBs', 'mscPassportTraps') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, ip_address, time_ticks, mib_identifier, counter32, notification_type, unsigned32, gauge32, counter64, iso, integer32, module_identity, bits, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'IpAddress', 'TimeTicks', 'MibIdentifier', 'Counter32', 'NotificationType', 'Unsigned32', 'Gauge32', 'Counter64', 'iso', 'Integer32', 'ModuleIdentity', 'Bits', 'NotificationType') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') alarm_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4)) msc_alarm_trap = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2)) msc_mandatory_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7)) msc_component_row_pointer = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 1), row_pointer()) if mibBuilder.loadTexts: mscComponentRowPointer.setStatus('mandatory') msc_component_name = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 2), display_string()) if mibBuilder.loadTexts: mscComponentName.setStatus('mandatory') msc_event_time = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 3), date_and_time()) if mibBuilder.loadTexts: mscEventTime.setStatus('mandatory') msc_active_list_status = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('message', 0), ('set', 1), ('clear', 2)))) if mibBuilder.loadTexts: mscActiveListStatus.setStatus('mandatory') msc_severity = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5))).clone(namedValues=named_values(('indeterminate', 0), ('critical', 1), ('major', 2), ('minor', 3), ('warning', 4), ('cleared', 5)))) if mibBuilder.loadTexts: mscSeverity.setStatus('mandatory') msc_alarm_type = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('communications', 0), ('qualityOfService', 1), ('processing', 2), ('equipment', 3), ('environmental', 4), ('security', 5), ('operator', 6), ('debug', 7), ('unknown', 8)))) if mibBuilder.loadTexts: mscAlarmType.setStatus('mandatory') msc_probable_cause = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25, 26, 27, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 90, 91, 92, 93, 100, 101, 102, 110, 111, 112, 113, 114, 120, 121, 122, 200, 201, 202, 203, 204))).clone(namedValues=named_values(('lossOfSignal', 0), ('lossOfFrame', 1), ('framingError', 2), ('localTransmissionError', 3), ('remoteTransmissionError', 4), ('callEstablishmentError', 5), ('degradedSignal', 6), ('commSubsystemFailure', 7), ('commProtocolError', 8), ('lanError', 9), ('dteDceInterfaceError', 10), ('responseTimeExcessive', 20), ('queueSizeExceeded', 21), ('bandwidthReduced', 22), ('retransmissionRateReduced', 23), ('thresholdCrossed', 24), ('performanceDegraded', 25), ('congestion', 26), ('atOrNearCapacity', 27), ('storageCapacityProblem', 40), ('versionMismatch', 41), ('corruptData', 42), ('cpuCyclesLimitExceeded', 43), ('softwareError', 44), ('softwareProgramError', 45), ('softwareProgramTermination', 46), ('fileError', 47), ('outOfMemory', 48), ('underlyingResourceUnavail', 49), ('applicationSubsystemFailure', 50), ('configurationError', 51), ('powerProblem', 60), ('timingProblem', 61), ('processorProblem', 62), ('datasetModemError', 63), ('multiplexorProblem', 64), ('receiverFailure', 65), ('transmitterFailure', 66), ('outputDeviceError', 67), ('inputDeviceError', 68), ('ioDeviceError', 69), ('equipmentFailure', 70), ('adapterError', 71), ('duplicateInfo', 80), ('infoMissing', 81), ('infoModification', 82), ('infoOutOfSequence', 83), ('unexpectedInfo', 84), ('denialOfService', 90), ('outOfService', 91), ('proceduralError', 92), ('otherOperational', 93), ('cableTamper', 100), ('intrusionDetection', 101), ('otherPhysical', 102), ('authenticationFailure', 110), ('breachOfConfidence', 111), ('nonRepudiationFailure', 112), ('unauthorizedAccess', 113), ('otherSecurityService', 114), ('delayedInfo', 120), ('keyExpired', 121), ('outOfHoursActivity', 122), ('operationalCondition', 200), ('debugging', 201), ('unknown', 202), ('inactiveVirtualCircuit', 203), ('networkServerIntervention', 204)))) if mibBuilder.loadTexts: mscProbableCause.setStatus('mandatory') msc_ntp_index = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 8), digit_string().subtype(subtypeSpec=value_size_constraint(8, 8)).setFixedLength(8)) if mibBuilder.loadTexts: mscNtpIndex.setStatus('mandatory') msc_comment_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 9), ascii_string().subtype(subtypeSpec=value_size_constraint(0, 750))) if mibBuilder.loadTexts: mscCommentData.setStatus('mandatory') msc_optional_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8)) msc_notification_id = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 1), hex()) if mibBuilder.loadTexts: mscNotificationID.setStatus('mandatory') msc_lp_for_hier_clear = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 2), row_pointer()) if mibBuilder.loadTexts: mscLpForHierClear.setStatus('mandatory') msc_operator_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 3), hex_string().subtype(subtypeSpec=value_size_constraint(0, 750))) if mibBuilder.loadTexts: mscOperatorData.setStatus('mandatory') msc_pid = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 25))) if mibBuilder.loadTexts: mscPid.setStatus('mandatory') msc_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 5), display_string()) if mibBuilder.loadTexts: mscFileName.setStatus('mandatory') msc_file_line_number = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 6), unsigned32()) if mibBuilder.loadTexts: mscFileLineNumber.setStatus('mandatory') msc_file_version = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 7), display_string()) if mibBuilder.loadTexts: mscFileVersion.setStatus('mandatory') msc_internal_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 8), hex_string().subtype(subtypeSpec=value_size_constraint(0, 750))) if mibBuilder.loadTexts: mscInternalData.setStatus('mandatory') msc_provisional_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9)) msc_cid = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9, 1), unsigned32()) if mibBuilder.loadTexts: mscCid.setStatus('mandatory') msc_critical_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 1)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) msc_major_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 2)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) msc_minor_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 3)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) msc_warning_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 4)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) msc_cleared_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 5)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) msc_indeterminate_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 6)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData')) alarm_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1)) alarm_group_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1)) alarm_group_ca01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2)) alarm_group_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2, 2)) alarm_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2)) alarm_notifications_group_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2, 1)) alarm_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3)) alarm_capabilities_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1)) alarm_capabilities_ca01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2)) alarm_capabilities_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2, 2)) mibBuilder.exportSymbols('Nortel-MsCarrier-MscPassport-AlarmMIB', mscCommentData=mscCommentData, alarmCapabilitiesCA01=alarmCapabilitiesCA01, alarmCapabilitiesCA01A=alarmCapabilitiesCA01A, alarmCapabilities=alarmCapabilities, mscOptionalAlarmInfo=mscOptionalAlarmInfo, alarmNotificationsGroupCA01A=alarmNotificationsGroupCA01A, mscProvisionalAlarmInfo=mscProvisionalAlarmInfo, mscWarningAlarm=mscWarningAlarm, mscAlarmTrap=mscAlarmTrap, alarmCapabilitiesCA=alarmCapabilitiesCA, mscMandatoryAlarmInfo=mscMandatoryAlarmInfo, mscComponentRowPointer=mscComponentRowPointer, mscNtpIndex=mscNtpIndex, alarmGroup=alarmGroup, alarmNotifications=alarmNotifications, mscProbableCause=mscProbableCause, mscMinorAlarm=mscMinorAlarm, mscActiveListStatus=mscActiveListStatus, mscLpForHierClear=mscLpForHierClear, alarmGroupCA01A=alarmGroupCA01A, mscAlarmType=mscAlarmType, mscNotificationID=mscNotificationID, mscFileLineNumber=mscFileLineNumber, mscClearedAlarm=mscClearedAlarm, alarmGroupCA01=alarmGroupCA01, mscFileVersion=mscFileVersion, mscOperatorData=mscOperatorData, mscMajorAlarm=mscMajorAlarm, alarmGroupCA=alarmGroupCA, mscSeverity=mscSeverity, mscComponentName=mscComponentName, mscIndeterminateAlarm=mscIndeterminateAlarm, mscFileName=mscFileName, mscInternalData=mscInternalData, alarmMIB=alarmMIB, mscPid=mscPid, mscCriticalAlarm=mscCriticalAlarm, mscCid=mscCid, mscEventTime=mscEventTime)
def insertion_sort(a): for i in range (1,len(a)): c=a[i] k=i-1 while (k>=0) and (c<=a[k]) : a[k+1] = a[k] k=k-1 a[k+1] = c n=int(input("Enter No. Of Elements in List :-s ")) a=[i for i in range (n)] print ("Enter the Elements one after the other :- ") for i in range (n): a[i]=int(input()) insertion_sort(a) print(a)
def insertion_sort(a): for i in range(1, len(a)): c = a[i] k = i - 1 while k >= 0 and c <= a[k]: a[k + 1] = a[k] k = k - 1 a[k + 1] = c n = int(input('Enter No. Of Elements in List :-s ')) a = [i for i in range(n)] print('Enter the Elements one after the other :- ') for i in range(n): a[i] = int(input()) insertion_sort(a) print(a)
""" assign a database version to the getpaid installation for future upgrades. """ def evolve( portal ): # the upgrade framework will take care of upgrading for us pass
""" assign a database version to the getpaid installation for future upgrades. """ def evolve(portal): pass
class GraphAlgos: """ Wrapper class which handle the graph algorithms more efficiently, by abstracting repeating code. """ database = None # Static variable shared across objects. def __init__(self, database, start, relationship, end = None, orientation = 'NATURAL', rel_weight = None): # Initialize the static variable and class member. if GraphAlgos.database is None: GraphAlgos.database = database # Initialize the optional parameter. end = end if end is not None else start # Construct the projection of the anonymous graph. self.graph_projection = ( f'{{nodeProjection: ["{start}", "{end}"], ' 'relationshipProjection: {' f'{relationship}: {{' f'type: "{relationship}", ' f'orientation: "{orientation}"' ) # If the relationship weight property exists, then set it. if rel_weight is not None: self.graph_projection += f', properties: "{rel_weight}"' # Add two right brackets to complete the query. self.graph_projection += '}}' def pagerank(self, write_property, max_iterations = 20, damping_factor = 0.85): setup = (f'{self.graph_projection}, ' f'writeProperty: "{write_property}", ' f'maxIterations: {max_iterations}, ' f'dampingFactor: {damping_factor}}}' ) GraphAlgos.database.execute(f'CALL gds.pageRank.write({setup})', 'w') def nodeSimilarity(self, write_property, write_relationship, cutoff = 0.5, top_k = 10): setup = (f'{self.graph_projection}, ' f'writeProperty: "{write_property}", ' f'writeRelationshipType: "{write_relationship}", ' f'similarityCutoff: {cutoff}, ' f'topK: {top_k}}}' ) GraphAlgos.database.execute(f'CALL gds.nodeSimilarity.write({setup})', 'w') def louvain(self, write_property, max_levels = 10, max_iterations = 10): setup = (f'{self.graph_projection}, ' f'writeProperty: "{write_property}", ' f'maxLevels: {max_levels}, ' f'maxIterations: {max_iterations}}}' ) GraphAlgos.database.execute(f'CALL gds.louvain.write({setup})', 'w') # These methods enable the use of this class in a with statement. def __enter__(self): return self # Automatic cleanup of the created graph of this class. def __exit__(self, exc_type, exc_value, tb): if exc_type is not None: traceback.print_exception(exc_type, exc_value, tb)
class Graphalgos: """ Wrapper class which handle the graph algorithms more efficiently, by abstracting repeating code. """ database = None def __init__(self, database, start, relationship, end=None, orientation='NATURAL', rel_weight=None): if GraphAlgos.database is None: GraphAlgos.database = database end = end if end is not None else start self.graph_projection = f'{{nodeProjection: ["{start}", "{end}"], relationshipProjection: {{{relationship}: {{type: "{relationship}", orientation: "{orientation}"' if rel_weight is not None: self.graph_projection += f', properties: "{rel_weight}"' self.graph_projection += '}}' def pagerank(self, write_property, max_iterations=20, damping_factor=0.85): setup = f'{self.graph_projection}, writeProperty: "{write_property}", maxIterations: {max_iterations}, dampingFactor: {damping_factor}}}' GraphAlgos.database.execute(f'CALL gds.pageRank.write({setup})', 'w') def node_similarity(self, write_property, write_relationship, cutoff=0.5, top_k=10): setup = f'{self.graph_projection}, writeProperty: "{write_property}", writeRelationshipType: "{write_relationship}", similarityCutoff: {cutoff}, topK: {top_k}}}' GraphAlgos.database.execute(f'CALL gds.nodeSimilarity.write({setup})', 'w') def louvain(self, write_property, max_levels=10, max_iterations=10): setup = f'{self.graph_projection}, writeProperty: "{write_property}", maxLevels: {max_levels}, maxIterations: {max_iterations}}}' GraphAlgos.database.execute(f'CALL gds.louvain.write({setup})', 'w') def __enter__(self): return self def __exit__(self, exc_type, exc_value, tb): if exc_type is not None: traceback.print_exception(exc_type, exc_value, tb)
total = int(input()) b_num = 0 b_x = 0 b_y = 0 for i in range(total): num, x, y = map(int, input().split()) mn = num - b_num mx = abs(x - b_x) my = abs(y - b_y) if mn < mx + my: print("No") exit() else: if b_num % 2 == (mx + my) % 2: mn = num b_x = x b_y = y else: # print("{} {} {}".format(b_num, mx, my)) print("No") exit() print("Yes")
total = int(input()) b_num = 0 b_x = 0 b_y = 0 for i in range(total): (num, x, y) = map(int, input().split()) mn = num - b_num mx = abs(x - b_x) my = abs(y - b_y) if mn < mx + my: print('No') exit() elif b_num % 2 == (mx + my) % 2: mn = num b_x = x b_y = y else: print('No') exit() print('Yes')
# uninhm # https://atcoder.jp/contests/abc164/tasks/abc164_c # dictionary a = {} ans = 0 n = int(input()) for _ in range(n): i = input() ans += a.get(i, 1) a[i] = 0 print(ans)
a = {} ans = 0 n = int(input()) for _ in range(n): i = input() ans += a.get(i, 1) a[i] = 0 print(ans)
class UnionFind: def __init__(self, size): self.parent = list(range(size)) self.component = [[i] for i in range(size)] def root(self, i): if self.parent[i] != i: self.parent[i] = self.root(self.parent[i]) return self.parent[i] def unite(self, i, j): i, j = self.root(i), self.root(j) if len(self.component[i]) < len(self.component[j]): i, j = j, i self.parent[j] = i self.component[i] += self.component[j]
class Unionfind: def __init__(self, size): self.parent = list(range(size)) self.component = [[i] for i in range(size)] def root(self, i): if self.parent[i] != i: self.parent[i] = self.root(self.parent[i]) return self.parent[i] def unite(self, i, j): (i, j) = (self.root(i), self.root(j)) if len(self.component[i]) < len(self.component[j]): (i, j) = (j, i) self.parent[j] = i self.component[i] += self.component[j]
class Print: """ A simple text-printing component """ def doPrint(self, v): print(v) @staticmethod def cfgr(builder): ## outputs builder.addInput('on').string_to_method(lambda obj: obj.doPrint)
class Print: """ A simple text-printing component """ def do_print(self, v): print(v) @staticmethod def cfgr(builder): builder.addInput('on').string_to_method(lambda obj: obj.doPrint)
#!/usr/bin/env python # -*- coding: utf-8 -*- class TClassStatic(object): obj_num = 0 def __init__(self, data): self.data = data TClassStatic.obj_num += 1 def printself(self): print("self.data: ", self.data) @staticmethod def smethod(): print("the number of obj is : ", TClassStatic.obj_num) @classmethod def cmethod(cls): print("cmethod : ", cls.obj_num) print(';first') cls.smethod() print('last') def main(): objA = TClassStatic(10) objB = TClassStatic(12) objA.printself() objB.printself() objA.smethod() objB.cmethod() print("------------------------------") TClassStatic.smethod() TClassStatic.cmethod() if __name__ == "__main__": main()
class Tclassstatic(object): obj_num = 0 def __init__(self, data): self.data = data TClassStatic.obj_num += 1 def printself(self): print('self.data: ', self.data) @staticmethod def smethod(): print('the number of obj is : ', TClassStatic.obj_num) @classmethod def cmethod(cls): print('cmethod : ', cls.obj_num) print(';first') cls.smethod() print('last') def main(): obj_a = t_class_static(10) obj_b = t_class_static(12) objA.printself() objB.printself() objA.smethod() objB.cmethod() print('------------------------------') TClassStatic.smethod() TClassStatic.cmethod() if __name__ == '__main__': main()
# This code is connected with '18 - Modules.py' def kgs_to_lbs(weight): return 2.20462 * weight def lbs_t_kgs(weight): return 0.453592 * weight
def kgs_to_lbs(weight): return 2.20462 * weight def lbs_t_kgs(weight): return 0.453592 * weight
"""December 1st""" def sevenish_number(num): """Sevenish Number""" power_of_two = 0 sevenish = 0 while num > 0: val = pow(7, power_of_two) if num % 2 == 1 else 0 sevenish += val power_of_two += 1 num //= 2 return sevenish
"""December 1st""" def sevenish_number(num): """Sevenish Number""" power_of_two = 0 sevenish = 0 while num > 0: val = pow(7, power_of_two) if num % 2 == 1 else 0 sevenish += val power_of_two += 1 num //= 2 return sevenish
""" ------------------------------------------------------------------------------ @file variable.py @author Milos Milicevic (milosh.mkv@gmail.com) @brief ... @version 0.1 @date 2020-08-26 @copyright Copyright (c) 2020 Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. ------------------------------------------------------------------------------ """ class Variable(object): def __init__(self): """ Constructs variable object. """ self.name = None # Variable name (identifier) self.type = None # Variable type (int, char, boolean, anyClassName) self.kind = None # Variable kind (field, static, local, argument) self.id = None # Variable id (id of certain kind) def __str__(self): """ Returns string representaion of object. """ return "Name => {0}; Type => {1}; Kind => {2}; Id => {3};".format(self.name, self.type, self.kind, self.id)
""" ------------------------------------------------------------------------------ @file variable.py @author Milos Milicevic (milosh.mkv@gmail.com) @brief ... @version 0.1 @date 2020-08-26 @copyright Copyright (c) 2020 Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. ------------------------------------------------------------------------------ """ class Variable(object): def __init__(self): """ Constructs variable object. """ self.name = None self.type = None self.kind = None self.id = None def __str__(self): """ Returns string representaion of object. """ return 'Name => {0}; Type => {1}; Kind => {2}; Id => {3};'.format(self.name, self.type, self.kind, self.id)
n=int(input()) arr=[] game=True for i in range(n): arr.append((input())) for j in range(n): if "OO" in arr[j]: print("YES") ind=arr[j].index("OO") if ind==0 and arr[j][ind+1]=="O": arr[j]="++|"+arr[j][3]+arr[j][4] if ind==3 and arr[j][ind+1]=="O": arr[j]=arr[j][0]+arr[j][1]+"|"+"++" game=False break if game==True: print('NO') else: for k in range(n): print(arr[k])
n = int(input()) arr = [] game = True for i in range(n): arr.append(input()) for j in range(n): if 'OO' in arr[j]: print('YES') ind = arr[j].index('OO') if ind == 0 and arr[j][ind + 1] == 'O': arr[j] = '++|' + arr[j][3] + arr[j][4] if ind == 3 and arr[j][ind + 1] == 'O': arr[j] = arr[j][0] + arr[j][1] + '|' + '++' game = False break if game == True: print('NO') else: for k in range(n): print(arr[k])
# -*- coding: utf-8 -*- """ Created on Sat May 29 03:30:25 2021 @author: Septhiono """ year=int(input("Which year would you like to check?")) if year%4==0: if year%100==0: if year%400==0: print(f"{year} is a leap year") else: print(f"{year} is not a leap year") else: print(f"{year} is a leap year") else: print(f"{year} is not a leap year")
""" Created on Sat May 29 03:30:25 2021 @author: Septhiono """ year = int(input('Which year would you like to check?')) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: print(f'{year} is a leap year') else: print(f'{year} is not a leap year') else: print(f'{year} is a leap year') else: print(f'{year} is not a leap year')
""" LeetCode Problem: 1095. Find in Mountain Array Link: https://leetcode.com/problems/find-in-mountain-array/ Language: Python Written by: Mostofa Adib Shakib """ class Solution: def findInMountainArray(self, target: int, mountain_arr: 'MountainArray') -> int: #binary search to find the peak mountain high = mountain_arr.length() -1 low = 0 while(low<high): mid = (low+high)//2 if mountain_arr.get(mid) > mountain_arr.get(mid+1): high = mid else: low = mid+1 peak = low #binary search to find target in the acsending part of the array low = 0 high = peak+1 while(low<high): mid = (low+high)//2 temp = mountain_arr.get(mid) if target==temp: return mid if temp>target: high = mid else: low = mid+1 #binary search to find target in the descending part of the array low = peak+1 high = mountain_arr.length() while(low<high): mid = (low+high)//2 temp = mountain_arr.get(mid) if target==temp: return mid if temp<target: high = mid else: low = mid+1 return -1 # returns -1 if target not found in the mountain array
""" LeetCode Problem: 1095. Find in Mountain Array Link: https://leetcode.com/problems/find-in-mountain-array/ Language: Python Written by: Mostofa Adib Shakib """ class Solution: def find_in_mountain_array(self, target: int, mountain_arr: 'MountainArray') -> int: high = mountain_arr.length() - 1 low = 0 while low < high: mid = (low + high) // 2 if mountain_arr.get(mid) > mountain_arr.get(mid + 1): high = mid else: low = mid + 1 peak = low low = 0 high = peak + 1 while low < high: mid = (low + high) // 2 temp = mountain_arr.get(mid) if target == temp: return mid if temp > target: high = mid else: low = mid + 1 low = peak + 1 high = mountain_arr.length() while low < high: mid = (low + high) // 2 temp = mountain_arr.get(mid) if target == temp: return mid if temp < target: high = mid else: low = mid + 1 return -1
"""Modules for user interfaces. Modules: ui -- Provide a base class for user interface facades. ui_cmd -- Provide a facade for a command line user interface. ui_tk -- Provide a facade for a Tkinter based GUI. ui_mb -- Provide a facade for a GUI featuring just message boxes. """
"""Modules for user interfaces. Modules: ui -- Provide a base class for user interface facades. ui_cmd -- Provide a facade for a command line user interface. ui_tk -- Provide a facade for a Tkinter based GUI. ui_mb -- Provide a facade for a GUI featuring just message boxes. """
class A: def spam(self): print('A.spam') class B(A): def spam(self): print('B.spam') super().spam() # Call parent spam() class C: def __init__(self): self.x = 0 class D(C): def __init__(self): super().__init__() self.y = 1 d = D() print(d.y) class Base: def __init__(self): print('Base.__init__') class A(Base): def __init__(self): Base.__init__(self) print('A.__init__')
class A: def spam(self): print('A.spam') class B(A): def spam(self): print('B.spam') super().spam() class C: def __init__(self): self.x = 0 class D(C): def __init__(self): super().__init__() self.y = 1 d = d() print(d.y) class Base: def __init__(self): print('Base.__init__') class A(Base): def __init__(self): Base.__init__(self) print('A.__init__')
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item'] print(foo[0], ' FIRST ITEM') print(foo[len(foo) - 1], ' LAST ITEM')
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item'] print(foo[0], ' FIRST ITEM') print(foo[len(foo) - 1], ' LAST ITEM')
# Copyright 2017 Citrix Systems # # 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 set_host_enabled(session, enabled): args = {"enabled": enabled} return session.call_plugin('xenhost.py', 'set_host_enabled', args) def get_host_uptime(session): return session.call_plugin('xenhost.py', 'host_uptime', {}) def get_host_data(session): return session.call_plugin('xenhost.py', 'host_data', {}) def get_pci_type(session, pci_device): return session.call_plugin_serialized('xenhost.py', 'get_pci_type', pci_device) def get_pci_device_details(session): return session.call_plugin_serialized('xenhost.py', 'get_pci_device_details')
def set_host_enabled(session, enabled): args = {'enabled': enabled} return session.call_plugin('xenhost.py', 'set_host_enabled', args) def get_host_uptime(session): return session.call_plugin('xenhost.py', 'host_uptime', {}) def get_host_data(session): return session.call_plugin('xenhost.py', 'host_data', {}) def get_pci_type(session, pci_device): return session.call_plugin_serialized('xenhost.py', 'get_pci_type', pci_device) def get_pci_device_details(session): return session.call_plugin_serialized('xenhost.py', 'get_pci_device_details')
""" get information of receptive field """ def get_receptive_field(neuron_index, layer_info, pad=(0, 0)): """ neuron_index: tuple of length 2 or int represented x axis and y layer_info: tuple of length 4 has information of receptive_field """ n, j, rf, start = layer_info if isinstance(neuron_index, tuple): center_y = start + (neuron_index[1]) * (j) center_x = start + (neuron_index[0]) * (j) else: center_y = start + (neuron_index // n) * (j) center_x = start + (neuron_index % n) * (j) return (center_x, center_y), (rf / 2, rf / 2)
""" get information of receptive field """ def get_receptive_field(neuron_index, layer_info, pad=(0, 0)): """ neuron_index: tuple of length 2 or int represented x axis and y layer_info: tuple of length 4 has information of receptive_field """ (n, j, rf, start) = layer_info if isinstance(neuron_index, tuple): center_y = start + neuron_index[1] * j center_x = start + neuron_index[0] * j else: center_y = start + neuron_index // n * j center_x = start + neuron_index % n * j return ((center_x, center_y), (rf / 2, rf / 2))
"""This module regroups all exceptions tied to pyqtcli cli.""" class QresourceError(Exception): """Exception raised with problems concerning qresource node in qrc files.""" def __init__(self, arg): super(QresourceError, self).__init__() self.msg = arg def __str__(self): return self.msg class PyqtcliConfigError(Exception): """Exception raised with problems concerning .pyqtclirc config file.""" def __init__(self, arg): super(PyqtcliConfigError, self).__init__() self.msg = arg def __str__(self): return self.msg class QRCFileError(Exception): """Exception raised with problems concerning qrc files.""" def __init__(self, arg): super(QRCFileError, self).__init__() self.msg = arg def __str__(self): return self.msg
"""This module regroups all exceptions tied to pyqtcli cli.""" class Qresourceerror(Exception): """Exception raised with problems concerning qresource node in qrc files.""" def __init__(self, arg): super(QresourceError, self).__init__() self.msg = arg def __str__(self): return self.msg class Pyqtcliconfigerror(Exception): """Exception raised with problems concerning .pyqtclirc config file.""" def __init__(self, arg): super(PyqtcliConfigError, self).__init__() self.msg = arg def __str__(self): return self.msg class Qrcfileerror(Exception): """Exception raised with problems concerning qrc files.""" def __init__(self, arg): super(QRCFileError, self).__init__() self.msg = arg def __str__(self): return self.msg