Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Replace all uses of six.with_metaclass with six.add_metaclass
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecol committed Sep 8, 2019
1 parent 6d629b8 commit cbb5180
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
5 changes: 3 additions & 2 deletions iota/adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from requests import Response, auth, codes, request
from six import PY2, binary_type, iteritems, moves as compat, text_type, \
with_metaclass
add_metaclass

from iota.exceptions import with_context
from iota.json import JsonEncoder
Expand Down Expand Up @@ -139,7 +139,8 @@ def configure(cls, parsed):
return cls(parsed)


class BaseAdapter(with_metaclass(AdapterMeta)):
@add_metaclass(AdapterMeta)
class BaseAdapter(object):
"""
Interface for IOTA API adapters.
Expand Down
5 changes: 3 additions & 2 deletions iota/adapter/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABCMeta, abstractmethod as abstract_method
from typing import Dict, Text

from six import with_metaclass
from six import add_metaclass

from iota.adapter import AdapterSpec, BaseAdapter, resolve_adapter

Expand All @@ -14,7 +14,8 @@
]


class BaseWrapper(with_metaclass(ABCMeta, BaseAdapter)):
@add_metaclass(ABCMeta)
class BaseWrapper(BaseAdapter):
"""
Base functionality for "adapter wrappers", used to extend the
functionality of IOTA adapters.
Expand Down
5 changes: 3 additions & 2 deletions iota/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Dict, Iterable, Optional, Text

from six import with_metaclass
from six import add_metaclass

from iota import AdapterSpec, Address, BundleHash, ProposedTransaction, Tag, \
TransactionHash, TransactionTrytes, TryteString, TrytesCompatible
Expand Down Expand Up @@ -53,7 +53,8 @@ def __init__(cls, name, bases=None, attrs=None):
cls.commands = commands


class StrictIota(with_metaclass(ApiMeta)):
@add_metaclass(ApiMeta)
class StrictIota(object):
"""
API to send HTTP requests for communicating with an IOTA node.
Expand Down
5 changes: 3 additions & 2 deletions iota/bin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sys import exit
from typing import Any, Optional, Text

from six import text_type, with_metaclass
from six import text_type, add_metaclass

from iota import Iota, __version__
from iota.crypto.types import Seed
Expand All @@ -20,7 +20,8 @@
]


class IotaCommandLineApp(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class IotaCommandLineApp(object):
"""
Base functionality for a PyOTA-powered command-line application.
"""
Expand Down
2 changes: 1 addition & 1 deletion iota/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(cls, what, bases=None, dict=None):
command_registry[command] = cls

@six.add_metaclass(CommandMeta)
class BaseCommand():
class BaseCommand(object):
"""
An API command ready to send to the node.
"""
Expand Down
5 changes: 3 additions & 2 deletions iota/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from json.encoder import JSONEncoder as BaseJsonEncoder
from typing import Iterable, Mapping

from six import with_metaclass
from six import add_metaclass


class JsonSerializable(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class JsonSerializable(object):
"""
Interface for classes that can be safely converted to JSON.
"""
Expand Down
5 changes: 3 additions & 2 deletions test/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from abc import ABCMeta
from unittest import TestCase

from six import with_metaclass
from six import add_metaclass

from iota import InvalidCommand, StrictIota
from iota.adapter import MockAdapter
Expand Down Expand Up @@ -150,5 +150,6 @@ class definition raises an exception.
# This statement will raise an exception if the regression is
# present; no assertions necessary.
# noinspection PyUnusedLocal
class CustomClient(with_metaclass(ABCMeta)):
@add_metaclass(ABCMeta)
class CustomClient(object):
client = StrictIota(MockAdapter())

0 comments on commit cbb5180

Please sign in to comment.