typing: disable a few incorrect warnings in pywatchman
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 05 Jan 2023 17:31:11 -0500
changeset 49857 ab32fd8412a7
parent 49856 40d3ee570d83
child 49858 8cb848601bec
typing: disable a few incorrect warnings in pywatchman The module-attr warnings are for things that only exist on Windows, and the wrong-keyword-args warning is due to a special case for a specific constructor. Both of these are properly conditionalized.
hgext/fsmonitor/pywatchman/__init__.py
--- a/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:28:33 2023 -0500
+++ b/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:31:11 2023 -0500
@@ -986,8 +986,12 @@
                 # if invoked via an application with graphical user interface,
                 # this call will cause a brief command window pop-up.
                 # Using the flag STARTF_USESHOWWINDOW to avoid this behavior.
+
+                # pytype: disable=module-attr
                 startupinfo = subprocess.STARTUPINFO()
                 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+                # pytype: enable=module-attr
+
                 args["startupinfo"] = startupinfo
 
             p = subprocess.Popen(cmd, **args)
@@ -1024,7 +1028,11 @@
         if self.transport == CLIProcessTransport:
             kwargs["binpath"] = self.binpath
 
+        # Only CLIProcessTransport has the binpath kwarg
+        # pytype: disable=wrong-keyword-args
         self.tport = self.transport(self.sockpath, self.timeout, **kwargs)
+        # pytype: enable=wrong-keyword-args
+
         self.sendConn = self.sendCodec(self.tport)
         self.recvConn = self.recvCodec(self.tport)
         self.pid = os.getpid()