Skip to content

Commit 3ba10ea

Browse files
committed
Clean up class name and self in calls to super()
PEP 3135 [^1] simplified the syntax for `super()` in Python 3.0 from: super(ClassName, self) to the following very simple and equivalent [^2] syntax: super() The current Keras codebase already requires Python 3+. This change simplifies the entire code base by cleaning up the remaining explicit uses of the current class name and `self` and using the cleaner `super()` syntax everywhere consistently. Since the new syntax is intended to be a shorthand for the old syntax, this change should have no semantic differences from before. [^1]: https://peps.python.org/pep-3135/ [^2]: https://docs.python.org/3/library/functions.html#super
1 parent d1500aa commit 3ba10ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

keras_nlp/layers/transformer_decoder_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_value_error_when_invalid_kernel_inititalizer(self):
132132
def test_one_training_step_of_transformer_with_cross_attention(self):
133133
class MyModel(keras.Model):
134134
def __init__(self):
135-
super(MyModel, self).__init__()
135+
super().__init__()
136136
self._decoder = transformer_decoder.TransformerDecoder(
137137
intermediate_dim=4, num_heads=2
138138
)
@@ -160,7 +160,7 @@ def call(self, decoder_input, encoder_output):
160160
def test_one_training_step_of_transformer_without_cross_attention(self):
161161
class MyModel(keras.Model):
162162
def __init__(self):
163-
super(MyModel, self).__init__()
163+
super().__init__()
164164
self._decoder = transformer_decoder.TransformerDecoder(
165165
intermediate_dim=4,
166166
num_heads=2,

0 commit comments

Comments
 (0)