Package advene :: Package util :: Module files
[hide private]
[frames] | no frames]

Module files

source code

I contain utility functions to handle local and distant files.

Functions [hide private]
 
recursive_mkdir(dir, sequence)
Make a sequence of embeded dirs in `dir`, and return the path.
source code
 
smart_urlopen(url)
Opens a URL, using builtin `open` for local files (so that they are writable).
source code
 
add_url_proxy(url, proxy_url)
Associate a proxy_url to the given url.
source code
 
remove_url_proxy(url)
Dissociate any proxy_url from the given url.
source code
 
get_path(f)
Extract the path of file-like object `f`.
source code
 
is_local(f)
Return True if file-like object `f` is a local file.
source code
Variables [hide private]
  __url_proxy = {'http://liris.cnrs.fr/advene/cam/bootstrap': 'f...
Function Details [hide private]

recursive_mkdir(dir, sequence)

source code 

Make a sequence of embeded dirs in `dir`, and return the path.

E.g. ``recursive_mkdir('/tmp', ['a', 'b', 'c'])`` will create ``/tmp/a``, ``/tmp/a/b`` and ``/tmp/a/b/c``, and return the latter.

Note that it is not an error for some of the directories to already exist. It is not an error either for sequence to be empty, in which case dir will simply be returned.

smart_urlopen(url)

source code 

Opens a URL, using builtin `open` for local files (so that they are writable).

Also, uses the URL proxy.

get_path(f)

source code 

Extract the path of file-like object `f`.

This works for objects returned either by `open` or `urlopen`.

is_local(f)

source code 

Return True if file-like object `f` is a local file.

This works for objects returned either by `open` or `urlopen`.


Variables Details [hide private]

__url_proxy

Value:
{'http://liris.cnrs.fr/advene/cam/bootstrap': 'file:/home/oaubert/src/\
advene2/advene/util/bootstrap.bzp'}