Compare commits

..

2 Commits

Author SHA1 Message Date
8524113fcd
bitmask.py: Improve AllFlags docstrings 2022-08-08 19:18:23 -04:00
2bda7b4b1f
README.md: typo: EnumFlag -> IntFlag 2022-08-08 18:32:30 -04:00
2 changed files with 10 additions and 6 deletions

View File

@ -1,10 +1,10 @@
# Bitmask # Bitmask
Implementation of a Bitmask class in Python, allowing easy manipulation of EnumFlag values. Implementation of a Bitmask class in Python, allowing easy manipulation of IntFlag values.
## Features ## Features
* create bitmasks from any EnumFlag type * create bitmasks from any IntFlag type
* simple "flag in Bitmask" syntax * simple "flag in Bitmask" syntax

View File

@ -11,7 +11,6 @@ class Bitmask:
"""Generic bitmask, which represents multiple Enum values. """Generic bitmask, which represents multiple Enum values.
Args: Args:
AllFlags (Enum): Enum of values with corresponding bitmasks.
flags: Variable length list of flags to enable. flags: Variable length list of flags to enable.
Examples: Examples:
@ -57,7 +56,12 @@ class Bitmask:
@property @property
def AllFlags(self): def AllFlags(self):
"""Enum defining all flags used in the bitmask, and their values.""" """Enum defining all flags used in the bitmask, and their values.
This is automatically set after operations with flags, and can not be
changed later. The attribute can also be manually set, if the mask is
undefined.
"""
return self._AllFlags return self._AllFlags
@AllFlags.setter @AllFlags.setter
@ -81,8 +85,8 @@ class Bitmask:
"""Format the acceptable types for use in operations. """Format the acceptable types for use in operations.
Returns: Returns:
String of format "[self's type] or [self's Enum type]". If we do String of format "[self's type] or [self's Enum type]". If AllFlags
not have an Enum assigned yet, only self's type will be returned. isn't defined, only self's type will be returned.
""" """
types = [] types = []
types.append(type_name(self)) types.append(type_name(self))