Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the repo through the typos spell checker #159

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ which, of course, can be nested:
Functions
---------

You can define functions which you'd like the expresssions to have access to:
You can define functions which you'd like the expressions to have access to:

.. code-block:: pycon

Expand Down Expand Up @@ -339,7 +339,7 @@ cases):
# and so on...

One useful feature of using the ``SimpleEval`` object is that you can parse an expression
once, and then evaluate it mulitple times using different ``names``:
once, and then evaluate it multiple times using different ``names``:

.. code-block:: python

Expand Down
10 changes: 5 additions & 5 deletions simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
]

# Disallow functions:
# This, strictly speaking, is not necessary. These /should/ never be accessable anyway,
# This, strictly speaking, is not necessary. These /should/ never be accessible anyway,
# if DISALLOW_PREFIXES and DISALLOW_METHODS are all right. This is here to try and help
# people not be stupid. Allowing these functions opens up all sorts of holes - if any of
# their functionality is required, then please wrap them up in a safe container. And think
Expand Down Expand Up @@ -254,9 +254,9 @@ def safe_mult(a, b): # pylint: disable=invalid-name
"""limit the number of times an iterable can be repeated..."""

if hasattr(a, "__len__") and b * len(a) > MAX_STRING_LENGTH:
raise IterableTooLong("Sorry, I will not evalute something that long.")
raise IterableTooLong("Sorry, I will not evaluate something that long.")
if hasattr(b, "__len__") and a * len(b) > MAX_STRING_LENGTH:
raise IterableTooLong("Sorry, I will not evalute something that long.")
raise IterableTooLong("Sorry, I will not evaluate something that long.")

return a * b

Expand Down Expand Up @@ -424,7 +424,7 @@ def parse(expr):
return parsed.body[0]

def eval(self, expr, previously_parsed=None):
"""evaluate an expresssion, using the operators, functions and
"""evaluate an expression, using the operators, functions and
names previously set up."""

# set a copy of the expression aside, so we can give nice errors...
Expand Down Expand Up @@ -763,6 +763,6 @@ def do_generator(gi=0):


def simple_eval(expr, operators=None, functions=None, names=None):
"""Simply evaluate an expresssion"""
"""Simply evaluate an expression"""
s = SimpleEval(operators=operators, functions=functions, names=names)
return s.eval(expr)
10 changes: 5 additions & 5 deletions test_simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def setUp(self):
"""initialize a SimpleEval"""
self.s = SimpleEval()

def t(self, expr, shouldbe): # pylint: disable=invalid-name
def t(self, expr, should_be): # pylint: disable=invalid-name
"""test an evaluation of an expression against an expected answer"""
return self.assertEqual(self.s.eval(expr), shouldbe)
return self.assertEqual(self.s.eval(expr), should_be)


class TestBasic(DRYTest):
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_empty_string_not_allowed(self):
class TestEvaluator(DRYTest):
"""Tests for how the SimpleEval class does things"""

def test_only_evalutate_first_statement(self):
def test_only_evaluate_first_statement(self):
# it only evaluates the first statement:
with warnings.catch_warnings(record=True) as ws:
warnings.simplefilter("always")
Expand Down Expand Up @@ -1027,7 +1027,7 @@ def test_no_whitespace(self):
def test_trailing(self):
self.t("200 + 200 ", 400)

def test_preciding_whitespace(self):
def test_preceding_whitespace(self):
self.t(" 200 + 200", 400)

def test_preceding_tab_whitespace(self):
Expand Down Expand Up @@ -1284,7 +1284,7 @@ class Foo:
def bar(self):
yield "Hello, world!"

# Test the genertor does work - also adds the `yield` to codecov...
# Test the generator does work - also adds the `yield` to codecov...
assert list(Foo().bar()) == ["Hello, world!"]

evil = "foo.bar().gi_frame.f_globals['__builtins__'].exec('raise RuntimeError(\"Oh no\")')"
Expand Down