-
Notifications
You must be signed in to change notification settings - Fork 36
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
Adding literals to feols and fepois api's #680
Conversation
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Looks very good to me. Will leave this open until tomorrow to see if @leostimpfle has some thoughs, and then merge after we get his feedback. Thanks @marcandre259!
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.
Thanks @marcandre259 ! Looks good to me overall, just have a few comments
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
pre-commit.ci autofix |
It's a little bit annoying, but whenever the autofix corrects code, one has to run it again to pass the checks (because the previous did not pass as it triggered the fix) @marcandre259 |
Looks like pyfixest/estimation/literals.py:1: error: Module "typing" has no attribute "_LiteralGenericAlias" [attr-defined] Maybe we can simply check for a literal type via smth like if get_origin(literal) is not Literal:
raise TypeError("Expected a Literal type as the second argument") ? I would not overthink this as it's in the end behavior we would (hopefully) catch in a review process? |
Another thing I oversaw in my initial review - pyfixest/pyfixest/estimation/estimation.py Line 617 in a3ed27a
Maybe we could update them to use the Literal validation function whenever relevant? |
Hi @s3alfisc, Indeed, I'll modify it with a similar check. I did notice that Literal was not really a type without being specific Literal["..."], at least when trying out type(literal) is Literal. But maybe it works with get_origin then? |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Thanks @marcandre259 ! This looks good to me know =) |
Just fyi @marcandre259 , the test failures in the main branch stem back from changes to the actions wfl I merged yesterday and are completely unrelated to this PR =) |
* Adding literals to feols and fepois api's * Adding docstring * Fix lpdid argument vcov * literal type * hunting vcov literals * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Changes refering to initial review * Whac-a-mole based development * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Check length of valid_types instead looking for generic literal type * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Reference to #671. Pretty literal interpretation. Added a small validate_literal_argument function, taken from the predict method of Feols (assumption is it may be used elsewhere also).