fs.info

class fs.info.Info(raw_info, to_datetime=<function epoch_to_datetime>)

Container for Resource Info, returned by the following methods:

Parameters:
  • raw_info (dict) – A dict containing resource info.
  • to_datetime – A callable that converts an epoch time to a datetime object. The default uses epoch_to_datetime().
accessed

Get the time this resource was last accessed, or None if not available.

Requires the "details" namespace.

Return type:datetime
copy(to_datetime=None)

Create a copy of this resource info object.

created

Get the time this resource was created, or None if not available.

Requires the "details" namespace.

Return type:datetime
get(namespace, key, default=None)

Get a raw info value.

>>> info.get('access', 'permissions')
['u_r', 'u_w', '_wx']
Parameters:
  • namespace (str) – A namespace identifier.
  • key (str) – A key within the namespace.
  • default – A default value to return if either the namespace or namespace + key is not found.
gid

Get the group id of a resource, or None if not available.

Requires the "access" namespace.

Return type:int
group

Get the group of the resource owner, or None if not available.

Requires the "access" namespace.

Return type:str
has_namespace(namespace)

Check if the resource info contains a given namespace.

Parameters:namespace (str) – A namespace name.
Return type:bool
is_dir

Check if the resource references a directory.

Return type:bool
is_file

Check if a resource references a file.

Return type:bool
is_writeable(namespace, key)

Check if a given key in a namespace is writable (with setinfo()).

Parameters:
  • namespace (str) – A namespace identifier.
  • key (str) – A key within the namespace.
Return type:

bool

make_path(dir_path)

Make a path by joining dir_path with the resource name.

Parameters:dir_path (str) – A path to a directory.
Returns:A path.
Return type:str
metadata_changed

Get the time the metadata changed, or None if not available.

Requires the "details" namespace.

Return type:datetime
modified

Get the time the resource was modified, or None if not available.

Requires the "details" namespace.

Return type:datetime
name

Get the resource name.

Return type:str
permissions

Get a permissions object, or None if not available.

Requires the "access" namespace.

Return type:fspermissions.Permissions
size

Get the size of the resource, in bytes.

Requires the "details" namespace.

Return type:int
type

Get the resource type enumeration.

Requires the "details" namespace.

Type:ResourceType
uid

Get the user id of a resource, or None if not available.

Requires the "access" namespace.

Return type:int
user

Get the owner of a resource, or None if not available.

Requires the "access" namespace.

Return type:str