bambinos / formulae

Formulas for mixed-effects models in Python
https://bambinos.github.io/formulae/
MIT License
56 stars 14 forks source link

Make formulae reach transformations before outer names #109

Closed tomicapretto closed 8 months ago

tomicapretto commented 8 months ago

All the environment machinery built into formulae was working in such a way that names in "outer" environments were reached before the names of "internal" transformations. This caused these kind of problems

p = 1
design_matrices("p(y, n) ~ 1", df)
TypeError: 'int' object is not callable

This PR changes the order in which namespaces are added into the environment so transformations and encodings are reached first.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (9bcd01a) 92.62% compared to head (7df836c) 92.63%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #109 +/- ## ======================================= Coverage 92.62% 92.63% ======================================= Files 20 20 Lines 2225 2227 +2 ======================================= + Hits 2061 2063 +2 Misses 164 164 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.