88import re
99from typing import Dict
1010
11- _TRAFO_CONNECTION_RE = re .compile (r"^(Y|YN|D|Z|ZN)(y|yn|d|z|zn)(\d|1[0-2])?$" )
11+ _TRAFO_CONNECTION_RE = re .compile (r"^(Y|YN|D|Z|ZN)(y|yn|d|z|zn)(-? \d|1[0-2]|- 1[0-2])?$" )
1212
1313
1414def parse_trafo_connection (string : str ) -> Dict [str , str ]:
@@ -17,11 +17,11 @@ def parse_trafo_connection(string: str) -> Dict[str, str]:
1717 Matches the following regular expression to the winding_from and winding_to codes.
1818 Optionally checks the clock number:
1919
20- ^ Start of the string
21- (Y|YN|D|Z|ZN) From winding type
22- (y|yn|d|z|zn) To winding type
23- (\d|1[0-2])? Optional clock number (0 -12)
24- $ End of the string
20+ ^ Start of the string
21+ (Y|YN|D|Z|ZN) From winding type
22+ (y|yn|d|z|zn) To winding type
23+ (-? \d|1[0-2]|-1[0-2] )? Optional clock number (-12 -12)
24+ $ End of the string
2525
2626 Args:
2727 string (str): The input string.
@@ -39,7 +39,9 @@ def parse_trafo_connection(string: str) -> Dict[str, str]:
3939 return {"winding_from" : match .group (1 ), "winding_to" : match .group (2 ), "clock" : match .group (3 )}
4040
4141
42- _TRAFO3_CONNECTION_RE = re .compile (r"^(Y|YN|D|Z|ZN)(y|yn|d|z|zn)(\d|1[0-2])?(y|yn|d|z|zn)(\d|1[0-2])?$" )
42+ _TRAFO3_CONNECTION_RE = re .compile (
43+ r"^(Y|YN|D|Z|ZN)(y|yn|d|z|zn)(-?\d|1[0-2]|-1[0-2])?(y|yn|d|z|zn)(-?\d|1[0-2]|-1[0-2])?$"
44+ )
4345
4446
4547def parse_trafo3_connection (string : str ) -> Dict [str , str ]:
@@ -48,13 +50,13 @@ def parse_trafo3_connection(string: str) -> Dict[str, str]:
4850 Matches the following regular expression to the winding_1, winding_2 and winding_3 codes.
4951 Optionally checks the clock numbers:
5052
51- ^ Start of the string
52- (Y|YN|D|Z|ZN) First winding type
53- (y|yn|d|z|zn) Second winding type
54- (\d|1[0-2]) Clock number (0 -12)
55- (y|yn|d|z|zn) Third winding type
56- (\d|1[0-2]) Clock number (0 -12)
57- $ End of the string
53+ ^ Start of the string
54+ (Y|YN|D|Z|ZN) First winding type
55+ (y|yn|d|z|zn) Second winding type
56+ (-? \d|1[0-2]|-1[0-2] ) Clock number (-12 -12)
57+ (y|yn|d|z|zn) Third winding type
58+ (-? \d|1[0-2]|-1[0-2] ) Clock number (-12 -12)
59+ $ End of the string
5860
5961 Args:
6062 string (str): The input string.
0 commit comments