Skip to content

Commit

Permalink
Move remaining modules out of google.fhir, allowing that to become a …
Browse files Browse the repository at this point in the history
…Python namespace package.

PiperOrigin-RevId: 448346086
  • Loading branch information
rbrush authored and nickgeorge committed May 17, 2022
1 parent 25ce132 commit a24f15b
Show file tree
Hide file tree
Showing 49 changed files with 233 additions and 226 deletions.
104 changes: 104 additions & 0 deletions py/google/fhir/core/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
load(
"@rules_python//python:python.bzl",
"py_library",
"py_test",
)
load("@fhir_bazel_pip_dependencies//:requirements.bzl", "requirement")

package(
default_visibility = [
"//visibility:public",
],
)

licenses(["notice"])

py_library(
name = "codes",
srcs = [
"codes.py",
],
srcs_version = "PY3",
deps = [
":fhir_errors",
"//py",
"//proto/google/fhir/proto:annotations_py_pb2",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:fhir_types",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
],
)

py_library(
name = "fhir_errors",
srcs = [
"fhir_errors.py",
],
srcs_version = "PY3",
deps = ["//py"],
)

py_test(
name = "fhir_errors_test",
srcs = ["fhir_errors_test.py"],
legacy_create_init = 0,
python_version = "PY3",
srcs_version = "PY3",
deps = [
":fhir_errors",
"//py",
requirement("absl-py"),
requirement("six"),
],
)

py_library(
name = "extensions",
srcs = [
":extensions.py",
],
srcs_version = "PY3",
deps = [
":codes",
":fhir_errors",
"//py",
"//proto/google/fhir/proto:annotations_py_pb2",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:fhir_types",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
],
)

py_library(
name = "extensions_test",
testonly = 1,
srcs = [
":extensions_test.py",
],
srcs_version = "PY3",
deps = [
":extensions",
"@com_google_protobuf//:protobuf_python",
"//py",
"//py/google/fhir/core/testing:testdata_utils",
requirement("absl-py"),
requirement("six"),
],
)

py_library(
name = "references",
srcs = [
":references.py",
],
srcs_version = "PY3",
deps = [
"//py",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:path_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
],
)
2 changes: 1 addition & 1 deletion py/google/fhir/codes.py → py/google/fhir/core/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from google.protobuf import descriptor
from google.protobuf import message
from proto.google.fhir.proto import annotations_pb2
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import fhir_types
from google.fhir.core.utils import proto_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from google.protobuf import descriptor
from google.protobuf import message
from proto.google.fhir.proto import annotations_pb2
from google.fhir import codes
from google.fhir import fhir_errors
from google.fhir.core import codes
from google.fhir.core import fhir_errors
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import fhir_types
from google.fhir.core.utils import proto_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

from google.protobuf import message
from absl.testing import absltest
from google.fhir import extensions
from google.fhir.testing import testdata_utils
from google.fhir.core import extensions
from google.fhir.core.testing import testdata_utils


class ExtensionsTest(absltest.TestCase, metaclass=abc.ABCMeta):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Unit tests exercising `fhir_errors.py` functionality."""

from absl.testing import absltest
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors


class ListErrorReporterTests(absltest.TestCase):
Expand Down
8 changes: 4 additions & 4 deletions py/google/fhir/core/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ py_library(
":primitive_time_utils",
"@com_google_protobuf//:protobuf_python",
"//py",
"//py/google/fhir:extensions",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/testing:testdata_utils",
"//py/google/fhir/core:extensions",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/testing:testdata_utils",
"//py/google/fhir/core/utils:path_utils",
"//py/google/fhir/core/utils:proto_utils",
requirement("absl-py"),
Expand All @@ -81,7 +81,7 @@ py_library(
":primitive_time_utils",
"//py",
"//proto/google/fhir/proto:annotations_py_pb2",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:fhir_types",
"//py/google/fhir/core/utils:proto_utils",
Expand Down
14 changes: 7 additions & 7 deletions py/google/fhir/core/internal/json_format/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ py_library(
srcs_version = "PY3",
deps = [
"//py",
"//py/google/fhir:extensions",
"//py/google/fhir:references",
"//py/google/fhir/core:extensions",
"//py/google/fhir/core:references",
"//py/google/fhir/core/internal:primitive_handler",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:fhir_types",
Expand All @@ -44,7 +44,7 @@ py_library(
deps = [
"@com_google_protobuf//:protobuf_python",
"//py",
"//py/google/fhir/testing:testdata_utils",
"//py/google/fhir/core/testing:testdata_utils",
requirement("absl-py"),
requirement("six"),
],
Expand All @@ -60,15 +60,15 @@ py_test(
"//py",
"//proto/google/fhir/proto/r4:primitive_test_suite_py_pb2",
"//proto/google/fhir/proto/r4/core:datatypes_py_pb2",
"//py/google/fhir:extensions",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:extensions",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/testing:protobuf_compare",
"//py/google/fhir/core/testing:testdata_utils",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:fhir_types",
"//py/google/fhir/core/utils:path_utils",
"//py/google/fhir/core/utils:proto_utils",
"//py/google/fhir/r4:json_format",
"//py/google/fhir/testing:protobuf_compare",
"//py/google/fhir/testing:testdata_utils",
"@com_google_protobuf//:protobuf_python",
],
)
4 changes: 2 additions & 2 deletions py/google/fhir/core/internal/json_format/_json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from google.protobuf import any_pb2
from google.protobuf import descriptor
from google.protobuf import message
from google.fhir import extensions
from google.fhir import references
from google.fhir.core import extensions
from google.fhir.core import references
from google.fhir.core.internal import primitive_handler
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import proto_utils
Expand Down
2 changes: 1 addition & 1 deletion py/google/fhir/core/internal/json_format/_json_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from google.protobuf import any_pb2
from google.protobuf import descriptor
from google.protobuf import message
from google.fhir import references
from google.fhir.core import references
from google.fhir.core.internal import primitive_handler
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import fhir_types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
from absl.testing import absltest
from proto.google.fhir.proto.r4 import primitive_test_suite_pb2
from proto.google.fhir.proto.r4.core import datatypes_pb2
from google.fhir import extensions
from google.fhir import fhir_errors
from google.fhir.core import extensions
from google.fhir.core import fhir_errors
from google.fhir.core.testing import protobuf_compare
from google.fhir.core.testing import testdata_utils
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import fhir_types
from google.fhir.core.utils import path_utils
from google.fhir.core.utils import proto_utils
from google.fhir.r4 import json_format
from google.fhir.testing import protobuf_compare
from google.fhir.testing import testdata_utils

_PRIMITIVE_TESTS_PATH = os.path.join('testdata', 'primitives')

Expand Down Expand Up @@ -122,7 +122,9 @@ def test_valid_pairs(self):
actual_json = self.json_format.print_fhir_to_json_string( # pytype: disable=not-callable # trace-all-classes
expected_proto)
actual_proto = self.json_format.json_fhir_string_to_proto( # pytype: disable=not-callable # trace-all-classes
actual_json, field_type, default_timezone='Australia/Sydney')
actual_json,
field_type,
default_timezone='Australia/Sydney')

self.assertEqual(expected_json, actual_json)
self.assertProtoEqual(expected_proto, actual_proto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from google.protobuf import message
from absl.testing import parameterized
from google.fhir.testing import testdata_utils
from google.fhir.core.testing import testdata_utils

_T = TypeVar('_T', bound=message.Message)

Expand Down
18 changes: 9 additions & 9 deletions py/google/fhir/core/internal/json_format/wrappers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ py_library(
deps = [
":primitive_wrappers",
"//py",
"//py/google/fhir:extensions",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:extensions",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
],
Expand All @@ -38,7 +38,7 @@ py_library(
deps = [
":primitive_wrappers",
"//py",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/internal:primitive_time_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
Expand All @@ -55,7 +55,7 @@ py_library(
deps = [
":primitive_wrappers",
"//py",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/internal:primitive_time_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
Expand Down Expand Up @@ -86,7 +86,7 @@ py_library(
deps = [
":primitive_wrappers",
"//py",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/internal:primitive_time_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
Expand All @@ -102,9 +102,9 @@ py_library(
srcs_version = "PY3",
deps = [
"//py",
"//py/google/fhir:codes",
"//py/google/fhir:extensions",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:codes",
"//py/google/fhir/core:extensions",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/utils:annotation_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
Expand All @@ -121,7 +121,7 @@ py_library(
deps = [
":primitive_wrappers",
"//py",
"//py/google/fhir:fhir_errors",
"//py/google/fhir/core:fhir_errors",
"//py/google/fhir/core/internal:primitive_time_utils",
"//py/google/fhir/core/utils:proto_utils",
"@com_google_protobuf//:protobuf_python",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from typing import Any, List, Tuple, Type, TypeVar, cast

from google.protobuf import message
from google.fhir import extensions
from google.fhir import fhir_errors
from google.fhir.core import extensions
from google.fhir.core import fhir_errors
from google.fhir.core.internal.json_format.wrappers import _primitive_wrappers
from google.fhir.core.utils import proto_utils

Expand Down
2 changes: 1 addition & 1 deletion py/google/fhir/core/internal/json_format/wrappers/_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Callable, Dict, Tuple, Type, TypeVar, cast

from google.protobuf import message
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors
from google.fhir.core.internal import _primitive_time_utils
from google.fhir.core.internal.json_format.wrappers import _primitive_wrappers
from google.fhir.core.utils import proto_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Callable, Dict, Tuple, Type, TypeVar

from google.protobuf import message
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors
from google.fhir.core.internal import _primitive_time_utils
from google.fhir.core.internal.json_format.wrappers import _primitive_wrappers
from google.fhir.core.utils import proto_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Callable, Dict, Tuple, Type, TypeVar

from google.protobuf import message
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors
from google.fhir.core.internal import _primitive_time_utils
from google.fhir.core.internal.json_format.wrappers import _primitive_wrappers
from google.fhir.core.utils import proto_utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

from google.protobuf import descriptor
from google.protobuf import message

from google.fhir import codes
from google.fhir import extensions
from google.fhir import fhir_errors
from google.fhir.core import codes
from google.fhir.core import extensions
from google.fhir.core import fhir_errors
from google.fhir.core.utils import annotation_utils
from google.fhir.core.utils import proto_utils

Expand Down
2 changes: 1 addition & 1 deletion py/google/fhir/core/internal/json_format/wrappers/_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Callable, Dict, Tuple, Type, TypeVar

from google.protobuf import message
from google.fhir import fhir_errors
from google.fhir.core import fhir_errors
from google.fhir.core.internal import _primitive_time_utils
from google.fhir.core.internal.json_format.wrappers import _primitive_wrappers
from google.fhir.core.utils import proto_utils
Expand Down
Loading

0 comments on commit a24f15b

Please sign in to comment.