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

fix TypeError when a variable name matches a builtin python function #558

Merged
merged 7 commits into from Mar 22, 2024

Conversation

tomjelen
Copy link
Contributor

@tomjelen tomjelen commented Mar 1, 2024

For example, fitting on a dataset with a column named 'exec' fails with:

ValueError: Error from parse_expr with transformed code: "(Float ('86.76248' )-exec )" 
... snip ...
TypeError: unsupported operand type(s) for -: 'Float' and 'builtin_function_or_method'

This change maps the feature names to sympy.Symbol when parsing the pysr-equation in pysr2sympy.

…nction

Example:

A dataset with a column named 'exec' failed with:

ValueError: Error from parse_expr with transformed code: "(Float ('86.76248' )-exec )"
... snip ...
TypeError: unsupported operand type(s) for -: 'Float' and 'builtin_function_or_method'
@MilesCranmer
Copy link
Owner

Thanks!

@MilesCranmer
Copy link
Owner

@tomjelen can you enable push access for maintainers? Then I can edit the PR directly.

@tomjelen
Copy link
Contributor Author

tomjelen commented Mar 3, 2024

Hey there, thanks for looking into the failed build. I don't have much experience with Conda, so could take me a while to figure out whats going on.

"Allow edits by maintainers" is checked. That's what you need right?

@MilesCranmer
Copy link
Owner

Perfect, thanks!

The segfault looks to be unrelated. Sometimes the GitHub action runners simply don't enough memory to use for the builds. But I will take a look.

@MilesCranmer
Copy link
Owner

MilesCranmer commented Mar 3, 2024

Hm, nope, it's still not letting me push to your branch. It says

! [remote rejected] tomjelen/master -> tomjelen/master (permission denied)

I'll try to figure this out... Not sure why it's doing that

I can also make a new PR from my local branch if needed, including your commit as the base.

@MilesCranmer
Copy link
Owner

Nevermind, seems like it was some issue on my side with remotes and what URL I used... Sorry for the confusion

@tomjelen
Copy link
Contributor Author

tomjelen commented Mar 3, 2024

Ah, okay. No worries :)

@MilesCranmer MilesCranmer merged commit fb5f0a1 into MilesCranmer:master Mar 22, 2024
21 checks passed
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.

None yet

2 participants