Skip to content

Commit 03811c1

Browse files
SG-39414 Add type annotations (#422)
* Add type annotations (from #393) * Add more fixes * Remove unused types
1 parent 304a153 commit 03811c1

File tree

5 files changed

+371
-227
lines changed

5 files changed

+371
-227
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@
3030
packages=find_packages(exclude=("tests",)),
3131
script_args=sys.argv[1:],
3232
include_package_data=True,
33-
package_data={"": ["cacerts.txt", "cacert.pem"]},
33+
package_data={"": ["cacerts.txt", "cacert.pem", "py.typed"]},
3434
zip_safe=False,
35-
python_requires=">=3.7.0",
35+
python_requires=">=3.9.0",
3636
classifiers=[
3737
"Development Status :: 5 - Production/Stable",
3838
"Intended Audience :: Developers",
3939
"Programming Language :: Python",
40-
"Programming Language :: Python :: 3.7",
4140
"Programming Language :: Python :: 3.9",
4241
"Programming Language :: Python :: 3.10",
4342
"Programming Language :: Python :: 3.11",
43+
"Programming Language :: Python :: 3.12",
4444
"Operating System :: OS Independent",
4545
],
4646
)

shotgun_api3/lib/mockgun/mockgun.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
"""
116116

117117
import datetime
118+
from typing import Any
118119

119120
from ... import ShotgunError
120121
from ...shotgun import _Config
@@ -580,7 +581,7 @@ def _get_new_row(self, entity_type):
580581
row[field] = default_value
581582
return row
582583

583-
def _compare(self, field_type, lval, operator, rval):
584+
def _compare(self, field_type: str, lval: Any, operator: str, rval: Any) -> bool:
584585
"""
585586
Compares a field using the operator and value provide by the filter.
586587
@@ -797,7 +798,7 @@ def _row_matches_filter(self, entity_type, row, sg_filter, retired_only):
797798

798799
return self._compare(field_type, lval, operator, rval)
799800

800-
def _rearrange_filters(self, filters):
801+
def _rearrange_filters(self, filters: list) -> None:
801802
"""
802803
Modifies the filter syntax to turn it into a list of three items regardless
803804
of the actual filter. Most of the filters are list of three elements, so this doesn't change much.

shotgun_api3/lib/mockgun/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SchemaFactory(object):
4747
_schema_cache_path = None
4848

4949
@classmethod
50-
def get_schemas(cls, schema_path, schema_entity_path):
50+
def get_schemas(cls, schema_path: str, schema_entity_path: str) -> tuple:
5151
"""
5252
Retrieves the schemas from disk.
5353

shotgun_api3/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)