You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@liminal.apache.org by li...@apache.org on 2021/07/20 08:28:17 UTC

[incubator-liminal] branch master updated: fix missing licenses (#61)

This is an automated email from the ASF dual-hosted git repository.

lior pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-liminal.git


The following commit(s) were added to refs/heads/master by this push:
     new 92a849f  fix missing licenses (#61)
92a849f is described below

commit 92a849f76fc969fea19b2528b1da0a2ad516d12c
Author: Aviem Zur <av...@gmail.com>
AuthorDate: Tue Jul 20 11:28:10 2021 +0300

    fix missing licenses (#61)
---
 docs/liminal/executors/emr.md                     |  2 +-
 docs/liminal/tasks/create_cloudformation_stack.md |  2 +-
 docs/liminal/tasks/delete_cloudformation_stack.md |  2 +-
 docs/liminal/tasks/spark.md                       |  2 +-
 examples/aws-ml-app-demo/__init__.py              | 17 +++++
 examples/aws-ml-app-demo/liminal.yml              | 17 +++++
 examples/aws-ml-app-demo/model_store.py           | 18 +++++
 examples/aws-ml-app-demo/requirements.txt         | 18 +++++
 examples/aws-ml-app-demo/serving.py               | 18 +++++
 examples/aws-ml-app-demo/training.py              | 18 +++++
 tests/runners/apps/test/liminal.yml               | 17 +++++
 check_license.py => tests/test_licenses.py        | 89 ++++++++++++-----------
 12 files changed, 172 insertions(+), 48 deletions(-)

diff --git a/docs/liminal/executors/emr.md b/docs/liminal/executors/emr.md
index 9ae5155..f4e1d19 100644
--- a/docs/liminal/executors/emr.md
+++ b/docs/liminal/executors/emr.md
@@ -9,7 +9,7 @@ with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required bgit y applicable law or agreed to in writing,
+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
diff --git a/docs/liminal/tasks/create_cloudformation_stack.md b/docs/liminal/tasks/create_cloudformation_stack.md
index 4db465c..4a393f9 100644
--- a/docs/liminal/tasks/create_cloudformation_stack.md
+++ b/docs/liminal/tasks/create_cloudformation_stack.md
@@ -9,7 +9,7 @@ with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required bgit y applicable law or agreed to in writing,
+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
diff --git a/docs/liminal/tasks/delete_cloudformation_stack.md b/docs/liminal/tasks/delete_cloudformation_stack.md
index 2aa20f0..462c5c7 100644
--- a/docs/liminal/tasks/delete_cloudformation_stack.md
+++ b/docs/liminal/tasks/delete_cloudformation_stack.md
@@ -9,7 +9,7 @@ with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required bgit y applicable law or agreed to in writing,
+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
diff --git a/docs/liminal/tasks/spark.md b/docs/liminal/tasks/spark.md
index 86366ec..3cca0d7 100644
--- a/docs/liminal/tasks/spark.md
+++ b/docs/liminal/tasks/spark.md
@@ -9,7 +9,7 @@ with the License.  You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required bgit y applicable law or agreed to in writing,
+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
diff --git a/examples/aws-ml-app-demo/__init__.py b/examples/aws-ml-app-demo/__init__.py
index e69de29..217e5db 100644
--- a/examples/aws-ml-app-demo/__init__.py
+++ b/examples/aws-ml-app-demo/__init__.py
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
diff --git a/examples/aws-ml-app-demo/liminal.yml b/examples/aws-ml-app-demo/liminal.yml
index 5972aeb..03d1498 100644
--- a/examples/aws-ml-app-demo/liminal.yml
+++ b/examples/aws-ml-app-demo/liminal.yml
@@ -1,3 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
 ---
 name: MyDataScienceApp
 owner: Bosco Albert Baracus
diff --git a/examples/aws-ml-app-demo/model_store.py b/examples/aws-ml-app-demo/model_store.py
index 06bb138..191861f 100644
--- a/examples/aws-ml-app-demo/model_store.py
+++ b/examples/aws-ml-app-demo/model_store.py
@@ -1,3 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 pickle
 import time
 import glob
diff --git a/examples/aws-ml-app-demo/requirements.txt b/examples/aws-ml-app-demo/requirements.txt
index 15a6efe..16e18e3 100644
--- a/examples/aws-ml-app-demo/requirements.txt
+++ b/examples/aws-ml-app-demo/requirements.txt
@@ -1,2 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
 scikit-learn==0.23.2
 apache-liminal==0.0.2
diff --git a/examples/aws-ml-app-demo/serving.py b/examples/aws-ml-app-demo/serving.py
index 7aa8886..02ca58c 100644
--- a/examples/aws-ml-app-demo/serving.py
+++ b/examples/aws-ml-app-demo/serving.py
@@ -1,3 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 json
 
 import model_store
diff --git a/examples/aws-ml-app-demo/training.py b/examples/aws-ml-app-demo/training.py
index b9f4e88..505f814 100644
--- a/examples/aws-ml-app-demo/training.py
+++ b/examples/aws-ml-app-demo/training.py
@@ -1,3 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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 sys
 import time
 
diff --git a/tests/runners/apps/test/liminal.yml b/tests/runners/apps/test/liminal.yml
index e69de29..217e5db 100644
--- a/tests/runners/apps/test/liminal.yml
+++ b/tests/runners/apps/test/liminal.yml
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
diff --git a/check_license.py b/tests/test_licenses.py
similarity index 75%
rename from check_license.py
rename to tests/test_licenses.py
index eda66f6..76fef79 100644
--- a/check_license.py
+++ b/tests/test_licenses.py
@@ -18,7 +18,7 @@
 
 import os
 import pathlib
-import sys
+from unittest import TestCase
 
 from termcolor import colored
 
@@ -131,46 +131,47 @@ JSON_LICENSE_HEADER = """
 """.strip().split("\n")
 
 
-def check_licenses():
-    files = []
-    base_dir = os.path.join(pathlib.Path(__file__).parent.absolute())
-    print(f'Checking licenses for files in {base_dir}')
-    for r, d, f in os.walk(base_dir):
-        if not any(os.path.relpath(r, base_dir).startswith(excluded) for excluded in EXCLUDED_DIRS):
-            for file in f:
-                if not any(os.path.basename(file).endswith(ext) for ext in EXCLUDED_EXTENSIONS):
-                    files.append(os.path.join(r, file))
-
-    output = ''
-    success = True
-    for file in files:
-        print(f'Checking license for file {file}')
-        has_license = check_license(file)
-        if not has_license:
-            output += colored(f'Missing License: {file}\n', 'red')
-        success = success and has_license
-
-    print(output)
-
-    if not success:
-        sys.exit(1)
-
-
-def check_license(file):
-    header_lines = PYTHON_LICENSE_HEADER
-    if file.endswith('.md'):
-        header_lines = MD_LICENSE_HEADER
-    elif file.endswith('.rst'):
-        header_lines = RST_LICENSE_HEADER
-    elif file.endswith('.bat'):
-        header_lines = BAT_LICENSE_HEADER
-    elif file.endswith('.json'):
-        header_lines = JSON_LICENSE_HEADER
-        header_lines[0] = f'  {header_lines[0]}'
-    with open(file) as f:
-        file_lines = f.readlines()
-    return all(f'{line}\n' in file_lines for line in header_lines)
-
-
-if __name__ == '__main__':
-    check_licenses()
+class TestLicenses(TestCase):
+
+    def test_licenses(self):
+        files = []
+        base_dir = os.path.join(pathlib.Path(__file__).parent.parent.absolute())
+        print(f'Checking licenses for files in {base_dir}')
+        for r, d, f in os.walk(base_dir):
+            if not any(os.path.relpath(r, base_dir).startswith(excluded) for excluded in
+                       EXCLUDED_DIRS):
+                for file in f:
+                    if not any(os.path.basename(file).endswith(ext) for ext in EXCLUDED_EXTENSIONS):
+                        files.append(os.path.join(r, file))
+
+        output = ''
+        files_missing_license = []
+        success = True
+        for file in files:
+            print(f'Checking license for file {file}')
+            has_license = self.check_license(file)
+            if not has_license:
+                output += colored(f'Missing License: {file}\n', 'red')
+                files_missing_license.append(file)
+            success = success and has_license
+
+        print(output)
+
+        if not success:
+            self.assertListEqual([], files_missing_license)
+
+    @staticmethod
+    def check_license(file):
+        header_lines = PYTHON_LICENSE_HEADER
+        if file.endswith('.md'):
+            header_lines = MD_LICENSE_HEADER
+        elif file.endswith('.rst'):
+            header_lines = RST_LICENSE_HEADER
+        elif file.endswith('.bat'):
+            header_lines = BAT_LICENSE_HEADER
+        elif file.endswith('.json'):
+            header_lines = JSON_LICENSE_HEADER
+            header_lines[0] = f'  {header_lines[0]}'
+        with open(file) as f:
+            file_lines = f.readlines()
+        return all(f'{line}\n' in file_lines for line in header_lines)