Skip to content

Commit

Permalink
fix: pydantic validation of None in enums
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueg committed Jun 1, 2022
1 parent 7392f65 commit b1b4e54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions htsinfer/get_read_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ def process_paired( # pylint: disable=R0912,R0915
if reads >= self.min_mapped_reads:
if fraction_most_common_state > self.min_fraction:
orientation.relationship = most_common_state
assert orientation.relationship is not None
if orientation.relationship.value[-2:] == "SF":
orientation.file_1 = StatesOrientation("SF")
orientation.file_2 = StatesOrientation("SR")
Expand Down
12 changes: 6 additions & 6 deletions htsinfer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ class ResultsType(BaseModel):
file_2: Library type of the second file.
relationship: Type/mate relationship between the provided files.
"""
file_1: StatesType = StatesType.not_available
file_2: StatesType = StatesType.not_available
relationship: StatesTypeRelationship = (
file_1: Optional[StatesType] = StatesType.not_available
file_2: Optional[StatesType] = StatesType.not_available
relationship: Optional[StatesTypeRelationship] = (
StatesTypeRelationship.not_available
)

Expand Down Expand Up @@ -270,9 +270,9 @@ class ResultsOrientation(BaseModel):
file_1: Read orientation of first file.
file_2: Read orientation of second file.
"""
file_1: StatesOrientation = StatesOrientation.not_available
file_2: StatesOrientation = StatesOrientation.not_available
relationship: StatesOrientationRelationship = (
file_1: Optional[StatesOrientation] = StatesOrientation.not_available
file_2: Optional[StatesOrientation] = StatesOrientation.not_available
relationship: Optional[StatesOrientationRelationship] = (
StatesOrientationRelationship.not_available
)

Expand Down

0 comments on commit b1b4e54

Please sign in to comment.