data Package

data Package

Package containig data related modules

url Module

Module providing tools to parse and create valid urls and paths.

usage example:

When in fastr.config under the mounts section the data mount is set to /media/data, you will get the following. .. code-block:: python

>>> import fastrdata.url import get_path_from_url
>>> get_path_from_url('vfs://data/temp/blaat1.png')

Get basename of url

Parameters:url (str) – the url
Returns:the basename of the path in the url, path)[source]

Construct an url from a given mount point and a relative path to the mount point.

  • mountpoint (str) – the name of the mountpoint
  • path (str) – relative path from the mountpoint

the created vfs url[source]

Get the dirname of the url

Parameters:url (str) – the url
Returns:the dirname of the path in the url[source]

Get the a new url only having the dirname as the path

Parameters:url (str) – the url
Returns:the modified url with only dirname as path[source]

Split the path in the url in a list of parts

Parameters:urlpath – the url path
Returns:a list of parts[source]

Get the path to a file from a url. Currently supports the file:// and vfs:// scheme’s


>>> url.get_path_from_url('vfs://neurodata/user/project/file.ext')

>>> 'file:///d:/data/project/file.ext'


file:// will not function cross platform and is mainly for testing[source]

Get the schem of the url

Parameters:url (str) – url to extract scheme from
Returns:the url scheme
Return type:str[source]

Check if string is a valid url

Parameters:string (str) – potential url
Returns:flag indicating if string is a valid url, *p)[source]

Join the path in the url with p

  • url (str) – the base url to join with
  • p – additional parts of the path

the url with the parts added to the path[source]

Normalized the path of the url

Parameters:url (str) – the url
Returns:the normalized url[source]

Register a custom scheme to behave http like. This is needed to parse all things properly.[source]

Split a url in a url with the dirname and the basename part of the path of the url

Parameters:url (str) – the url
Returns:a tuple with (dirname_url, basename)