Parser does not recognise form 'nx'
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- data-visualization
Rechercherichtung
Beginne damit, die beiden fehlschlagenden Ausdrücke und ihre funktionierenden n*x-Äquivalente über parseplot.Parser.plot zu reproduzieren, und untersuche dann den im Traceback genannten Einstiegspunkt parse/parser.py sowie den zugrunde liegenden Parsing-Aufruf von plusminus. Als erledigt gilt die Aufgabe, wenn Formen wie 2x und x^3+4x-5 genauso geparst und ausgewertet werden wie ihre Äquivalente mit expliziter Multiplikation.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Parser does not recognise expressions or parts with the form nx where n is an integer/float.
Expressions taking form n*x evaluate fine.
expression 2x:
>>> p = parseplot.Parser('2x')
>>> p.plot(-5, 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/parseplot/parse/parser.py", line 29, in plot
xy = (x, self._parser.evaluate(self._function))
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/plusminus/plusminus.py", line 853, in evaluate
parsed = self.parse(arith_expression, parseAll=True)
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/plusminus/plusminus.py", line 845, in parse
parsed = self.get_parser().parseString(*args, **kwargs)
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/pyparsing.py", line 1955, in parseString
raise exc
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/pyparsing.py", line 3814, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text, found 'x' (at char 1), (line:1, col:2)
>>> p = parseplot.Parser('2*x')
>>> p.plot(-5, 5)
[(-5, -10), (-4, -8), (-3, -6), (-2, -4), (-1, -2), (0, 0), (1, 2), (2, 4), (3, 6), (4, 8), (5, 10)]
expression x^3 + 4x -5
>>> p = parseplot.Parser('x^3+4x-5')
>>> p.plot(-5, 5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/parseplot/parse/parser.py", line 29, in plot
xy = (x, self._parser.evaluate(self._function))
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/plusminus/plusminus.py", line 853, in evaluate
parsed = self.parse(arith_expression, parseAll=True)
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/plusminus/plusminus.py", line 845, in parse
parsed = self.get_parser().parseString(*args, **kwargs)
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/pyparsing.py", line 1955, in parseString
raise exc
File "/home/toonarmycaptain/PycharmProjects/parseplot/test_install_env/lib/python3.9/site-packages/pyparsing.py", line 3814, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text, found 'x' (at char 6), (line:1, col:7)
>>> p = parseplot.Parser('x^3+4*x-5')
>>> p.plot(-5, 5)
[(-5, -150), (-4, -85), (-3, -44), (-2, -21), (-1, -10), (0, -5), (1, 0), (2, 11), (3, 34), (4, 75), (5, 140)]
- Vorherrschende Sprache
- Python
- Sterne
- 0
- Forks
- 1
- Ø Merge
- 19 Std. 29 Min.
- Gemergte PRs (30 T.)
- 5
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus toonarmycaptain/parseplot
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
toonarmycaptain/parseplot#16 ·
-
packaging plotter
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
Alle Issues in toonarmycaptain/parseplot
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
google-agentic-commerce/AP2#388 ·
-
area:codegen backend:cuda backend:hip bug direction:input
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CrossGL/crosstl#3061 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
rlaope/oh-my-hermes#2304 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
mochan-tk/agentic-dev-kit-for-codex#64 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Windows ARM memory-leakOffenbug docs performance
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 3 Tagen