Skip to content

Fix pylint and isort errors #674

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

Merged
merged 1 commit into from
Feb 4, 2023
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 Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ types-requests = "*"
black = "*"
isort = "*"
importlib_metadata = {version = "*", markers="python_version < '3.8'"}
zipp = {version = "*", markers="python_version < '3.8'"}
zipp = {version = "==3.8.1", markers="python_version < '3.8'"}
exceptiongroup = {version = "*", markers="python_version < '3.11'"}
tomli = {version = "*", markers="python_version < '3.11'"}
wrapt = {version = "*", markers="python_version < '3.11'"}
Expand Down
63 changes: 49 additions & 14 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions meilisearch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def index(self, uid: str) -> Index:
"""
if uid is not None:
return Index(self.config, uid=uid)
raise Exception("The index UID should not be None")
raise ValueError("The index UID should not be None")

def get_all_stats(self) -> Dict[str, Any]:
"""Get all stats of Meilisearch
Expand Down Expand Up @@ -566,15 +566,15 @@ def generate_tenant_token(
"""
# Validate all fields
if api_key == "" or api_key is None and self.config.api_key is None:
raise Exception(
raise ValueError(
"An api key is required in the client or should be passed as an argument."
)
if api_key_uid == "" or api_key_uid is None or self._valid_uuid(api_key_uid) is False:
raise Exception("An uid is required and must comply to the uuid4 format.")
raise ValueError("An uid is required and must comply to the uuid4 format.")
if not search_rules or search_rules == [""]:
raise Exception("The search_rules field is mandatory and should be defined.")
raise ValueError("The search_rules field is mandatory and should be defined.")
if expires_at and expires_at < datetime.datetime.utcnow():
raise Exception("The date expires_at should be in the future.")
raise ValueError("The date expires_at should be in the future.")

# Standard JWT header for encryption with SHA256/HS256 algorithm
header = {"typ": "JWT", "alg": "HS256"}
Expand Down