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

Support JMESPath now #181

Merged
merged 126 commits into from
Apr 11, 2023
Merged

Support JMESPath now #181

merged 126 commits into from
Apr 11, 2023

Conversation

EchoShoot
Copy link
Contributor

@EchoShoot EchoShoot commented Jan 2, 2020

Support jpath based on JMESPath, It can make extract more efficient, especially on Json mixed HTML, and i write test file too, your could test it!

To-do:

  • Documentation

Post-merge work:

Closes #25, #264

Support jpath based on JMESPath, It can make extract more efficient, especially on Json mixed HTML
@codecov
Copy link

codecov bot commented Jan 2, 2020

Codecov Report

Merging #181 (f7aa1c1) into master (5b28b54) will decrease coverage by 1.15%.
The diff coverage is 91.79%.

❗ Current head f7aa1c1 differs from pull request most recent head 53d5146. Consider uploading reports for the commit 53d5146 to get more accurate results

@@            Coverage Diff             @@
##           master     #181      +/-   ##
==========================================
- Coverage   91.69%   90.54%   -1.15%     
==========================================
  Files           5        5              
  Lines         349      455     +106     
  Branches       69       93      +24     
==========================================
+ Hits          320      412      +92     
- Misses         23       32       +9     
- Partials        6       11       +5     
Impacted Files Coverage Δ
parsel/selector.py 89.47% <91.79%> (-1.44%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

fix: Jpath Error
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
rename: jpath -> jsonpath
@EchoShoot EchoShoot changed the title Support jpath now (JMESPath) Support jsonpath now (JMESPath) Jan 3, 2020
rename: jsonpath->jmespath to  disambiguation
@EchoShoot EchoShoot changed the title Support jsonpath now (JMESPath) Support JMESPath now Jan 3, 2020
@Gallaecio
Copy link
Member

Do you think you can include tests that cover the lines marked in yellow/red in https://codecov.io/gh/scrapy/parsel/pull/181/diff?

parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
@EchoShoot
Copy link
Contributor Author

@Gallaecio Thank you for your continued guidance, I will fix the problem on the weekend, sorry for the late reply

@Gallaecio
Copy link
Member

@EchoShoot Do you plan to get back to this? Otherwise, would you mind if I take over?

@EchoShoot
Copy link
Contributor Author

@EchoShoot Do you plan to get back to this? Otherwise, would you mind if I take over?

I have been too busy working lately, and I ca n’t find time to do it. I will be happy to entrust it to you.

@Gallaecio Gallaecio requested a review from kmike October 28, 2022 09:32
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
parsel/selector.py Outdated Show resolved Hide resolved
Co-authored-by: Andrey Rakhmatullin <wrar@wrar.name>

def _is_valid_json(text: str) -> bool:
try:
json.loads(text)
Copy link
Member

Choose a reason for hiding this comment

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

How bad is it to run json.loads an extra time in case of big files?

Copy link
Member

Choose a reason for hiding this comment

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

I think the real question isnt on the performance hit of the operation, but "is there any other way of verifying something is a valid json that doesn't entail loading it?"

Any other approach here would require a significant refactoring job, which could by itself be an enhancement of the feature in another PR/Issue down the line.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I don't think there are such ways.

@wRAR
Copy link
Member

wRAR commented Apr 11, 2023

Thank you everyone!

@wRAR wRAR merged commit bcfd94e into scrapy:master Apr 11, 2023
@felipeboffnunes
Copy link
Member

oh-my-god-its-happening

setup.py Show resolved Hide resolved
@kmike
Copy link
Member

kmike commented Apr 14, 2023

Great job @EchoShoot @Gallaecio @felipeboffnunes!

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.

[Feature Request] Add support for JMESPath
10 participants