From 1f6e1abce6fec026c65bb9cd76e89a68dfa0f205 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 28 Nov 2018 16:30:19 +0100 Subject: [PATCH] adding ftrack python api without python 3 support --- .../__init__.py | 0 .../_centralized_storage_scenario.py | 14 +- .../_python_ntpath.py | 0 .../_version.py | 0 .../accessor/__init__.py | 0 .../accessor/base.py | 24 +- .../accessor/disk.py | 24 +- .../accessor/server.py | 20 +- .../attribute.py | 126 ++++----- .../cache.py | 8 +- .../collection.py | 40 +-- .../{ftrack_api_27 => ftrack_api_old}/data.py | 0 .../entity/__init__.py | 0 .../entity/asset_version.py | 4 +- .../entity/base.py | 48 ++-- .../entity/component.py | 12 +- .../entity/factory.py | 86 +++--- .../entity/job.py | 6 +- .../entity/location.py | 122 ++++---- .../entity/note.py | 4 +- .../entity/project_schema.py | 4 +- .../entity/user.py | 16 +- .../event/__init__.py | 0 .../event/base.py | 0 .../event/expression.py | 6 +- .../event/hub.py | 92 +++--- .../event/subscriber.py | 4 +- .../event/subscription.py | 4 +- .../exception.py | 6 +- .../formatter.py | 18 +- .../inspection.py | 42 +-- .../logging.py | 0 .../operation.py | 12 +- .../plugin.py | 0 .../query.py | 14 +- .../__init__.py | 0 .../resource_identifier_transformer/base.py | 4 +- .../session.py | 262 +++++++++--------- .../structure/__init__.py | 0 .../structure/base.py | 0 .../structure/entity_id.py | 4 +- .../structure/id.py | 10 +- .../structure/origin.py | 0 .../structure/standard.py | 16 +- .../symbol.py | 0 45 files changed, 526 insertions(+), 526 deletions(-) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/_centralized_storage_scenario.py (98%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/_python_ntpath.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/_version.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/accessor/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/accessor/base.py (80%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/accessor/disk.py (91%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/accessor/server.py (91%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/attribute.py (83%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/cache.py (98%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/collection.py (93%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/data.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/asset_version.py (97%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/base.py (90%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/component.py (84%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/factory.py (84%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/job.py (89%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/location.py (84%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/note.py (95%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/project_schema.py (97%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/entity/user.py (88%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/base.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/expression.py (98%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/hub.py (91%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/subscriber.py (86%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/event/subscription.py (85%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/exception.py (98%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/formatter.py (88%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/inspection.py (67%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/logging.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/operation.py (87%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/plugin.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/query.py (92%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/resource_identifier_transformer/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/resource_identifier_transformer/base.py (89%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/session.py (90%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/__init__.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/base.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/entity_id.py (71%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/id.py (91%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/origin.py (100%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/structure/standard.py (93%) rename pype/vendor/{ftrack_api_27 => ftrack_api_old}/symbol.py (100%) diff --git a/pype/vendor/ftrack_api_27/__init__.py b/pype/vendor/ftrack_api_old/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/__init__.py rename to pype/vendor/ftrack_api_old/__init__.py diff --git a/pype/vendor/ftrack_api_27/_centralized_storage_scenario.py b/pype/vendor/ftrack_api_old/_centralized_storage_scenario.py similarity index 98% rename from pype/vendor/ftrack_api_27/_centralized_storage_scenario.py rename to pype/vendor/ftrack_api_old/_centralized_storage_scenario.py index fbe14f3277..566e374af4 100644 --- a/pype/vendor/ftrack_api_27/_centralized_storage_scenario.py +++ b/pype/vendor/ftrack_api_old/_centralized_storage_scenario.py @@ -8,9 +8,9 @@ import json import sys import os -import ftrack_api -import ftrack_api.structure.standard as _standard -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old +import ftrack_api_old.structure.standard as _standard +from ftrack_api_old.logging import LazyLogMessage as L scenario_name = 'ftrack.centralized-storage' @@ -446,7 +446,7 @@ class ConfigureCentralizedStorageScenario(object): self.session.commit() # Broadcast an event that storage scenario has been configured. - event = ftrack_api.event.base.Event( + event = ftrack_api_old.event.base.Event( topic='ftrack.storage-scenario.configure-done' ) self.session.event_hub.publish(event) @@ -547,7 +547,7 @@ class ActivateCentralizedStorageScenario(object): 'Unable to read storage scenario data.' ) self.logger.error(L(error_message)) - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'Unable to configure location based on scenario.' ) @@ -568,13 +568,13 @@ class ActivateCentralizedStorageScenario(object): elif sys.platform == 'win32': prefix = mount_points['windows'] else: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( ( 'Unable to find accessor prefix for platform {0}.' ).format(sys.platform) ) - location.accessor = ftrack_api.accessor.disk.DiskAccessor( + location.accessor = ftrack_api_old.accessor.disk.DiskAccessor( prefix=prefix ) location.structure = _standard.StandardStructure() diff --git a/pype/vendor/ftrack_api_27/_python_ntpath.py b/pype/vendor/ftrack_api_old/_python_ntpath.py similarity index 100% rename from pype/vendor/ftrack_api_27/_python_ntpath.py rename to pype/vendor/ftrack_api_old/_python_ntpath.py diff --git a/pype/vendor/ftrack_api_27/_version.py b/pype/vendor/ftrack_api_old/_version.py similarity index 100% rename from pype/vendor/ftrack_api_27/_version.py rename to pype/vendor/ftrack_api_old/_version.py diff --git a/pype/vendor/ftrack_api_27/accessor/__init__.py b/pype/vendor/ftrack_api_old/accessor/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/accessor/__init__.py rename to pype/vendor/ftrack_api_old/accessor/__init__.py diff --git a/pype/vendor/ftrack_api_27/accessor/base.py b/pype/vendor/ftrack_api_old/accessor/base.py similarity index 80% rename from pype/vendor/ftrack_api_27/accessor/base.py rename to pype/vendor/ftrack_api_old/accessor/base.py index 6aa9cf0281..d15d0208db 100644 --- a/pype/vendor/ftrack_api_27/accessor/base.py +++ b/pype/vendor/ftrack_api_old/accessor/base.py @@ -3,7 +3,7 @@ import abc -import ftrack_api.exception +import ftrack_api_old.exception class Accessor(object): @@ -38,9 +38,9 @@ class Accessor(object): Each entry in the returned list should be a valid resource identifier. - Raise :exc:`~ftrack_api.exception.AccessorResourceNotFoundError` if + Raise :exc:`~ftrack_api_old.exception.AccessorResourceNotFoundError` if *resource_identifier* does not exist or - :exc:`~ftrack_api.exception.AccessorResourceInvalidError` if + :exc:`~ftrack_api_old.exception.AccessorResourceInvalidError` if *resource_identifier* is not a container. ''' @@ -63,13 +63,13 @@ class Accessor(object): @abc.abstractmethod def open(self, resource_identifier, mode='rb'): - '''Return :class:`~ftrack_api.data.Data` for *resource_identifier*.''' + '''Return :class:`~ftrack_api_old.data.Data` for *resource_identifier*.''' @abc.abstractmethod def remove(self, resource_identifier): '''Remove *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorResourceNotFoundError` if + Raise :exc:`~ftrack_api_old.exception.AccessorResourceNotFoundError` if *resource_identifier* does not exist. ''' @@ -88,7 +88,7 @@ class Accessor(object): def get_container(self, resource_identifier): '''Return resource_identifier of container for *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorParentResourceNotFoundError` + Raise :exc:`~ftrack_api_old.exception.AccessorParentResourceNotFoundError` if container of *resource_identifier* could not be determined. ''' @@ -100,25 +100,25 @@ class Accessor(object): def get_filesystem_path(self, resource_identifier): # pragma: no cover '''Return filesystem path for *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorFilesystemPathError` if + Raise :exc:`~ftrack_api_old.exception.AccessorFilesystemPathError` if filesystem path could not be determined from *resource_identifier* or - :exc:`~ftrack_api.exception.AccessorUnsupportedOperationError` if + :exc:`~ftrack_api_old.exception.AccessorUnsupportedOperationError` if retrieving filesystem paths is not supported by this accessor. ''' - raise ftrack_api.exception.AccessorUnsupportedOperationError( + raise ftrack_api_old.exception.AccessorUnsupportedOperationError( 'get_filesystem_path', resource_identifier=resource_identifier ) def get_url(self, resource_identifier): '''Return URL for *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorFilesystemPathError` if + Raise :exc:`~ftrack_api_old.exception.AccessorFilesystemPathError` if URL could not be determined from *resource_identifier* or - :exc:`~ftrack_api.exception.AccessorUnsupportedOperationError` if + :exc:`~ftrack_api_old.exception.AccessorUnsupportedOperationError` if retrieving URL is not supported by this accessor. ''' - raise ftrack_api.exception.AccessorUnsupportedOperationError( + raise ftrack_api_old.exception.AccessorUnsupportedOperationError( 'get_url', resource_identifier=resource_identifier ) diff --git a/pype/vendor/ftrack_api_27/accessor/disk.py b/pype/vendor/ftrack_api_old/accessor/disk.py similarity index 91% rename from pype/vendor/ftrack_api_27/accessor/disk.py rename to pype/vendor/ftrack_api_old/accessor/disk.py index 65769603f6..7c6c91fcb9 100644 --- a/pype/vendor/ftrack_api_27/accessor/disk.py +++ b/pype/vendor/ftrack_api_old/accessor/disk.py @@ -6,10 +6,10 @@ import sys import errno import contextlib -import ftrack_api._python_ntpath as ntpath -import ftrack_api.accessor.base -import ftrack_api.data -from ftrack_api.exception import ( +import ftrack_api_old._python_ntpath as ntpath +import ftrack_api_old.accessor.base +import ftrack_api_old.data +from ftrack_api_old.exception import ( AccessorFilesystemPathError, AccessorUnsupportedOperationError, AccessorResourceNotFoundError, @@ -21,7 +21,7 @@ from ftrack_api.exception import ( ) -class DiskAccessor(ftrack_api.accessor.base.Accessor): +class DiskAccessor(ftrack_api_old.accessor.base.Accessor): '''Provide disk access to a location. Expect resource identifiers to refer to relative filesystem paths. @@ -48,9 +48,9 @@ class DiskAccessor(ftrack_api.accessor.base.Accessor): Each entry in the returned list should be a valid resource identifier. - Raise :exc:`~ftrack_api.exception.AccessorResourceNotFoundError` if + Raise :exc:`~ftrack_api_old.exception.AccessorResourceNotFoundError` if *resource_identifier* does not exist or - :exc:`~ftrack_api.exception.AccessorResourceInvalidError` if + :exc:`~ftrack_api_old.exception.AccessorResourceInvalidError` if *resource_identifier* is not a container. ''' @@ -85,20 +85,20 @@ class DiskAccessor(ftrack_api.accessor.base.Accessor): raise AccessorUnsupportedOperationError(operation='is_sequence') def open(self, resource_identifier, mode='rb'): - '''Return :class:`~ftrack_api.Data` for *resource_identifier*.''' + '''Return :class:`~ftrack_api_old.Data` for *resource_identifier*.''' filesystem_path = self.get_filesystem_path(resource_identifier) with error_handler( operation='open', resource_identifier=resource_identifier ): - data = ftrack_api.data.File(filesystem_path, mode) + data = ftrack_api_old.data.File(filesystem_path, mode) return data def remove(self, resource_identifier): '''Remove *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorResourceNotFoundError` if + Raise :exc:`~ftrack_api_old.exception.AccessorResourceNotFoundError` if *resource_identifier* does not exist. ''' @@ -153,7 +153,7 @@ class DiskAccessor(ftrack_api.accessor.base.Accessor): def get_container(self, resource_identifier): '''Return resource_identifier of container for *resource_identifier*. - Raise :exc:`~ftrack_api.exception.AccessorParentResourceNotFoundError` if + Raise :exc:`~ftrack_api_old.exception.AccessorParentResourceNotFoundError` if container of *resource_identifier* could not be determined. ''' @@ -192,7 +192,7 @@ class DiskAccessor(ftrack_api.accessor.base.Accessor): >>> print accessor.get_filesystem_path('/mountpoint/test.txt') /mountpoint/test.txt - Raise :exc:`ftrack_api.exception.AccessorFilesystemPathError` if filesystem + Raise :exc:`ftrack_api_old.exception.AccessorFilesystemPathError` if filesystem path could not be determined from *resource_identifier*. ''' diff --git a/pype/vendor/ftrack_api_27/accessor/server.py b/pype/vendor/ftrack_api_old/accessor/server.py similarity index 91% rename from pype/vendor/ftrack_api_27/accessor/server.py rename to pype/vendor/ftrack_api_old/accessor/server.py index 9c735084d5..bd88093837 100644 --- a/pype/vendor/ftrack_api_27/accessor/server.py +++ b/pype/vendor/ftrack_api_old/accessor/server.py @@ -10,8 +10,8 @@ import requests from .base import Accessor from ..data import String -import ftrack_api.exception -import ftrack_api.symbol +import ftrack_api_old.exception +import ftrack_api_old.symbol class ServerFile(String): @@ -59,11 +59,11 @@ class ServerFile(String): try: response.raise_for_status() except requests.exceptions.HTTPError as error: - raise ftrack_api.exception.AccessorOperationFailedError( + raise ftrack_api_old.exception.AccessorOperationFailedError( 'Failed to read data: {0}.'.format(error) ) - for block in response.iter_content(ftrack_api.symbol.CHUNK_SIZE): + for block in response.iter_content(ftrack_api_old.symbol.CHUNK_SIZE): self.wrapped_file.write(block) self.flush() @@ -77,7 +77,7 @@ class ServerFile(String): # Retrieve component from cache to construct a filename. component = self._session.get('FileComponent', self.resource_identifier) if not component: - raise ftrack_api.exception.AccessorOperationFailedError( + raise ftrack_api_old.exception.AccessorOperationFailedError( 'Unable to retrieve component with id: {0}.'.format( self.resource_identifier ) @@ -99,7 +99,7 @@ class ServerFile(String): checksum=self._compute_checksum() ) except Exception as error: - raise ftrack_api.exception.AccessorOperationFailedError( + raise ftrack_api_old.exception.AccessorOperationFailedError( 'Failed to get put metadata: {0}.'.format(error) ) @@ -116,7 +116,7 @@ class ServerFile(String): try: response.raise_for_status() except requests.exceptions.HTTPError as error: - raise ftrack_api.exception.AccessorOperationFailedError( + raise ftrack_api_old.exception.AccessorOperationFailedError( 'Failed to put file to server: {0}.'.format(error) ) @@ -133,7 +133,7 @@ class ServerFile(String): def _compute_checksum(self): '''Return checksum for file.''' fp = self.wrapped_file - buf_size = ftrack_api.symbol.CHUNK_SIZE + buf_size = ftrack_api_old.symbol.CHUNK_SIZE hash_obj = hashlib.md5() spos = fp.tell() @@ -160,7 +160,7 @@ class _ServerAccessor(Accessor): self._session = session def open(self, resource_identifier, mode='rb'): - '''Return :py:class:`~ftrack_api.Data` for *resource_identifier*.''' + '''Return :py:class:`~ftrack_api_old.Data` for *resource_identifier*.''' return ServerFile(resource_identifier, session=self._session, mode=mode) def remove(self, resourceIdentifier): @@ -174,7 +174,7 @@ class _ServerAccessor(Accessor): } ) if response.status_code != 200: - raise ftrack_api.exception.AccessorOperationFailedError( + raise ftrack_api_old.exception.AccessorOperationFailedError( 'Failed to remove file.' ) diff --git a/pype/vendor/ftrack_api_27/attribute.py b/pype/vendor/ftrack_api_old/attribute.py similarity index 83% rename from pype/vendor/ftrack_api_27/attribute.py rename to pype/vendor/ftrack_api_old/attribute.py index 4497066c1e..66840bed66 100644 --- a/pype/vendor/ftrack_api_27/attribute.py +++ b/pype/vendor/ftrack_api_old/attribute.py @@ -8,11 +8,11 @@ import copy import logging import functools -import ftrack_api.symbol -import ftrack_api.exception -import ftrack_api.collection -import ftrack_api.inspection -import ftrack_api.operation +import ftrack_api_old.symbol +import ftrack_api_old.exception +import ftrack_api_old.collection +import ftrack_api_old.inspection +import ftrack_api_old.operation logger = logging.getLogger( __name__ @@ -42,9 +42,9 @@ def merge_references(function): if isinstance( local_value, ( - ftrack_api.entity.base.Entity, - ftrack_api.collection.Collection, - ftrack_api.collection.MappedCollectionProxy + ftrack_api_old.entity.base.Entity, + ftrack_api_old.collection.Collection, + ftrack_api_old.collection.MappedCollectionProxy ) ): logger.debug( @@ -64,9 +64,9 @@ def merge_references(function): if isinstance( remote_value, ( - ftrack_api.entity.base.Entity, - ftrack_api.collection.Collection, - ftrack_api.collection.MappedCollectionProxy + ftrack_api_old.entity.base.Entity, + ftrack_api_old.collection.Collection, + ftrack_api_old.collection.MappedCollectionProxy ) ): logger.debug( @@ -105,7 +105,7 @@ class Attributes(object): '''Add *attribute*.''' existing = self._data.get(attribute.name, None) if existing: - raise ftrack_api.exception.NotUniqueError( + raise ftrack_api_old.exception.NotUniqueError( 'Attribute with name {0} already added as {1}' .format(attribute.name, existing) ) @@ -148,7 +148,7 @@ class Attribute(object): '''A name and value pair persisted remotely.''' def __init__( - self, name, default_value=ftrack_api.symbol.NOT_SET, mutable=True + self, name, default_value=ftrack_api_old.symbol.NOT_SET, mutable=True ): '''Initialise attribute with *name*. @@ -158,8 +158,8 @@ class Attribute(object): If *mutable* is set to False then the local value of the attribute on an entity can only be set when both the existing local and remote values - are :attr:`ftrack_api.symbol.NOT_SET`. The exception to this is when the - target value is also :attr:`ftrack_api.symbol.NOT_SET`. + are :attr:`ftrack_api_old.symbol.NOT_SET`. The exception to this is when the + target value is also :attr:`ftrack_api_old.symbol.NOT_SET`. ''' super(Attribute, self).__init__() @@ -187,8 +187,8 @@ class Attribute(object): storage = collections.defaultdict( lambda: { - self._local_key: ftrack_api.symbol.NOT_SET, - self._remote_key: ftrack_api.symbol.NOT_SET + self._local_key: ftrack_api_old.symbol.NOT_SET, + self._remote_key: ftrack_api_old.symbol.NOT_SET } ) setattr(entity, storage_key, storage) @@ -214,11 +214,11 @@ class Attribute(object): ''' value = self.get_local_value(entity) - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: return value value = self.get_remote_value(entity) - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: return value if not entity.session.auto_populate: @@ -248,9 +248,9 @@ class Attribute(object): if ( not self.mutable and self.is_set(entity) - and value is not ftrack_api.symbol.NOT_SET + and value is not ftrack_api_old.symbol.NOT_SET ): - raise ftrack_api.exception.ImmutableAttributeError(self) + raise ftrack_api_old.exception.ImmutableAttributeError(self) old_value = self.get_local_value(entity) @@ -260,9 +260,9 @@ class Attribute(object): # Record operation. if entity.session.record_operations: entity.session.recorded_operations.push( - ftrack_api.operation.UpdateEntityOperation( + ftrack_api_old.operation.UpdateEntityOperation( entity.entity_type, - ftrack_api.inspection.primary_key(entity), + ftrack_api_old.inspection.primary_key(entity), self.name, old_value, value @@ -296,15 +296,15 @@ class Attribute(object): local_value = self.get_local_value(entity) remote_value = self.get_remote_value(entity) return ( - local_value is not ftrack_api.symbol.NOT_SET + local_value is not ftrack_api_old.symbol.NOT_SET and local_value != remote_value ) def is_set(self, entity): '''Return whether a value is set for *entity*.''' return any([ - self.get_local_value(entity) is not ftrack_api.symbol.NOT_SET, - self.get_remote_value(entity) is not ftrack_api.symbol.NOT_SET + self.get_local_value(entity) is not ftrack_api_old.symbol.NOT_SET, + self.get_remote_value(entity) is not ftrack_api_old.symbol.NOT_SET ]) @@ -356,15 +356,15 @@ class ReferenceAttribute(Attribute): local_value = self.get_local_value(entity) remote_value = self.get_remote_value(entity) - if local_value is ftrack_api.symbol.NOT_SET: + if local_value is ftrack_api_old.symbol.NOT_SET: return False - if remote_value is ftrack_api.symbol.NOT_SET: + if remote_value is ftrack_api_old.symbol.NOT_SET: return True if ( - ftrack_api.inspection.identity(local_value) - != ftrack_api.inspection.identity(remote_value) + ftrack_api_old.inspection.identity(local_value) + != ftrack_api_old.inspection.identity(remote_value) ): return True @@ -405,13 +405,13 @@ class AbstractCollectionAttribute(Attribute): local_value = self.get_local_value(entity) remote_value = self.get_remote_value(entity) if ( - local_value is ftrack_api.symbol.NOT_SET + local_value is ftrack_api_old.symbol.NOT_SET and isinstance(remote_value, self.collection_class) ): try: with entity.session.operation_recording(False): self.set_local_value(entity, copy.copy(remote_value)) - except ftrack_api.exception.ImmutableAttributeError: + except ftrack_api_old.exception.ImmutableAttributeError: pass value = self.get_local_value(entity) @@ -422,7 +422,7 @@ class AbstractCollectionAttribute(Attribute): # newly created entity for example. It *could* be done as a simple # default value, but that would incur cost for every collection even # when they are not modified before commit. - if value is ftrack_api.symbol.NOT_SET: + if value is ftrack_api_old.symbol.NOT_SET: try: with entity.session.operation_recording(False): self.set_local_value( @@ -430,14 +430,14 @@ class AbstractCollectionAttribute(Attribute): # None should be treated as empty collection. None ) - except ftrack_api.exception.ImmutableAttributeError: + except ftrack_api_old.exception.ImmutableAttributeError: pass return self.get_local_value(entity) def set_local_value(self, entity, value): '''Set local *value* for *entity*.''' - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: value = self._adapt_to_collection(entity, value) value.mutable = self.mutable @@ -451,7 +451,7 @@ class AbstractCollectionAttribute(Attribute): Only set locally stored remote value, do not persist to remote. ''' - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: value = self._adapt_to_collection(entity, value) value.mutable = False @@ -472,18 +472,18 @@ class CollectionAttribute(AbstractCollectionAttribute): '''Represent a collection of other entities.''' #: Collection class used by attribute. - collection_class = ftrack_api.collection.Collection + collection_class = ftrack_api_old.collection.Collection def _adapt_to_collection(self, entity, value): '''Adapt *value* to a Collection instance on *entity*.''' - if not isinstance(value, ftrack_api.collection.Collection): + if not isinstance(value, ftrack_api_old.collection.Collection): if value is None: - value = ftrack_api.collection.Collection(entity, self) + value = ftrack_api_old.collection.Collection(entity, self) elif isinstance(value, list): - value = ftrack_api.collection.Collection( + value = ftrack_api_old.collection.Collection( entity, self, data=value ) @@ -494,7 +494,7 @@ class CollectionAttribute(AbstractCollectionAttribute): else: if value.attribute is not self: - raise ftrack_api.exception.AttributeError( + raise ftrack_api_old.exception.AttributeError( 'Collection already bound to a different attribute' ) @@ -505,7 +505,7 @@ class KeyValueMappedCollectionAttribute(AbstractCollectionAttribute): '''Represent a mapped key, value collection of entities.''' #: Collection class used by attribute. - collection_class = ftrack_api.collection.KeyValueMappedCollectionProxy + collection_class = ftrack_api_old.collection.KeyValueMappedCollectionProxy def __init__( self, name, creator, key_attribute, value_attribute, **kw @@ -532,24 +532,24 @@ class KeyValueMappedCollectionAttribute(AbstractCollectionAttribute): def _adapt_to_collection(self, entity, value): '''Adapt *value* to an *entity*.''' if not isinstance( - value, ftrack_api.collection.KeyValueMappedCollectionProxy + value, ftrack_api_old.collection.KeyValueMappedCollectionProxy ): if value is None: - value = ftrack_api.collection.KeyValueMappedCollectionProxy( - ftrack_api.collection.Collection(entity, self), + value = ftrack_api_old.collection.KeyValueMappedCollectionProxy( + ftrack_api_old.collection.Collection(entity, self), self.creator, self.key_attribute, self.value_attribute ) - elif isinstance(value, (list, ftrack_api.collection.Collection)): + elif isinstance(value, (list, ftrack_api_old.collection.Collection)): if isinstance(value, list): - value = ftrack_api.collection.Collection( + value = ftrack_api_old.collection.Collection( entity, self, data=value ) - value = ftrack_api.collection.KeyValueMappedCollectionProxy( + value = ftrack_api_old.collection.KeyValueMappedCollectionProxy( value, self.creator, self.key_attribute, self.value_attribute ) @@ -565,7 +565,7 @@ class KeyValueMappedCollectionAttribute(AbstractCollectionAttribute): current_value = self.get_value(entity) if not isinstance( current_value, - ftrack_api.collection.KeyValueMappedCollectionProxy + ftrack_api_old.collection.KeyValueMappedCollectionProxy ): raise NotImplementedError( 'Cannot adapt mapping to collection as current value ' @@ -576,11 +576,11 @@ class KeyValueMappedCollectionAttribute(AbstractCollectionAttribute): # basis. Then update through proxy interface to ensure all # internal operations called consistently (such as entity # deletion for key removal). - collection = ftrack_api.collection.Collection( + collection = ftrack_api_old.collection.Collection( entity, self, data=current_value.collection[:] ) collection_proxy = ( - ftrack_api.collection.KeyValueMappedCollectionProxy( + ftrack_api_old.collection.KeyValueMappedCollectionProxy( collection, self.creator, self.key_attribute, self.value_attribute ) @@ -603,7 +603,7 @@ class KeyValueMappedCollectionAttribute(AbstractCollectionAttribute): ) else: if value.attribute is not self: - raise ftrack_api.exception.AttributeError( + raise ftrack_api_old.exception.AttributeError( 'Collection already bound to a different attribute.' ) @@ -615,30 +615,30 @@ class CustomAttributeCollectionAttribute(AbstractCollectionAttribute): #: Collection class used by attribute. collection_class = ( - ftrack_api.collection.CustomAttributeCollectionProxy + ftrack_api_old.collection.CustomAttributeCollectionProxy ) def _adapt_to_collection(self, entity, value): '''Adapt *value* to an *entity*.''' if not isinstance( - value, ftrack_api.collection.CustomAttributeCollectionProxy + value, ftrack_api_old.collection.CustomAttributeCollectionProxy ): if value is None: - value = ftrack_api.collection.CustomAttributeCollectionProxy( - ftrack_api.collection.Collection(entity, self) + value = ftrack_api_old.collection.CustomAttributeCollectionProxy( + ftrack_api_old.collection.Collection(entity, self) ) - elif isinstance(value, (list, ftrack_api.collection.Collection)): + elif isinstance(value, (list, ftrack_api_old.collection.Collection)): # Why are we creating a new if it is a list? This will cause # any merge to create a new proxy and collection. if isinstance(value, list): - value = ftrack_api.collection.Collection( + value = ftrack_api_old.collection.Collection( entity, self, data=value ) - value = ftrack_api.collection.CustomAttributeCollectionProxy( + value = ftrack_api_old.collection.CustomAttributeCollectionProxy( value ) @@ -653,7 +653,7 @@ class CustomAttributeCollectionAttribute(AbstractCollectionAttribute): current_value = self.get_value(entity) if not isinstance( current_value, - ftrack_api.collection.CustomAttributeCollectionProxy + ftrack_api_old.collection.CustomAttributeCollectionProxy ): raise NotImplementedError( 'Cannot adapt mapping to collection as current value ' @@ -664,11 +664,11 @@ class CustomAttributeCollectionAttribute(AbstractCollectionAttribute): # basis. Then update through proxy interface to ensure all # internal operations called consistently (such as entity # deletion for key removal). - collection = ftrack_api.collection.Collection( + collection = ftrack_api_old.collection.Collection( entity, self, data=current_value.collection[:] ) collection_proxy = ( - ftrack_api.collection.CustomAttributeCollectionProxy( + ftrack_api_old.collection.CustomAttributeCollectionProxy( collection ) ) @@ -690,7 +690,7 @@ class CustomAttributeCollectionAttribute(AbstractCollectionAttribute): ) else: if value.attribute is not self: - raise ftrack_api.exception.AttributeError( + raise ftrack_api_old.exception.AttributeError( 'Collection already bound to a different attribute.' ) diff --git a/pype/vendor/ftrack_api_27/cache.py b/pype/vendor/ftrack_api_old/cache.py similarity index 98% rename from pype/vendor/ftrack_api_27/cache.py rename to pype/vendor/ftrack_api_old/cache.py index 49456dc2d7..b62fe176bc 100644 --- a/pype/vendor/ftrack_api_27/cache.py +++ b/pype/vendor/ftrack_api_old/cache.py @@ -28,8 +28,8 @@ try: except ImportError: # pragma: no cover import pickle -import ftrack_api.inspection -import ftrack_api.symbol +import ftrack_api_old.inspection +import ftrack_api_old.symbol class Cache(object): @@ -166,7 +166,7 @@ class LayeredCache(Cache): ''' target_caches = [] - value = ftrack_api.symbol.NOT_SET + value = ftrack_api_old.symbol.NOT_SET for cache in self.caches: try: @@ -177,7 +177,7 @@ class LayeredCache(Cache): else: break - if value is ftrack_api.symbol.NOT_SET: + if value is ftrack_api_old.symbol.NOT_SET: raise KeyError(key) # Set value on all higher level caches. diff --git a/pype/vendor/ftrack_api_27/collection.py b/pype/vendor/ftrack_api_old/collection.py similarity index 93% rename from pype/vendor/ftrack_api_27/collection.py rename to pype/vendor/ftrack_api_old/collection.py index 91655a7b02..177c423df0 100644 --- a/pype/vendor/ftrack_api_27/collection.py +++ b/pype/vendor/ftrack_api_old/collection.py @@ -8,12 +8,12 @@ import logging import collections import copy -import ftrack_api.exception -import ftrack_api.inspection -import ftrack_api.symbol -import ftrack_api.operation -import ftrack_api.cache -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old.exception +import ftrack_api_old.inspection +import ftrack_api_old.symbol +import ftrack_api_old.operation +import ftrack_api_old.cache +from ftrack_api_old.logging import LazyLogMessage as L class Collection(collections.MutableSequence): @@ -43,7 +43,7 @@ class Collection(collections.MutableSequence): def _identity_key(self, entity): '''Return identity key for *entity*.''' - return str(ftrack_api.inspection.identity(entity)) + return str(ftrack_api_old.inspection.identity(entity)) def __copy__(self): '''Return shallow copy. @@ -67,9 +67,9 @@ class Collection(collections.MutableSequence): # Record operation. if self.entity.session.record_operations: self.entity.session.recorded_operations.push( - ftrack_api.operation.UpdateEntityOperation( + ftrack_api_old.operation.UpdateEntityOperation( self.entity.entity_type, - ftrack_api.inspection.primary_key(self.entity), + ftrack_api_old.inspection.primary_key(self.entity), self.attribute.name, old_value, self @@ -79,10 +79,10 @@ class Collection(collections.MutableSequence): def insert(self, index, item): '''Insert *item* at *index*.''' if not self.mutable: - raise ftrack_api.exception.ImmutableCollectionError(self) + raise ftrack_api_old.exception.ImmutableCollectionError(self) if item in self: - raise ftrack_api.exception.DuplicateItemInCollectionError( + raise ftrack_api_old.exception.DuplicateItemInCollectionError( item, self ) @@ -102,7 +102,7 @@ class Collection(collections.MutableSequence): def __setitem__(self, index, item): '''Set *item* against *index*.''' if not self.mutable: - raise ftrack_api.exception.ImmutableCollectionError(self) + raise ftrack_api_old.exception.ImmutableCollectionError(self) try: existing_index = self.index(item) @@ -110,7 +110,7 @@ class Collection(collections.MutableSequence): pass else: if index != existing_index: - raise ftrack_api.exception.DuplicateItemInCollectionError( + raise ftrack_api_old.exception.DuplicateItemInCollectionError( item, self ) @@ -129,7 +129,7 @@ class Collection(collections.MutableSequence): def __delitem__(self, index): '''Remove item at *index*.''' if not self.mutable: - raise ftrack_api.exception.ImmutableCollectionError(self) + raise ftrack_api_old.exception.ImmutableCollectionError(self) old_value = copy.copy(self) item = self._data[index] @@ -256,8 +256,8 @@ class KeyValueMappedCollectionProxy(MappedCollectionProxy): entity = self.creator(self, data) if ( - ftrack_api.inspection.state(entity) is - ftrack_api.symbol.CREATED + ftrack_api_old.inspection.state(entity) is + ftrack_api_old.symbol.CREATED ): # Persisting this entity will be handled here, record the # operation. @@ -308,7 +308,7 @@ class KeyValueMappedCollectionProxy(MappedCollectionProxy): return len(keys) -class PerSessionDefaultKeyMaker(ftrack_api.cache.KeyMaker): +class PerSessionDefaultKeyMaker(ftrack_api_old.cache.KeyMaker): '''Generate key for session.''' def _key(self, obj): @@ -323,8 +323,8 @@ class PerSessionDefaultKeyMaker(ftrack_api.cache.KeyMaker): #: Memoiser for use with callables that should be called once per session. -memoise_session = ftrack_api.cache.memoise_decorator( - ftrack_api.cache.Memoiser( +memoise_session = ftrack_api_old.cache.memoise_decorator( + ftrack_api_old.cache.Memoiser( key_maker=PerSessionDefaultKeyMaker(), return_copies=False ) ) @@ -491,7 +491,7 @@ class CustomAttributeCollectionProxy(MappedCollectionProxy): def __eq__(self, collection): '''Return True if *collection* equals proxy collection.''' - if collection is ftrack_api.symbol.NOT_SET: + if collection is ftrack_api_old.symbol.NOT_SET: return False return collection.collection == self.collection diff --git a/pype/vendor/ftrack_api_27/data.py b/pype/vendor/ftrack_api_old/data.py similarity index 100% rename from pype/vendor/ftrack_api_27/data.py rename to pype/vendor/ftrack_api_old/data.py diff --git a/pype/vendor/ftrack_api_27/entity/__init__.py b/pype/vendor/ftrack_api_old/entity/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/entity/__init__.py rename to pype/vendor/ftrack_api_old/entity/__init__.py diff --git a/pype/vendor/ftrack_api_27/entity/asset_version.py b/pype/vendor/ftrack_api_old/entity/asset_version.py similarity index 97% rename from pype/vendor/ftrack_api_27/entity/asset_version.py rename to pype/vendor/ftrack_api_old/entity/asset_version.py index 859d94e436..0473dde80f 100644 --- a/pype/vendor/ftrack_api_27/entity/asset_version.py +++ b/pype/vendor/ftrack_api_old/entity/asset_version.py @@ -1,10 +1,10 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.entity.base +import ftrack_api_old.entity.base -class AssetVersion(ftrack_api.entity.base.Entity): +class AssetVersion(ftrack_api_old.entity.base.Entity): '''Represent asset version.''' def create_component( diff --git a/pype/vendor/ftrack_api_27/entity/base.py b/pype/vendor/ftrack_api_old/entity/base.py similarity index 90% rename from pype/vendor/ftrack_api_27/entity/base.py rename to pype/vendor/ftrack_api_old/entity/base.py index f5a1a3cec3..f4942b5181 100644 --- a/pype/vendor/ftrack_api_27/entity/base.py +++ b/pype/vendor/ftrack_api_old/entity/base.py @@ -7,12 +7,12 @@ import abc import collections import logging -import ftrack_api.symbol -import ftrack_api.attribute -import ftrack_api.inspection -import ftrack_api.exception -import ftrack_api.operation -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old.symbol +import ftrack_api_old.attribute +import ftrack_api_old.inspection +import ftrack_api_old.exception +import ftrack_api_old.operation +from ftrack_api_old.logging import LazyLogMessage as L class DynamicEntityTypeMetaclass(abc.ABCMeta): @@ -41,7 +41,7 @@ class Entity(collections.MutableMapping): def __init__(self, session, data=None, reconstructing=False): '''Initialise entity. - *session* is an instance of :class:`ftrack_api.session.Session` that + *session* is an instance of :class:`ftrack_api_old.session.Session` that this entity instance is bound to. *data* is a mapping of key, value pairs to apply as initial attribute @@ -105,7 +105,7 @@ class Entity(collections.MutableMapping): )) continue - if not isinstance(attribute, ftrack_api.attribute.ScalarAttribute): + if not isinstance(attribute, ftrack_api_old.attribute.ScalarAttribute): relational_attributes.setdefault( attribute, value ) @@ -133,13 +133,13 @@ class Entity(collections.MutableMapping): # collections that are automatically generated on access. for attribute in self.attributes: value = attribute.get_local_value(self) - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: entity_data[attribute.name] = value self.session.recorded_operations.push( - ftrack_api.operation.CreateEntityOperation( + ftrack_api_old.operation.CreateEntityOperation( self.entity_type, - ftrack_api.inspection.primary_key(self), + ftrack_api_old.inspection.primary_key(self), entity_data ) ) @@ -182,7 +182,7 @@ class Entity(collections.MutableMapping): with self.session.auto_populating(False): primary_key = ['Unknown'] try: - primary_key = ftrack_api.inspection.primary_key(self).values() + primary_key = ftrack_api_old.inspection.primary_key(self).values() except KeyError: pass @@ -192,7 +192,7 @@ class Entity(collections.MutableMapping): def __hash__(self): '''Return hash representing instance.''' - return hash(str(ftrack_api.inspection.identity(self))) + return hash(str(ftrack_api_old.inspection.identity(self))) def __eq__(self, other): '''Return whether *other* is equal to this instance. @@ -205,8 +205,8 @@ class Entity(collections.MutableMapping): ''' try: return ( - ftrack_api.inspection.identity(other) - == ftrack_api.inspection.identity(self) + ftrack_api_old.inspection.identity(other) + == ftrack_api_old.inspection.identity(self) ) except (AttributeError, KeyError): return False @@ -237,7 +237,7 @@ class Entity(collections.MutableMapping): ''' attribute = self.__class__.attributes.get(key) - attribute.set_local_value(self, ftrack_api.symbol.NOT_SET) + attribute.set_local_value(self, ftrack_api_old.symbol.NOT_SET) def __iter__(self): '''Iterate over all attributes keys.''' @@ -278,7 +278,7 @@ class Entity(collections.MutableMapping): '''Merge *entity* attribute values and other data into this entity. Only merge values from *entity* that are not - :attr:`ftrack_api.symbol.NOT_SET`. + :attr:`ftrack_api_old.symbol.NOT_SET`. Return a list of changes made with each change being a mapping with the keys: @@ -305,7 +305,7 @@ class Entity(collections.MutableMapping): # this entity. attributes = collections.deque() for attribute in entity.attributes: - if isinstance(attribute, ftrack_api.attribute.ScalarAttribute): + if isinstance(attribute, ftrack_api_old.attribute.ScalarAttribute): attributes.appendleft(attribute) else: attributes.append(attribute) @@ -315,7 +315,7 @@ class Entity(collections.MutableMapping): # Local attributes. other_local_value = other_attribute.get_local_value(entity) - if other_local_value is not ftrack_api.symbol.NOT_SET: + if other_local_value is not ftrack_api_old.symbol.NOT_SET: local_value = attribute.get_local_value(self) if local_value != other_local_value: merged_local_value = self.session.merge( @@ -335,7 +335,7 @@ class Entity(collections.MutableMapping): # Remote attributes. other_remote_value = other_attribute.get_remote_value(entity) - if other_remote_value is not ftrack_api.symbol.NOT_SET: + if other_remote_value is not ftrack_api_old.symbol.NOT_SET: remote_value = attribute.get_remote_value(self) if remote_value != other_remote_value: merged_remote_value = self.session.merge( @@ -361,7 +361,7 @@ class Entity(collections.MutableMapping): # they may store a local copy of the remote attribute # even though it may not be modified. if not isinstance( - attribute, ftrack_api.attribute.AbstractCollectionAttribute + attribute, ftrack_api_old.attribute.AbstractCollectionAttribute ): continue @@ -371,7 +371,7 @@ class Entity(collections.MutableMapping): # Populated but not modified, update it. if ( - local_value is not ftrack_api.symbol.NOT_SET and + local_value is not ftrack_api_old.symbol.NOT_SET and local_value == remote_value ): attribute.set_local_value( @@ -394,8 +394,8 @@ class Entity(collections.MutableMapping): '''Populate all unset scalar attributes in one query.''' projections = [] for attribute in self.attributes: - if isinstance(attribute, ftrack_api.attribute.ScalarAttribute): - if attribute.get_remote_value(self) is ftrack_api.symbol.NOT_SET: + if isinstance(attribute, ftrack_api_old.attribute.ScalarAttribute): + if attribute.get_remote_value(self) is ftrack_api_old.symbol.NOT_SET: projections.append(attribute.name) if projections: diff --git a/pype/vendor/ftrack_api_27/entity/component.py b/pype/vendor/ftrack_api_old/entity/component.py similarity index 84% rename from pype/vendor/ftrack_api_27/entity/component.py rename to pype/vendor/ftrack_api_old/entity/component.py index 9d59c4c051..2f43ae1614 100644 --- a/pype/vendor/ftrack_api_27/entity/component.py +++ b/pype/vendor/ftrack_api_old/entity/component.py @@ -1,10 +1,10 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.entity.base +import ftrack_api_old.entity.base -class Component(ftrack_api.entity.base.Entity): +class Component(ftrack_api_old.entity.base.Entity): '''Represent a component.''' def get_availability(self, locations=None): @@ -28,7 +28,7 @@ class CreateThumbnailMixin(object): Creates a thumbnail component using in the ftrack.server location :meth:`Session.create_component - ` The thumbnail component + ` The thumbnail component will be created using *data* if specified. If no component name is given, `thumbnail` will be used. @@ -37,7 +37,7 @@ class CreateThumbnailMixin(object): .. note:: - A :meth:`Session.commit` will be + A :meth:`Session.commit` will be automatically issued. ''' @@ -51,10 +51,10 @@ class CreateThumbnailMixin(object): ) origin_location = self.session.get( - 'Location', ftrack_api.symbol.ORIGIN_LOCATION_ID + 'Location', ftrack_api_old.symbol.ORIGIN_LOCATION_ID ) server_location = self.session.get( - 'Location', ftrack_api.symbol.SERVER_LOCATION_ID + 'Location', ftrack_api_old.symbol.SERVER_LOCATION_ID ) server_location.add_component(thumbnail_component, [origin_location]) diff --git a/pype/vendor/ftrack_api_27/entity/factory.py b/pype/vendor/ftrack_api_old/entity/factory.py similarity index 84% rename from pype/vendor/ftrack_api_27/entity/factory.py rename to pype/vendor/ftrack_api_old/entity/factory.py index 5a6a65a288..16721514bd 100644 --- a/pype/vendor/ftrack_api_27/entity/factory.py +++ b/pype/vendor/ftrack_api_old/entity/factory.py @@ -7,18 +7,18 @@ import logging import uuid import functools -import ftrack_api.attribute -import ftrack_api.entity.base -import ftrack_api.entity.location -import ftrack_api.entity.component -import ftrack_api.entity.asset_version -import ftrack_api.entity.project_schema -import ftrack_api.entity.note -import ftrack_api.entity.job -import ftrack_api.entity.user -import ftrack_api.symbol -import ftrack_api.cache -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old.attribute +import ftrack_api_old.entity.base +import ftrack_api_old.entity.location +import ftrack_api_old.entity.component +import ftrack_api_old.entity.asset_version +import ftrack_api_old.entity.project_schema +import ftrack_api_old.entity.note +import ftrack_api_old.entity.job +import ftrack_api_old.entity.user +import ftrack_api_old.symbol +import ftrack_api_old.cache +from ftrack_api_old.logging import LazyLogMessage as L class Factory(object): @@ -35,7 +35,7 @@ class Factory(object): '''Create and return entity class from *schema*. *bases* should be a list of bases to give the constructed class. If not - specified, default to :class:`ftrack_api.entity.base.Entity`. + specified, default to :class:`ftrack_api_old.entity.base.Entity`. ''' entity_type = schema['id'] @@ -43,23 +43,23 @@ class Factory(object): class_bases = bases if class_bases is None: - class_bases = [ftrack_api.entity.base.Entity] + class_bases = [ftrack_api_old.entity.base.Entity] class_namespace = dict() # Build attributes for class. - attributes = ftrack_api.attribute.Attributes() + attributes = ftrack_api_old.attribute.Attributes() immutable = schema.get('immutable', []) for name, fragment in schema.get('properties', {}).items(): mutable = name not in immutable - default = fragment.get('default', ftrack_api.symbol.NOT_SET) + default = fragment.get('default', ftrack_api_old.symbol.NOT_SET) if default == '{uid}': default = lambda instance: str(uuid.uuid4()) - data_type = fragment.get('type', ftrack_api.symbol.NOT_SET) + data_type = fragment.get('type', ftrack_api_old.symbol.NOT_SET) - if data_type is not ftrack_api.symbol.NOT_SET: + if data_type is not ftrack_api_old.symbol.NOT_SET: if data_type in ( 'string', 'boolean', 'integer', 'number', 'variable' @@ -108,8 +108,8 @@ class Factory(object): )) else: # Reference attribute. - reference = fragment.get('$ref', ftrack_api.symbol.NOT_SET) - if reference is ftrack_api.symbol.NOT_SET: + reference = fragment.get('$ref', ftrack_api_old.symbol.NOT_SET) + if reference is ftrack_api_old.symbol.NOT_SET: self.logger.debug(L( 'Skipping {0}.{1} mapped_array attribute that does ' 'not define a schema reference.', class_name, name @@ -142,19 +142,19 @@ class Factory(object): self, class_name, name, mutable, default, data_type ): '''Return appropriate scalar attribute instance.''' - return ftrack_api.attribute.ScalarAttribute( + return ftrack_api_old.attribute.ScalarAttribute( name, data_type=data_type, default_value=default, mutable=mutable ) def create_reference_attribute(self, class_name, name, mutable, reference): '''Return appropriate reference attribute instance.''' - return ftrack_api.attribute.ReferenceAttribute( + return ftrack_api_old.attribute.ReferenceAttribute( name, reference, mutable=mutable ) def create_collection_attribute(self, class_name, name, mutable): '''Return appropriate collection attribute instance.''' - return ftrack_api.attribute.CollectionAttribute( + return ftrack_api_old.attribute.CollectionAttribute( name, mutable=mutable ) @@ -169,7 +169,7 @@ class Factory(object): )) -class PerSessionDefaultKeyMaker(ftrack_api.cache.KeyMaker): +class PerSessionDefaultKeyMaker(ftrack_api_old.cache.KeyMaker): '''Generate key for defaults.''' def _key(self, obj): @@ -185,15 +185,15 @@ class PerSessionDefaultKeyMaker(ftrack_api.cache.KeyMaker): #: Memoiser for use with default callables that should only be called once per # session. -memoise_defaults = ftrack_api.cache.memoise_decorator( - ftrack_api.cache.Memoiser( +memoise_defaults = ftrack_api_old.cache.memoise_decorator( + ftrack_api_old.cache.Memoiser( key_maker=PerSessionDefaultKeyMaker(), return_copies=False ) ) #: Memoiser for use with callables that should be called once per session. -memoise_session = ftrack_api.cache.memoise_decorator( - ftrack_api.cache.Memoiser( +memoise_session = ftrack_api_old.cache.memoise_decorator( + ftrack_api_old.cache.Memoiser( key_maker=PerSessionDefaultKeyMaker(), return_copies=False ) ) @@ -284,41 +284,41 @@ class StandardFactory(Factory): extra_bases = [] # Customise classes. if schema['id'] == 'ProjectSchema': - extra_bases = [ftrack_api.entity.project_schema.ProjectSchema] + extra_bases = [ftrack_api_old.entity.project_schema.ProjectSchema] elif schema['id'] == 'Location': - extra_bases = [ftrack_api.entity.location.Location] + extra_bases = [ftrack_api_old.entity.location.Location] elif schema['id'] == 'AssetVersion': - extra_bases = [ftrack_api.entity.asset_version.AssetVersion] + extra_bases = [ftrack_api_old.entity.asset_version.AssetVersion] elif schema['id'].endswith('Component'): - extra_bases = [ftrack_api.entity.component.Component] + extra_bases = [ftrack_api_old.entity.component.Component] elif schema['id'] == 'Note': - extra_bases = [ftrack_api.entity.note.Note] + extra_bases = [ftrack_api_old.entity.note.Note] elif schema['id'] == 'Job': - extra_bases = [ftrack_api.entity.job.Job] + extra_bases = [ftrack_api_old.entity.job.Job] elif schema['id'] == 'User': - extra_bases = [ftrack_api.entity.user.User] + extra_bases = [ftrack_api_old.entity.user.User] bases = extra_bases + bases # If bases does not contain any items, add the base entity class. if not bases: - bases = [ftrack_api.entity.base.Entity] + bases = [ftrack_api_old.entity.base.Entity] # Add mixins. if 'notes' in schema.get('properties', {}): bases.append( - ftrack_api.entity.note.CreateNoteMixin + ftrack_api_old.entity.note.CreateNoteMixin ) if 'thumbnail_id' in schema.get('properties', {}): bases.append( - ftrack_api.entity.component.CreateThumbnailMixin + ftrack_api_old.entity.component.CreateThumbnailMixin ) cls = super(StandardFactory, self).create(schema, bases=bases) @@ -347,13 +347,13 @@ class StandardFactory(Factory): key_attribute = 'key' value_attribute = 'value' - return ftrack_api.attribute.KeyValueMappedCollectionAttribute( + return ftrack_api_old.attribute.KeyValueMappedCollectionAttribute( name, creator, key_attribute, value_attribute, mutable=mutable ) elif reference == 'CustomAttributeValue': return ( - ftrack_api.attribute.CustomAttributeCollectionAttribute( + ftrack_api_old.attribute.CustomAttributeCollectionAttribute( name, mutable=mutable ) ) @@ -376,8 +376,8 @@ class StandardFactory(Factory): ''' entity = proxy.collection.entity if ( - ftrack_api.inspection.state(entity) is not - ftrack_api.symbol.CREATED + ftrack_api_old.inspection.state(entity) is not + ftrack_api_old.symbol.CREATED ): raise KeyError( 'Custom attributes must be created explicitly for the ' @@ -421,7 +421,7 @@ class StandardFactory(Factory): key_attribute = 'key' value_attribute = 'value' - return ftrack_api.attribute.KeyValueMappedCollectionAttribute( + return ftrack_api_old.attribute.KeyValueMappedCollectionAttribute( name, creator, key_attribute, value_attribute, mutable=mutable ) diff --git a/pype/vendor/ftrack_api_27/entity/job.py b/pype/vendor/ftrack_api_old/entity/job.py similarity index 89% rename from pype/vendor/ftrack_api_27/entity/job.py rename to pype/vendor/ftrack_api_old/entity/job.py index ae37922c51..0d716f5914 100644 --- a/pype/vendor/ftrack_api_27/entity/job.py +++ b/pype/vendor/ftrack_api_old/entity/job.py @@ -1,16 +1,16 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.entity.base +import ftrack_api_old.entity.base -class Job(ftrack_api.entity.base.Entity): +class Job(ftrack_api_old.entity.base.Entity): '''Represent job.''' def __init__(self, session, data=None, reconstructing=False): '''Initialise entity. - *session* is an instance of :class:`ftrack_api.session.Session` that + *session* is an instance of :class:`ftrack_api_old.session.Session` that this entity instance is bound to. *data* is a mapping of key, value pairs to apply as initial attribute diff --git a/pype/vendor/ftrack_api_27/entity/location.py b/pype/vendor/ftrack_api_old/entity/location.py similarity index 84% rename from pype/vendor/ftrack_api_27/entity/location.py rename to pype/vendor/ftrack_api_old/entity/location.py index 55ef54c9cc..d48264abc2 100644 --- a/pype/vendor/ftrack_api_27/entity/location.py +++ b/pype/vendor/ftrack_api_old/entity/location.py @@ -4,21 +4,21 @@ import collections import functools -import ftrack_api.entity.base -import ftrack_api.exception -import ftrack_api.event.base -import ftrack_api.symbol -import ftrack_api.inspection -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old.entity.base +import ftrack_api_old.exception +import ftrack_api_old.event.base +import ftrack_api_old.symbol +import ftrack_api_old.inspection +from ftrack_api_old.logging import LazyLogMessage as L -class Location(ftrack_api.entity.base.Entity): +class Location(ftrack_api_old.entity.base.Entity): '''Represent storage for components.''' def __init__(self, session, data=None, reconstructing=False): '''Initialise entity. - *session* is an instance of :class:`ftrack_api.session.Session` that + *session* is an instance of :class:`ftrack_api_old.session.Session` that this entity instance is bound to. *data* is a mapping of key, value pairs to apply as initial attribute @@ -29,9 +29,9 @@ class Location(ftrack_api.entity.base.Entity): logic applied, such as initialising defaults for missing data. ''' - self.accessor = ftrack_api.symbol.NOT_SET - self.structure = ftrack_api.symbol.NOT_SET - self.resource_identifier_transformer = ftrack_api.symbol.NOT_SET + self.accessor = ftrack_api_old.symbol.NOT_SET + self.structure = ftrack_api_old.symbol.NOT_SET + self.resource_identifier_transformer = ftrack_api_old.symbol.NOT_SET self.priority = 95 super(Location, self).__init__( session, data=data, reconstructing=reconstructing @@ -43,7 +43,7 @@ class Location(ftrack_api.entity.base.Entity): with self.session.auto_populating(False): name = self['name'] - if name is not ftrack_api.symbol.NOT_SET: + if name is not ftrack_api_old.symbol.NOT_SET: representation = representation.replace( '(', '("{0}", '.format(name) ) @@ -58,10 +58,10 @@ class Location(ftrack_api.entity.base.Entity): *source* should be an instance of another location that acts as the source. - Raise :exc:`ftrack_api.ComponentInLocationError` if the *component* + Raise :exc:`ftrack_api_old.ComponentInLocationError` if the *component* already exists in this location. - Raise :exc:`ftrack_api.LocationError` if managing data and the generated + Raise :exc:`ftrack_api_old.LocationError` if managing data and the generated target structure for the component already exists according to the accessor. This helps prevent potential data loss by avoiding overwriting existing data. Note that there is a race condition between the check and @@ -70,7 +70,7 @@ class Location(ftrack_api.entity.base.Entity): .. note:: - A :meth:`Session.commit` may be + A :meth:`Session.commit` may be automatically issued as part of the component registration. ''' @@ -87,11 +87,11 @@ class Location(ftrack_api.entity.base.Entity): then each corresponding index in *sources* will be used for each *component*. A source should be an instance of another location. - Raise :exc:`ftrack_api.exception.ComponentInLocationError` if any + Raise :exc:`ftrack_api_old.exception.ComponentInLocationError` if any component in *components* already exists in this location. In this case, no changes will be made and no data transferred. - Raise :exc:`ftrack_api.exception.LocationError` if managing data and the + Raise :exc:`ftrack_api_old.exception.LocationError` if managing data and the generated target structure for the component already exists according to the accessor. This helps prevent potential data loss by avoiding overwriting existing data. Note that there is a race condition between @@ -100,7 +100,7 @@ class Location(ftrack_api.entity.base.Entity): .. note:: - A :meth:`Session.commit` may be + A :meth:`Session.commit` may be automatically issued as part of the components registration. .. important:: @@ -108,7 +108,7 @@ class Location(ftrack_api.entity.base.Entity): If this location manages data then the *components* data is first transferred to the target prescribed by the structure plugin, using the configured accessor. If any component fails to transfer then - :exc:`ftrack_api.exception.LocationError` is raised and none of the + :exc:`ftrack_api_old.exception.LocationError` is raised and none of the components are registered with the database. In this case it is left up to the caller to decide and act on manually cleaning up any transferred data using the 'transferred' detail in the raised error. @@ -116,7 +116,7 @@ class Location(ftrack_api.entity.base.Entity): Likewise, after transfer, all components are registered with the database in a batch call. If any component causes an error then all components will remain unregistered and - :exc:`ftrack_api.exception.LocationError` will be raised detailing + :exc:`ftrack_api_old.exception.LocationError` will be raised detailing issues and any transferred data under the 'transferred' detail key. ''' @@ -134,7 +134,7 @@ class Location(ftrack_api.entity.base.Entity): ) if not self.structure: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'No structure defined for location {location}.', details=dict(location=self) ) @@ -151,7 +151,7 @@ class Location(ftrack_api.entity.base.Entity): try: self.get_resource_identifiers(components) - except ftrack_api.exception.ComponentNotInLocationError as error: + except ftrack_api_old.exception.ComponentNotInLocationError as error: missing_component_ids = [ missing_component['id'] for missing_component in error.details['components'] @@ -165,7 +165,7 @@ class Location(ftrack_api.entity.base.Entity): if existing_components: # Some of the components already present in location. - raise ftrack_api.exception.ComponentInLocationError( + raise ftrack_api_old.exception.ComponentInLocationError( existing_components, self ) @@ -198,7 +198,7 @@ class Location(ftrack_api.entity.base.Entity): self._add_data(component, resource_identifier, source) except Exception as error: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'Failed to transfer component {component} data to location ' '{location} due to error:\n{indent}{error}\n{indent}' 'Transferred component data that may require cleanup: ' @@ -239,7 +239,7 @@ class Location(ftrack_api.entity.base.Entity): ) except Exception as error: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'Failed to register components with location {location} due to ' 'error:\n{indent}{error}\n{indent}Transferred component data ' 'that may require cleanup: {transferred}', @@ -254,14 +254,14 @@ class Location(ftrack_api.entity.base.Entity): # Publish events. for component in components_to_register: - component_id = ftrack_api.inspection.primary_key( + component_id = ftrack_api_old.inspection.primary_key( component ).values()[0] - location_id = ftrack_api.inspection.primary_key(self).values()[0] + location_id = ftrack_api_old.inspection.primary_key(self).values()[0] self.session.event_hub.publish( - ftrack_api.event.base.Event( - topic=ftrack_api.symbol.COMPONENT_ADDED_TO_LOCATION_TOPIC, + ftrack_api_old.event.base.Event( + topic=ftrack_api_old.symbol.COMPONENT_ADDED_TO_LOCATION_TOPIC, data=dict( component_id=component_id, location_id=location_id @@ -278,7 +278,7 @@ class Location(ftrack_api.entity.base.Entity): source_resource_identifier = source.get_resource_identifier( component ) - except ftrack_api.exception.ComponentNotInLocationError: + except ftrack_api_old.exception.ComponentNotInLocationError: pass else: context.update(dict( @@ -302,13 +302,13 @@ class Location(ftrack_api.entity.base.Entity): # Read data from source and write to this location. if not source.accessor: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'No accessor defined for source location {location}.', details=dict(location=source) ) if not self.accessor: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'No accessor defined for target location {location}.', details=dict(location=self) ) @@ -316,7 +316,7 @@ class Location(ftrack_api.entity.base.Entity): is_container = 'members' in component.keys() if is_container: # TODO: Improve this check. Possibly introduce an inspection - # such as ftrack_api.inspection.is_sequence_component. + # such as ftrack_api_old.inspection.is_sequence_component. if component.entity_type != 'SequenceComponent': self.accessor.make_container(resource_identifier) @@ -327,7 +327,7 @@ class Location(ftrack_api.entity.base.Entity): resource_identifier ) - except ftrack_api.exception.AccessorParentResourceNotFoundError: + except ftrack_api_old.exception.AccessorParentResourceNotFoundError: # Container could not be retrieved from # resource_identifier. Assume that there is no need to # make the container. @@ -345,7 +345,7 @@ class Location(ftrack_api.entity.base.Entity): # result in potential data loss. However, there is no # good cross platform, cross accessor solution for this # at present. - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'Cannot add component as data already exists and ' 'overwriting could result in data loss. Computed ' 'target resource identifier was: {0}' @@ -361,7 +361,7 @@ class Location(ftrack_api.entity.base.Entity): # Read/write data in chunks to avoid reading all into memory at the # same time. chunked_read = functools.partial( - source_data.read, ftrack_api.symbol.CHUNK_SIZE + source_data.read, ftrack_api_old.symbol.CHUNK_SIZE ) for chunk in iter(chunked_read, ''): target_data.write(chunk) @@ -401,7 +401,7 @@ class Location(ftrack_api.entity.base.Entity): .. note:: - A :meth:`Session.commit` may be + A :meth:`Session.commit` may be automatically issued as part of the component deregistration. ''' @@ -412,7 +412,7 @@ class Location(ftrack_api.entity.base.Entity): .. note:: - A :meth:`Session.commit` may be + A :meth:`Session.commit` may be automatically issued as part of the components deregistration. ''' @@ -434,13 +434,13 @@ class Location(ftrack_api.entity.base.Entity): self._deregister_component_in_location(component) # Emit event. - component_id = ftrack_api.inspection.primary_key( + component_id = ftrack_api_old.inspection.primary_key( component ).values()[0] - location_id = ftrack_api.inspection.primary_key(self).values()[0] + location_id = ftrack_api_old.inspection.primary_key(self).values()[0] self.session.event_hub.publish( - ftrack_api.event.base.Event( - topic=ftrack_api.symbol.COMPONENT_REMOVED_FROM_LOCATION_TOPIC, + ftrack_api_old.event.base.Event( + topic=ftrack_api_old.symbol.COMPONENT_REMOVED_FROM_LOCATION_TOPIC, data=dict( component_id=component_id, location_id=location_id @@ -452,7 +452,7 @@ class Location(ftrack_api.entity.base.Entity): def _remove_data(self, component): '''Remove data associated with *component*.''' if not self.accessor: - raise ftrack_api.exception.LocationError( + raise ftrack_api_old.exception.LocationError( 'No accessor defined for location {location}.', details=dict(location=self) ) @@ -461,7 +461,7 @@ class Location(ftrack_api.entity.base.Entity): self.accessor.remove( self.get_resource_identifier(component) ) - except ftrack_api.exception.AccessorResourceNotFoundError: + except ftrack_api_old.exception.AccessorResourceNotFoundError: # If accessor does not support detecting sequence paths then an # AccessorResourceNotFoundError is raised. For now, if the # component type is 'SequenceComponent' assume success. @@ -470,8 +470,8 @@ class Location(ftrack_api.entity.base.Entity): def _deregister_component_in_location(self, component): '''Deregister *component* from location.''' - component_id = ftrack_api.inspection.primary_key(component).values()[0] - location_id = ftrack_api.inspection.primary_key(self).values()[0] + component_id = ftrack_api_old.inspection.primary_key(component).values()[0] + location_id = ftrack_api_old.inspection.primary_key(self).values()[0] # TODO: Use session.get for optimisation. component_location = self.session.query( @@ -506,7 +506,7 @@ class Location(ftrack_api.entity.base.Entity): def get_resource_identifier(self, component): '''Return resource identifier for *component*. - Raise :exc:`ftrack_api.exception.ComponentNotInLocationError` if the + Raise :exc:`ftrack_api_old.exception.ComponentNotInLocationError` if the component is not present in this location. ''' @@ -515,7 +515,7 @@ class Location(ftrack_api.entity.base.Entity): def get_resource_identifiers(self, components): '''Return resource identifiers for *components*. - Raise :exc:`ftrack_api.exception.ComponentNotInLocationError` if any + Raise :exc:`ftrack_api_old.exception.ComponentNotInLocationError` if any of the components are not present in this location. ''' @@ -535,13 +535,13 @@ class Location(ftrack_api.entity.base.Entity): def _get_resource_identifiers(self, components): '''Return resource identifiers for *components*. - Raise :exc:`ftrack_api.exception.ComponentNotInLocationError` if any + Raise :exc:`ftrack_api_old.exception.ComponentNotInLocationError` if any of the components are not present in this location. ''' component_ids_mapping = collections.OrderedDict() for component in components: - component_id = ftrack_api.inspection.primary_key( + component_id = ftrack_api_old.inspection.primary_key( component ).values()[0] component_ids_mapping[component_id] = component @@ -550,7 +550,7 @@ class Location(ftrack_api.entity.base.Entity): 'select component_id, resource_identifier from ComponentLocation ' 'where location_id is {0} and component_id in ({1})' .format( - ftrack_api.inspection.primary_key(self).values()[0], + ftrack_api_old.inspection.primary_key(self).values()[0], ', '.join(component_ids_mapping.keys()) ) ) @@ -572,7 +572,7 @@ class Location(ftrack_api.entity.base.Entity): ) if missing: - raise ftrack_api.exception.ComponentNotInLocationError( + raise ftrack_api_old.exception.ComponentNotInLocationError( missing, self ) @@ -597,9 +597,9 @@ class Location(ftrack_api.entity.base.Entity): def get_url(self, component): '''Return url for *component*. - Raise :exc:`~ftrack_api.exception.AccessorFilesystemPathError` if + Raise :exc:`~ftrack_api_old.exception.AccessorFilesystemPathError` if URL could not be determined from *component* or - :exc:`~ftrack_api.exception.AccessorUnsupportedOperationError` if + :exc:`~ftrack_api_old.exception.AccessorUnsupportedOperationError` if retrieving URL is not supported by the location's accessor. ''' resource_identifier = self.get_resource_identifier(component) @@ -627,7 +627,7 @@ class MemoryLocationMixin(object): def _register_component_in_location(self, component, resource_identifier): '''Register *component* in location with *resource_identifier*.''' - component_id = ftrack_api.inspection.primary_key(component).values()[0] + component_id = ftrack_api_old.inspection.primary_key(component).values()[0] self._cache[component_id] = resource_identifier def _register_components_in_location( @@ -645,20 +645,20 @@ class MemoryLocationMixin(object): def _deregister_component_in_location(self, component): '''Deregister *component* in location.''' - component_id = ftrack_api.inspection.primary_key(component).values()[0] + component_id = ftrack_api_old.inspection.primary_key(component).values()[0] self._cache.pop(component_id) def _get_resource_identifiers(self, components): '''Return resource identifiers for *components*. - Raise :exc:`ftrack_api.exception.ComponentNotInLocationError` if any + Raise :exc:`ftrack_api_old.exception.ComponentNotInLocationError` if any of the referenced components are not present in this location. ''' resource_identifiers = [] missing = [] for component in components: - component_id = ftrack_api.inspection.primary_key( + component_id = ftrack_api_old.inspection.primary_key( component ).values()[0] resource_identifier = self._cache.get(component_id) @@ -668,7 +668,7 @@ class MemoryLocationMixin(object): resource_identifiers.append(resource_identifier) if missing: - raise ftrack_api.exception.ComponentNotInLocationError( + raise ftrack_api_old.exception.ComponentNotInLocationError( missing, self ) @@ -723,9 +723,9 @@ class ServerLocationMixin(object): Optionally, specify *size* to constrain the downscaled image to size x size pixels. - Raise :exc:`~ftrack_api.exception.AccessorFilesystemPathError` if + Raise :exc:`~ftrack_api_old.exception.AccessorFilesystemPathError` if URL could not be determined from *resource_identifier* or - :exc:`~ftrack_api.exception.AccessorUnsupportedOperationError` if + :exc:`~ftrack_api_old.exception.AccessorUnsupportedOperationError` if retrieving URL is not supported by the location's accessor. ''' resource_identifier = self.get_resource_identifier(component) diff --git a/pype/vendor/ftrack_api_27/entity/note.py b/pype/vendor/ftrack_api_old/entity/note.py similarity index 95% rename from pype/vendor/ftrack_api_27/entity/note.py rename to pype/vendor/ftrack_api_old/entity/note.py index bc6d7791e1..4cacf6ac8a 100644 --- a/pype/vendor/ftrack_api_27/entity/note.py +++ b/pype/vendor/ftrack_api_old/entity/note.py @@ -1,10 +1,10 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.entity.base +import ftrack_api_old.entity.base -class Note(ftrack_api.entity.base.Entity): +class Note(ftrack_api_old.entity.base.Entity): '''Represent a note.''' def create_reply( diff --git a/pype/vendor/ftrack_api_27/entity/project_schema.py b/pype/vendor/ftrack_api_old/entity/project_schema.py similarity index 97% rename from pype/vendor/ftrack_api_27/entity/project_schema.py rename to pype/vendor/ftrack_api_old/entity/project_schema.py index ec6db7c019..7f2f2b492d 100644 --- a/pype/vendor/ftrack_api_27/entity/project_schema.py +++ b/pype/vendor/ftrack_api_old/entity/project_schema.py @@ -1,10 +1,10 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.entity.base +import ftrack_api_old.entity.base -class ProjectSchema(ftrack_api.entity.base.Entity): +class ProjectSchema(ftrack_api_old.entity.base.Entity): '''Class representing ProjectSchema.''' def get_statuses(self, schema, type_id=None): diff --git a/pype/vendor/ftrack_api_27/entity/user.py b/pype/vendor/ftrack_api_old/entity/user.py similarity index 88% rename from pype/vendor/ftrack_api_27/entity/user.py rename to pype/vendor/ftrack_api_old/entity/user.py index 511ad4ba99..e57783aca0 100644 --- a/pype/vendor/ftrack_api_27/entity/user.py +++ b/pype/vendor/ftrack_api_old/entity/user.py @@ -3,11 +3,11 @@ import arrow -import ftrack_api.entity.base -import ftrack_api.exception +import ftrack_api_old.entity.base +import ftrack_api_old.exception -class User(ftrack_api.entity.base.Entity): +class User(ftrack_api_old.entity.base.Entity): '''Represent a user.''' def start_timer(self, context=None, comment='', name=None, force=False): @@ -23,14 +23,14 @@ class User(ftrack_api.entity.base.Entity): This method will automatically commit the changes and if *force* is False then it will fail with a - :class:`ftrack_api.exception.NotUniqueError` exception if a + :class:`ftrack_api_old.exception.NotUniqueError` exception if a timer is already running. ''' if force: try: self.stop_timer() - except ftrack_api.exception.NoResultFoundError: + except ftrack_api_old.exception.NoResultFoundError: self.logger.debug('Failed to stop existing timer.') timer = self.session.create('Timer', { @@ -44,9 +44,9 @@ class User(ftrack_api.entity.base.Entity): # timelog already exists and inform the user about it. try: self.session.commit() - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: if 'IntegrityError' in str(error): - raise ftrack_api.exception.NotUniqueError( + raise ftrack_api_old.exception.NotUniqueError( ('Failed to start a timelog for user with id: {0}, it is ' 'likely that a timer is already running. Either use ' 'force=True or stop the timer first.').format(self['id']) @@ -61,7 +61,7 @@ class User(ftrack_api.entity.base.Entity): '''Stop the current timer and return a timelog created from it. If a timer is not running, a - :exc:`ftrack_api.exception.NoResultFoundError` exception will be + :exc:`ftrack_api_old.exception.NoResultFoundError` exception will be raised. .. note:: diff --git a/pype/vendor/ftrack_api_27/event/__init__.py b/pype/vendor/ftrack_api_old/event/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/event/__init__.py rename to pype/vendor/ftrack_api_old/event/__init__.py diff --git a/pype/vendor/ftrack_api_27/event/base.py b/pype/vendor/ftrack_api_old/event/base.py similarity index 100% rename from pype/vendor/ftrack_api_27/event/base.py rename to pype/vendor/ftrack_api_old/event/base.py diff --git a/pype/vendor/ftrack_api_27/event/expression.py b/pype/vendor/ftrack_api_old/event/expression.py similarity index 98% rename from pype/vendor/ftrack_api_27/event/expression.py rename to pype/vendor/ftrack_api_old/event/expression.py index d0e6d41872..e10cd85844 100644 --- a/pype/vendor/ftrack_api_27/event/expression.py +++ b/pype/vendor/ftrack_api_old/event/expression.py @@ -7,7 +7,7 @@ from pyparsing import (ParserElement, Group, Word, CaselessKeyword, Forward, FollowedBy, Suppress, oneOf, OneOrMore, Optional, alphanums, quotedString, removeQuotes) -import ftrack_api.exception +import ftrack_api_old.exception # Optimise parsing using packrat memoisation feature. ParserElement.enablePackrat() @@ -77,7 +77,7 @@ class Parser(object): def parse(self, expression): '''Parse string *expression* into :class:`Expression`. - Raise :exc:`ftrack_api.exception.ParseError` if *expression* could + Raise :exc:`ftrack_api_old.exception.ParseError` if *expression* could not be parsed. ''' @@ -89,7 +89,7 @@ class Parser(object): expression, parseAll=True ) except Exception as error: - raise ftrack_api.exception.ParseError( + raise ftrack_api_old.exception.ParseError( 'Failed to parse: {0}. {1}'.format(expression, error) ) diff --git a/pype/vendor/ftrack_api_27/event/hub.py b/pype/vendor/ftrack_api_old/event/hub.py similarity index 91% rename from pype/vendor/ftrack_api_27/event/hub.py rename to pype/vendor/ftrack_api_old/event/hub.py index 68357ca6c3..25410aa1e1 100644 --- a/pype/vendor/ftrack_api_27/event/hub.py +++ b/pype/vendor/ftrack_api_old/event/hub.py @@ -19,11 +19,11 @@ import requests import requests.exceptions import websocket -import ftrack_api.exception -import ftrack_api.event.base -import ftrack_api.event.subscriber -import ftrack_api.event.expression -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old.exception +import ftrack_api_old.event.base +import ftrack_api_old.event.subscriber +import ftrack_api_old.event.expression +from ftrack_api_old.logging import LazyLogMessage as L SocketIoSession = collections.namedtuple('SocketIoSession', [ @@ -69,7 +69,7 @@ class EventHub(object): self._event_queue = queue.Queue() self._event_namespace = 'ftrack.event' - self._expression_parser = ftrack_api.event.expression.Parser() + self._expression_parser = ftrack_api_old.event.expression.Parser() # Default values for auto reconnection timeout on unintentional # disconnection. Equates to 5 minutes. @@ -130,12 +130,12 @@ class EventHub(object): def connect(self): '''Initialise connection to server. - Raise :exc:`ftrack_api.exception.EventHubConnectionError` if already + Raise :exc:`ftrack_api_old.exception.EventHubConnectionError` if already connected or connection fails. ''' if self.connected: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Already connected.' ) @@ -172,7 +172,7 @@ class EventHub(object): ), exc_info=1 ) - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Failed to connect to event server at {0}.' .format(self.get_server_url()) ) @@ -193,7 +193,7 @@ class EventHub(object): id=self.id ) ) - except ftrack_api.exception.NotUniqueError: + except ftrack_api_old.exception.NotUniqueError: pass # Now resubscribe any existing stored subscribers. This can happen when @@ -209,7 +209,7 @@ class EventHub(object): def disconnect(self, unsubscribe=True): '''Disconnect from server. - Raise :exc:`ftrack_api.exception.EventHubConnectionError` if not + Raise :exc:`ftrack_api_old.exception.EventHubConnectionError` if not currently connected. If *unsubscribe* is True then unsubscribe all current subscribers @@ -217,7 +217,7 @@ class EventHub(object): ''' if not self.connected: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Not currently connected.' ) @@ -257,13 +257,13 @@ class EventHub(object): All current subscribers will be automatically resubscribed after successful reconnection. - Raise :exc:`ftrack_api.exception.EventHubConnectionError` if fail to + Raise :exc:`ftrack_api_old.exception.EventHubConnectionError` if fail to reconnect. ''' try: self.disconnect(unsubscribe=False) - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: pass for attempt in range(attempts): @@ -278,7 +278,7 @@ class EventHub(object): try: self.connect() - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: time.sleep(delay) else: break @@ -287,7 +287,7 @@ class EventHub(object): logging.disable(logging.NOTSET) if not self.connected: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Failed to reconnect to event server at {0} after {1} attempts.' .format(self.get_server_url(), attempts) ) @@ -342,7 +342,7 @@ class EventHub(object): The *callback* should accept an instance of - :class:`ftrack_api.event.base.Event` as its sole argument. + :class:`ftrack_api_old.event.base.Event` as its sole argument. Callbacks are called in order of *priority*. The lower the priority number the sooner it will be called, with 0 being the first. The @@ -371,7 +371,7 @@ class EventHub(object): Return subscriber identifier. - Raise :exc:`ftrack_api.exception.NotUniqueError` if a subscriber with + Raise :exc:`ftrack_api_old.exception.NotUniqueError` if a subscriber with the same identifier already exists. ''' @@ -383,7 +383,7 @@ class EventHub(object): # Notify server now if possible. try: self._notify_server_about_subscriber(subscriber) - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: self.logger.debug(L( 'Failed to notify server about new subscriber {0} ' 'as server not currently reachable.', subscriber.metadata['id'] @@ -398,9 +398,9 @@ class EventHub(object): See :meth:`subscribe` for argument descriptions. - Return :class:`ftrack_api.event.subscriber.Subscriber` instance. + Return :class:`ftrack_api_old.event.subscriber.Subscriber` instance. - Raise :exc:`ftrack_api.exception.NotUniqueError` if a subscriber with + Raise :exc:`ftrack_api_old.exception.NotUniqueError` if a subscriber with the same identifier already exists. ''' @@ -415,12 +415,12 @@ class EventHub(object): ) if existing_subscriber is not None: - raise ftrack_api.exception.NotUniqueError( + raise ftrack_api_old.exception.NotUniqueError( 'Subscriber with identifier {0} already exists.' .format(subscriber['id']) ) - subscriber = ftrack_api.event.subscriber.Subscriber( + subscriber = ftrack_api_old.event.subscriber.Subscriber( subscription=subscription, callback=callback, metadata=subscriber, @@ -433,7 +433,7 @@ class EventHub(object): def _notify_server_about_subscriber(self, subscriber): '''Notify server of new *subscriber*.''' - subscribe_event = ftrack_api.event.base.Event( + subscribe_event = ftrack_api_old.event.base.Event( topic='ftrack.meta.subscribe', data=dict( subscriber=subscriber.metadata, @@ -467,7 +467,7 @@ class EventHub(object): subscriber = self.get_subscriber_by_identifier(subscriber_identifier) if subscriber is None: - raise ftrack_api.exception.NotFoundError( + raise ftrack_api_old.exception.NotFoundError( 'Cannot unsubscribe missing subscriber with identifier {0}' .format(subscriber_identifier) ) @@ -475,7 +475,7 @@ class EventHub(object): self._subscribers.pop(self._subscribers.index(subscriber)) # Notify the server if possible. - unsubscribe_event = ftrack_api.event.base.Event( + unsubscribe_event = ftrack_api_old.event.base.Event( topic='ftrack.meta.unsubscribe', data=dict(subscriber=subscriber.metadata) ) @@ -485,7 +485,7 @@ class EventHub(object): unsubscribe_event, callback=functools.partial(self._on_unsubscribed, subscriber) ) - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: self.logger.debug(L( 'Failed to notify server to unsubscribe subscriber {0} as ' 'server not currently reachable.', subscriber.metadata['id'] @@ -560,7 +560,7 @@ class EventHub(object): sent event. ''' - reply_event = ftrack_api.event.base.Event( + reply_event = ftrack_api_old.event.base.Event( 'ftrack.meta.reply', data=data ) @@ -587,7 +587,7 @@ class EventHub(object): received in response to the published *event*. Note that there is no guarantee that a reply will be sent. - Raise :exc:`ftrack_api.exception.EventHubConnectionError` if not + Raise :exc:`ftrack_api_old.exception.EventHubConnectionError` if not currently connected. ''' @@ -600,7 +600,7 @@ class EventHub(object): return self._handle(event, synchronous=synchronous) if not self.connected: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Cannot publish event asynchronously as not connected to ' 'server.' ) @@ -622,7 +622,7 @@ class EventHub(object): self._emit_event_packet( self._event_namespace, event, callback=callback ) - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: # Connection may have dropped temporarily. Wait a few moments to # see if background thread reconnects automatically. time.sleep(15) @@ -762,21 +762,21 @@ class EventHub(object): timeout=60 # 60 seconds timeout to recieve errors faster. ) except requests.exceptions.Timeout as error: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Timed out connecting to server: {0}.'.format(error) ) except requests.exceptions.SSLError as error: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Failed to negotiate SSL with server: {0}.'.format(error) ) except requests.exceptions.ConnectionError as error: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Failed to connect to server: {0}.'.format(error) ) else: status = response.status_code if status != 200: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Received unexpected status code {0}.'.format(status) ) @@ -837,7 +837,7 @@ class EventHub(object): self._connection.send(packet) self.logger.debug(L(u'Sent packet: {0}', packet)) except socket.error as error: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Failed to send packet: {0}'.format(error) ) @@ -846,14 +846,14 @@ class EventHub(object): try: packet = self._connection.recv() except Exception as error: - raise ftrack_api.exception.EventHubConnectionError( + raise ftrack_api_old.exception.EventHubConnectionError( 'Error receiving packet: {0}'.format(error) ) try: parts = packet.split(':', 3) except AttributeError: - raise ftrack_api.exception.EventHubPacketError( + raise ftrack_api_old.exception.EventHubPacketError( 'Received invalid packet {0}'.format(packet) ) @@ -867,7 +867,7 @@ class EventHub(object): elif count == 1: code = parts[0] else: - raise ftrack_api.exception.EventHubPacketError( + raise ftrack_api_old.exception.EventHubPacketError( 'Received invalid packet {0}'.format(packet) ) @@ -880,7 +880,7 @@ class EventHub(object): if code_name == 'connect': self.logger.debug('Connected to event server.') - event = ftrack_api.event.base.Event('ftrack.meta.connected') + event = ftrack_api_old.event.base.Event('ftrack.meta.connected') self._event_queue.put(event) elif code_name == 'disconnect': @@ -894,13 +894,13 @@ class EventHub(object): attempts=self._auto_reconnect_attempts, delay=self._auto_reconnect_delay ) - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: self.logger.debug('Failed to reconnect automatically.') else: self.logger.debug('Reconnected successfully.') if not self.connected: - event = ftrack_api.event.base.Event('ftrack.meta.disconnected') + event = ftrack_api_old.event.base.Event('ftrack.meta.disconnected') self._event_queue.put(event) elif code_name == 'heartbeat': @@ -918,7 +918,7 @@ class EventHub(object): event_payload = args[0] if isinstance(event_payload, collections.Mapping): try: - event = ftrack_api.event.base.Event(**event_payload) + event = ftrack_api_old.event.base.Event(**event_payload) except Exception: self.logger.exception(L( 'Failed to convert payload into event: {0}', @@ -960,7 +960,7 @@ class EventHub(object): def _encode_object_hook(self, item): '''Return *item* transformed for encoding.''' - if isinstance(item, ftrack_api.event.base.Event): + if isinstance(item, ftrack_api_old.event.base.Event): # Convert to dictionary for encoding. item = dict(**item) @@ -1030,11 +1030,11 @@ class _ProcessorThread(threading.Thread): code, packet_identifier, path, data = self.client._receive_packet() self.client._handle_packet(code, packet_identifier, path, data) - except ftrack_api.exception.EventHubPacketError as error: + except ftrack_api_old.exception.EventHubPacketError as error: self.logger.debug(L('Ignoring invalid packet: {0}', error)) continue - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: self.cancel() # Fake a disconnection event in order to trigger reconnection diff --git a/pype/vendor/ftrack_api_27/event/subscriber.py b/pype/vendor/ftrack_api_old/event/subscriber.py similarity index 86% rename from pype/vendor/ftrack_api_27/event/subscriber.py rename to pype/vendor/ftrack_api_old/event/subscriber.py index 0d38463aaf..522cf3d86f 100644 --- a/pype/vendor/ftrack_api_27/event/subscriber.py +++ b/pype/vendor/ftrack_api_old/event/subscriber.py @@ -1,7 +1,7 @@ # :coding: utf-8 # :copyright: Copyright (c) 2014 ftrack -import ftrack_api.event.subscription +import ftrack_api_old.event.subscription class Subscriber(object): @@ -9,7 +9,7 @@ class Subscriber(object): def __init__(self, subscription, callback, metadata, priority): '''Initialise subscriber.''' - self.subscription = ftrack_api.event.subscription.Subscription( + self.subscription = ftrack_api_old.event.subscription.Subscription( subscription ) self.callback = callback diff --git a/pype/vendor/ftrack_api_27/event/subscription.py b/pype/vendor/ftrack_api_old/event/subscription.py similarity index 85% rename from pype/vendor/ftrack_api_27/event/subscription.py rename to pype/vendor/ftrack_api_old/event/subscription.py index 0b208d9977..87b777c412 100644 --- a/pype/vendor/ftrack_api_27/event/subscription.py +++ b/pype/vendor/ftrack_api_old/event/subscription.py @@ -1,13 +1,13 @@ # :coding: utf-8 # :copyright: Copyright (c) 2014 ftrack -import ftrack_api.event.expression +import ftrack_api_old.event.expression class Subscription(object): '''Represent a subscription.''' - parser = ftrack_api.event.expression.Parser() + parser = ftrack_api_old.event.expression.Parser() def __init__(self, subscription): '''Initialise with *subscription*.''' diff --git a/pype/vendor/ftrack_api_27/exception.py b/pype/vendor/ftrack_api_old/exception.py similarity index 98% rename from pype/vendor/ftrack_api_27/exception.py rename to pype/vendor/ftrack_api_old/exception.py index 8a2eb9bc04..bc1c87c060 100644 --- a/pype/vendor/ftrack_api_27/exception.py +++ b/pype/vendor/ftrack_api_old/exception.py @@ -4,7 +4,7 @@ import sys import traceback -import ftrack_api.entity.base +import ftrack_api_old.entity.base class Error(Exception): @@ -247,7 +247,7 @@ class ComponentNotInLocationError(LocationError): def __init__(self, components, location, **kw): '''Initialise with *components* and *location*.''' - if isinstance(components, ftrack_api.entity.base.Entity): + if isinstance(components, ftrack_api_old.entity.base.Entity): components = [components] kw.setdefault('details', {}).update(dict( @@ -271,7 +271,7 @@ class ComponentInLocationError(LocationError): def __init__(self, components, location, **kw): '''Initialise with *components* and *location*.''' - if isinstance(components, ftrack_api.entity.base.Entity): + if isinstance(components, ftrack_api_old.entity.base.Entity): components = [components] kw.setdefault('details', {}).update(dict( diff --git a/pype/vendor/ftrack_api_27/formatter.py b/pype/vendor/ftrack_api_old/formatter.py similarity index 88% rename from pype/vendor/ftrack_api_27/formatter.py rename to pype/vendor/ftrack_api_old/formatter.py index c282fcc814..543b9ef04e 100644 --- a/pype/vendor/ftrack_api_27/formatter.py +++ b/pype/vendor/ftrack_api_old/formatter.py @@ -3,16 +3,16 @@ import termcolor -import ftrack_api.entity.base -import ftrack_api.collection -import ftrack_api.symbol -import ftrack_api.inspection +import ftrack_api_old.entity.base +import ftrack_api_old.collection +import ftrack_api_old.symbol +import ftrack_api_old.inspection #: Useful filters to pass to :func:`format`.` FILTER = { 'ignore_unset': ( - lambda entity, name, value: value is not ftrack_api.symbol.NOT_SET + lambda entity, name, value: value is not ftrack_api_old.symbol.NOT_SET ) } @@ -35,7 +35,7 @@ def format( returns True if the attribute should be included in the output. For example, to filter out all unset values:: - attribute_filter=ftrack_api.formatter.FILTER['ignore_unset'] + attribute_filter=ftrack_api_old.formatter.FILTER['ignore_unset'] If *recursive* is True then recurse into Collections and format each entity present. @@ -76,7 +76,7 @@ def format( if _seen is None: _seen = set() - identifier = str(ftrack_api.inspection.identity(entity)) + identifier = str(ftrack_api_old.inspection.identity(entity)) if identifier in _seen: return ( first_line_spacer + @@ -96,7 +96,7 @@ def format( child_indent = indent + len(key) + 3 - if isinstance(value, ftrack_api.entity.base.Entity): + if isinstance(value, ftrack_api_old.entity.base.Entity): value = format( value, formatters=formatters, @@ -107,7 +107,7 @@ def format( _seen=_seen.copy() ) - if isinstance(value, ftrack_api.collection.Collection): + if isinstance(value, ftrack_api_old.collection.Collection): if recursive: child_values = [] for index, child in enumerate(value): diff --git a/pype/vendor/ftrack_api_27/inspection.py b/pype/vendor/ftrack_api_old/inspection.py similarity index 67% rename from pype/vendor/ftrack_api_27/inspection.py rename to pype/vendor/ftrack_api_old/inspection.py index d8b815200e..fbef8a5873 100644 --- a/pype/vendor/ftrack_api_27/inspection.py +++ b/pype/vendor/ftrack_api_old/inspection.py @@ -3,8 +3,8 @@ import collections -import ftrack_api.symbol -import ftrack_api.operation +import ftrack_api_old.symbol +import ftrack_api_old.operation def identity(entity): @@ -26,7 +26,7 @@ def primary_key(entity): primary_key = collections.OrderedDict() for name in entity.primary_key_attributes: value = entity[name] - if value is ftrack_api.symbol.NOT_SET: + if value is ftrack_api_old.symbol.NOT_SET: raise KeyError( 'Missing required value for primary key attribute "{0}" on ' 'entity {1!r}.'.format(name, entity) @@ -41,24 +41,24 @@ def _state(operation, state): '''Return state following *operation* against current *state*.''' if ( isinstance( - operation, ftrack_api.operation.CreateEntityOperation + operation, ftrack_api_old.operation.CreateEntityOperation ) - and state is ftrack_api.symbol.NOT_SET + and state is ftrack_api_old.symbol.NOT_SET ): - state = ftrack_api.symbol.CREATED + state = ftrack_api_old.symbol.CREATED elif ( isinstance( - operation, ftrack_api.operation.UpdateEntityOperation + operation, ftrack_api_old.operation.UpdateEntityOperation ) - and state is ftrack_api.symbol.NOT_SET + and state is ftrack_api_old.symbol.NOT_SET ): - state = ftrack_api.symbol.MODIFIED + state = ftrack_api_old.symbol.MODIFIED elif isinstance( - operation, ftrack_api.operation.DeleteEntityOperation + operation, ftrack_api_old.operation.DeleteEntityOperation ): - state = ftrack_api.symbol.DELETED + state = ftrack_api_old.symbol.DELETED return state @@ -66,10 +66,10 @@ def _state(operation, state): def state(entity): '''Return current *entity* state. - .. seealso:: :func:`ftrack_api.inspection.states`. + .. seealso:: :func:`ftrack_api_old.inspection.states`. ''' - value = ftrack_api.symbol.NOT_SET + value = ftrack_api_old.symbol.NOT_SET for operation in entity.session.recorded_operations: # Determine if operation refers to an entity and whether that entity @@ -78,9 +78,9 @@ def state(entity): isinstance( operation, ( - ftrack_api.operation.CreateEntityOperation, - ftrack_api.operation.UpdateEntityOperation, - ftrack_api.operation.DeleteEntityOperation + ftrack_api_old.operation.CreateEntityOperation, + ftrack_api_old.operation.UpdateEntityOperation, + ftrack_api_old.operation.DeleteEntityOperation ) ) and operation.entity_type == entity.entity_type @@ -101,7 +101,7 @@ def states(entities): All *entities* should belong to the same session. - .. seealso:: :func:`ftrack_api.inspection.state`. + .. seealso:: :func:`ftrack_api_old.inspection.state`. ''' if not entities: @@ -112,16 +112,16 @@ def states(entities): entities_by_identity = collections.OrderedDict() for entity in entities: key = (entity.entity_type, str(primary_key(entity).values())) - entities_by_identity[key] = ftrack_api.symbol.NOT_SET + entities_by_identity[key] = ftrack_api_old.symbol.NOT_SET for operation in session.recorded_operations: if ( isinstance( operation, ( - ftrack_api.operation.CreateEntityOperation, - ftrack_api.operation.UpdateEntityOperation, - ftrack_api.operation.DeleteEntityOperation + ftrack_api_old.operation.CreateEntityOperation, + ftrack_api_old.operation.UpdateEntityOperation, + ftrack_api_old.operation.DeleteEntityOperation ) ) ): diff --git a/pype/vendor/ftrack_api_27/logging.py b/pype/vendor/ftrack_api_old/logging.py similarity index 100% rename from pype/vendor/ftrack_api_27/logging.py rename to pype/vendor/ftrack_api_old/logging.py diff --git a/pype/vendor/ftrack_api_27/operation.py b/pype/vendor/ftrack_api_old/operation.py similarity index 87% rename from pype/vendor/ftrack_api_27/operation.py rename to pype/vendor/ftrack_api_old/operation.py index bb3bb4ee2c..ebf5ce46fe 100644 --- a/pype/vendor/ftrack_api_27/operation.py +++ b/pype/vendor/ftrack_api_old/operation.py @@ -44,10 +44,10 @@ class CreateEntityOperation(Operation): '''Initialise operation. *entity_type* should be the type of entity in string form (as returned - from :attr:`ftrack_api.entity.base.Entity.entity_type`). + from :attr:`ftrack_api_old.entity.base.Entity.entity_type`). *entity_key* should be the unique key for the entity and should follow - the form returned from :func:`ftrack_api.inspection.primary_key`. + the form returned from :func:`ftrack_api_old.inspection.primary_key`. *entity_data* should be a mapping of the initial data to populate the entity with when creating. @@ -74,10 +74,10 @@ class UpdateEntityOperation(Operation): '''Initialise operation. *entity_type* should be the type of entity in string form (as returned - from :attr:`ftrack_api.entity.base.Entity.entity_type`). + from :attr:`ftrack_api_old.entity.base.Entity.entity_type`). *entity_key* should be the unique key for the entity and should follow - the form returned from :func:`ftrack_api.inspection.primary_key`. + the form returned from :func:`ftrack_api_old.inspection.primary_key`. *attribute_name* should be the string name of the attribute being modified and *old_value* and *new_value* should reflect the change in @@ -103,10 +103,10 @@ class DeleteEntityOperation(Operation): '''Initialise operation. *entity_type* should be the type of entity in string form (as returned - from :attr:`ftrack_api.entity.base.Entity.entity_type`). + from :attr:`ftrack_api_old.entity.base.Entity.entity_type`). *entity_key* should be the unique key for the entity and should follow - the form returned from :func:`ftrack_api.inspection.primary_key`. + the form returned from :func:`ftrack_api_old.inspection.primary_key`. ''' super(DeleteEntityOperation, self).__init__() diff --git a/pype/vendor/ftrack_api_27/plugin.py b/pype/vendor/ftrack_api_old/plugin.py similarity index 100% rename from pype/vendor/ftrack_api_27/plugin.py rename to pype/vendor/ftrack_api_old/plugin.py diff --git a/pype/vendor/ftrack_api_27/query.py b/pype/vendor/ftrack_api_old/query.py similarity index 92% rename from pype/vendor/ftrack_api_27/query.py rename to pype/vendor/ftrack_api_old/query.py index ea101a29d4..03b33f20c4 100644 --- a/pype/vendor/ftrack_api_27/query.py +++ b/pype/vendor/ftrack_api_old/query.py @@ -4,7 +4,7 @@ import re import collections -import ftrack_api.exception +import ftrack_api_old.exception class QueryResult(collections.Sequence): @@ -16,7 +16,7 @@ class QueryResult(collections.Sequence): def __init__(self, session, expression, page_size=500): '''Initialise result set. - *session* should be an instance of :class:`ftrack_api.session.Session` + *session* should be an instance of :class:`ftrack_api_old.session.Session` that will be used for executing the query *expression*. *page_size* should be an integer specifying the maximum number of @@ -131,15 +131,15 @@ class QueryResult(collections.Sequence): Raise :exc:`ValueError` if an existing offset is already present in the expression as offset is inappropriate when expecting a single item. - Raise :exc:`~ftrack_api.exception.MultipleResultsFoundError` if more + Raise :exc:`~ftrack_api_old.exception.MultipleResultsFoundError` if more than one result was available or - :exc:`~ftrack_api.exception.NoResultFoundError` if no results were + :exc:`~ftrack_api_old.exception.NoResultFoundError` if no results were available. .. note:: Both errors subclass - :exc:`~ftrack_api.exception.IncorrectResultError` if you want to + :exc:`~ftrack_api_old.exception.IncorrectResultError` if you want to catch only one error type. ''' @@ -164,10 +164,10 @@ class QueryResult(collections.Sequence): results, metadata = self._session._query(expression) if not results: - raise ftrack_api.exception.NoResultFoundError() + raise ftrack_api_old.exception.NoResultFoundError() if len(results) != 1: - raise ftrack_api.exception.MultipleResultsFoundError() + raise ftrack_api_old.exception.MultipleResultsFoundError() return results[0] diff --git a/pype/vendor/ftrack_api_27/resource_identifier_transformer/__init__.py b/pype/vendor/ftrack_api_old/resource_identifier_transformer/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/resource_identifier_transformer/__init__.py rename to pype/vendor/ftrack_api_old/resource_identifier_transformer/__init__.py diff --git a/pype/vendor/ftrack_api_27/resource_identifier_transformer/base.py b/pype/vendor/ftrack_api_old/resource_identifier_transformer/base.py similarity index 89% rename from pype/vendor/ftrack_api_27/resource_identifier_transformer/base.py rename to pype/vendor/ftrack_api_old/resource_identifier_transformer/base.py index ee069b57b6..c344d51049 100644 --- a/pype/vendor/ftrack_api_27/resource_identifier_transformer/base.py +++ b/pype/vendor/ftrack_api_old/resource_identifier_transformer/base.py @@ -16,7 +16,7 @@ class ResourceIdentifierTransformer(object): .. note:: This is separate from any transformations an - :class:`ftrack_api.accessor.base.Accessor` may perform and is targeted + :class:`ftrack_api_old.accessor.base.Accessor` may perform and is targeted towards common transformations. ''' @@ -24,7 +24,7 @@ class ResourceIdentifierTransformer(object): def __init__(self, session): '''Initialise resource identifier transformer. - *session* should be the :class:`ftrack_api.session.Session` instance + *session* should be the :class:`ftrack_api_old.session.Session` instance to use for communication with the server. ''' diff --git a/pype/vendor/ftrack_api_27/session.py b/pype/vendor/ftrack_api_old/session.py similarity index 90% rename from pype/vendor/ftrack_api_27/session.py rename to pype/vendor/ftrack_api_old/session.py index e1182183bb..164b9501f0 100644 --- a/pype/vendor/ftrack_api_27/session.py +++ b/pype/vendor/ftrack_api_old/session.py @@ -22,27 +22,27 @@ import requests.auth import arrow import clique -import ftrack_api -import ftrack_api.exception -import ftrack_api.entity.factory -import ftrack_api.entity.base -import ftrack_api.entity.location -import ftrack_api.cache -import ftrack_api.symbol -import ftrack_api.query -import ftrack_api.attribute -import ftrack_api.collection -import ftrack_api.event.hub -import ftrack_api.event.base -import ftrack_api.plugin -import ftrack_api.inspection -import ftrack_api.operation -import ftrack_api.accessor.disk -import ftrack_api.structure.origin -import ftrack_api.structure.entity_id -import ftrack_api.accessor.server -import ftrack_api._centralized_storage_scenario -from ftrack_api.logging import LazyLogMessage as L +import ftrack_api_old +import ftrack_api_old.exception +import ftrack_api_old.entity.factory +import ftrack_api_old.entity.base +import ftrack_api_old.entity.location +import ftrack_api_old.cache +import ftrack_api_old.symbol +import ftrack_api_old.query +import ftrack_api_old.attribute +import ftrack_api_old.collection +import ftrack_api_old.event.hub +import ftrack_api_old.event.base +import ftrack_api_old.plugin +import ftrack_api_old.inspection +import ftrack_api_old.operation +import ftrack_api_old.accessor.disk +import ftrack_api_old.structure.origin +import ftrack_api_old.structure.entity_id +import ftrack_api_old.accessor.server +import ftrack_api_old._centralized_storage_scenario +from ftrack_api_old.logging import LazyLogMessage as L class SessionAuthentication(requests.auth.AuthBase): @@ -81,8 +81,8 @@ class Session(object): *api_key* should be the API key to use for authentication whilst *api_user* should be the username of the user in ftrack to record operations against. If not specified, *api_key* should be retrieved - from :envvar:`FTRACK_API_KEY` and *api_user* from - :envvar:`FTRACK_API_USER`. + from :envvar:`ftrack_api_old_KEY` and *api_user* from + :envvar:`ftrack_api_old_USER`. If *auto_populate* is True (the default), then accessing entity attributes will cause them to be automatically fetched from the server @@ -93,7 +93,7 @@ class Session(object): specified, default to looking up :envvar:`FTRACK_EVENT_PLUGIN_PATH`. *cache* should be an instance of a cache that fulfils the - :class:`ftrack_api.cache.Cache` interface and will be used as the cache + :class:`ftrack_api_old.cache.Cache` interface and will be used as the cache for the session. It can also be a callable that will be called with the session instance as sole argument. The callable should return ``None`` if a suitable cache could not be configured, but session instantiation @@ -103,22 +103,22 @@ class Session(object): The session will add the specified cache to a pre-configured layered cache that specifies the top level cache as a - :class:`ftrack_api.cache.MemoryCache`. Therefore, it is unnecessary + :class:`ftrack_api_old.cache.MemoryCache`. Therefore, it is unnecessary to construct a separate memory cache for typical behaviour. Working around this behaviour or removing the memory cache can lead to unexpected behaviour. *cache_key_maker* should be an instance of a key maker that fulfils the - :class:`ftrack_api.cache.KeyMaker` interface and will be used to + :class:`ftrack_api_old.cache.KeyMaker` interface and will be used to generate keys for objects being stored in the *cache*. If not specified, - a :class:`~ftrack_api.cache.StringKeyMaker` will be used. + a :class:`~ftrack_api_old.cache.StringKeyMaker` will be used. If *auto_connect_event_hub* is True then embedded event hub will be automatically connected to the event server and allow for publishing and subscribing to **non-local** events. If False, then only publishing and subscribing to **local** events will be possible until the hub is manually connected using :meth:`EventHub.connect - `. + `. .. note:: @@ -129,7 +129,7 @@ class Session(object): connected event hub. Enable schema caching by setting *schema_cache_path* to a folder path. - If not set, :envvar:`FTRACK_API_SCHEMA_CACHE_PATH` will be used to + If not set, :envvar:`ftrack_api_old_SCHEMA_CACHE_PATH` will be used to determine the path to store cache in. If the environment variable is also not specified then a temporary directory will be used. Set to `False` to disable schema caching entirely. @@ -161,21 +161,21 @@ class Session(object): if api_key is None: api_key = os.environ.get( - 'FTRACK_API_KEY', + 'ftrack_api_old_KEY', # Backwards compatibility - os.environ.get('FTRACK_APIKEY') + os.environ.get('ftrack_api_oldKEY') ) if not api_key: raise TypeError( 'Required "api_key" not specified. Pass as argument or set in ' - 'environment variable FTRACK_API_KEY.' + 'environment variable ftrack_api_old_KEY.' ) self._api_key = api_key if api_user is None: - api_user = os.environ.get('FTRACK_API_USER') + api_user = os.environ.get('ftrack_api_old_USER') if not api_user: try: api_user = getpass.getuser() @@ -185,24 +185,24 @@ class Session(object): if not api_user: raise TypeError( 'Required "api_user" not specified. Pass as argument, set in ' - 'environment variable FTRACK_API_USER or one of the standard ' + 'environment variable ftrack_api_old_USER or one of the standard ' 'environment variables used by Python\'s getpass module.' ) self._api_user = api_user # Currently pending operations. - self.recorded_operations = ftrack_api.operation.Operations() + self.recorded_operations = ftrack_api_old.operation.Operations() self.record_operations = True self.cache_key_maker = cache_key_maker if self.cache_key_maker is None: - self.cache_key_maker = ftrack_api.cache.StringKeyMaker() + self.cache_key_maker = ftrack_api_old.cache.StringKeyMaker() # Enforce always having a memory cache at top level so that the same # in-memory instance is returned from session. - self.cache = ftrack_api.cache.LayeredCache([ - ftrack_api.cache.MemoryCache() + self.cache = ftrack_api_old.cache.LayeredCache([ + ftrack_api_old.cache.MemoryCache() ]) if cache is not None: @@ -227,7 +227,7 @@ class Session(object): self.check_server_compatibility() # Construct event hub and load plugins. - self._event_hub = ftrack_api.event.hub.EventHub( + self._event_hub = ftrack_api_old.event.hub.EventHub( self._server_url, self._api_user, self._api_key @@ -258,17 +258,17 @@ class Session(object): if schema_cache_path is not False: if schema_cache_path is None: schema_cache_path = os.environ.get( - 'FTRACK_API_SCHEMA_CACHE_PATH', tempfile.gettempdir() + 'ftrack_api_old_SCHEMA_CACHE_PATH', tempfile.gettempdir() ) schema_cache_path = os.path.join( - schema_cache_path, 'ftrack_api_schema_cache.json' + schema_cache_path, 'ftrack_api_old_schema_cache.json' ) self.schemas = self._load_schemas(schema_cache_path) self.types = self._build_entity_type_classes(self.schemas) - ftrack_api._centralized_storage_scenario.register(self) + ftrack_api_old._centralized_storage_scenario.register(self) self._configure_locations() @@ -284,12 +284,12 @@ class Session(object): def _request(self): '''Return request session. - Raise :exc:`ftrack_api.exception.ConnectionClosedError` if session has + Raise :exc:`ftrack_api_old.exception.ConnectionClosedError` if session has been closed and connection unavailable. ''' if self._managed_request is None: - raise ftrack_api.exception.ConnectionClosedError() + raise ftrack_api_old.exception.ConnectionClosedError() return self._managed_request @@ -337,7 +337,7 @@ class Session(object): '''Check compatibility with connected server.''' server_version = self.server_information.get('version') if server_version is None: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Could not determine server version.' ) @@ -348,7 +348,7 @@ class Session(object): distutils.version.LooseVersion(min_server_version) > distutils.version.LooseVersion(server_version) ): - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0} incompatible with this version of the ' 'API which requires a server version >= {1}'.format( server_version, @@ -390,7 +390,7 @@ class Session(object): try: self.event_hub.disconnect() self._auto_connect_event_hub_thread.join() - except ftrack_api.exception.EventHubConnectionError: + except ftrack_api_old.exception.EventHubConnectionError: pass self.logger.debug('Session closed.') @@ -401,7 +401,7 @@ class Session(object): Clear all pending operations and expunge all entities from session. Also clear the local cache. If the cache used by the session is a - :class:`~ftrack_api.cache.LayeredCache` then only clear top level cache. + :class:`~ftrack_api_old.cache.LayeredCache` then only clear top level cache. Otherwise, clear the entire cache. Plugins are not rediscovered or reinitialised, but certain plugin events @@ -458,33 +458,33 @@ class Session(object): def created(self): '''Return list of newly created entities.''' entities = self._local_cache.values() - states = ftrack_api.inspection.states(entities) + states = ftrack_api_old.inspection.states(entities) return [ entity for (entity, state) in itertools.izip(entities, states) - if state is ftrack_api.symbol.CREATED + if state is ftrack_api_old.symbol.CREATED ] @property def modified(self): '''Return list of locally modified entities.''' entities = self._local_cache.values() - states = ftrack_api.inspection.states(entities) + states = ftrack_api_old.inspection.states(entities) return [ entity for (entity, state) in itertools.izip(entities, states) - if state is ftrack_api.symbol.MODIFIED + if state is ftrack_api_old.symbol.MODIFIED ] @property def deleted(self): '''Return list of deleted entities.''' entities = self._local_cache.values() - states = ftrack_api.inspection.states(entities) + states = ftrack_api_old.inspection.states(entities) return [ entity for (entity, state) in itertools.izip(entities, states) - if state is ftrack_api.symbol.DELETED + if state is ftrack_api_old.symbol.DELETED ] def reset_remote(self, reset_type, entity=None): @@ -537,7 +537,7 @@ class Session(object): try: EntityTypeClass = self.types[entity_type] except KeyError: - raise ftrack_api.exception.UnrecognisedEntityTypeError(entity_type) + raise ftrack_api_old.exception.UnrecognisedEntityTypeError(entity_type) return EntityTypeClass(self, data=data, reconstructing=reconstructing) @@ -564,7 +564,7 @@ class Session(object): :meth:`create` calls. If more than one entity matches the determined filter criteria then - raise :exc:`~ftrack_api.exception.MultipleResultsFoundError`. + raise :exc:`~ftrack_api_old.exception.MultipleResultsFoundError`. If no matching entity found then create entity using supplied *data*. @@ -636,7 +636,7 @@ class Session(object): try: entity = self.query(expression).one() - except ftrack_api.exception.NoResultFoundError: + except ftrack_api_old.exception.NoResultFoundError: self.logger.debug('Creating entity as did not already exist.') # Create entity. @@ -663,9 +663,9 @@ class Session(object): '''Mark *entity* for deletion.''' if self.record_operations: self.recorded_operations.push( - ftrack_api.operation.DeleteEntityOperation( + ftrack_api_old.operation.DeleteEntityOperation( entity.entity_type, - ftrack_api.inspection.primary_key(entity) + ftrack_api_old.inspection.primary_key(entity) ) ) @@ -726,7 +726,7 @@ class Session(object): ''' # Check cache for existing entity emulating - # ftrack_api.inspection.identity result object to pass to key maker. + # ftrack_api_old.inspection.identity result object to pass to key maker. cache_key = self.cache_key_maker.key( (str(entity_type), map(str, entity_key)) ) @@ -745,7 +745,7 @@ class Session(object): '''Query against remote data according to *expression*. *expression* is not executed directly. Instead return an - :class:`ftrack_api.query.QueryResult` instance that will execute remote + :class:`ftrack_api_old.query.QueryResult` instance that will execute remote call on access. *page_size* specifies the maximum page size that the returned query @@ -770,7 +770,7 @@ class Session(object): expression ) - query_result = ftrack_api.query.QueryResult( + query_result = ftrack_api_old.query.QueryResult( self, expression, page_size=page_size ) return query_result @@ -817,7 +817,7 @@ class Session(object): '''Return merged *value*.''' log_debug = self.logger.isEnabledFor(logging.DEBUG) - if isinstance(value, ftrack_api.entity.base.Entity): + if isinstance(value, ftrack_api_old.entity.base.Entity): log_debug and self.logger.debug( 'Merging entity into session: {0} at {1}' .format(value, id(value)) @@ -825,7 +825,7 @@ class Session(object): return self._merge_entity(value, merged=merged) - elif isinstance(value, ftrack_api.collection.Collection): + elif isinstance(value, ftrack_api_old.collection.Collection): log_debug and self.logger.debug( 'Merging collection into session: {0!r} at {1}' .format(value, id(value)) @@ -839,7 +839,7 @@ class Session(object): return merged_collection - elif isinstance(value, ftrack_api.collection.MappedCollectionProxy): + elif isinstance(value, ftrack_api_old.collection.MappedCollectionProxy): log_debug and self.logger.debug( 'Merging mapped collection into session: {0!r} at {1}' .format(value, id(value)) @@ -873,7 +873,7 @@ class Session(object): with self.auto_populating(False): entity_key = self.cache_key_maker.key( - ftrack_api.inspection.identity(entity) + ftrack_api_old.inspection.identity(entity) ) # Check whether this entity has already been processed. @@ -936,7 +936,7 @@ class Session(object): Any locally set values included in the *projections* will not be overwritten with the retrieved remote value. If this 'synchronise' behaviour is required, first clear the relevant values on the entity by - setting them to :attr:`ftrack_api.symbol.NOT_SET`. Deleting the key will + setting them to :attr:`ftrack_api_old.symbol.NOT_SET`. Deleting the key will have the same effect:: >>> print(user['username']) @@ -956,7 +956,7 @@ class Session(object): )) if not isinstance( - entities, (list, tuple, ftrack_api.query.QueryResult) + entities, (list, tuple, ftrack_api_old.query.QueryResult) ): entities = [entities] @@ -968,7 +968,7 @@ class Session(object): entities_to_process = [] for entity in entities: - if ftrack_api.inspection.state(entity) is ftrack_api.symbol.CREATED: + if ftrack_api_old.inspection.state(entity) is ftrack_api_old.symbol.CREATED: # Created entities that are not yet persisted have no remote # values. Don't raise an error here as it is reasonable to # iterate over an entities properties and see that some of them @@ -988,7 +988,7 @@ class Session(object): primary_key_definition = reference_entity.primary_key_attributes entity_keys = [ - ftrack_api.inspection.primary_key(entity).values() + ftrack_api_old.inspection.primary_key(entity).values() for entity in entities_to_process ] @@ -1039,7 +1039,7 @@ class Session(object): # Convert operation to payload. if isinstance( - operation, ftrack_api.operation.CreateEntityOperation + operation, ftrack_api_old.operation.CreateEntityOperation ): # At present, data payload requires duplicating entity # type in data and also ensuring primary key added. @@ -1057,7 +1057,7 @@ class Session(object): }) elif isinstance( - operation, ftrack_api.operation.UpdateEntityOperation + operation, ftrack_api_old.operation.UpdateEntityOperation ): entity_data = { # At present, data payload requires duplicating entity @@ -1074,7 +1074,7 @@ class Session(object): }) elif isinstance( - operation, ftrack_api.operation.DeleteEntityOperation + operation, ftrack_api_old.operation.DeleteEntityOperation ): payload = OperationPayload({ 'action': 'delete', @@ -1145,7 +1145,7 @@ class Session(object): for payload in batch: entity_data = payload.get('entity_data', {}) for key, value in entity_data.items(): - if value is ftrack_api.symbol.NOT_SET: + if value is ftrack_api_old.symbol.NOT_SET: del entity_data[key] # Remove payloads with redundant entity_data. @@ -1241,7 +1241,7 @@ class Session(object): # or cache. for operation in self.recorded_operations: if isinstance( - operation, ftrack_api.operation.CreateEntityOperation + operation, ftrack_api_old.operation.CreateEntityOperation ): entity_key = str(( str(operation.entity_type), @@ -1281,7 +1281,7 @@ class Session(object): ''' plugin_arguments = plugin_arguments or {} - ftrack_api.plugin.discover( + ftrack_api_old.plugin.discover( self._plugin_paths, [self], plugin_arguments ) @@ -1382,12 +1382,12 @@ class Session(object): def _build_entity_type_classes(self, schemas): '''Build default entity type classes.''' - fallback_factory = ftrack_api.entity.factory.StandardFactory() + fallback_factory = ftrack_api_old.entity.factory.StandardFactory() classes = {} for schema in schemas: results = self.event_hub.publish( - ftrack_api.event.base.Event( + ftrack_api_old.event.base.Event( topic='ftrack.api.session.construct-entity-type', data=dict( schema=schema, @@ -1429,16 +1429,16 @@ class Session(object): 'Location', data=dict( name='ftrack.origin', - id=ftrack_api.symbol.ORIGIN_LOCATION_ID + id=ftrack_api_old.symbol.ORIGIN_LOCATION_ID ), reconstructing=True ) - ftrack_api.mixin( - location, ftrack_api.entity.location.OriginLocationMixin, + ftrack_api_old.mixin( + location, ftrack_api_old.entity.location.OriginLocationMixin, name='OriginLocation' ) - location.accessor = ftrack_api.accessor.disk.DiskAccessor(prefix='') - location.structure = ftrack_api.structure.origin.OriginStructure() + location.accessor = ftrack_api_old.accessor.disk.DiskAccessor(prefix='') + location.structure = ftrack_api_old.structure.origin.OriginStructure() location.priority = 100 # Unmanaged. @@ -1446,18 +1446,18 @@ class Session(object): 'Location', data=dict( name='ftrack.unmanaged', - id=ftrack_api.symbol.UNMANAGED_LOCATION_ID + id=ftrack_api_old.symbol.UNMANAGED_LOCATION_ID ), reconstructing=True ) - ftrack_api.mixin( - location, ftrack_api.entity.location.UnmanagedLocationMixin, + ftrack_api_old.mixin( + location, ftrack_api_old.entity.location.UnmanagedLocationMixin, name='UnmanagedLocation' ) - location.accessor = ftrack_api.accessor.disk.DiskAccessor(prefix='') - location.structure = ftrack_api.structure.origin.OriginStructure() + location.accessor = ftrack_api_old.accessor.disk.DiskAccessor(prefix='') + location.structure = ftrack_api_old.structure.origin.OriginStructure() # location.resource_identifier_transformer = ( - # ftrack_api.resource_identifier_transformer.internal.InternalResourceIdentifierTransformer(session) + # ftrack_api_old.resource_identifier_transformer.internal.InternalResourceIdentifierTransformer(session) # ) location.priority = 90 @@ -1466,16 +1466,16 @@ class Session(object): 'Location', data=dict( name='ftrack.review', - id=ftrack_api.symbol.REVIEW_LOCATION_ID + id=ftrack_api_old.symbol.REVIEW_LOCATION_ID ), reconstructing=True ) - ftrack_api.mixin( - location, ftrack_api.entity.location.UnmanagedLocationMixin, + ftrack_api_old.mixin( + location, ftrack_api_old.entity.location.UnmanagedLocationMixin, name='UnmanagedLocation' ) - location.accessor = ftrack_api.accessor.disk.DiskAccessor(prefix='') - location.structure = ftrack_api.structure.origin.OriginStructure() + location.accessor = ftrack_api_old.accessor.disk.DiskAccessor(prefix='') + location.structure = ftrack_api_old.structure.origin.OriginStructure() location.priority = 110 # Server. @@ -1483,18 +1483,18 @@ class Session(object): 'Location', data=dict( name='ftrack.server', - id=ftrack_api.symbol.SERVER_LOCATION_ID + id=ftrack_api_old.symbol.SERVER_LOCATION_ID ), reconstructing=True ) - ftrack_api.mixin( - location, ftrack_api.entity.location.ServerLocationMixin, + ftrack_api_old.mixin( + location, ftrack_api_old.entity.location.ServerLocationMixin, name='ServerLocation' ) - location.accessor = ftrack_api.accessor.server._ServerAccessor( + location.accessor = ftrack_api_old.accessor.server._ServerAccessor( session=self ) - location.structure = ftrack_api.structure.entity_id.EntityIdStructure() + location.structure = ftrack_api_old.structure.entity_id.EntityIdStructure() location.priority = 150 # Master location based on server scenario. @@ -1505,7 +1505,7 @@ class Session(object): storage_scenario.get('scenario') ): self.event_hub.publish( - ftrack_api.event.base.Event( + ftrack_api_old.event.base.Event( topic='ftrack.storage-scenario.activate', data=dict( storage_scenario=storage_scenario @@ -1516,7 +1516,7 @@ class Session(object): # Next, allow further configuration of locations via events. self.event_hub.publish( - ftrack_api.event.base.Event( + ftrack_api_old.event.base.Event( topic='ftrack.api.session.configure-location', data=dict( session=self @@ -1554,7 +1554,7 @@ class Session(object): .format(response.text) ) self.logger.error(error_message) - raise ftrack_api.exception.ServerError(error_message) + raise ftrack_api_old.exception.ServerError(error_message) else: if 'exception' in result: @@ -1563,7 +1563,7 @@ class Session(object): result['exception'], result['content'] ) self.logger.error(error_message) - raise ftrack_api.exception.ServerError(error_message) + raise ftrack_api_old.exception.ServerError(error_message) return result @@ -1619,18 +1619,18 @@ class Session(object): data = dict(item.items()) if "entity_data" in data: for key, value in data["entity_data"].items(): - if isinstance(value, ftrack_api.entity.base.Entity): + if isinstance(value, ftrack_api_old.entity.base.Entity): data["entity_data"][key] = self._entity_reference(value) return data - if isinstance(item, ftrack_api.entity.base.Entity): + if isinstance(item, ftrack_api_old.entity.base.Entity): data = self._entity_reference(item) with self.auto_populating(True): for attribute in item.attributes: - value = ftrack_api.symbol.NOT_SET + value = ftrack_api_old.symbol.NOT_SET if entity_attribute_strategy == 'all': value = attribute.get_value(item) @@ -1638,7 +1638,7 @@ class Session(object): elif entity_attribute_strategy == 'set_only': if attribute.is_set(item): value = attribute.get_local_value(item) - if value is ftrack_api.symbol.NOT_SET: + if value is ftrack_api_old.symbol.NOT_SET: value = attribute.get_remote_value(item) elif entity_attribute_strategy == 'modified_only': @@ -1648,11 +1648,11 @@ class Session(object): elif entity_attribute_strategy == 'persisted_only': value = attribute.get_remote_value(item) - if value is not ftrack_api.symbol.NOT_SET: + if value is not ftrack_api_old.symbol.NOT_SET: if isinstance( - attribute, ftrack_api.attribute.ReferenceAttribute + attribute, ftrack_api_old.attribute.ReferenceAttribute ): - if isinstance(value, ftrack_api.entity.base.Entity): + if isinstance(value, ftrack_api_old.entity.base.Entity): value = self._entity_reference(value) data[attribute.name] = value @@ -1660,12 +1660,12 @@ class Session(object): return data if isinstance( - item, ftrack_api.collection.MappedCollectionProxy + item, ftrack_api_old.collection.MappedCollectionProxy ): # Use proxied collection for serialisation. item = item.collection - if isinstance(item, ftrack_api.collection.Collection): + if isinstance(item, ftrack_api_old.collection.Collection): data = [] for entity in item: data.append(self._entity_reference(entity)) @@ -1685,7 +1685,7 @@ class Session(object): '__entity_type__': entity.entity_type } with self.auto_populating(False): - reference.update(ftrack_api.inspection.primary_key(entity)) + reference.update(ftrack_api_old.inspection.primary_key(entity)) return reference @@ -1812,7 +1812,7 @@ class Session(object): .. note:: - A :meth:`Session.commit` may be + A :meth:`Session.commit` may be automatically issued as part of the components registration in the location. ''' @@ -1827,7 +1827,7 @@ class Session(object): 'ftrackreview-mp4', 'ftrackreview-webm', 'ftrackreview-image' ): location = self.get( - 'Location', ftrack_api.symbol.REVIEW_LOCATION_ID + 'Location', ftrack_api_old.symbol.REVIEW_LOCATION_ID ) else: @@ -1892,7 +1892,7 @@ class Session(object): if location: origin_location = self.get( - 'Location', ftrack_api.symbol.ORIGIN_LOCATION_ID + 'Location', ftrack_api_old.symbol.ORIGIN_LOCATION_ID ) location.add_component( container, origin_location, recursive=True @@ -1911,7 +1911,7 @@ class Session(object): # Add to special origin location so that it is possible to add to other # locations. origin_location = self.get( - 'Location', ftrack_api.symbol.ORIGIN_LOCATION_ID + 'Location', ftrack_api_old.symbol.ORIGIN_LOCATION_ID ) origin_location.add_component(component, path, recursive=False) @@ -2022,7 +2022,7 @@ class Session(object): *job_type* should be one of the allowed job types. There is currently only one remote job type "SYNC_USERS_LDAP". ''' - if job_type not in (ftrack_api.symbol.JOB_SYNC_USERS_LDAP, ): + if job_type not in (ftrack_api_old.symbol.JOB_SYNC_USERS_LDAP, ): raise ValueError( u'Invalid Job type: {0}.'.format(job_type) ) @@ -2037,7 +2037,7 @@ class Session(object): [operation] )[0] - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: raise return result['data'] @@ -2066,16 +2066,16 @@ class Session(object): if entity: operation['entity_type'] = entity.entity_type operation['entity_key'] = ( - ftrack_api.inspection.primary_key(entity).values() + ftrack_api_old.inspection.primary_key(entity).values() ) try: result = self._call([operation]) - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: # Raise informative error if the action is not supported. if 'Invalid action u\'get_widget_url\'' in error.message: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0!r} does not support "get_widget_url", ' 'please update server and try again.'.format( self.server_information.get('version') @@ -2132,7 +2132,7 @@ class Session(object): if isinstance(media, basestring): # Media is a path to a file. server_location = self.get( - 'Location', ftrack_api.symbol.SERVER_LOCATION_ID + 'Location', ftrack_api_old.symbol.SERVER_LOCATION_ID ) if keep_original == 'auto': keep_original = False @@ -2174,10 +2174,10 @@ class Session(object): try: result = self._call([operation]) - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: # Raise informative error if the action is not supported. if 'Invalid action u\'encode_media\'' in error.message: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0!r} does not support "encode_media", ' 'please update server and try again.'.format( self.server_information.get('version') @@ -2214,10 +2214,10 @@ class Session(object): try: result = self._call([operation]) - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: # Raise informative error if the action is not supported. if 'Invalid action u\'get_upload_metadata\'' in error.message: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0!r} does not support ' '"get_upload_metadata", please update server and try ' 'again.'.format( @@ -2260,10 +2260,10 @@ class Session(object): try: self._call(operations) - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: # Raise informative error if the action is not supported. if 'Invalid action u\'send_user_invite\'' in error.message: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0!r} does not support ' '"send_user_invite", please update server and ' 'try again.'.format( @@ -2307,10 +2307,10 @@ class Session(object): try: self._call(operations) - except ftrack_api.exception.ServerError as error: + except ftrack_api_old.exception.ServerError as error: # Raise informative error if the action is not supported. if 'Invalid action u\'send_review_session_invite\'' in error.message: - raise ftrack_api.exception.ServerCompatibilityError( + raise ftrack_api_old.exception.ServerCompatibilityError( 'Server version {0!r} does not support ' '"send_review_session_invite", please update server and ' 'try again.'.format( diff --git a/pype/vendor/ftrack_api_27/structure/__init__.py b/pype/vendor/ftrack_api_old/structure/__init__.py similarity index 100% rename from pype/vendor/ftrack_api_27/structure/__init__.py rename to pype/vendor/ftrack_api_old/structure/__init__.py diff --git a/pype/vendor/ftrack_api_27/structure/base.py b/pype/vendor/ftrack_api_old/structure/base.py similarity index 100% rename from pype/vendor/ftrack_api_27/structure/base.py rename to pype/vendor/ftrack_api_old/structure/base.py diff --git a/pype/vendor/ftrack_api_27/structure/entity_id.py b/pype/vendor/ftrack_api_old/structure/entity_id.py similarity index 71% rename from pype/vendor/ftrack_api_27/structure/entity_id.py rename to pype/vendor/ftrack_api_old/structure/entity_id.py index ae466bf6d9..9759e7795e 100644 --- a/pype/vendor/ftrack_api_27/structure/entity_id.py +++ b/pype/vendor/ftrack_api_old/structure/entity_id.py @@ -1,10 +1,10 @@ # :coding: utf-8 # :copyright: Copyright (c) 2015 ftrack -import ftrack_api.structure.base +import ftrack_api_old.structure.base -class EntityIdStructure(ftrack_api.structure.base.Structure): +class EntityIdStructure(ftrack_api_old.structure.base.Structure): '''Entity id pass-through structure.''' def get_resource_identifier(self, entity, context=None): diff --git a/pype/vendor/ftrack_api_27/structure/id.py b/pype/vendor/ftrack_api_old/structure/id.py similarity index 91% rename from pype/vendor/ftrack_api_27/structure/id.py rename to pype/vendor/ftrack_api_old/structure/id.py index acc3e21b02..1051f55aad 100644 --- a/pype/vendor/ftrack_api_27/structure/id.py +++ b/pype/vendor/ftrack_api_old/structure/id.py @@ -3,11 +3,11 @@ import os -import ftrack_api.symbol -import ftrack_api.structure.base +import ftrack_api_old.symbol +import ftrack_api_old.structure.base -class IdStructure(ftrack_api.structure.base.Structure): +class IdStructure(ftrack_api_old.structure.base.Structure): '''Id based structure supporting Components only. A components unique id will be used to form a path to store the data at. @@ -44,7 +44,7 @@ class IdStructure(ftrack_api.structure.base.Structure): # When in a container, place the file inside a directory named # after the container. container = entity['container'] - if container and container is not ftrack_api.symbol.NOT_SET: + if container and container is not ftrack_api_old.symbol.NOT_SET: path = self.get_resource_identifier(container) if container.entity_type in ('SequenceComponent',): @@ -72,7 +72,7 @@ class IdStructure(ftrack_api.structure.base.Structure): if ( entity['file_type'] and - entity['file_type'] is not ftrack_api.symbol.NOT_SET + entity['file_type'] is not ftrack_api_old.symbol.NOT_SET ): name += entity['file_type'] diff --git a/pype/vendor/ftrack_api_27/structure/origin.py b/pype/vendor/ftrack_api_old/structure/origin.py similarity index 100% rename from pype/vendor/ftrack_api_27/structure/origin.py rename to pype/vendor/ftrack_api_old/structure/origin.py diff --git a/pype/vendor/ftrack_api_27/structure/standard.py b/pype/vendor/ftrack_api_old/structure/standard.py similarity index 93% rename from pype/vendor/ftrack_api_27/structure/standard.py rename to pype/vendor/ftrack_api_old/structure/standard.py index 0b0602df00..f58608afb8 100644 --- a/pype/vendor/ftrack_api_27/structure/standard.py +++ b/pype/vendor/ftrack_api_old/structure/standard.py @@ -5,11 +5,11 @@ import os import re import unicodedata -import ftrack_api.symbol -import ftrack_api.structure.base +import ftrack_api_old.symbol +import ftrack_api_old.structure.base -class StandardStructure(ftrack_api.structure.base.Structure): +class StandardStructure(ftrack_api_old.structure.base.Structure): '''Project hierarchy based structure that only supports Components. The resource identifier is generated from the project code, the name @@ -72,7 +72,7 @@ class StandardStructure(ftrack_api.structure.base.Structure): version = entity['version'] - if version is ftrack_api.symbol.NOT_SET and entity['version_id']: + if version is ftrack_api_old.symbol.NOT_SET and entity['version_id']: version = session.get('AssetVersion', entity['version_id']) error_message = ( @@ -83,15 +83,15 @@ class StandardStructure(ftrack_api.structure.base.Structure): ) if ( - version is ftrack_api.symbol.NOT_SET or + version is ftrack_api_old.symbol.NOT_SET or version in session.created ): - raise ftrack_api.exception.StructureError(error_message) + raise ftrack_api_old.exception.StructureError(error_message) link = version['link'] if not link: - raise ftrack_api.exception.StructureError(error_message) + raise ftrack_api_old.exception.StructureError(error_message) structure_names = [ item['name'] @@ -151,7 +151,7 @@ class StandardStructure(ftrack_api.structure.base.Structure): is unused in this implementation. - Raise a :py:exc:`ftrack_api.exeption.StructureError` if *entity* is not + Raise a :py:exc:`ftrack_api_old.exeption.StructureError` if *entity* is not attached to a committed version and a committed asset with a parent context. diff --git a/pype/vendor/ftrack_api_27/symbol.py b/pype/vendor/ftrack_api_old/symbol.py similarity index 100% rename from pype/vendor/ftrack_api_27/symbol.py rename to pype/vendor/ftrack_api_old/symbol.py