Skip to content

Commit

Permalink
cosmetic pep8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jan 11, 2024
1 parent 92a2664 commit db1cfaa
Show file tree
Hide file tree
Showing 231 changed files with 1,166 additions and 1,144 deletions.
6 changes: 5 additions & 1 deletion fs/bin/build_cuda_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_nvcc_version(command):
print(f"found CUDA compiler {command!r} : {version_str}")
return tuple(int(x) for x in version.split("."))


def get_nvcc():
path_options = os.environ.get("PATH", "").split(os.path.pathsep)
if WIN32:
Expand Down Expand Up @@ -62,7 +63,8 @@ def get_nvcc():
print(f" using version {nvcc_version} from {nvcc}")
return nvcc, nvcc_version

def get_nvcc_args(nvcc:str, nvcc_version=(0, 0)):

def get_nvcc_args(nvcc: str, nvcc_version=(0, 0)):
if nvcc_version < (11, 6):
raise RuntimeError(f"nvcc version {nvcc_version} is too old, minimum is 11.6")
nvcc_cmd = [
Expand Down Expand Up @@ -99,6 +101,7 @@ def main(args):
nvcc_commands.append(kbuild_cmd)
#parallel build:
nvcc_errors = []

def nvcc_compile(nvcc_cmd):
c, stdout, stderr = get_status_output(nvcc_cmd)
if c!=0:
Expand All @@ -119,6 +122,7 @@ def nvcc_compile(nvcc_cmd):
t.join()
return len(nvcc_errors)


if __name__ == "__main__":
r = main(sys.argv)
sys.exit(r)
2 changes: 1 addition & 1 deletion xpra/audio/audio_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def cleanup(self) -> None:
self.volume = None

def onstart(self) -> None:
# we don't always get the "audio-codec" message..
# we don't always get the "audio-codec" message
# so print the codec from here instead (and assume gstreamer is using what we told it to)
# after a delay, just in case we do get the real "audio-codec" message!
self.timeout_add(500, self.new_codec_description, self.codec.split("+")[0])
Expand Down
4 changes: 2 additions & 2 deletions xpra/audio/gstreamer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def force_enabled(codec_name):
# format: encoder, container-formatter, decoder, container-parser, stream-compressor
# we keep multiple options here for the same encoding
# and will populate the ones that are actually available into the "CODECS" dict
CODEC_OPTIONS : tuple[tuple[str, str, str, str, str, str], ...] = (
CODEC_OPTIONS: tuple[tuple[str, str, str, str, str, str], ...] = (
(VORBIS_MKA , "vorbisenc", "matroskamux", "vorbisdec", "matroskademux", ""),
(VORBIS_MKA , "vorbisenc", "webmmux", "vorbisdec", "matroskademux", ""),
# those two used to fail silently (older versions of gstreamer?)
Expand All @@ -119,7 +119,7 @@ def force_enabled(codec_name):
(AAC_MPEG4 , "voaacenc", "mp4mux", "faad", "qtdemux", ""),
)

MUX_OPTIONS : tuple[tuple[str, str, str], ...] = (
MUX_OPTIONS: tuple[tuple[str, str, str], ...] = (
(OGG, "oggmux", "oggdemux"),
(MKA, "webmmux", "matroskademux"),
(MKA, "matroskamux", "matroskademux"),
Expand Down
2 changes: 1 addition & 1 deletion xpra/client/auth/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ def __repr__(self):
def get_digest(self) -> str:
return ""

def handle(self, challenge, digest:str, prompt:str) -> str: # pylint: disable=unused-argument
def handle(self, challenge, digest: str, prompt: str) -> str: # pylint: disable=unused-argument
return os.environ.get(self.var_name, "")
2 changes: 1 addition & 1 deletion xpra/client/auth/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Handler:

def __init__(self, client, **kwargs):
self.client = client
self.password_file : str = kwargs.get("filename", "")
self.password_file: str = kwargs.get("filename", "")
if not self.password_file and client.password_file:
self.password_file = client.password_file[0]
client.password_file = client.password_file[1:]
Expand Down
16 changes: 8 additions & 8 deletions xpra/client/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def defaults_init(self):
for k,v in os.environ.items():
log(f" {k}={v!r}")
#client state:
self.exit_code : int | ExitCode | None = None
self.exit_code: int | ExitCode | None = None
self.exit_on_signal = False
self.display_desc = {}
self.progress_process = None
Expand Down Expand Up @@ -682,7 +682,7 @@ def send_shutdown_server(self) -> None:
assert self.server_client_shutdown
self.send("shutdown-server")

def _process_disconnect(self, packet : PacketType) -> None:
def _process_disconnect(self, packet: PacketType) -> None:
#ie: ("disconnect", "version error", "incompatible version")
netlog("%s", packet)
info = tuple(nonl(bytestostr(x)) for x in packet[1:])
Expand Down Expand Up @@ -728,7 +728,7 @@ def server_disconnect_exit_code(self, reason: str, *extra_info) -> ExitCode:
return ExitCode.AUTHENTICATION_FAILED
return ExitCode.OK

def _process_connection_lost(self, _packet : PacketType) -> None:
def _process_connection_lost(self, _packet: PacketType) -> None:
p = self._protocol
if p and p.input_raw_packetcount==0:
props = p.get_info()
Expand All @@ -753,7 +753,7 @@ def _process_ssl_upgrade(self, packet: PacketType) -> None:
ssl_attrs = typedict(packet[1])
start_thread(self.ssl_upgrade, "ssl-upgrade", True, args=(ssl_attrs, ))

def ssl_upgrade(self, ssl_attrs : typedict) -> None:
def ssl_upgrade(self, ssl_attrs: typedict) -> None:
# send ssl-upgrade request!
ssllog = Logger("client", "ssl")
ssllog(f"ssl-upgrade({ssl_attrs})")
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def _process_hello(self, packet: PacketType) -> None:
netlog.info("error in hello packet", exc_info=True)
self.warn_and_quit(ExitCode.FAILURE, f"error processing hello packet from server: {e}")

def server_connection_established(self, caps : typedict) -> bool:
def server_connection_established(self, caps: typedict) -> bool:
netlog("server_connection_established(..)")
if not self.parse_encryption_capabilities(caps):
netlog("server_connection_established(..) failed encryption capabilities")
Expand All @@ -1094,7 +1094,7 @@ def server_connection_established(self, caps : typedict) -> bool:
self.init_authenticated_packet_handlers()
return True

def parse_server_capabilities(self, c : typedict) -> bool:
def parse_server_capabilities(self, c: typedict) -> bool:
for bc in XpraClientBase.__bases__:
if not bc.parse_server_capabilities(self, c):
log.info(f"server capabilities rejected by {bc}")
Expand All @@ -1103,7 +1103,7 @@ def parse_server_capabilities(self, c : typedict) -> bool:
self.server_compressors = c.strtupleget("compressors", )
return True

def parse_network_capabilities(self, caps : typedict) -> bool:
def parse_network_capabilities(self, caps: typedict) -> bool:
p = self._protocol
if p.TYPE=="rfb":
return True
Expand All @@ -1116,7 +1116,7 @@ def parse_network_capabilities(self, caps : typedict) -> bool:
netlog(f"self.server_packet_types={self.server_packet_types}")
return True

def parse_encryption_capabilities(self, caps : typedict) -> bool:
def parse_encryption_capabilities(self, caps: typedict) -> bool:
p = self._protocol
if not p:
return False
Expand Down
Loading

0 comments on commit db1cfaa

Please sign in to comment.