j178 / leetgo

Best LeetCode friend for geek. :snowboarder:
MIT License
539 stars 32 forks source link

fix: local Python test utils overwriting built-in Python methods #158

Closed shiyang07ca closed 1 year ago

shiyang07ca commented 1 year ago

Fix local Python test utils overwriting built-in Python methods due to global module imports.

When using the --lang python -L parameter for local testing, if the following code is be tested in Python:

from leetgo_py import *
nums = [1, 2, 3,]
list(nums)

It will prompt an runtime error message: nums = list(nums) TypeError: 'module' object is not callable.

The code is mainly used to precisely control the imported content of a module leetgo_py that is imported entirely."

j178 commented 1 year ago

I just released leetgo-py 0.2.2 for the fix, you can use .venv/bin/python -m pip install -U leetgo-py to upgrade.