---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP004 [*] Class `A` inherits from `object`
 --> UP004.py:5:9
  |
5 | class A(object):
  |         ^^^^^^
6 |     ...
  |
help: Remove `object` inheritance
  |
4 |
  - class A(object):
5 + class A:
6 |     ...
  |

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:10:5
   |
 9 | class A(
10 |     object,
   |     ^^^^^^
11 | ):
12 |     ...
   |
help: Remove `object` inheritance
   |
8  |
   - class A(
   -     object,
   - ):
9  + class A:
10 |     ...
   |

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:16:5
   |
15 | class A(
16 |     object,
   |     ^^^^^^
17 |     #
18 | ):
   |
help: Remove `object` inheritance
   |
14 |
   - class A(
   -     object,
   -     #
   - ):
15 + class A:
16 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:24:5
   |
22 | class A(
23 |     #
24 |     object,
   |     ^^^^^^
25 | ):
26 |     ...
   |
help: Remove `object` inheritance
   |
21 |
   - class A(
   -     #
   -     object,
   - ):
22 + class A:
23 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:31:5
   |
29 | class A(
30 |     #
31 |     object
   |     ^^^^^^
32 | ):
33 |     ...
   |
help: Remove `object` inheritance
   |
28 |
   - class A(
   -     #
   -     object
   - ):
29 + class A:
30 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:37:5
   |
36 | class A(
37 |     object
   |     ^^^^^^
38 |     #
39 | ):
   |
help: Remove `object` inheritance
   |
35 |
   - class A(
   -     object
   -     #
   - ):
36 + class A:
37 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:45:5
   |
43 | class A(
44 |     #
45 |     object,
   |     ^^^^^^
46 |     #
47 | ):
   |
help: Remove `object` inheritance
   |
42 |
   - class A(
   -     #
   -     object,
   -     #
   - ):
43 + class A:
44 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:53:5
   |
51 | class A(
52 |     #
53 |     object,
   |     ^^^^^^
54 |     #
55 | ):
   |
help: Remove `object` inheritance
   |
50 |
   - class A(
   -     #
   -     object,
   -     #
   - ):
51 + class A:
52 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:61:5
   |
59 | class A(
60 |     #
61 |     object
   |     ^^^^^^
62 |     #
63 | ):
   |
help: Remove `object` inheritance
   |
58 |
   - class A(
   -     #
   -     object
   -     #
   - ):
59 + class A:
60 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
  --> UP004.py:69:5
   |
67 | class A(
68 |     #
69 |     object
   |     ^^^^^^
70 |     #
71 | ):
   |
help: Remove `object` inheritance
   |
66 |
   - class A(
   -     #
   -     object
   -     #
   - ):
67 + class A:
68 |     ...
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `B` inherits from `object`
  --> UP004.py:75:12
   |
75 | class B(A, object):
   |            ^^^^^^
76 |     ...
   |
help: Remove `object` inheritance
   |
74 |
   - class B(A, object):
75 + class B(A):
76 |     ...
   |

UP004 [*] Class `B` inherits from `object`
  --> UP004.py:79:9
   |
79 | class B(object, A):
   |         ^^^^^^
80 |     ...
   |
help: Remove `object` inheritance
   |
78 |
   - class B(object, A):
79 + class B(A):
80 |     ...
   |

UP004 [*] Class `B` inherits from `object`
  --> UP004.py:84:5
   |
83 | class B(
84 |     object,
   |     ^^^^^^
85 |     A,
86 | ):
   |
help: Remove `object` inheritance
   |
83 | class B(
   -     object,
84 |     A,
   |

UP004 [*] Class `B` inherits from `object`
  --> UP004.py:92:5
   |
90 | class B(
91 |     A,
92 |     object,
   |     ^^^^^^
93 | ):
94 |     ...
   |
help: Remove `object` inheritance
   |
91 |     A,
   -     object,
92 | ):
   |

UP004 [*] Class `B` inherits from `object`
   --> UP004.py:98:5
    |
 97 | class B(
 98 |     object,
    |     ^^^^^^
 99 |     # Comment on A.
100 |     A,
    |
help: Remove `object` inheritance
   |
97 | class B(
   -     object,
98 |     # Comment on A.
   |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `B` inherits from `object`
   --> UP004.py:108:5
    |
106 |     # Comment on A.
107 |     A,
108 |     object,
    |     ^^^^^^
109 | ):
110 |     ...
    |
help: Remove `object` inheritance
    |
107 |     A,
    -     object,
108 | ):
    |

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:119:5
    |
118 | class A(
119 |     object,
    |     ^^^^^^
120 | ):
121 |     ...
    |
help: Remove `object` inheritance
    |
117 |
    - class A(
    -     object,
    - ):
118 + class A:
119 |     ...
    |

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:125:5
    |
124 | class A(
125 |     object,  # )
    |     ^^^^^^
126 | ):
127 |     ...
    |
help: Remove `object` inheritance
    |
123 |
    - class A(
    -     object,  # )
    - ):
124 + class A:
125 |     ...
    |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:131:5
    |
130 | class A(
131 |     object  # )
    |     ^^^^^^
132 |     ,
133 | ):
    |
help: Remove `object` inheritance
    |
129 |
    - class A(
    -     object  # )
    -     ,
    - ):
130 + class A:
131 |     ...
    |
note: This is an unsafe fix and may change runtime behavior

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:137:9
    |
137 | class A(object, object):
    |         ^^^^^^
138 |     ...
    |
help: Remove `object` inheritance
    |
136 |
    - class A(object, object):
137 + class A(object):
138 |     ...
    |

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:137:17
    |
137 | class A(object, object):
    |                 ^^^^^^
138 |     ...
    |
help: Remove `object` inheritance
    |
136 |
    - class A(object, object):
137 + class A(object):
138 |     ...
    |

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:142:9
    |
141 | @decorator()
142 | class A(object):
    |         ^^^^^^
143 |     ...
    |
help: Remove `object` inheritance
    |
141 | @decorator()
    - class A(object):
142 + class A:
143 |     ...
    |

UP004 [*] Class `A` inherits from `object`
   --> UP004.py:146:9
    |
145 | @decorator()  # class A(object):
146 | class A(object):
    |         ^^^^^^
147 |     ...
    |
help: Remove `object` inheritance
    |
145 | @decorator()  # class A(object):
    - class A(object):
146 + class A:
147 |     ...
    |

UP004 [*] Class `Unusual` inherits from `object`
   --> UP004.py:159:15
    |
157 | import builtins
158 |
159 | class Unusual(builtins.object):
    |               ^^^^^^^^^^^^^^^
160 |     ...
    |
help: Remove `object` inheritance
    |
158 |
    - class Unusual(builtins.object):
159 + class Unusual:
160 |     ...
    |
