Skip to content

Commit

Permalink
chore: apply license headers to all the source files (#116)
Browse files Browse the repository at this point in the history
* chore: apply license headers to all the source files

* fix flake8 with autopep8

* fix lint
  • Loading branch information
feng-tao authored Jul 16, 2020
1 parent 6ae8194 commit 08a9b75
Show file tree
Hide file tree
Showing 46 changed files with 141 additions and 8 deletions.
3 changes: 3 additions & 0 deletions search_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import ast
import importlib
import os
Expand Down
2 changes: 2 additions & 0 deletions search_service/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions search_service/api/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Any, Dict, Iterable # noqa: F401

Expand Down
4 changes: 4 additions & 0 deletions search_service/api/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from http import HTTPStatus
from typing import Iterable, Any
Expand Down Expand Up @@ -64,6 +67,7 @@ class SearchDashboardFilterAPI(BaseFilterAPI):
"""
Search Filter for Dashboard
"""

def __init__(self) -> None:
super().__init__(schema=SearchDashboardResultSchema,
index=DASHBOARD_INDEX)
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/document.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging

from http import HTTPStatus
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/healthcheck.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Tuple
from flasgger import swag_from

Expand Down
4 changes: 4 additions & 0 deletions search_service/api/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Any, Iterable # noqa: F401

Expand Down Expand Up @@ -58,6 +61,7 @@ class SearchTableFilterAPI(BaseFilterAPI):
"""
Search Filter for table
"""

def __init__(self) -> None:
super().__init__(schema=SearchTableResultSchema,
index=TABLE_INDEX)
Expand Down
3 changes: 3 additions & 0 deletions search_service/api/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Iterable, Any

Expand Down
3 changes: 3 additions & 0 deletions search_service/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

ELASTICSEARCH_INDEX_KEY = 'ELASTICSEARCH_INDEX'
Expand Down
4 changes: 4 additions & 0 deletions search_service/exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0


class NotFoundException(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
2 changes: 2 additions & 0 deletions search_service/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions search_service/models/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from abc import ABCMeta, abstractmethod
from typing import Set

Expand Down
7 changes: 5 additions & 2 deletions search_service/models/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Set, List

import attr
Expand Down Expand Up @@ -46,8 +49,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchDashboardResult:
total_results: int = attr.ib()
results: List[Dashboard] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[Dashboard] = attr.ib(factory=list)


class SearchDashboardResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/models/search_result.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Any, List


Expand Down
7 changes: 5 additions & 2 deletions search_service/models/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import List, Optional, Set

import attr
Expand Down Expand Up @@ -65,8 +68,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchTableResult:
total_results: int = attr.ib()
results: List[Table] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[Table] = attr.ib(factory=list)


class SearchTableResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/models/tag.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import attr

from marshmallow_annotations.ext.attrs import AttrsSchema
Expand Down
7 changes: 5 additions & 2 deletions search_service/models/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0


from typing import Optional, Set, List

Expand Down Expand Up @@ -47,8 +50,8 @@ class Meta:

@attr.s(auto_attribs=True, kw_only=True)
class SearchUserResult:
total_results: int = attr.ib()
results: List[User] = attr.ib(factory=list)
total_results: int = attr.ib()
results: List[User] = attr.ib(factory=list)


class SearchUserResultSchema(AttrsSchema):
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from threading import Lock

from flask import current_app
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/atlas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from re import sub
from typing import Any, List, Dict, Tuple, Optional
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from abc import ABCMeta, abstractmethod
from typing import Any, Dict, List, Union

Expand Down
7 changes: 5 additions & 2 deletions search_service/proxy/elasticsearch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
import uuid
import itertools
Expand Down Expand Up @@ -87,7 +90,7 @@ def __init__(self, *,
def _get_search_result(self, page_index: int,
client: Search,
model: Any,
search_result_model: Any=SearchResult) -> Any:
search_result_model: Any = SearchResult) -> Any:
"""
Common helper function to get result.
Expand Down Expand Up @@ -140,7 +143,7 @@ def _search_helper(self, page_index: int,
client: Search,
query_name: dict,
model: Any,
search_result_model: Any =SearchResult) -> Any:
search_result_model: Any = SearchResult) -> Any:
"""
Constructs Elasticsearch Query DSL to:
1. Use function score to customize scoring of search result. It currently uses "total_usage" field to score.
Expand Down
3 changes: 3 additions & 0 deletions search_service/proxy/statsd_utilities.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from threading import Lock
from typing import Any, Dict, Callable # noqa: F401
Expand Down
3 changes: 3 additions & 0 deletions search_service/search_wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

from search_service import create_app
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

from setuptools import setup, find_packages
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions tests/unit/api/dashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions tests/unit/api/dashboard/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from search_service.models.dashboard import Dashboard


Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/dashboard/test_search_dashboard_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from unittest import TestCase

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/dashboard/test_search_dashboard_filter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/api/document/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions tests/unit/api/document/test_document_table_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/document/test_document_tables_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/document/test_document_user_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/document/test_document_users_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/api/table/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions tests/unit/api/table/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from search_service.models.table import Table
from search_service.models.tag import Tag

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/table/test_search_table_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from unittest import TestCase

Expand Down
3 changes: 3 additions & 0 deletions tests/unit/api/table/test_search_table_filter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from http import HTTPStatus
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions tests/unit/proxy/test_atlas.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from mock import MagicMock, patch
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/proxy/test_elasticsearch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from unittest.mock import patch, MagicMock
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/proxy/test_statsd_utilities.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from mock import patch, MagicMock
from flask import current_app
from statsd import StatsClient
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from flask import current_app
Expand All @@ -9,6 +12,7 @@ class AppTest(unittest.TestCase):
"""
Test the service if it can stand-up
"""

def setUp(self) -> None:
config_module_class = 'search_service.config.LocalConfig'
self.app = create_app(config_module_class=config_module_class)
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_swagger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import unittest

from typing import Any, Dict
Expand Down

0 comments on commit 08a9b75

Please sign in to comment.