URL: https://github.com/freeipa/freeipa/pull/4931
Author: tiran
 Title: #4931: Teach pylint how dnspython 2.x works
Action: opened

PR body:
"""
pylint does not understand pylint's
globals().update(RdataType.__members__) trick.

Fixes: https://pagure.io/freeipa/issue/8419
Signed-off-by: Christian Heimes <[email protected]>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4931/head:pr4931
git checkout pr4931
From 97682d09641f608759b2771e672d98fda052761a Mon Sep 17 00:00:00 2001
From: Christian Heimes <[email protected]>
Date: Sat, 18 Jul 2020 13:12:58 +0200
Subject: [PATCH] Teach pylint how dnspython 2.x works

pylint does not understand pylint's
globals().update(RdataType.__members__) trick.

Fixes: https://pagure.io/freeipa/issue/8419
Signed-off-by: Christian Heimes <[email protected]>
---
 pylint_plugins.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index 5470029910..cd9df64459 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -545,3 +545,26 @@ def wildcard(*args, **kwargs):
     api.env.webui_prod = True
     """
 ))
+
+# dnspython 2.x introduces enums and creates module level globals from them
+# pylint does not understand the trick
+AstroidBuilder(MANAGER).string_build(textwrap.dedent(
+    """
+    import dns.flags
+    import dns.rdataclass
+    import dns.rdatatype
+    
+    dns.flags.CD = 0
+    dns.flags.DO = 0
+    dns.flags.RD = 0
+    
+    dns.rdataclass.IN = 0
+
+    dns.rdatatype.NS = 0
+    dns.rdatatype.MX = 0
+    dns.rdatatype.RRSIG = 0
+    dns.rdatatype.SOA = 0
+    dns.rdatatype.SRV = 0
+    dns.rdatatype.TXT = 0
+    """
+))
_______________________________________________
FreeIPA-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/[email protected]

Reply via email to