Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121674468
workspace.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 13, 01:20
Size
854 B
Mime Type
text/x-python
Expires
Tue, Jul 15, 01:20 (2 d)
Engine
blob
Format
Raw Data
Handle
27372242
Attached To
rAKA akantu
workspace.py
View Options
import
os
SRC_SUFFIX
=
[
'.c'
,
'.cpp'
,
'.cc'
,
'.cxx'
]
class
Workspace
:
def
__init__
(
self
,
include_paths
):
self
.
include_paths
=
include_paths
def
calculate
(
self
):
paths
=
[]
for
path
in
self
.
include_paths
:
if
os
.
path
.
isdir
(
path
):
paths
.
extend
(
self
.
_walk
(
path
))
elif
self
.
should_include
(
path
):
paths
.
append
(
path
)
return
[
os
.
path
.
join
(
'/code'
,
path
)
for
path
in
paths
]
def
should_include
(
self
,
name
):
return
name
.
lower
()
.
endswith
(
tuple
(
SRC_SUFFIX
))
def
_walk
(
self
,
path
):
paths
=
[]
for
root
,
_directories
,
files
in
os
.
walk
(
path
):
for
name
in
files
:
if
self
.
should_include
(
name
):
path
=
os
.
path
.
join
(
root
,
name
)
paths
.
append
(
path
)
return
paths
Event Timeline
Log In to Comment