Skip to content

Commit

Permalink
chore: remove old-style classes
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch authored and JohnVillalovos committed Jan 23, 2022
1 parent 39e7435 commit ae2a015
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions gitlab/base.py
Expand Up @@ -41,7 +41,7 @@
)


class RESTObject(object):
class RESTObject:
"""Represents an object built from server data.
It holds the attributes know from the server, and the updated attributes in
Expand Down Expand Up @@ -234,7 +234,7 @@ def attributes(self) -> Dict[str, Any]:
return d


class RESTObjectList(object):
class RESTObjectList:
"""Generator object representing a list of RESTObject's.
This generator uses the Gitlab pagination system to fetch new data when
Expand Down Expand Up @@ -321,7 +321,7 @@ class RequiredOptional(NamedTuple):
optional: Tuple[str, ...] = tuple()


class RESTManager(object):
class RESTManager:
"""Base class for CRUD operations on objects.
Derived class must define ``_path`` and ``_obj_cls``.
Expand Down
4 changes: 2 additions & 2 deletions gitlab/client.py
Expand Up @@ -36,7 +36,7 @@
)


class Gitlab(object):
class Gitlab:
"""Represents a GitLab server connection.
Args:
Expand Down Expand Up @@ -957,7 +957,7 @@ def search(
return self.http_list("/search", query_data=data, **kwargs)


class GitlabList(object):
class GitlabList:
"""Generator representing a list of remote objects.
The object handles the links returned by a query to the API, and will call
Expand Down
2 changes: 1 addition & 1 deletion gitlab/config.py
Expand Up @@ -101,7 +101,7 @@ class GitlabConfigHelperError(ConfigError):
pass


class GitlabConfigParser(object):
class GitlabConfigParser:
def __init__(
self, gitlab_id: Optional[str] = None, config_files: Optional[List[str]] = None
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion gitlab/types.py
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Optional, TYPE_CHECKING


class GitlabAttribute(object):
class GitlabAttribute:
def __init__(self, value: Any = None) -> None:
self._value = value

Expand Down
2 changes: 1 addition & 1 deletion gitlab/utils.py
Expand Up @@ -21,7 +21,7 @@
import requests


class _StdoutStream(object):
class _StdoutStream:
def __call__(self, chunk: Any) -> None:
print(chunk)

Expand Down
8 changes: 4 additions & 4 deletions gitlab/v4/cli.py
Expand Up @@ -27,7 +27,7 @@
from gitlab import cli


class GitlabCLI(object):
class GitlabCLI:
def __init__(
self, gl: gitlab.Gitlab, what: str, action: str, args: Dict[str, str]
) -> None:
Expand Down Expand Up @@ -359,7 +359,7 @@ def get_dict(
return obj.attributes


class JSONPrinter(object):
class JSONPrinter:
def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
import json # noqa

Expand All @@ -376,7 +376,7 @@ def display_list(
print(json.dumps([get_dict(obj, fields) for obj in data]))


class YAMLPrinter(object):
class YAMLPrinter:
def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
try:
import yaml # noqa
Expand Down Expand Up @@ -411,7 +411,7 @@ def display_list(
)


class LegacyPrinter(object):
class LegacyPrinter:
def display(self, d: Union[str, Dict[str, Any]], **kwargs: Any) -> None:
verbose = kwargs.get("verbose", False)
padding = kwargs.get("padding", 0)
Expand Down
4 changes: 2 additions & 2 deletions tests/meta/test_mro.py
Expand Up @@ -20,7 +20,7 @@ class ProjectPipeline(RefreshMixin, ObjectDeleteMixin, RESTObject):
Here is how our classes look when type-checking:
class RESTObject(object):
class RESTObject:
def __init__(self, manager: "RESTManager", attrs: Dict[str, Any]) -> None:
...
Expand Down Expand Up @@ -52,7 +52,7 @@ class Wrongv4Object(RESTObject, Mixin):
def test_show_issue() -> None:
"""Test case to demonstrate the TypeError that occurs"""

class RESTObject(object):
class RESTObject:
def __init__(self, manager: str, attrs: int) -> None:
...

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_base.py
Expand Up @@ -23,7 +23,7 @@
from gitlab import base


class FakeGitlab(object):
class FakeGitlab:
pass


Expand Down Expand Up @@ -61,7 +61,7 @@ class MGR(base.RESTManager):
_obj_cls = object
_from_parent_attrs = {"test_id": "id"}

class Parent(object):
class Parent:
id = 42

mgr = MGR(FakeGitlab(), parent=Parent())
Expand Down

0 comments on commit ae2a015

Please sign in to comment.