QuantEcon / QuantEcon/QuantEcon.py
MAINT: Code-hygiene quick wins: dead code, bare excepts, broken test block, comparison anti-patterns
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 3
Description
Problem
Small, independent hygiene defects that don't merit separate issues:
quantecon/util/common_messages.py— one message string, referenced nowhere, untouched since 2018, pointing to the defunct continuum.io downloads page. Delete.quantecon/__init__.py:9-13— bareexcept:(catchesKeyboardInterrupt/SystemExitduring import) aroundimport numba, discarding the original exception and raising a conda-specific message — wrong for pip users, and it hides the real traceback in the common numba/llvmlite ABI-mismatch case. Replace withexcept ImportError as e: raise ImportError(<pip-and-conda message>) from e, or delete the guard and let the natural ImportError speak. The file-level# flake8: noqamasks this today.quantecon/tests/test_quadsum.py:59-63— nose-era__main__block calling undefined names (test_simplesum,test_identitysum; dangling uncalledtest_m_identitysum). Running the file directly raisesNameError; the source of all 3 F821s in the package. Delete the block.- Comparison anti-patterns:
_dle.py:246isinstance(...) == True;_dle.py:280andutil/notebooks.py:77type(x) != np.ndarray→isinstance(deep DLE work stays in #844 — these lines needn't wait). quantecon/markov/tests/test_graph_tools.py:137— bareexcept:→except KeyError:.util/timing.py:247—__exit__bindsexc_type, exc_val, exc_tbunused.game_theory/game_generators/__init__.py:6— the package's loneimport *; make it explicit.
Acceptance criteria
- Full
flake8 quanteconrun reports zero F821/E722/E712/E721 -
common_messages.pygone; suite green; no behavior change anywhere else
From the July 2026 technical-debt audit (AI-assisted; claims verified against 28d4b3b on 2026-07-25).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the file and line references in quantecon/util/common_messages.py, quantecon/init.py, quantecon/tests/test_quadsum.py, _dle.py, util/notebooks.py, markov/tests/test_graph_tools.py, util/timing.py, and game_theory/game_generators/init.py. Run the affected tests and full flake8 quantecon; done means zero F821/E722/E712/E721, the unused message is gone, and the suite remains green without other behavior changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa, tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100