Skip to content

Commit fa01aab

Browse files
committed
Fix a few lint issues
1 parent 416db0e commit fa01aab

File tree

7 files changed

+32
-26
lines changed

7 files changed

+32
-26
lines changed

asyncssh/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
from . import sk_eddsa, sk_ecdsa, eddsa, ecdsa, rsa, dsa, kex_dh, kex_rsa
123123

124124
__all__ = [
125+
'__author__', '__author_email__', '__url__', '__version__',
125126
'BreakReceived', 'BytesOrStr', 'ChannelListenError',
126127
'ChannelOpenError', 'CompressionError', 'ConfigParseError',
127128
'ConnectionLost', 'DEVNULL', 'DataType', 'DisconnectError', 'Error',
@@ -136,15 +137,15 @@
136137
'SFTPDirNotEmpty', 'SFTPEOFError', 'SFTPError', 'SFTPFailure',
137138
'SFTPFileAlreadyExists', 'SFTPFileCorrupt', 'SFTPFileIsADirectory',
138139
'SFTPGroupInvalid', 'SFTPInvalidFilename', 'SFTPInvalidHandle',
139-
'SFTPInvalidParameter', 'SFTPLinkLoop', 'SFTPLockConflict', 'SFTPName',
140-
'SFTPNoConnection', 'SFTPNoMatchingByteRangeLock', 'SFTPNoMedia',
141-
'SFTPNoSpaceOnFilesystem', 'SFTPNoSuchFile', 'SFTPNoSuchPath',
142-
'SFTPNotADirectory', 'SFTPOpUnsupported', 'SFTPOwnerInvalid',
143-
'SFTPPermissionDenied', 'SFTPQuotaExceeded', 'SFTPServer',
144-
'SFTPServerFactory', 'SFTPUnknownPrincipal', 'SFTPVFSAttrs',
145-
'SFTPWriteProtect', 'SSHAcceptor', 'SSHAgentClient', 'SSHAgentKeyPair',
146-
'SSHAuthorizedKeys', 'SSHCertificate', 'SSHClient', 'SSHClientChannel',
147-
'SSHClientConnection', 'SSHClientConnectionOptions',
140+
'SFTPInvalidParameter', 'SFTPLimits', 'SFTPLinkLoop', 'SFTPLockConflict',
141+
'SFTPName', 'SFTPNoConnection', 'SFTPNoMatchingByteRangeLock',
142+
'SFTPNoMedia', 'SFTPNoSpaceOnFilesystem', 'SFTPNoSuchFile',
143+
'SFTPNoSuchPath', 'SFTPNotADirectory', 'SFTPOpUnsupported',
144+
'SFTPOwnerInvalid', 'SFTPPermissionDenied', 'SFTPQuotaExceeded',
145+
'SFTPServer', 'SFTPServerFactory', 'SFTPUnknownPrincipal', 'SFTPVFSAttrs',
146+
'SFTPWriteProtect', 'SSHAcceptHandler', 'SSHAcceptor', 'SSHAgentClient',
147+
'SSHAgentKeyPair', 'SSHAuthorizedKeys', 'SSHCertificate', 'SSHClient',
148+
'SSHClientChannel', 'SSHClientConnection', 'SSHClientConnectionOptions',
148149
'SSHClientProcess', 'SSHClientSession', 'SSHCompletedProcess',
149150
'SSHForwarder', 'SSHKey', 'SSHKeyPair', 'SSHKnownHosts',
150151
'SSHLineEditorChannel', 'SSHListener', 'SSHReader', 'SSHServer',

asyncssh/agent.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"""SSH agent client"""
2222

2323
import asyncio
24-
import errno
2524
import os
2625
import sys
2726
from types import TracebackType
@@ -58,17 +57,10 @@ async def wait_closed(self) -> None:
5857
"""Wait for the connection to the SSH agent to close"""
5958

6059

61-
try:
62-
if sys.platform == 'win32': # pragma: no cover
63-
from .agent_win32 import open_agent
64-
else:
65-
from .agent_unix import open_agent
66-
except ImportError as _exc: # pragma: no cover
67-
async def open_agent(agent_path: str) -> \
68-
Tuple[AgentReader, AgentWriter]:
69-
"""Dummy function if we're unable to import agent support"""
70-
71-
raise OSError(errno.ENOENT, 'Agent support unavailable: %s' % str(_exc))
60+
if sys.platform == 'win32': # pragma: no cover
61+
from .agent_win32 import open_agent
62+
else:
63+
from .agent_unix import open_agent
7264

7365

7466
class _SupportsOpenAgentConnection(Protocol):

asyncssh/auth_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _add_permitopen(self, option: str, value: str) -> None:
120120
host = host[1:-1]
121121

122122
port = None if port_str == '*' else int(port_str)
123-
except:
123+
except ValueError:
124124
raise ValueError('Illegal permitopen value: %s' % value) from None
125125

126126
permitted_opens = cast(Set[Tuple[str, Optional[int]]],

asyncssh/crypto/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,16 @@
5757
from .x509 import generate_x509_certificate, import_x509_certificate
5858
except (ImportError, AttributeError): # pragma: no cover
5959
pass
60+
61+
__all__ = [
62+
'BasicCipher', 'ChachaCipher', 'CryptoKey', 'Curve25519DH', 'Curve448DH',
63+
'DH', 'DSAPrivateKey', 'DSAPublicKey', 'ECDH', 'ECDSAPrivateKey',
64+
'ECDSAPublicKey', 'EdDSAPrivateKey', 'EdDSAPublicKey', 'GCMCipher', 'PQDH',
65+
'PyCAKey', 'RSAPrivateKey', 'RSAPublicKey', 'chacha_available',
66+
'curve25519_available', 'curve448_available', 'X509Certificate',
67+
'X509Name', 'X509NamePattern', 'ed25519_available', 'ed448_available',
68+
'generate_x509_certificate', 'get_cipher_params', 'import_x509_certificate',
69+
'lookup_ec_curve_by_params', 'mlkem_available', 'pbkdf2_hmac',
70+
'register_cipher', 'sntrup_available', 'umac32', 'umac64', 'umac96',
71+
'umac128'
72+
]

asyncssh/scp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ async def run(self, dstpath: _SCPPath) -> None:
724724
dstpath))
725725
else:
726726
await self._recv_files(b'', dstpath)
727-
except asyncio.CancelledError as exc:
727+
except asyncio.CancelledError:
728728
cancelled = True
729729
except (OSError, SFTPError, ValueError) as exc:
730730
self.handle_error(exc)

asyncssh/sftp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,7 @@ async def start(self) -> None:
26602660
rcvd_extensions.append((name, data))
26612661
except PacketDecodeError as exc:
26622662
raise SFTPBadMessage(str(exc)) from None
2663-
except SFTPError as exc:
2663+
except SFTPError:
26642664
raise
26652665
except ConnectionLost as exc:
26662666
raise SFTPConnectionLost(str(exc)) from None
@@ -5715,7 +5715,7 @@ async def _process_packet(self, pkttype: int, pktid: int,
57155715
str(exc.reason))
57165716

57175717
response = exc.encode(self._version)
5718-
except NotImplementedError as exc:
5718+
except NotImplementedError:
57195719
assert handler is not None
57205720

57215721
return_type = FXP_STATUS

asyncssh/sk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def sk_enroll(alg: int, application: bytes, user: str,
173173
raise ValueError('Invalid PIN') from None
174174
else:
175175
raise ValueError(str(exc)) from None
176-
except ValueError as exc:
176+
except ValueError:
177177
try:
178178
return _ctap1_enroll(dev, alg, application)
179179
except ApduError as exc:

0 commit comments

Comments
 (0)