Returns the list of Transformers submodules.
()
| 239 | |
| 240 | |
| 241 | def get_transformers_submodules(): |
| 242 | """ |
| 243 | Returns the list of Transformers submodules. |
| 244 | """ |
| 245 | submodules = [] |
| 246 | for path, directories, files in os.walk(PATH_TO_TRANSFORMERS): |
| 247 | for folder in directories: |
| 248 | # Ignore private modules |
| 249 | if folder.startswith("_"): |
| 250 | directories.remove(folder) |
| 251 | continue |
| 252 | # Ignore leftovers from branches (empty folders apart from pycache) |
| 253 | if len(list((Path(path) / folder).glob("*.py"))) == 0: |
| 254 | continue |
| 255 | short_path = str((Path(path) / folder).relative_to(PATH_TO_TRANSFORMERS)) |
| 256 | submodule = short_path.replace(os.path.sep, ".") |
| 257 | submodules.append(submodule) |
| 258 | for fname in files: |
| 259 | if fname == "__init__.py": |
| 260 | continue |
| 261 | short_path = str((Path(path) / fname).relative_to(PATH_TO_TRANSFORMERS)) |
| 262 | submodule = short_path.replace(".py", "").replace(os.path.sep, ".") |
| 263 | if len(submodule.split(".")) == 1: |
| 264 | submodules.append(submodule) |
| 265 | return submodules |
| 266 | |
| 267 | |
| 268 | IGNORE_SUBMODULES = [ |
no test coverage detected