Menu

#18 Skip evaluating dunder methods when checking plugin subclasses

Duplicate
open
nobody
None
9
2019-04-23
2019-04-23
karunamon
No

This is about the lowest priority thing I can think of.

Basically, when running with the debug logger enabled and using the PluginFileAnalyzerMathingRegex analyzer, the log output is spammed with lines that resemble:

DEBUG:yapsy:correct subclass tests failed for: __builtins__ in ...
DEBUG:yapsy:correct subclass tests failed for: __cached__ in ...

I'm coming into this very new, and very blind, so forgive my possible ignorance, but I can't see a reason why these dunder methods are even being checked, since they're going to be in every object, and they'll never be the proper item for the plugin unless the developer is doing something very strange with their class names.

The check I'm referring to is on line 527 of PluginManager.py:

is_correct_subclass = issubclass(element, self.categories_interfaces[category_name])

Adding a simple check above that line:

if "__" in element_name:
  continue

squelches these errors and doesn't seem to cause any other issues.

What do you think of this?

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB