-
Notifications
You must be signed in to change notification settings - Fork 18
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
Create a tool for stubs in cstruct v4 #72
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #72 +/- ##
==========================================
- Coverage 92.33% 90.83% -1.51%
==========================================
Files 20 21 +1
Lines 2180 2357 +177
==========================================
+ Hits 2013 2141 +128
- Misses 167 216 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dissect/cstruct/types/base.py
Outdated
def _type_stub(cls, name: str = "") -> str: | ||
return f"{name}: {cls.__name__}" | ||
|
||
def to_stub(cls, name: str) -> str: |
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.
Maybe name this differently? Also I think this might as well be a private method. Maybe _to_type_stub
? to_stub
might be confusing because it also makes me think of the compiler.
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.
i renamed it to to_type_stub
as it is a function that gets called externally.
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.
I don't agree on the "externally" part, I'd classify this usage as internal and would never expect anyone to ever call this externally. This is not part of any expected usage API.
so it uses <name>.<structure> instead of only <structure>
…o shadowing of names going on.
I added some more tests, and noticed there was still some issues with import stuff from a file. As all signatures/names dissapear once the stub file is there. I attempted to fix this by adding more checks in |
The only thing that does not work as intended yet is the
dereference
of pointer. As in, it doesn't return the desired type information but justT