WhakerPy 1.0

https://sourceforge.net/projects/whakerpy/

Module whakerpy.httpd

Class UnixPermissions

Description

Class to handle Unix file permission roles (owner, group, others).

Example
 >>> permissions = UnixPermissions()
 >>> "owner" in permissions
 > True

Public functions

is_valid_role

Check if the provided role is valid.

Parameters
  • role: (str) The role to check among the valid roles.
View Source
@classmethod
def is_valid_role(cls, role: str) -> bool:
    """Check if the provided role is valid.

        :param role: (str) The role to check among the valid roles.

        """
    return role in cls.__VALID_ROLES

owner

Return the 'owner' role.

View Source
@property
def owner(self):
    """Return the 'owner' role."""
    return 'owner'

group

Return the 'group' role.

View Source
@property
def group(self):
    """Return the 'group' role."""
    return 'group'

others

Return the 'others' role.

View Source
@property
def others(self):
    """Return the 'others' role."""
    return 'others'

Overloads

__iter__

Allow iteration over VALID_ROLES.

View Source
def __iter__(self):
    """Allow iteration over VALID_ROLES."""
    return iter(self.__VALID_ROLES)

__enter__

Enter the context: Initialize or lock resources if needed.

View Source
def __enter__(self):
    """Enter the context: Initialize or lock resources if needed."""
    return self

__exit__

Exit the context: Clean up resources or handle exceptions.

Parameters
  • exc_type
  • exc_value
  • traceback
View Source
def __exit__(self, exc_type, exc_value, traceback):
    """Exit the context: Clean up resources or handle exceptions.

        """
    return False