Coverage for src/atlus/objects.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-07-27 14:35 -0400

1"""Define objects for parsing fields.""" 

2 

3from typing import Union, Optional 

4from pydantic import BaseModel, Field 

5 

6 

7class Address(BaseModel): 

8 """Define address parsing fields.""" 

9 

10 addr_housenumber: Optional[Union[int, str]] = Field( 

11 alias="addr:housenumber", 

12 description="The house number that is included in the address.", 

13 examples=[200, "1200-29"], 

14 default=None, 

15 ) 

16 addr_street: Optional[str] = Field( 

17 alias="addr:street", 

18 description="The street that the address is located on.", 

19 examples=["North Spring Street"], 

20 default=None, 

21 ) 

22 addr_unit: Optional[str] = Field( 

23 alias="addr:unit", 

24 description="The unit number or letter that is included in the address.", 

25 examples=["B"], 

26 default=None, 

27 ) 

28 addr_city: Optional[str] = Field( 

29 alias="addr:city", 

30 description="The city that the address is located in.", 

31 examples=["Los Angeles"], 

32 default=None, 

33 ) 

34 addr_state: Optional[str] = Field( 

35 alias="addr:state", 

36 pattern=r"^[A-Z]{2}$", 

37 description="The state or territory of the address.", 

38 examples=["CA"], 

39 default=None, 

40 ) 

41 addr_postcode: Optional[str] = Field( 

42 alias="addr:postcode", 

43 pattern=r"^\d{5}(?:\-\d{4})?$", 

44 description="The postal code of the address.", 

45 examples=["90012", "90012-4801"], 

46 default=None, 

47 )