-
Notifications
You must be signed in to change notification settings - Fork 20
Set types as attributes on the cstruct object #114
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
base: main
Are you sure you want to change the base?
Conversation
d6d2c3c to
900e933
Compare
1558ae7 to
a7a1441
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
==========================================
- Coverage 93.01% 92.91% -0.11%
==========================================
Files 21 21
Lines 2435 2470 +35
==========================================
+ Hits 2265 2295 +30
- Misses 170 175 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Some initial remarks with these changes, some projects fail to build:
|
| return name | ||
|
|
||
| def _add_attr(self, name: str, value: Any, replace: bool = False) -> None: | ||
| if not replace and (name in self.__dict__ and self.__dict__[name] != value): |
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.
| if not replace and (name in self.__dict__ and self.__dict__[name] != value): | |
| if not replace and (self.__dict__.get(name) != value): |
Or is the overhead of the function call higher?
| if name in empty_cs.consts: | ||
| continue | ||
| body.append(textwrap.indent(f"{name}: Literal[{value!r}] = ...", prefix=indent)) | ||
|
|
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.
There is an issue on L174/L185 where it now generates structures multiple times due to looking into typedefs instead of types
Closes #113
Some micro benchmarks:
Before:
After: