Return a mapping attribute: the optional value_type defines the type of values it stores. The key is always a string. Notes: in Python 2 the type is Dict as there is no typing available for dict for now.
(
value_type=typing.Any,
default=attr.NOTHING,
validator=None,
repr=False,
eq=True,
order=True, # NOQA
converter=None,
help=None,
label=None,
)
| 225 | |
| 226 | |
| 227 | def Mapping( |
| 228 | value_type=typing.Any, |
| 229 | default=attr.NOTHING, |
| 230 | validator=None, |
| 231 | repr=False, |
| 232 | eq=True, |
| 233 | order=True, # NOQA |
| 234 | converter=None, |
| 235 | help=None, |
| 236 | label=None, |
| 237 | ): # NOQA |
| 238 | """ |
| 239 | Return a mapping attribute: the optional value_type defines the type of values it |
| 240 | stores. The key is always a string. |
| 241 | |
| 242 | Notes: in Python 2 the type is Dict as there is no typing available for |
| 243 | dict for now. |
| 244 | """ |
| 245 | if default is attr.NOTHING: |
| 246 | default = attr.Factory(dict) |
| 247 | |
| 248 | return attribute( |
| 249 | default=default, |
| 250 | validator=validator, |
| 251 | repr=repr, |
| 252 | eq=eq, |
| 253 | order=order, |
| 254 | init=True, |
| 255 | type=typing.Dict[str, value_type], |
| 256 | converter=converter, |
| 257 | help=help, |
| 258 | label=label, |
| 259 | ) |
| 260 | |
| 261 | |
| 262 | ################################################## |
no test coverage detected