From 2dce43203940eb7ace388fe6705db30714ede876 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Wed, 9 Nov 2022 11:02:06 +0800 Subject: [PATCH] [CodeStyle][py2] use new syntax for metaclass declaration (PEP 3115) (#47730) --- python/paddle/fluid/incubate/fleet/base/fleet_base.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/python/paddle/fluid/incubate/fleet/base/fleet_base.py b/python/paddle/fluid/incubate/fleet/base/fleet_base.py index 61b7fe7de5..c53090a52b 100644 --- a/python/paddle/fluid/incubate/fleet/base/fleet_base.py +++ b/python/paddle/fluid/incubate/fleet/base/fleet_base.py @@ -30,7 +30,7 @@ __all__ = ['Fleet', 'DistributedOptimizer'] __all__ += mode.__all__ -class Fleet: +class Fleet(metaclass=abc.ABCMeta): """ Fleet is the base class, transpiler and pslib are implementation of Fleet. @@ -41,8 +41,6 @@ class Fleet: None """ - __metaclass__ = abc.ABCMeta - def __init__(self, mode): self._is_initialized = False self._mode = mode @@ -268,7 +266,7 @@ class Fleet: pass -class DistributedOptimizer: +class DistributedOptimizer(metaclass=abc.ABCMeta): """ DistributedOptimizer is a wrapper for paddle.fluid.optimizer A user should pass a paddle.fluid.optimizer to DistributedOptimizer @@ -287,8 +285,6 @@ class DistributedOptimizer: """ - __metaclass__ = abc.ABCMeta - def __init__(self, optimizer, strategy=None): if ( not isinstance(optimizer, SGD.__bases__) -- GitLab