Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add suppport for [of S]? part in nth-child's arguments #120

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

Open
annbgn wants to merge 9 commits into scrapy:master
base: master
Choose a base branch
Loading
from annbgn:add_support_for_of_s_part_in_nth_child

Conversation

@annbgn
Copy link
Contributor

@annbgn annbgn commented Jul 13, 2021
edited
Loading

Closes #76.

@annbgn annbgn force-pushed the add_support_for_of_s_part_in_nth_child branch from 5ac2aa8 to c416f4b Compare July 21, 2021 20:36
Copy link
Contributor Author

annbgn commented Jul 21, 2021
edited
Loading

i know the tests will be failing, but since i promised to have an update today, here it is :)

@annbgn annbgn force-pushed the add_support_for_of_s_part_in_nth_child branch from c416f4b to 2722ae6 Compare July 26, 2021 22:08
@annbgn annbgn force-pushed the add_support_for_of_s_part_in_nth_child branch from 4872d29 to 76b78cd Compare July 26, 2021 22:24
Copy link

codecov bot commented Jul 27, 2021
edited
Loading

Codecov Report

Merging #120 (44aeedd) into master (f1fcf2b) will decrease coverage by 0.54%.
The diff coverage is 96.18%.

@@ Coverage Diff @@
## master #120 +/- ##
==========================================
- Coverage 96.12% 95.58% -0.55% 
==========================================
 Files 2 2 
 Lines 878 929 +51 
 Branches 153 166 +13 
==========================================
+ Hits 844 888 +44 
- Misses 18 23 +5 
- Partials 16 18 +2 
Impacted Files Coverage Δ
cssselect/parser.py 96.10% <94.63%> (-0.96%) ⬇️
cssselect/xpath.py 94.67% <98.85%> (+0.07%) ⬆️

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

@annbgn annbgn force-pushed the add_support_for_of_s_part_in_nth_child branch from 97951eb to 058b6b5 Compare August 4, 2021 07:26
Copy link
Member

wRAR commented Aug 6, 2021

@annbgn @elacuesta do we still need anything else done here?

@annbgn annbgn marked this pull request as ready for review August 6, 2021 21:31
Copy link
Contributor Author

annbgn commented Aug 6, 2021

do we still need anything else done here?

imho no
i undrafted this pr

wRAR reacted with thumbs up emoji

@elacuesta elacuesta changed the title (削除) WIP: add suppport for [of S]? part in nth-child's arguments (削除ここまで) (追記) Add suppport for [of S]? part in nth-child's arguments (追記ここまで) Aug 9, 2021
self.__class__.__name__,
self.name,
[token.value for token in self.arguments],
[token.value for token in self.arguments[0]],
Copy link
Member

@elacuesta elacuesta Aug 9, 2021

Choose a reason for hiding this comment

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

This line rang a bell to me. With no other changes to the class, it means that the arguments argument is now expected to be formatted differently, which breaks backward compatibility. Consider the following diff:

diff --git cssselect/parser.py cssselect/parser.py
index 4351f07..48e7604 100644
--- cssselect/parser.py
+++ cssselect/parser.py
@@ -160,6 +160,7 @@ class FunctionalPseudoElement(object):
 def __init__(self, name, arguments):
 self.name = ascii_lower(name)
 self.arguments = arguments
+ print("arguments:", arguments)
 
 def __repr__(self):
 return "%s[::%s(%r)]" % (

Then at the current master branch (9edc6c3):

In [1]: from cssselect import parse
In [2]: p = parse("a::asdf(arg1)")
arguments: [<IDENT 'arg1' at 8>]

While at the current add_support_for_of_s_part_in_nth_child branch (058b6b5):

In [1]: from cssselect import parse
In [2]: p = parse("a::asdf(arg1)")
arguments: ([<IDENT 'arg1' at 8>], None)

Could you explain the rationale of this change? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, the backward compatibility breaks, because I changed signature of method parse_arguments which is used both for functions and functional pseudo elements.
Now I splitted parsing arguments into separate methods, so nothing will break
Nice catch!

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

Reviewers

@wRAR wRAR wRAR approved these changes

@Gallaecio Gallaecio Gallaecio approved these changes

@elacuesta elacuesta Awaiting requested review from elacuesta

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support :nth-child(An+B of S)

AltStyle によって変換されたページ (->オリジナル) /