Example #1
0
def enter2LocalLacList(cursor, hs, db, lactable, anfadr, endadr):
    import Address
    b, bc, bv, bw, ec, ev, ew = Address.decodeAdr(anfadr, endadr)
    hsnr = Address.hs2hsnr(hs)
    cmd  = "insert into %s.%s " % (db, lactable)
    cmd += "(buch, kapanf, versanf, wortanf, kapend, versend, wortend, "
    cmd += "anfadr, endadr, hs, hsnr, anfalt, endalt) "
    cmd += "values (%d, %d, %d, %d, %d, %d, %d, " % (b, bc, bv, bw, ec, ev, ew)
    cmd += "%d, %d, '%s', %d, %d, %d) " % (anfadr, endadr, hs, hsnr, anfadr, endadr)
    cursor.execute(cmd)
Example #2
0
    def anonymize_order(self, order):
        assert isinstance(order, Order)
        self.anonymize_object(order)

        self.anonymize_object(order.shipping_address, save=False)
        self.anonymize_object(order.billing_address, save=False)

        # bypass Protected model save() invoking super directly
        Address.save(order.shipping_address)
        Address.save(order.billing_address)
Example #3
0
    def execAlarm():
        global alarmEvent
        alarmEvent = None
        print "ALARM ALARM"

        addr = Address(Config.get("AlarmClock", "exec"))
        print addr.__str__()
        print EventEngine.root.getByAddress(addr.__str__()).use()
        
        time.sleep(1)
        print AlarmClock.schedAlarm()
Example #4
0
def enter2LocalLacList(cursor, hs, db, lactable, anfadr, endadr):
    import Address
    b, bc, bv, bw, ec, ev, ew = Address.decodeAdr(anfadr, endadr)
    hsnr = Address.hs2hsnr(hs)
    cmd = "insert into %s.%s " % (db, lactable)
    cmd += "(buch, kapanf, versanf, wortanf, kapend, versend, wortend, "
    cmd += "anfadr, endadr, hs, hsnr, anfalt, endalt) "
    cmd += "values (%d, %d, %d, %d, %d, %d, %d, " % (b, bc, bv, bw, ec, ev, ew)
    cmd += "%d, %d, '%s', %d, %d, %d) " % (anfadr, endadr, hs, hsnr, anfadr,
                                           endadr)
    cursor.execute(cmd)
 def testDirectionSuffix(self):
     directionSuffix = Address("100 test street south", "", "", "")
     directionSuffix.normalize()
     self.assertEqual(directionSuffix.getStreet(), "100 TEST ST S")
     directionSuffix = Address("100 test street southWEST", "", "", "")
     directionSuffix.normalize()
     self.assertEqual(directionSuffix.getStreet(), "100 TEST ST SW")
Example #6
0
class Provider:
    address = Address()
    longCoord = 0.0
    latCoord = 0.0
    ru = 0.0                        #unique radius from provider
    fu = 0.0                        #unique fade [0-1] from provider
    rd = 0.0                        #default radius from resourceType
    regions = []                    #list of pointers to regions impacted by this provider
    population = []                 #list of population constraints
    _isMobile = False                #boolean identifying if the provider offers mobile service
    def _init_ (self):
        address = Address()
        longCoord = 0.0
        latCoord = 0.0
        ru = 0.0  # unique radius from provider
        fu = 0.0  # unique fade [0-1] from provider
        rd = 0.0  #default radius from resourceType
        regions = []                # list of regions impacted by this provider
        population = []             # list of population constraints

    def _init_(self, longCoord, latCoord, radius, fade, defaultRadius, multiplier, regions, population, isMobile, address):
        self.longCoord = longCoord
        self.latCoord = latCoord
        self.ru = radius
        self.rd = defaultRadius * multiplier         #the provider's default radius is the product of resourceType's radius and the resource's multiplier
        self.fu = fade
        self.regions = regions
        self.population = population
        self.address = address
        self.isMobile = isMobile
Example #7
0
 def mreq(self, string=''):
     print string
     try:
         requests = json.loads(string)
     except:
         requests = {"np":"error - error - error","coverart":"", "state":"playing"}
         print '[ERROR] Json could not be decoded... in services.py'
     print requests
     
     result = {}
     for key, request in requests.items():
         request = Address(request)
         try:
             result[key]=self.root().getByAddress(request.__str__()).use()
         except:
             result[key]='error'
     return json.dumps(result)
Example #8
0
 def getNestleText(self, book, bchap, bvers, bword, echap, evers, eword, additamenta=False):
     """
     If the address represents an additamentum and the parameter additamenta is false,
     the text will be skipped. It is printed only if this parameter is set to true.
     """
     result = ""
     fehlvers_active = False
     fehlvers_started = False
     if not additamenta and bword % 2 == 1 and eword % 2 == 1:
         return result
     chapter  = bchap
     verse    = bvers
     word     = bword
     maxverse = self.getMaxVerse(book, chapter)
     maxword  = self.getMaxWord(book, chapter, verse)
     if maxword == 0:
         return result
     if eword == maxword + 1: # Endlosschleife verhindern
         maxword += 1
     while True:
         address = Address.encodeSingleAdr(book, chapter, verse, word) # ->Address.py
         fehlvers_active = self.fehlverse.isFehlvers(address)
         cmd  = "select content from Apparat.Nestle where book = %d " % (book)
         cmd += "and chapter = %d and verse = %d and word = %d " % (chapter, verse, word)
         self.cursor.execute(cmd)
         row = self.cursor.fetchone()
         if row == None:
             pass 
         else:
             # Anfangsklammern setzen
             if fehlvers_active and not fehlvers_started:
                 result += "[["
                 fehlvers_started = True
             # Schlussklammern setzen
             if not fehlvers_active and fehlvers_started:
                 result += "]]"
                 fehlvers_started = False
             # Rueckgabestring schreiben
             result += row[0] + " "
         # Abbruchbedingung definieren
         if chapter == echap and verse == evers and word == eword:
             break
         # second condition in case of an error in Apparat.LookUpNT
         if chapter > echap:
             break
         word += 1
         if word > maxword:
             verse += 1
             if verse > maxverse:
                 chapter += 1
                 verse = 1
             word   = 2
             maxword = self.getMaxWord(book, chapter, verse)
             maxverse = self.getMaxVerse(book, chapter)
     result[:-1] # cut off last white space
     if fehlvers_started: # schliessende Doppelklammer falls geoeffnet
         result += "]]"
     return result
Example #9
0
 def _init_ (self):
     address = Address()
     longCoord = 0.0
     latCoord = 0.0
     ru = 0.0  # unique radius from provider
     fu = 0.0  # unique fade [0-1] from provider
     rd = 0.0  #default radius from resourceType
     regions = []                # list of regions impacted by this provider
     population = []             # list of population constraints
    def __init__(self, group_id, matrix_size):
        # Determine the sizes of all the matrices (these are the same) and
        # use it to assign addresses to each of them.
        matrices_size = Matrix.calculate_size(4, matrix_size, matrix_size)
        address_A, address_B, address_C = Address.assign_object_sizes(group_id, [matrices_size, matrices_size, matrices_size])

        # Construct actual matrices on assigned addresses.
        self.matrix_A = Matrix(address_A, 4, matrix_size, matrix_size)
        self.matrix_B = Matrix(address_B, 4, matrix_size, matrix_size)
        self.matrix_C = Matrix(address_C, 4, matrix_size, matrix_size)
Example #11
0
    def get_double(self, address: Address):
        retrieved_set = self.cache_sets[address.get_index()]
        this_tag = address.get_tag()

        # Check if block exists
        if self.policy != "LRU":
            for i in range(0, retrieved_set.n_way):
                # possible error in None value, so make sure that's not the case
                if retrieved_set.tags[
                        i] == this_tag and retrieved_set.data_blocks[
                            i] is not None:
                    self.cpu.read_hits += 1
                    return retrieved_set.data_blocks[i].get_value(
                        address.get_offset())
            # Get block from RAM
            self.cpu.read_misses += 1
            ram_block = self.cpu.ram.get_block(address)
            self.set_block_with_replacement(address, ram_block)
            return ram_block.get_value(address.get_offset())

        else:  # LRU
            if this_tag in retrieved_set.tag_dictionary:
                this_node = retrieved_set.tag_dictionary[this_tag]
                self.cpu.read_hits += 1
                # swap to front of the list
                removed_node = retrieved_set.data_blocks.remove(this_node)
                retrieved_set.data_blocks.appendright(removed_node)
                touched_block = removed_node[0]
                # update in the tag dictionary
                location = len(retrieved_set.data_blocks) - 1
                retrieved_set.tag_dictionary[address.get_tag(
                )] = retrieved_set.data_blocks.nodeat(location)
                return touched_block.get_value(
                    address.get_offset())  # returns a block
            else:
                # Get block from RAM
                self.cpu.read_misses += 1
                ram_block = self.cpu.ram.get_block(address)
                if retrieved_set.capacity > 0:

                    retrieved_set.capacity -= 1
                    tag = address.get_tag()
                    retrieved_set.data_blocks.appendright(
                        dllistnode([ram_block, tag]))

                    location = len(retrieved_set.data_blocks
                                   ) - 1  # new location of the node
                    retrieved_set.tag_dictionary[
                        tag] = retrieved_set.data_blocks.nodeat(location)
                else:
                    self.set_block_with_replacement(address, ram_block)
                return ram_block.get_value(address.get_offset())
    def __init__(self, group_id, matrix_size):
        # Determine the sizes of all the matrices (these are the same) and
        # use it to assign addresses to each of them.
        matrices_size = Matrix.calculate_size(4, matrix_size, matrix_size)
        address_A, address_B, address_C = Address.assign_object_sizes(
            group_id, [matrices_size, matrices_size, matrices_size])

        # Construct actual matrices on assigned addresses.
        self.matrix_A = Matrix(address_A, 4, matrix_size, matrix_size)
        self.matrix_B = Matrix(address_B, 4, matrix_size, matrix_size)
        self.matrix_C = Matrix(address_C, 4, matrix_size, matrix_size)
class Person:
    name = "No name"
    address = None
    age = 0

    def __init__(self, name, address_city, address_street, address_number,
                 age):
        self.name = name
        self.address = Address(address_city, address_street, address_number)
        self.age = age

    def print(self):
        print(self.name + " ", end="")
        self.address.print()
        print(" " + str(self.age))

    def get_address(self):
        return self.address.city + " " + self.address.street + " " + str(
            self.address.number)

    def birthday(self):
        self.age += 1
        print("Happy Birthday " + self.name + "!")
Example #14
0
    def __init__(self, word, address):
        self.adresses = []
        self.word = word
        try:
            self.blockId = address.getAddress() // word
            self.firstAddress = self.blockId * word
            self.lastAddress = self.firstAddress + word
            for i in range(self.firstAddress, self.lastAddress):
                if i == address.getAddress():
                    self.adresses.append(address)
                else:
                    self.adresses.append(Address(i))

        except TypeError:
            self.blockId = None
            self.firstAddress = None
            self.lastAddress = None
Example #15
0
	def printTable():
		cmd  = "select anfadr, endadr, labez, labezsuf, reading1 "
		cmd += "from `ECM_Acts`.`TempTable` order by anfadr asc, endadr desc, labez asc; "
		cursor.execute(cmd)
		rows = cursor.fetchall()
		for r in rows:
			anf = r[0]
			end = r[1]
			lab = r[2]
			las = r[3]
			rd1 = r[4]
			b, bc, bv, bw, ec, ev, ew = Address.decodeAdr(anf, end)
			sb = getBookName(b)
			s = db_access3.formatAdr(sb, bc, bv, bw, ec, ev, ew)
			s1 = s2 = ""
			if rd1 != None:
				s1 = "\n\t>" + rd1.decode('utf8') + "< "
			print "%s%s%s%s " % (s, lab, las, s1)
Example #16
0
 def printTable():
     cmd = "select anfadr, endadr, labez, labezsuf, reading1 "
     cmd += "from `ECM_Acts`.`TempTable` order by anfadr asc, endadr desc, labez asc; "
     cursor.execute(cmd)
     rows = cursor.fetchall()
     for r in rows:
         anf = r[0]
         end = r[1]
         lab = r[2]
         las = r[3]
         rd1 = r[4]
         b, bc, bv, bw, ec, ev, ew = Address.decodeAdr(anf, end)
         sb = getBookName(b)
         s = db_access3.formatAdr(sb, bc, bv, bw, ec, ev, ew)
         s1 = s2 = ""
         if rd1 != None:
             s1 = "\n\t>" + rd1.decode('utf8') + "< "
         print "%s%s%s%s " % (s, lab, las, s1)
def main(args):

    try:
        if args[1] == "-h" or args[1]=="--help":
            print("Use: ' python3 Creator.py path_to_pcap_file path_to_save_mud_file [ip_addr] ' ")
            return
        c = pyshark.FileCapture(args[1],display_filter='tcp || udp',keep_packets=False)
        save_path = args[2]
    except FileNotFoundError:
        print("Incorrect/invalid path for pcap file.")
        return
    except:
        print("Use: ' python3 Creator.py path_to_pcap_file path_to_save_mud_file [ip_addr] ' ")
        return

    date_and_time = datetime.now()

    resolver = dns.resolver.Resolver()
    hostname = socket.gethostname()

    if args.__len__()==4:
        IP = args[3]
        hostname = args[3]
    else:
        IP = socket.gethostbyname(hostname)

    mud_path = save_path+"/"+hostname+"("+date_and_time.__str__()+")MUD.json"
    try:
        mud_file = open(mud_path,'x')
    except:
        print("Incorrect/invalid path for MUD file.")
        return

    received = AddressTree()
    sent = AddressTree()

    for p in c:
        if p.ip.src == IP:
            new_addr=Address(p.ip.dst,p[p.transport_layer].dstport,p.transport_layer)
            sent.add(new_addr)
        elif p.ip.dst == IP:
            new_addr=Address(p.ip.src,p[p.transport_layer].dstport,p.transport_layer)
            received.add(new_addr)


    remote_to_local_addresslist = received.getAddresses()
    local_to_remote_addresslist = sent.getAddresses()

    resolved_rtl = []
    unresolved_rtl = []

    resolved_ltr = []
    unresolved_ltr = []

    for add in local_to_remote_addresslist:
        try:
            ans = (resolver.query(add[0] + ".in-addr.arpa", "PTR"))
            for r in ans:
               resolved_ltr.append((r.__str__(),add[1],add[2]))
        except:
            unresolved_ltr.append((add[0],add[1],add[2]))


    for add in remote_to_local_addresslist:
        try:
            ans = (resolver.query(add[0] + ".in-addr.arpa", "PTR"))
            for r in ans:
               resolved_rtl.append((r.__str__(),add[1],add[2]))
        except:
            unresolved_rtl.append((add[0],add[1],add[2]))

    from_name = "from-ipv4-"+hostname
    to_name = "to-ipv4-"+hostname

    lista1 = createACL("from-ipv4-"+hostname,"ipv4-acl-type",resolved_ltr,unresolved_ltr,0)
    lista2 = createACL("to-ipv4-" + hostname, "ipv4-acl-type", resolved_rtl, unresolved_rtl,1)

    mud = {
        "ietf-mud:mud": {
            "mud-version" : 1,
            "mud-url": mud_path,
            "last-update": date_and_time.__str__(),
            "cache-validity" : 100,
            "is-supported" : "true",
            "systeminfo": hostname,
            "from-device-policy": {
                "access-lists": {
                    "access-list": [{
                        "name": from_name
                    }]
                }
            },
            "to-device-policy": {
                "access-lists": {
                    "access-list": [{
                        "name": to_name
                    }]
                }
            }
        },
        "ietf-access-control-list:access-lists": {
            "acl": [
                lista1,
                lista2
            ]
        }
    }

    json.dump(mud,mud_file,indent=1)
Example #18
0
    # encode 4 chars as "0.########" and 3 chars as "0.######" and so on.
    amount = "0." + "".join(asciiArr)
    # 0.34353637
    return float(amount)


if __name__ == "__main__":
    load_dotenv()
    if len(sys.argv) > 1:
        htmlFile = sys.argv[1]
    else:
        htmlFile = "index.html"

    signingPrivKey = os.getenv("signingPrivKey")
    sendingAddress = os.getenv("sendingAddress")
    recievingInfo = Address.generateKeysAndAddress()
    htmlArr = chopHtmlIntoChunksOfFourChars(readWebpage(htmlFile))
    encodedHtml = [encodeCharsAsAmount(chunk) for chunk in htmlArr]
    alreadyUsedInputs = []

    # For every four characters we get the unspent SMLY from the api
    # and calculate the wait time based on the number of utxos recieved.
    # Then we proceed  going through the sorted list of utxos checking if
    # we have one that is greater then the encoded amount. Lastly we 
    # calculate the fee and change and then create, sign and send the
    # transaction.
    for j, chunk in enumerate(encodedHtml):
        utxos = Api.getUtxo(sendingAddress)
        utxos = sorted(utxos, key=lambda utxo: utxo["amount"])
        print(f"utxo #: {len(utxos)}")
        waitTime = 60/len(utxos)
Example #19
0
    def set_double(self, address: Address, value):
        retrieved_set = self.cache_sets[address.get_index()]
        none_position = -1
        if_block_exists = False

        if self.policy == "LRU":

            if address.get_tag() in retrieved_set.tag_dictionary:
                self.cpu.write_hits += 1
                this_tag = address.get_tag()
                # swap to front of the list
                for node in retrieved_set.data_blocks:
                    if retrieved_set.tag_dictionary[this_tag] == node:
                        node.set_value(address.get_offset(), value)

                # removed_node = retrieved_set.data_blocks.remove(retrieved_set.tag_dictionary[this_tag])
                # retrieved_set.data_blocks.appendright(removed_node)
                # touched_block = removed_node[0]
                # # update in the tag dictionary
                # location = len(retrieved_set.data_blocks) - 1
                # retrieved_set.tag_dictionary[address.get_tag()] = retrieved_set.data_blocks.nodeat(location)
                # return

            else:
                # Get block from RAM
                self.cpu.write_misses += 1
                ram_block = self.cpu.ram.get_block(address)

                # None position = capacity, still filling the set ---- Compulsory
                if retrieved_set.capacity > 0:

                    retrieved_set.capacity -= 1
                    tag = address.get_tag()
                    retrieved_set.data_blocks.appendright(
                        dllistnode([ram_block, tag]))

                    location = len(retrieved_set.data_blocks
                                   ) - 1  # new location of the node
                    retrieved_set.tag_dictionary[
                        tag] = retrieved_set.data_blocks.nodeat(location)

                else:
                    self.set_block_with_replacement(address, ram_block)
        else:  # Random and FIFO Policies

            # Search for None Blocks in the set :
            none_position = retrieved_set.search_for_none(address)

            for i in range(0, retrieved_set.n_way):
                this_tag = address.get_tag()
                if retrieved_set.tags[i] == this_tag:
                    if retrieved_set.data_blocks[i].get_value(
                            address.get_offset()) == value:
                        self.cpu.write_hits += 1
                        if_block_exists = True
                        return
                    # else:
                    # retrieved_set.data_blocks[i].set_value(address.get_offset(), value)

            if if_block_exists is False:
                # Get block from RAM
                self.cpu.write_misses += 1

                ram_block = self.cpu.ram.get_block(address)

                if none_position < 0:  # If there doesnt exist a none block
                    # Cache full, need to use replacement policy
                    self.set_block_with_replacement(address, ram_block)
                else:
                    if self.policy != "LRU":  # not needed, but just to be sure
                        # Need to set block into None position
                        retrieved_set.tags[none_position] = address.get_tag()
                        retrieved_set.data_blocks[none_position] = ram_block
Example #20
0
def formatOutput(output):
    # scriptPubKey = OP_DUP OP_HASH160 hash_len pubkey_hash OP_EQUALVERIFY OP_CHECKSIG
    scriptPubKey = "76a914" + Address.getPubKeyHash(output["address"]) + "88ac"
    scriptLength = "{:02x}".format(len(bytes.fromhex(scriptPubKey)))
    return calculateSatoshis(output["amount"]) + scriptLength + scriptPubKey
Example #21
0
 def __init__(self, fname, lname, street, zip, city, state, contact_number):
     self._name = name.Name(fname, lname)
     self._address = addr.Address(street, zip, city, state)
     self._contact_number = contact_number
Example #22
0
 def set_block(self, address: Address, value):
     self.data[address.get_block_number()].set_value(
         address.get_offset(), value)
Example #23
0
 def __init__(self, id, first_name, last_name, numhouse, street, city):
     self.Id = id
     self.first_name = first_name
     self.last_name = last_name
     self.addres = Address.Addres(numhouse, street, city)
def generateUrl(addr: Address, apikey: str) -> str:
    return "https://api.geocod.io/v1.6/geocode?street=%s&city=%s&state=%s&api_key=%s" \
           % (addr.getStreet(), addr.city, addr.getState(), apikey)
Example #25
0
 def load_double(self, address):
     self.instruction_count += 1
     adr = Address(address, self.block_size, self.set_number)
     return self.cache.get_double(adr)
 def testDirectionStreet(self):
     directionStreet = Address("100 West Street", "Kirksville", "MO", "63501");  
     directionStreet.normalize()
     self.assertEqual(directionStreet.getStreet(), "100 WEST ST")
Example #27
0
 def store_double(self, address, value):
     self.instruction_count += 1
     adr = Address(address, self.block_size, self.set_number)
     self.ram.set_block(adr, value)
     self.cache.set_double(adr, value)
 def __init__(self, name, address_city, address_street, address_number,
              age):
     self.name = name
     self.address = Address(address_city, address_street, address_number)
     self.age = age
Example #29
0
 def getNestleText(self,
                   book,
                   bchap,
                   bvers,
                   bword,
                   echap,
                   evers,
                   eword,
                   additamenta=False):
     """
     If the address represents an additamentum and the parameter additamenta is false,
     the text will be skipped. It is printed only if this parameter is set to true.
     """
     result = ""
     fehlvers_active = False
     fehlvers_started = False
     if not additamenta and bword % 2 == 1 and eword % 2 == 1:
         return result
     chapter = bchap
     verse = bvers
     word = bword
     maxverse = self.getMaxVerse(book, chapter)
     maxword = self.getMaxWord(book, chapter, verse)
     if maxword == 0:
         return result
     if eword == maxword + 1:  # Endlosschleife verhindern
         maxword += 1
     while True:
         address = Address.encodeSingleAdr(book, chapter, verse,
                                           word)  # ->Address.py
         fehlvers_active = self.fehlverse.isFehlvers(address)
         cmd = "select content from Apparat.Nestle where book = %d " % (
             book)
         cmd += "and chapter = %d and verse = %d and word = %d " % (
             chapter, verse, word)
         self.cursor.execute(cmd)
         row = self.cursor.fetchone()
         if row == None:
             pass
         else:
             # Anfangsklammern setzen
             if fehlvers_active and not fehlvers_started:
                 result += "[["
                 fehlvers_started = True
             # Schlussklammern setzen
             if not fehlvers_active and fehlvers_started:
                 result += "]]"
                 fehlvers_started = False
             # Rueckgabestring schreiben
             result += row[0] + " "
         # Abbruchbedingung definieren
         if chapter == echap and verse == evers and word == eword:
             break
         # second condition in case of an error in Apparat.LookUpNT
         if chapter > echap:
             break
         word += 1
         if word > maxword:
             verse += 1
             if verse > maxverse:
                 chapter += 1
                 verse = 1
             word = 2
             maxword = self.getMaxWord(book, chapter, verse)
             maxverse = self.getMaxVerse(book, chapter)
     result[:-1]  # cut off last white space
     if fehlvers_started:  # schliessende Doppelklammer falls geoeffnet
         result += "]]"
     return result
Example #30
0
 def __init__(self, *_floor_plans):
     self.propertyId = 1
     self.propertyName = "Nashville Place"
     self.description = "Regions and We Work Building"
     self.floorPlans = _floor_plans
     self.address = Address()
 def testAbbrevFile(self):
     abbrev = Address("", "", "", "")
     abbreviations = abbrev.getAbbrevs("suffixAbbreviations.txt")
     self.assertEqual(abbreviations["ALLEY"], "ALY")
     self.assertEqual(abbreviations["WELLS"], "WLS")
def getAddress() -> Address:
    street = input("Street: ")
    city = input("City: ")
    state = input("State: ")
    zipcode = input("Zip: ")
    return Address(street, city, state, zipcode)
 def testStateAbbrevFile(self):
     abbrev = Address("", "", "", "")
     abbreviations = abbrev.getAbbrevs("stateAbbreviations.txt")
     self.assertEqual(abbreviations["MISSOURI"], "MO")
     self.assertEqual(abbreviations["FEDERATED STATES OF MICRONESIA"], "FM")
Example #34
0
    def __init__(self, word, address):
        self.adresses = []
        self.word = word
        try:
            self.blockId = address.getAddress() // word
            self.firstAddress = self.blockId * word
            self.lastAddress = self.firstAddress + word
            for i in range(self.firstAddress, self.lastAddress):
                if i == address.getAddress():
                    self.adresses.append(address)
                else:
                    self.adresses.append(Address(i))

        except TypeError:
            self.blockId = None
            self.firstAddress = None
            self.lastAddress = None

    def print(self):
        print("Bloco: " + str(self.blockId))
        for i in self.adresses:
            i.print()

    def __eq__(self, b):
        return self.blockId == b.blockId


if __name__ == '__main__':
    block = Block(4, Address(4, 20))
    block.print()
 def testNormalization(self):
     hillcrest_address = Address("303? North Hillcrest, Drive.", "Kirksville", "missouri", "63501")
     hillcrest_address.normalize()
     self.assertEqual(hillcrest_address.getStreet(), "303 N HILLCREST DR")
     self.assertEqual(hillcrest_address.getCity(), "KIRKSVILLE")
     self.assertEqual(hillcrest_address.getState(), "MO")
Example #36
0
 def get_block(self, address: Address):
     return self.data[address.get_block_number()]
Example #37
0
from Address import *
# from anbar import *

base0LAN = Address(host='192.168.5.17', user='******', database='Moozmar')
base0LANT = Address(host='192.168.5.17', user='******', database='Topoli')
Example #38
0
# -*- coding: utf-8 -*-
"""
@author: alezanper
"""
import Address

mAddress = Address.address(
    'calle 56 apartamento carrera 56 67 apartamento 345,,edificio la curuña,')

print(mAddress.getParts())
print(mAddress.getTokens())
print(mAddress.getUrbanBlock())
Example #39
0
	def convert_arg_to_object(index):
		stack_address = Address('[esp+%d]' % (index*4))
		memory = Memory(stack_address, 4)
		return memory			
Example #40
0
            [[1, "Fries(Large)", "Rs.60/-"], [2, "Fries(Small)", "Rs.40/-"]],
            headers=("Code", "Fries", "MRP"),
            tablefmt='orgtbl'))
    f_choice = int(input("Enter your selected Fries's code: "))
    f_qty = int(
        input("How many {}'s do you like to have".format(dict_f[f_choice][0])))
    f1 = f.Fries(dict_f[f_choice][0], dict_f[f_choice][1], f_qty)
    fries_list.append(f1)


print("WELCOME TO McDONALDS!!! I 'M LOVIN' IT!!")
cid = 14577
name_e = input("Enter your name:\n")
no_e = input("{}, Please enter your contact no:\n".format(name_e))
address_e = input("Enter your address:\n").split(',')
ad1 = a.Address(address_e[0], address_e[1], address_e[1])
eorc = input("Employee(E) or NOT(N):\n")

if eorc == "E" or eorc == "e":
    print("You're eligible for our special 20% employee discount.\n")
    eid = 262155
    e1 = e.Employee(cid, name_e, no_e, ad1, od1, eid, 20)
elif eorc == "C":
    c1 = c.Customer(cid, name_e, no_e, ad1, od1)
loop = True
while loop:
    att = int(
        input(
            "What would you like to have?\nPress 1 for Burgers.\nPress 2 for Drinks\nPress 3 for Fries.\n"
        ))
    if att == 1:
Example #41
0
 def add_address(self, town, zipcode, street, person_id, country):
     Address.Address().add_address(town, zipcode, street, person_id, country)