Skip to content

Commit

Permalink
Remove ApiConnection support
Browse files Browse the repository at this point in the history
This API was the original draft API that has been marked deprecated for
the Podman3 releases, with Podman4 being released soon now is the time
to remove this support. APIClient provides a compatible interface while
also allowing access to libpod enhancements.

Signed-off-by: Jhon Honce <[email protected]>
  • Loading branch information
jwhonce committed Jan 24, 2022
1 parent d1494be commit 285519d
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 2,502 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ docs:
cp -R docs/source/* build/docs/source
sphinx-apidoc --separate --no-toc --force --templatedir build/docs/source/_templates/apidoc \
-o build/docs/source \
podman podman/tests podman/api_connection.py podman/containers podman/images \
podman/manifests podman/networks podman/pods podman/system
podman podman/tests
sphinx-build build/docs/source build/html

# .PHONY: install
Expand Down
11 changes: 1 addition & 10 deletions podman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@

assert sys.version_info >= (3, 6), "Python 3.6 or greater is required."

try:
from podman.api_connection import ApiConnection
except ImportError:

class ApiConnection: # pylint: disable=too-few-public-methods
def __init__(self):
raise NotImplementedError("ApiConnection deprecated, please use PodmanClient().")


from podman.client import PodmanClient, from_env
from podman.version import __version__

# isort: unique-list
__all__ = ['ApiConnection', 'PodmanClient', '__version__', 'from_env']
__all__ = ['PodmanClient', '__version__', 'from_env']
9 changes: 8 additions & 1 deletion podman/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ class APIClient(requests.Session):
# pylint: disable=arguments-differ
# pylint: disable=too-many-instance-attributes

supported_schemes: ClassVar[List[str]] = ("unix", "http+unix", "ssh", "http+ssh", "tcp", "http")
supported_schemes: ClassVar[List[str]] = (
"unix",
"http+unix",
"ssh",
"http+ssh",
"tcp",
"http",
)

def __init__(
self,
Expand Down
23 changes: 20 additions & 3 deletions podman/api/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ def __new__(cls, *args, **kwds):
return collections.deque(*args, **kwds)
return _generic_new(collections.deque, cls, *args, **kwds)


else:

class Deque(
Expand Down Expand Up @@ -911,6 +912,7 @@ class ContextManager(
):
__slots__ = ()


else:

class ContextManager(typing.Generic[T_co]):
Expand Down Expand Up @@ -992,6 +994,7 @@ def __new__(cls, *args, **kwds):
return collections.defaultdict(*args, **kwds)
return _generic_new(collections.defaultdict, cls, *args, **kwds)


else:

class DefaultDict(
Expand Down Expand Up @@ -1029,6 +1032,7 @@ def __new__(cls, *args, **kwds):
return collections.OrderedDict(*args, **kwds)
return _generic_new(collections.OrderedDict, cls, *args, **kwds)


else:

class OrderedDict(
Expand Down Expand Up @@ -1069,6 +1073,7 @@ def __new__(cls, *args, **kwds):
return collections.Counter(*args, **kwds)
return _generic_new(collections.Counter, cls, *args, **kwds)


elif _geqv_defined:

class Counter(
Expand All @@ -1085,6 +1090,7 @@ def __new__(cls, *args, **kwds):
return collections.Counter(*args, **kwds)
return _generic_new(collections.Counter, cls, *args, **kwds)


else:

class Counter(
Expand Down Expand Up @@ -1311,7 +1317,10 @@ def __new__(
for base in bases:
if base is Generic:
raise TypeError("Cannot inherit from plain Generic")
if isinstance(base, GenericMeta) and base.__origin__ in (Generic, Protocol):
if isinstance(base, GenericMeta) and base.__origin__ in (
Generic,
Protocol,
):
if gvars is not None:
raise TypeError(
"Cannot inherit from Generic[...] or"
Expand Down Expand Up @@ -1344,7 +1353,9 @@ def __new__(
bases = tuple(b for b in bases if b is not Generic)
namespace.update({'__origin__': origin, '__extra__': extra})
self = super(GenericMeta, cls).__new__(cls, name, bases, namespace, _root=True)
super(GenericMeta, self).__setattr__('_gorg', self if not origin else _gorg(origin))
super(GenericMeta, self).__setattr__(
'_gorg', self if not origin else _gorg(origin)
)
self.__parameters__ = tvars
self.__args__ = (
tuple(
Expand Down Expand Up @@ -1468,7 +1479,9 @@ def __getitem__(self, params):
if not isinstance(params, tuple):
params = (params,)
if not params and _gorg(self) is not Tuple:
raise TypeError("Parameter list to %s[...] cannot be empty" % self.__qualname__)
raise TypeError(
"Parameter list to %s[...] cannot be empty" % self.__qualname__
)
msg = "Parameters to generic types must be types."
params = tuple(_type_check(p, msg) for p in params)
if self in (Generic, Protocol):
Expand Down Expand Up @@ -2095,6 +2108,7 @@ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
return hint
return {k: _strip_annotations(t) for k, t in hint.items()}


elif HAVE_ANNOTATED:

def _is_dunder(name):
Expand Down Expand Up @@ -2330,6 +2344,7 @@ def TypeAlias(self, parameters):
"""
raise TypeError("{} is not subscriptable".format(self))


elif sys.version_info[:2] >= (3, 7):

class _TypeAliasForm(typing._SpecialForm, _root=True):
Expand Down Expand Up @@ -2657,6 +2672,7 @@ def Concatenate(self, parameters):
"""
return _concatenate_getitem(self, parameters)


elif sys.version_info[:2] >= (3, 7):

class _ConcatenateForm(typing._SpecialForm, _root=True):
Expand Down Expand Up @@ -2805,6 +2821,7 @@ def is_str(val: Union[str, float]):
item = typing._type_check(parameters, '{} accepts only single type.'.format(self))
return _GenericAlias(self, (item,))


elif sys.version_info[:2] >= (3, 7):

class _TypeGuardForm(typing._SpecialForm, _root=True):
Expand Down
175 changes: 0 additions & 175 deletions podman/api_connection.py

This file was deleted.

Loading

0 comments on commit 285519d

Please sign in to comment.