This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Core: Add reference
#69
Merged
mawildoer
merged 14 commits into
mawildoer/reduced-trait-verbosity
from
mawildoer/magic_pointers
Sep 23, 2024
Merged
Core: Add reference
#69
mawildoer
merged 14 commits into
mawildoer/reduced-trait-verbosity
from
mawildoer/magic_pointers
Sep 23, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mawildoer
force-pushed
the
mawildoer/magic_pointers
branch
from
September 20, 2024 13:27
63a190d
to
c0358cf
Compare
mawildoer
commented
Sep 20, 2024
@@ -145,6 +155,14 @@ def __init__(self, node: "Node", other: "Node", *args: object) -> None: | |||
class NodeNoParent(NodeException): ... | |||
|
|||
|
|||
class InitVar(dataclass_InitVar): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this belong in Node
?
src/faebryk/core/node.py
Outdated
@@ -709,3 +743,48 @@ def zip_children_by_name_with[N: Node]( | |||
@staticmethod | |||
def with_names[N: Node](nodes: Iterable[N]) -> dict[str, N]: | |||
return {n.get_name(): n for n in nodes} | |||
|
|||
|
|||
def magic_pointer[O: Node](out_type: type[O] | None = None) -> O: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this belong in Node
? It'd be the only classmethod
a dev would typically touch in it, but it's also fewer imports and precisely node-related, so maybe 🤷♂️
mawildoer
force-pushed
the
mawildoer/magic_pointers
branch
from
September 22, 2024 16:46
c0358cf
to
4fbc245
Compare
mawildoer
changed the base branch from
mawildoer/constraint-params
to
mawildoer/reduced-trait-verbosity
September 22, 2024 16:49
mawildoer
changed the title
Core: Add megic_pointer to generate convenient references
Library: Add Sep 22, 2024
Reference
iopapamanoglou
approved these changes
Sep 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Love the Pointer and better test_basic.
…utes during node construction
Merged
mawildoer
added a commit
that referenced
this pull request
Sep 23, 2024
Additionally, simplify the trait impl implementation and extend trait testing * Core: Add `reference` (#69) * Core: Add megic_pointer to generate convenient references * Library: Move Reference to library and add some polish * Library: Add has_reference trait * Get the references passing pre-commit * Test: refactor test_basic.py to work as a pytest properly * Library: Move reference back to core. Apparently library doesn't like it * Test: Refactor test_basic with clear criteria * Improved basic test; use type_pair * graphinterface connect tying * Address incidious underlying properties * Add check to ensure properties aren't instantiated as instance attributes during node construction * Reinstate better errors on field construction * Add util to check debugging * pre-commit --------- Co-authored-by: iopapamanoglou <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The graph is the correct way to draw references between Nodes, however, it's a PITA.
PR adds
magic_pointer
to make it easy to appropriately point at other NodesChecklist
Please read and execute the following:
Code of Conduct
By submitting this issue, you agree to follow our Code of Conduct: