Skip to content

Commit

Permalink
relax strict requirement of future and pyparsing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Roberts committed Apr 17, 2015
1 parent c74c3b0 commit 330b09d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 6 additions & 2 deletions nltk_tgrep/tests/test_tgrep.py
Expand Up @@ -7,8 +7,12 @@
(c) 16 March, 2013 Will Roberts
'''

from __future__ import unicode_literals
from builtins import range
from __future__ import print_function, unicode_literals
try:
from builtins import range
except ImportError:
print('Warning: nltk_tgrep may not work correctly on Python 2.* without the ')
print('`future` package installed.')
from nltk.tree import ParentedTree
from .. import tgrep
import unittest
Expand Down
14 changes: 11 additions & 3 deletions nltk_tgrep/tgrep.py
Expand Up @@ -60,11 +60,19 @@
macro definitions to `m` and initialises `l` to an empty dictionary.
'''

from __future__ import unicode_literals
from builtins import bytes, range, str
from __future__ import print_function, unicode_literals
try:
from builtins import bytes, range, str
except ImportError:
print('Warning: nltk_tgrep may not work correctly on Python 2.* without the')
print('`future` package installed.')
import functools
import nltk.tree
import pyparsing
try:
import pyparsing
except ImportError:
print('Warning: nltk_tgrep will not work without the `pyparsing` package')
print('installed.')
import re

class TgrepException(Exception):
Expand Down

0 comments on commit 330b09d

Please sign in to comment.