Skip to content

Commit

Permalink
Split bulk_api/core into exceptions and helpers modules
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Nov 22, 2023
1 parent 2675109 commit 03b6f5c
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion h/services/bulk_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from h.services.bulk_api.annotation import BulkAnnotation, BulkAnnotationService
from h.services.bulk_api.core import BadDateFilter
from h.services.bulk_api.exceptions import BadDateFilter
from h.services.bulk_api.group import BulkGroupService
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import sqlalchemy as sa


class BadDateFilter(Exception):
"""There is something wrong with the date filter provided."""
from h.services.bulk_api.exceptions import BadDateFilter


def date_match(column: sa.Column, spec: dict):
Expand Down
2 changes: 1 addition & 1 deletion h/services/bulk_api/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sqlalchemy.sql import Select

from h.models import AnnotationMetadata, AnnotationSlim, Group, GroupMembership, User
from h.services.bulk_api.core import date_match
from h.services.bulk_api._helpers import date_match


@dataclass
Expand Down
2 changes: 2 additions & 0 deletions h/services/bulk_api/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class BadDateFilter(Exception):
"""There is something wrong with the date filter provided."""
2 changes: 1 addition & 1 deletion h/services/bulk_api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.orm import Session

from h.models import Annotation, Group
from h.services.bulk_api.core import date_match
from h.services.bulk_api._helpers import date_match


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from sqlalchemy import select

from h.models import Annotation
from h.services.bulk_api.core import BadDateFilter, date_match
from h.services.bulk_api._helpers import date_match
from h.services.bulk_api.exceptions import BadDateFilter


class TestDateMatch:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/h/views/api/bulk/annotation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from h.schemas import ValidationError
from h.services.bulk_api.annotation import BulkAnnotation
from h.services.bulk_api.core import BadDateFilter
from h.services.bulk_api.exceptions import BadDateFilter
from h.views.api.bulk.annotation import BulkAnnotationSchema, bulk_annotation


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/h/views/api/bulk/group_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from h_matchers import Any

from h.schemas import ValidationError
from h.services.bulk_api.core import BadDateFilter
from h.services.bulk_api.exceptions import BadDateFilter
from h.services.bulk_api.group import BulkGroup
from h.views.api.bulk.group import BulkGroupSchema, bulk_group

Expand Down

0 comments on commit 03b6f5c

Please sign in to comment.