Skip to content

Commit

Permalink
Use type(self) instead of entity class name in create methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapaioa authored and JacobCallahan committed May 23, 2024
1 parent 1774a48 commit d5545c1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1381129>`_.
"""
return DiscoveryRule(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -3191,7 +3191,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1219654>`_.
"""
return Domain(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -3685,7 +3685,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1654383>`_.
"""
return HostCollection(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -3765,7 +3765,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1235377>`_.
"""
return HostGroup(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -4405,7 +4405,7 @@ def create(self, create_missing=None):
For more information, see `Bugzilla #1449749
<https://bugzilla.redhat.com/show_bug.cgi?id=1449749>`_.
"""
return Host(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -5458,7 +5458,7 @@ def create(self, create_missing=None):
"""
attrs = self.create_json(create_missing)
return Location(self._server_config, id=attrs['id']).read()
return type(self)(self._server_config, id=attrs['id']).read()

def read(self, entity=None, attrs=None, ignore=None, params=None):
"""Work around a bug in the server's response.
Expand Down Expand Up @@ -5535,7 +5535,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1219653>`_.
"""
return Media(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -5800,7 +5800,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1230873>`_.
"""
return Organization(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -6682,7 +6682,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1232855>`_.
"""
return Realm(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -8284,7 +8284,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1381129>`_.
"""
return TailoringFile(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -8455,7 +8455,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1301658>`_.
"""
return UserGroup(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -8732,7 +8732,7 @@ def create(self, create_missing=None):
<https://bugzilla.redhat.com/show_bug.cgi?id=1381129>`_.
"""
return ScapContents(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down Expand Up @@ -8851,7 +8851,7 @@ def create(self, create_missing=None):
"""
self._fields['event'] = entity_fields.StringField(required=True, choices=self.get_events())

return Webhooks(
return type(self)(
self._server_config,
id=self.create_json(create_missing)['id'],
).read()
Expand Down

0 comments on commit d5545c1

Please sign in to comment.