Patchwork D842: style: always use `x is not None` instead of `not x is None`

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2017, 3:58 p.m.
Message ID <486dc54ffd66ccf5e8c7544109d87eb0@localhost.localdomain>
Download mbox | patch
Permalink /patch/24208/
State Not Applicable
Headers show

Comments

phabricator - Sept. 29, 2017, 3:58 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb1243afb61c9: style: always use `x is not None` instead of `not x is None` (authored by alex_gaynor, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D842?vs=2152&id=2153

REVISION DETAIL
  https://phab.mercurial-scm.org/D842

AFFECTED FILES
  mercurial/keepalive.py
  mercurial/pure/parsers.py

CHANGE DETAILS




To: alex_gaynor, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -80,7 +80,7 @@ 
         return i * indexsize
 
     def __delitem__(self, i):
-        if not isinstance(i, slice) or not i.stop == -1 or not i.step is None:
+        if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
             raise ValueError("deleting slices only supports a:-1 with step 1")
         i = self._fix_index(i.start)
         if i < self._lgt:
@@ -114,7 +114,7 @@ 
         return count
 
     def __delitem__(self, i):
-        if not isinstance(i, slice) or not i.stop == -1 or not i.step is None:
+        if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
             raise ValueError("deleting slices only supports a:-1 with step 1")
         i = self._fix_index(i.start)
         if i < self._lgt:
diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -393,7 +393,7 @@ 
     def read(self, amt=None):
         # the _rbuf test is only in this first if for speed.  It's not
         # logically necessary
-        if self._rbuf and not amt is None:
+        if self._rbuf and amt is not None:
             L = len(self._rbuf)
             if amt > L:
                 amt -= L