Пример #1
0
 def list(self, prefix='', delimiter='', marker=NOT_IMPL,
          headers=NOT_IMPL):
     prefix = prefix or '' # Turn None into '' for prefix match.
     # Return list instead of using a generator so we don't get
     # 'dictionary changed size during iteration' error when performing
     # deletions while iterating (e.g., during test cleanup).
     result = []
     key_name_set = set()
     for k in six.itervalues(self.keys):
         if k.name.startswith(prefix):
             k_name_past_prefix = k.name[len(prefix):]
             if delimiter:
               pos = k_name_past_prefix.find(delimiter)
             else:
               pos = -1
             if (pos != -1):
                 key_or_prefix = Prefix(
                     bucket=self, name=k.name[:len(prefix)+pos+1])
             else:
                 key_or_prefix = MockKey(bucket=self, name=k.name)
             if key_or_prefix.name not in key_name_set:
                 key_name_set.add(key_or_prefix.name)
                 result.append(key_or_prefix)
     return result
Пример #2
0
 def get_all_buckets(self, headers=NOT_IMPL):
     return six.itervalues(self.buckets)
Пример #3
0
 def get_all_keys(self, headers=NOT_IMPL):
     return six.itervalues(self.keys)