Coverage for backend/pgraph_factory/types.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from typing import Literal, TypedDict 

2from typing_extensions import Required 

3 

4class BlockSchema(TypedDict): 

5 "Represents a singular block in a p-graph flowsheet" 

6 id : Required[int] 

7 type: Required[Literal["unit", "stream", "decisionNode"]] 

8 name : Required[str] 

9 

10ConnectionSchema = list[int] 

11 

12 

13class PgraphDetails(TypedDict): 

14 """ 

15 Represents the schema required on a JSON object to a flowsheet used for pgraph solving.  

16 """ 

17 # list of object and block data. Object takes id and name. Connections takes id of connected blocks 

18 blocks: Required[list[BlockSchema]] 

19 connections: Required[list[ConnectionSchema]] 

20