Skip to content

Commit

Permalink
Use operator in comparison dict
Browse files Browse the repository at this point in the history
  • Loading branch information
dcamron committed Nov 14, 2023
1 parent 4b8b92b commit 2e91e15
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/metpy/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import contextlib
import functools
from importlib.metadata import metadata, version
import operator as op
import re

import numpy as np
Expand Down Expand Up @@ -42,9 +43,9 @@ def module_version_check(version_spec):
bool : Whether the installed package validates against the provided specification
"""
comparison_operators = {
'==': lambda x, y: x == y, '=': lambda x, y: x == y, '!=': lambda x, y: x != y,
'<': lambda x, y: x < y, '<=': lambda x, y: x <= y,
'>': lambda x, y: x > y, '>=': lambda x, y: x >= y,
'==': op.eq, '=': op.eq, '!=': op.ne,
'<': op.lt, '<=': op.le,
'>': op.gt, '>=': op.ge,
}

# Match version_spec for groups of module name,
Expand Down

0 comments on commit 2e91e15

Please sign in to comment.