@@ -60,15 +60,15 @@ def _init_socket(self):
60
60
return clamd_socket
61
61
62
62
def ping (self ):
63
- """ Sends the ping command to the ClamAV daemon """
63
+ """Sends the ping command to the ClamAV daemon"""
64
64
return self ._basic_command ("PING" )
65
65
66
66
def version (self ):
67
- """ Sends the version command to the ClamAV daemon """
67
+ """Sends the version command to the ClamAV daemon"""
68
68
return self ._basic_command ("VERSION" )
69
69
70
70
def reload (self ):
71
- """ Sends the reload command to the ClamAV daemon """
71
+ """Sends the reload command to the ClamAV daemon"""
72
72
return self ._basic_command ("RELOAD" )
73
73
74
74
def shutdown (self ):
@@ -88,19 +88,19 @@ def shutdown(self):
88
88
self ._close_socket ()
89
89
90
90
def scan (self , filename ):
91
- """ Scan a file. """
91
+ """Scan a file."""
92
92
return self ._file_system_scan ("SCAN" , filename )
93
93
94
94
def cont_scan (self , filename ):
95
- """ Scan a file but don't stop if a virus is found. """
95
+ """Scan a file but don't stop if a virus is found."""
96
96
return self ._file_system_scan ("CONTSCAN" , filename )
97
97
98
98
def multi_scan (self , filename ):
99
- """ Scan a file using multiple threads. """
99
+ """Scan a file using multiple threads."""
100
100
return self ._file_system_scan ("MULTISCAN" , filename )
101
101
102
102
def _basic_command (self , command ):
103
- """ Send a command to the clamav server, and return the reply. """
103
+ """Send a command to the clamav server, and return the reply."""
104
104
self ._init_socket ()
105
105
try :
106
106
self ._send_command (command )
@@ -212,7 +212,7 @@ def _send_command(self, cmd, *args):
212
212
self .socket .sendall (cmd )
213
213
214
214
def _recv_response (self ):
215
- """ Receive line from clamd """
215
+ """Receive line from clamd"""
216
216
try :
217
217
with contextlib .closing (self .socket .makefile ("rb" )) as file_object :
218
218
return file_object .readline ().decode ("utf-8" ).strip ()
@@ -222,7 +222,7 @@ def _recv_response(self):
222
222
) from error
223
223
224
224
def _recv_response_multiline (self ):
225
- """ Receive multiple line response from clamd and strip all whitespace characters """
225
+ """Receive multiple line response from clamd and strip all whitespace characters"""
226
226
try :
227
227
with contextlib .closing (self .socket .makefile ("rb" )) as file_object :
228
228
return file_object .read ().decode ("utf-8" )
@@ -232,12 +232,12 @@ def _recv_response_multiline(self):
232
232
) from error
233
233
234
234
def _close_socket (self ):
235
- """ Close clamd socket """
235
+ """Close clamd socket"""
236
236
self .socket .close ()
237
237
238
238
239
239
def parse_response (msg ):
240
- """ Parses responses for SCAN, CONTSCAN, MULTISCAN and STREAM commands. """
240
+ """Parses responses for SCAN, CONTSCAN, MULTISCAN and STREAM commands."""
241
241
242
242
scan_response = re .compile (
243
243
r"^(?P<path>.*): ((?P<virus>.+) )?(?P<status>(FOUND|OK|ERROR))$"
0 commit comments