import json

from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity

from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema

emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(many=True, strict=True)
user_schema = UserSchema(strict=True)


class AuthIndexResource(Resource):
    auth_required = False

    def get(self):
        """
        Return information on the currently authenticated user.
        """
        try:
            user_response = client.get('/users/me')
        except ApiError as exc:
            if exc.code == 401:
                return {
                    'isAuthenticated': False,
                }

        identity_list = list(Identity.query.filter(
            Identity.user_id == user_response.data['id'],
        ))

        email_list = list(Email.query.filter(
            Email.user_id == user_response.data['id'],
        ))

        return {
            'isAuthenticated': True,
            'user': json.loads(user_response.data),
            'emails': emails_schema.dump(email_list).data,
            'identities': identities_schema.dump(identity_list).data,
        }

    def delete(self):
        """
        Logout.
        """
        auth.logout()

        return {
            'isAuthenticated': False,
            'user': None,
        }

import json

from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity

from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema

emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(many=True, strict=True)
user_schema = UserSchema(strict=True)


class AuthIndexResource(Resource):
    auth_required = False

    def get(self):
        """
        Return information on the currently authenticated user.
        """
        try:
            user_response = client.get('/users/me')
        except ApiError as exc:
            if exc.code == 401:
                return {
                    'isAuthenticated': False,
                }

        user = json.loads(user_response.data)

        identity_list = list(Identity.query.filter(
            Identity.user_id == user['id'],
        ))

        email_list = list(Email.query.filter(
            Email.user_id == user['id'],
        ))

        return {
            'isAuthenticated': True,
            'user': user,
            'emails': emails_schema.dump(email_list).data,
            'identities': identities_schema.dump(identity_list).data,
        }

    def delete(self):
        """
        Logout.
        """
        auth.logout()

        return {
            'isAuthenticated': False,
            'user': None,
        }

Fix auth API usage (this is why we wait for CI)
Fix auth API usage (this is why we wait for CI)

  import json
  
  from zeus import auth
  from zeus.api import client
  from zeus.exceptions import ApiError
  from zeus.models import Email, Identity
  
  from .base import Resource
  from ..schemas import EmailSchema, IdentitySchema, UserSchema
  
  emails_schema = EmailSchema(many=True, strict=True)
  identities_schema = IdentitySchema(many=True, strict=True)
  user_schema = UserSchema(strict=True)
  
  
  class AuthIndexResource(Resource):
      auth_required = False
  
      def get(self):
          """
          Return information on the currently authenticated user.
          """
          try:
              user_response = client.get('/users/me')
          except ApiError as exc:
              if exc.code == 401:
                  return {
                      'isAuthenticated': False,
                  }
  
+         user = json.loads(user_response.data)
+ 
          identity_list = list(Identity.query.filter(
-             Identity.user_id == user_response.data['id'],
+             Identity.user_id == user['id'],
          ))
  
          email_list = list(Email.query.filter(
-             Email.user_id == user_response.data['id'],
+             Email.user_id == user['id'],
          ))
  
          return {
              'isAuthenticated': True,
-             'user': json.loads(user_response.data),
+             'user': user,
              'emails': emails_schema.dump(email_list).data,
              'identities': identities_schema.dump(identity_list).data,
          }
  
      def delete(self):
          """
          Logout.
          """
          auth.logout()
  
          return {
              'isAuthenticated': False,
              'user': None,
          }
  
Fix auth API usage (this is why we wait for CI)
## Code Before:
import json

from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity

from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema

emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(many=True, strict=True)
user_schema = UserSchema(strict=True)


class AuthIndexResource(Resource):
    auth_required = False

    def get(self):
        """
        Return information on the currently authenticated user.
        """
        try:
            user_response = client.get('/users/me')
        except ApiError as exc:
            if exc.code == 401:
                return {
                    'isAuthenticated': False,
                }

        identity_list = list(Identity.query.filter(
            Identity.user_id == user_response.data['id'],
        ))

        email_list = list(Email.query.filter(
            Email.user_id == user_response.data['id'],
        ))

        return {
            'isAuthenticated': True,
            'user': json.loads(user_response.data),
            'emails': emails_schema.dump(email_list).data,
            'identities': identities_schema.dump(identity_list).data,
        }

    def delete(self):
        """
        Logout.
        """
        auth.logout()

        return {
            'isAuthenticated': False,
            'user': None,
        }

## Instruction:
Fix auth API usage (this is why we wait for CI)
## Code After:
import json

from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity

from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema

emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(many=True, strict=True)
user_schema = UserSchema(strict=True)


class AuthIndexResource(Resource):
    auth_required = False

    def get(self):
        """
        Return information on the currently authenticated user.
        """
        try:
            user_response = client.get('/users/me')
        except ApiError as exc:
            if exc.code == 401:
                return {
                    'isAuthenticated': False,
                }

        user = json.loads(user_response.data)

        identity_list = list(Identity.query.filter(
            Identity.user_id == user['id'],
        ))

        email_list = list(Email.query.filter(
            Email.user_id == user['id'],
        ))

        return {
            'isAuthenticated': True,
            'user': user,
            'emails': emails_schema.dump(email_list).data,
            'identities': identities_schema.dump(identity_list).data,
        }

    def delete(self):
        """
        Logout.
        """
        auth.logout()

        return {
            'isAuthenticated': False,
            'user': None,
        }
