File: __init__.py

package info (click to toggle)
python-podman 5.4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,140 kB
  • sloc: python: 7,532; makefile: 82; sh: 75
file content (121 lines) | stat: -rw-r--r-- 2,869 bytes parent folder | download | duplicates (3)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
"""Podman API errors Package.

Import exceptions from 'importlib' are used to differentiate between APIConnection
and PodmanClient errors. Therefore, installing both APIConnection and PodmanClient
is not supported. PodmanClient related errors take precedence over APIConnection ones.

ApiConnection and associated classes have been deprecated.
"""

import warnings
from http.client import HTTPException

# isort: unique-list
__all__ = [
    'APIError',
    'BuildError',
    'ContainerError',
    'DockerException',
    'ImageNotFound',
    'InvalidArgument',
    'NotFound',
    'NotFoundError',
    'PodmanError',
    'StreamParseError',
]

try:
    from .exceptions import (
        APIError,
        BuildError,
        ContainerError,
        DockerException,
        InvalidArgument,
        NotFound,
        PodmanError,
        StreamParseError,
    )
except ImportError:
    pass


class NotFoundError(HTTPException):
    """HTTP request returned a http.HTTPStatus.NOT_FOUND.

    Deprecated.
    """

    def __init__(self, message, response=None):
        super().__init__(message)
        self.response = response
        warnings.warn(
            "APIConnection() and supporting classes.", PendingDeprecationWarning, stacklevel=2
        )


# If found, use new ImageNotFound otherwise old class
try:
    from .exceptions import ImageNotFound
except ImportError:

    class ImageNotFound(NotFoundError):
        """HTTP request returned a http.HTTPStatus.NOT_FOUND.

        Specialized for Image not found. Deprecated.
        """


class NetworkNotFound(NotFoundError):
    """Network request returned a http.HTTPStatus.NOT_FOUND.

    Deprecated.
    """


class ContainerNotFound(NotFoundError):
    """HTTP request returned a http.HTTPStatus.NOT_FOUND.

    Specialized for Container not found. Deprecated.
    """


class PodNotFound(NotFoundError):
    """HTTP request returned a http.HTTPStatus.NOT_FOUND.

    Specialized for Pod not found. Deprecated.
    """


class ManifestNotFound(NotFoundError):
    """HTTP request returned a http.HTTPStatus.NOT_FOUND.

    Specialized for Manifest not found. Deprecated.
    """


class RequestError(HTTPException):
    """Podman service reported issue with the request.

    Deprecated.
    """

    def __init__(self, message, response=None):
        super().__init__(message)
        self.response = response
        warnings.warn(
            "APIConnection() and supporting classes.", PendingDeprecationWarning, stacklevel=2
        )


class InternalServerError(HTTPException):
    """Podman service reported an internal error.

    Deprecated.
    """

    def __init__(self, message, response=None):
        super().__init__(message)
        self.response = response
        warnings.warn(
            "APIConnection() and supporting classes.", PendingDeprecationWarning, stacklevel=2
        )