Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
1a693391
Commit
1a693391
authored
Nov 01, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
b0f8c09f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
python/tools/garble/activity_garble.py
+10
-3
No files found.
python/tools/garble/activity_garble.py
View file @
1a693391
...
@@ -21,13 +21,20 @@ class ActivityGarble:
...
@@ -21,13 +21,20 @@ class ActivityGarble:
#替换文件内容
#替换文件内容
def
__process_file_content
(
self
,
path
,
file_name
):
def
__process_file_content
(
self
,
path
,
file_name
):
# print("processing content: %s..."%path)
# print("processing content: %s..."%path)
chars
=
"_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
.
split
(
""
)
with
open
(
path
,
"rt"
)
as
fin
:
with
open
(
path
,
"rt"
)
as
fin
:
file_content
=
fin
.
read
()
file_content
=
fin
.
read
()
# replace the file content based on mangle settings
# replace the file content based on mangle settings
for
(
src
,
dst
)
in
self
.
activity_mapping
.
items
():
for
(
src
,
dst
)
in
self
.
activity_mapping
.
items
():
separator
=
[
" "
,
"."
,
"
\"
"
,
"{"
,
"}"
,
"("
,
")"
,
"["
,
"]"
,
"<"
,
">"
,
":"
,
";"
,
","
]
#避免命名重复,确保要替换的部分前后没有合法的命名字符,如果有则还原
for
sep
in
separator
:
file_content
=
file_content
.
replace
(
src
,
dst
)
file_content
=
file_content
.
replace
(
src
+
sep
,
dst
+
sep
)
.
replace
(
sep
+
src
,
sep
+
dst
)
for
char
in
chars
:
if
char
+
dst
in
file_content
:
file_content
=
file_content
.
replace
(
char
+
dst
,
char
+
src
)
elif
dst
+
char
in
file_content
:
file_content
=
file_content
.
replace
(
dst
+
char
,
src
+
char
)
ext
=
os
.
path
.
splitext
(
file_name
)[
1
]
ext
=
os
.
path
.
splitext
(
file_name
)[
1
]
if
ext
==
'.java'
:
if
ext
==
'.java'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment