diff options
author | Gordon Chung <chungg@ca.ibm.com> | 2014-03-10 16:28:21 -0400 |
---|---|---|
committer | Gordon Chung <chungg@ca.ibm.com> | 2014-03-10 17:18:30 -0400 |
commit | 3d587491e7f2bfe9bd9bc8a2b19ebc4946b963e5 (patch) | |
tree | eaf7d814e8c295f571ad23d3a813ea7c72e5d963 /pycadf/identifier.py | |
parent | a93e2ae4d6a3412c79ddfdea5b4cfe6d7ec28d3b (diff) | |
download | pycadf-3d587491e7f2bfe9bd9bc8a2b19ebc4946b963e5.tar.gz |
add docstrings to functions
add docstrings to functions
Change-Id: I112e297d20de5026784298e93b6ff05733639a1c
Implements: blueprint document-pycadf
Diffstat (limited to 'pycadf/identifier.py')
-rw-r--r-- | pycadf/identifier.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pycadf/identifier.py b/pycadf/identifier.py index 7b76708..28713dc 100644 --- a/pycadf/identifier.py +++ b/pycadf/identifier.py @@ -34,10 +34,14 @@ CONF.register_opts(opts, group='audit') # a full openstack namespace/domain value via some declaration (e.g. # "openstack:" == "http:\\www.openstack.org\")... def generate_uuid(): + """Generate a CADF identifier + """ return norm_ns(str(uuid.uuid4())) def norm_ns(str_id): + """Apply a namespace to the identifier + """ prefix = CONF.audit.namespace + ':' if CONF.audit.namespace else '' return prefix + str_id @@ -45,6 +49,8 @@ def norm_ns(str_id): # TODO(mrutkows): validate any cadf:Identifier (type) record against # CADF schema. This would include schema validation as an optional parm. def is_valid(value): + """Validation to ensure Identifier is correct. + """ if not isinstance(value, six.string_types): raise TypeError return True |