Skip to content

Commit

Permalink
nitpick ( ˘▽˘)っ♨
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Jun 7, 2024
1 parent 27506c5 commit 0b9aa64
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tesk/api/ga4gh/tes/base/base_tesk_request.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Base classes for the TES API request."""

from abc import ABC, abstractmethod
from typing import final
from typing import Any, final

from pydantic import BaseModel

Expand Down Expand Up @@ -32,7 +32,7 @@ def api_response(self) -> BaseModel:
pass

@final
def response(self) -> dict:
def response(self) -> dict[Any, Any]:
"""Returns serialized response.
Should be invoked by controller.
Expand Down
3 changes: 2 additions & 1 deletion tesk/api/ga4gh/tes/controllers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Controllers for GA4GH TES API endpoints."""

import logging
from typing import Any

# from connexion import request # type: ignore
from foca.utils.logging import log_traffic # type: ignore
Expand Down Expand Up @@ -38,7 +39,7 @@ def CreateTask(*args, **kwargs) -> dict: # type: ignore

# GET /tasks/service-info
@log_traffic
def GetServiceInfo() -> dict:
def GetServiceInfo() -> dict[Any, Any]:
"""Get service info."""
service_info = ServiceInfo()
return service_info.response()
Expand Down
6 changes: 4 additions & 2 deletions tesk/api/ga4gh/tes/models/tes_service_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TesServiceInfo(BaseModel):
)

@validator('contactUrl')
def validate_url_and_email(cls, v):
def validate_url_and_email(cls, v: str) -> str:
"""Validate the contactURL format based on RFC 3986 or 2368 standard."""
url_validator = RFC3986Validator()
email_validator = RFC2386Validator()
Expand All @@ -190,4 +190,6 @@ def validate_url_and_email(cls, v):
return url_validator.validate(cls, v)

logger.error('contactUrl must be based on RFC 3986 or 2368 standard.')
raise ValidationError('contactUrl must be based on RFC 3986 or 2368 standard.')
raise ValidationError(
'contactUrl must be based on RFC 3986 or 2368 standard.', model=cls
)
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def validation_logic(self, v: T) -> bool:
"""
pass

def _raise_error(self, cls: Any, v: T):
def _raise_error(self, cls: Any, v: T) -> None:
"""Raise a validation error.
Args:
Expand Down
4 changes: 1 addition & 3 deletions tesk/api/ga4gh/tes/models/validators/rfc3339_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,4 @@ def validation_logic(self, v: str) -> bool:
# Year 0 is not valid a valid date
return False
(_, max_day) = calendar.monthrange(year, month)
if not 1 <= day <= max_day:
return False
return True
return 1 <= day <= max_day
6 changes: 5 additions & 1 deletion tesk/api/ga4gh/tes/service_info/service_info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""Service info for TES API."""
"""Service info for TES API.
This module provides the TesServiceInfo class, which is
the response to the service info request for the TES API.
"""

from tesk.api.ga4gh.tes.models.tes_service_info import TesServiceInfo
from tesk.api.ga4gh.tes.models.tes_service_info_organization import (
Expand Down

0 comments on commit 0b9aa64

Please sign in to comment.