Skip to content

Conversation

liamhuber
Copy link
Member

It was necessary for python<3.10, but we dropped support for that, so we can get rid of the ugly, non-public hint.

It was necessary for python<3.10, but we dropped support for that, so we can get rid of the ugly, non-public hint.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Copy link

github-actions bot commented Jan 9, 2025

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_workflow/type_hints_for_310

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4d242b6) 3387 3099 91.50%
Head commit (a25b3e7) 3387 (+0) 3099 (+0) 91.50% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#535) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@liamhuber liamhuber mentioned this pull request Jan 9, 2025
@liamhuber liamhuber merged commit 71c46da into mypy Jan 9, 2025
19 of 20 checks passed
@liamhuber liamhuber deleted the type_hints_for_310 branch January 9, 2025 17:42
liamhuber added a commit that referenced this pull request Jan 18, 2025
* Use typing.Callable instead of callable

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ignore erroneous error

typing._UnionGenericAlias definitively _does_ exist.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint a tuple, don't return one

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint typing.Callable instead of callable

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Expose the Self typing tool for all versions

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add a mypy job

Based on @jan-janssen's jobs for other pyiron repos

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` channels (#534)

* Leverage generics for connection partners

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Break apart connection error message

So we only reference type hints when they're there

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint connections type more specifically

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint disconnect more specifically

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Use Self in disconnection hints

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Use Self to hint value_receiver

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Devolve responsibility for connection validity

Otherwise mypy has trouble telling that data channels really are operating on a connection partner, since the `super()` call could wind up pointing anywhere.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Fix typing in channel tests

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* 🐛 Return the message

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Fix typing in figuring out who is I/O

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Recast connection parters as class method

mypy complained about the class-level attribute access I was using to get around circular references. This is a bit more verbose, but otherwise a fine alternative.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Match Accumulating input signal call to parent

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Move Ruff jobs into the main push-pull script

This is just a little QoL thing; the current script runs the jobs twice every time I push, and it's annoying me.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff: import Callable from collections.abc

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Drop the private type hint (#535)

It was necessary for python<3.10, but we dropped support for that, so we can get rid of the ugly, non-public hint.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` channels redux (#536)

* Refactor: rename

Move from "partner" language to "conjugate" language

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Explicitly decompose conjugate behaviour

Into flavor and IO components

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Tidying

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Narrow hint on connection copying

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Apply hints to IO panels (#537)

* Refactor: rename

Move from "partner" language to "conjugate" language

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Explicitly decompose conjugate behaviour

Into flavor and IO components

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Tidying

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Narrow hint on connection copying

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Apply hints to IO panels

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Narrow type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't reuse variable

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff: sort imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* 🐛 fix type hint

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add more hints

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor connection validity

The instance check to see if a connection candidate has the correct (conjugate) type now occurs only _once_ in the parent `Channel` class. `Channel._valid_connection` is the repurposed to check for validity inside the scope of the classes already lining up, and defaults to simply returning `True` in the base class. `DataChannel` overrides it to do the type hint comparison.

Changes inspired by [conversation](#533 (comment)) with @XzzX.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` run (#541)

* Hint init properties

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint local function

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add stricter return and hint

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* 🐛 Hint tuple[] not ()

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` topology and find (#542)

* Don't overload typed variable

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add (and more specific) return hint(s)

To the one function missing one

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add module docstring

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Catch module spec failures

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Force mypy to accept the design feature

That we _want_ callers to be able to get abstract classes if they request them

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff import sort

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` semantics (#538)

* Initialize _label to a string

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint the delimiter

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make SemanticParent a Generic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Purge `ParentMost`

If subclasses of `Semantic` want to limit their `parent` attribute beyond the standard requirement that it be a `SemanticParent`, they can handle that by overriding the `parent` setter and getter. The only place this was used was in `Workflow`, and so such handling is now exactly the case.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Update comment

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Use generic type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't use generic in static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Jump through mypy hoops

It doesn't recognize the __set__ for fset methods on the property, so my usual routes for super'ing the setter are failing. This is annoying, but I don't see it being particularly harmful as the method is private.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add dev note

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Semantics generic parent (#544)

* Make SemanticParent a Generic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't use generic in static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove HasParent

An interface class guaranteeing the (Any-typed) attribute is too vague to be super useful, and redundant when it's _only_ used in `Semantic`. Having a `parent` will just be a direct feature of being semantic.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull out static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull cyclicity check up to Semantic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* De-parent SemanticParent from Semantic

Because of the label arg vs kwarg problem, there is still a vestigial label arg in the SemanticParent init signature.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove redundant type check

This is handled in the super class

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Give Semantic a generic parent type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff sort imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Update docstrings

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Improvements to semantic labeling (#547)

* Initialize _label to a string

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint the delimiter

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make SemanticParent a Generic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Purge `ParentMost`

If subclasses of `Semantic` want to limit their `parent` attribute beyond the standard requirement that it be a `SemanticParent`, they can handle that by overriding the `parent` setter and getter. The only place this was used was in `Workflow`, and so such handling is now exactly the case.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Update comment

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Use generic type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't use generic in static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Jump through mypy hoops

It doesn't recognize the __set__ for fset methods on the property, so my usual routes for super'ing the setter are failing. This is annoying, but I don't see it being particularly harmful as the method is private.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add dev note

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove HasParent

An interface class guaranteeing the (Any-typed) attribute is too vague to be super useful, and redundant when it's _only_ used in `Semantic`. Having a `parent` will just be a direct feature of being semantic.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull out static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull cyclicity check up to Semantic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* De-parent SemanticParent from Semantic

Because of the label arg vs kwarg problem, there is still a vestigial label arg in the SemanticParent init signature.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove redundant type check

This is handled in the super class

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Give Semantic a generic parent type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff sort imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Update docstrings

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Guarantee that semantic parents have a label

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* 🐛 don't assume parents have semantic_path

But we can now safely assume they have a label

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull label default up into Semantic

This way it is allowed to be a keyword argument everywhere, except for Workflow which makes it positional and adjusts its `super().__init__` call accordingly.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor: label validity check

Pull it up from semantic into an extensible method on the mixin class

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor: rename class

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add label restrictions

To semantic parent based on its child type's semantic delimiter

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Improve error messages

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make SemanticParent a Generic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't use generic in static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove HasParent

An interface class guaranteeing the (Any-typed) attribute is too vague to be super useful, and redundant when it's _only_ used in `Semantic`. Having a `parent` will just be a direct feature of being semantic.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull out static method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Pull cyclicity check up to Semantic

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* De-parent SemanticParent from Semantic

Because of the label arg vs kwarg problem, there is still a vestigial label arg in the SemanticParent init signature.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove redundant type check

This is handled in the super class

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Give Semantic a generic parent type

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff sort imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Update docstrings

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Annotate some extra returns (#548)

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make the `HasChannel` interface generic on the `Channel` type (#550)

* 🐛 hint with [] for type args

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make a generic version of HasChannel

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Generic `HasIO` classes to specify data output panel types (#551)

* 🐛 hint with [] for type args

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make a generic version of HasChannel

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make HasIO generic on the output panel

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor: introduce generic data outputs panel

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unnecessary concrete class

To reduce misdirection. We barely use it in the super-class and never need to hint it. In contrast, I kept `OutputsWithInjection` around exactly because it shows up in type hints everywhere, so the shorthand version is nice to have.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Fix type hints and unused imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* More return hints (#552)

* Fix returned type of __dir__

Conventionally it returns a list, not a set, of strings

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add hints to io

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Adjust run_finally signature

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint user data

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint Workflow.automate_execution

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Provide a type-compliant default

It never actually matters with the current logic, because of all the checks if parent is None and the fact that it is otherwise hinted to be at least a `Composite`, but it shuts mypy up and it does zero harm.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` storage (#553)

* Add return hints

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* End clause with else

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Explicitly raise an error

After narrowing our search to files, actually throw an error right away if you never found one to load.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Resolve method extension complaints

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` signature compliance (#554)

* Extend runnable signatures

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Align Workflow.run with superclass signature

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Relax FromManyInputs._on_run constraint

It was too strict for the DataFrame subclass, so just keep the superclass reference instead of narrowing the constraints.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* black

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` draw (#555)

* Write 3-tuple explicitly

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Always hint channels having parents

Unlike nodes, the IO and Channel objects it the draw module always wind up having a parent

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make draw._Channel generic

On the underlying workflow channel type, so the data channel can later access its value.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff fix imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Stringify TYPE_CHECKING class uses

Oops.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Silence ruff

The imports are indeed used, but only in string form for the sake of the static type checker.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Generic value receiver (#556)

* 🐛 Re-parent abstract method

It belongs with the owners of channels, and these are HasIO, not the IO panels (which are merely dumb containers that give shortcuts to certain functionality)

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Make DataChannel generic on value_receiver

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint attribute

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't reuse variable

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Only hint available backends

Not just any old string

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Cast docstrings to string

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint NotData class

Instead of NOT_DATA instance

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Just use classmethod

It doesn't combine with property

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Ruff fix imports

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove preview helper method (#557)

* Remove preview helper method

The potential usage is limited to transform and for-loop modules, and the extra layer of misdirection does not feel worth the very minimal reduction in code duplication

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Relax Node.emitting_channels hint

To allow a tuple of variable length

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Account for __doc__ possibly being None

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Be more specific in return hint

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Change return on Composite.remove_child (#558)

* Change return on Composite.remove_child

To match return in parent class. Disconnections were only ever used in the test case, and users are always free to disconnect and _then_ remove if they want to capture the broken connections explicitly.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove unused import

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Fix docstring types

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* IO maps (#559)

* Refactor Workflow map setter

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Remove return hint

The method is in-place

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Move the None check around

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Reverse instance check

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Return both nodes on replacement (#560)

* Return both nodes on replacement

Instead of only returning the replaced node.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* 🐛 only use new variable

Missed a spot.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Hint graph creator

Incompletely for the creator, but I'm having trouble getting mypy happy with hinting args and kwargs here.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't reuse variable

Locally mypy doesn't care about this, but somehow on the CI it whines, even though the mypy version is allegedly the same.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Don't reuse variable here either

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` for_loop (#561)

* Make class "property" a plain method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor to non-None classvar

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Explicitly cast to tuple

For the sake of the name generator

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Silence mypy

It is upset about the hinting `list[hint]`, because `hint` is variable. We would be able to verify that it is a type at static analysis time, but since it comes from the body node class -- which is unknown until runtime -- it is impossible to say _which_ type.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* `mypy` finishing touches (#562)

* Make class "property" a plain method

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Refactor to non-None classvar

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Explicitly cast to tuple

For the sake of the name generator

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Silence mypy

It is upset about the hinting `list[hint]`, because `hint` is variable. We would be able to verify that it is a type at static analysis time, but since it comes from the body node class -- which is unknown until runtime -- it is impossible to say _which_ type.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Uniformly give and ignore classfactory hints

At a minimum, getting mypy to parse these correctly requires more rigorous hinting in pyiron_snippets.factory. But actually, since the classfactory allows the parent class to be specified with _multiple bases_, I'm not even 100% sure we'd ever be able to get a single type variable that could do the trick universally. In any case, for now kick the can don't the road and always hint what you know is true, then tell mypy to not worry about it.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add some hints to preview

Albeit pretty relaxed ones

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Add a return hint to Runnable.__init__

To get mypy to parse the body of the function

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

* Break loop into a method

Mypy didn't like parsing the zip variable when it could be inputs or outputs (even though both inherit from the relevant DataIO in this case), but using a separate method is functionally equivalent and mypy can get a better grasp of the type values.

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>

---------

Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Co-authored-by: Sebastian Eibl <XzzX@users.noreply.github.com>
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.

1 participant