FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
uTensor/python/scrape_for_events.py at develop · uTensor/uTensor · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
uTensor
/
uTensor
Public
Notifications
You must be signed in to change notification settings
Fork
250
Star
1.9k
Code
Issues
51
Pull requests
5
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
uTensor
/
python
/
scrape_for_events.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (34 loc) · 896 Bytes
Breadcrumbs
uTensor
/
python
/
scrape_for_events.py
Copy path
File metadata and controls
42 lines (34 loc) · 896 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import
numpy
as
np
import
glob
import
re
from
collections
import
defaultdict
from
pprint
import
pprint
def
mHash_fnv1a
(
mStr
):
np
.
seterr
(
over
=
'ignore'
)
val_32_const
=
np
.
uint32
(
0x811c9dc5
)
prime_32_const
=
np
.
uint32
(
0x1000193
)
value
=
val_32_const
for
c
in
mStr
:
value
=
(
value
^
np
.
uint32
(
ord
(
c
)))
*
prime_32_const
return
value
def
get_target_files
():
x
=
glob
.
glob
(
'**/*.[ch]pp'
,
recursive
=
True
)
return
x
def
get_event_map
():
tgts
=
get_target_files
()
event_names
=
[]
event_map
=
defaultdict
(
list
)
for
f
in
tgts
:
with
open
(
f
)
as
fp
:
for
line
in
fp
:
m
=
re
.
match
(
"\s*DECLARE_\w+\((\w+)\)"
,
line
)
if
m
:
#print(m)
event_names
.
append
(
m
.
group
(
1
))
for
evt
in
event_names
:
x
=
mHash_fnv1a
(
evt
)
event_map
[
x
].
append
(
evt
)
pprint
(
event_map
)
return
event_map
if
__name__
==
"__main__"
:
x
=
get_event_map
()
Back
|
FazBrowse Home
|
New Git URL