Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Ready for v1.0.0 (#14)
Browse files Browse the repository at this point in the history
* Bump black from 19.10b0 to 21.12b0

Bumps [black](https://github.com/psf/black) from 19.10b0 to 21.12b0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump to v1.0.0 (#13)

* Bump pytest from 5.4.3 to 6.2.5 (#12)

Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.4.3 to 6.2.5.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@5.4.3...6.2.5)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Linting and bumping deps

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
ranguli and dependabot[bot] authored Jan 18, 2022
1 parent 2170210 commit ea1dd2d
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 197 deletions.
22 changes: 11 additions & 11 deletions clammy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ def _init_socket(self):
return clamd_socket

def ping(self):
""" Sends the ping command to the ClamAV daemon """
"""Sends the ping command to the ClamAV daemon"""
return self._basic_command("PING")

def version(self):
""" Sends the version command to the ClamAV daemon """
"""Sends the version command to the ClamAV daemon"""
return self._basic_command("VERSION")

def reload(self):
""" Sends the reload command to the ClamAV daemon """
"""Sends the reload command to the ClamAV daemon"""
return self._basic_command("RELOAD")

def shutdown(self):
Expand All @@ -88,19 +88,19 @@ def shutdown(self):
self._close_socket()

def scan(self, filename):
""" Scan a file. """
"""Scan a file."""
return self._file_system_scan("SCAN", filename)

def cont_scan(self, filename):
""" Scan a file but don't stop if a virus is found. """
"""Scan a file but don't stop if a virus is found."""
return self._file_system_scan("CONTSCAN", filename)

def multi_scan(self, filename):
""" Scan a file using multiple threads. """
"""Scan a file using multiple threads."""
return self._file_system_scan("MULTISCAN", filename)

def _basic_command(self, command):
""" Send a command to the clamav server, and return the reply. """
"""Send a command to the clamav server, and return the reply."""
self._init_socket()
try:
self._send_command(command)
Expand Down Expand Up @@ -212,7 +212,7 @@ def _send_command(self, cmd, *args):
self.socket.sendall(cmd)

def _recv_response(self):
""" Receive line from clamd """
"""Receive line from clamd"""
try:
with contextlib.closing(self.socket.makefile("rb")) as file_object:
return file_object.readline().decode("utf-8").strip()
Expand All @@ -222,7 +222,7 @@ def _recv_response(self):
) from error

def _recv_response_multiline(self):
""" Receive multiple line response from clamd and strip all whitespace characters """
"""Receive multiple line response from clamd and strip all whitespace characters"""
try:
with contextlib.closing(self.socket.makefile("rb")) as file_object:
return file_object.read().decode("utf-8")
Expand All @@ -232,12 +232,12 @@ def _recv_response_multiline(self):
) from error

def _close_socket(self):
""" Close clamd socket """
"""Close clamd socket"""
self.socket.close()


def parse_response(msg):
""" Parses responses for SCAN, CONTSCAN, MULTISCAN and STREAM commands. """
"""Parses responses for SCAN, CONTSCAN, MULTISCAN and STREAM commands."""

scan_response = re.compile(
r"^(?P<path>.*): ((?P<virus>.+) )?(?P<status>(FOUND|OK|ERROR))$"
Expand Down
4 changes: 3 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
@session(python=["3.7", "3.8", "3.9"])
def test(session):
session.run(
"pytest", "-vvv", external=True,
"pytest",
"-vvv",
external=True,
)


Expand Down
Loading

0 comments on commit ea1dd2d

Please sign in to comment.