Skip to content

Commit

Permalink
code linting, fix flake8 errors, format with black (#61)
Browse files Browse the repository at this point in the history
* code linting without change in functionality
  • Loading branch information
m29h authored Jun 16, 2023
1 parent 9d20166 commit 4fc9b3f
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions pocketbase/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
from .log_request import LogRequest
from .record import Record
from .file_upload import FileUpload

__all__ = ["Admin", "Collection", "ExternalAuth", "LogRequest", "Record", "FileUpload"]
3 changes: 0 additions & 3 deletions pocketbase/models/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from __future__ import annotations

import datetime

from pocketbase.utils import to_datetime
from pocketbase.models.utils.base_model import BaseModel


Expand Down
2 changes: 2 additions & 0 deletions pocketbase/models/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .base_model import BaseModel
from .list_result import ListResult
from .schema_field import SchemaField

__all__ = ["BaseModel", "ListResult", "SchemaField"]
11 changes: 11 additions & 0 deletions pocketbase/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
from .realtime_service import RealtimeService
from .record_service import RecordService
from .settings_service import SettingsService

__all__ = [
"AdminService",
"AdminAuthResponse",
"CollectionService",
"LogService",
"HourlyStats",
"RealtimeService",
"RecordService",
"SettingsService",
]
2 changes: 2 additions & 0 deletions pocketbase/services/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .base_crud_service import BaseCrudService
from .base_service import BaseService
from .crud_service import CrudService

__all__ = ["BaseCrudService", "BaseService", "CrudService"]
6 changes: 1 addition & 5 deletions pocketbase/services/utils/base_crud_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def decode(self, data: dict) -> BaseModel:
def _get_full_list(
self, base_path: str, batch_size: int = 100, query_params: dict = {}
) -> list[BaseModel]:

result: list[BaseModel] = []

def request(result: list[BaseModel], page: int) -> list:
Expand Down Expand Up @@ -65,10 +64,7 @@ def _get_first_list_item(self, base_path: str, filter: str, query_params={}):
}
)
result = self._get_list(base_path, 1, 1, query_params)
try:
if len(result.items) == 0:
raise
except:
if not result.items:
raise ClientResponseError(
"The requested resource wasn't found.", status=404
)
Expand Down
2 changes: 1 addition & 1 deletion pocketbase/services/utils/sse.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run(self):
break
if event.event in self.listeners:
self.listeners[event.event](event)
except:
except Exception:
self.kill = True


Expand Down
2 changes: 2 additions & 0 deletions pocketbase/stores/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .base_auth_store import BaseAuthStore
from .local_auth_store import LocalAuthStore

__all__ = ["BaseAuthStore", "LocalAuthStore"]
3 changes: 0 additions & 3 deletions tests/integration/test_files.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from pocketbase import PocketBase
from pocketbase.utils import ClientResponseError
from pocketbase.client import FileUpload
import httpx
from random import getrandbits

from uuid import uuid4
import pytest


class TestFileService:
Expand Down
6 changes: 1 addition & 5 deletions tests/integration/test_record.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from pocketbase import PocketBase
from pocketbase.utils import ClientResponseError
from pocketbase.client import FileUpload
import httpx
from random import getrandbits

from uuid import uuid4
import pytest

Expand Down Expand Up @@ -89,7 +85,7 @@ def test_get_record_expand_full_list(self, client: PocketBase, state):
)
i = 0
for r in rel:
while r != None:
while r is not None:
if hasattr(r, "expand"):
if "rel" in r.expand:
i += 1
Expand Down
1 change: 0 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import datetime

from pocketbase import __version__
from pocketbase.utils import camel_to_snake, to_datetime


Expand Down

0 comments on commit 4fc9b3f

Please sign in to comment.