8000 Pydot considers dotted strings like "1.4.0" to be numeric · Issue #438 · pydot/pydot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pydot considers dotted strings like "1.4.0" to be numeric #438

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

Closed
ferdnyc opened this issue Nov 27, 2024 · 1 comment · Fixed by #439
Closed

Pydot considers dotted strings like "1.4.0" to be numeric #438

ferdnyc opened this issue Nov 27, 2024 · 1 comment · Fixed by #439

Comments

@ferdnyc
Copy link
Member
ferdnyc commented Nov 27, 2024

@pktpls wrote:

Have had the same problem with version numbers in node properties, which end up as e.g. ipkVersion=1.4.0, while they should actually be wrapped in quotes

Ooh, that's a different problem. The regular expression used to detect numeric values accepts periods (because, decimal points), but really it should only accept a SINGLE period at most. We'll have to change that from

re_all_numeric = re.compile(r"^[0-9\.]+$")

to something like...

re_all_numeric = re.compile(r"^([0-9]+\.?[0-9]*|[0-9]*\.[0-9]+)$")

Originally posted by @ferdnyc in #178 (comment)

ferdnyc added a commit to ferdnyc/pydot that referenced this issue Nov 27, 2024
The `re_all_numeric` check used to allow any number of decimal
points in the value, which isn't correct for numerics; at most one
can be allowed. Rename to `re_numeric`, and use a more complex
RE that allows a maximum of one decimal point, but fails on strings
like "1.4.0".

Fixes pydot#438
ferdnyc added a commit to ferdnyc/pydot that referenced this issue Nov 28, 2024
The `re_all_numeric` check used to allow any number of decimal
points in the value, which isn't correct for numerics; at most one
can be allowed. Rename to `re_numeric`, and use a more complex
RE that allows a maximum of one decimal point, but fails on strings
like "1.4.0".

Fixes pydot#438
lkk7 pushed a commit that referenced this issue Nov 28, 2024
* Fix numeric-value regular expression

The `re_all_numeric` check used to allow any number of decimal
points in the value, which isn't correct for numerics; at most one
can be allowed. Rename to `re_numeric`, and use a more complex
RE that allows a maximum of one decimal point, but fails on strings
like "1.4.0".

Fixes #438

* Add tests for re_numeric quoting behavior
@lkk7 lkk7 closed this as completed in #439 Nov 28, 2024
@lkk7 lkk7 closed this as completed in 0bd243b Nov 28, 2024
@pktpls
Copy link
pktpls commented Nov 28, 2024

Nice, thanks a lot :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0