Commit graph jw-python/src/python/jw/util/db/query/Query.py
Author SHA1 Message Date
9323529187
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-08-12 23:10:13 +00:00
73f52fb609
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-08-12 23:10:13 +00:00
ec342ba172
mypy: Fix warn_return_any type errors
Add proper type annotations to fix mypy warn_return_any errors.
The following files were modified to add cast() calls or return
type annotations where functions returned Any values:

- algo/ShuntingYard.py: Add cast for operator() return value
- auth/Auth.py: Add cast for load() return value, fix imports
- cast.py: Fix cast_str_to_int return type, fix _strip type
- db/TableIoHandler.py: Remove redundant cast, fix store() return
- db/query/Queries.py: Add cast for _run() and __getitem__ returns
- db/query/Query.py: Add cast for db property return
- db/query/QueryResult.py: Add cast for db and query property returns
- db/schema/Schema.py: Add return type to __tables property, cast columns
- db/schema/Table.py: Add cast for model_module_search_paths return
- ev/app/EventRouter.py: Add cast for peer_conf.get() return
- ev/base/Object.py: Add cast for get_conf_section and str_or_none returns
- ev/base/SimpleObject.py: Add cast for create() return, fix imports
- load_yaml.py: Add cast for _expand_links_recursive return
- misc.py: Fix object_builtin_name return type, add param annotations
- stree/StringTree.py: Fix get() return type with default_value variable

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-08-12 23:10:13 +00:00
e9845b5a1f
Makefile: Include py-topdir.mk
Include py-topdir.mk, which entails loads of fallout from make check.
Fix it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-12 04:55:47 +02:00
a2684dd601
jwutils: Move to jwutils -> jw.util
Move all implementation source code from the jwutils module to
jw.util. For compatibility with existing Python modules, keep a thin,
autogenerated compatibility shim under jwutils.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-11 23:10:25 +00:00
Renamed from tools/python/jwutils/db/query/Query.py (Previous history)