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
bc68adfa
Commit
bc68adfa
authored
Oct 23, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
930a4cb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
python/tools/garbel/class_builder.py
+5
-4
python/tools/garbel/manifest_grable.py
+1
-1
No files found.
python/tools/garbel/class_builder.py
View file @
bc68adfa
...
...
@@ -5,7 +5,7 @@ class ClassBuilder:
__used_names
=
[]
__variables
=
[]
__functions
=
[]
__class_name
=
""
def
__gen_rand_str
(
self
):
result
=
""
while
len
(
result
)
==
0
or
result
in
self
.
__used_names
:
...
...
@@ -85,10 +85,10 @@ class ClassBuilder:
log_code
=
""
for
i
in
range
(
0
,
random
.
randint
(
0
,
5
)):
log_code
+=
"Log.
%
s(
\"
%
s
\"
);
\n
"
%
(
log_code
+=
"Log.
%
s(
\"
%
s
\"
,
\"
%
s
\"
);
\n
"
%
(
self
.
__class_name
,
''
.
join
(
random
.
sample
(
"idew"
,
random
.
randint
(
1
,
1
))),
''
.
join
(
random
.
sample
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
,
random
.
randint
(
5
,
15
)))
''
.
join
(
random
.
sample
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
,
random
.
randint
(
5
,
15
)))
)
fun_content
=
fun_content
.
replace
(
...
...
@@ -116,6 +116,7 @@ class ClassBuilder:
def
new_class
(
self
,
class_name
,
pkg_name
):
self
.
__class_name
=
class_name
self
.
__generate_variable
()
self
.
__generate_function
(
"tools/garbel/model/function_model.java"
)
class_content
=
self
.
__generate_class
(
"tools/garbel/model/activity_model.java"
)
...
...
python/tools/garbel/manifest_grable.py
View file @
bc68adfa
...
...
@@ -19,8 +19,8 @@ class ManifestGarble:
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
if
len
(
files
)
>
0
:
for
i
in
range
(
0
,
random
.
randint
(
3
,
10
)):
act_path
=
"
%
s/
%
s.java"
%
(
root
,
self
.
__gen_rand_str
())
act_name
=
self
.
__gen_rand_str
()
act_path
=
"
%
s/
%
s.java"
%
(
root
,
act_name
)
pkg_name
=
root
.
split
(
"main/java/"
)[
1
]
.
replace
(
"/"
,
"."
)
act_content
=
ClassBuilder
()
.
new_class
(
act_name
,
pkg_name
)
with
open
(
act_path
,
"w+"
,
encoding
=
"utf-8"
)
as
fout
:
...
...
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