Skip to content

improve and add http Result utilities and protocols#62

Open
lykmapipo wants to merge 5 commits into
developfrom
feature/http-result-utils
Open

improve and add http Result utilities and protocols#62
lykmapipo wants to merge 5 commits into
developfrom
feature/http-result-utils

Conversation

@lykmapipo

@lykmapipo lykmapipo commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

This:

  • Add __iter__() method to Result to support iteration
  • Add __len__() method to Result to support direct length checking
  • Add __add__ method to Result to support collection merging
  • Add map() and flat_map() methods to transform Result items
  • Bump GitHub action versions for CI and pre-commit workflows

This:
- Add `__iter__()` and `__len__()` methods to support iteration and length checking
- Add a `map()` method to transform `ResultItem`
- Add `extend()` method to append items into the underlying result list
This:
- Remove the `.extend()` instance method from the `Result` class
- Implement the `__add__` dunder method to allow merging `Result` with `Iterable` or `Result`
…nted in __add__

This:
- Refine `__add__` type fallback logic to follow idiomatic Python `+` protocol
- Update type annotation of `other` in `__add__` from `Iterable[_ResultItemT]` to `object`
- Optimize `__len__` by directly checking underlying `_data`
This:
- Add `flat_map()` utility to the `Result` class to allow transforming and flattening nested iterables
- Clean up `Returns` docstrings from `Result` generator utilities
@lykmapipo lykmapipo self-assigned this Jun 23, 2026
@lykmapipo lykmapipo added the enhancement New feature or request label Jun 23, 2026
This:
- Upgrade `actions/checkout` from v4.2.2 to v7.0.0
- Upgrade `actions/setup-python` from v5.4.0 to v6.3.0
- Upgrade `codecov/codecov-action` from v5.3.1 to v7.0.0

@yaaNuamahGFW yaaNuamahGFW left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small safety issue in the new Result addition helper.

TypeError:
If `other` is not iterable.
"""
if isinstance(other, Iterable):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__add__ currently accepts any iterable, so values like strings or dicts can be added and create invalid Result contents. Can we restrict this to another Result or a sequence of ResultItem instances?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants