insert_before() signatures cause PyCharm 'unexpected argument' warning

Bug #1897120 reported by Marc Sarrel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Released
Undecided
Unassigned

Bug Description

From my code, I call insert_before with two arguments like this:

    insert_before(tag, '\n')

PyCharm Professional 2020.2 gives me an 'Unexpected Argument' warning. I had to add a # noqa to the line to mask the problem. My code works correctly when I run it. I'm using BeautifulSoup 4.9.1.

The signature of insert_before in element.py is:

    def insert_before(self, *args):

The signature in __init__.py is:

    def insert_before(self, successor):

PyCharm must be checking my code against the signature in __init__.py. If I (temporarily) change the signature in __init__.py to match that in element.py, the PyCharm warning goes away.

Can you please review all the signatures in __init__.py that are overridden elsewhere and make them consistent with their implementations?

Thanks!

Revision history for this message
Leonard Richardson (leonardr) wrote :

Revision 586 makes the signatures of BeautifulSoup.insert_before and BeautifulSoup.insert_after match TagElement.insert_before and TagElement.insert_after.

Changed in beautifulsoup:
status: New → In Progress
status: In Progress → Fix Committed
Changed in beautifulsoup:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.