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

Add automatic __init__ #198

Merged
merged 5 commits into from
Feb 3, 2022
Merged

Add automatic __init__ #198

merged 5 commits into from
Feb 3, 2022

Conversation

PythonFZ
Copy link
Member

@PythonFZ PythonFZ commented Jan 21, 2022

TODO

  • Some sort of autocompletion / update the docs
  • fix merge conflicts

API

Allow for

class HelloWorld(Node):
   param1 = zn.params()
   result = zn.outs()

   def run(self):
      self.result = self.param

HelloWorld(param=25) # without defining the __init__

the created init is then __init__(self, param1=None)

@PythonFZ PythonFZ mentioned this pull request Jan 21, 2022
@PythonFZ PythonFZ requested a review from JR-1991 January 21, 2022 15:38
@PythonFZ PythonFZ requested a review from SamTov January 31, 2022 13:31
# Conflicts:
#	tests/unit_tests/utlis/test_utils.py
#	zntrack/utils/utils.py
zntrack/core/base.py Outdated Show resolved Hide resolved
Previously the signature shown in i.e. Jupyter showed only **kwargs as  arguments, now all zn.params arre listed by adding a __signature__ to the delegate.
Copy link
Collaborator

@JR-1991 JR-1991 left a comment

Choose a reason for hiding this comment

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

Meets the requirements now :-)

@PythonFZ PythonFZ merged commit 1775949 into main Feb 3, 2022
@PythonFZ PythonFZ deleted the add_auto_init branch February 3, 2022 20:03
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