Revision f3740b99 kamaki/cli/commands/__init__.py
b/kamaki/cli/commands/__init__.py | ||
---|---|---|
319 | 319 |
def _non_exact_name_filter(self, items): |
320 | 320 |
np, ns, nl = self['name_pref'], self['name_suff'], self['name_like'] |
321 | 321 |
return [item for item in items if ( |
322 |
(not np) or item['name'].lower().startswith(np.lower())) and ( |
|
323 |
(not ns) or item['name'].lower().endswith(ns.lower())) and ( |
|
324 |
(not nl) or nl.lower() in item['name'].lower())] |
|
322 |
(not np) or (item['name'] or '').lower().startswith( |
|
323 |
np.lower())) and ( |
|
324 |
(not ns) or (item['name'] or '').lower().endswith( |
|
325 |
ns.lower())) and ( |
|
326 |
(not nl) or nl.lower() in (item['name'] or '').lower())] |
|
325 | 327 |
|
326 | 328 |
def _exact_name_filter(self, items): |
327 |
return filter_dicts_by_dict(items, dict(name=self['name'])) if ( |
|
329 |
return filter_dicts_by_dict(items, dict(name=self['name'] or '')) if (
|
|
328 | 330 |
self['name']) else items |
329 | 331 |
|
330 | 332 |
def _filter_by_name(self, items): |
Also available in: Unified diff