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 importlib
import logging
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Tuple
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
from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
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 jsonify, make_response, Response
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
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
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 json
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
from typing import Optional, Any
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
from abc import ABCMeta, abstractmethod
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import io
import logging
from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json
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 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
from typing import Any, Dict, List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
from http import HTTPStatus
......@@ -81,7 +84,7 @@ def validate_options(*, options: Dict) -> None:
"""
if options.get('resource_path') is None:
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')
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict
import requests
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
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
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
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 logging
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc
from amundsen_application.models.data_issue import DataIssue
from amundsen_application.models.issue_results import IssueResults
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc
from typing import Dict, List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from abc import ABCMeta, abstractmethod
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc
from typing import Dict
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import abc
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 datetime import datetime, timedelta
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import smtplib
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import requests
import uuid
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import os
from typing import Callable, Dict, List, Optional, Set # noqa: F401
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 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
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
......@@ -5,16 +8,17 @@ class ActionLogParams(object):
"""
Holds parameters for Action log
"""
def __init__(self, *,
command: str,
start_epoch_ms: int,
end_epoch_ms: int =None,
end_epoch_ms: int = None,
user: str,
host_name: str,
pos_args_json: str,
keyword_args_json: str,
output: Any =None,
error: Exception =None) -> None:
output: Any = None,
error: Exception = None) -> None:
self.command = command
self.start_epoch_ms = start_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.exceptions import ValidationError
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# JIRA SDK does not return priority beyond the name
PRIORITY_MAP = {
'Blocker': 'P0',
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from amundsen_application.models.data_issue import DataIssue
from typing import List, Dict
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from marshmallow import Schema, fields
from typing import List
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, Optional
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 flask import Flask
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 threading import Lock
from werkzeug.utils import import_string
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
class IssueConfigurationException(Exception):
"""
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 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 amundsen_application.models.user import load_user, User
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import os
from amundsen_application import create_app
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import os
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 unittest
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
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 responses
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
import unittest
from unittest.mock import patch
......@@ -25,10 +28,9 @@ class TestModePreview(unittest.TestCase):
def tearDown(self) -> None:
self.app_context.pop()
def test_get_preview_image(self) -> None:
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:
mock_get_preview_image_url.return_value = 'http://foo.bar/image.jpeg'
mock_get.return_value.content = b'bar'
......@@ -87,7 +89,6 @@ class TestModePreview(unittest.TestCase):
preview = ModePreview(access_token='token', password='password', organization='foo')
self.assertTrue(preview._is_auth_enabled)
def test_authorization(self) -> None:
self.app.config['ACL_ENABLED_DASHBOARD_PREVIEW'] = {'ModePreview'}
self.app.config['AUTH_USER_METHOD'] = MagicMock()
......@@ -111,7 +112,6 @@ class TestModePreview(unittest.TestCase):
preview = ModePreview(access_token='token', password='password', organization='foo')
preview._authorize_access(user_id='test_email')
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 = {
'employee_type': 'teamMember',
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
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 responses
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
from http import HTTPStatus
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
import flask
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
import flask
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import flask
import json
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
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 socket
import unittest
......@@ -42,7 +45,7 @@ class ActionLogTest(unittest.TestCase):
:return:
"""
with app.test_request_context(), self.assertRaises(NotImplementedError):
fail_func()
fail_func()
def test_success_function(self) -> None:
"""
......
# 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
from amundsen_application.models.data_issue import DataIssue
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import flask
import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
from unittest.mock import patch, Mock
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json
import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import json
import unittest
......
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
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