jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/889240 )

Change subject: fix B028 by adding stacklevel=2
......................................................................

fix B028 by adding stacklevel=2

Change-Id: I121816f67ecddd8d37a488dafd0c580e9f85ff6e
---
M pywikibot/family.py
1 file changed, 28 insertions(+), 10 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/family.py b/pywikibot/family.py
index 22b83fc..639a273 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -320,22 +320,31 @@
             raise UnknownFamilyError(f'Family {fam} does not exist')
         cls = mod.Family.instance
         if cls.name != fam:
-            warnings.warn('Family name {} does not match family module name {}'
-                          .format(cls.name, fam), FamilyMaintenanceWarning)
+            warnings.warn(
+                'Family name {} does not match family module name {}'
+                .format(cls.name, fam),
+                FamilyMaintenanceWarning,
+                stacklevel=2,
+            )
         # Family 'name' and the 'langs' codes must be ascii letters and digits,
         # and codes must be lower-case due to the Site loading algorithm;
         # codes can accept also underscore/dash.
         if not all(x in NAME_CHARACTERS for x in cls.name):
-            warnings.warn('Name of family {} must be ASCII letters '
-                          'and digits [a-zA-Z0-9]'
-                          .format(cls.name), FamilyMaintenanceWarning)
+            warnings.warn(
+                'Name of family {} must be ASCII letters and digits '
+                '[a-zA-Z0-9]'.format(cls.name),
+                FamilyMaintenanceWarning,
+                stacklevel=2,
+            )
         for code in cls.langs.keys():
             if not all(x in CODE_CHARACTERS for x in code):
-                warnings.warn('Family {} code {} must be ASCII lowercase '
-                              'letters and digits [a-z0-9] or '
-                              'underscore/dash [_-]'
-                              .format(cls.name, code),
-                              FamilyMaintenanceWarning)
+                warnings.warn(
+                    'Family {} code {} must be ASCII lowercase letters and '
+                    ' digits [a-z0-9] or underscore/dash [_-]'
+                    .format(cls.name, code),
+                    FamilyMaintenanceWarning,
+                    stacklevel=2,
+                )
         Family._families[fam] = cls
         return cls


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/889240
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I121816f67ecddd8d37a488dafd0c580e9f85ff6e
Gerrit-Change-Number: 889240
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to