Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/smart_open/_typing.py: 0%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

16 statements  

1# 

2# Copyright (C) 2026 Radim Rehurek <me@radimrehurek.com> 

3# 

4# This code is distributed under the terms and conditions 

5# from the MIT License (MIT). 

6# 

7 

8"""Shared type aliases for ``smart_open``'s public and internal APIs. 

9 

10For internal use only. These aliases keep the type annotations consistent 

11across the transport, compression and top-level modules. 

12""" 

13 

14from __future__ import annotations 

15 

16import os 

17from collections.abc import Callable 

18from typing import IO, Any, TypeAlias 

19 

20FileObj: TypeAlias = IO[Any] 

21"""A binary or text file-like object, as returned by :func:`smart_open.open`.""" 

22 

23Uri: TypeAlias = str | os.PathLike[str] | int | IO[bytes] 

24"""Anything :func:`smart_open.open` accepts as its first argument.""" 

25 

26TransportParams: TypeAlias = dict[str, Any] 

27"""Per-transport keyword arguments forwarded by :func:`smart_open.open`.""" 

28 

29CompressionKwargs: TypeAlias = dict[str, Any] 

30"""Keyword arguments forwarded to a registered compressor callback.""" 

31 

32Compressor: TypeAlias = Callable[..., IO[Any]] 

33"""A compressor callback registered via :func:`smart_open.register_compressor`."""