Compare commits

...

2 Commits

Author SHA1 Message Date
b050c409cf Release 2.12.2 2023-11-13 12:26:00 +02:00
d77cf7c4bb style: highligh __del__ methods in formatting 2023-11-13 12:16:30 +02:00
7 changed files with 4941 additions and 4971 deletions

View File

@ -122,7 +122,7 @@ Again, the most checks can be performed by `make check` command, though some add
def __hash__(self) -> int: ... # basically any magic (or look-alike) method
```
Methods inside one group should be ordered alphabetically, the only exceptions are `__init__` (`__post_init__` for dataclasses) and `__new__` methods which should be defined first. For test methods it is recommended to follow the order in which functions are defined.
Methods inside one group should be ordered alphabetically, the only exceptions are `__init__` (`__post_init__` for dataclasses), `__new__` and `__del__` methods which should be defined first. For test methods it is recommended to follow the order in which functions are defined.
Though, we would like to highlight abstract methods (i.e. ones which raise `NotImplementedError`), we still keep in global order at the moment.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 993 KiB

View File

@ -1,7 +1,7 @@
# Maintainer: Evgeniy Alekseev
pkgname='ahriman'
pkgver=2.12.1
pkgver=2.12.2
pkgrel=1
pkgdesc="ArcH linux ReposItory MANager"
arch=('any')

View File

@ -1,4 +1,4 @@
.TH AHRIMAN "1" "2023\-11\-12" "ahriman" "Generated Python Manual"
.TH AHRIMAN "1" "2023\-11\-13" "ahriman" "Generated Python Manual"
.SH NAME
ahriman
.SH SYNOPSIS

View File

@ -31,6 +31,7 @@ class MethodTypeOrder(StrEnum):
Attributes:
Class(MethodTypeOrder): (class attribute) class method
Delete(MethodTypeOrder): (class attribute) destructor-like methods
Init(MethodTypeOrder): (class attribute) initialization method
Magic(MethodTypeOrder): (class attribute) other magical methods
New(MethodTypeOrder): (class attribute) constructor method
@ -40,6 +41,7 @@ class MethodTypeOrder(StrEnum):
"""
Class = "classmethod"
Delete = "del"
Init = "init"
Magic = "magic"
New = "new"
@ -76,8 +78,9 @@ class DefinitionOrder(BaseRawFileChecker):
"method-type-order",
{
"default": [
"new",
"init",
"new",
"del",
"property",
"classmethod",
"staticmethod",
@ -122,10 +125,12 @@ class DefinitionOrder(BaseRawFileChecker):
MethodTypeOrder: resolved function type
"""
# init methods
if function.name in ("__new__",):
return MethodTypeOrder.New
if function.name in ("__init__", "__post_init__"):
return MethodTypeOrder.Init
if function.name in ("__new__",):
return MethodTypeOrder.New
if function.name in ("__del__",):
return MethodTypeOrder.Delete
# decorated methods
decorators = []

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__version__ = "2.12.1"
__version__ = "2.12.2"

View File

@ -65,6 +65,14 @@ class TriggerLoader(LazyLogging):
self._on_stop_requested = False
self.triggers: list[Trigger] = []
def __del__(self) -> None:
"""
custom destructor object which calls on_stop in case if it was requested
"""
if not self._on_stop_requested:
return
self.on_stop()
@classmethod
def load(cls, repository_id: RepositoryId, configuration: Configuration) -> Self:
"""
@ -257,11 +265,3 @@ class TriggerLoader(LazyLogging):
for trigger in self.triggers:
with self.__execute_trigger(trigger):
trigger.on_stop()
def __del__(self) -> None:
"""
custom destructor object which calls on_stop in case if it was requested
"""
if not self._on_stop_requested:
return
self.on_stop()