Ejemplo n.º 1
0
    def address(cls,
                *,
                locale=Locales.EN,
                calling_code=None,
                city=None,
                country=None,
                country_code=None,
                latitude=None,
                longitude=None,
                postal_code=None,
                state=None,
                street_name=None,
                street_number=None,
                street_suffix=None):
        '''
            Create an Address Data Entity object.

            All individual fields are automatically randomly generated based on locale. If provided, the corresponding values are overriden.

            Note:
                All individual fields are randomly generated. Don't expect correct correlation e.g. correct postal code for the generated city.

            Keyword Arguments:
                locale: Approprite Random.locale.<local_name> object. Default is Random.locale.EN
                calling_code: Calling Code
                city: City
                country: Country Name
                country_code: Country Code 
                latitude: Latitude
                longitude: Longitde
                postal_code: Postal Code
                state: State
                street_name: Street Name
                street_number Street Number
                street_suffix: Street Suffix
        '''
        address = Address(locale=locale)
        from arjuna.engine.data.entity.address import Address as ArjAddress

        return ArjAddress(
            calling_code=calling_code is not None and calling_code
            or address.calling_code(),
            city=city and city is not None or address.city(),
            country=country is not None and country or address.country(),
            country_code=country_code is not None and country_code
            or address.country_code(),
            latitude=latitude is not None and latitude or address.latitude(),
            longitude=longitude is not None and longitude
            or address.longitude(),
            postal_code=postal_code is not None and postal_code
            or address.postal_code(),
            state=state is not None and state or address.state(),
            street_name=street_name is not None and street_name
            or address.street_name(),
            street_number=street_number is not None and street_number
            or address.street_number(),
            street_suffix=street_suffix is not None and street_suffix
            or address.street_suffix(),
        )
Ejemplo n.º 2
0
class CSVData:
    def __init__(self):
        self.person = Person(locale='zh')
        self.address = Address(locale='zh')
        self.code = Code()
        self.business = Business(locale='zh')
        self.text = Text(locale='zh')
        self.datetime = Datetime(locale='zh')
        self.file = File()
        self.path = Path()
        self.internet = Internet()
        self.structure = Structure()

    def mime_data(self):
        # col1 = self.person.full_name()
        col1 = self.person.last_name() + self.person.first_name()
        col2 = self.address.city()
        col3 = self.address.street_name()
        col4 = self.address.calling_code()
        col5 = self.address.longitude()
        col6 = self.code.imei()
        col7 = self.business.company()
        col8 = self.text.hex_color()
        col9 = self.datetime.formatted_datetime()
        col10 = self.datetime.time()

        col11 = self.file.file_name()
        col12 = self.path.dev_dir()
        col13 = self.internet.ip_v4()
        col14 = self.internet.ip_v6()
        col15 = self.internet.home_page()
        col16 = self.internet.stock_image()
        col17 = self.internet.user_agent()
        col18 = self.internet.mac_address()
        col19 = self.person.email()
        col20 = self.person.telephone()

        col21 = self.code.issn()
        col22 = self.person.social_media_profile()
        col23 = self.structure.html()

        line = '\"{0}\", \"{1}\", \"{2}\", \"{3}\", {4}, \"{5}\", \"{6}\" , \"{7}\" , \"{8}\" , \"{9}\" , \"{10}\" , \"{11}\" , \"{12}\" , \"{13}\" , \"{14}\" , \"{15}\" , \"{16}\" , \"{17}\" , \"{18}\" , \"{19}\" , \"{20}\" , \"{21}\" , \"{22}\"\n'.format(
                col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13, col14, col15, col16, col17, col18, col19, col20, col21, col22, col23)

        # line = "mime data"
        # print(line)
        return line
Ejemplo n.º 3
0
def get_data(address: Address, lang: str):
    return {
        'address': address.address(),
        'calling_code': address.calling_code(),
        'city': address.city(),
        'continent': address.continent(),
        'coordinates': address.coordinates(),
        'country': address.country(),
        'country_code': get_country_code(lang),
        'latitude': address.latitude(),
        'longitude': address.longitude(),
        'postal_code': address.postal_code(),
        'state': address.state(),
        'street_name': address.street_name(),
        'street_number': address.street_number(),
        'street_suffix': address.street_suffix(),
        'zip_code': address.zip_code()
    }