Commit f13c111 1 parent 0d7254a commit f13c111 Copy full SHA for f13c111
File tree 2 files changed +5
-8
lines changed
travertino/src/travertino
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change
1
+ The logic that checks if two styles are compatible for union operators has been simplified.
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ class BaseStyle:
22
22
for parameters to the constructor.
23
23
"""
24
24
25
+ # Only "real" properties
25
26
_BASE_PROPERTIES = defaultdict (set )
27
+ # Includes aliases and shorthands
26
28
_BASE_ALL_PROPERTIES = defaultdict (set )
27
29
28
30
def __init_subclass__ (cls ):
@@ -197,21 +199,15 @@ def __iter__(self):
197
199
yield from (name for name in self ._PROPERTIES if name in self )
198
200
199
201
def __or__ (self , other ):
200
- if isinstance (other , BaseStyle ):
201
- if self .__class__ is not other .__class__ :
202
- return NotImplemented
203
- elif not isinstance (other , Mapping ):
202
+ if not (type (self ) is type (other ) or isinstance (other , Mapping )):
204
203
return NotImplemented
205
204
206
205
result = self .copy ()
207
206
result .update (** other )
208
207
return result
209
208
210
209
def __ior__ (self , other ):
211
- if isinstance (other , BaseStyle ):
212
- if self .__class__ is not other .__class__ :
213
- return NotImplemented
214
- elif not isinstance (other , Mapping ):
210
+ if not (type (self ) is type (other ) or isinstance (other , Mapping )):
215
211
return NotImplemented
216
212
217
213
self .update (** other )
You can’t perform that action at this time.
0 commit comments