jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1337393?usp=email )

Change subject: api: Avoid temporary sets when checking MIME parameter keys
......................................................................

api: Avoid temporary sets when checking MIME parameter keys

Use the parameter dictionary's keys view and isdisjoint() to check for
overlap with MIME keys. This avoids copying both key collections and
building an intersection, and stops at the first shared key.

Preserve the ValueError for shared keys and accept empty or disjoint
MIME mappings.

Change-Id: I864c775f6db751aa1a6062bdfdaa6a5f026685f7
---
M pywikibot/data/api/_requests.py
1 file changed, 2 insertions(+), 1 deletion(-)

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




diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index 5fc20c9..789ac9d 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -424,7 +424,8 @@
         if hasattr(self, '__defaulted'):
             return

-        if self.mime is not None and set(self._params) & set(self.mime):
+        if (self.mime is not None
+                and not self._params.keys().isdisjoint(self.mime)):
             raise ValueError('The mime and params shall not share the '
                              'same keys.')


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I864c775f6db751aa1a6062bdfdaa6a5f026685f7
Gerrit-Change-Number: 1337393
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to