|
25 | 25 | from __future__ import annotations
|
26 | 26 |
|
27 | 27 | import types
|
| 28 | +# https://docs.python.org/3/whatsnew/3.10.html#pep-604-new-type-union-operator |
| 29 | +# TODO: Remove when py-3.10+ is supported (for union types) |
28 | 30 | import typing
|
29 | 31 | import logging
|
30 | 32 | import functools
|
@@ -127,7 +129,7 @@ def fetch_stage(identifier: typing.Union[str, UsdAsset], context: Ar.ResolverCon
|
127 | 129 | return Usd.Stage.Open(layer, load=load)
|
128 | 130 |
|
129 | 131 |
|
130 |
| -def define_taxon(stage: Usd.Stage, name: str, *, references: tuple[Usd.Prim] = tuple(), id_fields: typing.Mapping[str, str] = types.MappingProxyType({})) -> Usd.Prim: |
| 132 | +def define_taxon(stage: Usd.Stage, name: str, *, references: tuple[Usd.Prim] = tuple(), id_fields: collections.abc.Mapping[str, str] = types.MappingProxyType({})) -> Usd.Prim: |
131 | 133 | """Define a new `taxon group <https://en.wikipedia.org/wiki/Taxon>`_ for asset `taxonomy <https://en.wikipedia.org/wiki/Taxonomy>`_.
|
132 | 134 |
|
133 | 135 | If an existing ``taxon`` with the provided name already exists in the `stage <https://graphics.pixar.com/usd/docs/api/class_usd_stage.html>`_, it is used.
|
@@ -455,12 +457,12 @@ def _root_asset(stage):
|
455 | 457 | def _get_id_fields(prim):
|
456 | 458 | if not (fields:=prim.GetAssetInfoByKey(_ASSETINFO_FIELDS_KEY)):
|
457 | 459 | raise ValueError(f"Missing or empty '{_FIELDS_KEY}' on '{_ASSETINFO_KEY}' asset info for {prim}. Got: {pformat(prim.GetAssetInfoByKey(_ASSETINFO_KEY))}")
|
458 |
| - if not isinstance(fields, typing.Mapping): |
| 460 | + if not isinstance(fields, collections.abc.Mapping): |
459 | 461 | raise TypeError(f"Expected mapping on key '{_FIELDS_KEY}' from {prim} on custom data key '{_ASSETINFO_KEY}'. Got instead {fields} with type: {type(fields)}")
|
460 | 462 | return fields
|
461 | 463 |
|
462 | 464 |
|
463 |
| -def _find_layer_matching(tokens: typing.Mapping, layers: collections.abc.Iterable[Sdf.Layer]) -> Sdf.Layer: |
| 465 | +def _find_layer_matching(tokens: collections.abc.Mapping, layers: collections.abc.Iterable[Sdf.Layer]) -> Sdf.Layer: |
464 | 466 | """Find the first layer matching the given identifier tokens.
|
465 | 467 |
|
466 | 468 | :raises ValueError: If none of the given layers match the provided tokens.
|
|
0 commit comments