|
7 | 7 | """
|
8 | 8 |
|
9 | 9 | from enum import IntEnum
|
10 |
| -from typing import Optional, Type |
| 10 | +from typing import Type |
11 | 11 |
|
12 | 12 | import numpy as np
|
13 | 13 |
|
@@ -45,11 +45,11 @@ class PowerGridModel:
|
45 | 45 | """
|
46 | 46 |
|
47 | 47 | _model_ptr: ModelPtr
|
48 |
| - _all_component_count: Optional[dict[ComponentType, int]] |
49 |
| - _batch_error: Optional[PowerGridBatchError] |
| 48 | + _all_component_count: dict[ComponentType, int] | None |
| 49 | + _batch_error: PowerGridBatchError | None |
50 | 50 |
|
51 | 51 | @property
|
52 |
| - def batch_error(self) -> Optional[PowerGridBatchError]: |
| 52 | + def batch_error(self) -> PowerGridBatchError | None: |
53 | 53 | """
|
54 | 54 | Get the batch error object, if present
|
55 | 55 |
|
@@ -242,7 +242,7 @@ def _calculate_impl( # pylint: disable=too-many-positional-arguments
|
242 | 242 | self,
|
243 | 243 | calculation_type: CalculationType,
|
244 | 244 | symmetric: bool,
|
245 |
| - update_data: Optional[Dataset], |
| 245 | + update_data: Dataset | None, |
246 | 246 | output_component_types: ComponentAttributeMapping,
|
247 | 247 | options: Options,
|
248 | 248 | continue_on_batch_error: bool,
|
@@ -310,7 +310,7 @@ def _calculate_power_flow(
|
310 | 310 | error_tolerance: float = 1e-8,
|
311 | 311 | max_iterations: int = 20,
|
312 | 312 | calculation_method: CalculationMethod | str = CalculationMethod.newton_raphson,
|
313 |
| - update_data: Optional[Dataset] = None, |
| 313 | + update_data: Dataset | None = None, |
314 | 314 | threading: int = -1,
|
315 | 315 | output_component_types: ComponentAttributeMapping = None,
|
316 | 316 | continue_on_batch_error: bool = False,
|
@@ -347,7 +347,7 @@ def _calculate_state_estimation(
|
347 | 347 | error_tolerance: float = 1e-8,
|
348 | 348 | max_iterations: int = 20,
|
349 | 349 | calculation_method: CalculationMethod | str = CalculationMethod.iterative_linear,
|
350 |
| - update_data: Optional[Dataset] = None, |
| 350 | + update_data: Dataset | None = None, |
351 | 351 | threading: int = -1,
|
352 | 352 | output_component_types: ComponentAttributeMapping = None,
|
353 | 353 | continue_on_batch_error: bool = False,
|
@@ -379,7 +379,7 @@ def _calculate_short_circuit(
|
379 | 379 | self,
|
380 | 380 | *,
|
381 | 381 | calculation_method: CalculationMethod | str = CalculationMethod.iec60909,
|
382 |
| - update_data: Optional[Dataset] = None, |
| 382 | + update_data: Dataset | None = None, |
383 | 383 | threading: int = -1,
|
384 | 384 | output_component_types: ComponentAttributeMapping = None,
|
385 | 385 | continue_on_batch_error: bool = False,
|
@@ -416,7 +416,7 @@ def calculate_power_flow(
|
416 | 416 | error_tolerance: float = 1e-8,
|
417 | 417 | max_iterations: int = 20,
|
418 | 418 | calculation_method: CalculationMethod | str = CalculationMethod.newton_raphson,
|
419 |
| - update_data: Optional[dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset] = None, |
| 419 | + update_data: dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset | None = None, |
420 | 420 | threading: int = -1,
|
421 | 421 | output_component_types: ComponentAttributeMapping = None,
|
422 | 422 | continue_on_batch_error: bool = False,
|
@@ -514,7 +514,7 @@ def calculate_state_estimation(
|
514 | 514 | error_tolerance: float = 1e-8,
|
515 | 515 | max_iterations: int = 20,
|
516 | 516 | calculation_method: CalculationMethod | str = CalculationMethod.iterative_linear,
|
517 |
| - update_data: Optional[dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset] = None, |
| 517 | + update_data: dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset | None = None, |
518 | 518 | threading: int = -1,
|
519 | 519 | output_component_types: ComponentAttributeMapping = None,
|
520 | 520 | continue_on_batch_error: bool = False,
|
@@ -604,7 +604,7 @@ def calculate_short_circuit(
|
604 | 604 | self,
|
605 | 605 | *,
|
606 | 606 | calculation_method: CalculationMethod | str = CalculationMethod.iec60909,
|
607 |
| - update_data: Optional[dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset] = None, |
| 607 | + update_data: dict[str, np.ndarray | dict[str, np.ndarray]] | Dataset | None = None, |
608 | 608 | threading: int = -1,
|
609 | 609 | output_component_types: ComponentAttributeMapping = None,
|
610 | 610 | continue_on_batch_error: bool = False,
|
|
0 commit comments