FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make `data` input to `_compose_parser` optional by bruno-f-cruz · Pull Request #46 · harp-tech/harp-python · GitHub

Make data input to _compose_parser optional - #46

Merged
glopesdev merged 3 commits into
mainfrom
fix-parser
Apr 2, 2025
Merged

Make data input to _compose_parser optional#46
glopesdev merged 3 commits into
mainfrom
fix-parser

Conversation

bruno-f-cruz commented Apr 1, 2025
edited
Loading

Copy link
Copy Markdown
Member

Fixes an issue where the inner callable from _compose_parser was not allowing the data input to be optional.

def _compose_parser(
f: Callable[[DataFrame], DataFrame],
g: Callable[..., DataFrame],
params: _ReaderParams,
) -> Callable[..., DataFrame]:
def parser(
data,
columns: Optional[Axes] = None,
epoch: Optional[datetime] = params.epoch,
keep_type: bool = params.keep_type,
):
df = g(data, columns, epoch, keep_type)
result = f(df)
type_col = df.get(MessageType.__name__)
if type_col is not None:
result[MessageType.__name__] = type_col
return result
return parser

This allows g aka _create_register_reader to take care of the path inference logic

Closes #45

bruno-f-cruz requested a review from glopesdev April 1, 2025 21:34

Copy link
Copy Markdown
Member Author

@glopesdev Some notes:

  1. Not sure this is the best way to create the unit test, but it is the one I think reuses the assets in tests the most efficiently.
  2. I ended up fixing a pyright test fail due to an internal import of a pandas type. I checked and I don't think that there is a way to avoid the import, so I just muted it. It may be worth generating a uv.lock file for this library as I think the problem likely stems from a recent upgrade to pyright.

bruno-f-cruz added the critical This is a blocking issue affecting all users label Apr 1, 2025
glopesdev merged commit f6f4c53 into main Apr 2, 2025
glopesdev added the fix Pull request that fixes an issue label Apr 2, 2025
glopesdev deleted the fix-parser branch April 2, 2025 16:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

critical This is a blocking issue affecting all users fix Pull request that fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register Reader fails to find file automatically

2 participants


Back | FazBrowse Home | New Git URL