def _matches(self, sequence): if not hasmethod(sequence, '__len__') or not hasmethod(sequence, '__iter__'): return False if len(sequence) == 0: return False for item in sequence: if not self.matcher.matches(item): return False return True
def _matches(self, dictionary): if hasmethod(dictionary, 'itervalues'): for value in dictionary.itervalues(): if self.value_matcher.matches(value): return True return False
def _matches(self, dictionary): if hasmethod(dictionary, 'iterkeys'): for key in dictionary.iterkeys(): if self.key_matcher.matches(key): return True return False
def _matches(self, item): if not hasmethod(item, '__len__'): return False return len(item) == 0
def _matches(self, sequence): if hasmethod(sequence, '__iter__'): for item in sequence: if self.element_matcher.matches(item): return True return False
def _matches(self, item): if not hasmethod(item, '__len__'): return False return self.len_matcher.matches(len(item))
def _matches(self, dictionary): if hasmethod(dictionary, 'iteritems'): for key, value in dictionary.iteritems(): if self.key_matcher.matches(key) and self.value_matcher.matches(value): return True return False
def _matches(self, item): if not hasmethod(item, 'endswith'): return False return item.endswith(self.substring)
def _matches(self, item): if not hasmethod(item, 'find'): return False return item.find(self.substring) >= 0