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

SG-37773 future import removed and super format updated #82

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion dev/build_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

from __future__ import print_function
import sys

sys.dont_write_bytecode = True
Expand Down
2 changes: 1 addition & 1 deletion python/tk_framework_alias/client/socketio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs):
# The connection timeout in seconds
self.__timeout = kwargs.pop("timeout", 20)

super(AliasSocketIoClient, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

# The callbacks registry. Callback functions passed to the server are stored in the
# client by their id, such that they can be looked up and executed when the server
Expand Down
8 changes: 3 additions & 5 deletions python/tk_framework_alias/client/socketio/client_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AliasClientJSONEncoder(json.JSONEncoder):
def __init__(self, *args, **kwargs):
"""Initialize the encoder."""

super(AliasClientJSONEncoder, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

def default(self, obj):
"""Return a serializable object for obj."""
Expand All @@ -67,7 +67,7 @@ def default(self, obj):
# cannot be accessed here, functions must be encoded before getting to this stage.
raise AliasClientJSONEncoderError("Functions should already be encoded.")

return super(AliasClientJSONEncoder, self).default(obj)
return super().default(obj)


class AliasClientJSONDecoder(json.JSONDecoder):
Expand All @@ -76,9 +76,7 @@ class AliasClientJSONDecoder(json.JSONDecoder):
def __init__(self, *args, **kwargs):
"""Initialize the decoder."""

super(AliasClientJSONDecoder, self).__init__(
object_hook=self.object_hook, *args, **kwargs
)
super().__init__(object_hook=self.object_hook, *args, **kwargs)

def object_hook(self, obj):
"""Decode the JSON serialized object obj to a Python object."""
Expand Down
12 changes: 6 additions & 6 deletions python/tk_framework_alias/client/socketio/proxy_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class AliasClientModuleProxyWrapper(AliasClientObjectProxyWrapper):
def __init__(self, module_data):
"""Initialize"""

super(AliasClientModuleProxyWrapper, self).__init__(module_data, module=self)
super().__init__(module_data, module=self)

self.__module_name = module_data["__module_name__"]
self.__sio = None
Expand Down Expand Up @@ -507,7 +507,7 @@ class AliasClientFunctionProxyWrapper(AliasClientObjectProxyWrapper):
def __init__(self, data):
"""Initialize"""

super(AliasClientFunctionProxyWrapper, self).__init__(data)
super().__init__(data)

self.__func_name = data.get("__function_name__")
self.__is_instance_method = data.get("__is_method__", False)
Expand Down Expand Up @@ -575,7 +575,7 @@ class AliasClientClassProxyWrapper(AliasClientObjectProxyWrapper):
def __init__(self, data):
"""Initialize"""

super(AliasClientClassProxyWrapper, self).__init__(data)
super().__init__(data)

self.__class_name = self.data["__class_name__"]

Expand Down Expand Up @@ -617,7 +617,7 @@ class AliasClientEnumProxyWrapper(AliasClientObjectProxyWrapper):
def __init__(self, data):
"""Initialize the enum object."""

super(AliasClientEnumProxyWrapper, self).__init__(data)
super().__init__(data)

self.__name = data.get("__enum_name__")
self.__value = data.get("__enum_value__")
Expand Down Expand Up @@ -717,7 +717,7 @@ class AliasClientObjectProxy(AliasClientObjectProxyWrapper):
def __init__(self, data):
"""Initialize"""

super(AliasClientObjectProxy, self).__init__(data)
super().__init__(data)

self.__unique_id = self.data["__instance_id__"]
self.__dict = self.data["__dict__"]
Expand All @@ -729,7 +729,7 @@ def __str__(self):
obj_name = self.name
if obj_name:
return obj_name
return super(AliasClientObjectProxy, self).__str__()
return super().__str__()

def __repr__(self):
"""Return the string representation of the object."""
Expand Down
2 changes: 1 addition & 1 deletion python/tk_framework_alias/server/socketio/api_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def __str__(self) -> str:
return f"{self.instance}.{func_str}"
except:
# Do not fail on trying to return a string representation.
return super(AliasApiRequestFunctionWrapper, self).__str__()
return super().__str__()

# ----------------------------------------------------------------------------------------
# Class methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):
"""Initialize the namespace."""

namespace = AliasEventsServerNamespace.get_namespace()
super(AliasEventsClientNamespace, self).__init__(namespace)
super().__init__(namespace)

# ----------------------------------------------------------------------------------------
# Event callback methods for namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self):

self.__client_sid = None

super(AliasEventsServerNamespace, self).__init__(self.get_namespace())
super().__init__(self.get_namespace())

# ----------------------------------------------------------------------------------------
# Class methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, sub_namespace=None):
if sub_namespace:
namespace = f"{namespace}-{sub_namespace}"

super(AliasServerNamespace, self).__init__(namespace)
super().__init__(namespace)

# ----------------------------------------------------------------------------------------
# Properties
Expand Down
8 changes: 3 additions & 5 deletions python/tk_framework_alias/server/socketio/server_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class AliasServerJSONEncoder(json.JSONEncoder):
def __init__(self, *args, **kwargs):
"""Initialize the encoder."""

super(AliasServerJSONEncoder, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

@staticmethod
def is_al_object(obj):
Expand Down Expand Up @@ -254,7 +254,7 @@ def default(self, obj):
return self.encode_al_object(obj)

# Fall back to the default encode method.
return super(AliasServerJSONEncoder, self).default(obj)
return super().default(obj)

except Exception as encode_error:
# Catch any errors from encoding and return the exception encoded.
Expand All @@ -267,9 +267,7 @@ class AliasServerJSONDecoder(json.JSONDecoder):
def __init__(self, *args, **kwargs):
"""Initialize the decoder."""

super(AliasServerJSONDecoder, self).__init__(
object_hook=self.object_hook, *args, **kwargs
)
super().__init__(object_hook=self.object_hook, *args, **kwargs)

@staticmethod
def create_callback(callback_id):
Expand Down