Skip to content

Commit

Permalink
add typos CI (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored Sep 30, 2024
1 parent 0279229 commit 64c9b57
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 26 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ concurrency:
cancel-in-progress: true

jobs:
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@master

ruff:
name: Ruff
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ Glossary
mix-in
See `Wikipedia article <https://en.wikipedia.org/wiki/Mixin>`__.

Be sure to mention the mix-in before the base classe being mixed in the
Be sure to mention the mix-in before the base class being mixed in the
list of base classes. This way, the mix-in can override base class
behavior.
2 changes: 1 addition & 1 deletion pymbolic/geometric_algebra/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def __call__(self, operand):

@staticmethod
def resolve(expr):
# This method will need to be overriden by codes using this
# This method will need to be overridden by codes using this
# infrastructure to use the appropriate subclass of DerivativeBinder.

from pymbolic.geometric_algebra.mapper import DerivativeBinder
Expand Down
4 changes: 2 additions & 2 deletions pymbolic/interop/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _comparison_operator(self, expr, operator=None):
return prim.Comparison(left, operator, right)

map_Equality = partial(_comparison_operator, operator="==") # noqa: N815
map_Unequality = partial(_comparison_operator, operator="!=") # noqa: N815
map_Unequality = partial(_comparison_operator, operator="!=") # noqa: N815 # spellchecker: disable-line
map_GreaterThan = partial(_comparison_operator, operator=">=") # noqa: N815
map_LessThan = partial(_comparison_operator, operator="<=") # noqa: N815
map_StrictGreaterThan = partial(_comparison_operator, operator=">") # noqa: N815
Expand Down Expand Up @@ -199,7 +199,7 @@ def map_comparison(self, expr):
if expr.operator == "==":
return self.sym.Equality(left, right)
elif expr.operator == "!=":
return self.sym.Unequality(left, right)
return self.sym.Unequality(left, right) # spellchecker: disable-line
elif expr.operator == "<":
return self.sym.StrictLessThan(left, right)
elif expr.operator == ">":
Expand Down
2 changes: 1 addition & 1 deletion pymbolic/mapper/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# This machinery applies AST rewriting to the mapper in a mildly brutal
# manner, and as such it requires some attention from the user to
# make sure all transformations applied are valid. A good way to do
# this is to look at the generated code by settting print_modified_code_file
# this is to look at the generated code by setting print_modified_code_file
# to sys.stdout or the like.

# Note that this machinery is intentionally generic enough so as to also
Expand Down
42 changes: 21 additions & 21 deletions pymbolic/polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,36 +129,36 @@ def __add__(self, other):
else:
return other.__add__(self)

iself = 0
iother = 0
i_self = 0
i_other = 0

result = []
while iself < len(self.Data) and iother < len(other.Data):
exp_self = self.Data[iself][0]
exp_other = other.Data[iother][0]
while i_self < len(self.Data) and i_other < len(other.Data):
exp_self = self.Data[i_self][0]
exp_other = other.Data[i_other][0]
if exp_self == exp_other:
coeff = self.Data[iself][1] + other.Data[iother][1]
coeff = self.Data[i_self][1] + other.Data[i_other][1]
if coeff:
result.append((exp_self, coeff))
iself += 1
iother += 1
i_self += 1
i_other += 1
elif exp_self > exp_other:
result.append((exp_other, other.Data[iother][1]))
iother += 1
result.append((exp_other, other.Data[i_other][1]))
i_other += 1
elif exp_self < exp_other:
result.append((exp_self, self.Data[iself][1]))
iself += 1
result.append((exp_self, self.Data[i_self][1]))
i_self += 1

# we have exhausted at least one list, exhaust the other
while iself < len(self.Data):
exp_self = self.Data[iself][0]
result.append((exp_self, self.Data[iself][1]))
iself += 1

while iother < len(other.Data):
exp_other = other.Data[iother][0]
result.append((exp_other, other.Data[iother][1]))
iother += 1
while i_self < len(self.Data):
exp_self = self.Data[i_self][0]
result.append((exp_self, self.Data[i_self][1]))
i_self += 1

while i_other < len(other.Data):
exp_other = other.Data[i_other][0]
result.append((exp_other, other.Data[i_other][1]))
i_other += 1

return Polynomial(self.Base, tuple(result))

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ inline-quotes = "double"
docstring-quotes = "double"
multiline-quotes = "double"

[tool.typos.default]
extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$"
]

[tool.ruff.lint.isort]
known-first-party = ["pytools"]
known-local-folder = ["pymbolic"]
Expand Down

0 comments on commit 64c9b57

Please sign in to comment.