44from __future__ import annotations
55
66import re
7- from typing import TYPE_CHECKING , Any , Dict , Optional , Union
7+ from typing import TYPE_CHECKING , Any
88
99if TYPE_CHECKING :
1010 import pandas as pd
@@ -142,9 +142,9 @@ class stage:
142142
143143 def __init__ (
144144 self ,
145- start : Optional [ str ] = None ,
146- after_stat : Optional [ str ] = None ,
147- after_scale : Optional [ str ] = None
145+ start : str | None = None ,
146+ after_stat : str | None = None ,
147+ after_scale : str | None = None
148148 ) -> None :
149149 self .start = start
150150 self .after_stat = after_stat
@@ -162,7 +162,7 @@ def __repr__(self) -> str:
162162
163163
164164# Type alias for aesthetic values
165- AesValue = Union [ str , after_stat , after_scale , stage , float , int , None ]
165+ AesValue = str | after_stat | after_scale | stage | float | int | None
166166
167167
168168class aes :
@@ -198,21 +198,21 @@ class aes:
198198
199199 def __init__ (
200200 self ,
201- x : Optional [ AesValue ] = None ,
202- y : Optional [ AesValue ] = None ,
203- z : Optional [ AesValue ] = None ,
204- color : Optional [ AesValue ] = None ,
205- colour : Optional [ AesValue ] = None ,
206- fill : Optional [ AesValue ] = None ,
207- size : Optional [ AesValue ] = None ,
208- shape : Optional [ AesValue ] = None ,
209- alpha : Optional [ AesValue ] = None ,
210- linetype : Optional [ AesValue ] = None ,
211- label : Optional [ AesValue ] = None ,
212- group : Optional [ str ] = None ,
201+ x : AesValue = None ,
202+ y : AesValue = None ,
203+ z : AesValue = None ,
204+ color : AesValue = None ,
205+ colour : AesValue = None ,
206+ fill : AesValue = None ,
207+ size : AesValue = None ,
208+ shape : AesValue = None ,
209+ alpha : AesValue = None ,
210+ linetype : AesValue = None ,
211+ label : AesValue = None ,
212+ group : str | None = None ,
213213 ** kwargs : Any
214214 ) -> None :
215- self .mapping : Dict [str , Any ] = {}
215+ self .mapping : dict [str , Any ] = {}
216216
217217 # Handle standard aesthetics
218218 if x is not None :
@@ -277,7 +277,7 @@ def copy(self) -> aes:
277277 new_aes .mapping = self .mapping .copy ()
278278 return new_aes
279279
280- def update (self , other : Union [ aes , Dict [str , Any ] ]) -> None :
280+ def update (self , other : aes | dict [str , Any ]) -> None :
281281 """Update mappings from another aes or dict."""
282282 if isinstance (other , aes ):
283283 self .mapping .update (other .mapping )
0 commit comments