BIM2SIM / bim2sim

A python tool to create simulation models for different domains based on BIM IFC models.
https://bim2sim.github.io/bim2sim/
GNU Lesser General Public License v3.0
42 stars 7 forks source link

typing for all functions #653

Open DaJansenGit opened 2 weeks ago

DaJansenGit commented 2 weeks ago

at least in core (bim2sim main without plugins)

DaJansenGit commented 4 days ago

A good example is this:

    def get_ifc_types(self, relevant_elements: List[Type[ProductBased]]) \
            -> Set[str]:
        """Extract used ifc types from list of elements."""
        relevant_ifc_types = []
        for ele in relevant_elements:
            relevant_ifc_types.extend(ele.ifc_types.keys())
        return set(relevant_ifc_types)
DaJansenGit commented 4 days ago

In some cases it might make sense to use TYPE_CHECKING to prevent circular imports

from typing import TYPE_CHECKING

if TYPE_CHECKING:
   import ...

please check google to find out why and how this works ;)