Update calls to super() for Python 3 #2144

Closed
opened 2025-12-29 17:22:39 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Nov 27, 2018).

Proposed Changes

Under Python 2, super() must be called with the model and instance referenced explicitly:

class Foo:
    def __init__(self, *args, **kwargs):
        super(Foo, self).__init__(*args, **kwargs)

Python 3 allows for this to be simplified, calling super() with no arguments:

class Foo:
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

Since NetBox no longer supports Python 2 as of v2.5, we can simplify all super() calls.

Justification

Removes superfluous code

Originally created by @jeremystretch on GitHub (Nov 27, 2018). ### Proposed Changes Under Python 2, `super()` must be called with the model and instance referenced explicitly: ``` class Foo: def __init__(self, *args, **kwargs): super(Foo, self).__init__(*args, **kwargs) ``` Python 3 allows for this to be simplified, calling `super()` with no arguments: ``` class Foo: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ``` Since NetBox no longer supports Python 2 as of v2.5, we can simplify all `super()` calls. ### Justification Removes superfluous code
adam added the status: acceptedtype: housekeeping labels 2025-12-29 17:22:39 +01:00
adam closed this issue 2025-12-29 17:22:39 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2144