From 52f1450e6d485275a14a281eb3854a0fedc03b35 Mon Sep 17 00:00:00 2001 From: Brian Cline Date: Wed, 20 Nov 2013 20:16:03 -0600 Subject: [PATCH] Several static analysis fixes, v2.0.2 * Don't use relative imports * Remove __version__ from module init, unnecessary maintenance * Change Classifier to "new" style class * Don't redefine built-in list * Fix typo when calling os.makedirs --- crm114/__init__.py | 3 +-- crm114/classifier.py | 12 ++++++------ setup.py | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crm114/__init__.py b/crm114/__init__.py index 4f8b9bf..ca9eaa9 100644 --- a/crm114/__init__.py +++ b/crm114/__init__.py @@ -1,6 +1,5 @@ -from classifier import Classifier +from crm114.classifier import Classifier -__version__ = "1.0.0a1" __license__ = '(c) 2005 Sam Deane. ' \ '(c) 2013 Brian Cline. ' \ 'MIT License. See LICENSE file for details.' diff --git a/crm114/classifier.py b/crm114/classifier.py index 53f344c..2c4607c 100644 --- a/crm114/classifier.py +++ b/crm114/classifier.py @@ -15,7 +15,7 @@ " output /:*:best:\\t:*:prob:/ }'" -class Classifier: +class Classifier(object): def __init__(self, path, categories=None): """ Wrapper class for the CRM-114 Discriminator. """ self.categories = categories if categories else [] @@ -51,14 +51,14 @@ def classify(self, text): fin.write(text) fin.close() - list = string.split(fout.readline()) + output_list = string.split(fout.readline()) fout.close() - if list is None: + if output_list is None: return ('', 0.0) else: - category = list[0] - probability = float(list[1]) + category = output_list[0] + probability = float(output_list[1]) return (category, probability) def create_files(self): @@ -67,7 +67,7 @@ def create_files(self): # Create directory if necessary if not os.path.exists(self.path): - os.mkdirs(self.path) + os.makedirs(self.path) # Create category files for category in self.categories: diff --git a/setup.py b/setup.py index 2881a5b..b31c010 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='crm114', - version='2.0.1', + version='2.0.2', author='Brian Cline', author_email='brian.cline@gmail.com', description=('Python wrapper classes for the CRM-114 Discriminator '