comparison hgext/fsmonitor/pywatchman/__init__.py @ 49857:ab32fd8412a7

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 05 Jan 2023 17:31:11 -0500
parents 40d3ee570d83
children 493034cc3265
comparison
equal deleted inserted replaced
49856:40d3ee570d83 49857:ab32fd8412a7
984 984
985 if os.name == "nt": 985 if os.name == "nt":
986 # if invoked via an application with graphical user interface, 986 # if invoked via an application with graphical user interface,
987 # this call will cause a brief command window pop-up. 987 # this call will cause a brief command window pop-up.
988 # Using the flag STARTF_USESHOWWINDOW to avoid this behavior. 988 # Using the flag STARTF_USESHOWWINDOW to avoid this behavior.
989
990 # pytype: disable=module-attr
989 startupinfo = subprocess.STARTUPINFO() 991 startupinfo = subprocess.STARTUPINFO()
990 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW 992 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
993 # pytype: enable=module-attr
994
991 args["startupinfo"] = startupinfo 995 args["startupinfo"] = startupinfo
992 996
993 p = subprocess.Popen(cmd, **args) 997 p = subprocess.Popen(cmd, **args)
994 998
995 except OSError as e: 999 except OSError as e:
1022 1026
1023 kwargs = {} 1027 kwargs = {}
1024 if self.transport == CLIProcessTransport: 1028 if self.transport == CLIProcessTransport:
1025 kwargs["binpath"] = self.binpath 1029 kwargs["binpath"] = self.binpath
1026 1030
1031 # Only CLIProcessTransport has the binpath kwarg
1032 # pytype: disable=wrong-keyword-args
1027 self.tport = self.transport(self.sockpath, self.timeout, **kwargs) 1033 self.tport = self.transport(self.sockpath, self.timeout, **kwargs)
1034 # pytype: enable=wrong-keyword-args
1035
1028 self.sendConn = self.sendCodec(self.tport) 1036 self.sendConn = self.sendCodec(self.tport)
1029 self.recvConn = self.recvCodec(self.tport) 1037 self.recvConn = self.recvCodec(self.tport)
1030 self.pid = os.getpid() 1038 self.pid = os.getpid()
1031 1039
1032 def __del__(self): 1040 def __del__(self):