django “EntryPoints”对象在运行预提交期间没有属性“get”[重复]

ecr0jaav  于 2023-03-04  发布在  Go
关注(0)|答案(1)|浏览(277)
    • 此问题在此处已有答案**:

'EntryPoints' object has no attribute 'get' - Digital ocean(6个答案)
3天前关闭。
我在预提交安装期间收到importlib_metadata AttributeError: 'EntryPoints' object has no attribute 'get'的错误,尽管我已经按照下面StackOverflow答案的建议安装了importlib_metadata==4.13.0。我在这里做错了什么?
这是我正在使用的预提交配置yaml文件-

exclude: 'settings.py'
fail_fast: true
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks.git
    rev: v4.0.1
    hooks:
    -   id: trailing-whitespace
    -   id: check-yaml
    -   id: check-json
    -   id: check-docstring-first
    -   id: requirements-txt-fixer
    -   id: debug-statements
    -   id: check-toml
    -   id: pretty-format-json
        args: [--autofix]
    -   id: no-commit-to-branch
        args: [--branch, develop, --branch, master]

-   repo: https://github.com/pycqa/isort
    rev: 5.11.5
    hooks:
    -   id: isort
        name: isort
        exclude: ^site-pacakges/

-   repo: https://github.com/asottile/pyupgrade
    rev: v2.26.0
    hooks:
    -   id: pyupgrade
        exclude: ^site-pacakges/
        args: ["--py37-plus"]

-   repo: https://github.com/psf/black
    rev: 23.1.0
    hooks:
    -   id: black
        exclude: ^site-pacakges/
        language_version: python3.7

-   repo: https://github.com/PyCQA/flake8
    rev: 3.9.2
    hooks:
    -   id: flake8
        additional_dependencies: [flake8-typing-imports==1.10.0]
        exclude: ^site-pacakges/

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.910
    hooks:
    -   id: mypy
        name: Mypy typing checks
        args: ["--config-file=pyproject.toml"]
        exclude: ^site-pacakges/

-   repo: local
    hooks:
    -   id: tests
        name: run tests
        entry: pytest
        pass_filenames: false
        language: system

Possible duplicate - 'EntryPoints' object has no attribute 'get'
从flake8生成时出错

File "/Users/X/.cache/pre-commit/repo_fr5yg6d/py_env-python3.7/lib/python3.7/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
AttributeError: 'EntryPoints' object has no attribute 'get
ovfsdjhp

ovfsdjhp1#

使用importlib-metadata==4.8.3和以下配置,我能够解决这个问题。

exclude: 'settings.py'
fail_fast: true
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks.git
    rev: v4.0.1
    hooks:
    -   id: trailing-whitespace
    -   id: check-yaml
    -   id: check-json
    -   id: check-docstring-first
    -   id: requirements-txt-fixer
    -   id: debug-statements
    -   id: check-toml
    -   id: pretty-format-json
        args: [--autofix]
    -   id: no-commit-to-branch
        args: [--branch, develop, --branch, master]

-   repo: https://github.com/pycqa/isort
    rev: 5.11.5
    hooks:
    -   id: isort
        name: isort
       exclude: ^site-pacakges/

-   repo: https://github.com/asottile/pyupgrade
    rev: v2.26.0
    hooks:
    -   id: pyupgrade
       exclude: ^site-pacakges/
        args: [--py37-plus]

-   repo: https://github.com/psf/black
    rev: 23.1.0
    hooks:
    -   id: black
       exclude: ^site-pacakges/
        language_version: python3.7

-   repo: https://github.com/PyCQA/flake8
    rev: 5.0.4
    hooks:
    -   id: flake8
        additional_dependencies: [flake8-typing-imports==1.10.0]
        exclude: ^site-pacakges/

-   repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.910
    hooks:
    -   id: mypy
        name: Mypy typing checks
        args: ["--config-file=pyproject.toml"]
        exclude: site-pacakges/

-   repo: local
    hooks:
    -   id: tests
        name: run tests
        entry: pytest
        pass_filenames: false
        language: system

相关问题