(path: &Path)
| 85 | } |
| 86 | |
| 87 | fn check_python(path: &Path) -> Option<PathBuf> { |
| 88 | if path.is_file() { |
| 89 | if let Some(ext) = path.extension() { |
| 90 | if ext == "py" { |
| 91 | return Some(path.to_path_buf()); |
| 92 | } |
| 93 | } |
| 94 | None |
| 95 | } else { |
| 96 | let mut buf = path.to_path_buf(); |
| 97 | buf.push("__init__.py"); |
| 98 | if buf.exists() { |
| 99 | buf.pop(); |
| 100 | Some(buf) |
| 101 | } else { |
| 102 | None |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | } |