Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91869323
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
Fri, Nov 15, 07:47
Size
854 B
Mime Type
text/x-python
Expires
Sun, Nov 17, 07:47 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22339316
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