@@ -70,22 +70,22 @@ def validate_mac_address(value: bytes) -> str:
7070 """
7171 if len (value ) < 14 :
7272 raise PydanticCustomError (
73- " mac_address_len" ,
74- " Length for a {mac_address} MAC address must be {required_length}" ,
75- {" mac_address" : value .decode (), " required_length" : 14 },
73+ ' mac_address_len' ,
74+ ' Length for a {mac_address} MAC address must be {required_length}' ,
75+ {' mac_address' : value .decode (), ' required_length' : 14 },
7676 )
7777
78- if value [2 ] in [ord (":" ), ord ("-" )]:
78+ if value [2 ] in [ord (':' ), ord ('-' )]:
7979 if (len (value ) + 1 ) % 3 != 0 :
8080 raise PydanticCustomError (
81- " mac_address_format" , " Must have the format xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx"
81+ ' mac_address_format' , ' Must have the format xx:xx:xx:xx:xx:xx or xx-xx-xx-xx-xx-xx'
8282 )
8383 n = (len (value ) + 1 ) // 3
8484 if n not in (6 , 8 , 20 ):
8585 raise PydanticCustomError (
86- " mac_address_format" ,
87- " Length for a {mac_address} MAC address must be {required_length}" ,
88- {" mac_address" : value .decode (), " required_length" : (6 , 8 , 20 )},
86+ ' mac_address_format' ,
87+ ' Length for a {mac_address} MAC address must be {required_length}' ,
88+ {' mac_address' : value .decode (), ' required_length' : (6 , 8 , 20 )},
8989 )
9090 mac_address = bytearray (n )
9191 x = 0
@@ -95,17 +95,17 @@ def validate_mac_address(value: bytes) -> str:
9595 mac_address [i ] = byte_value
9696 x += 3
9797 except ValueError as e :
98- raise PydanticCustomError (" mac_address_format" , " Unrecognized format" ) from e
98+ raise PydanticCustomError (' mac_address_format' , ' Unrecognized format' ) from e
9999
100- elif value [4 ] == ord ("." ):
100+ elif value [4 ] == ord ('.' ):
101101 if (len (value ) + 1 ) % 5 != 0 :
102- raise PydanticCustomError (" mac_address_format" , " Must have the format xx.xx.xx.xx.xx.xx" )
102+ raise PydanticCustomError (' mac_address_format' , ' Must have the format xx.xx.xx.xx.xx.xx' )
103103 n = 2 * (len (value ) + 1 ) // 5
104104 if n not in (6 , 8 , 20 ):
105105 raise PydanticCustomError (
106- " mac_address_format" ,
107- " Length for a {mac_address} MAC address must be {required_length}" ,
108- {" mac_address" : value .decode (), " required_length" : (6 , 8 , 20 )},
106+ ' mac_address_format' ,
107+ ' Length for a {mac_address} MAC address must be {required_length}' ,
108+ {' mac_address' : value .decode (), ' required_length' : (6 , 8 , 20 )},
109109 )
110110 mac_address = bytearray (n )
111111 x = 0
@@ -117,9 +117,9 @@ def validate_mac_address(value: bytes) -> str:
117117 mac_address [i + 1 ] = byte_value
118118 x += 5
119119 except ValueError as e :
120- raise PydanticCustomError (" mac_address_format" , " Unrecognized format" ) from e
120+ raise PydanticCustomError (' mac_address_format' , ' Unrecognized format' ) from e
121121
122122 else :
123- raise PydanticCustomError (" mac_address_format" , " Unrecognized format" )
123+ raise PydanticCustomError (' mac_address_format' , ' Unrecognized format' )
124124
125- return ":" .join (f" { b :02x} " for b in mac_address )
125+ return ':' .join (f' { b :02x} ' for b in mac_address )
0 commit comments