From a0bb867df06344e3c3aac108e96d56ef08bb1d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sa=C5=82aban?= Date: Sun, 7 Feb 2021 20:35:17 +0100 Subject: [PATCH] Remove deprecated features --- docs/source/release_notes.rst | 9 +++++++++ monero/address.py | 33 ------------------------------- monero/prio.py | 9 --------- monero/seed.py | 6 ------ tests/test_address.py | 37 ----------------------------------- 5 files changed, 9 insertions(+), 85 deletions(-) delete mode 100644 monero/prio.py diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index 841d317..f2cae10 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -1,6 +1,15 @@ Release Notes ============= +0.8 +--- + +Backward-incompatible changes: + + 1. The ``monero.prio`` submodule has been removed. Switch to ``monero.const``. + 2. Methods ``.is_mainnet()``, ``.is_testnet()``, ``.is_stagenet()`` have been removed from + ``monero.address.Address`` instances. Use ``.net`` attribute instead. + 0.7 --- diff --git a/monero/address.py b/monero/address.py index 04a4096..2def4b0 100644 --- a/monero/address.py +++ b/monero/address.py @@ -42,39 +42,6 @@ class BaseAddress(object): def net(self): return const.NETS[self._valid_netbytes.index(self._decoded[0])] - def is_mainnet(self): - """Returns `True` if the address belongs to mainnet. - - :rtype: bool - """ - warnings.warn(".is_mainnet(), .is_testnet() and .is_stagenet() methods are deprecated " - "and will be gone in 0.8; use Address.net property and constants form monero.const " - "instead", - DeprecationWarning) - return self.net == const.NET_MAIN - - def is_testnet(self): - """Returns `True` if the address belongs to testnet. - - :rtype: bool - """ - warnings.warn(".is_mainnet(), .is_testnet() and .is_stagenet() methods are deprecated " - "and will be gone in 0.8; use Address.net property and constants form monero.const " - "instead", - DeprecationWarning) - return self.net == const.NET_TEST - - def is_stagenet(self): - """Returns `True` if the address belongs to stagenet. - - :rtype: bool - """ - warnings.warn(".is_mainnet(), .is_testnet() and .is_stagenet() methods are deprecated " - "and will be gone in 0.8; use Address.net property and constants form monero.const " - "instead", - DeprecationWarning) - return self.net == const.NET_STAGE - def _decode(self, address): self._decoded = bytearray(unhexlify(base58.decode(address))) checksum = self._decoded[-4:] diff --git a/monero/prio.py b/monero/prio.py deleted file mode 100644 index 2848ad4..0000000 --- a/monero/prio.py +++ /dev/null @@ -1,9 +0,0 @@ -import warnings -warnings.warn( - "monero.prio is deprecated and will be gone in 0.8; use monero.const.PRIO_* consts instead", - DeprecationWarning) - -UNIMPORTANT=1 -NORMAL=2 -ELEVATED=3 -PRIORITY=4 diff --git a/monero/seed.py b/monero/seed.py index 8509c9a..5601c02 100644 --- a/monero/seed.py +++ b/monero/seed.py @@ -159,12 +159,6 @@ class Seed(object): """ # backward compatibility _net = net[:-3] if net.endswith('net') else net - if _net != net: - warnings.warn( - "Argument '{:s}' is deprecated and will not be accepted in 0.8, " - "use one of monero.const.NET_*".format(net), - DeprecationWarning) - net = _net if net not in const.NETS: raise ValueError( "Invalid net argument '{:s}'. Must be one of monero.const.NET_*".format(net)) diff --git a/tests/test_address.py b/tests/test_address.py index 9d3ada0..ea0a321 100644 --- a/tests/test_address.py +++ b/tests/test_address.py @@ -50,7 +50,6 @@ class Tests(object): self.assertEqual(ia.payment_id(), self.pid) self.assertEqual(str(ia), self.iaddr) - @pytest.mark.filterwarnings("ignore::DeprecationWarning") def test_recognition_and_comparisons(self): a = Address(self.addr) a2 = address(self.addr) @@ -60,19 +59,7 @@ class Tests(object): self.assertEqual(self.addr, a) self.assertEqual(hash(a), hash(self.addr)) self.assertEqual(a.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(a.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(a.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(a.is_stagenet(), self.net == const.NET_STAGE) self.assertEqual(a2.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(a2.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(a2.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(a2.is_stagenet(), self.net == const.NET_STAGE) ia = IntegratedAddress(self.iaddr) ia2 = address(self.iaddr) @@ -82,19 +69,7 @@ class Tests(object): self.assertEqual(self.iaddr, ia) self.assertEqual(hash(ia), hash(self.iaddr)) self.assertEqual(ia.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(ia.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(ia.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(ia.is_stagenet(), self.net == const.NET_STAGE) self.assertEqual(ia2.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(ia2.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(ia2.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(ia2.is_stagenet(), self.net == const.NET_STAGE) self.assertEqual(ia2.base_address(), a) self.assertEqual(ia.view_key(), a.view_key()) @@ -108,19 +83,7 @@ class Tests(object): self.assertEqual(self.subaddr, sa) self.assertEqual(hash(sa), hash(self.subaddr)) self.assertEqual(sa.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(sa.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(sa.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(sa.is_stagenet(), self.net == const.NET_STAGE) self.assertEqual(sa2.net, self.net) - with pytest.deprecated_call(): - self.assertEqual(sa2.is_mainnet(), self.net == const.NET_MAIN) - with pytest.deprecated_call(): - self.assertEqual(sa2.is_testnet(), self.net == const.NET_TEST) - with pytest.deprecated_call(): - self.assertEqual(sa2.is_stagenet(), self.net == const.NET_STAGE) self.assertNotEqual(a, 0)