chore: skip unnecessary key checks prior to accessing a dictionary (#4497)

This commit is contained in:
Bowen Liang
2024-05-19 18:30:45 +08:00
committed by GitHub
parent aa13d14019
commit 04ad46dd31
30 changed files with 45 additions and 44 deletions

View File

@@ -47,10 +47,10 @@ class AppService:
elif args['mode'] == 'channel':
filters.append(App.mode == AppMode.CHANNEL.value)
if 'name' in args and args['name']:
if args.get('name'):
name = args['name'][:30]
filters.append(App.name.ilike(f'%{name}%'))
if 'tag_ids' in args and args['tag_ids']:
if args.get('tag_ids'):
target_ids = TagService.get_target_ids_by_tag_ids('app',
tenant_id,
args['tag_ids'])