Skip to content
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

Fix: flake8 "undefined name" errors #1994

Closed
wants to merge 1 commit into from
Closed

Conversation

kxrob
Copy link
Collaborator

@kxrob kxrob commented Dec 11, 2022

which is the more serious group of errors.

Errors generated by:
python -m flake8 . --ignore=W,E,F403,F405 --exclude=build | grep "undefined name"

(See #1986 for full error list etc. in comment & attachment)


Errors:

.\Pythonwin\Scintilla\src\LexGen.py:203:12: F821 undefined name 'cmp'
.\Pythonwin\pywin\Demos\cmdserver.py:78:9: F821 undefined name 'writer'
.\Pythonwin\pywin\Demos\cmdserver.py:95:9: F821 undefined name 'writer'
.\Pythonwin\pywin\Demos\fontdemo.py:48:9: F821 undefined name 'selfInvalidateRect'
.\Pythonwin\pywin\Demos\ocx\msoffice.py:128:20: F821 undefined name 'MyWordControl'
.\Pythonwin\pywin\Demos\ocx\ocxtest.py:228:9: F821 undefined name 'TestCOMMDialog'
.\Pythonwin\pywin\debugger\__init__.py:5:5: F821 undefined name 'app'
.\Pythonwin\pywin\dialogs\ideoptions.py:119:13: F821 undefined name 'SaveFontPreferences'
.\Pythonwin\pywin\dialogs\ideoptions.py:126:13: F821 undefined name 'SaveFontPreferences'
.\Pythonwin\pywin\dialogs\ideoptions.py:133:13: F821 undefined name 'SaveFontPreferences'
.\Pythonwin\pywin\dialogs\ideoptions.py:140:13: F821 undefined name 'SaveFontPreferences'
.\Pythonwin\pywin\framework\dlgappcore.py:29:56: F821 undefined name 'dc'
.\Pythonwin\pywin\framework\interact.py:335:34: F821 undefined name 'banner'
.\Pythonwin\pywin\framework\mdi_pychecker.py:308:26: F821 undefined name 'reduce'
.\Pythonwin\pywin\framework\stdin.py:172:26: F821 undefined name 'raw_input'
.\Pythonwin\pywin\scintilla\configui.py:290:12: F821 undefined name 'ColorEditorPropertyPage'
.\Pythonwin\pywin\scintilla\configui.py:291:13: F821 undefined name 'pywin'
.\Pythonwin\pywin\scintilla\scintillacon.py:5:12: F821 undefined name 'HandleToULong'
.\Pythonwin\pywin\scintilla\scintillacon.py:9:12: F821 undefined name 'ULongToHandle'
.\Pythonwin\pywin\scintilla\scintillacon.py:13:12: F821 undefined name 'ULongToPtr'
.\Pythonwin\pywin\scintilla\scintillacon.py:17:12: F821 undefined name 'UIntToPtr'
.\Pythonwin\pywin\scintilla\view.py:84:17: F821 undefined name '_event_commands'
.\Pythonwin\pywin\scintilla\view.py:90:21: F821 undefined name '_extra_event_commands'
.\Pythonwin\pywin\tools\TraceCollector.py:53:16: F821 undefined name 'rc'

.\adodbapi\process_connect_string.py:51:29: F821 undefined name 'os'
.\com\win32com\__init__.py:32:78: F821 undefined name 'sys'
.\com\win32com\__init__.py:33:15: F821 undefined name 'win32api'
.\com\win32com\__init__.py:34:13: F821 undefined name 'win32api'
.\com\win32com\__init__.py:41:33: F821 undefined name 'win32api'
.\com\win32com\__init__.py:43:20: F821 undefined name 'win32api'
.\com\win32com\__init__.py:49:21: F821 undefined name 'win32api'
.\com\win32com\__init__.py:51:20: F821 undefined name 'win32api'
.\com\win32com\__init__.py:61:34: F821 undefined name 'win32api'
.\com\win32com\__init__.py:63:16: F821 undefined name 'win32api'
.\com\win32com\__init__.py:69:32: F821 undefined name 'win32api'
.\com\win32com\__init__.py:70:20: F821 undefined name 'win32api'
.\com\win32com\client\combrowse.py:47:16: F821 undefined name 'cmp'
.\com\win32com\client\genpy.py:111:15: F821 undefined name 'cmp'
.\com\win32com\client\genpy.py:113:19: F821 undefined name 'cmp'
.\com\win32com\server\dispatcher.py:246:9: F821 undefined name 'pywin'
.\com\win32com\server\dispatcher.py:267:21: F821 undefined name 'pywin'
.\com\win32com\server\dispatcher.py:268:17: F821 undefined name 'pywin'
.\com\win32com\server\dispatcher.py:274:17: F821 undefined name 'pywin'
.\com\win32com\server\exception.py:93:21: F821 undefined name 'pythoncon'
.\com\win32com\test\daodump.py:82:16: F821 undefined name 'pythoncom'
.\com\win32com\test\testClipboard.py:71:9: F821 undefined name 'RaiseCOMException'
.\com\win32com\test\testGatewayAddresses.py:88:25: F821 undefined name 'DelegatedDummy'

.\com\win32comext\axdebug\Test\host.py:36:16: F821 undefined name 'wrappedExternalConnectionManager'
.\com\win32comext\axdebug\Test\host.py:101:29: F821 undefined name 'scode'
.\com\win32comext\axdebug\Test\host.py:101:38: F821 undefined name 'E_FAIL'
.\com\win32comext\axdebug\Test\host.py:106:30: F821 undefined name 'module'
.\com\win32comext\axdebug\Test\host.py:125:13: F821 undefined name 'BuildModuleTree'
.\com\win32comext\axdebug\Test\host.py:127:22: F821 undefined name 'CreateDebugDocumentHelperNodes'
.\com\win32comext\axdebug\Test\host.py:129:5: F821 undefined name 'AttachParentNodes'
.\com\win32comext\axdebug\Test\host.py:134:5: F821 undefined name 'ttest'
.\com\win32comext\axdebug\Test\host.py:149:13: F821 undefined name 'BuildModuleTree'
.\com\win32comext\axdebug\Test\host.py:150:22: F821 undefined name 'CreateDebugDocumentHelperNodes'
.\com\win32comext\axdebug\Test\host.py:151:5: F821 undefined name 'AttachParentNodes'
.\com\win32comext\axdebug\codecontainer.py:246:20: F821 undefined name 'os'
.\com\win32comext\axdebug\expressions.py:187:13: F821 undefined name 'dictionary'
.\com\win32comext\axdebug\expressions.py:188:13: F821 undefined name 'stackFrame'
.\com\win32comext\axscript\client\pydumper.py:69:5: F821 undefined name 'CreateRegKey'
.\com\win32comext\axscript\client\pydumper.py:71:5: F821 undefined name 'win32com'
.\com\win32comext\axscript\client\pydumper.py:72:5: F821 undefined name 'win32com'
.\com\win32comext\shell\demos\servers\context_menu.py:52:23: F821 undefined name 'CMF_DEFAULTONLY'
.\com\win32comext\shell\demos\servers\shell_view.py:843:21: F821 undefined name 'file'

.\isapi\install.py:210:12: F821 undefined name 'exc'
.\isapi\install.py:210:30: F821 undefined name 'exc'
.\isapi\install.py:211:19: F821 undefined name 'exc'

.\pywin32_postinstall.py:692:15: F821 undefined name 'argparse'
.\win32\Lib\mmsystem.py:221:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:225:13: F821 undefined name 'DWORD'
.\win32\Lib\mmsystem.py:711:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:715:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:715:21: F821 undefined name 'WORD'
.\win32\Lib\mmsystem.py:719:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:723:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:727:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:727:21: F821 undefined name 'WORD'
.\win32\Lib\mmsystem.py:731:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:735:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:739:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:743:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:743:21: F821 undefined name 'WORD'
.\win32\Lib\mmsystem.py:747:13: F821 undefined name 'BYTE'
.\win32\Lib\mmsystem.py:954:12: F821 undefined name 'MAKELONG'
.\win32\Lib\pywin32_testutil.py:25:16: F821 undefined name 'buffer'
.\win32\Lib\pywin32_testutil.py:33:16: F821 undefined name 'buffer'
.\win32\Lib\win32gui_struct.py:92:20: F821 undefined name 'buffer'
.\win32\Lib\win32rcparser.py:604:12: F821 undefined name 'rcp'
.\win32\Lib\win32timezone.py:682:16: F821 undefined name 'cmp'
.\win32\Lib\winnt.py:164:13: F821 undefined name 'WORD'
.\win32\Lib\winnt.py:168:13: F821 undefined name 'WORD'
.\win32\Lib\winnt.py:175:13: F821 undefined name 'WORD'
.\win32\Lib\winnt.py:179:13: F821 undefined name 'WORD'
.\win32\Lib\winnt.py:179:22: F821 undefined name 'DWORD'
.\win32\Lib\winnt.py:933:13: F821 undefined name 'Ordinal'
.\win32\Lib\winnt.py:937:12: F821 undefined name 'Ordinal'
.\win32\scripts\VersionStamp\BrandProject.py:32:9: F821 undefined name 'SubstituteVSSInFile'
.\win32\scripts\VersionStamp\BrandProject.py:67:12: F821 undefined name 'getopts'
.\win32\scripts\backupEventLog.py:28:12: F821 undefined name 'win32evtlogutil'
.\win32\scripts\rasutil.py:41:9: F821 undefined name 'win32api'
.\win32\test\test_win32api.py:45:47: F821 undefined name 'time'
.\win32\test\test_win32api.py:51:38: F821 undefined name 'time'
.\win32\test\test_win32wnet.py:112:18: F821 undefined name 'Netbios'
.\win32\test\test_win32wnet.py:116:28: F821 undefined name 'byte_to_int'
.\win32\test\test_win32wnet.py:120:13: F821 undefined name 'Netbios'

which is the more serious group of errors.

Errors generated by:
  python -m flake8 . --ignore=W,E,F403,F405 --exclude=build | grep "undefined name"


Except
  .\pywin32_postinstall.py:692:15: F821 undefined name 'argparse'
which is fixed in an extra commit.
@Avasam
Copy link
Collaborator

Avasam commented Apr 21, 2023

@kxrob Do you think conflicts could be resolved?
Btw I believe the command to find these can be simplified to flake8 . --select=F821 --exclude=build, or ruff . --select=F821 --exclude=build if you wanna run it much faster.

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