Unverified Commit e1473e4a authored by Tao Feng's avatar Tao Feng Committed by GitHub

chore[python]: apply license headers to all the source files (#513)

* chore[python]: apply license headers to all the source files

* fix flake8 with autopep8

* fix lint
parent 1e142606
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import ast import ast
import importlib import importlib
import logging import logging
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Tuple from typing import Any, Tuple
from flask import Flask, render_template from flask import Flask, render_template
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
class MailClientNotImplemented(Exception): class MailClientNotImplemented(Exception):
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from flask import current_app as app from flask import current_app as app
from flask import jsonify, make_response, Response from flask import jsonify, make_response, Response
from flask_restful import Resource, reqparse from flask_restful import Resource, reqparse
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
import json import json
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from typing import Optional, Any from typing import Optional, Any
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import io import io
import logging import logging
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import logging import logging
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
import json import json
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from typing import Any, Dict, List from typing import Any, Dict, List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from http import HTTPStatus from http import HTTPStatus
...@@ -81,7 +84,7 @@ def validate_options(*, options: Dict) -> None: ...@@ -81,7 +84,7 @@ def validate_options(*, options: Dict) -> None:
""" """
if options.get('resource_path') is None: if options.get('resource_path') is None:
raise Exception('resource_path was not provided in the notification options') raise Exception('resource_path was not provided in the notification options')
if options.get('resource_name')is None: if options.get('resource_name') is None:
raise Exception('resource_name was not provided in the notification options') raise Exception('resource_name was not provided in the notification options')
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict from typing import Dict
import requests import requests
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from typing import Dict # noqa: F401 from typing import Dict # noqa: F401
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List # noqa: F401 from typing import Dict, List # noqa: F401
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc import abc
import logging import logging
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc import abc
from amundsen_application.models.data_issue import DataIssue from amundsen_application.models.data_issue import DataIssue
from amundsen_application.models.issue_results import IssueResults from amundsen_application.models.issue_results import IssueResults
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc import abc
from typing import Dict, List from typing import Dict, List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc import abc
from typing import Dict from typing import Dict
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc import abc
from flask import Response as FlaskResponse, make_response, jsonify from flask import Response as FlaskResponse, make_response, jsonify
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from random import randint from random import randint
from datetime import datetime, timedelta from datetime import datetime, timedelta
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
import os import os
import smtplib import smtplib
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
import requests import requests
import uuid import uuid
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import os import os
from typing import Callable, Dict, List, Optional, Set # noqa: F401 from typing import Callable, Dict, List, Optional, Set # noqa: F401
from amundsen_application.models.user import User from amundsen_application.models.user import User
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import functools import functools
import getpass import getpass
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
""" """
An Action Logger module. Singleton pattern has been applied into this module An Action Logger module. Singleton pattern has been applied into this module
so that registered callbacks can be used all through the same python process. so that registered callbacks can be used all through the same python process.
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Any from typing import Any
...@@ -5,16 +8,17 @@ class ActionLogParams(object): ...@@ -5,16 +8,17 @@ class ActionLogParams(object):
""" """
Holds parameters for Action log Holds parameters for Action log
""" """
def __init__(self, *, def __init__(self, *,
command: str, command: str,
start_epoch_ms: int, start_epoch_ms: int,
end_epoch_ms: int =None, end_epoch_ms: int = None,
user: str, user: str,
host_name: str, host_name: str,
pos_args_json: str, pos_args_json: str,
keyword_args_json: str, keyword_args_json: str,
output: Any =None, output: Any = None,
error: Exception =None) -> None: error: Exception = None) -> None:
self.command = command self.command = command
self.start_epoch_ms = start_epoch_ms self.start_epoch_ms = start_epoch_ms
self.end_epoch_ms = end_epoch_ms self.end_epoch_ms = end_epoch_ms
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from marshmallow import Schema, fields, post_dump from marshmallow import Schema, fields, post_dump
from marshmallow.exceptions import ValidationError from marshmallow.exceptions import ValidationError
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# JIRA SDK does not return priority beyond the name # JIRA SDK does not return priority beyond the name
PRIORITY_MAP = { PRIORITY_MAP = {
'Blocker': 'P0', 'Blocker': 'P0',
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from amundsen_application.models.data_issue import DataIssue from amundsen_application.models.data_issue import DataIssue
from typing import List, Dict from typing import List, Dict
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from marshmallow import Schema, fields from marshmallow import Schema, fields
from typing import List from typing import List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, Optional from typing import Dict, Optional
from amundsen_common.models.user import UserSchema, User from amundsen_common.models.user import UserSchema, User
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, Optional from typing import Dict, Optional
from flask import Flask from flask import Flask
from amundsen_application.config import LocalConfig from amundsen_application.config import LocalConfig
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from flask import current_app as app from flask import current_app as app
from threading import Lock from threading import Lock
from werkzeug.utils import import_string from werkzeug.utils import import_string
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
class IssueConfigurationException(Exception): class IssueConfigurationException(Exception):
""" """
Raised when there are missing configuration settings Raised when there are missing configuration settings
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from jira import JIRA, JIRAError, Issue from jira import JIRA, JIRAError, Issue
from typing import List from typing import List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from flask import current_app as app from flask import current_app as app
from amundsen_application.models.user import load_user, User from amundsen_application.models.user import load_user, User
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import os import os
from amundsen_application import create_app from amundsen_application import create_app
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging import logging
import os import os
import subprocess import subprocess
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import unittest import unittest
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import responses import responses
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa # flake8: noqa
import unittest import unittest
from unittest.mock import patch from unittest.mock import patch
...@@ -25,7 +28,6 @@ class TestModePreview(unittest.TestCase): ...@@ -25,7 +28,6 @@ class TestModePreview(unittest.TestCase):
def tearDown(self) -> None: def tearDown(self) -> None:
self.app_context.pop() self.app_context.pop()
def test_get_preview_image(self) -> None: def test_get_preview_image(self) -> None:
with patch.object(ModePreview, '_get_preview_image_url') as mock_get_preview_image_url,\ with patch.object(ModePreview, '_get_preview_image_url') as mock_get_preview_image_url,\
patch.object(requests, 'get') as mock_get: patch.object(requests, 'get') as mock_get:
...@@ -87,7 +89,6 @@ class TestModePreview(unittest.TestCase): ...@@ -87,7 +89,6 @@ class TestModePreview(unittest.TestCase):
preview = ModePreview(access_token='token', password='password', organization='foo') preview = ModePreview(access_token='token', password='password', organization='foo')
self.assertTrue(preview._is_auth_enabled) self.assertTrue(preview._is_auth_enabled)
def test_authorization(self) -> None: def test_authorization(self) -> None:
self.app.config['ACL_ENABLED_DASHBOARD_PREVIEW'] = {'ModePreview'} self.app.config['ACL_ENABLED_DASHBOARD_PREVIEW'] = {'ModePreview'}
self.app.config['AUTH_USER_METHOD'] = MagicMock() self.app.config['AUTH_USER_METHOD'] = MagicMock()
...@@ -111,7 +112,6 @@ class TestModePreview(unittest.TestCase): ...@@ -111,7 +112,6 @@ class TestModePreview(unittest.TestCase):
preview = ModePreview(access_token='token', password='password', organization='foo') preview = ModePreview(access_token='token', password='password', organization='foo')
preview._authorize_access(user_id='test_email') preview._authorize_access(user_id='test_email')
with patch('amundsen_application.api.preview.dashboard.dashboard_preview.mode_preview.request_metadata') as mock_request_metadata: with patch('amundsen_application.api.preview.dashboard.dashboard_preview.mode_preview.request_metadata') as mock_request_metadata:
mock_request_metadata.return_value.json.return_value = { mock_request_metadata.return_value.json.return_value = {
'employee_type': 'teamMember', 'employee_type': 'teamMember',
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa # flake8: noqa
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from flask import current_app from flask import current_app
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import responses import responses
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from http import HTTPStatus from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
import flask import flask
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
import flask import flask
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import flask import flask
import json import json
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from unittest.mock import Mock from unittest.mock import Mock
import flask import flask
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import getpass import getpass
import socket import socket
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from amundsen_application.models.data_issue import DataIssue from amundsen_application.models.data_issue import DataIssue
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import flask import flask
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from unittest.mock import patch, Mock from unittest.mock import patch, Mock
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json import json
import unittest import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest import unittest
from amundsen_application.api.utils.search_utils import generate_query_json, has_filters, transform_filters from amundsen_application.api.utils.search_utils import generate_query_json, has_filters, transform_filters
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment