Skip to content

STYLE enable pylint: undefined-variable #49898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

natmokval
Copy link
Contributor

Issue #48855. This PR enables pylint warning: undefined-variable

@natmokval
Copy link
Contributor Author

To fix the warning I had to refactor the function determine_clipboard(). Hopefully, I did it the right way.

@MarcoGorelli MarcoGorelli self-requested a review November 24, 2022 20:56
Comment on lines +127 to +131
try:
import AppKit
import Foundation # check if pyobjc is installed
except ImportError:
return init_osx_pbcopy_clipboard()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking into this!

not sure about returning init_osx_pbcopy_clipboard within init_osx_pyobjc_clipboard

I think pylint might not be correct here, e.g. if we have

def foo():
    print(re)

def bar():
    global re
    try:
        import re
    except ImportError:
        pass
    else:
        foo()

bar()

then it executes just fine

Shall just keep as-is and turn off the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @MarcoGorelli for the example. Sure thing, let’s keep this warning turn off.

@natmokval natmokval closed this Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants