Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typing for functions in bps and common tasks #678

Open
wants to merge 31 commits into
base: development
Choose a base branch
from

Conversation

ShujiaoHee
Copy link
Contributor

I added basic type annotations to all functions where typing was missing, but I didn't delve deeply into the structure. So for most functions I didn't provide detailed type information, like the example List[Type[ProductBased]], but I will try to see if there are some improvements. I hope to recieve feedback and suggestions, and would be glad to do the futher improvement. :)

@@ -180,7 +183,7 @@ def get_material_template(cls, material_name: str, resumed_names: list,
material_name)
return resumed[selected_material]

def enrich_layer_set(self, invalid_element, resumed, templates):
def enrich_layer_set(self, invalid_element: Any, resumed: dict, templates: dict):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will get different types if we run the different cases, so I just set it to "Any".
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I checked typing on this file, there were multiple errors in other lines.
image

@@ -38,7 +40,7 @@ class PlotBEPSResults(ITask):
reads = ('df_finals', 'sim_results_path', 'ifc_files', 'elements')
final = True

def run(self, df_finals, sim_results_path, ifc_files, elements):
def run(self, df_finals: dict, sim_results_path: Path, ifc_files: list, elements: dict):
Copy link
Contributor Author

@ShujiaoHee ShujiaoHee Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got the "NoneType" for the parameters "df_finals" and "sim_results_path" when I debug, but according to the Args above, I just added the dict and Path.
image

@DaJansenGit DaJansenGit marked this pull request as draft August 7, 2024 07:53
…ions' into 653-typing-for-all-functions"

This reverts commit b3cc0a5, reversing
changes made to d30d512.
# Conflicts:
#	bim2sim/tasks/bps/disaggr_creation.py
#	bim2sim/tasks/bps/enrich_material.py
#	bim2sim/tasks/bps/resolve_type_mismatch.py
#	bim2sim/tasks/bps/sb_2b_generation.py
#	bim2sim/tasks/bps/sb_correction.py
#	bim2sim/tasks/bps/verify.py
#	bim2sim/tasks/common/create_elements.py
#	bim2sim/tasks/common/serialize_elements.py
@DaJansenGit DaJansenGit marked this pull request as ready for review August 21, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants