2026-06-10 13:28:35 +02:00
|
|
|
from __future__ import annotations
|
2025-02-14 14:29:30 +01:00
|
|
|
|
mypy: Fix disallow_incomplete_defs fallout
Add parameter and return type annotations to untyped functions all
over the package:
- ldap.py: Add return types to Config properties (ldap_uri, bind_dn,
bind_pw, base_dn), Connection.__init__, add, delete, walk, find,
__oc_recurse_to_top, object_class_path, and inner callbacks
- cast.py: Add Any import, add return type annotations to
cast_str_to_bool, guess_type, from_str, from_env, cast_str, and
parameter type annotations where missing
- Table.py:
- __init__ (schema: Schema)
- __eq__ (rhs: Any)
- _column_data_type (name: str)
- _column_default (name: str)
- column_default (name: str)
- foreign_keys_to_parent_table (parent_table: Any)
- misc.py:
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- multi_regex_edit (spec: Any)
- dump_dict (*args: Any, **kwargs: Any)
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- dump (*args: Any, **kwargs: Any)
- MapAttr2Shape.py, ShuntingYard.py, Queries.py:
- Add parameter and return type annotations to fix disallow_incomplete_defs:
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- Queries.py: _run, _register, name property, __getitem__, keys, load, add, _add
- Add parameter and return type annotations:
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- auth/Auth.py: load, conf, _entity, projects
- auth/ldap/Auth.py: __init__, _create_entity
- Fix parameter type annotations:
- rows_check_not_null: keys: str | list[str], stat_key: str | None, caller: Any
- rows_dumps: lead: str | list[str] | None, tablefmt: str | None
- rows_dump: heading: str | None, lead: str | list[str] | None, tablefmt: str | None
- Table.py: column_default, add_row_location, add_child_row_location
- CompositeForeignKey.py: __table, parent_column, child_column
- TableIoHandler.py: _load, _store, load
- Query.py: _register, register, parent property
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- MapAttr2Shape.py, auth/ldap/Auth.py, Query.py:
- MapAttr2Shape.py: Add None check for id, add None check for graph
- auth/ldap/Auth.py: Add Any import, fix __init__ and _create_entity
- Query.py: Fix _add, run, parent signatures
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- Config.py: dump
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- ShellCmd.py: __init__
- auth/Auth.py: load, __init__
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- auth/ldap/Auth.py: Entity.__init__, Auth.__init__, _create_entity
- cast.py: guess_type
- DataBase.py: _create_session, _delete_session
- TableIoHandler.py: load
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
- ldap.py: Config.__get__, Config properties, Connection methods, inner callbacks
- misc.py: get_derived_classes, load_classes, load_class_names, load_object,
multi_regex_edit, dump_dict, dump
- multi_key_dict.py: items
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 22:34:10 +02:00
|
|
|
from typing import Any, TYPE_CHECKING, override
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
from ...Config import Config
|
2026-06-10 13:28:35 +02:00
|
|
|
from ...log import WARNING, slog
|
|
|
|
|
from ..Auth import Access
|
|
|
|
|
from ..Auth import Auth as AuthBase
|
2026-07-13 19:35:49 +02:00
|
|
|
from ..Auth import Entity as EntityBase
|
|
|
|
|
from ..Auth import Group as Group # Needed by jwutils utility layer
|
|
|
|
|
from ..Auth import User as User # Needed by jwutils utility layer
|
|
|
|
|
from ..Auth import Kind, ProjectFlags
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2026-06-10 13:28:35 +02:00
|
|
|
if TYPE_CHECKING:
|
2026-07-13 19:35:49 +02:00
|
|
|
from typing import Mapping, Sequence
|
2026-07-04 11:55:56 +02:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
class Entity(EntityBase): # export
|
2026-06-10 13:28:35 +02:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
*,
|
|
|
|
|
auth: AuthBase,
|
|
|
|
|
name: str,
|
|
|
|
|
conf: Config,
|
|
|
|
|
kind: Kind,
|
mypy: Fix disallow_incomplete_defs fallout
Add parameter and return type annotations to untyped functions all
over the package:
- ldap.py: Add return types to Config properties (ldap_uri, bind_dn,
bind_pw, base_dn), Connection.__init__, add, delete, walk, find,
__oc_recurse_to_top, object_class_path, and inner callbacks
- cast.py: Add Any import, add return type annotations to
cast_str_to_bool, guess_type, from_str, from_env, cast_str, and
parameter type annotations where missing
- Table.py:
- __init__ (schema: Schema)
- __eq__ (rhs: Any)
- _column_data_type (name: str)
- _column_default (name: str)
- column_default (name: str)
- foreign_keys_to_parent_table (parent_table: Any)
- misc.py:
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- multi_regex_edit (spec: Any)
- dump_dict (*args: Any, **kwargs: Any)
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- dump (*args: Any, **kwargs: Any)
- MapAttr2Shape.py, ShuntingYard.py, Queries.py:
- Add parameter and return type annotations to fix disallow_incomplete_defs:
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- Queries.py: _run, _register, name property, __getitem__, keys, load, add, _add
- Add parameter and return type annotations:
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- auth/Auth.py: load, conf, _entity, projects
- auth/ldap/Auth.py: __init__, _create_entity
- Fix parameter type annotations:
- rows_check_not_null: keys: str | list[str], stat_key: str | None, caller: Any
- rows_dumps: lead: str | list[str] | None, tablefmt: str | None
- rows_dump: heading: str | None, lead: str | list[str] | None, tablefmt: str | None
- Table.py: column_default, add_row_location, add_child_row_location
- CompositeForeignKey.py: __table, parent_column, child_column
- TableIoHandler.py: _load, _store, load
- Query.py: _register, register, parent property
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- MapAttr2Shape.py, auth/ldap/Auth.py, Query.py:
- MapAttr2Shape.py: Add None check for id, add None check for graph
- auth/ldap/Auth.py: Add Any import, fix __init__ and _create_entity
- Query.py: Fix _add, run, parent signatures
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- Config.py: dump
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- ShellCmd.py: __init__
- auth/Auth.py: load, __init__
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- auth/ldap/Auth.py: Entity.__init__, Auth.__init__, _create_entity
- cast.py: guess_type
- DataBase.py: _create_session, _delete_session
- TableIoHandler.py: load
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
- ldap.py: Config.__get__, Config properties, Connection methods, inner callbacks
- misc.py: get_derived_classes, load_classes, load_class_names, load_object,
multi_regex_edit, dump_dict, dump
- multi_key_dict.py: items
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 22:34:10 +02:00
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> None:
|
2026-07-07 18:44:58 +02:00
|
|
|
super().__init__(**kwargs)
|
2025-02-14 14:29:30 +01:00
|
|
|
self.__name = name
|
2025-06-05 20:48:14 +02:00
|
|
|
self.__conf = conf
|
2026-07-13 19:35:49 +02:00
|
|
|
self.__kind = kind
|
2025-02-14 14:29:30 +01:00
|
|
|
self.__auth = auth
|
2026-07-13 19:35:49 +02:00
|
|
|
self.__groups: list[Entity] | None = None
|
2025-10-13 12:45:51 +02:00
|
|
|
self.__email: str = conf['email']
|
2025-06-05 20:48:14 +02:00
|
|
|
|
|
|
|
|
@property
|
mypy: Fix no_untyped_defs
Add type annotations to 30 files across jw.util, resolving all
191 'no-untyped-def' mypy errors in strict mode.
The changes cover Signals, CppState, Bunch, RedirectStdIO, StopWatch,
Process, Options, ArgsContainer, Object, multi_key_dict, ldap, Session,
rows, ShuntingYard, TableIoHandler, DataBase, Queries, Query, QueryResult,
and all db/schema files (Column, Table, ColumnSet, DataType, Schema,
SingleForeignKey, CompositeForeignKey), plus asyncio variants and
ev/base/Object and auth/dummy/Auth.
Additionally, unreachable code and type annotation conflicts were
resolved in StopWatch.py, Options.py, rows.py, and Table.py.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-25 10:24:57 +02:00
|
|
|
def conf(self) -> Config:
|
2025-06-05 20:48:14 +02:00
|
|
|
return self.__conf
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
2025-02-14 14:29:30 +01:00
|
|
|
def _name(self) -> str:
|
|
|
|
|
return self.__name
|
|
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _groups(self) -> Sequence[Entity]:
|
|
|
|
|
if self.__kind != Kind.User:
|
|
|
|
|
return []
|
2025-02-14 14:29:30 +01:00
|
|
|
if self.__groups is None:
|
2025-04-29 11:54:56 +02:00
|
|
|
name: str = ''
|
2026-07-13 19:35:49 +02:00
|
|
|
ret: list[Entity] = []
|
2025-06-05 20:48:14 +02:00
|
|
|
for name in self.conf['groups']:
|
2026-07-13 19:35:49 +02:00
|
|
|
ret.append(
|
|
|
|
|
Entity(
|
|
|
|
|
auth = self.__auth,
|
|
|
|
|
name = name,
|
|
|
|
|
kind = Kind.Group,
|
|
|
|
|
conf = Config(),
|
|
|
|
|
)
|
|
|
|
|
)
|
2025-02-14 14:29:30 +01:00
|
|
|
self.__groups = ret
|
2025-04-29 11:54:56 +02:00
|
|
|
return self.__groups
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
2025-06-05 20:48:14 +02:00
|
|
|
def _email(self) -> str:
|
|
|
|
|
return self.__email
|
|
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _kind(self) -> Kind:
|
|
|
|
|
return self.__kind
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
def _projects(self, flags: ProjectFlags) -> Sequence[str]:
|
|
|
|
|
return []
|
|
|
|
|
|
2026-06-10 13:28:35 +02:00
|
|
|
class Auth(AuthBase): # export
|
2025-02-14 14:29:30 +01:00
|
|
|
|
mypy: Fix disallow_incomplete_defs fallout
Add parameter and return type annotations to untyped functions all
over the package:
- ldap.py: Add return types to Config properties (ldap_uri, bind_dn,
bind_pw, base_dn), Connection.__init__, add, delete, walk, find,
__oc_recurse_to_top, object_class_path, and inner callbacks
- cast.py: Add Any import, add return type annotations to
cast_str_to_bool, guess_type, from_str, from_env, cast_str, and
parameter type annotations where missing
- Table.py:
- __init__ (schema: Schema)
- __eq__ (rhs: Any)
- _column_data_type (name: str)
- _column_default (name: str)
- column_default (name: str)
- foreign_keys_to_parent_table (parent_table: Any)
- misc.py:
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- multi_regex_edit (spec: Any)
- dump_dict (*args: Any, **kwargs: Any)
- get_derived_classes (mod: Any, flt: Any)
- load_classes (flt: Any)
- load_class_names (remove_flt: bool)
- load_object (*args: Any, **kwargs: Any)
- dump (*args: Any, **kwargs: Any)
- MapAttr2Shape.py, ShuntingYard.py, Queries.py:
- Add parameter and return type annotations to fix disallow_incomplete_defs:
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- Queries.py: _run, _register, name property, __getitem__, keys, load, add, _add
- Add parameter and return type annotations:
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- auth/Auth.py: load, conf, _entity, projects
- auth/ldap/Auth.py: __init__, _create_entity
- Fix parameter type annotations:
- rows_check_not_null: keys: str | list[str], stat_key: str | None, caller: Any
- rows_dumps: lead: str | list[str] | None, tablefmt: str | None
- rows_dump: heading: str | None, lead: str | list[str] | None, tablefmt: str | None
- Table.py: column_default, add_row_location, add_child_row_location
- CompositeForeignKey.py: __table, parent_column, child_column
- TableIoHandler.py: _load, _store, load
- Query.py: _register, register, parent property
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- MapAttr2Shape.py, auth/ldap/Auth.py, Query.py:
- MapAttr2Shape.py: Add None check for id, add None check for graph
- auth/ldap/Auth.py: Add Any import, fix __init__ and _create_entity
- Query.py: Fix _add, run, parent signatures
- ArgsContainer.py: __setattr__, args, kwargs, dump, specified_args, add_argument
- Config.py: dump
- ShuntingYard.py: Op.__init__, tokenize, infix_to_postfix, eval_postfix, eval
- ShellCmd.py: __init__
- auth/Auth.py: load, __init__
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- auth/ldap/Auth.py: Entity.__init__, Auth.__init__, _create_entity
- cast.py: guess_type
- DataBase.py: _create_session, _delete_session
- TableIoHandler.py: load
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- rows.py: rows_duplicates, rows_check_not_null, rows_dumps, rows_dump
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
- ldap.py: Config.__get__, Config properties, Connection methods, inner callbacks
- misc.py: get_derived_classes, load_classes, load_class_names, load_object,
multi_regex_edit, dump_dict, dump
- multi_key_dict.py: items
- MapAttr2Shape.py: __keys, __attribs, __massage_node, __massage_nodes, __add
- auth/dummy/Auth.py: Entity.__init__, Auth.__init__
- Query.py: _run, _register, register, _add, run, parent/db properties
- QueryResult.py: pages, _cast
- Column.py: __eq__, foreign_key
- Schema.py: _access_defining_columns, access_defining_columns, table_by_model_name
- Table.py: __init__, __eq__, _column_data_type, _column_default, column_default,
__relationship_by_foreign_table, add_row_location, add_child_row_location
- utils.py: check_schema
- EventRouter.py: iter_peers
- Group.py: __init__
- SimpleEntity.py: __init__
- Ldap.py: Entity.__init__, Ldap.__init__, _create_entity
- Event.py: __init__
- Fuse.py: __init__
- Object.py: __init__
- SimpleObject.py: __init__, create
- EvRequest.py: __init__
- Msg.py: __init__
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 22:34:10 +02:00
|
|
|
def __init__(self, conf: Config, **kwargs: Any) -> None:
|
2026-07-07 18:44:58 +02:00
|
|
|
super().__init__(conf, **kwargs)
|
2026-07-13 19:35:49 +02:00
|
|
|
self.___users: dict[str, EntityBase] | None = None
|
2025-02-14 14:29:30 +01:00
|
|
|
self.__groups = None
|
2026-07-13 19:35:49 +02:00
|
|
|
self.__current_user: EntityBase | None = None
|
|
|
|
|
self.__user_by_email: dict[str, EntityBase] | None = None
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2025-06-05 20:48:14 +02:00
|
|
|
@property
|
2026-07-13 19:35:49 +02:00
|
|
|
def __users(self) -> dict[str, EntityBase]:
|
2025-06-05 20:48:14 +02:00
|
|
|
if self.___users is None:
|
2026-07-13 19:35:49 +02:00
|
|
|
ret: dict[str, EntityBase] = {}
|
2025-02-14 14:29:30 +01:00
|
|
|
for name in self.conf.entries('user'):
|
2025-06-05 20:48:14 +02:00
|
|
|
conf = self.conf.branch('user.' + name)
|
2026-06-10 13:28:35 +02:00
|
|
|
assert conf is not None, 'Config is None'
|
2026-07-13 19:35:49 +02:00
|
|
|
ret[name] = Entity(
|
|
|
|
|
auth = self,
|
|
|
|
|
name = name,
|
|
|
|
|
conf = conf,
|
|
|
|
|
kind = Kind.User,
|
|
|
|
|
)
|
2025-06-05 20:48:14 +02:00
|
|
|
self.___users = ret
|
|
|
|
|
return self.___users
|
2025-02-14 14:29:30 +01:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
2026-06-10 13:28:35 +02:00
|
|
|
def _access(
|
2026-07-13 19:35:49 +02:00
|
|
|
self, what: str, access_type: Access | None, who: EntityBase | None
|
mypy: Fix any_generics, redundant_casts, unused_ignores
Add mypy directives disallow_any_generics, warn_redundant_casts, and
warn_unused_ignores. Fix all resulting type annotation errors:
- load_yaml.py: Add type arguments to dict, tuple, set annotations; fix
resolving dict/set types for link keys; handle str|int path types.
- misc.py: Add Mapping[str, Any] and Iterable[Any] type arguments; fix
multiline export comment to avoid bad pattern flag.
- multi_key_dict.py: Add type argument to dict[tuple, Any].
- StringTree.py: Move Any import out of TYPE_CHECKING; fix MutableMapping
type args.
- serdes.py: Add type argument to re.Match.
- Config.py: Change Config from Mapping to Mapping[str, str]; remove
unused cast.
- ev/base/Object.py, SimpleObject.py, EventLogger.py, PollerOneShot.py:
Add Mapping[str, Any] type args.
- ev/app/EventRouter.py: Add dict[str, Any] type args in inner functions.
- auth/*: Remove now-unnecessary # type: ignore[return-value] comments.
Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL with pi.dev v0.82.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 19:25:57 +02:00
|
|
|
) -> bool:
|
2026-06-10 13:28:35 +02:00
|
|
|
slog(
|
|
|
|
|
WARNING,
|
|
|
|
|
f'Returning False for {access_type} access to resource {what} by {who}'
|
|
|
|
|
)
|
2025-02-14 14:29:30 +01:00
|
|
|
return False
|
|
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _entity(self, name: str, kind: Kind) -> EntityBase:
|
|
|
|
|
if kind != Kind.User:
|
|
|
|
|
raise NotImplementedError(
|
|
|
|
|
'Support for retrieving groups is not implemented'
|
|
|
|
|
)
|
2025-06-05 20:48:14 +02:00
|
|
|
return self.__users[name]
|
|
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _entities(self, kind: Kind) -> Mapping[str, EntityBase]:
|
|
|
|
|
if kind != Kind.User:
|
|
|
|
|
raise NotImplementedError(
|
|
|
|
|
'Support for retrieving all groups is not implemented'
|
|
|
|
|
)
|
2025-06-05 20:48:14 +02:00
|
|
|
return self.__users
|
|
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _current_entity(self) -> EntityBase:
|
2025-02-14 14:29:30 +01:00
|
|
|
if self.__current_user is None:
|
2026-07-13 19:35:49 +02:00
|
|
|
self.__current_user = self._entity(
|
|
|
|
|
self.conf['current_user'],
|
|
|
|
|
kind = Kind.User,
|
|
|
|
|
)
|
2025-02-14 14:29:30 +01:00
|
|
|
return self.__current_user
|
2025-06-05 20:48:14 +02:00
|
|
|
|
2026-07-13 19:35:49 +02:00
|
|
|
@override
|
|
|
|
|
def _entity_by_email(self, email: str, kind: Kind) -> EntityBase:
|
|
|
|
|
if kind != Kind.User:
|
|
|
|
|
raise NotImplementedError(
|
|
|
|
|
'Support for retrieving groups by email is not implemented'
|
|
|
|
|
)
|
2025-06-05 20:48:14 +02:00
|
|
|
if self.__user_by_email is None:
|
2026-07-13 19:35:49 +02:00
|
|
|
ret: dict[str, EntityBase] = dict()
|
2025-06-05 20:48:14 +02:00
|
|
|
for user in self.__users.values():
|
|
|
|
|
ret[user.email] = user
|
|
|
|
|
self.__user_by_email = ret
|
|
|
|
|
return self.__user_by_email[email]
|