Source code for celme.site

import doctest
from .home import Home
from .atmosphere import Atmosphere
from .horizon import Horizon

# ========================================================
# ========================================================
# === SITE = HOME + HORIZON + ATMOSPHERE
# ========================================================
# ========================================================

[docs]class Site(Home, Horizon, Atmosphere): """ Class to describe an Site """ # ======================================================== # === attributs # ======================================================== #_home = Home() #_atmosphere = Atmosphere() #_horizon = Horizon() # ======================================================== # === internal methods : Generals # ======================================================== def _init_site(self, home): """ Object initialization """ # --- update self.home with input parameters if isinstance(home, Home) == True: self.home(home.gps) else: self.home(home) # --- instanciate a new home to feed atmosphere and horizon home_local = Home(self.gps) self.horizon(home_local) self.atmosphere_standard(home_local) # ======================================================== # === internal methods : # ======================================================== # ======================================================== # === Site methods # ======================================================== # ======================================================== # === get/set methods # ======================================================== # ======================================================== # === debug methods # ========================================================
[docs] def infos(self, action) -> None: """ To get informations about this class :param action: A command to run a debug action (see examples). :type action: string :Example: Site('GPS 0 E 0 0').infos("doctest") Site('GPS 0 E 0 0').infos("doc_methods") Site('GPS 0 E 0 0').infos("internal_attributes") Site('GPS 0 E 0 0').infos("public_methods") """ if (action == "doc_methods"): publics = [x for x in dir(self) if x[0]!="_"] for public in publics: varname = "{}".format(public) if (callable(getattr(self,varname))==True): print("\n{:=^40}".format(" method "+varname+" ")) t = "Site('GPS 0 E 0 0')."+varname+".__doc__" tt =eval(t) print(tt) if (action == "doctest"): if __name__ == "__main__": print("\n{:~^40}".format("doctest")) doctest.testmod(verbose=False) if (action == "internal_attributes"): internals = [x for x in dir(self) if x[0]=="_" and x[1]!="_"] for internal in internals: varname = "{}".format(internal) #if (hasattr(self,varname)==True): if (callable(getattr(self,varname))==False): print(varname + "=" + str(getattr(self,varname))) if (action == "public_methods"): publics = [x for x in dir(Site('GPS 0 E 0 0')) if x[0]!="_"] for public in publics: varname = "{}".format(public) if (callable(getattr(self,varname))==True): print(varname)
# ======================================================== # === special methods # ======================================================== def __init__(self, home): """ Object initialization """ self._init_site(home)
# super().__init__()