Skip to content

Commit 10821b2

Browse files
committed
Rename private GvmProtocol methods for handling requests
Make it more obvious that these methods are handling requests and responses.
1 parent 8fd3d4e commit 10821b2

File tree

6 files changed

+298
-237
lines changed

6 files changed

+298
-237
lines changed

gvm/protocols/_protocol.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ def send_command(self, cmd: str) -> str:
112112
string
113113
"""
114114
return bytes(
115-
self._send_command(cmd.encode("utf-8", errors="ignore")) # type: ignore[arg-type] # it seems mypy on Python < 3.11 can't handle bytes here
115+
self._send_request(cmd.encode("utf-8", errors="ignore")) # type: ignore[arg-type] # it seems mypy on Python < 3.11 can't handle bytes here
116116
).decode("utf-8", errors="ignore")
117117

118118
def _transform(self, response: Response) -> T:
119119
transform = self._transform_callable
120120
return transform(response)
121121

122-
def _send_command(self, cmd: Request) -> Response:
122+
def _send_request(self, request: Request) -> Response:
123123
try:
124-
send_data = self._protocol.send(cmd)
124+
send_data = self._protocol.send(request)
125125
self._send(send_data)
126126
response: Optional[Response] = None
127127
while not response:
@@ -132,5 +132,5 @@ def _send_command(self, cmd: Request) -> Response:
132132
self.disconnect()
133133
raise e
134134

135-
def _send_and_transform_command(self, cmd: Request) -> T:
136-
return self._transform(self._send_command(cmd))
135+
def _send_request_and_transform_response(self, request: Request) -> T:
136+
return self._transform(self._send_request(request))

gvm/protocols/gmp/_gmp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(
7171
def determine_remote_gmp_version(self) -> str:
7272
"""Determine the supported GMP version of the remote daemon"""
7373
self.connect()
74-
resp = self._send_command(Version.get_version())
74+
resp = self._send_request(Version.get_version())
7575
self.disconnect()
7676

7777
version_el = resp.xml().find("version")

0 commit comments

Comments
 (0)