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, orNoneif operation failed. """
fileno: Callable[[], int] | None = getattr(file_like, "fileno", None) if fileno isnotNone: 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. returnNone returnNone
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.