Skip to content

Commit 629cff6

Browse files
committed
fixing tests and package versions. test work only black import is buggy.
1 parent 511df87 commit 629cff6

6 files changed

Lines changed: 21 additions & 21 deletions

File tree

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- conda-build
1313
- conda-verify
1414
- doc8
15-
- estimagic>=0.1.2
15+
- estimagic=0.4.3
1616
- fastparquet
1717
- hypothesis
1818
- joblib
@@ -49,4 +49,4 @@ dependencies:
4949
- bump2version
5050
- pytest-randomly
5151
- sphinx-tabs
52-
- chaospy>=4.2.3
52+
- chaospy==3.3.8

respy/conditional_draws.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Everything related to conditional draws for the maximum likelihood estimation."""
22
import numpy as np
3-
from estimagic.optimization.utilities import robust_cholesky
3+
from estimagic.utilities import robust_cholesky
44
from numba import guvectorize
55

66
from respy.config import MAX_FLOAT
@@ -177,7 +177,7 @@ def update_mean_and_evaluate_likelihood(
177177
invariant
178178
- log_wage_observed
179179
- np.log(sigma)
180-
- shock ** 2 / (2 * sigma_squared)
180+
- shock**2 / (2 * sigma_squared)
181181
)
182182
else:
183183
for i in range(n_choices):

respy/pre_processing/model_processing.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import numpy as np
1010
import pandas as pd
1111
import yaml
12-
from estimagic.optimization.utilities import chol_params_to_lower_triangular_matrix
13-
from estimagic.optimization.utilities import cov_params_to_matrix
14-
from estimagic.optimization.utilities import robust_cholesky
15-
from estimagic.optimization.utilities import sdcorr_params_to_matrix
12+
from estimagic.utilities import chol_params_to_lower_triangular_matrix
13+
from estimagic.utilities import cov_params_to_matrix
14+
from estimagic.utilities import robust_cholesky
15+
from estimagic.utilities import sdcorr_params_to_matrix
1616

1717
from respy.config import DEFAULT_OPTIONS
1818
from respy.config import MAX_FLOAT
@@ -189,7 +189,7 @@ def _parse_exogenous_processes(optim_paras, params):
189189
names = _parse_observable_or_exog_process_names(params, "exogenous_process")
190190

191191
for exog_proc in names:
192-
regex_pattern = fr"\bexogenous_process_{exog_proc}_([0-9a-z_]+)\b"
192+
regex_pattern = rf"\bexogenous_process_{exog_proc}_([0-9a-z_]+)\b"
193193
parsed_parameters = _parse_probabilities_or_logit_coefficients(
194194
params, regex_pattern
195195
)
@@ -205,7 +205,7 @@ def _parse_observables(optim_paras, params):
205205
names = _parse_observable_or_exog_process_names(params, "observable")
206206

207207
for observable in names:
208-
regex_pattern = fr"\bobservable_{observable}_([0-9a-z_]+)\b"
208+
regex_pattern = rf"\bobservable_{observable}_([0-9a-z_]+)\b"
209209
parsed_parameters = _parse_probabilities_or_logit_coefficients(
210210
params, regex_pattern
211211
)
@@ -286,7 +286,7 @@ def _parse_choice_parameters(optim_paras, params):
286286
def _parse_initial_and_max_experience(optim_paras, params, options):
287287
"""Process initial experience distributions and maximum experience."""
288288
for choice in optim_paras["choices_w_exp"]:
289-
regex_for_levels = fr"\binitial_exp_{choice}_([0-9]+)\b"
289+
regex_for_levels = rf"\binitial_exp_{choice}_([0-9]+)\b"
290290
parsed_parameters = _parse_probabilities_or_logit_coefficients(
291291
params, regex_for_levels
292292
)
@@ -470,7 +470,7 @@ def _infer_choices_with_prefix(params, prefix):
470470
"""
471471
return sorted(
472472
params.index.get_level_values(0)
473-
.str.extract(fr"\b{prefix}_([A-Za-z_]+)\b", expand=False)
473+
.str.extract(rf"\b{prefix}_([A-Za-z_]+)\b", expand=False)
474474
.dropna()
475475
.unique()
476476
)
@@ -544,7 +544,7 @@ def _parse_lagged_choices(optim_paras, options, params):
544544
# Add existing lagged choice parameters to ``optim_paras``.
545545
for lag in range(1, n_lc_covariates + 1):
546546
parsed_parameters = _parse_probabilities_or_logit_coefficients(
547-
params, fr"lagged_choice_{lag}_([A-Za-z_]+)"
547+
params, rf"lagged_choice_{lag}_([A-Za-z_]+)"
548548
)
549549

550550
# If there are no parameters for the specific lag, assume equiprobable choices.

respy/shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def calculate_expected_value_functions(
456456
The underlying process in this function is called `Monte Carlo integration
457457
<https://en.wikipedia.org/wiki/Monte_Carlo_integration>`_. The goal is to
458458
approximate an integral by evaluating the integrand at randomly chosen points. In
459-
this setting, one wants to approximate the expected maximum utility of the current
459+
this setting, one wants to approximate the m maximum utility of the current
460460
state.
461461
462462
Note that ``wages`` have the same length as ``nonpecs`` despite that wages are only
@@ -589,8 +589,8 @@ def pandas_dot(x, beta, out=None):
589589
if not received_out:
590590
out = np.zeros(x.shape[0])
591591

592-
for covariate, beta in beta.items():
593-
out += beta * x[covariate].values
592+
for covariate, beta_ in beta.items():
593+
out += beta_ * x[covariate].values
594594

595595
if not received_out:
596596
return out

respy/state_space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def create_is_inadmissible(df, optim_paras, options):
705705
for formula in options["negative_choice_set"][choice]:
706706
try:
707707
df[f"_{choice}"] |= df.eval(formula)
708-
except pd.core.computation.ops.UndefinedVariableError:
708+
except pd.errors.UndefinedVariableError:
709709
pass
710710

711711
return df

respy/tests/random_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import numpy as np
66
import pandas as pd
7-
from estimagic.optimization.utilities import cov_matrix_to_params
8-
from estimagic.optimization.utilities import cov_matrix_to_sdcorr_params
9-
from estimagic.optimization.utilities import number_of_triangular_elements_to_dimension
7+
from estimagic.utilities import cov_matrix_to_params
8+
from estimagic.utilities import cov_matrix_to_sdcorr_params
9+
from estimagic.utilities import number_of_triangular_elements_to_dimension
1010

1111
from respy.config import DEFAULT_OPTIONS
1212
from respy.config import ROOT_DIR
@@ -264,7 +264,7 @@ def _update_nested_dictionary(dict_, other):
264264
265265
"""
266266
for key, value in other.items():
267-
if isinstance(value, collections.Mapping):
267+
if isinstance(value, collections.abc.Mapping):
268268
dict_[key] = _update_nested_dictionary(dict_.get(key, {}), value)
269269
else:
270270
dict_[key] = value

0 commit comments

Comments
 (0)