HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.79k stars 192 forks source link

Fix infinite recursion on Windows #137

Closed ibachar-es closed 1 year ago

ibachar-es commented 2 years ago

On windows, when running using VSCode and using the integrated terminal to launch my application, _caller_path returns a path starting with c:\ (lowercase) while os.path.abspath(os.sep) return C:\ (uppercase). This causes infinite recursion in _find_file

henriquebastos commented 2 years ago

Can you please provide a test case?

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.19%.

Quality metrics Before After Change
Complexity 1.86 ⭐ 1.81 ⭐ -0.05 👍
Method Length 40.66 ⭐ 41.12 ⭐ 0.46 👎
Working memory 5.46 ⭐ 5.39 ⭐ -0.07 👍
Quality 84.47% 84.66% 0.19% 👍
Other metrics Before After Change
Lines 296 304 8
Changed files Quality Before Quality After Quality Change
decouple.py 82.34% ⭐ 82.22% ⭐ -0.12% 👎
tests/test_autoconfig.py 88.93% ⭐ 89.34% ⭐ 0.41% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
decouple.py RepositoryEnv.__init__ 10 🙂 114 🙂 11 😞 55.54% 🙂 Extract out complex expressions
decouple.py Config.get 7 ⭐ 81 🙂 11 😞 62.91% 🙂 Extract out complex expressions
decouple.py Csv.__init__ 0 ⭐ 42 ⭐ 10 😞 77.78% ⭐ Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

ibachar-es commented 1 year ago

@henriquebastos Done

ibachar-es commented 1 year ago

@henriquebastos It seems Sourcery complains about lines of code I didn't change in this PR