Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90526441
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
Sat, Nov 2, 11:55
Size
812 B
Mime Type
text/x-python
Expires
Mon, Nov 4, 11:55 (2 d)
Engine
blob
Format
Raw Data
Handle
22069943
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
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