@@ -127,23 +127,29 @@ class Alias:
127127 Examples
128128 --------
129129 >>> par = Alias((3.0, 3.0), prefix="+o", separator="/")
130- >>> par.value
130+ >>> par._value
131131 '+o3.0/3.0'
132132
133133 >>> par = Alias(["xaf", "yaf", "WSen"])
134- >>> par.value
134+ >>> par._value
135135 ['xaf', 'yaf', 'WSen']
136136 """
137137
138- def __init__ (
139- self ,
140- value : Any ,
141- prefix : str = "" ,
142- separator : Literal ["/" , "," ] | None = None ,
143- mapping : bool | Mapping = False ,
144- ):
145- self .value = to_string (
146- value = value , prefix = prefix , separator = separator , mapping = mapping
138+ value : Any
139+ prefix : str = ""
140+ separator : Literal ["/" , "," ] | None = None
141+ mapping : bool | Mapping = False
142+
143+ @property
144+ def _value (self ) -> str | Sequence [str ] | None :
145+ """
146+ The value of the alias as a string, a sequence of strings or None.
147+ """
148+ return to_string (
149+ value = self .value ,
150+ prefix = self .prefix ,
151+ separator = self .separator ,
152+ mapping = self .mapping ,
147153 )
148154
149155
@@ -221,13 +227,13 @@ def kwdict(self):
221227 for option , aliases in self .options .items ():
222228 for alias in aliases :
223229 # value can be a string, a sequence of strings or None.
224- if alias .value is None :
230+ if alias ._value is None :
225231 continue
226232 # Special handing of repeatable parameter like -B/frame.
227- if is_nonstr_iter (alias .value ):
228- kwdict [option ] = alias .value
233+ if is_nonstr_iter (alias ._value ):
234+ kwdict [option ] = alias ._value
229235 # A repeatable option should have only one alias, so break.
230236 break
231237
232- kwdict [option ] += alias .value
238+ kwdict [option ] += alias ._value
233239 return kwdict
0 commit comments