Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
- name: Lint with Ruff
run: |
uv run ruff check src/typesense
uv run ruff format src/typesense
- name: Check types with mypy
run: |
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ Bug reports and pull requests are welcome on GitHub at [https://github.com/types
## License

`typesense-python` is distributed under the Apache 2 license.



2 changes: 0 additions & 2 deletions src/typesense/analytics_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ def status(self) -> AnalyticsStatus:
entity_type=AnalyticsStatus,
)
return response


2 changes: 0 additions & 2 deletions src/typesense/analytics_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,3 @@ def __init__(self, api_call: ApiCall) -> None:
@property
def rules(self) -> AnalyticsRulesV1:
return self._rules


13 changes: 6 additions & 7 deletions src/typesense/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def __contains__(self, collection_name: str) -> bool:
"""
if collection_name in self.collections:
try: # noqa: WPS229, WPS529

self.collections[collection_name].retrieve() # noqa: WPS529
return True
except Exception:
Expand Down Expand Up @@ -100,7 +99,7 @@ def __getitem__(self, collection_name: str) -> Collection[TDoc]:

Example:
>>> collections = Collections(api_call)
>>> fruits_collection = collections['fruits']
>>> fruits_collection = collections["fruits"]
"""
if not self.collections.get(collection_name):
self.collections[collection_name] = Collection(
Expand All @@ -126,11 +125,11 @@ def create(self, schema: CollectionCreateSchema) -> CollectionSchema:
>>> schema = {
... "name": "companies",
... "fields": [
... {"name": "company_name", "type": "string" },
... {"name": "num_employees", "type": "int32" },
... {"name": "country", "type": "string", "facet": True }
... {"name": "company_name", "type": "string"},
... {"name": "num_employees", "type": "int32"},
... {"name": "country", "type": "string", "facet": True},
... ],
... "default_sorting_field": "num_employees"
... "default_sorting_field": "num_employees",
... }
>>> created_schema = collections.create(schema)
"""
Expand All @@ -154,7 +153,7 @@ def retrieve(self) -> typing.List[CollectionSchema]:
>>> collections = Collections(api_call)
>>> all_collections = collections.retrieve()
>>> for collection in all_collections:
... print(collection['name'])
... print(collection["name"])
"""
call: typing.List[CollectionSchema] = self.api_call.get(
endpoint=Collections.resource_path,
Expand Down
4 changes: 3 additions & 1 deletion src/typesense/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ def __init__(
)
self.verify = config_dict.get("verify", True)
self.additional_headers = config_dict.get("additional_headers", {})
self.suppress_deprecation_warnings = config_dict.get("suppress_deprecation_warnings", False)
self.suppress_deprecation_warnings = config_dict.get(
"suppress_deprecation_warnings", False
)

def _handle_nearest_node(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/typesense/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ class Overrides:

resource_path: typing.Final[str] = "overrides"

@warn_deprecation( # type: ignore[misc]
@warn_deprecation( # type: ignore[misc]
"Overrides is deprecated on v30+. Use client.curation_sets instead.",
flag_name="overrides_deprecation",
)
def __init__(
self,
api_call: ApiCall,
collection_name: str,
) -> None:
) -> None:
"""
Initialize the Overrides object.

Expand Down
4 changes: 2 additions & 2 deletions src/typesense/synonyms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ class Synonyms:

resource_path: typing.Final[str] = "synonyms"

@warn_deprecation( # type: ignore[misc]
@warn_deprecation( # type: ignore[misc]
"The synonyms API (collections/{collection}/synonyms) is deprecated is removed on v30+. "
"Use synonym sets (synonym_sets) instead.",
flag_name="synonyms_deprecation",
)
def __init__(self, api_call: ApiCall, collection_name: str) -> None:
def __init__(self, api_call: ApiCall, collection_name: str) -> None:
"""
Initialize the Synonyms object.

Expand Down
2 changes: 0 additions & 2 deletions src/typesense/types/analytics_rule_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,3 @@ class RulesRetrieveSchema(typing.TypedDict):
"""

rules: typing.List[typing.Union[RuleSchemaForQueries, RuleSchemaForCounters]]


1 change: 0 additions & 1 deletion src/typesense/types/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,3 @@ class CollectionUpdateSchema(typing.TypedDict):
]
synonym_sets: typing.NotRequired[typing.List[str]]
curation_sets: typing.NotRequired[typing.List[str]]

2 changes: 0 additions & 2 deletions src/typesense/types/curation_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,3 @@ class CurationSetDeleteSchema(typing.TypedDict):
"""Response schema for deleting a curation set."""

name: str


4 changes: 3 additions & 1 deletion src/typesense/types/synonym_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class SynonymItemSchema(typing.TypedDict):
locale: typing.NotRequired[Locales]
symbols_to_index: typing.NotRequired[typing.List[str]]


class SynonymItemDeleteSchema(typing.TypedDict):
"""
Schema for deleting a synonym item.
"""

id: str


class SynonymSetCreateSchema(typing.TypedDict):
"""
Schema for creating or updating a synonym set.
Expand Down Expand Up @@ -73,4 +75,4 @@ class SynonymSetDeleteSchema(typing.TypedDict):
name (str): Name of the deleted synonym set.
"""

name: str
name: str