Skip to content
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

TypeError: 'float' object is not iterable when attempting to emit a count of elements #20

Open
OddBloke opened this issue Sep 17, 2020 · 0 comments

Comments

@OddBloke
Copy link

I'm currently using astpath to determine if we need a function's lone keyword to be optional, or if all of its callers pass it and therefore we can make it unconditionally required. I can get a list of callsites which use it:

$ astpath './/Call[func[Name[@id="report_diagnostic_event"]] and count(keywords) = 1]' -d cloudinit | wc -l
46

and then I thought I'd get clever:

$ astpath 'count(.//Call[func[Name[@id="report_diagnostic_event"]] and count(keywords) = 1])' -d cloudinit
Traceback (most recent call last):
  File "/home/daniel/.virtualenvs/cloud-init/bin/astpath", line 8, in <module>
    sys.exit(main())
  File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/astpath/cli.py", line 37, in main
    search(
  File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/astpath/search.py", line 149, in search
    file_matches = find_in_ast(
  File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/astpath/search.py", line 42, in find_in_ast
    for result in results:
TypeError: 'float' object is not iterable

I don't really know if I'm specifying valid XPath, but if this should work then I'd like it to (and if it shouldn't then perhaps a friendlier error message?).

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

No branches or pull requests

1 participant