Skip to content

Commit

Permalink
Correct comments, remove use of TypeVar
Browse files Browse the repository at this point in the history
  • Loading branch information
portante committed Jan 6, 2023
1 parent 511cf82 commit aa29a8d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions lib/pbench/server/database/models/active_token.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from datetime import datetime
from typing import TypeVar

from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.orm import relationship

from pbench.server.database.database import Database

AT = TypeVar("AT", bound="ActiveToken")


class ActiveToken(Database.Base):
"""Token model for storing the active auth tokens.
Expand All @@ -16,7 +13,7 @@ class ActiveToken(Database.Base):
expiration time.
"""

# Table name is plural so it looks better SQL statements.
# Table name is plural so it looks better in SQL statements.
__tablename__ = "active_tokens"
id = Column(Integer, primary_key=True, autoincrement=True)
token = Column(String(500), unique=True, nullable=False, index=True)
Expand All @@ -34,7 +31,7 @@ def __init__(self, token: str, expiration: datetime):
self.expiration = expiration

@staticmethod
def query(token: str) -> AT:
def query(token: str) -> "ActiveToken":
# We currently only query token database for a specific token.
token_model = (
Database.db_session.query(ActiveToken).filter_by(token=token).first()
Expand Down
4 changes: 2 additions & 2 deletions lib/pbench/server/database/models/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class Dataset(Database.Base):
transition The timestamp of the last state transition
"""

# Table name is plural so it looks better SQL statements.
# Table name is plural so it looks better in SQL statements.
__tablename__ = "datasets"

# This dict defines the allowed dataset state transitions through its
Expand Down Expand Up @@ -695,7 +695,7 @@ class Metadata(Database.Base):
value Metadata value string
"""

# Table name is plural so it looks better SQL statements.
# Table name is plural so it looks better in SQL statements.
__tablename__ = "datasets_metadata"

# +++ Standard Metadata keys:
Expand Down
2 changes: 1 addition & 1 deletion lib/pbench/server/database/models/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Template(Database.Base):
version The template version metadata
"""

# Table name is plural so it looks better SQL statements.
# Table name is plural so it looks better in SQL statements.
__tablename__ = "templates"

id = Column(Integer, primary_key=True, autoincrement=True)
Expand Down
2 changes: 1 addition & 1 deletion lib/pbench/server/database/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Roles(enum.Enum):
class User(Database.Base):
"""User Model for storing user related details"""

# Table name is plural so it looks better SQL statements.
# Table name is plural so it looks better in SQL statements.
__tablename__ = "users"

id = Column(Integer, primary_key=True, autoincrement=True)
Expand Down

0 comments on commit aa29a8d

Please sign in to comment.