-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mypy is happy, and it runsmypy src/lsst/cmservice/
- Loading branch information
Showing
24 changed files
with
108 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
from .element import ElementBase, ElementCreateMixin, ElementMixin | ||
from .element import ElementCreateMixin, ElementMixin | ||
|
||
|
||
class CampaignBase(ElementBase): | ||
class CampaignCreate(ElementCreateMixin): | ||
pass | ||
|
||
|
||
class CampaignCreate(CampaignBase, ElementCreateMixin): | ||
class Campaign(ElementMixin): | ||
pass | ||
|
||
|
||
class Campaign(CampaignBase, ElementMixin): | ||
pass | ||
class Config: | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ class Dependency(DependencyBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
from .element import ElementBase, ElementCreateMixin, ElementMixin | ||
from .element import ElementCreateMixin, ElementMixin | ||
|
||
|
||
class GroupBase(ElementBase): | ||
class GroupCreate(ElementCreateMixin): | ||
pass | ||
|
||
|
||
class GroupCreate(GroupBase, ElementCreateMixin): | ||
pass | ||
|
||
|
||
class Group(GroupBase, ElementMixin): | ||
class Group(ElementMixin): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ class PipetaskError(PipetaskErrorBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ class PipetaskErrorType(PipetaskErrorTypeBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ class ProductSet(ProductSetBase): | |
n_missing: int = 0 | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ class Production(ProductionBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ class Queue(QueueBase): | |
time_finished: datetime | None | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ class RowData(BaseModel): | |
data: dict | ||
|
||
class Config: | ||
from_attributes = False | ||
orm_mode = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ class Script(ScriptBase): | |
superseded: bool = False | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ class ScriptError(ScriptErrorBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ class ScriptTemplate(ScriptTemplateBase): | |
fullname: str | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
from .element import ElementBase, ElementCreateMixin, ElementMixin | ||
from .element import ElementCreateMixin, ElementMixin | ||
|
||
|
||
class StepBase(ElementBase): | ||
class StepCreate(ElementCreateMixin): | ||
pass | ||
|
||
|
||
class StepCreate(StepBase, ElementCreateMixin): | ||
pass | ||
|
||
|
||
class Step(StepBase, ElementMixin): | ||
class Step(ElementMixin): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ class TaskSet(TaskSetBase): | |
n_failed_upstream: int = 0 | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ class WmsTaskReport(WmsTaskReportBase): | |
id: int | ||
|
||
class Config: | ||
from_attributes = True | ||
orm_mode = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from typing import Sequence | ||
|
||
from fastapi import APIRouter, Depends | ||
from safir.dependencies.db_session import db_session_dependency | ||
from sqlalchemy.ext.asyncio import async_scoped_session | ||
|
||
from .. import db, models | ||
|
||
response_model_class = models.ScriptTemplate | ||
create_model_class = models.ScriptTemplateCreate | ||
db_class = db.ScriptTemplate | ||
class_string = "script_template" | ||
tag_string = "ScriptTemplates" | ||
|
||
|
||
router = APIRouter( | ||
prefix=f"/{class_string}s", | ||
tags=[tag_string], | ||
) | ||
|
||
|
||
@router.get( | ||
"", | ||
response_model=list[response_model_class], | ||
summary=f"List {class_string}s", | ||
) | ||
async def get_rows( | ||
parent_id: int | None = None, | ||
parent_name: str | None = None, | ||
skip: int = 0, | ||
limit: int = 100, | ||
session: async_scoped_session = Depends(db_session_dependency), | ||
) -> Sequence[db_class]: | ||
result = await db_class.get_rows( | ||
session, | ||
parent_id=parent_id, | ||
skip=skip, | ||
limit=limit, | ||
parent_name=parent_name, | ||
parent_class=db.Specification, | ||
) | ||
return result | ||
|
||
|
||
@router.get( | ||
"/{row_id}", | ||
response_model=response_model_class, | ||
summary=f"Retrieve a {class_string}", | ||
) | ||
async def get_row( | ||
row_id: int, | ||
session: async_scoped_session = Depends(db_session_dependency), | ||
) -> db_class: | ||
result = await db_class.get_row(session, row_id) | ||
assert isinstance(result, db_class) | ||
return result |