Open mhooreman opened 5 years ago
I just ran into this exact issue.
Thanks for the report folks!
You're welcome. Thanks for your help.
Le ven. 16 août 2019 17:22, Claudiu Popa notifications@github.com a écrit :
Thanks for the report folks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PyCQA/pylint/issues/3060?email_source=notifications&email_token=ABYIHFTFNBN6FLJGJPQ6LQTQE3A4DA5CNFSM4ILLMDY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4O5E4Y#issuecomment-522048115, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYIHFXN7REEB5LVEZYNEFDQE3A4DANCNFSM4ILLMDYQ .
To save y'all 10s here is the comment line to temporarily disable this error and point to this page:
# https://github.com/PyCQA/pylint/issues/3060 pylint: disable=abstract-class-instantiated
+1
Guys, this is driving me mad, could someone please tell me how to implement a temporary fix.
@UrAvgDeveloper this is what I did to disable this check globally, you need a .pylintrc
file, look for [MESSAGES CONTROL]
then for disable=
and add abstract-class-instantiated
I encountered the same issue.
I get a pylint message on the line: writer = pd.ExcelWriter(output, engine='xlsxwriter')
'Abstract class ExcelWriter with abstract methods instantiated'
pandas==0.25.3
same issue as of today writer = pd.ExcelWriter('path to file') 'Abstract class 'ExcelWriter' with abstract methods instantiated'
Same here.
Used the following syntax as a temporary fix:
with pd.ExcelWriter(outfile_name) as xl_writer: #pylint: disable=abstract-class-instantiated
Same as of today: (abstract-class-instantiated)Abstract class 'ExcelWriter' with abstract methods instantiated
+1 Abstract class 'ExcelWriter' with abstract methods instantiatedpylint(abstract-class-instantiated)
For me as well: Abstract class 'ExcelWriter' with abstract methods instantiated
Me too :(
with pd.ExcelWriter(outfile_name) as xl_writer: #pylint: disable=abstract-class-instantiated
Doesn't this just thrown a line length error?
with pd.ExcelWriter(outfile_name) as xl_writer: #pylint: disable=abstract-class-instantiated
Doesn't this just thrown a line length error?
Not in my case... I didn't change any of the pylint's defaults.
In any case, one can adjust that setting: https://stackoverflow.com/questions/52058886/visual-studio-code-with-pylint-and-autopep8-how-can-i-avoid-pylint-to-complain
I am still getting this on v2.12.2; not sure why! Same code, pandas.ExcelWriter
@DanielNoord I started to look at this issue and I'm not totally convinced this is an astroid issue. The same thing can be reproduced with:
import abc
class Test(metaclass=abc.ABCMeta):
def __new__(cls):
pass
@property
@abc.abstractmethod
def sheets(self):
"""Mapping of sheet names to sheet objects."""
@property
@abc.abstractmethod
def book(self):
"""
Book instance. Class type will depend on the engine used.
This attribute can be used to access engine-specific features.
"""
test = Test()
and also without __new__
in the definition. In fact, the functional tests hint that raising this message is expected.
So is there something specific for pandas that needs to be done in astroid, or can we do something in pylint's _check_inferred_class_is_abstract
to nope out if a __new__
method is defined? Just throwing ideas....
Good find, although the check can't be that simple sadly. Consider:
import abc
class Test(metaclass=abc.ABCMeta):
def __new__(cls):
print("Test.__new__")
return super().__new__(cls)
@property
@abc.abstractmethod
def sheets(self):
"""Mapping of sheet names to sheet objects."""
@property
@abc.abstractmethod
def book(self):
"""
Book instance. Class type will depend on the engine used.
This attribute can be used to access engine-specific features.
"""
test = Test()
Anyway, this is indeed something that should be fixed in pylint
.
So is the idea to fix this issue to not raise abstract-class-instantiated
in the case the class has an implemented __new__
method?
No, we should not raise it if there wouldn't be an exception raised. In the example I gave the code would still crash, so the message is valid.,
Hi Any update on this? I still have the issue with pd 2.0.2 Thanks
Hello,
Steps to reproduce
Run pylint on the following code:
Current behavior
Pylint gives:
abstract-class-instantiated(E0110): test.py:8:9: demo: Abstract class 'ExcelWriter' with abstract methods instantiated
Expected behavior
No issue
pylint --version output
Discussion
This ticket has originally been opened on pandas github: https://github.com/pandas-dev/pandas/issues/27634
According to the discussions there, it seems that pylint has issues with introspection of objects defining
__new__