|
2 | 2 | from sqlalchemy.sql import func |
3 | 3 | from sqlalchemy.orm import Session |
4 | 4 | from datetime import datetime |
| 5 | +from typing import cast |
5 | 6 | from .base import Base |
6 | 7 |
|
7 | 8 |
|
@@ -57,31 +58,31 @@ class Extended(Base): |
57 | 58 |
|
58 | 59 | def is_active(self) -> bool: |
59 | 60 | """Check if the contract is active""" |
60 | | - return self.status == "active" |
| 61 | + return cast(bool, self.status == "active") |
61 | 62 |
|
62 | 63 | def is_closed(self) -> bool: |
63 | 64 | """Check if the contract is closed""" |
64 | | - return self.status == "closed" |
| 65 | + return cast(bool, self.status == "closed") |
65 | 66 |
|
66 | 67 | def is_expired(self) -> bool: |
67 | 68 | """Check if the contract is expired""" |
68 | | - return self.status == "expired" |
| 69 | + return cast(bool, self.status == "expired") |
69 | 70 |
|
70 | 71 | def close_contract( |
71 | 72 | self, closure_txid: str = None, closure_timestamp: datetime = None, closure_height: int = None |
72 | 73 | ) -> None: |
73 | 74 | """Mark the contract as closed""" |
74 | | - self.status = "closed" |
| 75 | + self.status = "closed" # type: ignore[assignment] |
75 | 76 | if closure_txid: |
76 | | - self.closure_txid = closure_txid |
| 77 | + self.closure_txid = closure_txid # type: ignore[assignment] |
77 | 78 | if closure_timestamp: |
78 | | - self.closure_timestamp = closure_timestamp |
| 79 | + self.closure_timestamp = closure_timestamp # type: ignore[assignment] |
79 | 80 | if closure_height: |
80 | | - self.closure_height = closure_height |
| 81 | + self.closure_height = closure_height # type: ignore[assignment] |
81 | 82 |
|
82 | 83 | def expire_contract(self) -> None: |
83 | 84 | """Mark the contract as expired""" |
84 | | - self.status = "expired" |
| 85 | + self.status = "expired" # type: ignore[assignment] |
85 | 86 |
|
86 | 87 | @classmethod |
87 | 88 | def get_by_script_address(cls, session: Session, script_address: str): |
|
0 commit comments