From 6c8fbebb16f4cc049279ac929d775b117628ed11 Mon Sep 17 00:00:00 2001 From: Emeric Million Date: Mon, 26 Sep 2016 17:31:23 +0200 Subject: [PATCH] add code checker flake8 --- .gitignore | 1 + Makefile | 2 ++ rblwatch/__init__.py | 2 +- rblwatch/rblwatch.py | 12 +++++++----- setup.py | 24 ++++++++++++------------ 5 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 0c50ea5..9cc44d1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ # distutils dist/ MANIFEST +build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8f3cf93 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +lint: + flake8 --exclude=build,dist,tests/samples.py . diff --git a/rblwatch/__init__.py b/rblwatch/__init__.py index 20e36bc..8898b44 100644 --- a/rblwatch/__init__.py +++ b/rblwatch/__init__.py @@ -1 +1 @@ -from .rblwatch import RBLSearch +from .rblwatch import RBLSearch # NOQA diff --git a/rblwatch/rblwatch.py b/rblwatch/rblwatch.py index 0eb5c33..f3e0a37 100644 --- a/rblwatch/rblwatch.py +++ b/rblwatch/rblwatch.py @@ -125,6 +125,7 @@ def run(self): self.listed[self.dnslist]['ERROR'] = True self.listed[self.dnslist]['ERRORTYPE'] = NoAnswer + class RBLSearch(object): def __init__(self, lookup_host): self.lookup_host = lookup_host @@ -147,7 +148,8 @@ def search(self, RBLS=RBLS): threads = [] for LIST in RBLS: self._listed[LIST] = {'LISTED': False} - query = Lookup("%s.%s" % (host, LIST), LIST, self._listed, self.resolver) + query = Lookup( + "%s.%s" % (host, LIST), LIST, self._listed, self.resolver) threads.append(query) query.start() for thread in threads: @@ -165,13 +167,13 @@ def print_results(self): if not listed[key].get('ERROR'): if listed[key]['LISTED']: print("Results for %s: %s" % (key, listed[key]['LISTED'])) - print(" + Host information: %s" % \ + print(" + Host information: %s" % (listed[key]['HOST'])) if 'TEXT' in listed[key].keys(): - print(" + Additional information: %s" % \ + print(" + Additional information: %s" % (listed[key]['TEXT'])) else: - #print "*** Error contacting %s ***" % key + # print "*** Error contacting %s ***" % key pass if __name__ == "__main__": @@ -185,7 +187,7 @@ def print_results(self): if not is_ip_address: try: ip = socket.gethostbyname(ip) - print("Hostname %s resolved to ip %s" % (sys.argv[1],ip)) + print("Hostname %s resolved to ip %s" % (sys.argv[1], ip)) except socket.error: print("IP %s can't be resolved" % ip) ip = "" diff --git a/setup.py b/setup.py index 90ea6a8..706caad 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,15 @@ from distutils.core import setup setup( - name = 'rblwatch', - packages = ['rblwatch'], - scripts = ['bin/rblcheck', 'bin/rblwatch'], - version = '0.2.4', - description = 'RBL lookups with Python', - author = 'James Polera', - author_email = 'james@uncryptic.com', - maintainer = 'Thomas Merkel', - maintainer_email = 'tm@core.io', - url = 'https://github.com/drscream/rblwatch', - keywords = ['rbl', 'blacklist', 'mail'], - install_requires = ['IPy', 'dnspython'], + name='rblwatch', + packages=['rblwatch'], + scripts=['bin/rblcheck', 'bin/rblwatch'], + version='0.2.4', + description='RBL lookups with Python', + author='James Polera', + author_email='james@uncryptic.com', + maintainer='Thomas Merkel', + maintainer_email='tm@core.io', + url='https://github.com/drscream/rblwatch', + keywords=['rbl', 'blacklist', 'mail'], + install_requires=['IPy', 'dnspython'], )