Changeset - 755b2c66b462
[Not reviewed]
default
0 4 0
Mads Kiilerich (mads) - 6 years ago 2020-08-18 22:25:45
mads@kiilerich.com
Grafted from: 322508f5a0ba
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]
4 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_iis.py
Show inline comments
 
@@ -62,13 +62,13 @@ if __name__=='__main__':
 
def iis_install(virtualdir, config):
 
    """Install into IIS using isapi-wsgi."""
 

	
 
    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')
 
        sys.exit(1)
 

	
 
    dispatchfile = os.path.join(os.getcwd(), 'dispatch.py')
kallithea/lib/compat.py
Show inline comments
 
@@ -53,13 +53,13 @@ formatted_json = functools.partial(ext_j
 
#==============================================================================
 
if os.name == 'nt': # Windows
 
    import ctypes
 

	
 
    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))
 

	
 
else:
 
    kill = os.kill
 

	
kallithea/templates/py/git_post_receive_hook.py
Show inline comments
 
@@ -19,13 +19,13 @@ import kallithea.bin.vcs_hooks
 
# This prevents python (or the windows console) from replacing \n with \r\n.
 
# Git doesn't display remote output lines that contain \r,
 
# and therefore without this modification git would display empty lines
 
# 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
 

	
 

	
 
def main():
kallithea/tests/scripts/manual_test_concurrency.py
Show inline comments
 
@@ -196,13 +196,13 @@ if __name__ == '__main__':
 
        try:
 
            backend = sys.argv[4]
 
        except IndexError:
 
            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()
 
        for i in range(1, int(sys.argv[2]) + 1):
 
            print('take', i)
 
            test_clone_with_credentials(repo=sys.argv[1], method=METHOD,
0 comments (0 inline, 0 general)