diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-08-31 13:59:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 13:59:52 (GMT) |
commit | 3c65457156d87e55010507d616b4eecb7a02883d (patch) | |
tree | a472bfd630afb07817c381852549f24bdfb9d01f /Lib | |
parent | 08767c73b5bf1f28792d5fef7f41d52822a4989f (diff) | |
download | cpython-3c65457156d87e55010507d616b4eecb7a02883d.zip cpython-3c65457156d87e55010507d616b4eecb7a02883d.tar.gz cpython-3c65457156d87e55010507d616b4eecb7a02883d.tar.bz2 |
bpo-45060: Get rid of few uses of the equality operators with None (GH-28087)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/_aix.py | 4 | ||||
-rw-r--r-- | Lib/email/contentmanager.py | 2 | ||||
-rw-r--r-- | Lib/test/datetimetester.py | 2 | ||||
-rw-r--r-- | Lib/test/test_pty.py | 2 | ||||
-rw-r--r-- | Lib/test/test_type_annotations.py | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/Lib/ctypes/_aix.py b/Lib/ctypes/_aix.py index 190cac6..26959d9 100644 --- a/Lib/ctypes/_aix.py +++ b/Lib/ctypes/_aix.py @@ -282,7 +282,7 @@ def find_shared(paths, name): if path.exists(archive): members = get_shared(get_ld_headers(archive)) member = get_member(re.escape(name), members) - if member != None: + if member is not None: return (base, member) else: return (None, None) @@ -307,7 +307,7 @@ def find_library(name): libpaths = get_libpaths() (base, member) = find_shared(libpaths, name) - if base != None: + if base is not None: return f"{base}({member})" # To get here, a member in an archive has not been found diff --git a/Lib/email/contentmanager.py b/Lib/email/contentmanager.py index 3cf62dc..fcf278d 100644 --- a/Lib/email/contentmanager.py +++ b/Lib/email/contentmanager.py @@ -144,7 +144,7 @@ def _encode_text(string, charset, cte, policy): linesep = policy.linesep.encode('ascii') def embedded_body(lines): return linesep.join(lines) + linesep def normal_body(lines): return b'\n'.join(lines) + b'\n' - if cte==None: + if cte is None: # Use heuristics to decide on the "best" encoding. if max((len(x) for x in lines), default=0) <= policy.max_line_length: try: diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 316cf0b..6414f1a 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -344,7 +344,7 @@ class TestTimeZone(unittest.TestCase): with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO) self.assertIn(timezone(ZERO), {timezone(ZERO)}) self.assertTrue(timezone(ZERO) != None) - self.assertFalse(timezone(ZERO) == None) + self.assertFalse(timezone(ZERO) == None) tz = timezone(ZERO) self.assertTrue(tz == ALWAYS_EQ) diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index e2e9475..0c17812 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -136,7 +136,7 @@ class PtyTest(unittest.TestCase): mode = None new_stdin_winsz = None - if self.stdin_rows != None and self.stdin_cols != None: + if self.stdin_rows is not None and self.stdin_cols is not None: try: # Modify pty.STDIN_FILENO window size; we need to # check if pty.openpty() is able to set pty slave diff --git a/Lib/test/test_type_annotations.py b/Lib/test/test_type_annotations.py index f6c99bd..87f46c2c 100644 --- a/Lib/test/test_type_annotations.py +++ b/Lib/test/test_type_annotations.py @@ -71,7 +71,7 @@ class TypeAnnotationTests(unittest.TestCase): @__annotations__.deleter def __annotations__(self): - if hasattr(self, 'my_annotations') and self.my_annotations == None: + if getattr(self, 'my_annotations', False) is None: raise AttributeError('__annotations__') self.my_annotations = None |