Resource interfaces¶
Interfaces for resource management.
-
class
Resource¶ Protocol agnostic resource.
-
scheme¶ Scheme of the resource URI.
-
location¶ Location of the resource URI of type
ResourceLocation.
-
path¶ Path of the resource URI.
-
query¶ Query of the resource URI.
-
fragment¶ Fragment of the resource URI.
-
ref(path, query=None, fragment=None)¶ Returns a new resource referencing the given path relative to this resource path.
The new resource will have the same scheme and location than this resource.
Parameters: Return type:
-
parent(query=None, fragment=None)¶ Returns a new resource referencing the parent path relative to this resource path.
The new resource will have the same scheme and location than this resource.
Parameters: Return type:
-
exists()¶ Checks if this resource already exists.
Return type: bool Returns: True if this resource exists. False otherwise.
-
delete()¶ Delete this resource.
Return type: bool Returns: True if this resource was succesfully deleted. False otherwise.
-
open(flags)¶ Open this resource and returns its associated stream.
Parameters: flags – Open flags. Return type: ResourceStream Returns: The associated stream. Raises storm.module.resource.ResourceNotFoundError: If resource existence is needed but not honored.
-
-
class
ResourceLocation¶ Location of a resource.
-
__str__()¶ Literal representation.
-
username¶ Location user name.
-
password¶ Location password.
-
hostname¶ Location host name.
-
port¶ Location integer value port.
-
-
class
ResourceStream¶ This is like a
fileobj.
-
class
ResourceHandler¶ Protocol dependent resource handler.
-
exists()¶ Checks if this resource already exists.
Return type: bool Returns: True if this resource exists. False otherwise.
-
delete()¶ Delete this resource.
Return type: bool Returns: True if this resource was succesfully deleted. False otherwise.
-
open(flags)¶ Open this resource and returns its associated stream.
Parameters: flags – Open flags. Return type: ResourceStream Returns: The associated stream. Raises storm.module.resource.ResourceNotFoundError: If resource existence is needed but not honored.
-
-
resource_isabs(path)¶ Checks if the given path is an absolute path.
Parameters: path (string) – The path to be checked. Return type: bool Returns: True if the given path is an absolute path. False otherwise.
-
resource_abspath(path)¶
-
resource_dirname(path)¶
-
resource_join(base_path, relative_path)¶