diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-21 13:36:53 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-21 13:36:53 -0700 |
commit | 5d82e3b35a8fb2d4c25f282cddad557a7650197c (patch) | |
tree | d3d95911e4c01ee2faa169820089cd029d956c26 /ipalib | |
parent | 0c95e86cf328a443cbe8559c175f022fd93ce212 (diff) | |
download | freeipa-5d82e3b35a8fb2d4c25f282cddad557a7650197c.tar.gz freeipa-5d82e3b35a8fb2d4c25f282cddad557a7650197c.tar.xz freeipa-5d82e3b35a8fb2d4c25f282cddad557a7650197c.zip |
Changed ipauuid.py docstring slightly so epydoc formats it correctly
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/ipauuid.py | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/ipalib/ipauuid.py b/ipalib/ipauuid.py index dde7f8ae3..9923dc7a9 100644 --- a/ipalib/ipauuid.py +++ b/ipalib/ipauuid.py @@ -1,3 +1,5 @@ +# This is a backport of the Python2.5 uuid module. + r"""UUID objects (universally unique identifiers) according to RFC 4122. This module provides immutable UUID objects (class UUID) and the functions @@ -10,36 +12,49 @@ the computer's network address. uuid4() creates a random UUID. Typical usage: + **Important:** So that the freeIPA Python 2.4 ``uuid`` backport can be + automatically loaded when needed, import the ``uuid`` module like this: + >>> from ipalib import uuid - # make a UUID based on the host ID and current time + Make a UUID based on the host ID and current time: + >>> uuid.uuid1() #doctest: +ELLIPSIS UUID('...') - # make a UUID using an MD5 hash of a namespace UUID and a name + Make a UUID using an MD5 hash of a namespace UUID and a name: + >>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org') UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e') - # make a random UUID + Make a random UUID: + >>> uuid.uuid4() #doctest: +ELLIPSIS UUID('...') - # make a UUID using a SHA-1 hash of a namespace UUID and a name + Make a UUID using a SHA-1 hash of a namespace UUID and a name: + >>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org') UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d') - # make a UUID from a string of hex digits (braces and hyphens ignored) + Make a UUID from a string of hex digits (braces and hyphens ignored): + >>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}') + >>> x + UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') + + Convert a UUID to a string of hex digits in standard form: - # convert a UUID to a string of hex digits in standard form >>> str(x) '00010203-0405-0607-0809-0a0b0c0d0e0f' - # get the raw 16 bytes of the UUID + Get the raw 16 bytes of the UUID: + >>> x.bytes '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f' - # make a UUID from a 16-byte string + Make a UUID from a 16-byte string: + >>> uuid.UUID(bytes=x.bytes) UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') """ |