Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`protocols`.`amp`.`Decimal``

class documentation

`class Decimal(Argument): (source)`

Constructor: `Decimal(optional)`

View In Hierarchy

Encodes `decimal.Decimal` instances.

There are several ways in which a decimal value might be encoded.

Special values are encoded as special strings:

      - Positive infinity is encoded as C{"Infinity"}
      - Negative infinity is encoded as C{"-Infinity"}
      - Quiet not-a-number is encoded as either C{"NaN"} or C{"-NaN"}
      - Signalling not-a-number is encoded as either C{"sNaN"} or C{"-sNaN"}

Normal values are encoded using the base ten string representation, using engineering notation to indicate magnitude without precision, and "normal" digits to indicate precision. For example:

      - C{"1"} represents the value I{1} with precision to one place.
      - C{"-1"} represents the value I{-1} with precision to one place.
      - C{"1.0"} represents the value I{1} with precision to two places.
      - C{"10"} represents the value I{10} with precision to two places.
      - C{"1E+2"} represents the value I{10} with precision to one place.
      - C{"1E-1"} represents the value I{0.1} with precision to one place.
      - C{"1.5E+2"} represents the value I{15} with precision to two places.

http://speleotrove.com/decimal/ should be considered the authoritative specification for the format.

Method | `fromString` | Convert a string to a Python object. Subclasses must implement this.
Method | `toString` | Serialize a `decimal.Decimal` instance to the specified wire format.

Inherited from `Argument`:

Method | `__init__` | Create an Argument.
Method | `fromBox` | Populate an 'out' dictionary with mapping names to Python values decoded from an 'in' AmpBox mapping strings to string values.
Method | `fromStringProto` | Convert a string to a Python value.
Method | `retrieve` | Retrieve the given key from the given dictionary, removing it if found.
Method | `toBox` | Populate an 'out' AmpBox with strings encoded from an 'in' dictionary mapping names to Python values.
Method | `toStringProto` | Convert a Python object to a string.
Instance Variable | `optional` | Undocumented

def fromString(self, inString): (source)
overrides `twisted.protocols.amp.Argument.fromString`

Convert a string to a Python object. Subclasses must implement this.

Parameters
inString:`bytes` | the string to convert.
Returns
the decoded value from `inString`

def toString(self, inObject): (source)
overrides `twisted.protocols.amp.Argument.toString`

Serialize a `decimal.Decimal` instance to the specified wire format.