File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
crates/plugins/python3/src Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -20,20 +20,19 @@ impl StudentFilePolicy for Python3StudentFilePolicy {
2020 }
2121
2222 fn is_non_extra_student_file ( & self , path : & Path ) -> bool {
23- // never include pyc files
24- let is_pyc = path. extension ( ) == Some ( OsStr :: new ( "pyc" ) ) ;
25- if is_pyc {
26- return false ;
27- }
28-
29- let in_src = path. starts_with ( "src" ) ;
30- let in_exercise_root = match path. parent ( ) {
31- Some ( s) => s. as_os_str ( ) . is_empty ( ) ,
32- None => true ,
33- } ;
23+ // include all .py and .ipynb files,
24+ // since python project structure is more freeform than most languages
25+ // so there may not be a src dir etc.
26+ // but exclude venv, test and tmc dirs
27+
28+ let in_venv = path. starts_with ( "venv" ) || path. starts_with ( ".venv" ) ;
29+ let in_test = path. starts_with ( "test" ) ;
30+ let in_tmc = path. starts_with ( "tmc" ) ;
31+ let excluded = in_venv || in_test || in_tmc;
32+
3433 let is_py = path. extension ( ) == Some ( OsStr :: new ( "py" ) ) ;
3534 let is_ipynb = path. extension ( ) == Some ( OsStr :: new ( "ipynb" ) ) ;
36- ( in_src || in_exercise_root ) && ( is_py || is_ipynb)
35+ !excluded && ( is_py || is_ipynb)
3736 }
3837}
3938
You can’t perform that action at this time.
0 commit comments