Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42c81fa

Browse files
committed
1.0.3 修改 imports 文件内容,将 import 语句改为了绝对路径
1 parent 6e81d13 commit 42c81fa

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
修改扩展,以满足个人需要,主要是修改使用python 语言时,添加一些自动的测试用例。
44

5+
必须使用美国网站,之后在 `Leetcode: Show Description `中选择 `Both`
6+
工作目录必须是`.leetcode` 目录,这样 `import` 才能正常工作。
7+
8+
59
以下是原项目说明。
610

711

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "python-leetcode",
33
"displayName": "PythonLeetcode",
44
"description": "Solve LeetCode problems in VS Code",
5-
"version": "1.0.2",
5+
"version": "1.0.3",
66
"author": "KuiyuanFu",
77
"publisher": "KuiyuanFu",
88
"license": "MIT",

resources/imports.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from typing import *
22
from collections import *
3+
import sys
4+
import os
5+
6+
rootPath = os.path.dirname(sys.path[0])
7+
os.chdir(rootPath)
38

49

510
class ListNode:

src/leetCodeExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class LeetCodeExecutor implements Disposable {
168168
}
169169
var t = [
170170
'# @lc imports=start',
171-
'from .imports import *',
171+
'from imports import *',
172172
'# @lc imports=end',
173173
]
174174
t.forEach(

0 commit comments

Comments
 (0)