Skip to content

Commit 1772289

Browse files
committed
Remove unnecessary parentheses on return statements
1 parent 266a25f commit 1772289

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

asyncssh/channel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,16 +2065,16 @@ async def connect(self, session_factory: SSHTCPSessionFactory[AnyStr],
20652065
SSHTCPSession[AnyStr]:
20662066
"""Create a new outbound TCP session"""
20672067

2068-
return (await self._open_tcp(session_factory, b'direct-tcpip',
2069-
host, port, orig_host, orig_port))
2068+
return await self._open_tcp(session_factory, b'direct-tcpip',
2069+
host, port, orig_host, orig_port)
20702070

20712071
async def accept(self, session_factory: SSHTCPSessionFactory[AnyStr],
20722072
host: str, port: int, orig_host: str,
20732073
orig_port: int) -> SSHTCPSession[AnyStr]:
20742074
"""Create a new forwarded TCP session"""
20752075

2076-
return (await self._open_tcp(session_factory, b'forwarded-tcpip',
2077-
host, port, orig_host, orig_port))
2076+
return await self._open_tcp(session_factory, b'forwarded-tcpip',
2077+
host, port, orig_host, orig_port)
20782078

20792079
def set_inbound_peer_names(self, dest_host: str, dest_port: int,
20802080
orig_host: str, orig_port: int) -> None:

asyncssh/connection.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,9 +3236,8 @@ async def tunnel_connection(
32363236
raise ChannelOpenError(OPEN_ADMINISTRATIVELY_PROHIBITED,
32373237
'Connection forwarding denied')
32383238

3239-
return (await self.create_connection(session_factory,
3240-
dest_host, dest_port,
3241-
orig_host, orig_port))
3239+
return await self.create_connection(session_factory, dest_host,
3240+
dest_port, orig_host, orig_port)
32423241

32433242
if (listen_host, listen_port) == (dest_host, dest_port):
32443243
self.logger.info('Creating local TCP forwarder on %s',
@@ -5058,8 +5057,8 @@ async def create_ssh_connection(self, client_factory: _ClientFactory,
50585057
50595058
"""
50605059

5061-
return (await create_connection(client_factory, host, port,
5062-
tunnel=self, **kwargs)) # type: ignore
5060+
return await create_connection(client_factory, host, port,
5061+
tunnel=self, **kwargs) # type: ignore
50635062

50645063
@async_context_manager
50655064
async def connect_ssh(self, host: str, port: DefTuple[int] = (),
@@ -5327,8 +5326,7 @@ async def tunnel_connection(
53275326
raise ChannelOpenError(OPEN_ADMINISTRATIVELY_PROHIBITED,
53285327
'Connection forwarding denied')
53295328

5330-
return (await self.create_unix_connection(session_factory,
5331-
dest_path))
5329+
return await self.create_unix_connection(session_factory, dest_path)
53325330

53335331
self.logger.info('Creating local TCP forwarder from %s to %s',
53345332
(listen_host, listen_port), dest_path)

asyncssh/sftp.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5262,7 +5262,7 @@ async def exists(self, path: _SFTPPath) -> bool:
52625262
52635263
"""
52645264

5265-
return (await self._type(path)) != FILEXFER_TYPE_UNKNOWN
5265+
return await self._type(path) != FILEXFER_TYPE_UNKNOWN
52665266

52675267
async def lexists(self, path: _SFTPPath) -> bool:
52685268
"""Return if the remote path exists, without following symbolic links
@@ -5275,7 +5275,7 @@ async def lexists(self, path: _SFTPPath) -> bool:
52755275
52765276
"""
52775277

5278-
return (await self._type(path, statfunc=self.lstat)) != \
5278+
return await self._type(path, statfunc=self.lstat) != \
52795279
FILEXFER_TYPE_UNKNOWN
52805280

52815281
async def getatime(self, path: _SFTPPath) -> Optional[float]:
@@ -5404,7 +5404,7 @@ async def isdir(self, path: _SFTPPath) -> bool:
54045404
54055405
"""
54065406

5407-
return (await self._type(path)) == FILEXFER_TYPE_DIRECTORY
5407+
return await self._type(path) == FILEXFER_TYPE_DIRECTORY
54085408

54095409
async def isfile(self, path: _SFTPPath) -> bool:
54105410
"""Return if the remote path refers to a regular file
@@ -5417,7 +5417,7 @@ async def isfile(self, path: _SFTPPath) -> bool:
54175417
54185418
"""
54195419

5420-
return (await self._type(path)) == FILEXFER_TYPE_REGULAR
5420+
return await self._type(path) == FILEXFER_TYPE_REGULAR
54215421

54225422
async def islink(self, path: _SFTPPath) -> bool:
54235423
"""Return if the remote path refers to a symbolic link
@@ -5430,7 +5430,7 @@ async def islink(self, path: _SFTPPath) -> bool:
54305430
54315431
"""
54325432

5433-
return (await self._type(path, statfunc=self.lstat)) == \
5433+
return await self._type(path, statfunc=self.lstat) == \
54345434
FILEXFER_TYPE_SYMLINK
54355435

54365436
async def remove(self, path: _SFTPPath) -> None:
@@ -8171,12 +8171,12 @@ async def _type(self, path: bytes) -> int:
81718171
async def exists(self, path: bytes) -> bool:
81728172
"""Return if a path exists"""
81738173

8174-
return (await self._type(path)) != FILEXFER_TYPE_UNKNOWN
8174+
return await self._type(path) != FILEXFER_TYPE_UNKNOWN
81758175

81768176
async def isdir(self, path: bytes) -> bool:
81778177
"""Return if the path refers to a directory"""
81788178

8179-
return (await self._type(path)) == FILEXFER_TYPE_DIRECTORY
8179+
return await self._type(path) == FILEXFER_TYPE_DIRECTORY
81808180

81818181
def scandir(self, path: bytes) -> AsyncIterator[SFTPName]:
81828182
"""Return names and attributes of the files in a directory"""

0 commit comments

Comments
 (0)