Skip to content

Commit

Permalink
replace typing.Any by typing.Union (wrong usage)
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenMeinecke committed Nov 13, 2024
1 parent 804d23f commit 48739fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pandapower/converter/jao/from_jao.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import json
from functools import reduce
from typing import Optional, Any
from typing import Optional, Union
import numpy as np
import pandas as pd
from pandas.api.types import is_integer_dtype, is_object_dtype
Expand All @@ -31,7 +31,7 @@ def from_jao(excel_file_path:str,
extend_data_for_grid_group_connections: bool,
drop_grid_groups_islands: bool = False,
apply_data_correction: bool = True,
max_i_ka_fillna:Any[float,int]=999,
max_i_ka_fillna:Union[float,int]=999,
**kwargs) -> pandapowerNet:
"""Converts European (Core) EHV grid data provided by JAO (Joint Allocation Office), the
"Single Allocation Platform (SAP) for all European Transmission System Operators (TSOs) that
Expand Down Expand Up @@ -91,7 +91,7 @@ def from_jao(excel_file_path:str,
minimal_trafo_invention). If False, all equally named buses that have different voltage
level and lay in different groups will be connected via additional transformers,
by default False
min_bus_number : Any[int,str], optional
min_bus_number : Union[int,str], optional
Threshold value to decide which small grid groups should be dropped and which large grid
groups should be kept. If all islanded grid groups should be dropped except of the one
largest, set "max". If all grid groups that do not contain a slack element should be
Expand Down Expand Up @@ -165,7 +165,7 @@ def from_jao(excel_file_path:str,
def _data_correction(
data:dict[str, pd.DataFrame],
html_str:Optional[str],
max_i_ka_fillna:Any[float,int]) -> Optional[str]:
max_i_ka_fillna:Union[float,int]) -> Optional[str]:
"""Corrects input data in particular with regard to obvious weaknesses in the data provided,
such as inconsistent spellings and missing necessary information
Expand Down Expand Up @@ -330,7 +330,7 @@ def _create_buses_from_line_data(net:pandapowerNet, data:dict[str, pd.DataFrame]
def _create_lines(
net:pandapowerNet,
data:dict[str, pd.DataFrame],
max_i_ka_fillna:Any[float,int]) -> None:
max_i_ka_fillna:Union[float,int]) -> None:
"""Creates lines to the pandapower net using information from the lines and tielines sheets
(excel file).
Expand Down Expand Up @@ -558,7 +558,7 @@ def _invent_connections_between_grid_groups(
f"\n'{name1}' and '{name2}'")


def drop_islanded_grid_groups(net:pandapowerNet, min_bus_number:Any[int,str], **kwargs) -> None:
def drop_islanded_grid_groups(net:pandapowerNet, min_bus_number:Union[int,str], **kwargs) -> None:
"""Drops grid groups that are islanded and include a number of buses below min_bus_number.
Parameters
Expand Down Expand Up @@ -970,7 +970,7 @@ def _lng_lat_to_df(dict_:dict, line_EIC:str, line_name:str) -> pd.DataFrame:

def _fill_geo_at_one_sided_branches_without_geo_extent(net:pandapowerNet):

def _check_geo_availablitiy(net:pandapowerNet) -> dict[str, Any[pd.Index,int]]:
def _check_geo_availablitiy(net:pandapowerNet) -> dict[str, Union[pd.Index,int]]:
av = dict() # availablitiy of geodata
av["bus_with_geo"] = net.bus.index[~net.bus.geo.isnull()]
av["lines_fbw_tbwo"] = net.line.index[net.line.from_bus.isin(av["bus_with_geo"]) &
Expand Down

0 comments on commit 48739fa

Please sign in to comment.