66tubing changes, well state changes, and production/injection control changes.
77"""
88
9- from typing import Dict
9+ from typing import Any , Dict
1010from datetime import date , datetime
1111
1212from .pdmobject import add_method
1717)
1818
1919
20- def _format_date (event_date ) -> str :
20+ def _format_date (event_date : str | date | datetime ) -> str :
2121 """Convert date to ISO format string (YYYY-MM-DD)."""
2222 if isinstance (event_date , str ):
2323 return event_date
@@ -31,7 +31,7 @@ def _format_date(event_date) -> str:
3131 )
3232
3333
34- def parse_well_events_config (config_path : str ) -> Dict [str , Dict [str , dict ]]:
34+ def parse_well_events_config (config_path : str ) -> Dict [str , Dict [str , Any ]]:
3535 """Parse a YAML configuration file with well events.
3636
3737 The YAML format is organized by well name, then by date:
@@ -71,11 +71,11 @@ def parse_well_events_config(config_path: str) -> Dict[str, Dict[str, dict]]:
7171 with open (config_path , "r" ) as f :
7272 config = yaml .safe_load (f )
7373
74- return config
74+ return config or {}
7575
7676
7777def load_events_from_config (
78- project ,
78+ project : Any ,
7979 config_path : str ,
8080) -> None :
8181 """Load well events from a YAML configuration file.
@@ -177,12 +177,12 @@ def load_events_from_config(
177177
178178@add_method (WellEventTimeline )
179179def add_well_keyword_event_with_dict (
180- self ,
181- event_date ,
182- well_path ,
180+ self : WellEventTimeline ,
181+ event_date : str | date | datetime ,
182+ well_path : Any ,
183183 keyword_name : str ,
184- keyword_data : dict ,
185- ) -> " WellEventKeyword" :
184+ keyword_data : Dict [ str , Any ] ,
185+ ) -> WellEventKeyword :
186186 """Add a well keyword event with arbitrary keyword data.
187187
188188 This is a convenience method that automatically infers types from Python
@@ -301,11 +301,11 @@ def add_well_keyword_event_with_dict(
301301
302302
303303# Replace the add_well_keyword_event method with our enhanced version
304- WellEventTimeline .add_well_keyword_event = add_well_keyword_event_with_dict
304+ WellEventTimeline .add_well_keyword_event = add_well_keyword_event_with_dict # type: ignore[assignment]
305305
306306
307307@add_method (WellEventTimeline )
308- def generate_schedule_text (self , eclipse_case : Case ) -> str :
308+ def generate_schedule_text (self : WellEventTimeline , eclipse_case : Case ) -> str :
309309 """Generate Eclipse schedule text for all wells in the collection.
310310
311311 The timeline is shared across all wells in the well path collection.
0 commit comments