Skip to content

Commit 091eff3

Browse files
committed
Removed unused pyparsing verbosity patch
1 parent 4bcadd0 commit 091eff3

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

dice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
__all__ = ['roll', 'ParseException']
1212
__author__ = "Sam Clements <[email protected]>"
13-
__version__ = '0.3.0'
13+
__version__ = '0.3.1'
1414

1515
def roll(string, single=True, verbose=False):
1616
"""Parses and evaluates a dice expression"""

dice/grammar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
from dice.elements import Integer, Dice, Total, Mul, Div, Sub, Add
1515
from dice.utilities import patch_pyparsing
1616

17-
# Set PyParsing options
18-
patch_pyparsing(verbose=False)
17+
patch_pyparsing()
1918

2019
def operatorPrecedence(base, operators):
2120
"""

dice/tests/test_utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
def test_enable_pyparsing_packrat_parsing():
88
"""Test that packrat parsing was enabled"""
99
import pyparsing
10-
assert pyparsing.ParserElement._packratEnabled
10+
assert pyparsing.ParserElement._packratEnabled is True
11+
1112

1213
def test_disable_pyparsing_arity_trimming():
1314
"""Test that pyparsing._trim_arity has been replaced"""
1415
import pyparsing
1516
import dice.utilities
1617
assert pyparsing._trim_arity is dice.utilities._trim_arity
1718

19+
1820
def test_disable_pyparsing_arity_trimming_works():
1921
"""Tests that arity trimming has been disabled and parse actions with
2022
the wrong number of arguments will raise TypeErrors"""

dice/utilities.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ def single(iterable):
1414
return iterable[0] if len(iterable) == 1 else iterable
1515

1616

17-
def patch_pyparsing(packrat=True, arity=True, verbose=True):
17+
def patch_pyparsing(packrat=True, arity=True):
1818
"""Applies monkey-patches to pyparsing"""
1919
if packrat:
2020
enable_pyparsing_packrat()
2121

2222
if arity:
2323
disable_pyparsing_arity_trimming()
2424

25-
if verbose:
26-
enable_pyparsing_verbose_stacktrace()
27-
2825

2926
def enable_pyparsing_packrat():
3027
"""Enables pyparsing's packrat parsing, which is much faster for the type
@@ -33,12 +30,6 @@ def enable_pyparsing_packrat():
3330
pyparsing.ParserElement.enablePackrat()
3431

3532

36-
def enable_pyparsing_verbose_stacktrace():
37-
"""Enables verbose stacktraces in pyparsing"""
38-
warnings.warn("Enabled pyparsing verbose stacktrace", ImportWarning)
39-
pyparsing.ParserElement.verbose_stacktrace = True
40-
41-
4233
def _trim_arity(func, maxargs=None):
4334
def wrapper(string, location, tokens):
4435
return func(string, location, tokens)

0 commit comments

Comments
 (0)