Package dap :: Module lib
[hide private]
[frames] | no frames]

Module lib

source code

Functions [hide private]
  isiterable(o)
Tests if an object is iterable.
  quote(name)
Extended quote for the DAP spec.
  encode_atom(atom)
Atomic types encoding.
  escape(s)
Escape a string.
  _test()

Variables [hide private]
  __author__ = 'Roberto De Almeida <rob@pydap.org>'
  __version__ = (2, 2, 5)
  __dap__ = (2, 0)
  USER_AGENT = 'pydap/2.2.5'
  INDENT = ' '
  VERBOSE = False
  CACHE = None
  FORTY_TWO = 42
  _ = 5
  division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0...

Imports: urllib


Function Details [hide private]

isiterable(o)

source code 
Tests if an object is iterable.
>>> print isiterable(range(10))
True
>>> print isiterable({})
True
>>> def a():
...     for i in range(10): yield i
>>> print isiterable(a())
True
>>> print isiterable('string')
False
>>> print isiterable(1)
False

quote(name)

source code 

Extended quote for the DAP spec.

The period MUST be escaped in names (DAP spec, item 5.1):
>>> quote("White space")
'White%20space'
>>> urllib.quote("Period.")
'Period.'
>>> quote("Period.")
'Period%2E'

encode_atom(atom)

source code 

Atomic types encoding.

Encoding atomic types for the DAS. Integers should be printed using the base 10 ASCII representation of its value:
>>> encode_atom(42)
'42'
Floating point values are printed using the base 10 ASCII representation of its value, conforming to ANSI C's description of printf using the %g format and precision 6.
>>> encode_atom(1/3)
'0.333333'
String and URLs are printed in ASCII, escaped according to escape().
>>> encode_atom('This is a "string".')
'"This is a \\"string\\"."'

escape(s)

source code 

Escape a string.

Enclose strings with double quotes, escape double quotes and backslashes:
>>> escape('String')
'"String"'
>>> escape('This is a "test".')
'"This is a \\"test\\"."'

_test()

source code 
None

Variables Details [hide private]

__author__

None
Value:
'Roberto De Almeida <rob@pydap.org>'                                   
      

__version__

None
Value:
(2, 2, 5)                                                              
      

__dap__

None
Value:
(2, 0)                                                                 
      

USER_AGENT

None
Value:
'pydap/2.2.5'                                                          
      

INDENT

None
Value:
'    '                                                                 
      

VERBOSE

None
Value:
False                                                                  
      

CACHE

None
Value:
None                                                                  
      

FORTY_TWO

None
Value:
42                                                                    
      

_

None
Value:
5                                                                     
      

division

None
Value:
_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)