From 2d5654c0466408251ede54a1eadf25a4e2e567bc Mon Sep 17 00:00:00 2001 From: hanhxiao Date: Sun, 21 Jul 2019 08:39:37 +0800 Subject: [PATCH] chore(license): add license --- gnes/client/cli.py | 16 ++++++++++++++++ gnes/composer/base.py | 15 +++++++++++++++ gnes/composer/flask.py | 23 +++++++++++++++++++---- gnes/indexer/key_only.py | 16 ++++++++++++++++ gnes/indexer/vector/annoy.py | 15 +++++++++++++++ gnes/preprocessor/image/segmentation.py | 15 +++++++++++++++ gnes/preprocessor/image/sliding_window.py | 1 + gnes/router/map/simple.py | 15 +++++++++++++++ gnes/router/reduce/chunk.py | 15 +++++++++++++++ gnes/router/reduce/concat.py | 15 +++++++++++++++ gnes/router/reduce/document.py | 15 +++++++++++++++ 11 files changed, 157 insertions(+), 4 deletions(-) diff --git a/gnes/client/cli.py b/gnes/client/cli.py index 9f6037cd..3a90b4aa 100644 --- a/gnes/client/cli.py +++ b/gnes/client/cli.py @@ -1,3 +1,19 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + import zipfile import grpc diff --git a/gnes/composer/base.py b/gnes/composer/base.py index 294e6562..d80cc95c 100644 --- a/gnes/composer/base.py +++ b/gnes/composer/base.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import copy import random import time diff --git a/gnes/composer/flask.py b/gnes/composer/flask.py index 9d94704f..27b9fcf0 100644 --- a/gnes/composer/flask.py +++ b/gnes/composer/flask.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import tempfile from .base import YamlComposer @@ -8,7 +23,7 @@ class YamlComposerFlask: def __init__(self, args): self.args = args - def create_flask_app(self): + def _create_flask_app(self): try: from flask import Flask, request, abort, redirect, url_for from flask_compress import Compress @@ -22,11 +37,11 @@ def create_flask_app(self): app = Flask(__name__) @app.route('/', methods=['GET']) - def get_homepage(): + def _get_homepage(): return YamlComposer(set_composer_parser().parse_args([])).build_all()['html'] @app.route('/refresh', methods=['POST']) - def regenerate(): + def _regenerate(): data = request.form if request.form else request.json f = tempfile.NamedTemporaryFile('w', delete=False).name with open(f, 'w', encoding='utf8') as fp: @@ -43,5 +58,5 @@ def regenerate(): return app def run(self): - app = self.create_flask_app() + app = self._create_flask_app() app.run(port=self.args.http_port, threaded=True, host='0.0.0.0') diff --git a/gnes/indexer/key_only.py b/gnes/indexer/key_only.py index 4fd34191..9be22082 100644 --- a/gnes/indexer/key_only.py +++ b/gnes/indexer/key_only.py @@ -1,3 +1,19 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + from typing import List, Tuple import numpy as np diff --git a/gnes/indexer/vector/annoy.py b/gnes/indexer/vector/annoy.py index 2c3a9913..cacf4c64 100644 --- a/gnes/indexer/vector/annoy.py +++ b/gnes/indexer/vector/annoy.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import os from typing import List, Tuple diff --git a/gnes/preprocessor/image/segmentation.py b/gnes/preprocessor/image/segmentation.py index ed31688a..dbc99170 100644 --- a/gnes/preprocessor/image/segmentation.py +++ b/gnes/preprocessor/image/segmentation.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import io import os diff --git a/gnes/preprocessor/image/sliding_window.py b/gnes/preprocessor/image/sliding_window.py index a0500143..3a32d447 100644 --- a/gnes/preprocessor/image/sliding_window.py +++ b/gnes/preprocessor/image/sliding_window.py @@ -12,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import io from typing import List diff --git a/gnes/router/map/simple.py b/gnes/router/map/simple.py index 7e173b81..81db685b 100644 --- a/gnes/router/map/simple.py +++ b/gnes/router/map/simple.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from typing import Generator from ..base import BaseMapRouter diff --git a/gnes/router/reduce/chunk.py b/gnes/router/reduce/chunk.py index 55286ff2..23868760 100644 --- a/gnes/router/reduce/chunk.py +++ b/gnes/router/reduce/chunk.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from collections import defaultdict from typing import List diff --git a/gnes/router/reduce/concat.py b/gnes/router/reduce/concat.py index eea0f4b8..690a8067 100644 --- a/gnes/router/reduce/concat.py +++ b/gnes/router/reduce/concat.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from typing import List import numpy as np diff --git a/gnes/router/reduce/document.py b/gnes/router/reduce/document.py index 245ec3dc..31623d23 100644 --- a/gnes/router/reduce/document.py +++ b/gnes/router/reduce/document.py @@ -1,3 +1,18 @@ +# Tencent is pleased to support the open source community by making GNES available. +# +# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from typing import List from ..base import BaseReduceRouter