

def remove(self, permission, user_or_group, obj=None):
    '\n        Removes the given permission from the given user or group, and returns\n        the deleted AssignedPermission instance or None if not found.\n        \n        If an object is given, removes the permission for that object.\n        '
    (perm, ct) = self.get_permission_and_content_type(permission, obj)
    assigned_dict = {
        'permission': perm,
        'content_type': ct,
        'object_id': None,
    }
    if obj:
        assigned_dict['object_id'] = ct.id
    if isinstance(user_or_group, User):
        assigned_dict['user'] = user_or_group
    elif isinstance(user_or_group, Group):
        assigned_dict['group'] = user_or_group
    else:
        raise TypeError('Permissions can only be removed from a User or Group instance.')
    try:
        assigned = AssignedPermission.objects.get(**assigned_dict)
    except AssignedPermission.DoesNotExist:
        return None
    else:
        assigned.delete()
        return assigned

dataset/ETHPy150Open jlecker/django-rubberstamp/rubberstamp/models.py AppPermissionManager.remove/VarMisuse@66/174 `obj`->`ct`