0

我决定通过运行一些已知的工作代码来提高我的代码质量pylint。特别是我有一个使用pymilter. 这是我正在运行的非常简单的代码:

#!/usr/bin/python3
"Test Milter"

import Milter

# Configuration

# List of email addresses for which incoming mail should  be rejected:
EMAILS = ('mailinglist1@domain.com', 'mailinglist2@domain.com')
# Socket for milter
SOCKETNAME = 'inet:14201@127.0.0.1'

# End of Configuration

class TestMilter(Milter.Milter):
    "Test Milter"

    def __init__(self):
        self.milter_id = Milter.uniqueID()

    def envrcpt(self, to, *str):
        "Reject mail if the To: address is one of the specified e-mail addresses."
        if any(e in to for e in EMAILS):
            return Milter.REJECT
        return Milter.ACCEPT

if __name__ == "__main__":
    Milter.factory = TestMilter
    Milter.runmilter("test_milter", SOCKETNAME, 240)

这是输出pylint -E

************* Module test_milter
test_milter.py:24:19: E1101: Module 'Milter' has no 'REJECT' member (no-member)
test_milter.py:25:15: E1101: Module 'Milter' has no 'ACCEPT' member (no-member)

我看了高低,根本不明白为什么pylint给我这个输出。我不想告诉它忽略这个特定规则,因为它实际上是大多数时候非常有用的规则。有任何想法吗?

4

0 回答 0