Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions wp1/models/wp10/category.py
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 6 additions & 6 deletions wp1/models/wp10/namespace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import enum

from typing import Optional
import attr


Expand All @@ -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)
6 changes: 3 additions & 3 deletions wp1/models/wp10/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
9 changes: 5 additions & 4 deletions wp1/models/wp10/review.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from sqlalchemy import Column
from sqlalchemy.dialects.mysql import BINARY
from typing import Optional

from wp1.wp10_db import Base


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 "<Review(value=%r, article=%r, timestamp=%r)>" % (
self.value,
self.article,
Expand Down