def execute_perms_command(db, objs, args, options, credentials, unixPaths=None):
    if len(args) < 2:
        db.Print(u'Form: perms SPEC list of tags and namespaces')
        return
    spec = args[0]
    primitives = [u'write', u'read', u'control']
    if not (spec in [u'private', u'default', u'group', u'group-write',
                     u'group-read', u'lock', u'unlock'] + primitives):
        raise PermissionsError(u'perms must be followed by one of:\n%s'
                                % u', '.join(spec + primitives))
    isGroup = spec.startswith(u'group')
    if isGroup:
        group = args[1].split(u'+')
        if len(args) < 3:
            raise PermissionsError(
                    u'Group form: perms %s list+of+group+members list of tags '
                    u'and namespaces' % spec)

    if spec in primitives:
        errorText = (u'%s form: perms %s [open|closed]'
                     u'[except list+of+group+members list'
                     u'of tags and namespaces]' % (spec, spec))
        if len(args) < 3 or not args[1] in (u'open', u'closed'):
            raise PermissionsError(errorText)
        policy = args[1]
        exceptions = args[3].split(u'+') if args[2] == u'except' else []
        fullpaths = (db.abs_tag_path(t, inPref=True)
                     for t in args[2 + 2 * bool(exceptions):])
        if options.extravals:
            for v in options.extravals:
                assert v in ALL_NAMES
    else:
        fullpaths = (db.abs_tag_path(t, inPref=True)
                     for t in args[1 + isGroup:])
    for path in fullpaths:
        done = False
        owner = path.split(u'/')[1]
        permsToSet = ALL_NAMES
        for (exists, isTag) in ((db.tag_exists, True), (db.ns_exists, False)):
            if exists(path):
                inPerms = FluidinfoPerms(db, path, isTag=isTag,
                                         getFromFI=False)
                if spec == u'private':
                    inPerms.set_to_private()
                elif spec == u'default':
                    inPerms.set_to_default()
                elif spec == u'lock':
                    inPerms = FluidinfoPerms(db, path, isTag=isTag,
                                             getFromFI=True)
                    inPerms.lock()
                elif spec == u'unlock':
                    inPerms = FluidinfoPerms(db, path, isTag=isTag,
                                             getFromFI=True)
                    inPerms.unlock()
                elif isGroup:
                    inPerms = FluidinfoPerms(db, path, isTag=isTag,
                                             getFromFI=True)
                    if (u'group', u'group-read') in spec:
                         inPerms.set_group_readable(group)
                    if spec in (u'group', u'group-write'):
                         inPerms.set_group_writable(group)
                else:  # if spec in primitives:
                    if spec == u'control':
                        permsToSet = CONTROL_NAMES
                    elif spec == u'write':
                        permsToSet = WRITE_NAMES
                    else:
                        permsToSet = READ_NAMES
                    for name in permsToSet:
                        if hasattr(inPerms, name):
                            inPerms.__dict__[name].policy = policy
                            inPerms.__dict__[name].exceptions = exceptions
                inPerms.update_fluidinfo(db, permsToSet, options.force,
                                         restrict_to=options.extravals,
                                         verbose=options.verbose)
                done = True
        if not done:
            db.Print('No tag or namespace %s found' % db.abs_tag_path(path,
                                                                outPref=True))
dataset/ETHPy150Open njr0/fish/fish/ls.py/execute_perms_command/swapped operands of `in`