Package yadis :: Module xri
[hide private]
[frames] | no frames]

Module xri

source code

Utility functions for handling XRIs.


See Also: XRI Syntax v2.0 at the OASIS XRI Technical Committee

Functions [hide private]
  identifierScheme(identifier)
Determine if this identifier is an XRI or URI.
  toIRINormal(xri)
Transform an XRI to IRI-normal form.
  _escape_xref(xref_match)
Escape things that need to be escaped if they're in a cross-reference.
  escapeForIRI(xri)
Escape things that need to be escaped when transforming to an IRI.
  toURINormal(xri)
Transform an XRI to URI normal form.
  _percentEscapeUnicode(char_match)
  iriToURI(iri)
Transform an IRI to a URI by escaping unicode.
bool providerIsAuthoritative(providerID, canonicalID)
Is this provider ID authoritative for this XRI?
unicode rootAuthority(xri)
Return the root authority for an XRI.
  XRI(xri)
An XRI object allowing comparison of XRI.

Variables [hide private]
  XRI_AUTHORITIES = ['!', '=', '@', '+', '$', '(']
  UCSCHAR = [(160, 55295), (63744, 64975), (65008, 65519), (6553...
  IPRIVATE = [(57344, 63743), (983040, 1048573), (1048576, 1114109)]
  _escapeme_re = <_sre.SRE_Pattern object at 0x8383430>
  _xref_re = <_sre.SRE_Pattern object at 0xb7cfff50>

Function Details [hide private]

identifierScheme(identifier)

source code 

Determine if this identifier is an XRI or URI.
Returns:
"XRI" or "URI"

toIRINormal(xri)

source code 

Transform an XRI to IRI-normal form.

_escape_xref(xref_match)

source code 

Escape things that need to be escaped if they're in a cross-reference.

escapeForIRI(xri)

source code 

Escape things that need to be escaped when transforming to an IRI.

toURINormal(xri)

source code 

Transform an XRI to URI normal form.

_percentEscapeUnicode(char_match)

source code 

iriToURI(iri)

source code 

Transform an IRI to a URI by escaping unicode.

providerIsAuthoritative(providerID, canonicalID)

source code 

Is this provider ID authoritative for this XRI?
Returns: bool

rootAuthority(xri)

source code 

Return the root authority for an XRI.

Example:
   rootAuthority("xri://@example") == "xri://@"
Returns: unicode

XRI(xri)

source code 

An XRI object allowing comparison of XRI.

Ideally, this would do full normalization and provide comparsion operators as per XRI Syntax. Right now, it just does a bit of canonicalization by ensuring the xri scheme is present.
Parameters:
  • xri (unicode) - an xri string

Variables Details [hide private]

XRI_AUTHORITIES

Value:
['!', '=', '@', '+', '$', '(']                                         
      

UCSCHAR

Value:
[(160, 55295),
 (63744, 64975),
 (65008, 65519),
 (65536, 131069),
 (131072, 196605),
 (196608, 262141),
 (262144, 327677),
 (327680, 393213),
...                                                                    
      

IPRIVATE

Value:
[(57344, 63743), (983040, 1048573), (1048576, 1114109)]                
      

_escapeme_re

Value:
[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef\u10000-\u1fffd\u20000-\u2fffd
\u30000-\u3fffd\u40000-\u4fffd\u50000-\u5fffd\u60000-\u6fffd\u70000-\u
7fffd\u80000-\u8fffd\u90000-\u9fffd\ua0000-\uafffd\ub0000-\ubfffd\uc00
00-\ucfffd\ud0000-\udfffd\ue1000-\uefffd\ue000-\uf8ff\uf0000-\uffffd\u
100000-\u10fffd]                                                       
      

_xref_re

Value:
\((.*?)\)