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

Support for typing and dataclass fields #115

Open
waszil opened this issue Sep 23, 2020 · 1 comment · May be fixed by #116
Open

Support for typing and dataclass fields #115

waszil opened this issue Sep 23, 2020 · 1 comment · May be fixed by #116

Comments

@waszil
Copy link

waszil commented Sep 23, 2020

Hi, great package!

I have one problem: automodapi seems to ignore dataclass fields if they are initialized with the field method or annotated with a typing type:

from dataclasses import dataclass
from typing import Optional, List

@dataclass
class MyClass:
    """description"""
    #: this is ok
    ok: int = 0
    #: this does not get generated
    notok: Optional[int] = None
    #: this does not get generated either
    foo: List[int] = field(default_factory=list)

Is there a solution for this?
Thanks!

@waszil waszil linked a pull request Sep 23, 2020 that will close this issue
@waszil
Copy link
Author

waszil commented Sep 23, 2020

I have created a PR for fixing this: #116

fzeiser added a commit to oslocyclotronlab/ompy that referenced this issue Jan 14, 2021
* optional arguments
In #161 some additional parameters were added to
`NormalizationParameters`. This caused trouble in `NormalizerGSF`, which
assumed that all parameters/attributes in `NormalizationParameters`
have to be set.
For now, I added a exclude_check_change attribute
to mark the real optional arguments. Alternatively NormalizerGSF
could be set to look just for some specific parameters it needs.

* Sphinx docs:
Workaround for documentation of non default members. Necessary due to astropy/sphinx-automodapi#115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants