Buckets:
MisterAI/LocalAI_Demo_backends / cpu-diffusers.upgrade-tmp /venv /lib /python3.10 /site-packages /rich /_fileno.py
| from __future__ import annotations | |
| from typing import IO, Callable | |
| def get_fileno(file_like: IO[str]) -> int | None: | |
| """Get fileno() from a file, accounting for poorly implemented file-like objects. | |
| Args: | |
| file_like (IO): A file-like object. | |
| Returns: | |
| int | None: The result of fileno if available, or None if operation failed. | |
| """ | |
| fileno: Callable[[], int] | None = getattr(file_like, "fileno", None) | |
| if fileno is not None: | |
| try: | |
| return fileno() | |
| except Exception: | |
| # `fileno` is documented as potentially raising a OSError | |
| # Alas, from the issues, there are so many poorly implemented file-like objects, | |
| # that `fileno()` can raise just about anything. | |
| return None | |
| return None | |
Xet Storage Details
- Size:
- 799 Bytes
- Xet hash:
- a2a1028078dea8027c3432415813f0d2db678d87dc5a9df9d0ff0582b9a139af
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.