Skip to content

Commit

Permalink
Pylint action.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jun 20, 2024
1 parent 8756869 commit 013cebb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/check_with_pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install pylint pydantic requests
- name: Run pylint
run: pylint py3xui
9 changes: 9 additions & 0 deletions py3xui/inbound/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pydantic import BaseModel, model_validator


# pylint: disable=too-few-public-methods
class JsonStringModel(BaseModel):
"""Base class for models that have a JSON string as a field."""

Expand All @@ -13,6 +14,14 @@ def model_validate(
cls,
values,
): # pylint: disable=no-self-argument, arguments-differ
"""Converts the JSON string to a dictionary if it is a string.
Args:
values (Any): The values to validate.
Returns:
Any: The validated values.
"""
if isinstance(values, str):
try:
return json.loads(values)
Expand Down

0 comments on commit 013cebb

Please sign in to comment.