A trial to add type hints for EventBuffer.py
and Utils.py
#111
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.
Intro
Based on the technical report of CAGI 2024 in Nanjing presented by @MoonWalker1997, I'm interesting to the temporal part of NAL, and want to learn the specific mechanism & concrete implementation of the "Event Buffer"(EB) data structure.
In recent 2 days, I have found the source code of EB on PyNARS, and tried to understand the code in combination with the technical report in CAGI.
Now I think I have a preliminary understanding of EB, althrough it's not yet completely implemented.
Modifications
For all Python classes and functions(or method in a class) in
EventBuffer.py
andUtils.py
, I added the type hints for them assisted by MyPy type checker.It includes:
class
def
(even thedef __init__(...) -> None
)class
definition ofAnticipation
to represent its dependence ofPredictiveImplication
Other Words
I think this PR can be merged after further discussion, adjustment and development as a reference for future learners.
Due to Python's asymptotic type system, it also won't be an obstable the original development.
If I'm not suitable of this work, It can also be a code reference, which is already helped me to learn NAL-7.