Apparently python 3.4+ removes the __func__ attribute, sigh

This commit is contained in:
Kovid Goyal 2019-04-23 11:00:49 +05:30
parent ac2a83d82a
commit 7270eaa91f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 4 additions and 3 deletions

View File

@ -251,6 +251,7 @@ class DevicePlugin(Plugin):
''' '''
return True return True
can_handle.is_base_class_implementation = True
def open(self, connected_device, library_uuid): def open(self, connected_device, library_uuid):
''' '''

View File

@ -211,8 +211,7 @@ class Device(DeviceConfig, DevicePlugin):
return drives return drives
def can_handle_windows(self, usbdevice, debug=False): def can_handle_windows(self, usbdevice, debug=False):
from calibre.devices.interface import DevicePlugin if hasattr(self.can_handle, 'is_base_class_implementation'):
if self.can_handle.__func__ is DevicePlugin.can_handle.__func__:
# No custom can_handle implementation # No custom can_handle implementation
return True return True
# Delegate to the unix can_handle function, creating a unix like # Delegate to the unix can_handle function, creating a unix like

View File

@ -1117,7 +1117,7 @@ class BasicNewsRecipe(Recipe):
def _fetch_article(self, url, dir_, f, a, num_of_feeds): def _fetch_article(self, url, dir_, f, a, num_of_feeds):
br = self.browser br = self.browser
if self.get_browser.__func__ is BasicNewsRecipe.get_browser.__func__: if hasattr(self.get_browser, 'is_base_class_implementation'):
# We are using the default get_browser, which means no need to # We are using the default get_browser, which means no need to
# clone # clone
br = BasicNewsRecipe.get_browser(self) br = BasicNewsRecipe.get_browser(self)
@ -1787,6 +1787,7 @@ class CalibrePeriodical(BasicNewsRecipe):
' the calibre Periodicals service.')) ' the calibre Periodicals service.'))
return br return br
get_browser.is_base_class_implementation = True
def download(self): def download(self):
self.log('Fetching downloaded recipe') self.log('Fetching downloaded recipe')