kerykeion.kr_types.kr_models

This is part of Kerykeion (C) 2024 Giacomo Battaglia

  1# -*- coding: utf-8 -*-
  2"""
  3    This is part of Kerykeion (C) 2024 Giacomo Battaglia
  4"""
  5
  6
  7from typing import Union, Optional
  8from pydantic import BaseModel
  9
 10from kerykeion.kr_types import LunarPhaseEmoji, LunarPhaseName, Planet, Houses, Quality, Element, Sign, ZodiacType, SignNumbers, HouseNumbers, PointType, SiderealMode, HousesSystemIdentifier
 11
 12class SubscriptableBaseModel(BaseModel):
 13    """
 14    Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.
 15    """
 16    def __getitem__(self, key):
 17        return getattr(self, key)
 18
 19    def __setitem__(self, key, value):
 20        setattr(self, key, value)
 21
 22    def __delitem__(self, key):
 23        delattr(self, key)
 24
 25    def get(self, key, default):
 26        return getattr(self, key, default)
 27
 28class LunarPhaseModel(SubscriptableBaseModel):
 29    degrees_between_s_m: Union[float, int]
 30    moon_phase: int
 31    sun_phase: int
 32    moon_emoji: LunarPhaseEmoji
 33    moon_phase_name: LunarPhaseName
 34
 35
 36class KerykeionPointModel(SubscriptableBaseModel):
 37    """
 38    Kerykeion Point Model
 39    """
 40
 41    name: Union[Planet, Houses]
 42    quality: Quality
 43    element: Element
 44    sign: Sign
 45    sign_num: SignNumbers
 46    position: float
 47    abs_pos: float
 48    emoji: str
 49    point_type: PointType
 50    house: Optional[HouseNumbers] = None
 51    retrograde: Optional[bool] = None
 52
 53
 54class AstrologicalSubjectModel(SubscriptableBaseModel):
 55    # Data
 56    name: str
 57    year: int
 58    month: int
 59    day: int
 60    hour: int
 61    minute: int
 62    city: str
 63    nation: str
 64    lng: float
 65    lat: float
 66    tz_str: str
 67    zodiac_type: ZodiacType
 68    sidereal_mode: Union[SiderealMode, None]
 69    houses_system_identifier: HousesSystemIdentifier
 70    houses_system_name: str
 71    perspective_type: str
 72    iso_formatted_local_datetime: str
 73    iso_formatted_utc_datetime: str
 74    julian_day: float
 75
 76    # Planets
 77    sun: KerykeionPointModel
 78    moon: KerykeionPointModel
 79    mercury: KerykeionPointModel
 80    venus: KerykeionPointModel
 81    mars: KerykeionPointModel
 82    jupiter: KerykeionPointModel
 83    saturn: KerykeionPointModel
 84    uranus: KerykeionPointModel
 85    neptune: KerykeionPointModel
 86    pluto: KerykeionPointModel
 87
 88    # Optional Planets:
 89    chiron: Union[KerykeionPointModel, None]
 90
 91    # Houses
 92    first_house: KerykeionPointModel
 93    second_house: KerykeionPointModel
 94    third_house: KerykeionPointModel
 95    fourth_house: KerykeionPointModel
 96    fifth_house: KerykeionPointModel
 97    sixth_house: KerykeionPointModel
 98    seventh_house: KerykeionPointModel
 99    eighth_house: KerykeionPointModel
100    ninth_house: KerykeionPointModel
101    tenth_house: KerykeionPointModel
102    eleventh_house: KerykeionPointModel
103    twelfth_house: KerykeionPointModel
104
105    # Nodes
106    mean_node: KerykeionPointModel
107    true_node: KerykeionPointModel
108
109    # Lunar Phase
110    lunar_phase: LunarPhaseModel
111
112    # Lists
113    # houses_list: list[KerykeionPointModel]
114    # planets_list: list[KerykeionPointModel]
115    # planets_degrees_ut: list[float]
116    # houses_degree_ut: list[float]
117
118if __name__ == "__main__":
119    from kerykeion.utilities import setup_logging
120
121    setup_logging(level="debug")
122
123    sun = KerykeionPointModel(
124        name="Sun",
125        element="Air",
126        quality="Fixed",
127        sign="Aqu",
128        sign_num=1,
129        position=0,
130        abs_pos=12.123123,
131        emoji="♈",
132        point_type="Planet",
133    )
134
135    print(sun.model_dump_json())
136    print(sun)
class SubscriptableBaseModel(pydantic.main.BaseModel):
13class SubscriptableBaseModel(BaseModel):
14    """
15    Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.
16    """
17    def __getitem__(self, key):
18        return getattr(self, key)
19
20    def __setitem__(self, key, value):
21        setattr(self, key, value)
22
23    def __delitem__(self, key):
24        delattr(self, key)
25
26    def get(self, key, default):
27        return getattr(self, key, default)

Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.

def get(self, key, default):
26    def get(self, key, default):
27        return getattr(self, key, default)
model_config = {}
model_fields = {}
model_computed_fields = {}
Inherited Members
pydantic.main.BaseModel
BaseModel
model_extra
model_fields_set
model_construct
model_copy
model_dump
model_dump_json
model_json_schema
model_parametrized_name
model_post_init
model_rebuild
model_validate
model_validate_json
model_validate_strings
dict
json
parse_obj
parse_raw
parse_file
from_orm
construct
copy
schema
schema_json
validate
update_forward_refs
class LunarPhaseModel(SubscriptableBaseModel):
29class LunarPhaseModel(SubscriptableBaseModel):
30    degrees_between_s_m: Union[float, int]
31    moon_phase: int
32    sun_phase: int
33    moon_emoji: LunarPhaseEmoji
34    moon_phase_name: LunarPhaseName

Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.

degrees_between_s_m: Union[float, int]
moon_phase: int
sun_phase: int
moon_emoji: Literal['🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘']
moon_phase_name: Literal['New Moon', 'Waxing Crescent', 'First Quarter', 'Waxing Gibbous', 'Full Moon', 'Waning Gibbous', 'Last Quarter', 'Waning Crescent']
model_config = {}
model_fields = {'degrees_between_s_m': FieldInfo(annotation=Union[float, int], required=True), 'moon_phase': FieldInfo(annotation=int, required=True), 'sun_phase': FieldInfo(annotation=int, required=True), 'moon_emoji': FieldInfo(annotation=Literal['🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘'], required=True), 'moon_phase_name': FieldInfo(annotation=Literal['New Moon', 'Waxing Crescent', 'First Quarter', 'Waxing Gibbous', 'Full Moon', 'Waning Gibbous', 'Last Quarter', 'Waning Crescent'], required=True)}
model_computed_fields = {}
Inherited Members
pydantic.main.BaseModel
BaseModel
model_extra
model_fields_set
model_construct
model_copy
model_dump
model_dump_json
model_json_schema
model_parametrized_name
model_post_init
model_rebuild
model_validate
model_validate_json
model_validate_strings
dict
json
parse_obj
parse_raw
parse_file
from_orm
construct
copy
schema
schema_json
validate
update_forward_refs
SubscriptableBaseModel
get
class KerykeionPointModel(SubscriptableBaseModel):
37class KerykeionPointModel(SubscriptableBaseModel):
38    """
39    Kerykeion Point Model
40    """
41
42    name: Union[Planet, Houses]
43    quality: Quality
44    element: Element
45    sign: Sign
46    sign_num: SignNumbers
47    position: float
48    abs_pos: float
49    emoji: str
50    point_type: PointType
51    house: Optional[HouseNumbers] = None
52    retrograde: Optional[bool] = None

Kerykeion Point Model

name: Union[Literal['Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Mean_Node', 'True_Node', 'Chiron'], Literal['First_House', 'Second_House', 'Third_House', 'Fourth_House', 'Fifth_House', 'Sixth_House', 'Seventh_House', 'Eighth_House', 'Ninth_House', 'Tenth_House', 'Eleventh_House', 'Twelfth_House']]
quality: Literal['Cardinal', 'Fixed', 'Mutable']
element: Literal['Air', 'Fire', 'Earth', 'Water']
sign: Literal['Ari', 'Tau', 'Gem', 'Can', 'Leo', 'Vir', 'Lib', 'Sco', 'Sag', 'Cap', 'Aqu', 'Pis']
sign_num: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
position: float
abs_pos: float
emoji: str
point_type: Literal['Planet', 'House']
house: Optional[Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]
retrograde: Optional[bool]
model_config = {}
model_fields = {'name': FieldInfo(annotation=Union[Literal['Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'Mean_Node', 'True_Node', 'Chiron'], Literal['First_House', 'Second_House', 'Third_House', 'Fourth_House', 'Fifth_House', 'Sixth_House', 'Seventh_House', 'Eighth_House', 'Ninth_House', 'Tenth_House', 'Eleventh_House', 'Twelfth_House']], required=True), 'quality': FieldInfo(annotation=Literal['Cardinal', 'Fixed', 'Mutable'], required=True), 'element': FieldInfo(annotation=Literal['Air', 'Fire', 'Earth', 'Water'], required=True), 'sign': FieldInfo(annotation=Literal['Ari', 'Tau', 'Gem', 'Can', 'Leo', 'Vir', 'Lib', 'Sco', 'Sag', 'Cap', 'Aqu', 'Pis'], required=True), 'sign_num': FieldInfo(annotation=Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], required=True), 'position': FieldInfo(annotation=float, required=True), 'abs_pos': FieldInfo(annotation=float, required=True), 'emoji': FieldInfo(annotation=str, required=True), 'point_type': FieldInfo(annotation=Literal['Planet', 'House'], required=True), 'house': FieldInfo(annotation=Union[Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], NoneType], required=False, default=None), 'retrograde': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None)}
model_computed_fields = {}
Inherited Members
pydantic.main.BaseModel
BaseModel
model_extra
model_fields_set
model_construct
model_copy
model_dump
model_dump_json
model_json_schema
model_parametrized_name
model_post_init
model_rebuild
model_validate
model_validate_json
model_validate_strings
dict
json
parse_obj
parse_raw
parse_file
from_orm
construct
copy
schema
schema_json
validate
update_forward_refs
SubscriptableBaseModel
get
class AstrologicalSubjectModel(SubscriptableBaseModel):
 55class AstrologicalSubjectModel(SubscriptableBaseModel):
 56    # Data
 57    name: str
 58    year: int
 59    month: int
 60    day: int
 61    hour: int
 62    minute: int
 63    city: str
 64    nation: str
 65    lng: float
 66    lat: float
 67    tz_str: str
 68    zodiac_type: ZodiacType
 69    sidereal_mode: Union[SiderealMode, None]
 70    houses_system_identifier: HousesSystemIdentifier
 71    houses_system_name: str
 72    perspective_type: str
 73    iso_formatted_local_datetime: str
 74    iso_formatted_utc_datetime: str
 75    julian_day: float
 76
 77    # Planets
 78    sun: KerykeionPointModel
 79    moon: KerykeionPointModel
 80    mercury: KerykeionPointModel
 81    venus: KerykeionPointModel
 82    mars: KerykeionPointModel
 83    jupiter: KerykeionPointModel
 84    saturn: KerykeionPointModel
 85    uranus: KerykeionPointModel
 86    neptune: KerykeionPointModel
 87    pluto: KerykeionPointModel
 88
 89    # Optional Planets:
 90    chiron: Union[KerykeionPointModel, None]
 91
 92    # Houses
 93    first_house: KerykeionPointModel
 94    second_house: KerykeionPointModel
 95    third_house: KerykeionPointModel
 96    fourth_house: KerykeionPointModel
 97    fifth_house: KerykeionPointModel
 98    sixth_house: KerykeionPointModel
 99    seventh_house: KerykeionPointModel
100    eighth_house: KerykeionPointModel
101    ninth_house: KerykeionPointModel
102    tenth_house: KerykeionPointModel
103    eleventh_house: KerykeionPointModel
104    twelfth_house: KerykeionPointModel
105
106    # Nodes
107    mean_node: KerykeionPointModel
108    true_node: KerykeionPointModel
109
110    # Lunar Phase
111    lunar_phase: LunarPhaseModel
112
113    # Lists
114    # houses_list: list[KerykeionPointModel]
115    # planets_list: list[KerykeionPointModel]
116    # planets_degrees_ut: list[float]
117    # houses_degree_ut: list[float]

Pydantic BaseModel with subscriptable support, so you can access the fields as if they were a dictionary.

name: str
year: int
month: int
day: int
hour: int
minute: int
city: str
nation: str
lng: float
lat: float
tz_str: str
zodiac_type: Literal['Tropic', 'Sidereal']
sidereal_mode: Optional[Literal['FAGAN_BRADLEY', 'LAHIRI', 'DELUCE', 'RAMAN', 'USHASHASHI', 'KRISHNAMURTI', 'DJWHAL_KHUL', 'YUKTESHWAR', 'JN_BHASIN', 'BABYL_KUGLER1', 'BABYL_KUGLER2', 'BABYL_KUGLER3', 'BABYL_HUBER', 'BABYL_ETPSC', 'ALDEBARAN_15TAU', 'HIPPARCHOS', 'SASSANIAN', 'J2000', 'J1900', 'B1950']]
houses_system_identifier: Literal['A', 'B', 'C', 'D', 'F', 'H', 'I', 'i', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y']
houses_system_name: str
perspective_type: str
iso_formatted_local_datetime: str
iso_formatted_utc_datetime: str
julian_day: float
chiron: Optional[KerykeionPointModel]
first_house: KerykeionPointModel
second_house: KerykeionPointModel
third_house: KerykeionPointModel
fourth_house: KerykeionPointModel
fifth_house: KerykeionPointModel
sixth_house: KerykeionPointModel
seventh_house: KerykeionPointModel
eighth_house: KerykeionPointModel
ninth_house: KerykeionPointModel
tenth_house: KerykeionPointModel
eleventh_house: KerykeionPointModel
twelfth_house: KerykeionPointModel
mean_node: KerykeionPointModel
true_node: KerykeionPointModel
lunar_phase: LunarPhaseModel
model_config = {}
model_fields = {'name': FieldInfo(annotation=str, required=True), 'year': FieldInfo(annotation=int, required=True), 'month': FieldInfo(annotation=int, required=True), 'day': FieldInfo(annotation=int, required=True), 'hour': FieldInfo(annotation=int, required=True), 'minute': FieldInfo(annotation=int, required=True), 'city': FieldInfo(annotation=str, required=True), 'nation': FieldInfo(annotation=str, required=True), 'lng': FieldInfo(annotation=float, required=True), 'lat': FieldInfo(annotation=float, required=True), 'tz_str': FieldInfo(annotation=str, required=True), 'zodiac_type': FieldInfo(annotation=Literal['Tropic', 'Sidereal'], required=True), 'sidereal_mode': FieldInfo(annotation=Union[Literal['FAGAN_BRADLEY', 'LAHIRI', 'DELUCE', 'RAMAN', 'USHASHASHI', 'KRISHNAMURTI', 'DJWHAL_KHUL', 'YUKTESHWAR', 'JN_BHASIN', 'BABYL_KUGLER1', 'BABYL_KUGLER2', 'BABYL_KUGLER3', 'BABYL_HUBER', 'BABYL_ETPSC', 'ALDEBARAN_15TAU', 'HIPPARCHOS', 'SASSANIAN', 'J2000', 'J1900', 'B1950'], NoneType], required=True), 'houses_system_identifier': FieldInfo(annotation=Literal['A', 'B', 'C', 'D', 'F', 'H', 'I', 'i', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y'], required=True), 'houses_system_name': FieldInfo(annotation=str, required=True), 'perspective_type': FieldInfo(annotation=str, required=True), 'iso_formatted_local_datetime': FieldInfo(annotation=str, required=True), 'iso_formatted_utc_datetime': FieldInfo(annotation=str, required=True), 'julian_day': FieldInfo(annotation=float, required=True), 'sun': FieldInfo(annotation=KerykeionPointModel, required=True), 'moon': FieldInfo(annotation=KerykeionPointModel, required=True), 'mercury': FieldInfo(annotation=KerykeionPointModel, required=True), 'venus': FieldInfo(annotation=KerykeionPointModel, required=True), 'mars': FieldInfo(annotation=KerykeionPointModel, required=True), 'jupiter': FieldInfo(annotation=KerykeionPointModel, required=True), 'saturn': FieldInfo(annotation=KerykeionPointModel, required=True), 'uranus': FieldInfo(annotation=KerykeionPointModel, required=True), 'neptune': FieldInfo(annotation=KerykeionPointModel, required=True), 'pluto': FieldInfo(annotation=KerykeionPointModel, required=True), 'chiron': FieldInfo(annotation=Union[KerykeionPointModel, NoneType], required=True), 'first_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'second_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'third_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'fourth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'fifth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'sixth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'seventh_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'eighth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'ninth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'tenth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'eleventh_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'twelfth_house': FieldInfo(annotation=KerykeionPointModel, required=True), 'mean_node': FieldInfo(annotation=KerykeionPointModel, required=True), 'true_node': FieldInfo(annotation=KerykeionPointModel, required=True), 'lunar_phase': FieldInfo(annotation=LunarPhaseModel, required=True)}
model_computed_fields = {}
Inherited Members
pydantic.main.BaseModel
BaseModel
model_extra
model_fields_set
model_construct
model_copy
model_dump
model_dump_json
model_json_schema
model_parametrized_name
model_post_init
model_rebuild
model_validate
model_validate_json
model_validate_strings
dict
json
parse_obj
parse_raw
parse_file
from_orm
construct
copy
schema
schema_json
validate
update_forward_refs
SubscriptableBaseModel
get