Skip to content

Commit

Permalink
DeprecatedMethod class takes msg kwarg for custom warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
reedsa committed Feb 20, 2024
1 parent c0c30da commit 5a1fd59
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions web3/_utils/miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,53 +28,65 @@
mungers=[default_root_munger],
)

make_dag = DeprecatedMethod(_make_dag, "make_dag", "deprecated")
make_dag = DeprecatedMethod(
_make_dag, "make_dag", msg="All mining methods have been deprecated"
)

_set_extra: Method[Callable[[str], bool]] = Method(
RPC.miner_setExtra,
mungers=[default_root_munger],
)

set_extra = DeprecatedMethod(_set_extra, "set_extra", "deprecated")
set_extra = DeprecatedMethod(
_set_extra, "set_extra", msg="All mining methods have been deprecated"
)

_set_etherbase: Method[Callable[[ChecksumAddress], bool]] = Method(
RPC.miner_setEtherbase,
mungers=[default_root_munger],
)

set_etherbase = DeprecatedMethod(_set_etherbase, "set_etherbase", "deprecated")
set_etherbase = DeprecatedMethod(
_set_etherbase, "set_etherbase", msg="All mining methods have been deprecated"
)

_set_gas_price: Method[Callable[[Wei], bool]] = Method(
RPC.miner_setGasPrice,
mungers=[default_root_munger],
)

set_gas_price = DeprecatedMethod(_set_gas_price, "set_gas_price", "deprecated")
set_gas_price = DeprecatedMethod(
_set_gas_price, "set_gas_price", msg="All mining methods have been deprecated"
)

_start: Method[Callable[[int], bool]] = Method(
RPC.miner_start,
mungers=[default_root_munger],
)

start = DeprecatedMethod(_start, "start", "deprecated")
start = DeprecatedMethod(_start, "start", msg="All mining methods have been deprecated")

_stop: Method[Callable[[], bool]] = Method(
RPC.miner_stop,
is_property=True,
)

stop = DeprecatedMethod(_stop, "stop", "deprecated")
stop = DeprecatedMethod(_stop, "stop", msg="All mining methods have been deprecated")

_start_auto_dag: Method[Callable[[], bool]] = Method(
RPC.miner_startAutoDag,
is_property=True,
)

start_auto_dag = DeprecatedMethod(_start_auto_dag, "start_auto_dag", "deprecated")
start_auto_dag = DeprecatedMethod(
_start_auto_dag, "start_auto_dag", msg="All mining methods have been deprecated"
)

_stop_auto_dag: Method[Callable[[], bool]] = Method(
RPC.miner_stopAutoDag,
is_property=True,
)

stop_auto_dag = DeprecatedMethod(_stop_auto_dag, "stop_auto_dag", "deprecated")
stop_auto_dag = DeprecatedMethod(
_stop_auto_dag, "stop_auto_dag", msg="All mining methods have been deprecated"
)

0 comments on commit 5a1fd59

Please sign in to comment.