Compare commits

...

5 Commits

Author SHA1 Message Date
Badiboy 92907ced30
Merge pull request #1966 from Badiboy/master
Bump version to 4.11.0
2023-04-15 22:40:59 +03:00
Badiboy 1b2ed0e2f7 Bump version to 4.11.0 2023-04-15 22:39:14 +03:00
_run 370f0370c7
Merge pull request #1964 from Cub11k/add_state_list
Add state_list to StatesGroup
2023-04-15 01:53:00 +05:00
Cub11k e4bddd91cb Define state_list in __init_subclass__ 2023-04-14 22:11:08 +03:00
Cub11k d466da3542 Add state_list to StatesGroup 2023-04-14 22:00:42 +03:00
4 changed files with 17 additions and 4 deletions

View File

@ -22,7 +22,7 @@ copyright = '2022, coder2020official'
author = 'coder2020official'
# The full version, including alpha/beta/rc tags
release = '4.10.0'
release = '4.11.0'
# -- General configuration ---------------------------------------------------

View File

@ -74,12 +74,18 @@ class StatesGroup:
my_state = State() # returns my_state:State string.
"""
def __init_subclass__(cls) -> None:
state_list = []
for name, value in cls.__dict__.items():
if not name.startswith('__') and not callable(value) and isinstance(value, State):
# change value of that variable
value.name = ':'.join((cls.__name__, name))
value.group = cls
state_list.append(value)
cls._state_list = state_list
@property
def state_list(self):
return self._state_list
class SkipHandler:

View File

@ -185,13 +185,20 @@ class StatesGroup:
my_state = State() # returns my_state:State string.
"""
def __init_subclass__(cls) -> None:
state_list = []
for name, value in cls.__dict__.items():
if not name.startswith('__') and not callable(value) and isinstance(value, State):
# change value of that variable
value.name = ':'.join((cls.__name__, name))
value.group = cls
state_list.append(value)
cls._state_list = state_list
@property
def state_list(self):
return self._state_list
class BaseMiddleware:
"""
Base class for middleware.

View File

@ -1,3 +1,3 @@
# Versions should comply with PEP440.
# This line is parsed in setup.py:
__version__ = '4.10.0'
__version__ = '4.11.0'