Skip to content

Commit 2fe55af

Browse files
committed
move doctests to README.rst
1 parent 683fe3e commit 2fe55af

File tree

3 files changed

+54
-56
lines changed

3 files changed

+54
-56
lines changed

README.rst

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,53 @@
1-
clamd
2-
=====
3-
4-
.. image:: https://travis-ci.org/graingert/python-clamd.png?branch=master
5-
:alt: travis build status
6-
:target: https://travis-ci.org/graingert/python-clamd
7-
8-
About
9-
-----
10-
`clamd` is a portable Python module to use the ClamAV anti-virus engine on
11-
Windows, Linux, MacOSX and other platforms. It requires a running instance of
12-
the `clamd` daemon.
13-
14-
This is a fork of pyClamd v0.2.0 created by Philippe Lagadec and published on his website: http://www.decalage.info/en/python/pyclamd which in turn is a slightly improved version of pyClamd v0.1.1 created by Alexandre Norman and published on his website: http://xael.org/norman/python/pyclamd/
15-
16-
License
17-
-------
18-
`clamd` is released as open-source software under the LGPL license.
19-
20-
clamd Install
21-
-------------
22-
How to install the ClamAV daemon `clamd` under Ubuntu::
23-
24-
sudo apt-get install clamav-daemon clamav-freshclam clamav-unofficial-sigs
25-
sudo freshclam
26-
sudo service clamav-daemon start
1+
clamd
2+
=====
3+
4+
.. image:: https://travis-ci.org/graingert/python-clamd.png?branch=master
5+
:alt: travis build status
6+
:target: https://travis-ci.org/graingert/python-clamd
7+
8+
About
9+
-----
10+
`clamd` is a portable Python module to use the ClamAV anti-virus engine on
11+
Windows, Linux, MacOSX and other platforms. It requires a running instance of
12+
the `clamd` daemon.
13+
14+
This is a fork of pyClamd v0.2.0 created by Philippe Lagadec and published on his website: http://www.decalage.info/en/python/pyclamd which in turn is a slightly improved version of pyClamd v0.1.1 created by Alexandre Norman and published on his website: http://xael.org/norman/python/pyclamd/
15+
16+
Usage
17+
-----
18+
19+
To use with a unix socket::
20+
21+
>>> import clamd
22+
>>> cd = clamd.ClamdUnixSocket()
23+
>>> cd.ping()
24+
u'PONG'
25+
>>> cd.version() # doctest: +ELLIPSIS
26+
u'ClamAV ...
27+
>>> cd.reload()
28+
u'RELOADING'
29+
30+
To scan a file::
31+
32+
>>> open('/tmp/EICAR','wb').write(clamd.EICAR)
33+
>>> cd.scan('/tmp/EICAR')
34+
{u'/tmp/EICAR': (u'FOUND', u'Eicar-Test-Signature')}
35+
36+
To scan a stream::
37+
38+
>>> from six import BytesIO
39+
>>> cd.instream(BytesIO(clamd.EICAR))
40+
{u'stream': (u'FOUND', u'Eicar-Test-Signature')}
41+
42+
43+
License
44+
-------
45+
`clamd` is released as open-source software under the LGPL license.
46+
47+
clamd Install
48+
-------------
49+
How to install the ClamAV daemon `clamd` under Ubuntu::
50+
51+
sudo apt-get install clamav-daemon clamav-freshclam clamav-unofficial-sigs
52+
sudo freshclam
53+
sudo service clamav-daemon start

clamd.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
from __future__ import unicode_literals
4-
"""
5-
clamd.py
6-
7-
Author : Alexandre Norman - norman()xael.org
8-
Contributors :
9-
Philippe Lagadec - philippe.lagadec()laposte.net
10-
Thomas Kastner - tk()underground8.com
11-
Licence : LGPL
12-
13-
Usage :
14-
15-
Test strings :
16-
^^^^^^^^^^^^
17-
18-
>>> import clamd
19-
>>> from six import BytesIO
20-
>>> cd = clamd.ClamdUnixSocket()
21-
>>> cd.ping()
22-
True
23-
>>> cd.version().split()[0]
24-
'ClamAV'
25-
>>> cd.reload()
26-
'RELOADING'
27-
>>> open('/tmp/EICAR','wb').write(clamd.EICAR)
28-
>>> cd.scan('/tmp/EICAR')
29-
{'/tmp/EICAR': ('FOUND', 'Eicar-Test-Signature')}
30-
>>> cd.instream(BytesIO(clamd.EICAR))
31-
{'stream': ('FOUND', 'Eicar-Test-Signature')}
32-
33-
"""
344

355
try:
366
__version__ = __import__('pkg_resources').get_distribution('clamd').version

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ tests-require = six
2828

2929
[nosetests]
3030
with-doctest=1
31+
doctest-extension=rst

0 commit comments

Comments
 (0)