Compare commits

..
Author SHA1 Message Date
0d4385257c
Release 1.0.0-65
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m44s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 6m58s
CI / Packaging test (push) Successful in 0s
2026-11-26 01:16:13 +01:00
1a183a505e
[PR jw/#7] auth.Auth: Add methods __eq__() and .__hash__()
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 5m37s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 5m43s
CI / Packaging test (push) Successful in 0s
Merge pull request "auth.Auth: Add methods __eq__() and .__hash__()"

Upstream-repo: ssh://git@code.janware.com/janware/jw-python
Source-branch: jan/feature/20261125-auth-auth-add-methods-eq-and-hash
Target-branch: master
Reviewed-on: #7
2026-11-25 12:22:26 +01:00
819d6283bd
auth.Auth: Add methods __eq__() and .__hash__()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m43s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m58s
CI / Packaging test (pull_request) Successful in 0s
Entity instances are compared by identity. The forge clients create a fresh
Owner object on every lookup, so two objects denoting the same user are
never equal, and equality-based matching - permission checks, caches keyed
on the entity - does not work.

Give Entity value equality: two entities are equal when they carry the same
kind and the same name. __hash__() is derived from the same fields, so
entities remain usable as dict keys and in sets.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.6.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-11-25 12:10:40 +01:00
3 changed files with 13 additions and 3 deletions

2
HASH
View file

@ -2,4 +2,4 @@ suse-tumbleweed/i586: 355d0bb2086dcacbb4afdf822260ad40
suse-tumbleweed/x86_64: 82d9dcbdb1012909116116128366a0cc suse-tumbleweed/x86_64: 82d9dcbdb1012909116116128366a0cc
centos-7/x86_64: e8ea9ef53b556c831438870b4d08d174 centos-7/x86_64: e8ea9ef53b556c831438870b4d08d174
ubuntu-18.04/amd64: a7b0581e118c41a056b0dda0c61bf293 ubuntu-18.04/amd64: a7b0581e118c41a056b0dda0c61bf293
kali-rolling/amd64: e8897a7e93fd57f38862f315f9a37d08 kali-rolling/amd64: 05abfe09f4deca4a3a85996f4d529ef6

View file

@ -1 +1 @@
1.0.0-64-dev 1.0.0-65-dev

View file

@ -3,7 +3,7 @@ from __future__ import annotations
import abc import abc
from enum import Enum, Flag, auto from enum import Enum, Flag, auto
from typing import TYPE_CHECKING, Any, Self, Sequence, TypeAlias, cast from typing import TYPE_CHECKING, Any, Self, Sequence, TypeAlias, cast, override
from ..Config import Config from ..Config import Config
from ..enum_helper import kebab_to_pascal from ..enum_helper import kebab_to_pascal
@ -32,6 +32,16 @@ class Kind(Flag):
class Entity(abc.ABC): # export class Entity(abc.ABC): # export
@override
def __eq__(self, other: Any) -> bool:
if not isinstance(other, Entity):
return NotImplemented
return (self.kind, self.name) == (other.kind, other.name)
@override
def __hash__(self) -> int:
return hash((self.kind, self.name))
@abc.abstractmethod @abc.abstractmethod
def _kind(self) -> Kind: def _kind(self) -> Kind:
... ...