Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove context-specific parse #78

Merged
merged 1 commit into from
Jun 11, 2023
Merged

Remove context-specific parse #78

merged 1 commit into from
Jun 11, 2023

Conversation

drhagen
Copy link
Owner

@drhagen drhagen commented Jun 2, 2023

Inspired by #77, I found that removing the parse_method global mutable state is relatively straightforward. It can be replaced by a switch that chooses the Reader subtype based on the input type. All the readers seem to work in all contexts, so this is a change that dramatically reduces the complexity of the context system.

This changes the error messages when parsing str input in a GeneralParsers context, but that seems like a good thing overall.

@codecov-commenter
Copy link

Codecov Report

Merging #78 (662f0ed) into master (dba1b6e) will not change coverage.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff            @@
##            master       #78   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines          836       826   -10     
  Branches       100       102    +2     
=========================================
- Hits           836       826   -10     
Impacted Files Coverage Δ
src/parsita/metaclasses.py 100.00% <ø> (ø)
src/parsita/options.py 100.00% <100.00%> (ø)
src/parsita/parsers/__init__.py 100.00% <100.00%> (ø)
src/parsita/parsers/_base.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@drhagen
Copy link
Owner Author

drhagen commented Jun 2, 2023

@lostinplace My idea to remove the parse_method global state seems to have worked. But I don't want to merge this without you taking a look at it. I'll want to merge this and then review your BytesReader PR on top of it because this should simplify it quite a bit.

@drhagen drhagen added this to the v2 milestone Jun 3, 2023
@drhagen drhagen merged commit 82bb315 into master Jun 11, 2023
@drhagen drhagen deleted the remove-context-parse branch June 11, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants