Skip to content

Commit

Permalink
chore: Upgrade parsimonious to 0.10.0 (#65150)
Browse files Browse the repository at this point in the history
This PR upgrades to parsimonious `0.10.0` with the necessary fixes to
adapt to the new version. This will be needed for the PR where we bump
the `snuba-sdk` since it's using this newer version of the
`parsimonious` library.

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
  • Loading branch information
iambriccardo and getsantry[bot] authored Feb 14, 2024
1 parent 41b380c commit 9d3ca66
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ maxminddb>=2.3
mistune>=2.0.3
mmh3>=4.0.0
packaging>=21.3
parsimonious>=0.9.0
parsimonious>=0.10.0
petname>=2.6
phonenumberslite>=8.12.32
Pillow>=10.2.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ openapi-spec-validator==0.7.1
outcome==1.2.0
packaging==21.3
parse==1.19.0
parsimonious==0.9.0
parsimonious==0.10.0
pathable==0.4.3
pathspec==0.9.0
pep517==0.12.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ msgpack==1.0.7
oauthlib==3.1.0
openai==1.3.5
packaging==21.3
parsimonious==0.9.0
parsimonious==0.10.0
petname==2.6
phabricator==0.7.0
phonenumberslite==8.12.55
Expand Down
5 changes: 2 additions & 3 deletions src/sentry/api/event_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from django.utils.functional import cached_property
from parsimonious.exceptions import IncompleteParseError
from parsimonious.expressions import Optional
from parsimonious.grammar import Grammar
from parsimonious.nodes import Node, NodeVisitor

Expand Down Expand Up @@ -262,7 +261,7 @@ def _flatten(seq):

def remove_optional_nodes(children):
def is_not_optional(child):
return not (isinstance(child, Node) and isinstance(child.expr, Optional))
return not (isinstance(child, Node) and not child.text)

return list(filter(is_not_optional, children))

Expand Down Expand Up @@ -303,7 +302,7 @@ def handle_negation(negation, operator):

def get_operator_value(operator):
if isinstance(operator, Node):
operator = "=" if isinstance(operator.expr, Optional) else operator.text
operator = operator.text or "="
elif isinstance(operator, list):
operator = operator[0]
return operator
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/grouping/enhancer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
enhancements_grammar = Grammar(
r"""
enhancements = line+
enhancements = line*
line = _ (comment / rule / empty) newline?
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/grouping/fingerprinting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
fingerprinting_grammar = Grammar(
r"""
fingerprinting_rules = line+
fingerprinting_rules = line*
line = _ (comment / rule / empty) newline?
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/ownership/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
ownership_grammar = Grammar(
rf"""
ownership = line+
ownership = line*
line = _ (comment / rule / empty) newline?
Expand Down

0 comments on commit 9d3ca66

Please sign in to comment.