当前位置: 首页>>代码示例>>Python>>正文


Python address.Address类代码示例

本文整理汇总了Python中address.Address的典型用法代码示例。如果您正苦于以下问题:Python Address类的具体用法?Python Address怎么用?Python Address使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Address类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sender_verify_forward

	def sender_verify_forward(self, mailfrom, rcpttos, msg):
		""" Forwards mail to user of our service.
		The criteria for forwarding to user is that there is only 1
		recipient and the sender is a noreply for a supported email service;
		"""

		if len(rcpttos) != 1:
			return

		# Must be using our servername
		prcpt = Address(rcpttos[0])
		username = prcpt.parse_user_address()

		if not username:
			return

		# Must be a user of our service
		userdata = self.db.get_user(username=username)

		if userdata == False:
			return
		
		# Now we can forward 
		user = User(**userdata)

		logging.debug('Forwarding verification mail to service user at %s', \
			      user.get_forwarding_address())

		self.send(mailfrom, [user.get_forwarding_address()], msg)

		return
开发者ID:bengheng,项目名称:SEAL,代码行数:31,代码来源:service.py

示例2: test_address_generation

 def test_address_generation(self):
     test_key = 'a' * 32
     address = Address.new(test_key)
     self.assertEqual(address.privkey,
         "5JZB2s2RCtRUunKiqMbb6rAj3Z7TkJwa8zknL1cfTFpWoQArd6n")
     self.assertEqual(address.rawPrivkey(), test_key)
     self.assertTrue(Address.new())
开发者ID:hankhero,项目名称:ngcccbase,代码行数:7,代码来源:address_test.py

示例3: createAddr

 def createAddr(self, ):
     # eckey = EC_KEY(int(os.urandom(32).encode('hex'), 16))
     pk = EC_KEY(int(os.urandom(32).encode('hex'), 16))
     addr = Address()
     addr.priv = SecretToASecret(getSecret(pk), True)
     addr.addr = getAddrFromPrivateKey(addr.priv)
     self.addresses.append(addr)
开发者ID:AnadoluPanteri,项目名称:BitPurse,代码行数:7,代码来源:wallet.py

示例4: test_mask_address_parts

    def test_mask_address_parts(self):
        index = u'123456'
        country = u'Российская Федерация'
        region = u'Московская область'
        subregion = u'Подольский район'
        settlement = u'Подольск'
        street = u'Малая'
        house = u'234'
        poi = u'Станция Канавка'
        raw_address = 'sdlkjsldjflsdfjksdjffedsjdnv'

        address = Address(
            raw_address=raw_address,
            index=index,
            country=country,
            region=region,
            subregion=subregion,
            settlement=settlement,
            street=street,
            house=house,
            poi=poi
        )

        used_parts = ['index', 'country']
        new = address.mask_address_parts(used_parts)
        expected = Address(raw_address=raw_address,
                           index=index, country=country)
        self.assertEqual(new, expected)

        used_parts = ['region', 'settlement']
        new = address.mask_address_parts(used_parts)
        expected = Address(raw_address=raw_address,
                           region=region, settlement=settlement)
        # import ipdb; ipdb.set_trace()
        self.assertEqual(new, expected)
开发者ID:KolesovDmitry,项目名称:address_utils,代码行数:35,代码来源:test_address.py

示例5: FromStructure

def FromStructure(root, address=[]):
	''' Returns an op that inserts the node at address (and its descendants) to root '''
	address = Address(address)

	if len(address) > 0:
		pos = address.position(root)
		return FromNode(address.resolve(root), pos) + address.parent
	else:
		return FromChildren(root)
开发者ID:aral,项目名称:ConcurrenTree,代码行数:9,代码来源:operation.py

示例6: test_equal

    def test_equal(self):
        addr1 = Address()
        addr2 = Address()
        self.assertEqual(addr1, addr2)

        for key, val in addr1.__dict__.iteritems():
            addr1.__dict__[key] = 'qwerty' + unicode(val)
            self.assertNotEqual(addr1, addr2)
            addr2.__dict__[key] = 'qwerty' + unicode(val)
            self.assertEqual(addr1, addr2)
开发者ID:nextgis,项目名称:address_utils,代码行数:10,代码来源:test_address.py

示例7: test_organisation_address_allocation

 def test_organisation_address_allocation(self):
     a = Address('Seaburn Road', 'Nottingham')
     a.HouseNumber = '155'
     a.LocalityName = 'Toton'
     a.PostCode = 'NG9 6HF'
     c = Country('United Kingdom')
     a.Country = c
     self.Organisation.Address = a
     
     self.assertEqual(self.Organisation.Address.AddressLine1(),'155, Seaburn Road')
     self.assertEqual(self.Organisation.Address.AddressLine2(), 'Toton')
     self.assertEqual(self.Organisation.Address.Town, 'Nottingham')
     self.assertEqual(self.Organisation.Address.PostCode, 'NG9 6HF')
     self.assertEqual(self.Organisation.Address.Country.Name, 'United Kingdom')
开发者ID:IanSkidmore,项目名称:TCLContacts,代码行数:14,代码来源:Test_organisation.py

示例8: fromproto

 def fromproto(self, value):
     """ Sets properties from list. """
     # TODO: type checking
     value = list(value)
     self.code = value[0]
     self.address = Address(value[1])
     self.additional = value[2:]
开发者ID:aral,项目名称:ConcurrenTree,代码行数:7,代码来源:instruction.py

示例9: test_master_key_address_generation

 def test_master_key_address_generation(self):
     test_master_key = '0' * 32
     color_string = '0'
     index = 0
     address = Address.fromMasterKey(test_master_key, color_string, index)
     self.assertEqual(
         address.privkey,
         '5KjWca2NdTm5DMdPC1WBzEtaZ86wVL1Sd7FNnKBvF6H782HgABK')
开发者ID:hankhero,项目名称:ngcccbase,代码行数:8,代码来源:address_test.py

示例10: __init__

class TurBoDebugger:

    option = 0
    rc = 0
    proc = 0

    def __init__(self, proc_name):

        self.mw = MemWorker(proc_name)

    def run_game(self, path):

        self.rc = subprocess.Popen(path, shell=True)

    def options(self):

        print("what to do?")
        print("  1 search for text")
        print("  2 go to offset")
        self.option = int(input("    1 or 2 :> "))

        if self.option == 1:
            self.search_text()
        elif self.option == 2:
            self.go_offset()

    def search_text(self):

        text = input("Text search :> ")

        l = [x for x in self.mw.mem_search(text)]

        a = [x for x in l]

        print(l)
        print(a)

        val = int(input("Select Offset :> "))

        a[val].dump()

    def go_offset(self):

        self.offset = input("offset :> ")
        print("go for %s" % self.offset)

        self.proc = self.mw.get_process()

        self.address = Address(self.offset, self.proc)

        data = self.address.read(type="bytes")

        print(int(data))
开发者ID:TurBoss,项目名称:memorpy,代码行数:53,代码来源:main.py

示例11: go_offset

    def go_offset(self):

        self.offset = input("offset :> ")
        print("go for %s" % self.offset)

        self.proc = self.mw.get_process()

        self.address = Address(self.offset, self.proc)

        data = self.address.read(type="bytes")

        print(int(data))
开发者ID:TurBoss,项目名称:memorpy,代码行数:12,代码来源:main.py

示例12: __init__

	def __init__(self, local_address, remote_address = None):
		self.address_ = Address(quick_lazy_ip(),local_address.port)
		self.local_addr =  local_address
		print("self id = %s" % self.id())
		self.shutdown_ = False
		# list of successors
		self.successors_ = []
		# join the DHT
		self.join(remote_address)
		# we don't have deamons until we start
		self.daemons_ = {}
		# initially no commands
		self.command_ = []
开发者ID:BrendanBenshoof,项目名称:ChordRelayChat,代码行数:13,代码来源:chord.py

示例13: venue_address_test

class venue_address_test(unittest.TestCase):
    def setUp(self):
        self.parser = Address()

    def test_expression_examples(self):
        for test in corpus:
            result = self.parser.parse(test)
            self.assertNotEqual(result, None, "No match for: {}".format(test))
            self.assertTrue(any(result), "No match for: {}".format(test))

    def test_expressions(self):
        with open("parse/address/expressions.yaml", 'r') as f:
            check_expression(self, yaml.load(f))
开发者ID:andychase,项目名称:eventizer,代码行数:13,代码来源:address_test.py

示例14: main

def main():
    print '-- Geo Ingestion Python Script Starting --'

    f = open('map.osm', 'r')
    map_xml_text = f.read()
    tree = ET.parse('map.osm')
    root = tree.getroot()

    complete_address_count = 0
    partial_address_count = 0

    for leaf in root:
        if leaf.tag == 'node':
            address = Address(leaf)

            if address.is_valid_address():

                complete_address_count += 1

                print address

                url = 'http://localhost:9200/geo/osm/%s' % address.id
                r = requests.put(url, data=json.dumps(address.to_json()))
                if r.status_code in (200, 201, 202):
                    print 'Success!'
                else:
                    print 'Failure...'
            elif address.is_partial_valid_address():

                partial_address_count += 1

                print 'Partial address found!', address

    print 'Total Complete Address Counts: ', complete_address_count
    print 'Total Partial Address Counts: ', partial_address_count

    print '-- Completed Script --'
开发者ID:erictsai6,项目名称:geo-ingestion,代码行数:37,代码来源:main.py

示例15: test_subaddress_of

    def test_subaddress_of(self):
        addr1 = Address()
        addr2 = Address()
        self.assertTrue(addr1.subaddress_of(addr2))

        # import ipdb; ipdb.set_trace()
        for key, val in addr1.__dict__.iteritems():
            if key == '_raw_address':
                continue
            addr1.__dict__[key] = 'qwerty' + unicode(val)
            self.assertTrue(addr2.subaddress_of(addr1))
            self.assertFalse(addr1.subaddress_of(addr2))
            addr2.__dict__[key] = 'qwerty' + unicode(val)
开发者ID:nextgis,项目名称:address_utils,代码行数:13,代码来源:test_address.py


注:本文中的address.Address类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。