From 12860706b01191499c507acd97459be09308e152 Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sat, 9 Feb 2019 17:17:25 +0100 Subject: [PATCH 1/7] Checking that all files have owners. --- tests/tooling/test_codeowners.py | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index 453aaf0a6..d70aafc07 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -34,5 +34,81 @@ def test_codeowners_user_exist(): assert client.get_user(user[1:]) +directories_to_test = [ + 'examples', + 'keras_contrib/activations', + 'keras_contrib/applications', + 'keras_contrib/callbacks', + 'keras_contrib/constraints', + 'keras_contrib/datasets', + 'keras_contrib/initializers', + 'keras_contrib/layers', + 'keras_contrib/losses', + 'keras_contrib/metrics', + 'keras_contrib/optimizers', + 'keras_contrib/preprocessing', + 'keras_contrib/regularizers', + 'keras_contrib/wrappers' +] +directories_to_test = [path_to_keras_contrib / x for x in directories_to_test] + +pattern_exclude = [ + '.gitkeep', + '__init__.py' +] + +exclude = [ + 'examples/cifar10_clr.py', + 'examples/cifar10_densenet.py', + 'examples/cifar10_nasnet.py', + 'examples/cifar10_resnet.py', + 'examples/cifar10_ror.py', + 'examples/cifar10_wide_resnet.py', + 'examples/conll2000_chunking_crf.py', + 'examples/improved_wgan.py', + 'examples/jaccard_loss.py', + 'keras_contrib/activations/squash.py', + 'keras_contrib/callbacks/cyclical_learning_rate.py', + 'keras_contrib/callbacks/dead_relu_detector.py', + 'keras_contrib/callbacks/snapshot.py', + 'keras_contrib/applications/densenet.py', + 'keras_contrib/applications/nasnet.py', + 'keras_contrib/applications/resnet.py', + 'keras_contrib/applications/wide_resnet.py', + 'keras_contrib/constraints/clip.py', + 'keras_contrib/datasets/coco.py', + 'keras_contrib/datasets/conll2000.py', + 'keras_contrib/datasets/pascal_voc.py', + 'keras_contrib/initializers/convaware.py', + 'keras_contrib/losses/crf_losses.py', + 'keras_contrib/losses/dssim.py', + 'keras_contrib/losses/jaccard.py', + 'keras_contrib/layers/advanced_activations.py', + 'keras_contrib/layers/capsule.py', + 'keras_contrib/layers/convolutional.py', + 'keras_contrib/layers/core.py', + 'keras_contrib/layers/crf.py', + 'keras_contrib/layers/normalization.py', + 'keras_contrib/optimizers/ftml.py', + 'keras_contrib/optimizers/lars.py', + 'keras_contrib/optimizers/padam.py', + 'keras_contrib/optimizers/yogi.py', + 'keras_contrib/metrics/crf_accuracies.py', + +] +exclude = [path_to_keras_contrib / x for x in exclude] + +@pytest.mark.parametrize('directory', directories_to_test) +def test_all_files_have_owners(directory): + files_with_owners = [x[0] for x in parse_codeowners()] + for children in directory.iterdir(): + if children.is_file(): + if children.name in pattern_exclude: + continue + if children in exclude: + continue + assert children in files_with_owners + + if __name__ == '__main__': pytest.main([__file__]) From f3923987ce220081939301e6b11774fd24598ab4 Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sat, 9 Feb 2019 17:31:34 +0100 Subject: [PATCH 2/7] pep8 fix --- tests/tooling/test_codeowners.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index d70aafc07..2d0857d55 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -98,6 +98,7 @@ def test_codeowners_user_exist(): ] exclude = [path_to_keras_contrib / x for x in exclude] + @pytest.mark.parametrize('directory', directories_to_test) def test_all_files_have_owners(directory): files_with_owners = [x[0] for x in parse_codeowners()] From b0fef47e9deafe7717a03aee4cda4b83679a084f Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sat, 9 Feb 2019 17:32:10 +0100 Subject: [PATCH 3/7] Added todo. --- tests/tooling/test_codeowners.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index 2d0857d55..87ba5a039 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -57,6 +57,7 @@ def test_codeowners_user_exist(): '__init__.py' ] +# TODO: remove those files or find them owners. exclude = [ 'examples/cifar10_clr.py', 'examples/cifar10_densenet.py', From fafd00dd0b91e4d88ac37e359ab2817adcdc12fb Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sat, 9 Feb 2019 17:41:23 +0100 Subject: [PATCH 4/7] Added explanations about the codeowner file. --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03cda0e20..206d42b61 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,3 +66,7 @@ We love pull requests. Here's a quick guide: Both Keras-Contrib and Keras operate under the [MIT License](LICENSE). At the discretion of the maintainers of both repositories, code may be moved from Keras-Contrib to Keras and vice versa. The maintainers will ensure that the proper chain of commits will flow in both directions, with proper attribution of code. Maintainers will also do their best to notify contributors when their work is moved between repositories. + +## About the `CODEOWNERS` file + +If you add a new feature to keras-contrib, you should add yourself and your file in the `CODEOWNERS` file. Doing so will, in the future, tag you whenever an issue or a pull request about your feature is opened. Be aware that it represents some work, and in addition of being tagged, you should review new pull requests related to your feature. From ba376cfda4bfe2172de5991a6e2f94b8ae2058c2 Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sun, 10 Feb 2019 11:05:39 +0100 Subject: [PATCH 5/7] Typo and style. --- tests/tooling/test_codeowners.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index 87ba5a039..c89c6bd33 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -95,7 +95,6 @@ def test_codeowners_user_exist(): 'keras_contrib/optimizers/padam.py', 'keras_contrib/optimizers/yogi.py', 'keras_contrib/metrics/crf_accuracies.py', - ] exclude = [path_to_keras_contrib / x for x in exclude] @@ -103,13 +102,11 @@ def test_codeowners_user_exist(): @pytest.mark.parametrize('directory', directories_to_test) def test_all_files_have_owners(directory): files_with_owners = [x[0] for x in parse_codeowners()] - for children in directory.iterdir(): - if children.is_file(): - if children.name in pattern_exclude: - continue - if children in exclude: + for child in directory.iterdir(): + if child.is_file(): + if child.name in pattern_exclude or child in exclude: continue - assert children in files_with_owners + assert child in files_with_owners if __name__ == '__main__': From 7f9658f3b8d28626a37bd6b497c6aef8f1a08b06 Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sun, 10 Feb 2019 12:08:33 +0100 Subject: [PATCH 6/7] Toned down the passage about reviews. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 206d42b61..78d6da0a9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,4 +69,4 @@ The maintainers will ensure that the proper chain of commits will flow in both d ## About the `CODEOWNERS` file -If you add a new feature to keras-contrib, you should add yourself and your file in the `CODEOWNERS` file. Doing so will, in the future, tag you whenever an issue or a pull request about your feature is opened. Be aware that it represents some work, and in addition of being tagged, you should review new pull requests related to your feature. +If you add a new feature to keras-contrib, you should add yourself and your file in the `CODEOWNERS` file. Doing so will, in the future, tag you whenever an issue or a pull request about your feature is opened. Be aware that it represents some work, and in addition of being tagged, we would appreciate that you review new pull requests related to your feature. From 7f64eaa62260437a18c87b90b4db2b375f392dc2 Mon Sep 17 00:00:00 2001 From: gabrieldemarmiesse Date: Sun, 10 Feb 2019 19:15:26 +0100 Subject: [PATCH 7/7] Updated the exclude list. --- tests/tooling/test_codeowners.py | 33 +++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/tests/tooling/test_codeowners.py b/tests/tooling/test_codeowners.py index deb5bea5b..e3da91357 100644 --- a/tests/tooling/test_codeowners.py +++ b/tests/tooling/test_codeowners.py @@ -66,11 +66,6 @@ def test_codeowners_user_exist(): ] directories_to_test = [path_to_keras_contrib / x for x in directories_to_test] -pattern_exclude = [ - '.gitkeep', - '__init__.py' -] - # TODO: remove those files or find them owners. exclude = [ 'examples/cifar10_clr.py', @@ -82,14 +77,9 @@ def test_codeowners_user_exist(): 'examples/conll2000_chunking_crf.py', 'examples/improved_wgan.py', 'examples/jaccard_loss.py', - 'keras_contrib/activations/squash.py', 'keras_contrib/callbacks/cyclical_learning_rate.py', 'keras_contrib/callbacks/dead_relu_detector.py', - 'keras_contrib/callbacks/snapshot.py', - 'keras_contrib/applications/densenet.py', - 'keras_contrib/applications/nasnet.py', 'keras_contrib/applications/resnet.py', - 'keras_contrib/applications/wide_resnet.py', 'keras_contrib/constraints/clip.py', 'keras_contrib/datasets/coco.py', 'keras_contrib/datasets/conll2000.py', @@ -98,16 +88,14 @@ def test_codeowners_user_exist(): 'keras_contrib/losses/crf_losses.py', 'keras_contrib/losses/dssim.py', 'keras_contrib/losses/jaccard.py', - 'keras_contrib/layers/advanced_activations.py', - 'keras_contrib/layers/capsule.py', - 'keras_contrib/layers/convolutional.py', + 'keras_contrib/layers/advanced_activations/pelu.py', + 'keras_contrib/layers/advanced_activations/srelu.py', + 'keras_contrib/layers/convolutional/cosineconvolution2d.py', 'keras_contrib/layers/core.py', 'keras_contrib/layers/crf.py', - 'keras_contrib/layers/normalization.py', + 'keras_contrib/layers/normalization/instancenormalization.py', 'keras_contrib/optimizers/ftml.py', 'keras_contrib/optimizers/lars.py', - 'keras_contrib/optimizers/padam.py', - 'keras_contrib/optimizers/yogi.py', 'keras_contrib/metrics/crf_accuracies.py', ] exclude = [path_to_keras_contrib / x for x in exclude] @@ -116,11 +104,16 @@ def test_codeowners_user_exist(): @pytest.mark.parametrize('directory', directories_to_test) def test_all_files_have_owners(directory): files_with_owners = [x[0] for x in parse_codeowners()] - for child in directory.iterdir(): - if child.is_file(): - if child.name in pattern_exclude or child in exclude: + for root, dirs, files in os.walk(directory): + for name in files: + file_path = pathlib.Path(root) / name + if file_path.suffix != '.py': + continue + if file_path.name == '__init__.py': + continue + if file_path in exclude: continue - assert child in files_with_owners + assert file_path in files_with_owners if __name__ == '__main__':