diff --git a/wp1/models/wp10/category.py b/wp1/models/wp10/category.py index 8ad570d8f..f07b5fedc 100644 --- a/wp1/models/wp10/category.py +++ b/wp1/models/wp10/category.py @@ -1,13 +1,14 @@ import attr +from typing import Optional @attr.s class Category: table_name = "categories" - c_project = attr.ib() - c_type = attr.ib() - c_rating = attr.ib() - c_replacement = attr.ib(default=None) - c_category = attr.ib(default=None) - c_ranking = attr.ib(default=None) + c_project: bytes = attr.ib() + c_type: bytes = attr.ib() + c_rating: bytes = attr.ib() + c_replacement: Optional[bytes] = attr.ib(default=None) + c_category: Optional[bytes] = attr.ib(default=None) + c_ranking: Optional[int] = attr.ib(default=None) diff --git a/wp1/models/wp10/namespace.py b/wp1/models/wp10/namespace.py index 4ac9e44e6..aabb91833 100644 --- a/wp1/models/wp10/namespace.py +++ b/wp1/models/wp10/namespace.py @@ -1,5 +1,5 @@ import enum - +from typing import Optional import attr @@ -13,8 +13,8 @@ class NsType(enum.Enum): class Namespace: table_name = "namespacename" - domain = attr.ib() - ns_name = attr.ib() - ns_type = attr.ib() - ns_id = attr.ib(default=None) - dbname = attr.ib(default=None) + domain: bytes = attr.ib() + ns_name: bytes = attr.ib() + ns_type: NsType = attr.ib() + ns_id: Optional[int] = attr.ib(default=None) + dbname: Optional[bytes] = attr.ib(default=None) diff --git a/wp1/models/wp10/release.py b/wp1/models/wp10/release.py index f584c1107..183ed13c4 100644 --- a/wp1/models/wp10/release.py +++ b/wp1/models/wp10/release.py @@ -5,6 +5,6 @@ class Release: table_name = "releases" - rel_article = attr.ib() - rel_0p5_category = attr.ib() - rel_0p5_timestamp = attr.ib() + rel_article: bytes = attr.ib() + rel_0p5_category: bytes = attr.ib() + rel_0p5_timestamp: bytes = attr.ib() diff --git a/wp1/models/wp10/review.py b/wp1/models/wp10/review.py index 56b964b63..7b8c17b53 100644 --- a/wp1/models/wp10/review.py +++ b/wp1/models/wp10/review.py @@ -1,5 +1,6 @@ from sqlalchemy import Column from sqlalchemy.dialects.mysql import BINARY +from typing import Optional from wp1.wp10_db import Base @@ -7,11 +8,11 @@ class Review(Base): __tablename__ = "reviews" - value = Column("rev_value", BINARY(10)) - article = Column("rev_article", BINARY(255), primary_key=True) - timestamp = Column("rev_timestamp", BINARY(20)) + value: Optional[bytes] = Column("rev_value", BINARY(10)) + article: bytes = Column("rev_article", BINARY(255), primary_key=True) + timestamp: Optional[bytes] = Column("rev_timestamp", BINARY(20)) - def __repr__(self): + def __repr__(self) -> str: return "" % ( self.value, self.article,