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

fix imprecise resource type-hinting #534

Merged

Conversation

rmudambi
Copy link
Contributor

Fix imprecise resource type-hinting

Description

Changes and notes

This was introduced as a result of merge conflicts

Testing

All builds pass

Base automatically changed from rmudambi/mic-5403/fix-vph-tests to rmudambi/epic/state-machine November 12, 2024 18:42
if len(set(r.component for r in initialized_resources)) != 1:
raise ResourceError("All initialized resources must have the same component.")

if len(set(r.resource_type for r in initialized_resources)) != 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean you can have duplicates in initialized_resources? That seems weird to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This case will only occur in practice, when a component is creating multiple columns. Then there will be multiple Column resources in the group. This is throwing an error if the resources are not all of the same type.

return False


class NullResource(Resource):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I have asked this before but what is the point of this class? I am guessing for warnings/errors later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because a component may have an on_initialize_simulants method that has required resources, even if that component doesn't create any columns. This is the resource that corresponds to that case.

@@ -31,6 +32,11 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(skip_slow)


@pytest.fixture(scope="session")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will save the output diagnostic file to this directory but it doesn't look like you needed to ignore that?

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 don't understand this comment

@rmudambi rmudambi merged commit 52ba222 into rmudambi/epic/state-machine Nov 12, 2024
4 checks passed
@rmudambi rmudambi deleted the rmudambi/mic-5403/resource-typing branch November 12, 2024 21:04
rmudambi added a commit that referenced this pull request Nov 13, 2024
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.

4 participants