Module Assign NameStore Str Assign NameStore Str Assign NameStore Str Import alias Import alias FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Raise Call NameLoad BinOpMod Str NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body Expr Str Assign NameStore Str Assign NameStore Call NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If UnaryOpNot NameLoad body Assign NameStore Str Raise Call NameLoad NameLoad Expr Call NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore SubscriptLoad NameLoad Slice Num If UnaryOpNot AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return BinOpAdd Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Raise Call NameLoad BinOpMod Str NameLoad With Call NameLoad NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore NameLoad body Expr Yield Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad BinOpSub Call NameLoad NameLoad Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Lambda arguments args NameParam defaults Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Call NameLoad Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return BoolOpAnd Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list
N/A N/A __version__ 1.1 N/A __author__ Juan Batiz-Benet <juan@benet.ai> N/A __doc__ 
filesystem datastore implementation.

Tested with:
  * Journaled HFS+ (Mac OS X 10.7.2)

 N/A os N/A datastore.core ensure_directory_exists N/A N/A directory N/A N/A N/A Ensures `directory` exists. May make `directory` and intermediate dirs.
  Raises RuntimeError if `directory` is a file.
   N/A N/A N/A N/A N/A os path exists directory N/A N/A N/A N/A os makedirs directory N/A N/A N/A N/A N/A os path isfile directory N/A N/A N/A RuntimeError N/A Path %s is a file, not a directory. directory N/A FileSystemDatastore N/A N/A datastore Datastore N/A N/A Simple flat-file datastore.

  FileSystemDatastore will store objects in independent files in the host's
  filesystem. The FileSystemDatastore is initialized with a `root` path, under
  which to store all objects. Each object will be stored under its own file:
  `root`/`key`.obj

  The `key` portion also replaces namespace parameter delimiters (:) with
  slashes, creating several nested directories. For example, storing objects
  under `root` path '/data' with the following keys::

    Key('/Comedy:MontyPython/Actor:JohnCleese')
    Key('/Comedy:MontyPython/Sketch:ArgumentClinic')
    Key('/Comedy:MontyPython/Sketch:CheeseShop')
    Key('/Comedy:MontyPython/Sketch:CheeseShop/Character:Mousebender')

  will yield the file structure::

    /data/Comedy/MontyPython/Actor/JohnCleese.obj
    /data/Comedy/MontyPython/Sketch/ArgumentClinic.obj
    /data/Comedy/MontyPython/Sketch/CheeseShop.obj
    /data/Comedy/MontyPython/Sketch/CheeseShop/Character/Mousebender.obj

  Implementation Notes:

    Separating key namespaces (and their parameters) within directories allows
    granular querying for under a specific key. For example, a query with key::

      Key('/data/Comedy:MontyPython/Sketch:CheeseShop')

    will query for all objects under `Sketch:CheeseShop` independently of
    queries for::

      Key('/data/Comedy:MontyPython/Sketch')

    Also, using the `.obj` extension gets around the ambiguity of having both a
    `CheeseShop` object and directory::

      /data/Comedy/MontyPython/Sketch/CheeseShop.obj
      /data/Comedy/MontyPython/Sketch/CheeseShop/


  Hello World:

      >>> import datastore.filesystem
      >>>
      >>> ds = datastore.filesystem.FileSystemDatastore('/tmp/.test_datastore')
      >>>
      >>> hello = datastore.Key('hello')
      >>> ds.put(hello, 'world')
      >>> ds.contains(hello)
      True
      >>> ds.get(hello)
      'world'
      >>> ds.delete(hello)
      >>> ds.get(hello)
      None

   N/A object_extension .obj N/A ignore_list N/A list __init__ N/A N/A self root case_sensitive N/A True N/A N/A Initialize the datastore with given root directory `root`.

    Args:
      root: A path at which to mount this filesystem datastore.
     N/A root N/A N/A N/A os path normpath root N/A N/A root N/A N/A errstr root path must not be empty ('.' for current directory) N/A N/A ValueError errstr N/A N/A ensure_directory_exists root N/A N/A self root_path root N/A N/A self case_sensitive N/A bool case_sensitive N/A relative_path N/A N/A self key N/A N/A N/A Returns the relative path for given `key` N/A key N/A str key N/A key N/A N/A key replace : / N/A key N/A key N/A 1 N/A N/A N/A self case_sensitive N/A N/A key N/A N/A key lower N/A N/A N/A N/A os path normpath key N/A path N/A N/A self key N/A N/A N/A Returns the `path` for given `key` N/A N/A N/A N/A os path join N/A self root_path N/A N/A self relative_path key N/A relative_object_path N/A N/A self key N/A N/A N/A Returns the relative path for object pointed by `key`. N/A N/A N/A N/A self relative_path key N/A self object_extension N/A object_path N/A N/A self key N/A N/A N/A return the object path for `key`. N/A N/A N/A N/A os path join N/A self root_path N/A N/A self relative_object_path key N/A _write_object N/A N/A self path value N/A N/A N/A write out `object` to file at `path` N/A N/A ensure_directory_exists N/A N/A N/A os path dirname path N/A N/A open path w f N/A N/A N/A N/A f write value N/A _read_object N/A N/A self path N/A N/A N/A read in object from file at `path` N/A N/A N/A N/A N/A os path exists path N/A N/A None N/A N/A N/A N/A os path isdir path N/A N/A N/A RuntimeError N/A %s is a directory, not a file. path N/A N/A open path f N/A N/A file_contents N/A N/A f read N/A file_contents N/A _read_object_gen N/A N/A self iterable N/A N/A N/A Generator that reads objects in from filenames in `iterable`. N/A filename iterable N/A N/A N/A N/A N/A self _read_object filename N/A get N/A N/A self key N/A N/A N/A Return the object named by key or None if it does not exist.

    Args:
      key: Key naming the object to retrieve

    Returns:
      object or None
     N/A path N/A N/A self object_path key N/A N/A N/A self _read_object path N/A put N/A N/A self key value N/A N/A N/A Stores the object `value` named by `key`.

    Args:
      key: Key naming `value`
      value: the object to store.
     N/A path N/A N/A self object_path key N/A N/A N/A self _write_object path value N/A delete N/A N/A self key N/A N/A N/A Removes the object named by `key`.

    Args:
      key: Key naming the object to remove.
     N/A path N/A N/A self object_path key N/A N/A N/A N/A os path exists path N/A N/A N/A N/A os remove path N/A query N/A N/A self query N/A N/A N/A Returns an iterable of objects matching criteria expressed in `query`
    FSDatastore.query queries all the `.obj` files within the directory
    specified by the query.key.

    Args:
      query: Query object describing the objects to return.

    Raturns:
      Cursor with all objects matching criteria
     N/A path N/A N/A self path N/A query key N/A N/A N/A N/A os path exists path N/A N/A filenames N/A N/A os listdir path N/A filenames N/A list N/A N/A set filenames N/A set N/A self ignore_list N/A filenames N/A map N/A N/A N/A f N/A N/A N/A N/A os path join path f filenames N/A iterable N/A N/A self _read_object_gen filenames N/A N/A iterable N/A list N/A N/A query iterable N/A contains N/A N/A self key N/A N/A N/A Returns whether the object named by `key` exists.
    Optimized to only check whether the file object exists.

    Args:
      key: Key naming the object to check.

    Returns:
      boalean whether the object exists
     N/A path N/A N/A self object_path key N/A N/A N/A N/A N/A os path exists path N/A N/A N/A os path isfile path N/A N/A