adriangb / di

Pythonic dependency injection
https://www.adriangb.com/di/
MIT License
301 stars 13 forks source link

chore: refactor solver #78

Closed adriangb closed 2 years ago

adriangb commented 2 years ago

Bringing over changes from #77.

The main con here is that solving will now break for DAGs > 1000 levels deep (the default recursion limit in Python). I can't imagine a sensible use case where this would be a problem, so I think this change is worth it because it simplifies the solver quite a bit.

codecov-commenter commented 2 years ago

Codecov Report

Merging #78 (e5b2140) into main (9cdfb71) will decrease coverage by 0.10%. The diff coverage is 96.15%.

@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   97.12%   97.02%   -0.11%     
==========================================
  Files          72       70       -2     
  Lines        2158     2115      -43     
  Branches      352      340      -12     
==========================================
- Hits         2096     2052      -44     
- Misses         52       53       +1     
  Partials       10       10              
Impacted Files Coverage Δ
di/container/_solving.py 97.53% <96.00%> (-1.39%) :arrow_down:
tests/test_dependency_cycles.py 100.00% <100.00%> (ø)
tests/test_solving.py 96.89% <100.00%> (ø)