Skip to content

Merge from master - #23

Open
BenhaoQu wants to merge 364 commits into
demo_masterfrom
master
Open

BenhaoQu wants to merge 364 commits into
demo_masterfrom
master

Conversation

@BenhaoQu

Copy link
Copy Markdown
Owner

This is an auto-generated PR to sync changes from the master branch to demo_master.

QuBenhao and others added 30 commits June 25, 2026 05:33
- P0-1: add /htmlcov/ and /.venv/ to .gitignore
- P0-2: use shared session with retry in rating.py and ranking_crawler.py
- P0-3: upgrade actions/setup-python from v2 to v5
- P0-4: remove .DS_Store files
- P1-5: extract nested closures in favorite_main to module-level functions
- P1-8: replace recursive retry in http_tool.py with iterative loop
- P2-9: remove unused numpy dependency from requirements.txt
- P2-10: add DeprecationWarning to submit.py
- P2-11: hoist subprocess import to top-level in leetcode.py
- P2-13: remove redundant -D_GLIBCXX_USE_CXX11_ABI=1 from README bazel commands
submit.py serves direct CLI submission, leetcode.py is interactive.
They are complementary, not deprecated/replacement.
…Python/Go/Rust/TS

Python optimizations:
- P0-1: Add python/_path.py for unified sys.path setup (15 scripts)
- P0-2: Consolidate load_dotenv() calls in tools.py to __main__ entry
- P0-3: ranking_crawler.py bare except -> except Exception
- P0-4: time_util.py timeout decorator rewritten with ThreadPoolExecutor
- P0-5: notify.py remove internal load_dotenv, caller handles env init
- P0-6: language_writer.py change_tests uses param folder, not env read
- P0-7: daily_submission.py use absolute import for daily_auto
- P0-8: Add init_env() helper, simplify submit.py and get_problem.py
- P0-9: batch_link_lcr.py reuse MAIN_SITE_SAME_PATTERN from similarity.py

Cross-language optimizations:
- go_setup.py and cargo_setup.py now import resolve_link from python.utils
- go_setup.py and cargo_setup.py use init_env() instead of manual .env parsing
- TypeScript: add shared env.ts module for centralized PROBLEM_FOLDER access

Tests: 193 passed, 1 skipped
The original approach had a circular dependency:
- 'from python._path import ...' requires 'python' in sys.path
- But _path.py's purpose was to add 'python' to sys.path

Solution: inline bootstrap logic in each script:
  import sys; from pathlib import Path
  _root = Path(__file__).resolve().parents[2]
  sys.path.insert(0, str(_root))

Also fixed submit.py missing 'rp' variable after refactor.
root_path is used throughout leetcode.py for .env path, data paths,
and various operations. It was accidentally removed during refactor.
LeetCode API returns 0 for passedTestCaseCnt and totalTestCaseCnt
on Accepted submissions. Derive total count from testInfo array
length when these fields are falsy, and set passed count equal to
total for Accepted status.

Closes QuBenhao#190
Add _strip_hidden to Python3Writer.write_problem_md: drop hidden
injection spans (opacity:0 / visibility:hidden / display:none /
height:0px), Google-Translate gtx-trans overlays, and zero-width
Unicode watermarks (U+200B etc.) before writing problem docs.
Delete whole elements via a depth-balanced stack so tags stay
balanced; guard the loop so malformed/unclosed tags cannot hang.
actions-user and others added 30 commits November 6, 2026 21:07
Update the State Council holiday notice embedded in spider.py to the
2027 arrangement, regenerate data/holiday.json (29 holiday days, 5
makeup workdays), and cover the new year in tests/time_test.py.
Normalize PROBLEM_FOLDER before building paths so explicit IDs, slugs and
daily submissions fall back to the documented default instead of crashing
on None; keep explicit overrides and the paid-only premiums folder.

Return meaningful exit statuses: 0 only for a confirmed Accepted result,
1 for submission/network/result failures, and 2 for missing configuration
or credentials. Optional article retrieval no longer affects the status,
and the interactive caller reports non-zero language submissions.

Prefer .venv/bin/python in Makefile test targets with a PYTHON override,
and align README examples and owner-terminal configuration notes.

Add mocked, isolated regression tests covering invocation modes, folder
defaults, Accepted/non-Accepted results, missing credentials, network
errors and optional article failures.
Prefer the executable project virtualenv, then python3 or python, while honoring PYTHON overrides from the environment and make command line. Run pytest and pip through that interpreter and align English and Chinese setup instructions. Validate with the complete tracked data tree rather than the earlier incomplete fixture copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants