changeset 8850:755b2c66b462

pytype: mute errors from import of optional or platform specific modules Mute pytype warnings: File "kallithea/bin/kallithea_cli_iis.py", line 69, in iis_install: Can't find module 'isapi_wsgi'. [import-error] File "kallithea/config/post_receive_tmpl.py", line 24, in <module>: No attribute 'setmode' on module 'msvcrt' [module-attr] File "kallithea/config/pre_receive_tmpl.py", line 24, in <module>: No attribute 'setmode' on module 'msvcrt' [module-attr] File "kallithea/lib/compat.py", line 59, in kill: No attribute 'windll' on module 'ctypes' [module-attr] File "kallithea/lib/utils.py", line 242, in is_valid_repo_uri: Can't find module 'hgsubversion.svnrepo'. [import-error] File "kallithea/tests/scripts/manual_test_concurrency.py", line 203, in <module>: No attribute '_RandomNameSequence' on module 'tempfile' [module-attr]
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 18 Aug 2020 22:25:45 +0200
parents 618e09120d47
children 05406c312342
files kallithea/bin/kallithea_cli_iis.py kallithea/lib/compat.py kallithea/templates/py/git_post_receive_hook.py kallithea/tests/scripts/manual_test_concurrency.py
diffstat 4 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/kallithea_cli_iis.py	Thu Jan 14 21:46:10 2021 +0100
+++ b/kallithea/bin/kallithea_cli_iis.py	Tue Aug 18 22:25:45 2020 +0200
@@ -65,7 +65,7 @@
     config_file_abs = config['__file__']
 
     try:
-        import isapi_wsgi
+        import isapi_wsgi  # pytype: disable=import-error
         assert isapi_wsgi
     except ImportError:
         sys.stderr.write('missing requirement: isapi-wsgi not installed\n')
--- a/kallithea/lib/compat.py	Thu Jan 14 21:46:10 2021 +0100
+++ b/kallithea/lib/compat.py	Tue Aug 18 22:25:45 2020 +0200
@@ -56,7 +56,7 @@
 
     def kill(pid, sig):
         """kill function for Win32"""
-        kernel32 = ctypes.windll.kernel32
+        kernel32 = ctypes.windll.kernel32  # pytype: disable=module-attr
         handle = kernel32.OpenProcess(1, 0, pid)
         return (0 != kernel32.TerminateProcess(handle, 0))
 
--- a/kallithea/templates/py/git_post_receive_hook.py	Thu Jan 14 21:46:10 2021 +0100
+++ b/kallithea/templates/py/git_post_receive_hook.py	Tue Aug 18 22:25:45 2020 +0200
@@ -22,7 +22,7 @@
 # instead of the exception output.
 if sys.platform == "win32":
     import msvcrt
-    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+    msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)  # pytype: disable=module-attr
 
 KALLITHEA_HOOK_VER = '_TMPL_'
 os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
--- a/kallithea/tests/scripts/manual_test_concurrency.py	Thu Jan 14 21:46:10 2021 +0100
+++ b/kallithea/tests/scripts/manual_test_concurrency.py	Tue Aug 18 22:25:45 2020 +0200
@@ -199,7 +199,7 @@
             backend = 'hg'
 
         if METHOD == 'pull':
-            seq = next(tempfile._RandomNameSequence())
+            seq = next(tempfile._RandomNameSequence())  # pytype: disable=module-attr
             test_clone_with_credentials(repo=sys.argv[1], method='clone',
                                         backend=backend)
         s = time.time()