Typing improved

This commit is contained in:
Lukas Klass 2020-09-10 15:31:07 +02:00
parent e400b21682
commit 5dfb922239
3 changed files with 11 additions and 9 deletions

View File

@ -1,6 +1,7 @@
from ..ARadiantFactory import ARadiantFactory from ..ARadiantFactory import ARadiantFactory
from ..Entry import Entry from ..Entry import Entry
from ..IRadiant import IRadiant from ..IRadiant import IRadiant
from .AOpticalComponent import AOpticalComponent
from ...classes import optical_component as oc from ...classes import optical_component as oc
from ...lib.logger import logger from ...lib.logger import logger
@ -21,7 +22,7 @@ class OpticalComponentFactory(ARadiantFactory):
""" """
super().__init__(common_conf) 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 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). The optional parent element of the object (necessary for subclasses of AOpticalComponent).
Returns Returns
------- -------
obj : IRadiant obj : AOpticalComponent
The created object The created optical component
""" """
opts = self.collectOptions(options) opts = self.collectOptions(options)
if parent is not None: if parent is not None:
@ -57,7 +58,7 @@ class OpticalComponentFactory(ARadiantFactory):
else: else:
logger.error("No parent given for optical component.") 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. Initialize a decorated target from a configuration.
@ -70,7 +71,7 @@ class OpticalComponentFactory(ARadiantFactory):
Returns Returns
------- -------
parent : IRadiant parent : AOpticalComponent
The decorated parent object. The decorated parent object.
""" """
if hasattr(conf.astroscene, "optical_component"): if hasattr(conf.astroscene, "optical_component"):

View File

@ -23,7 +23,7 @@ class SensorFactory(AFactory):
""" """
super().__init__(common_conf) 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 Create a new sensor object

View File

@ -2,6 +2,7 @@ import astropy.units as u
from ..ARadiantFactory import ARadiantFactory from ..ARadiantFactory import ARadiantFactory
from ..Entry import Entry from ..Entry import Entry
from ..IRadiant import IRadiant from ..IRadiant import IRadiant
from .ATarget import ATarget
from ...classes import target as tg from ...classes import target as tg
from ...lib.logger import logger from ...lib.logger import logger
@ -22,7 +23,7 @@ class TargetFactory(ARadiantFactory):
""" """
super().__init__(common_conf) 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 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). The optional parent element of the object (necessary for subclasses of AOpticalComponent).
Returns Returns
------- -------
obj : IRadiant obj : ATarget
The created object The created target object
""" """
opts = self.collectOptions(options) opts = self.collectOptions(options)
if parent is None: if parent is None: