From 8984f7f784859024dc9d6b0e9888a0fafa2b68d9 Mon Sep 17 00:00:00 2001 From: David Pollack Date: Sun, 12 Apr 2020 09:37:08 +0200 Subject: [PATCH] organize protobuf files (#299) --- presidio-analyzer/presidio_analyzer/__main__.py | 4 ++-- presidio-analyzer/presidio_analyzer/analyzer_engine.py | 6 +++--- .../presidio_analyzer/protobuf_models/__init__.py | 3 +++ .../presidio_analyzer/{ => protobuf_models}/analyze_pb2.py | 0 .../{ => protobuf_models}/analyze_pb2_grpc.py | 0 .../{ => protobuf_models}/anonymize_image_pb2.py | 0 .../{ => protobuf_models}/anonymize_image_pb2_grpc.py | 0 .../{ => protobuf_models}/anonymize_json_pb2.py | 0 .../{ => protobuf_models}/anonymize_json_pb2_grpc.py | 0 .../{ => protobuf_models}/anonymize_pb2.py | 0 .../{ => protobuf_models}/anonymize_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/common_pb2.py | 0 .../{ => protobuf_models}/common_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/datasink_pb2.py | 0 .../{ => protobuf_models}/datasink_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/ocr_pb2.py | 0 .../presidio_analyzer/{ => protobuf_models}/ocr_pb2_grpc.py | 0 .../{ => protobuf_models}/recognizers_store_pb2.py | 0 .../{ => protobuf_models}/recognizers_store_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/scan_pb2.py | 0 .../{ => protobuf_models}/scan_pb2_grpc.py | 0 .../{ => protobuf_models}/scheduler_pb2.py | 0 .../{ => protobuf_models}/scheduler_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/stream_pb2.py | 0 .../{ => protobuf_models}/stream_pb2_grpc.py | 0 .../presidio_analyzer/{ => protobuf_models}/template_pb2.py | 0 .../{ => protobuf_models}/template_pb2_grpc.py | 0 .../recognizer_registry/recognizers_store_api.py | 4 ++-- presidio-analyzer/tests/test_analyzer_engine.py | 6 +++--- 29 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 presidio-analyzer/presidio_analyzer/protobuf_models/__init__.py rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/analyze_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/analyze_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_image_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_image_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_json_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_json_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/anonymize_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/common_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/common_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/datasink_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/datasink_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/ocr_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/ocr_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/recognizers_store_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/recognizers_store_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/scan_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/scan_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/scheduler_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/scheduler_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/stream_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/stream_pb2_grpc.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/template_pb2.py (100%) rename presidio-analyzer/presidio_analyzer/{ => protobuf_models}/template_pb2_grpc.py (100%) diff --git a/presidio-analyzer/presidio_analyzer/__main__.py b/presidio-analyzer/presidio_analyzer/__main__.py index 202a345a6..b7e18982e 100644 --- a/presidio-analyzer/presidio_analyzer/__main__.py +++ b/presidio-analyzer/presidio_analyzer/__main__.py @@ -1,8 +1,8 @@ # pylint: disable=wrong-import-position,wrong-import-order import logging import grpc -import analyze_pb2 -import analyze_pb2_grpc +from protobuf_models import analyze_pb2 +from protobuf_models import analyze_pb2_grpc from concurrent import futures import os import sys diff --git a/presidio-analyzer/presidio_analyzer/analyzer_engine.py b/presidio-analyzer/presidio_analyzer/analyzer_engine.py index 92ea18fad..eaeedf12c 100644 --- a/presidio-analyzer/presidio_analyzer/analyzer_engine.py +++ b/presidio-analyzer/presidio_analyzer/analyzer_engine.py @@ -1,9 +1,9 @@ import json import uuid -import analyze_pb2 -import analyze_pb2_grpc -import common_pb2 +from protobuf_models import analyze_pb2 +from protobuf_models import analyze_pb2_grpc +from protobuf_models import common_pb2 from presidio_analyzer import PresidioLogger from presidio_analyzer.app_tracer import AppTracer diff --git a/presidio-analyzer/presidio_analyzer/protobuf_models/__init__.py b/presidio-analyzer/presidio_analyzer/protobuf_models/__init__.py new file mode 100644 index 000000000..3dc3922af --- /dev/null +++ b/presidio-analyzer/presidio_analyzer/protobuf_models/__init__.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.append(str(Path(__file__).parent)) diff --git a/presidio-analyzer/presidio_analyzer/analyze_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/analyze_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/analyze_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/analyze_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/analyze_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/analyze_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/analyze_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/analyze_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_image_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_image_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_image_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_image_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_image_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_image_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_image_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_image_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_json_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_json_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_json_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_json_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_json_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_json_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_json_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_json_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/anonymize_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/anonymize_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/anonymize_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/common_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/common_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/common_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/common_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/common_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/common_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/common_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/common_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/datasink_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/datasink_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/datasink_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/datasink_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/datasink_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/datasink_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/datasink_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/datasink_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/ocr_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/ocr_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/ocr_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/ocr_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/ocr_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/ocr_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/ocr_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/ocr_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/recognizers_store_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/recognizers_store_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/recognizers_store_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/recognizers_store_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/recognizers_store_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/recognizers_store_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/recognizers_store_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/recognizers_store_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/scan_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/scan_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/scan_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/scan_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/scan_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/scan_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/scan_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/scan_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/scheduler_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/scheduler_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/scheduler_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/scheduler_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/scheduler_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/scheduler_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/scheduler_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/scheduler_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/stream_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/stream_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/stream_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/stream_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/stream_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/stream_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/stream_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/stream_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/template_pb2.py b/presidio-analyzer/presidio_analyzer/protobuf_models/template_pb2.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/template_pb2.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/template_pb2.py diff --git a/presidio-analyzer/presidio_analyzer/template_pb2_grpc.py b/presidio-analyzer/presidio_analyzer/protobuf_models/template_pb2_grpc.py similarity index 100% rename from presidio-analyzer/presidio_analyzer/template_pb2_grpc.py rename to presidio-analyzer/presidio_analyzer/protobuf_models/template_pb2_grpc.py diff --git a/presidio-analyzer/presidio_analyzer/recognizer_registry/recognizers_store_api.py b/presidio-analyzer/presidio_analyzer/recognizer_registry/recognizers_store_api.py index 952885254..1af933f72 100644 --- a/presidio-analyzer/presidio_analyzer/recognizer_registry/recognizers_store_api.py +++ b/presidio-analyzer/presidio_analyzer/recognizer_registry/recognizers_store_api.py @@ -2,8 +2,8 @@ import os import grpc -import recognizers_store_pb2 -import recognizers_store_pb2_grpc +from protobuf_models import recognizers_store_pb2 +from protobuf_models import recognizers_store_pb2_grpc from presidio_analyzer import PatternRecognizer from presidio_analyzer import Pattern diff --git a/presidio-analyzer/tests/test_analyzer_engine.py b/presidio-analyzer/tests/test_analyzer_engine.py index 013e020a0..c18e25fd0 100644 --- a/presidio-analyzer/tests/test_analyzer_engine.py +++ b/presidio-analyzer/tests/test_analyzer_engine.py @@ -6,8 +6,8 @@ from presidio_analyzer import AnalyzerEngine, PatternRecognizer, Pattern, \ RecognizerResult, RecognizerRegistry, AnalysisExplanation from presidio_analyzer import PresidioLogger -from presidio_analyzer.analyze_pb2 import AnalyzeRequest -from presidio_analyzer.analyze_pb2 import RecognizersAllRequest +from presidio_analyzer.protobuf_models.analyze_pb2 import AnalyzeRequest, \ + RecognizersAllRequest from presidio_analyzer.entity_recognizer import EntityRecognizer from presidio_analyzer.nlp_engine import NlpArtifacts from presidio_analyzer.predefined_recognizers import CreditCardRecognizer, \ @@ -561,4 +561,4 @@ def test_get_recognizers_returns_supported_language(self): request = RecognizersAllRequest(language="ru") response = analyze_engine.GetAllRecognizers(request, None) # there is only 1 mocked russian recognizer - assert len(response) == 1 \ No newline at end of file + assert len(response) == 1