send_the_raven.address.Addresses#

class send_the_raven.address.Addresses[source]#

Bases: object

Represents a list of addresses.

Parameters:
  • addresses (iterable) – iterable of any to construct Address object.

  • field_mapping (dict) – A dictionary of field names to be used when constructing the Address objects. The default is DEFAULT_ADDRESS_MAPPING. The dict’s keys are Address’s attributes. The dict’s values are the key in the input addresses.

addresses#

A list of Address objects.

Type:

list[Address]

field_mapping#

A dictionary of field names to be used when constructing the Address objects.

Type:

dict

Example

>>> data = [{'street address': '12 main st', 'city': boston}, {'street address': '14 main st', 'city': boston}]
>>> field_mapper = {'street': 'street address'}
>>> addresses = Addresses(data, field_mapper)
__init__(addresses, field_mapping={'address_line_2': 'address_line_2', 'city': 'city', 'full_address': 'full_address', 'id': 'id', 'state': 'state', 'street': 'street', 'zip_code': 'zip_code'})[source]#
Parameters:
__call__(**kwargs)#

Call self as a function.

Methods

__eq__(value, /)

Return self==value.

__getitem__(index)

__init__(addresses[, field_mapping])

__iter__()

__len__()

normalize_parallel([number_of_proccesses])

Normalize all addresses in parallel.

__init__(addresses, field_mapping={'address_line_2': 'address_line_2', 'city': 'city', 'full_address': 'full_address', 'id': 'id', 'state': 'state', 'street': 'street', 'zip_code': 'zip_code'})[source]#
Parameters:
normalize_parallel(number_of_proccesses=None)[source]#

Normalize all addresses in parallel. Uses multiprocessing.Pool.map().

Parameters:

number_of_proccesses (int) – number of process