Create |ASN.1| schema or value object. |ASN.1| class is based on :class:`~pyasn1.type.base.SimpleAsn1Type`, its objects are immutable and duck-type Python :class:`int` objects. Keyword Args ------------ value: :class:`int`, :class:`str` or |ASN.1| object Python :class:`
| 260 | |
| 261 | |
| 262 | class Boolean(Integer): |
| 263 | """Create |ASN.1| schema or value object. |
| 264 | |
| 265 | |ASN.1| class is based on :class:`~pyasn1.type.base.SimpleAsn1Type`, its |
| 266 | objects are immutable and duck-type Python :class:`int` objects. |
| 267 | |
| 268 | Keyword Args |
| 269 | ------------ |
| 270 | value: :class:`int`, :class:`str` or |ASN.1| object |
| 271 | Python :class:`int` or :class:`str` literal or |ASN.1| class |
| 272 | instance. If `value` is not given, schema object will be created. |
| 273 | |
| 274 | tagSet: :py:class:`~pyasn1.type.tag.TagSet` |
| 275 | Object representing non-default ASN.1 tag(s) |
| 276 | |
| 277 | subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection` |
| 278 | Object representing non-default ASN.1 subtype constraint(s).Constraints |
| 279 | verification for |ASN.1| type occurs automatically on object |
| 280 | instantiation. |
| 281 | |
| 282 | namedValues: :py:class:`~pyasn1.type.namedval.NamedValues` |
| 283 | Object representing non-default symbolic aliases for numbers |
| 284 | |
| 285 | Raises |
| 286 | ------ |
| 287 | ~pyasn1.error.ValueConstraintError, ~pyasn1.error.PyAsn1Error |
| 288 | On constraint violation or bad initializer. |
| 289 | |
| 290 | Examples |
| 291 | -------- |
| 292 | .. code-block:: python |
| 293 | |
| 294 | class RoundResult(Boolean): |
| 295 | ''' |
| 296 | ASN.1 specification: |
| 297 | |
| 298 | RoundResult ::= BOOLEAN |
| 299 | |
| 300 | ok RoundResult ::= TRUE |
| 301 | ko RoundResult ::= FALSE |
| 302 | ''' |
| 303 | ok = RoundResult(True) |
| 304 | ko = RoundResult(False) |
| 305 | """ |
| 306 | #: Set (on class, not on instance) or return a |
| 307 | #: :py:class:`~pyasn1.type.tag.TagSet` object representing ASN.1 tag(s) |
| 308 | #: associated with |ASN.1| type. |
| 309 | tagSet = tag.initTagSet( |
| 310 | tag.Tag(tag.tagClassUniversal, tag.tagFormatSimple, 0x01), |
| 311 | ) |
| 312 | |
| 313 | #: Set (on class, not on instance) or return a |
| 314 | #: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection` object |
| 315 | #: imposing constraints on |ASN.1| type initialization values. |
| 316 | subtypeSpec = Integer.subtypeSpec + constraint.SingleValueConstraint(0, 1) |
| 317 | |
| 318 | #: Default :py:class:`~pyasn1.type.namedval.NamedValues` object |
| 319 | #: representing symbolic aliases for numbers |
no test coverage detected