Skip to content

Commit

Permalink
fix basestring for py3
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavisgithub committed Jan 30, 2015
1 parent 500cee1 commit 742b9b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mots_vides/stop_words.py
Expand Up @@ -4,6 +4,8 @@
"""
import re

TEXT_TYPE_LIST = ('str', 'unicode', 'byte')


class StopWord(object):
"""
Expand All @@ -21,7 +23,7 @@ def __add__(self, entry):
"""
Adds an entry or collection of entries to an instance.
"""
if isinstance(entry, basestring):
if type(entry).__name__ in TEXT_TYPE_LIST:
self.collection.add(entry)
else:
self.collection = self.collection.union(entry)
Expand All @@ -32,7 +34,7 @@ def __sub__(self, entry):
"""
Substracts an entry or collection of entries to an instance.
"""
if isinstance(entry, basestring):
if type(entry).__name__ in TEXT_TYPE_LIST:
self.collection.remove(entry)
else:
self.collection = self.collection.difference(entry)
Expand Down

0 comments on commit 742b9b7

Please sign in to comment.