Return a valid python filename in the current directory. If the given name is not a file, it adds '.py' and searches again. Raises IOError with an informative message if the file isn't found.
(name)
| 74 | return path |
| 75 | |
| 76 | def get_py_filename(name): |
| 77 | """Return a valid python filename in the current directory. |
| 78 | |
| 79 | If the given name is not a file, it adds '.py' and searches again. |
| 80 | Raises IOError with an informative message if the file isn't found. |
| 81 | """ |
| 82 | |
| 83 | name = os.path.expanduser(name) |
| 84 | if os.path.isfile(name): |
| 85 | return name |
| 86 | if not name.endswith(".py"): |
| 87 | py_name = name + ".py" |
| 88 | if os.path.isfile(py_name): |
| 89 | return py_name |
| 90 | raise IOError("File `%r` not found." % name) |
| 91 | |
| 92 | |
| 93 | def filefind(filename: str, path_dirs=None) -> str: |
no outgoing calls
no test coverage detected
searching dependent graphs…