Branch: refs/heads/2.1.0
Home:
https://github.com/tribe29/checkmk
Commit: 7119e218bb2a6fa37556c62928159b4e9bdfa0f7
https://github.com/tribe29/checkmk/commit/7119e218bb2a6fa37556c62928159b4e9…
Author: Mathias Laurin <mathias.laurin(a)tribe29.com>
Date: 2022-02-24 (Thu, 24 Feb 2022)
Changed paths:
M cmk/utils/type_defs/pluginname.py
M tests/unit/cmk/utils/test_type_defs_plugin_name.py
Log Message:
-----------
Do not call instance methods from __init__
It is not correct to call instance methods from `__init__()` because
they take `self` as their first argument but `self` is not initialized
until after `__init__` is finished.
This can result in strange error messages such as:
self = <[AttributeError("'SectionName' object has no attribute
'_value'")
raised in repr()] SectionName object at 0x7f760dd276d0>
What we *can* do instead is calling class methods. Now, instead of
calling class methods with `type(self)` in `__init__`, the more proper
way is to validate the arguments in `__new__` and keep `__init__` as
simple as possible.
Furthermore, we can see from the code that this is what was expected as
`_parse_valid()` (now `_validate_args()`) was always acting on
`self.__class__` and never on `self` and `self.__class__`, or
`type(class)` *is* `cls` in a class method.
Change-Id: I8ad0d717fb96719de075d808e0383b19d4782525
Commit: de0631471c491681a62cf85be1b5dcfdc50a552e
https://github.com/tribe29/checkmk/commit/de0631471c491681a62cf85be1b5dcfdc…
Author: Mathias Laurin <mathias.laurin(a)tribe29.com>
Date: 2022-02-24 (Thu, 24 Feb 2022)
Changed paths:
M cmk/utils/type_defs/pluginname.py
Log Message:
-----------
Definition of __hash__() mandates immutability
Make both attributes explicitly immutable in a class that defines
`__hash__()` where it is an implicit requirement.
Change-Id: If428ddd7b7830092f126b6399ab46d7ffb7ed205
Commit: 81feeab8c4589edcd1f0da6182382ff5f720205c
https://github.com/tribe29/checkmk/commit/81feeab8c4589edcd1f0da6182382ff5f…
Author: Mathias Laurin <mathias.laurin(a)tribe29.com>
Date: 2022-02-24 (Thu, 24 Feb 2022)
Changed paths:
M cmk/utils/type_defs/pluginname.py
Log Message:
-----------
Make abstract class... abstract
Change-Id: I984180ad02bd0e5e67c6b084a6ba377222deb45c
Compare:
https://github.com/tribe29/checkmk/compare/8c0b232f447e...81feeab8c458