File: protocols.py

package info (click to toggle)
python-openapi-core 0.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,104 kB
  • sloc: python: 19,979; makefile: 44
file content (39 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from typing import Iterator
from typing import Optional
from typing import Protocol
from typing import runtime_checkable

from jsonschema_path import SchemaPath

from openapi_core.templating.paths.datatypes import Path
from openapi_core.templating.paths.datatypes import PathOperation
from openapi_core.templating.paths.datatypes import PathOperationServer


@runtime_checkable
class PathsIterator(Protocol):
    def __call__(
        self, name: str, spec: SchemaPath, base_url: Optional[str] = None
    ) -> Iterator[Path]: ...


@runtime_checkable
class OperationsIterator(Protocol):
    def __call__(
        self,
        method: str,
        paths_iter: Iterator[Path],
        spec: SchemaPath,
        base_url: Optional[str] = None,
    ) -> Iterator[PathOperation]: ...


@runtime_checkable
class ServersIterator(Protocol):
    def __call__(
        self,
        name: str,
        operations_iter: Iterator[PathOperation],
        spec: SchemaPath,
        base_url: Optional[str] = None,
    ) -> Iterator[PathOperationServer]: ...