Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-python
Manage
Activity
Members
Plan
Custom issue tracker
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-python
Commits
3bfb1141
Commit
3bfb1141
authored
2 years ago
by
antondmtvch
Browse files
Options
Downloads
Patches
Plain Diff
Реализован скрипт замены некорректных импортов
parent
38fdb61e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+2
-1
2 additions, 1 deletion
Makefile
fix_imports.py
+31
-0
31 additions, 0 deletions
fix_imports.py
with
33 additions
and
1 deletion
Makefile
+
2
−
1
View file @
3bfb1141
...
@@ -23,7 +23,7 @@ clean-build:
...
@@ -23,7 +23,7 @@ clean-build:
rm
-fr
dist/
rm
-fr
dist/
rm
-fr
.eggs/
rm
-fr
.eggs/
find
.
-name
'*.egg-info'
-exec
rm
-fr
{}
+
find
.
-name
'*.egg-info'
-exec
rm
-fr
{}
+
find
.
-name
'*.egg'
-exec
rm
-f
{}
+
find
.
-name
'*.egg'
-exec
rm
-f
{}
+
||
true
clean-pyc
:
clean-pyc
:
find
.
-name
'*.pyc'
-exec
rm
-f
{}
+
find
.
-name
'*.pyc'
-exec
rm
-f
{}
+
...
@@ -62,3 +62,4 @@ release: dist
...
@@ -62,3 +62,4 @@ release: dist
install
:
clean generate install-requirements
install
:
clean generate install-requirements
python setup.py
install
python setup.py
install
python fix_imports.py
This diff is collapsed.
Click to expand it.
fix_imports.py
0 → 100644
+
31
−
0
View file @
3bfb1141
import
re
import
os
from
pathlib
import
Path
REGEXP
=
re
.
compile
(
r
"
(from )
"
r
"
(
"
r
"
clients|collaborators|collections|common|delivery|environments|extensions|files|images|invitations
"
r
"
|items|locales|members|organizations|references|roles|spaces|status|users|versions.+|
"
r
"
)
"
r
"
( import.*pb2)
"
)
PERXIS_DIR_NAME
=
"
perxis
"
PERXIS_PATH
=
(
Path
(
__file__
).
parent
.
absolute
()).
joinpath
(
PERXIS_DIR_NAME
)
def
main
():
for
path
,
_
,
files
in
os
.
walk
(
PERXIS_PATH
):
for
name
in
files
:
file_path
=
os
.
path
.
join
(
path
,
name
)
with
open
(
file_path
,
"
r+
"
)
as
f
:
text
=
f
.
read
()
result
=
re
.
sub
(
REGEXP
,
rf
"
\1
{
PERXIS_DIR_NAME
}
.\2\3
"
,
text
)
f
.
seek
(
0
)
f
.
write
(
result
)
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment