Skip to content

Commit add46d9

Browse files
committed
Use "is" to compare __class__
Since the value of __class__ is a type, comparing it to another type object should use "is" rather than "==". Some of these, involving type(), were fixed in bf7af69, but flake8 did not catch the .__class__ variation addressed here.
1 parent 59d208c commit add46d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git/refs/symbolic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def iter_items(
769769
770770
List is lexicographically sorted
771771
The returned objects represent actual subclasses, such as Head or TagReference"""
772-
return (r for r in cls._iter_items(repo, common_path) if r.__class__ == SymbolicReference or not r.is_detached)
772+
return (r for r in cls._iter_items(repo, common_path) if r.__class__ is SymbolicReference or not r.is_detached)
773773

774774
@classmethod
775775
def from_path(cls: Type[T_References], repo: "Repo", path: PathLike) -> T_References:
@@ -797,7 +797,7 @@ def from_path(cls: Type[T_References], repo: "Repo", path: PathLike) -> T_Refere
797797
try:
798798
instance: T_References
799799
instance = ref_type(repo, path)
800-
if instance.__class__ == SymbolicReference and instance.is_detached:
800+
if instance.__class__ is SymbolicReference and instance.is_detached:
801801
raise ValueError("SymbolicRef was detached, we drop it")
802802
else:
803803
return instance

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy