shotgun-api3 3.9.0__py2.py3-none-any.whl → 3.9.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
shotgun_api3/__init__.py CHANGED
@@ -8,6 +8,40 @@
8
8
  # agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
9
9
  # not expressly granted therein are reserved by Shotgun Software Inc.
10
10
 
11
+ import os
12
+ import sys
13
+ import warnings
14
+
15
+ if sys.version_info < (3, 7):
16
+ if os.environ.get("SHOTGUN_ALLOW_OLD_PYTHON", "0") != "1":
17
+ # This is our preferred default behavior when using an old
18
+ # unsupported Python version.
19
+ # This way, we can control where the exception is raised, and it provides a
20
+ # comprehensive error message rather than having users facing a random
21
+ # Python traceback and trying to understand this is due to using an
22
+ # unsupported Python version.
23
+
24
+ raise RuntimeError("This module requires Python version 3.7 or higher.")
25
+
26
+ warnings.warn(
27
+ "Python versions older than 3.7 are no longer supported as of January "
28
+ "2023. Since the SHOTGUN_ALLOW_OLD_PYTHON variable is enabled, this "
29
+ "module is raising a warning instead of an exception. "
30
+ "However, it is very likely that this module will not be able to work "
31
+ "on this Python version.",
32
+ RuntimeWarning,
33
+ stacklevel=2,
34
+ )
35
+ elif sys.version_info < (3, 9):
36
+ warnings.warn(
37
+ "Python versions older than 3.9 are no longer supported as of March "
38
+ "2025 and compatibility will be discontinued after March 2026. "
39
+ "Please update to Python 3.11 or any other supported version.",
40
+ DeprecationWarning,
41
+ stacklevel=2,
42
+ )
43
+
44
+
11
45
  from .shotgun import (
12
46
  Shotgun,
13
47
  ShotgunError,
@@ -115,6 +115,7 @@ Below is a non-exhaustive list of things that we still need to implement:
115
115
  """
116
116
 
117
117
  import datetime
118
+ from typing import Any
118
119
 
119
120
  from ... import ShotgunError
120
121
  from ...shotgun import _Config
@@ -580,7 +581,7 @@ class Shotgun(object):
580
581
  row[field] = default_value
581
582
  return row
582
583
 
583
- def _compare(self, field_type, lval, operator, rval):
584
+ def _compare(self, field_type: str, lval: Any, operator: str, rval: Any) -> bool:
584
585
  """
585
586
  Compares a field using the operator and value provide by the filter.
586
587
 
@@ -797,7 +798,7 @@ class Shotgun(object):
797
798
 
798
799
  return self._compare(field_type, lval, operator, rval)
799
800
 
800
- def _rearrange_filters(self, filters):
801
+ def _rearrange_filters(self, filters: list) -> None:
801
802
  """
802
803
  Modifies the filter syntax to turn it into a list of three items regardless
803
804
  of the actual filter. Most of the filters are list of three elements, so this doesn't change much.
@@ -47,7 +47,7 @@ class SchemaFactory(object):
47
47
  _schema_cache_path = None
48
48
 
49
49
  @classmethod
50
- def get_schemas(cls, schema_path, schema_entity_path):
50
+ def get_schemas(cls, schema_path: str, schema_entity_path: str) -> tuple:
51
51
  """
52
52
  Retrieves the schemas from disk.
53
53
 
shotgun_api3/py.typed ADDED
File without changes