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

A trial to add type hints for EventBuffer.py and Utils.py #111

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

ARCJ137442
Copy link
Contributor

@ARCJ137442 ARCJ137442 commented Jul 25, 2024

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 and Utils.py, I added the type hints for them assisted by MyPy type checker.

It includes:

  • Fields and their types in class
  • Function signature of each def (even the def __init__(...) -> None)
  • Reorder the class definition of Anticipation to represent its dependence of PredictiveImplication
  • Some side comments containing questions or problems that may to be solved

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.

…for Python to load type annotations

Reason: the class `Anticipation` requires `PredictiveImplication` as a type dependency
@MoonWalker1997
Copy link
Collaborator

MoonWalker1997 commented Jul 25, 2024 via email

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