55 plugins ,
66 core ,
77)
8+ from typing import Any , Optional , Dict , List
89
910__doc__ = """
1011HookScripts are plugins that run at defined points ("Hooks").
@@ -82,14 +83,14 @@ class HookScript(plugins.PythonPlugin):
8283
8384 def __init__ (
8485 self ,
85- name = None ,
86- filepath = None ,
87- ):
86+ name : Optional [ str ] = None ,
87+ filepath : Optional [ str ] = None ,
88+ ) -> None :
8889 """HookScript plugin constructor."""
8990
9091 super ().__init__ (name , filepath )
9192
92- def run (self , in_timeline , argument_map = {}):
93+ def run (self , in_timeline : Any , argument_map : Optional [ Dict [ str , Any ]] = {}) -> Any :
9394 """Run the hook_function associated with this plugin."""
9495
9596 # @TODO: should in_timeline be passed in place? or should a copy be
@@ -100,13 +101,13 @@ def run(self, in_timeline, argument_map={}):
100101 argument_map = argument_map
101102 )
102103
103- def __str__ (self ):
104+ def __str__ (self ) -> str :
104105 return "HookScript({}, {})" .format (
105106 repr (self .name ),
106107 repr (self .filepath )
107108 )
108109
109- def __repr__ (self ):
110+ def __repr__ (self ) -> str :
110111 return (
111112 "otio.hooks.HookScript("
112113 "name={}, "
@@ -118,24 +119,24 @@ def __repr__(self):
118119 )
119120
120121
121- def names ():
122+ def names () -> List [ str ] :
122123 """Return a list of all the registered hooks."""
123124
124125 return plugins .ActiveManifest ().hooks .keys ()
125126
126127
127- def available_hookscript_names ():
128+ def available_hookscript_names () -> List [ str ] :
128129 """Return the names of HookScripts that have been registered."""
129130
130131 return [hs .name for hs in plugins .ActiveManifest ().hook_scripts ]
131132
132133
133- def available_hookscripts ():
134+ def available_hookscripts () -> List [ Any ] :
134135 """Return the HookScripts objects that have been registered."""
135136 return plugins .ActiveManifest ().hook_scripts
136137
137138
138- def scripts_attached_to (hook ) :
139+ def scripts_attached_to (hook : str ) -> List [ str ] :
139140 """Return an editable list of all the hook scripts that are attached to
140141 the specified hook, in execution order. Changing this list will change the
141142 order that scripts run in, and deleting a script will remove it from
@@ -146,7 +147,7 @@ def scripts_attached_to(hook):
146147 return plugins .ActiveManifest ().hooks [hook ]
147148
148149
149- def run (hook , tl , extra_args = None ):
150+ def run (hook : str , tl : Any , extra_args : Optional [ Dict [ str , Any ]] = None ) -> Any :
150151 """Run all the scripts associated with hook, passing in tl and extra_args.
151152
152153 Will return the return value of the last hook script.
0 commit comments