question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError in check-builtin-literals hook.

See original GitHub issue

The check-builtin-literals hook is consistently failing for me, but I don’t know why. This is the error I’m getting:

Check builtin type constructor use.......................................Failed
hookid: check-builtin-literals

Traceback (most recent call last):
  File "/Users/nmford/.cache/pre-commit/repoco9z7yr8/py_env-python3.6/bin/check-builtin-literals", line 11, in <module>
    sys.exit(main())
  File "/Users/nmford/.cache/pre-commit/repoco9z7yr8/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/check_builtin_literals.py", line 79, in main
    allow_dict_kwargs=args.allow_dict_kwargs,
  File "/Users/nmford/.cache/pre-commit/repoco9z7yr8/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/check_builtin_literals.py", line 52, in check_file_for_builtin_type_constructors
    visitor.visit(tree)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 253, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 261, in generic_visit
    self.visit(item)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 253, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 261, in generic_visit
    self.visit(item)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 253, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 261, in generic_visit
    self.visit(item)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 253, in visit
    return visitor(node)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 263, in generic_visit
    self.visit(value)
  File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ast.py", line 253, in visit
    return visitor(node)
  File "/Users/nmford/.cache/pre-commit/repoco9z7yr8/py_env-python3.6/lib/python3.6/site-packages/pre_commit_hooks/check_builtin_literals.py", line 38, in visit_Call
    if node.func.id not in set(BUILTIN_TYPES).difference(self.ignore):
AttributeError: 'Call' object has no attribute 'id'

This is how the config yaml is configured:

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: 805530fe2934a55dc399f80615725157dec5f062
    hooks:
    -   id: check-ast
    -   id: check-builtin-literals  # Seems to have an issue in the library
    -   id: detect-private-key
    -   id: end-of-file-fixer
    -   id: flake8
        args: [--max-line-length=120]
        exclude: '(smoke_)?specs\/'
    -   id: mixed-line-ending
    -   id: name-tests-test
        args: [--django]
    -   id: requirements-txt-fixer
    -   id: trailing-whitespace

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nathanielfordcommented, May 29, 2018

Woo! Thanks for the fix!

On Mon, May 28, 2018 at 10:40 AM, Anthony Sottile notifications@github.com wrote:

This has been (finally!) released as part of v1.3.0 https://github.com/pre-commit/pre-commit-hooks/releases/tag/v1.3.0! 🎉

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pre-commit/pre-commit-hooks/issues/285#issuecomment-392576563, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkYEymlHpbNps5YvfdjJSSWykU7bklhks5t3DapgaJpZM4UD8bw .

1reaction
asottilecommented, May 28, 2018

This has been (finally!) released as part of v1.3.0! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError using hooks in Requests Python package
I am sending requests and receiving their response objects into a hooked function. Sometimes, I'm sending a new request out of that same ......
Read more >
How to Fix AttributeError in Python - Rollbar
The Python AttributeError is an exception that occurs when an attribute reference or assignment fails. Learn how to fix it.
Read more >
module 'pytest' has no attribute 'hookimpl'" running tests in ...
"AttributeError: module 'pytest' has no attribute 'hookimpl'" running tests in PyCharm · Open two Python projects in the same PyCharm window. · In...
Read more >
'NoneType' object has no attribute 'register_forward_hook'
I'm trying to register a forward hook function to the last conv layer of my network. ... AttributeError: 'NoneType' object has no attribute...
Read more >
Developing QGIS plugin: AttributeError: object has no attribute
I tested and it works just fine. However, I can't get the geocode with web service to work for now. The UI is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found