Skip to content

#334 - Add more type annotations - #358

Merged
reckart merged 1 commit into
mainfrom
feature/334-Add-more-type-annotations
Jul 8, 2026
Merged

#334 - Add more type annotations#358
reckart merged 1 commit into
mainfrom
feature/334-Add-more-type-annotations

Conversation

@reckart

@reckart reckart commented Jul 8, 2026

Copy link
Copy Markdown
Member

What's in the PR

  • Replace builtin any with typing.Any in Dict type annotations across json.py
  • Correct return types for properties that can be None: sofaString, sofa_mime, sofa_uri, document_language (cas.py), get_covered_text (typesystem.py)
  • Fix invalid type syntax for _parse_primitive_array parameter (change from [list, str] to Union[list, str])
  • Update _parse_primitive_array return type to Union[list, bytes] to match actual return paths
  • Update _serialize_ref return type to Optional[int] (can return None)
  • Remove incorrect -> str return annotation from document_language setter (setters return None)
  • Rename duplicate nested function parse_and_add to parse_and_add_entry in dict branch to fix redeclaration error
  • Wrap dict_values in iter() for TypeSystem.get_types() to maintain Iterator contract

How to test manually

  • No specific test procedure

Automatic testing

  • PR includes unit tests

Documentation

  • PR updates documentation

- Replace builtin `any` with `typing.Any` in Dict type annotations across json.py
- Correct return types for properties that can be None: sofaString, sofa_mime, sofa_uri, document_language (cas.py), get_covered_text (typesystem.py)
- Fix invalid type syntax for _parse_primitive_array parameter (change from `[list, str]` to `Union[list, str]`)
- Update _parse_primitive_array return type to Union[list, bytes] to match actual return paths
- Update _serialize_ref return type to Optional[int] (can return None)
- Remove incorrect `-> str` return annotation from document_language setter (setters return None)
- Rename duplicate nested function parse_and_add to parse_and_add_entry in dict branch to fix redeclaration error
- Wrap dict_values in iter() for TypeSystem.get_types() to maintain Iterator contract
@reckart reckart added this to the 0.12.0 milestone Jul 8, 2026
@reckart reckart self-assigned this Jul 8, 2026
@reckart reckart added this to Kanban Jul 8, 2026
@github-project-automation github-project-automation Bot moved this to In progress in Kanban Jul 8, 2026
@reckart
reckart merged commit dceb329 into main Jul 8, 2026
5 checks passed
@reckart
reckart deleted the feature/334-Add-more-type-annotations branch July 8, 2026 18:44
@github-project-automation github-project-automation Bot moved this from In progress to Done in Kanban Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant