Skip to content

Commit

Permalink
fix(python): pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ifplusor committed Oct 20, 2020
1 parent 989b5b7 commit 411d81d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actrie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

__all__ = ["Matcher", "Context", "PrefixMatcher"]

__version__ = "3.2.1"
__version__ = "3.2.2"
10 changes: 5 additions & 5 deletions actrie/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Enum(object):


from .tokenizer import Tokenizer
from .util import convert2unicode, is_py3k
from .util import convert2unicode, is_py2k

meta_char = {u"(", u")", u"|", u"."}

Expand Down Expand Up @@ -167,7 +167,7 @@ def ustr(self):
return self.text

def __str__(self):
return self.ustr() if is_py3k else self.ustr().encode("utf-8")
return self.ustr() if not is_py2k else self.ustr().encode("utf-8")


class AlternationPattern(Pattern):
Expand All @@ -183,7 +183,7 @@ def ustr(self):
return u"(" + u"|".join([p.ustr() for p in self.alters]) + u")"

def __str__(self):
return self.ustr() if is_py3k else self.ustr().encode("utf-8")
return self.ustr() if not is_py2k else self.ustr().encode("utf-8")


class AntiAmbiguousPattern(Pattern):
Expand All @@ -197,7 +197,7 @@ def ustr(self):
return self.origin.ustr() + u"(?&!" + u"|".join([p.ustr() for p in self.ambis]) + u")"

def __str__(self):
return self.ustr() if is_py3k else self.ustr().encode("utf-8")
return self.ustr() if not is_py2k else self.ustr().encode("utf-8")


class DistancePattern(Pattern):
Expand All @@ -212,5 +212,5 @@ def ustr(self):
return self.head.ustr() + u".{0," + convert2unicode(str(self.dist)) + u"}" + self.tail.ustr()

def __str__(self):
return self.ustr() if is_py3k else self.ustr().encode("utf-8")
return self.ustr() if not is_py2k else self.ustr().encode("utf-8")

2 changes: 1 addition & 1 deletion jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>psn.ifplusor</groupId>
<artifactId>actrie</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<packaging>nar</packaging>

<name>actrie</name>
Expand Down

0 comments on commit 411d81d

Please sign in to comment.