如何解决皮层评级问题

发布于 2025-02-08 10:52:19 字数 335 浏览 0 评论 0原文

我试图在以下代码上应用pylint规则:

class A:
    

    @staticmethod
    def r():
        

        query = {"get_data": {"$sum": 1)},
                             "value": True}
        

这给出了结果:

a.py:8:0: R0903: Too few public methods (1/2) (too-few-public-methods)

解决此问题的任何想法吗?

I'm trying to apply the Pylint rules on the following code:

class A:
    

    @staticmethod
    def r():
        

        query = {"get_data": {"$sum": 1)},
                             "value": True}
        

This is giving the result:

a.py:8:0: R0903: Too few public methods (1/2) (too-few-public-methods)

Any thoughts on solving this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×眷恋的温暖 2025-02-15 10:52:19

您可以重新考虑 /重构本班,但我认为这是不需要的。
拥有一个带有单个入口点的API是有时有效的。您可以添加pylint:disable = Too-Few-public方法,如果您认为Pylint的消息过于有用,甚至直接在Pylint配置文件中直接禁用整个项目。

披露:我是一名皮革维护者,我们可能会使此支票可选,因为我们认为它太有用了。

You could rethink / refactor this class but I don't think it's warranted.
It's sometime valid to have an API with a single entry-point. You can add a pylint: disable=too-few-public-methods if you think a pylint's message is too opinionated, or even in your pylint configuration file directly to disable for the whole project.

Disclosure : I'm a pylint maintainer, we're probably going to make this check optional because we think it's too opinionated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文