Skip to content
GitLab
探索
项目
群组
代码片段
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录
切换导航
菜单
打开侧边栏
ExternalRepo
isort
提交
2c591586
提交
2c591586
编辑于
6年前
作者:
Timothy Crosley
浏览文件
操作
下载
电子邮件补丁
差异文件
Initial work toward fixing issue #873
上级
bcec89b0
old-master
feature/fix-issue-890
feature/fix-issue-895
issue/942
4.3.21-2
4.3.20
4.3.19
4.3.18
4.3.17
4.3.16
4.3.15
4.3.13
4.3.12
4.3.11
无相关合并请求
变更
6
Hide whitespace changes
Inline
Side-by-side
显示
6 个更改的文件
.env
+4
-4
.env
.gitignore
+1
-1
.gitignore
CHANGELOG.md
+2
-0
CHANGELOG.md
isort/isort.py
+2
-2
isort/isort.py
isort/main.py
+3
-7
isort/main.py
isort/settings.py
+8
-2
isort/settings.py
有
20 个添加
和
16 个删除
+20
-16
.env
+
4
-
4
浏览文件 @
2c591586
...
...
@@ -12,7 +12,7 @@ fi
export
PROJECT_NAME
=
$OPEN_PROJECT_NAME
export
PROJECT_DIR
=
"
$PWD
"
if
[
!
-d
"venv"
]
;
then
if
[
!
-d
"
.
venv"
]
;
then
if
!
hash
pyvenv 2>/dev/null
;
then
function
pyvenv
()
{
...
...
@@ -31,13 +31,13 @@ if [ ! -d "venv" ]; then
fi
echo
"Making venv for
$PROJECT_NAME
"
pyvenv venv
.
venv/bin/activate
pyvenv
.
venv
.
.
venv/bin/activate
python setup.py
install
pip
install
-r
requirements.txt
fi
.
venv/bin/activate
.
.
venv/bin/activate
# Let's make sure this is a hubflow enabled repo
yes
| git hf init
>
/dev/null 2>/dev/null
...
...
This diff is collapsed.
Click to expand it.
.gitignore
+
1
-
1
浏览文件 @
2c591586
...
...
@@ -65,5 +65,5 @@ atlassian-ide-plugin.xml
pip-selfcheck.json
# Python3 Venv Files
venv/
.
venv/
pyvenv.cfg
This diff is collapsed.
Click to expand it.
CHANGELOG.md
+
2
-
0
浏览文件 @
2c591586
...
...
@@ -2,6 +2,8 @@ Changelog
=========
### 4.3.11 - March 3, 2019 - hot fix release
-
Fixed issue #876: confused by symlinks pointing to virtualenv gives FIRSTPARTY not THIRDPARTY
-
Fixed issue #873: current version skips every file on travis
-
Additional caching to reduce performance regression introduced in 4.3.5
### 4.3.10 - March 2, 2019 - hot fix release
-
Fixed Windows incompatibilities (Issue #835)
...
...
This diff is collapsed.
Click to expand it.
isort/isort.py
+
2
-
2
浏览文件 @
2c591586
...
...
@@ -47,7 +47,7 @@ class SortImports(object):
skipped
=
False
def
__init__
(
self
,
file_path
=
None
,
file_contents
=
None
,
write_to_stdout
=
False
,
check
=
False
,
show_diff
=
False
,
settings_path
=
None
,
ask_to_apply
=
False
,
**
setting_overrides
):
show_diff
=
False
,
settings_path
=
None
,
ask_to_apply
=
False
,
check_skip
=
True
,
**
setting_overrides
):
if
not
settings_path
and
file_path
:
settings_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
file_path
))
settings_path
=
settings_path
or
os
.
getcwd
()
...
...
@@ -93,7 +93,7 @@ class SortImports(object):
self
.
file_path
=
file_path
or
""
if
file_path
:
file_path
=
os
.
path
.
abspath
(
file_path
)
if
settings
.
should_skip
(
file_path
,
self
.
config
):
if
check_skip
and
settings
.
should_skip
(
file_path
,
self
.
config
):
self
.
skipped
=
True
if
self
.
config
[
'verbose'
]:
print
(
"WARNING: {0} was skipped as it's listed in 'skip' setting"
...
...
This diff is collapsed.
Click to expand it.
isort/main.py
+
3
-
7
浏览文件 @
2c591586
...
...
@@ -83,7 +83,7 @@ class SortAttempt(object):
def
sort_imports
(
file_name
,
**
arguments
):
try
:
result
=
SortImports
(
file_name
,
**
arguments
)
result
=
SortImports
(
file_name
,
check_skip
=
False
,
**
arguments
)
return
SortAttempt
(
result
.
incorrectly_sorted
,
result
.
skipped
)
except
IOError
as
e
:
print
(
"WARNING: Unable to parse file {0} due to {1}"
.
format
(
file_name
,
e
))
...
...
@@ -97,21 +97,17 @@ def iter_source_code(paths, config, skipped):
for
path
in
paths
:
if
os
.
path
.
isdir
(
path
):
if
should_skip
(
path
,
config
,
os
.
getcwd
()):
skipped
.
append
(
path
)
continue
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
path
,
topdown
=
True
,
followlinks
=
True
):
for
dirname
in
list
(
dirnames
):
if
should_skip
(
dirname
,
config
,
dirpath
):
if
should_skip
(
dirname
,
config
,
dirpath
,
paths
):
skipped
.
append
(
dirname
)
dirnames
.
remove
(
dirname
)
for
filename
in
filenames
:
filepath
=
os
.
path
.
join
(
dirpath
,
filename
)
if
is_python_file
(
filepath
):
if
should_skip
(
filename
,
config
,
dirpath
):
if
should_skip
(
filename
,
config
,
dirpath
,
paths
):
skipped
.
append
(
filename
)
else
:
yield
filepath
...
...
This diff is collapsed.
Click to expand it.
isort/settings.py
+
8
-
2
浏览文件 @
2c591586
...
...
@@ -317,16 +317,22 @@ def _get_config_data(file_path, sections):
def
should_skip
(
filename
,
config
,
path
=
''
):
"""Returns True if the file should be skipped based on the passed in settings."""
"""Returns True if the file
and/or folder
should be skipped based on the passed in settings."""
os_path
=
os
.
path
.
join
(
path
,
filename
)
normalized_path
=
os_path
.
replace
(
'
\\
'
,
'/'
)
if
normalized_path
[
1
:
2
]
==
':'
:
normalized_path
=
normalized_path
[
2
:]
if
config
[
'safety_excludes'
]
and
safety_exclude_re
.
search
(
normalized_path
):
if
config
[
'safety_excludes'
]
and
safety_exclude_re
.
search
(
'/'
+
filename
(
'
\\
'
,
'/'
)
+
'/'
):
return
True
for
skip_path
in
config
[
'skip'
]:
for
specified_path
in
specified_paths
:
normalized_specified_path
=
specified_path
.
replace
(
'
\\
'
,
'/'
)
if
normalized_path
.
startswith
(
normalized_specified_path
):
normalized_path_skip
=
normalized_specified_path
if
posixpath
.
abspath
(
normalized_path
)
==
posixpath
.
abspath
(
skip_path
.
replace
(
'
\\
'
,
'/'
)):
return
True
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
菜单
探索
项目
群组
代码片段