You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contains_item_with_id predicate requires id to be a str, but Collection.contains is iterating over instances of AnyObject returned by self.items().
defcontains(self, matcher: Callable[[AnyObject],bool]) ->bool:
""" Returns true if this Collection contains an item, as determined by the matcher object. This method passes the members of this collection to the matcher one at a time, and the matcher decides when there is a match. """foriteminself.items(): # <-- iterates AnyObject, not strifmatcher(item):
returnTruereturnFalsedefcontains_item_with_id(self, id: str) ->bool:
""" Convenience method that looks for items that are simple object identifiers. FIXME: this can be much more complicated in ActivityStreams, but this implementation is all we need right now. """returnself.contains(lambdacandidate: id==candidateifisinstance(candidate,str) elseFalse) # <-- requires str# ...defitems(self) ->Iterator[AnyObject]:
items=self._delegate.json_field('orderedItems'ifself.is_ordered() else'items')
ifitemsisnotNone:
foriteminitems:
ifisinstance(item,str):
yieldAnyObject(item) # <-- not yielding a str# ...
The text was updated successfully, but these errors were encountered:
The contains_item_with_id predicate requires
id
to be astr
, butCollection.contains
is iterating over instances ofAnyObject
returned byself.items()
.The text was updated successfully, but these errors were encountered: