Check whether a file is maybe a pyc file. Detection is performed by: 1. Checking if the filename ends with ".pyc" 2. If not, reading the first 2 bytes and comparing with the magic number
(path: &str)
| 148 | /// 1. Checking if the filename ends with ".pyc" |
| 149 | /// 2. If not, reading the first 2 bytes and comparing with the magic number |
| 150 | fn maybe_pyc_file(path: &str) -> bool { |
| 151 | if path.ends_with(".pyc") { |
| 152 | return true; |
| 153 | } |
| 154 | maybe_pyc_file_with_magic(path).unwrap_or(false) |
| 155 | } |
| 156 | |
| 157 | fn maybe_pyc_file_with_magic(path: &str) -> std::io::Result<bool> { |
| 158 | let path_obj = std::path::Path::new(path); |
no test coverage detected