File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -77,21 +77,22 @@ def key(self):
77
77
return self .url
78
78
79
79
def __eq__ (self , other ):
80
- if isinstance (other , Resource ):
81
- if self .name != other .name :
82
- return False
83
- if self .url != other .url :
84
- return False
85
- if self .paid != other .paid :
86
- return False
87
- if self .notes != other .notes :
88
- return False
89
- if self .category != other .category :
90
- return False
91
- if self .languages != other .languages :
92
- return False
93
- return True
94
- return False
80
+ return isinstance (other , Resource ) and all (
81
+ (
82
+ getattr (self , attribute )
83
+ == getattr (other , attribute )
84
+ for attribute in [
85
+ "name" ,
86
+ "url" ,
87
+ "paid" ,
88
+ "notes" ,
89
+ "category" ,
90
+ "languages" ,
91
+ ]
92
+ )
93
+ )
94
+
95
+
95
96
96
97
def __hash__ (self ):
97
98
return hash (self .url )
You can’t perform that action at this time.
0 commit comments