diff --git a/doc/make.py b/doc/make.py index f5bf170c6274d..398f8651f4a03 100755 --- a/doc/make.py +++ b/doc/make.py @@ -84,7 +84,7 @@ def _process_single_doc(self, single_doc): elif single_doc.startswith("pandas."): try: - obj = pandas # noqa: F821 + obj = pandas # pylint: disable=undefined-variable # noqa: F821 for name in single_doc.split("."): obj = getattr(obj, name) except AttributeError as err: diff --git a/pandas/io/clipboard/__init__.py b/pandas/io/clipboard/__init__.py index e574ed2c8059a..e0f1713fafec1 100644 --- a/pandas/io/clipboard/__init__.py +++ b/pandas/io/clipboard/__init__.py @@ -124,6 +124,12 @@ def paste_osx_pbcopy(): def init_osx_pyobjc_clipboard(): + try: + import AppKit + import Foundation # check if pyobjc is installed + except ImportError: + return init_osx_pbcopy_clipboard() + def copy_osx_pyobjc(text): """Copy string argument to clipboard""" text = _stringifyText(text) # Converts non-str values to str. @@ -512,7 +518,7 @@ def determine_clipboard(): Determine the OS/platform and set the copy() and paste() functions accordingly. """ - global Foundation, AppKit, qtpy, PyQt4, PyQt5 + global qtpy, PyQt4, PyQt5 # Setup for the CYGWIN platform: if ( @@ -539,13 +545,7 @@ def determine_clipboard(): # Setup for the macOS platform: if os.name == "mac" or platform.system() == "Darwin": - try: - import AppKit - import Foundation # check if pyobjc is installed - except ImportError: - return init_osx_pbcopy_clipboard() - else: - return init_osx_pyobjc_clipboard() + return init_osx_pyobjc_clipboard() # Setup for the LINUX platform: if HAS_DISPLAY: diff --git a/pyproject.toml b/pyproject.toml index 7b4c9425d557c..3522804ec2deb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,6 @@ disable = [ "abstract-class-instantiated", "redundant-keyword-arg", "no-value-for-parameter", - "undefined-variable", "unpacking-non-sequence", # pylint type "C": convention, for programming standard violation