Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][UP004] remove useless object inheritance #51771

Merged
merged 4 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions paddle/fluid/imperative/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ https://www.tensorflow.org/guide/eager

## API
```python
class Layer(object):
class Layer:

def __call__(inputs):
# build some parameter once.
Expand Down Expand Up @@ -49,7 +49,7 @@ Longer term.
```python

# Parent class.
class PyVarBase(object):
class PyVarBase:
pass

# Current python variable.
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ select = [
# Pyupgrade
"UP001",
"UP003",
"UP004",
"UP007",
"UP010",
"UP011",
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/device/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def get_available_custom_device():
return core.get_available_custom_device()


class Event(object):
class Event:
'''
A device event wrapper around StreamBase.
Parameters:
Expand Down Expand Up @@ -668,7 +668,7 @@ def __repr__(self):
return self.event_base


class Stream(object):
class Stream:
'''
A device stream wrapper around StreamBase.
Parameters:
Expand Down Expand Up @@ -936,7 +936,7 @@ def set_stream(stream):
return prev_stream


class stream_guard(object):
class stream_guard:
'''
Notes:
This API only supports dynamic graph mode currently.
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/fleet/base/runtime_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
__all__ = []


class RuntimeFactory(object):
class RuntimeFactory:
def __init__(self):
pass

Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/passes/auto_parallel_bf16.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
world_process_group = get_world_process_group()


class BF16State(object):
class BF16State:
def __init__(self, block):
self._block: Block = block
self._op_bf16_dict = {}
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/distributed/passes/auto_parallel_sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@ def group_param(sharding_info, fuse_size):
return group_to_param_map, param_to_group_map


class ShardingInfo(object):
class ShardingInfo:
def __init__(self, group, rank, params_grads, partition_algor):
self.group = group
self.params_grads = dict([(p.name, (p, g)) for p, g in params_grads])
Expand Down Expand Up @@ -1869,7 +1869,7 @@ def get_param_grad(self, param_name):
return self.params_grads.get(param_name, None)


class VarGroup(object):
class VarGroup:
def __init__(self, max_size):
self.max_siez = max_size
self.dtype = None
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/fluid/tests/unittests/prim/model/bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
VOCAB_SIZE = 30522


class Stack(object):
class Stack:
def __init__(self, axis=0, dtype=None):
self._axis = axis
self._dtype = dtype
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_dataset(inputs, config):
return dataset


class Main(object):
class Main:
def __init__(self):
self.metrics = {}
self.input_data = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
CUDA_BLOCK_SIZE = 32


class CTCForward(object):
class CTCForward:
def __init__(
self,
softmax,
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/jit/dy2static/program_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ def _program_hash(self, program):
return id(program)


class FallbackProgramLayer(object):
class FallbackProgramLayer:
__slots__ = [
'_instance',
'_dy_func',
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/quantization/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
DEFAULT_LEAVES = [nn.ReLU, nn.AvgPool2D]


class SingleLayerConfig(object):
class SingleLayerConfig:
r"""
Configure how to quantize the activations and weights of a single layer.

Expand All @@ -57,7 +57,7 @@ def __str__(self):
return f"activation: {self._activation}\nweight: {self._weight}"


class QuantConfig(object):
class QuantConfig:
r"""
Configure how to quantize a model or a part of the model. It will map each layer to
an instance of SingleLayerConfig by the settings. It provides diverse methods to set
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/quantization/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .config import QuantConfig


class Quantization(object, metaclass=abc.ABCMeta):
class Quantization(metaclass=abc.ABCMeta):
r"""
Abstract class used to prepares a copy of the model for quantization calibration or quantization-aware training.
Args:
Expand Down
4 changes: 2 additions & 2 deletions tools/parse_kernel_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import paddle


class KernelInfo(object):
class KernelInfo:
def __init__(self, op_type):
self.op_type = op_type
self.supported_dtypes = set()
Expand Down Expand Up @@ -53,7 +53,7 @@ def parse_fluid_dtypes(self, registered_info_list, device="gpu"):
self.supported_dtypes.add(dtype_str)


class KernelRegistryStatistics(object):
class KernelRegistryStatistics:
def __init__(self):
self.num_ops_for_dtypes = {
"all": 0,
Expand Down