From 5dfb92223969fecf4a9e65549143c0de561cc1b0 Mon Sep 17 00:00:00 2001 From: LukasK13 Date: Thu, 10 Sep 2020 15:31:07 +0200 Subject: [PATCH] Typing improved --- .../optical_component/OpticalComponentFactory.py | 11 ++++++----- esbo_etc/classes/sensor/SensorFactory.py | 2 +- esbo_etc/classes/target/TargetFactory.py | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/esbo_etc/classes/optical_component/OpticalComponentFactory.py b/esbo_etc/classes/optical_component/OpticalComponentFactory.py index 5801c49..caac9e0 100644 --- a/esbo_etc/classes/optical_component/OpticalComponentFactory.py +++ b/esbo_etc/classes/optical_component/OpticalComponentFactory.py @@ -1,6 +1,7 @@ from ..ARadiantFactory import ARadiantFactory from ..Entry import Entry from ..IRadiant import IRadiant +from .AOpticalComponent import AOpticalComponent from ...classes import optical_component as oc from ...lib.logger import logger @@ -21,7 +22,7 @@ class OpticalComponentFactory(ARadiantFactory): """ super().__init__(common_conf) - def create(self, options: Entry, parent: IRadiant = None) -> IRadiant: + def create(self, options: Entry, parent: IRadiant = None) -> AOpticalComponent: """ Create a new object of the type IRadiant @@ -33,8 +34,8 @@ class OpticalComponentFactory(ARadiantFactory): The optional parent element of the object (necessary for subclasses of AOpticalComponent). Returns ------- - obj : IRadiant - The created object + obj : AOpticalComponent + The created optical component """ opts = self.collectOptions(options) if parent is not None: @@ -57,7 +58,7 @@ class OpticalComponentFactory(ARadiantFactory): else: logger.error("No parent given for optical component.") - def fromConfigBatch(self, conf: Entry, parent: IRadiant) -> IRadiant: + def fromConfigBatch(self, conf: Entry, parent: IRadiant) -> AOpticalComponent: """ Initialize a decorated target from a configuration. @@ -70,7 +71,7 @@ class OpticalComponentFactory(ARadiantFactory): Returns ------- - parent : IRadiant + parent : AOpticalComponent The decorated parent object. """ if hasattr(conf.astroscene, "optical_component"): diff --git a/esbo_etc/classes/sensor/SensorFactory.py b/esbo_etc/classes/sensor/SensorFactory.py index 9d25a5e..52d7145 100644 --- a/esbo_etc/classes/sensor/SensorFactory.py +++ b/esbo_etc/classes/sensor/SensorFactory.py @@ -23,7 +23,7 @@ class SensorFactory(AFactory): """ super().__init__(common_conf) - def create(self, options: Entry, parent: IRadiant = None): + def create(self, options: Entry, parent: IRadiant = None) -> ASensor: """ Create a new sensor object diff --git a/esbo_etc/classes/target/TargetFactory.py b/esbo_etc/classes/target/TargetFactory.py index 48fe9e6..cc9ce60 100644 --- a/esbo_etc/classes/target/TargetFactory.py +++ b/esbo_etc/classes/target/TargetFactory.py @@ -2,6 +2,7 @@ import astropy.units as u from ..ARadiantFactory import ARadiantFactory from ..Entry import Entry from ..IRadiant import IRadiant +from .ATarget import ATarget from ...classes import target as tg from ...lib.logger import logger @@ -22,7 +23,7 @@ class TargetFactory(ARadiantFactory): """ super().__init__(common_conf) - def create(self, options: Entry, parent: IRadiant = None) -> IRadiant: + def create(self, options: Entry, parent: IRadiant = None) -> ATarget: """ Create a new object of the type IRadiant @@ -34,8 +35,8 @@ class TargetFactory(ARadiantFactory): The optional parent element of the object (necessary for subclasses of AOpticalComponent). Returns ------- - obj : IRadiant - The created object + obj : ATarget + The created target object """ opts = self.collectOptions(options) if parent is None: