Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: errors in typing for Python 3.13 #104

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'

- name: Build package
run: |
Expand Down
4 changes: 2 additions & 2 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent' : f'AppwritePythonSDK/9.0.0 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})',
'user-agent' : f'AppwritePythonSDK/9.0.1 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '9.0.0',
'x-sdk-version': '9.0.1',
'X-Appwrite-Response-Format' : '1.6.0',
}

Expand Down
7 changes: 4 additions & 3 deletions appwrite/services/account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException
from ..enums.authenticator_type import AuthenticatorType;
from ..enums.authentication_factor import AuthenticationFactor;
Expand Down Expand Up @@ -62,7 +63,7 @@ def update_email(self, email: str, password: str):
'content-type': 'application/json',
}, api_params)

def list_identities(self, queries: list[str] = None):
def list_identities(self, queries: List[str] = None):
"""List identities"""

api_path = '/account/identities'
Expand Down Expand Up @@ -99,7 +100,7 @@ def create_jwt(self):
'content-type': 'application/json',
}, api_params)

def list_logs(self, queries: list[str] = None):
def list_logs(self, queries: List[str] = None):
"""List logs"""

api_path = '/account/logs'
Expand Down Expand Up @@ -568,7 +569,7 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra
'content-type': 'application/json',
}, api_params)

def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list[str] = None):
def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: List[str] = None):
"""Create OAuth2 token"""

api_path = '/account/tokens/oauth2/{provider}'
Expand Down
1 change: 1 addition & 0 deletions appwrite/services/avatars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException
from ..enums.browser import Browser;
from ..enums.credit_card import CreditCard;
Expand Down
27 changes: 14 additions & 13 deletions appwrite/services/databases.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException
from ..enums.relationship_type import RelationshipType;
from ..enums.relation_mutate import RelationMutate;
Expand All @@ -9,7 +10,7 @@ class Databases(Service):
def __init__(self, client):
super(Databases, self).__init__(client)

def list(self, queries: list[str] = None, search: str = None):
def list(self, queries: List[str] = None, search: str = None):
"""List databases"""

api_path = '/databases'
Expand Down Expand Up @@ -92,7 +93,7 @@ def delete(self, database_id: str):
'content-type': 'application/json',
}, api_params)

def list_collections(self, database_id: str, queries: list[str] = None, search: str = None):
def list_collections(self, database_id: str, queries: List[str] = None, search: str = None):
"""List collections"""

api_path = '/databases/{databaseId}/collections'
Expand All @@ -109,7 +110,7 @@ def list_collections(self, database_id: str, queries: list[str] = None, search:
'content-type': 'application/json',
}, api_params)

def create_collection(self, database_id: str, collection_id: str, name: str, permissions: list[str] = None, document_security: bool = None, enabled: bool = None):
def create_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None):
"""Create collection"""

api_path = '/databases/{databaseId}/collections'
Expand Down Expand Up @@ -154,7 +155,7 @@ def get_collection(self, database_id: str, collection_id: str):
'content-type': 'application/json',
}, api_params)

def update_collection(self, database_id: str, collection_id: str, name: str, permissions: list[str] = None, document_security: bool = None, enabled: bool = None):
def update_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None):
"""Update collection"""

api_path = '/databases/{databaseId}/collections/{collectionId}'
Expand Down Expand Up @@ -199,7 +200,7 @@ def delete_collection(self, database_id: str, collection_id: str):
'content-type': 'application/json',
}, api_params)

def list_attributes(self, database_id: str, collection_id: str, queries: list[str] = None):
def list_attributes(self, database_id: str, collection_id: str, queries: List[str] = None):
"""List attributes"""

api_path = '/databases/{databaseId}/collections/{collectionId}/attributes'
Expand Down Expand Up @@ -393,7 +394,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str,
'content-type': 'application/json',
}, api_params)

def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list[str], required: bool, default: str = None, array: bool = None):
def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None):
"""Create enum attribute"""

api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'
Expand Down Expand Up @@ -426,7 +427,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str,
'content-type': 'application/json',
}, api_params)

def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list[str], required: bool, default: str, new_key: str = None):
def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str, new_key: str = None):
"""Update enum attribute"""

api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'
Expand Down Expand Up @@ -865,7 +866,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke
'content-type': 'application/json',
}, api_params)

def list_documents(self, database_id: str, collection_id: str, queries: list[str] = None):
def list_documents(self, database_id: str, collection_id: str, queries: List[str] = None):
"""List documents"""

api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
Expand All @@ -885,7 +886,7 @@ def list_documents(self, database_id: str, collection_id: str, queries: list[str
'content-type': 'application/json',
}, api_params)

def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: list[str] = None):
def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None):
"""Create document"""

api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
Expand Down Expand Up @@ -913,7 +914,7 @@ def create_document(self, database_id: str, collection_id: str, document_id: str
'content-type': 'application/json',
}, api_params)

def get_document(self, database_id: str, collection_id: str, document_id: str, queries: list[str] = None):
def get_document(self, database_id: str, collection_id: str, document_id: str, queries: List[str] = None):
"""Get document"""

api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
Expand All @@ -937,7 +938,7 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q
'content-type': 'application/json',
}, api_params)

def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: list[str] = None):
def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None):
"""Update document"""

api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
Expand Down Expand Up @@ -985,7 +986,7 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str
'content-type': 'application/json',
}, api_params)

def list_indexes(self, database_id: str, collection_id: str, queries: list[str] = None):
def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None):
"""List indexes"""

api_path = '/databases/{databaseId}/collections/{collectionId}/indexes'
Expand All @@ -1005,7 +1006,7 @@ def list_indexes(self, database_id: str, collection_id: str, queries: list[str]
'content-type': 'application/json',
}, api_params)

def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: list[str], orders: list[str] = None):
def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None):
"""Create index"""

api_path = '/databases/{databaseId}/collections/{collectionId}/indexes'
Expand Down
11 changes: 6 additions & 5 deletions appwrite/services/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException
from ..enums.runtime import Runtime;
from ..input_file import InputFile
Expand All @@ -9,7 +10,7 @@ class Functions(Service):
def __init__(self, client):
super(Functions, self).__init__(client)

def list(self, queries: list[str] = None, search: str = None):
def list(self, queries: List[str] = None, search: str = None):
"""List functions"""

api_path = '/functions'
Expand All @@ -22,7 +23,7 @@ def list(self, queries: list[str] = None, search: str = None):
'content-type': 'application/json',
}, api_params)

def create(self, function_id: str, name: str, runtime: Runtime, execute: list[str] = None, events: list[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None):
def create(self, function_id: str, name: str, runtime: Runtime, execute: List[str] = None, events: List[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: List[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None):
"""Create function"""

api_path = '/functions'
Expand Down Expand Up @@ -99,7 +100,7 @@ def get(self, function_id: str):
'content-type': 'application/json',
}, api_params)

def update(self, function_id: str, name: str, runtime: Runtime = None, execute: list[str] = None, events: list[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None):
def update(self, function_id: str, name: str, runtime: Runtime = None, execute: List[str] = None, events: List[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: List[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None):
"""Update function"""

api_path = '/functions/{functionId}'
Expand Down Expand Up @@ -149,7 +150,7 @@ def delete(self, function_id: str):
'content-type': 'application/json',
}, api_params)

def list_deployments(self, function_id: str, queries: list[str] = None, search: str = None):
def list_deployments(self, function_id: str, queries: List[str] = None, search: str = None):
"""List deployments"""

api_path = '/functions/{functionId}/deployments'
Expand Down Expand Up @@ -311,7 +312,7 @@ def get_deployment_download(self, function_id: str, deployment_id: str):
'content-type': 'application/json',
}, api_params)

def list_executions(self, function_id: str, queries: list[str] = None, search: str = None):
def list_executions(self, function_id: str, queries: List[str] = None, search: str = None):
"""List executions"""

api_path = '/functions/{functionId}/executions'
Expand Down
1 change: 1 addition & 0 deletions appwrite/services/graphql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException

class Graphql(Service):
Expand Down
1 change: 1 addition & 0 deletions appwrite/services/health.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException
from ..enums.name import Name;

Expand Down
1 change: 1 addition & 0 deletions appwrite/services/locale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from ..service import Service
from typing import List
from ..exception import AppwriteException

class Locale(Service):
Expand Down
Loading